mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 10:45:57 +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:
@@ -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
packages/common/y-octo/node/index.d.ts
vendored
1
packages/common/y-octo/node/index.d.ts
vendored
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user