mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
feat: bump deps (#14076)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Updated core dependencies, developer tooling and Rust toolchain to
newer stable versions across the repo
* Upgraded Storybook to v10 and improved ESM path resolution for
storybook tooling
* Broadened native binding platform/architecture support and
strengthened native module version validation, loading and WASI handling
* **New Features**
* Exposed an additional native text export for consumers (enhanced
JS/native surface)
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -32,10 +32,7 @@
|
||||
"build:debug": "napi build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"lib0": "^0.2.99",
|
||||
"tiktoken": "^1.0.17",
|
||||
"tinybench": "^4.0.0",
|
||||
"yjs": "^13.6.21"
|
||||
"@napi-rs/cli": "3.5.0",
|
||||
"tiktoken": "^1.0.17"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@
|
||||
"dependencies": {
|
||||
"@affine/reader": "workspace:*",
|
||||
"@affine/server-native": "workspace:*",
|
||||
"@ai-sdk/anthropic": "^2.0.38",
|
||||
"@ai-sdk/google": "^2.0.24",
|
||||
"@ai-sdk/google-vertex": "^3.0.54",
|
||||
"@ai-sdk/openai": "^2.0.56",
|
||||
"@ai-sdk/openai-compatible": "^1.0.23",
|
||||
"@ai-sdk/perplexity": "^2.0.14",
|
||||
"@apollo/server": "^4.11.3",
|
||||
"@aws-sdk/client-s3": "^3.779.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.779.0",
|
||||
"@ai-sdk/anthropic": "^2.0.53",
|
||||
"@ai-sdk/google": "^2.0.45",
|
||||
"@ai-sdk/google-vertex": "^3.0.87",
|
||||
"@ai-sdk/openai": "^2.0.80",
|
||||
"@ai-sdk/openai-compatible": "^1.0.28",
|
||||
"@ai-sdk/perplexity": "^2.0.21",
|
||||
"@apollo/server": "^4.12.2",
|
||||
"@aws-sdk/client-s3": "^3.947.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.947.0",
|
||||
"@fal-ai/serverless-client": "^0.15.0",
|
||||
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.4.1",
|
||||
"@google-cloud/opentelemetry-resource-util": "^2.4.0",
|
||||
"@google-cloud/opentelemetry-cloud-trace-exporter": "^3.0.0",
|
||||
"@google-cloud/opentelemetry-resource-util": "^3.0.0",
|
||||
"@modelcontextprotocol/sdk": "^1.24.3",
|
||||
"@nestjs-cls/transactional": "^2.6.1",
|
||||
"@nestjs-cls/transactional-adapter-prisma": "^1.2.19",
|
||||
@@ -56,26 +56,26 @@
|
||||
"@node-rs/argon2": "^2.0.2",
|
||||
"@node-rs/crc32": "^1.10.6",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/core": "^1.30.1",
|
||||
"@opentelemetry/exporter-prometheus": "^0.57.2",
|
||||
"@opentelemetry/exporter-zipkin": "^1.30.1",
|
||||
"@opentelemetry/host-metrics": "^0.36.0",
|
||||
"@opentelemetry/instrumentation": "^0.57.2",
|
||||
"@opentelemetry/instrumentation-graphql": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-http": "^0.57.2",
|
||||
"@opentelemetry/instrumentation-ioredis": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-nestjs-core": "^0.54.0",
|
||||
"@opentelemetry/instrumentation-socket.io": "^0.54.0",
|
||||
"@opentelemetry/resources": "^1.30.1",
|
||||
"@opentelemetry/sdk-metrics": "^1.30.1",
|
||||
"@opentelemetry/sdk-node": "^0.57.2",
|
||||
"@opentelemetry/sdk-trace-node": "^1.30.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.28.0",
|
||||
"@opentelemetry/core": "^2.2.0",
|
||||
"@opentelemetry/exporter-prometheus": "^0.208.0",
|
||||
"@opentelemetry/exporter-zipkin": "^2.2.0",
|
||||
"@opentelemetry/host-metrics": "^0.37.0",
|
||||
"@opentelemetry/instrumentation": "^0.208.0",
|
||||
"@opentelemetry/instrumentation-graphql": "^0.56.0",
|
||||
"@opentelemetry/instrumentation-http": "^0.208.0",
|
||||
"@opentelemetry/instrumentation-ioredis": "^0.56.0",
|
||||
"@opentelemetry/instrumentation-nestjs-core": "^0.55.0",
|
||||
"@opentelemetry/instrumentation-socket.io": "^0.55.0",
|
||||
"@opentelemetry/resources": "^2.2.0",
|
||||
"@opentelemetry/sdk-metrics": "^2.2.0",
|
||||
"@opentelemetry/sdk-node": "^0.208.0",
|
||||
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.38.0",
|
||||
"@prisma/client": "^6.6.0",
|
||||
"@prisma/instrumentation": "^6.7.0",
|
||||
"@react-email/components": "0.0.38",
|
||||
"@socket.io/redis-adapter": "^8.3.0",
|
||||
"ai": "^5.0.81",
|
||||
"ai": "^5.0.108",
|
||||
"bullmq": "^5.40.2",
|
||||
"cookie-parser": "^1.4.7",
|
||||
"cross-env": "^7.0.3",
|
||||
@@ -128,7 +128,7 @@
|
||||
"@affine-tools/cli": "workspace:*",
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@affine/graphql": "workspace:*",
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
"@faker-js/faker": "^10.1.0",
|
||||
"@nestjs/swagger": "^11.2.0",
|
||||
"@nestjs/testing": "patch:@nestjs/testing@npm%3A10.4.15#~/.yarn/patches/@nestjs-testing-npm-10.4.15-d591a1705a.patch",
|
||||
"@types/cookie-parser": "^1.4.8",
|
||||
@@ -148,7 +148,7 @@
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"ava": "^6.2.0",
|
||||
"ava": "^6.4.0",
|
||||
"c8": "^10.1.3",
|
||||
"nodemon": "^3.1.7",
|
||||
"react-email": "4.0.11",
|
||||
|
||||
@@ -13,8 +13,8 @@ import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
||||
import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis';
|
||||
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';
|
||||
import { SocketIoInstrumentation } from '@opentelemetry/instrumentation-socket.io';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { MetricProducer, MetricReader } from '@opentelemetry/sdk-metrics';
|
||||
import { resourceFromAttributes } from '@opentelemetry/resources';
|
||||
import { IMetricReader, MetricProducer } from '@opentelemetry/sdk-metrics';
|
||||
import { NodeSDK, NodeSDKConfiguration } from '@opentelemetry/sdk-node';
|
||||
import {
|
||||
BatchSpanProcessor,
|
||||
@@ -34,7 +34,7 @@ import { registerCustomMetrics } from './metrics';
|
||||
import { PrismaMetricProducer } from './prisma';
|
||||
|
||||
export abstract class BaseOpentelemetryOptionsFactory {
|
||||
abstract getMetricReader(): MetricReader;
|
||||
abstract getMetricReader(): IMetricReader;
|
||||
abstract getSpanExporter(): SpanExporter;
|
||||
|
||||
getInstractions(): Instrumentation[] {
|
||||
@@ -53,7 +53,7 @@ export abstract class BaseOpentelemetryOptionsFactory {
|
||||
}
|
||||
|
||||
getResource() {
|
||||
return new Resource({
|
||||
return resourceFromAttributes({
|
||||
[ATTR_K8S_NAMESPACE_NAME]: env.NAMESPACE,
|
||||
[ATTR_SERVICE_NAME]: env.FLAVOR,
|
||||
[ATTR_SERVICE_VERSION]: env.version,
|
||||
@@ -82,7 +82,7 @@ export abstract class BaseOpentelemetryOptionsFactory {
|
||||
|
||||
@Injectable()
|
||||
export class OpentelemetryOptionsFactory extends BaseOpentelemetryOptionsFactory {
|
||||
override getMetricReader(): MetricReader {
|
||||
override getMetricReader(): IMetricReader {
|
||||
return new PrometheusExporter({
|
||||
metricProducers: this.getMetricsProducers(),
|
||||
});
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { HrTime, ValueType } from '@opentelemetry/api';
|
||||
import { hrTime } from '@opentelemetry/core';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { emptyResource } from '@opentelemetry/resources';
|
||||
import {
|
||||
AggregationTemporality,
|
||||
CollectionResult,
|
||||
DataPointType,
|
||||
InstrumentType,
|
||||
MetricProducer,
|
||||
ScopeMetrics,
|
||||
} from '@opentelemetry/sdk-metrics';
|
||||
@@ -24,7 +23,7 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
async collect(): Promise<CollectionResult> {
|
||||
const result: CollectionResult = {
|
||||
resourceMetrics: {
|
||||
resource: Resource.EMPTY,
|
||||
resource: emptyResource(),
|
||||
scopeMetrics: [],
|
||||
},
|
||||
errors: [],
|
||||
@@ -51,7 +50,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(counter.key),
|
||||
description: counter.description,
|
||||
unit: '1',
|
||||
type: InstrumentType.COUNTER,
|
||||
valueType: ValueType.INT,
|
||||
},
|
||||
dataPointType: DataPointType.SUM,
|
||||
@@ -74,7 +72,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(gauge.key),
|
||||
description: gauge.description,
|
||||
unit: '1',
|
||||
type: InstrumentType.UP_DOWN_COUNTER,
|
||||
valueType: ValueType.INT,
|
||||
},
|
||||
dataPointType: DataPointType.GAUGE,
|
||||
@@ -102,7 +99,6 @@ export class PrismaMetricProducer implements MetricProducer {
|
||||
name: transformPrismaKey(histogram.key),
|
||||
description: histogram.description,
|
||||
unit: 'ms',
|
||||
type: InstrumentType.HISTOGRAM,
|
||||
valueType: ValueType.DOUBLE,
|
||||
},
|
||||
dataPointType: DataPointType.HISTOGRAM,
|
||||
|
||||
@@ -1,29 +1,35 @@
|
||||
import { TraceExporter } from '@google-cloud/opentelemetry-cloud-trace-exporter';
|
||||
import { GcpDetectorSync } from '@google-cloud/opentelemetry-resource-util';
|
||||
import { Global, Injectable, Module, Provider } from '@nestjs/common';
|
||||
import { getEnv } from '@opentelemetry/core';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import {
|
||||
type Resource,
|
||||
resourceFromAttributes,
|
||||
} from '@opentelemetry/resources';
|
||||
import { SpanExporter } from '@opentelemetry/sdk-trace-node';
|
||||
import {
|
||||
SEMRESATTRS_CONTAINER_NAME,
|
||||
SEMRESATTRS_K8S_POD_NAME,
|
||||
} from '@opentelemetry/semantic-conventions';
|
||||
ATTR_CONTAINER_NAME,
|
||||
ATTR_K8S_POD_NAME,
|
||||
} from '@opentelemetry/semantic-conventions/incubating';
|
||||
|
||||
import { OpentelemetryOptionsFactory } from '../../base/metrics';
|
||||
|
||||
@Injectable()
|
||||
export class GCloudOpentelemetryOptionsFactory extends OpentelemetryOptionsFactory {
|
||||
override getResource(): Resource {
|
||||
const env = getEnv();
|
||||
const envAttrs: Record<string, string> = {};
|
||||
if (process.env.HOSTNAME) {
|
||||
envAttrs[ATTR_K8S_POD_NAME] = process.env.HOSTNAME;
|
||||
}
|
||||
if (process.env.CONTAINER_NAME) {
|
||||
envAttrs[ATTR_CONTAINER_NAME] = process.env.CONTAINER_NAME;
|
||||
}
|
||||
|
||||
const detected = new GcpDetectorSync().detect();
|
||||
|
||||
return super
|
||||
.getResource()
|
||||
.merge(
|
||||
new Resource({
|
||||
[SEMRESATTRS_K8S_POD_NAME]: env.HOSTNAME,
|
||||
[SEMRESATTRS_CONTAINER_NAME]: env.CONTAINER_NAME,
|
||||
})
|
||||
)
|
||||
.merge(new GcpDetectorSync().detect());
|
||||
.merge(resourceFromAttributes(envAttrs))
|
||||
.merge(resourceFromAttributes(detected.attributes ?? {}));
|
||||
}
|
||||
|
||||
override getSpanExporter(): SpanExporter {
|
||||
|
||||
@@ -99,11 +99,11 @@ impl Update {
|
||||
Ok(encoder.into_inner())
|
||||
}
|
||||
|
||||
pub(crate) fn iter(&mut self, state: StateVector) -> UpdateIterator {
|
||||
pub(crate) fn iter(&mut self, state: StateVector) -> UpdateIterator<'_> {
|
||||
UpdateIterator::new(self, state)
|
||||
}
|
||||
|
||||
pub fn delete_set_iter(&mut self, state: StateVector) -> DeleteSetIterator {
|
||||
pub fn delete_set_iter(&mut self, state: StateVector) -> DeleteSetIterator<'_> {
|
||||
DeleteSetIterator::new(self, state)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ impl<T> SomrInner<T> {
|
||||
self.data.as_ref().map(|x| unsafe { &*x.get() })
|
||||
}
|
||||
|
||||
fn data_mut(&self) -> Option<InnerRefMut<T>> {
|
||||
fn data_mut(&self) -> Option<InnerRefMut<'_, T>> {
|
||||
self.data.as_ref().map(|x| InnerRefMut {
|
||||
inner: unsafe { NonNull::new_unchecked(x.get()) },
|
||||
_marker: PhantomData,
|
||||
@@ -145,7 +145,7 @@ impl<T> Somr<T> {
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub unsafe fn get_mut_from_ref(&self) -> Option<InnerRefMut<T>> {
|
||||
pub unsafe fn get_mut_from_ref(&self) -> Option<InnerRefMut<'_, T>> {
|
||||
if !self.is_owned() || self.dangling() {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Array {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> ArrayIter {
|
||||
pub fn iter(&self) -> ArrayIter<'_> {
|
||||
ArrayIter(self.iter_item())
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ pub(crate) trait ListType: AsInner<Inner = YTypeRef> {
|
||||
self.as_inner().ty().unwrap().len
|
||||
}
|
||||
|
||||
fn iter_item(&self) -> ListIterator {
|
||||
fn iter_item(&self) -> ListIterator<'_> {
|
||||
let inner = self.as_inner().ty().unwrap();
|
||||
ListIterator {
|
||||
cur: inner.start.clone(),
|
||||
|
||||
@@ -67,7 +67,7 @@ pub(crate) trait MapType: AsInner<Inner = YTypeRef> {
|
||||
self._keys().count() as u64
|
||||
}
|
||||
|
||||
fn _iter(&self) -> EntriesInnerIterator {
|
||||
fn _iter(&self) -> EntriesInnerIterator<'_> {
|
||||
let ty = self.as_inner().ty();
|
||||
|
||||
if let Some(ty) = ty {
|
||||
@@ -85,15 +85,15 @@ pub(crate) trait MapType: AsInner<Inner = YTypeRef> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _keys(&self) -> KeysIterator {
|
||||
fn _keys(&self) -> KeysIterator<'_> {
|
||||
KeysIterator(self._iter())
|
||||
}
|
||||
|
||||
fn _values(&self) -> ValuesIterator {
|
||||
fn _values(&self) -> ValuesIterator<'_> {
|
||||
ValuesIterator(self._iter())
|
||||
}
|
||||
|
||||
fn _entries(&self) -> EntriesIterator {
|
||||
fn _entries(&self) -> EntriesIterator<'_> {
|
||||
EntriesIterator(self._iter())
|
||||
}
|
||||
}
|
||||
@@ -185,22 +185,22 @@ impl Map {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn iter(&self) -> EntriesIterator {
|
||||
pub fn iter(&self) -> EntriesIterator<'_> {
|
||||
self._entries()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn entries(&self) -> EntriesIterator {
|
||||
pub fn entries(&self) -> EntriesIterator<'_> {
|
||||
self._entries()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn keys(&self) -> KeysIterator {
|
||||
pub fn keys(&self) -> KeysIterator<'_> {
|
||||
self._keys()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn values(&self) -> ValuesIterator {
|
||||
pub fn values(&self) -> ValuesIterator<'_> {
|
||||
self._values()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ impl YTypeRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ty(&self) -> Option<RwLockReadGuard<YType>> {
|
||||
pub fn ty(&self) -> Option<RwLockReadGuard<'_, YType>> {
|
||||
self.inner.get().and_then(|ty| ty.read().ok())
|
||||
}
|
||||
|
||||
pub fn ty_mut(&self) -> Option<RwLockWriteGuard<YType>> {
|
||||
pub fn ty_mut(&self) -> Option<RwLockWriteGuard<'_, YType>> {
|
||||
self.inner.get().and_then(|ty| ty.write().ok())
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ impl YTypeRef {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn read(&self) -> Option<(RwLockReadGuard<DocStore>, RwLockReadGuard<YType>)> {
|
||||
pub fn read(&self) -> Option<(RwLockReadGuard<'_, DocStore>, RwLockReadGuard<'_, YType>)> {
|
||||
self
|
||||
.store()
|
||||
.and_then(|store| self.ty().map(|ty| (store, ty)))
|
||||
}
|
||||
|
||||
pub fn write(&self) -> Option<(RwLockWriteGuard<DocStore>, RwLockWriteGuard<YType>)> {
|
||||
pub fn write(&self) -> Option<(RwLockWriteGuard<'_, DocStore>, RwLockWriteGuard<'_, YType>)> {
|
||||
self
|
||||
.store_mut()
|
||||
.and_then(|store| self.ty_mut().map(|ty| (store, ty)))
|
||||
|
||||
@@ -5,7 +5,7 @@ pub struct SyncMessageScanner<'a> {
|
||||
}
|
||||
|
||||
impl SyncMessageScanner<'_> {
|
||||
pub fn new(buffer: &[u8]) -> SyncMessageScanner {
|
||||
pub fn new(buffer: &[u8]) -> SyncMessageScanner<'_> {
|
||||
SyncMessageScanner { buffer }
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -28,7 +28,6 @@ export declare class YArray {
|
||||
}
|
||||
|
||||
export declare class YMap {
|
||||
constructor()
|
||||
get length(): number
|
||||
get isEmpty(): boolean
|
||||
get<T = unknown>(key: string): T
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { createRequire } = require('node:module')
|
||||
require = createRequire(__filename);
|
||||
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null;
|
||||
const loadErrors = [];
|
||||
|
||||
@@ -68,7 +65,7 @@ const isMuslFromChildProcess = () => {
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err);
|
||||
}
|
||||
@@ -80,7 +77,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-android-arm64');
|
||||
const binding = require('@y-octo/node-android-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-android-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -91,7 +100,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-android-arm-eabi');
|
||||
const binding = require('@y-octo/node-android-arm-eabi');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-android-arm-eabi/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -102,15 +123,55 @@ function requireNative() {
|
||||
}
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./y-octo.win32-x64-msvc.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-x64-msvc');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
if (
|
||||
process.config?.variables?.shlib_suffix === 'dll.a' ||
|
||||
process.config?.variables?.node_target_type === 'shared_library'
|
||||
) {
|
||||
try {
|
||||
return require('./y-octo.win32-x64-gnu.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-win32-x64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-x64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./y-octo.win32-x64-msvc.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-win32-x64-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-x64-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ia32') {
|
||||
try {
|
||||
@@ -119,7 +180,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-ia32-msvc');
|
||||
const binding = require('@y-octo/node-win32-ia32-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-ia32-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -130,7 +203,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-win32-arm64-msvc');
|
||||
const binding = require('@y-octo/node-win32-arm64-msvc');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-win32-arm64-msvc/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -146,11 +231,22 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-universal');
|
||||
const binding = require('@y-octo/node-darwin-universal');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-universal/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./y-octo.darwin-x64.node');
|
||||
@@ -158,7 +254,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-x64');
|
||||
const binding = require('@y-octo/node-darwin-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -169,7 +277,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-darwin-arm64');
|
||||
const binding = require('@y-octo/node-darwin-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-darwin-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -186,7 +306,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-freebsd-x64');
|
||||
const binding = require('@y-octo/node-freebsd-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-freebsd-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -197,7 +329,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-freebsd-arm64');
|
||||
const binding = require('@y-octo/node-freebsd-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-freebsd-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -215,7 +359,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-x64-musl');
|
||||
const binding = require('@y-octo/node-linux-x64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-x64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -226,7 +382,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-x64-gnu');
|
||||
const binding = require('@y-octo/node-linux-x64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-x64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -239,7 +407,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm64-musl');
|
||||
const binding = require('@y-octo/node-linux-arm64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -250,7 +430,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm64-gnu');
|
||||
const binding = require('@y-octo/node-linux-arm64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -263,7 +455,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm-musleabihf');
|
||||
const binding = require('@y-octo/node-linux-arm-musleabihf');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm-musleabihf/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -274,7 +478,67 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-arm-gnueabihf');
|
||||
const binding = require('@y-octo/node-linux-arm-gnueabihf');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-arm-gnueabihf/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./y-octo.linux-loong64-musl.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-linux-loong64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-loong64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./y-octo.linux-loong64-gnu.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-linux-loong64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-loong64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -287,7 +551,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-riscv64-musl');
|
||||
const binding = require('@y-octo/node-linux-riscv64-musl');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-riscv64-musl/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -298,7 +574,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-riscv64-gnu');
|
||||
const binding = require('@y-octo/node-linux-riscv64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-riscv64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -310,7 +598,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-ppc64-gnu');
|
||||
const binding = require('@y-octo/node-linux-ppc64-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-ppc64-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -321,7 +621,19 @@ function requireNative() {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
return require('@y-octo/node-linux-s390x-gnu');
|
||||
const binding = require('@y-octo/node-linux-s390x-gnu');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-linux-s390x-gnu/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
@@ -330,6 +642,81 @@ function requireNative() {
|
||||
new Error(`Unsupported architecture on Linux: ${process.arch}`)
|
||||
);
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./y-octo.openharmony-arm64.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-arm64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-arm64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./y-octo.openharmony-x64.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-x64');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-x64/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./y-octo.openharmony-arm.node');
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
try {
|
||||
const binding = require('@y-octo/node-openharmony-arm');
|
||||
const bindingPackageVersion =
|
||||
require('@y-octo/node-openharmony-arm/package.json').version;
|
||||
if (
|
||||
bindingPackageVersion !== '0.25.7' &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
|
||||
process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
|
||||
) {
|
||||
throw new Error(
|
||||
`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`
|
||||
);
|
||||
}
|
||||
return binding;
|
||||
} catch (e) {
|
||||
loadErrors.push(e);
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(
|
||||
new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(
|
||||
new Error(
|
||||
@@ -342,35 +729,54 @@ function requireNative() {
|
||||
nativeBinding = requireNative();
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null;
|
||||
let wasiBindingError = null;
|
||||
try {
|
||||
nativeBinding = require('./y-octo.wasi.cjs');
|
||||
wasiBinding = require('./y-octo.wasi.cjs');
|
||||
nativeBinding = wasiBinding;
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
loadErrors.push(err);
|
||||
wasiBindingError = err;
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
try {
|
||||
nativeBinding = require('@y-octo/node-wasm32-wasi');
|
||||
wasiBinding = require('@y-octo/node-wasm32-wasi');
|
||||
nativeBinding = wasiBinding;
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError.cause = err;
|
||||
loadErrors.push(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error(
|
||||
'WASI binding not found and NAPI_RS_FORCE_WASI is set to error'
|
||||
);
|
||||
error.cause = wasiBindingError;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
if (loadErrors.length > 0) {
|
||||
// TODO Link to documentation with potential fixes
|
||||
// - The package owner could build/publish bindings for this arch
|
||||
// - The user may need to bundle the correct files
|
||||
// - The user may need to re-install node_modules to get new packages
|
||||
throw new Error('Failed to load native binding', { cause: loadErrors });
|
||||
throw new Error(
|
||||
`Cannot find native binding. ` +
|
||||
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
||||
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
||||
{
|
||||
cause: loadErrors.reduce((err, cur) => {
|
||||
cur.cause = err;
|
||||
return cur;
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
throw new Error(`Failed to load native binding`);
|
||||
}
|
||||
|
||||
module.exports = nativeBinding;
|
||||
module.exports.Doc = nativeBinding.Doc;
|
||||
module.exports.YArray = nativeBinding.YArray;
|
||||
module.exports.YMap = nativeBinding.YMap;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"@napi-rs/cli": "3.0.0",
|
||||
"@types/node": "^22.14.1",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"c8": "^10.1.3",
|
||||
|
||||
@@ -105,7 +105,7 @@ impl YMap {
|
||||
}
|
||||
|
||||
#[napi]
|
||||
pub fn to_json(&self, env: Env) -> Result<Object> {
|
||||
pub fn to_json(&self, env: Env) -> Result<Object<'_>> {
|
||||
let mut js_object = Object::new(&env)?;
|
||||
for (key, value) in self.map.iter() {
|
||||
js_object.set(key, get_js_unknown_from_value(&env, value))?;
|
||||
|
||||
@@ -9,7 +9,7 @@ use super::*;
|
||||
pub type MixedYType<'a> = Either4<YArray, YMap, YText, Unknown<'a>>;
|
||||
pub type MixedRefYType<'a> = Either4<&'a YArray, &'a YMap, &'a YText, Unknown<'a>>;
|
||||
|
||||
pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown> {
|
||||
pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown<'_>> {
|
||||
match any {
|
||||
Any::Null | Any::Undefined => Null.into_unknown(env),
|
||||
Any::True => true.into_unknown(env),
|
||||
@@ -33,7 +33,7 @@ pub fn get_js_unknown_from_any(env: &Env, any: Any) -> Result<Unknown> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_js_unknown_from_value(env: &Env, value: Value) -> Result<Unknown> {
|
||||
pub fn get_js_unknown_from_value(env: &Env, value: Value) -> Result<Unknown<'_>> {
|
||||
match value {
|
||||
Value::Any(any) => get_js_unknown_from_any(env, any),
|
||||
Value::Array(array) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { StorybookConfig } from '@storybook/react-vite';
|
||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||
import swc from 'unplugin-swc';
|
||||
@@ -68,5 +69,6 @@ export default {
|
||||
} satisfies StorybookConfig;
|
||||
|
||||
function getAbsolutePath(value: string): any {
|
||||
return dirname(require.resolve(join(value, 'package.json')));
|
||||
return dirname(fileURLToPath(import.meta.resolve(join(value, 'package.json'))));
|
||||
}
|
||||
|
||||
|
||||
@@ -73,16 +73,16 @@
|
||||
"devDependencies": {
|
||||
"@affine-tools/utils": "workspace:*",
|
||||
"@blocksuite/affine": "workspace:*",
|
||||
"@chromatic-com/storybook": "^4.0.0",
|
||||
"@storybook/react": "^9.0.0",
|
||||
"@storybook/react-vite": "^9.0.0",
|
||||
"@chromatic-com/storybook": "^4.1.3",
|
||||
"@storybook/react": "^10.0.0",
|
||||
"@storybook/react-vite": "^10.0.0",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/react": "^16.1.0",
|
||||
"@types/bytes": "^3.1.5",
|
||||
"@types/react": "^19.0.1",
|
||||
"@types/react-dom": "^19.0.2",
|
||||
"@vanilla-extract/css": "^1.17.0",
|
||||
"storybook": "^9.0.0",
|
||||
"storybook": "^10.0.0",
|
||||
"typescript": "^5.7.2",
|
||||
"unplugin-swc": "^1.5.1",
|
||||
"vite": "^7.0.0",
|
||||
|
||||
Vendored
+1
-2
@@ -186,8 +186,7 @@ export declare class SqliteConnection {
|
||||
get isClose(): boolean
|
||||
static validate(path: string): Promise<ValidationResult>
|
||||
migrateAddDocId(): Promise<void>
|
||||
/**
|
||||
* Flush the WAL file to the database file.
|
||||
/** * Flush the WAL file to the database file.
|
||||
* See https://www.sqlite.org/pragma.html#pragma_wal_checkpoint:~:text=PRAGMA%20schema.wal_checkpoint%3B
|
||||
*/
|
||||
checkpoint(): Promise<void>
|
||||
|
||||
+314
-118
@@ -3,9 +3,6 @@
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { createRequire } = require('node:module')
|
||||
require = createRequire(__filename)
|
||||
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null
|
||||
const loadErrors = []
|
||||
@@ -66,7 +63,7 @@ const isMuslFromChildProcess = () => {
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err)
|
||||
}
|
||||
@@ -78,11 +75,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-android-arm64')
|
||||
const binding = require('@affine/native-android-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-android-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./affine.android-arm-eabi.node')
|
||||
@@ -90,27 +91,53 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-android-arm-eabi')
|
||||
const binding = require('@affine/native-android-arm-eabi')
|
||||
const bindingPackageVersion = require('@affine/native-android-arm-eabi/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
||||
try {
|
||||
return require('./affine.win32-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-win32-x64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-win32-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.win32-x64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-x64-msvc')
|
||||
const binding = require('@affine/native-win32-x64-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-x64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
}
|
||||
} else if (process.arch === 'ia32') {
|
||||
try {
|
||||
return require('./affine.win32-ia32-msvc.node')
|
||||
@@ -118,11 +145,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-ia32-msvc')
|
||||
const binding = require('@affine/native-win32-ia32-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-ia32-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./affine.win32-arm64-msvc.node')
|
||||
@@ -130,26 +161,34 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-win32-arm64-msvc')
|
||||
const binding = require('@affine/native-win32-arm64-msvc')
|
||||
const bindingPackageVersion = require('@affine/native-win32-arm64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'darwin') {
|
||||
try {
|
||||
return require('./affine.darwin-universal.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
return require('./affine.darwin-universal.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-darwin-universal')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-universal/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-universal')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./affine.darwin-x64.node')
|
||||
@@ -157,11 +196,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-x64')
|
||||
const binding = require('@affine/native-darwin-x64')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./affine.darwin-arm64.node')
|
||||
@@ -169,11 +212,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-darwin-arm64')
|
||||
const binding = require('@affine/native-darwin-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-darwin-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
||||
}
|
||||
@@ -185,11 +232,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-freebsd-x64')
|
||||
const binding = require('@affine/native-freebsd-x64')
|
||||
const bindingPackageVersion = require('@affine/native-freebsd-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./affine.freebsd-arm64.node')
|
||||
@@ -197,11 +248,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-freebsd-arm64')
|
||||
const binding = require('@affine/native-freebsd-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-freebsd-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
||||
}
|
||||
@@ -209,106 +264,172 @@ function requireNative() {
|
||||
if (process.arch === 'x64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-x64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-x64-musl')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-x64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-x64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-x64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-x64-gnu')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-x64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-arm64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm64-musl')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-arm64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-arm64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-arm64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm64-gnu')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-arm64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-arm64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-arm-musleabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm-musleabihf')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-arm-musleabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-arm-musleabihf')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm-musleabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-arm-gnueabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
return require('./affine.linux-arm-gnueabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-arm-gnueabihf')
|
||||
const bindingPackageVersion = require('@affine/native-linux-arm-gnueabihf/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-arm-gnueabihf')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-loong64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-loong64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-loong64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-loong64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-loong64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-loong64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'riscv64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./affine.linux-riscv64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-riscv64-musl')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-riscv64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-riscv64-musl')
|
||||
const bindingPackageVersion = require('@affine/native-linux-riscv64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./affine.linux-riscv64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-riscv64-gnu')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
return require('./affine.linux-riscv64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-linux-riscv64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-riscv64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ppc64') {
|
||||
try {
|
||||
@@ -317,11 +438,15 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-ppc64-gnu')
|
||||
const binding = require('@affine/native-linux-ppc64-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-ppc64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else if (process.arch === 's390x') {
|
||||
try {
|
||||
return require('./affine.linux-s390x-gnu.node')
|
||||
@@ -329,14 +454,70 @@ function requireNative() {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
return require('@affine/native-linux-s390x-gnu')
|
||||
const binding = require('@affine/native-linux-s390x-gnu')
|
||||
const bindingPackageVersion = require('@affine/native-linux-s390x-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./affine.openharmony-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-arm64')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./affine.openharmony-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-x64')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-x64/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./affine.openharmony-arm.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@affine/native-openharmony-arm')
|
||||
const bindingPackageVersion = require('@affine/native-openharmony-arm/package.json').version
|
||||
if (bindingPackageVersion !== '0.25.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 0.25.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
||||
}
|
||||
@@ -345,22 +526,32 @@ function requireNative() {
|
||||
nativeBinding = requireNative()
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null
|
||||
let wasiBindingError = null
|
||||
try {
|
||||
nativeBinding = require('./affine.wasi.cjs')
|
||||
wasiBinding = require('./affine.wasi.cjs')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
loadErrors.push(err)
|
||||
wasiBindingError = err
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
try {
|
||||
nativeBinding = require('@affine/native-wasm32-wasi')
|
||||
wasiBinding = require('@affine/native-wasm32-wasi')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError.cause = err
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||
error.cause = wasiBindingError
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
@@ -369,7 +560,12 @@ if (!nativeBinding) {
|
||||
`Cannot find native binding. ` +
|
||||
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
||||
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
||||
{ cause: loadErrors }
|
||||
{
|
||||
cause: loadErrors.reduce((err, cur) => {
|
||||
cur.cause = err
|
||||
return cur
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
throw new Error(`Failed to load native binding`)
|
||||
|
||||
@@ -66,7 +66,7 @@ impl CATapDescription {
|
||||
Ok(Self { inner: obj })
|
||||
}
|
||||
|
||||
pub fn get_uuid(&self) -> std::result::Result<ItemRef<CFString>, CoreAudioError> {
|
||||
pub fn get_uuid(&self) -> std::result::Result<ItemRef<'_, CFString>, CoreAudioError> {
|
||||
let uuid: *mut NSUUID = unsafe { msg_send![self.inner, UUID] };
|
||||
if uuid.is_null() {
|
||||
return Err(CoreAudioError::GetCATapDescriptionUUIDFailed);
|
||||
|
||||
@@ -95,7 +95,7 @@ impl DocStoragePool {
|
||||
})
|
||||
}
|
||||
|
||||
async fn get(&self, universal_id: String) -> Result<Ref<SqliteDocStorage>> {
|
||||
async fn get(&self, universal_id: String) -> Result<Ref<'_, SqliteDocStorage>> {
|
||||
Ok(self.pool.get(universal_id).await?)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ impl SqliteDocStoragePool {
|
||||
RefMut { _guard: lock }
|
||||
}
|
||||
|
||||
pub async fn get(&self, universal_id: String) -> Result<Ref<SqliteDocStorage>> {
|
||||
pub async fn get(&self, universal_id: String) -> Result<Ref<'_, SqliteDocStorage>> {
|
||||
let lock = RwLockReadGuard::try_map(self.inner.read().await, |lock| {
|
||||
if let Some(storage) = lock.get(&universal_id) {
|
||||
Some(storage)
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.0.0-alpha.89",
|
||||
"@napi-rs/cli": "3.5.0",
|
||||
"@napi-rs/whisper": "^0.0.4",
|
||||
"@types/node": "^22.0.0",
|
||||
"ava": "^6.2.0",
|
||||
"ava": "^6.4.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2"
|
||||
|
||||
Reference in New Issue
Block a user