diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f99e735..8ab3ebb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -110,7 +110,7 @@ jobs: with: name: bindings-${{ matrix.settings.target }} path: | - ${{ env.APP_NAME }}.*.node + crates/node-binding/${{ env.APP_NAME }}.*.node ${{ env.APP_NAME }}.*.wasm if-no-files-found: error test-macOS-windows-binding: diff --git a/crates/feopack-core/src/module_graph/mod.rs b/crates/feopack-core/src/module_graph/mod.rs index 0625230..6e65168 100644 --- a/crates/feopack-core/src/module_graph/mod.rs +++ b/crates/feopack-core/src/module_graph/mod.rs @@ -31,7 +31,7 @@ impl ModuleGraph { modules: std::collections::HashMap::new(), }); } - + // 添加到最后一个 partial if let Some(last) = self.partials.last_mut() { last.modules.insert(module_id, module); diff --git a/crates/node-binding/src/lib.rs b/crates/node-binding/src/lib.rs index fb03a90..8dd3a11 100644 --- a/crates/node-binding/src/lib.rs +++ b/crates/node-binding/src/lib.rs @@ -6,6 +6,11 @@ use napi_derive::napi; use feopack_core::*; +#[napi] +pub fn plus100(num: i32) -> i32 { + num + 100 +} + #[napi] pub struct Rspack { compiler: Box, @@ -32,6 +37,9 @@ impl Rspack { }) } + /// # Safety + /// This function is unsafe because it interacts with native resources. + /// Ensure the compiler is properly initialized before calling. #[napi] pub async unsafe fn build(&mut self) -> Result<()> { self diff --git a/index.js b/index.js index 3cad62c..b69e972 100644 --- a/index.js +++ b/index.js @@ -73,13 +73,13 @@ function requireNative() { } else if (process.platform === 'android') { if (process.arch === 'arm64') { try { - return require('./package-template.android-arm64.node') + return require('./feopack.android-arm64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-android-arm64') - const bindingPackageVersion = require('@napi-rs/package-template-android-arm64/package.json').version + const binding = require('@napi-rs/feopack-android-arm64') + const bindingPackageVersion = require('@napi-rs/feopack-android-arm64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -89,13 +89,13 @@ function requireNative() { } } else if (process.arch === 'arm') { try { - return require('./package-template.android-arm-eabi.node') + return require('./feopack.android-arm-eabi.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-android-arm-eabi') - const bindingPackageVersion = require('@napi-rs/package-template-android-arm-eabi/package.json').version + const binding = require('@napi-rs/feopack-android-arm-eabi') + const bindingPackageVersion = require('@napi-rs/feopack-android-arm-eabi/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -109,13 +109,13 @@ function requireNative() { } else if (process.platform === 'win32') { if (process.arch === 'x64') { try { - return require('./package-template.win32-x64-msvc.node') + return require('./feopack.win32-x64-msvc.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-win32-x64-msvc') - const bindingPackageVersion = require('@napi-rs/package-template-win32-x64-msvc/package.json').version + const binding = require('@napi-rs/feopack-win32-x64-msvc') + const bindingPackageVersion = require('@napi-rs/feopack-win32-x64-msvc/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -125,13 +125,13 @@ function requireNative() { } } else if (process.arch === 'ia32') { try { - return require('./package-template.win32-ia32-msvc.node') + return require('./feopack.win32-ia32-msvc.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-win32-ia32-msvc') - const bindingPackageVersion = require('@napi-rs/package-template-win32-ia32-msvc/package.json').version + const binding = require('@napi-rs/feopack-win32-ia32-msvc') + const bindingPackageVersion = require('@napi-rs/feopack-win32-ia32-msvc/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -141,13 +141,13 @@ function requireNative() { } } else if (process.arch === 'arm64') { try { - return require('./package-template.win32-arm64-msvc.node') + return require('./feopack.win32-arm64-msvc.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-win32-arm64-msvc') - const bindingPackageVersion = require('@napi-rs/package-template-win32-arm64-msvc/package.json').version + const binding = require('@napi-rs/feopack-win32-arm64-msvc') + const bindingPackageVersion = require('@napi-rs/feopack-win32-arm64-msvc/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -160,13 +160,13 @@ function requireNative() { } } else if (process.platform === 'darwin') { try { - return require('./package-template.darwin-universal.node') + return require('./feopack.darwin-universal.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-darwin-universal') - const bindingPackageVersion = require('@napi-rs/package-template-darwin-universal/package.json').version + const binding = require('@napi-rs/feopack-darwin-universal') + const bindingPackageVersion = require('@napi-rs/feopack-darwin-universal/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -176,13 +176,13 @@ function requireNative() { } if (process.arch === 'x64') { try { - return require('./package-template.darwin-x64.node') + return require('./feopack.darwin-x64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-darwin-x64') - const bindingPackageVersion = require('@napi-rs/package-template-darwin-x64/package.json').version + const binding = require('@napi-rs/feopack-darwin-x64') + const bindingPackageVersion = require('@napi-rs/feopack-darwin-x64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -192,13 +192,13 @@ function requireNative() { } } else if (process.arch === 'arm64') { try { - return require('./package-template.darwin-arm64.node') + return require('./feopack.darwin-arm64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-darwin-arm64') - const bindingPackageVersion = require('@napi-rs/package-template-darwin-arm64/package.json').version + const binding = require('@napi-rs/feopack-darwin-arm64') + const bindingPackageVersion = require('@napi-rs/feopack-darwin-arm64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -212,13 +212,13 @@ function requireNative() { } else if (process.platform === 'freebsd') { if (process.arch === 'x64') { try { - return require('./package-template.freebsd-x64.node') + return require('./feopack.freebsd-x64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-freebsd-x64') - const bindingPackageVersion = require('@napi-rs/package-template-freebsd-x64/package.json').version + const binding = require('@napi-rs/feopack-freebsd-x64') + const bindingPackageVersion = require('@napi-rs/feopack-freebsd-x64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -228,13 +228,13 @@ function requireNative() { } } else if (process.arch === 'arm64') { try { - return require('./package-template.freebsd-arm64.node') + return require('./feopack.freebsd-arm64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-freebsd-arm64') - const bindingPackageVersion = require('@napi-rs/package-template-freebsd-arm64/package.json').version + const binding = require('@napi-rs/feopack-freebsd-arm64') + const bindingPackageVersion = require('@napi-rs/feopack-freebsd-arm64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -249,13 +249,13 @@ function requireNative() { if (process.arch === 'x64') { if (isMusl()) { try { - return require('./package-template.linux-x64-musl.node') + return require('./feopack.linux-x64-musl.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-x64-musl') - const bindingPackageVersion = require('@napi-rs/package-template-linux-x64-musl/package.json').version + const binding = require('@napi-rs/feopack-linux-x64-musl') + const bindingPackageVersion = require('@napi-rs/feopack-linux-x64-musl/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -265,13 +265,13 @@ function requireNative() { } } else { try { - return require('./package-template.linux-x64-gnu.node') + return require('./feopack.linux-x64-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-x64-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-x64-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-x64-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-x64-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -283,13 +283,13 @@ function requireNative() { } else if (process.arch === 'arm64') { if (isMusl()) { try { - return require('./package-template.linux-arm64-musl.node') + return require('./feopack.linux-arm64-musl.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-arm64-musl') - const bindingPackageVersion = require('@napi-rs/package-template-linux-arm64-musl/package.json').version + const binding = require('@napi-rs/feopack-linux-arm64-musl') + const bindingPackageVersion = require('@napi-rs/feopack-linux-arm64-musl/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -299,13 +299,13 @@ function requireNative() { } } else { try { - return require('./package-template.linux-arm64-gnu.node') + return require('./feopack.linux-arm64-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-arm64-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-arm64-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-arm64-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-arm64-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -317,13 +317,13 @@ function requireNative() { } else if (process.arch === 'arm') { if (isMusl()) { try { - return require('./package-template.linux-arm-musleabihf.node') + return require('./feopack.linux-arm-musleabihf.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-arm-musleabihf') - const bindingPackageVersion = require('@napi-rs/package-template-linux-arm-musleabihf/package.json').version + const binding = require('@napi-rs/feopack-linux-arm-musleabihf') + const bindingPackageVersion = require('@napi-rs/feopack-linux-arm-musleabihf/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -333,13 +333,13 @@ function requireNative() { } } else { try { - return require('./package-template.linux-arm-gnueabihf.node') + return require('./feopack.linux-arm-gnueabihf.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-arm-gnueabihf') - const bindingPackageVersion = require('@napi-rs/package-template-linux-arm-gnueabihf/package.json').version + const binding = require('@napi-rs/feopack-linux-arm-gnueabihf') + const bindingPackageVersion = require('@napi-rs/feopack-linux-arm-gnueabihf/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -351,13 +351,13 @@ function requireNative() { } else if (process.arch === 'loong64') { if (isMusl()) { try { - return require('./package-template.linux-loong64-musl.node') + return require('./feopack.linux-loong64-musl.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-loong64-musl') - const bindingPackageVersion = require('@napi-rs/package-template-linux-loong64-musl/package.json').version + const binding = require('@napi-rs/feopack-linux-loong64-musl') + const bindingPackageVersion = require('@napi-rs/feopack-linux-loong64-musl/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -367,13 +367,13 @@ function requireNative() { } } else { try { - return require('./package-template.linux-loong64-gnu.node') + return require('./feopack.linux-loong64-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-loong64-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-loong64-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-loong64-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-loong64-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -385,13 +385,13 @@ function requireNative() { } else if (process.arch === 'riscv64') { if (isMusl()) { try { - return require('./package-template.linux-riscv64-musl.node') + return require('./feopack.linux-riscv64-musl.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-riscv64-musl') - const bindingPackageVersion = require('@napi-rs/package-template-linux-riscv64-musl/package.json').version + const binding = require('@napi-rs/feopack-linux-riscv64-musl') + const bindingPackageVersion = require('@napi-rs/feopack-linux-riscv64-musl/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -401,13 +401,13 @@ function requireNative() { } } else { try { - return require('./package-template.linux-riscv64-gnu.node') + return require('./feopack.linux-riscv64-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-riscv64-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-riscv64-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-riscv64-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-riscv64-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -418,13 +418,13 @@ function requireNative() { } } else if (process.arch === 'ppc64') { try { - return require('./package-template.linux-ppc64-gnu.node') + return require('./feopack.linux-ppc64-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-ppc64-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-ppc64-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-ppc64-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-ppc64-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -434,13 +434,13 @@ function requireNative() { } } else if (process.arch === 's390x') { try { - return require('./package-template.linux-s390x-gnu.node') + return require('./feopack.linux-s390x-gnu.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-linux-s390x-gnu') - const bindingPackageVersion = require('@napi-rs/package-template-linux-s390x-gnu/package.json').version + const binding = require('@napi-rs/feopack-linux-s390x-gnu') + const bindingPackageVersion = require('@napi-rs/feopack-linux-s390x-gnu/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -454,13 +454,13 @@ function requireNative() { } else if (process.platform === 'openharmony') { if (process.arch === 'arm64') { try { - return require('./package-template.openharmony-arm64.node') + return require('./feopack.openharmony-arm64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-openharmony-arm64') - const bindingPackageVersion = require('@napi-rs/package-template-openharmony-arm64/package.json').version + const binding = require('@napi-rs/feopack-openharmony-arm64') + const bindingPackageVersion = require('@napi-rs/feopack-openharmony-arm64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -470,13 +470,13 @@ function requireNative() { } } else if (process.arch === 'x64') { try { - return require('./package-template.openharmony-x64.node') + return require('./feopack.openharmony-x64.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-openharmony-x64') - const bindingPackageVersion = require('@napi-rs/package-template-openharmony-x64/package.json').version + const binding = require('@napi-rs/feopack-openharmony-x64') + const bindingPackageVersion = require('@napi-rs/feopack-openharmony-x64/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -486,13 +486,13 @@ function requireNative() { } } else if (process.arch === 'arm') { try { - return require('./package-template.openharmony-arm.node') + return require('./feopack.openharmony-arm.node') } catch (e) { loadErrors.push(e) } try { - const binding = require('@napi-rs/package-template-openharmony-arm') - const bindingPackageVersion = require('@napi-rs/package-template-openharmony-arm/package.json').version + const binding = require('@napi-rs/feopack-openharmony-arm') + const bindingPackageVersion = require('@napi-rs/feopack-openharmony-arm/package.json').version if (bindingPackageVersion !== '1.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { throw new Error(`Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } @@ -514,7 +514,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { let wasiBinding = null let wasiBindingError = null try { - wasiBinding = require('./package-template.wasi.cjs') + wasiBinding = require('./feopack.wasi.cjs') nativeBinding = wasiBinding } catch (err) { if (process.env.NAPI_RS_FORCE_WASI) { @@ -523,7 +523,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { } if (!nativeBinding) { try { - wasiBinding = require('@napi-rs/package-template-wasm32-wasi') + wasiBinding = require('@napi-rs/feopack-wasm32-wasi') nativeBinding = wasiBinding } catch (err) { if (process.env.NAPI_RS_FORCE_WASI) { diff --git a/package.json b/package.json index bbee546..ad6e305 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "repository": { "type": "git", - "url": "git+ssh://git@github.com/napi-rs/package-template.git" + "url": "git+ssh://git@github.com/atom-universe/FeOPack.git" }, "license": "MIT", "browser": "browser.js", @@ -52,10 +52,10 @@ "test": "ava", "preversion": "napi build --platform && git add .", "version": "napi version", - "prepare": "husky" + "prepare": "husky", + "build": "napi build --platform --release --package node-binding" }, "devDependencies": { - "@feopack/cli": "workspace:*", "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@napi-rs/cli": "^3.2.0", diff --git a/yarn.lock b/yarn.lock index fb3528c..102b740 100644 --- a/yarn.lock +++ b/yarn.lock @@ -569,28 +569,6 @@ __metadata: languageName: node linkType: hard -"@napi-rs/package-template@workspace:.": - version: 0.0.0-use.local - resolution: "@napi-rs/package-template@workspace:." - dependencies: - "@emnapi/core": "npm:^1.5.0" - "@emnapi/runtime": "npm:^1.5.0" - "@napi-rs/cli": "npm:^3.2.0" - "@oxc-node/core": "npm:^0.0.35" - "@taplo/cli": "npm:^0.7.0" - "@tybys/wasm-util": "npm:^0.10.0" - ava: "npm:^6.4.1" - chalk: "npm:^5.6.2" - husky: "npm:^9.1.7" - lint-staged: "npm:^16.1.6" - npm-run-all2: "npm:^8.0.4" - oxlint: "npm:^1.14.0" - prettier: "npm:^3.6.2" - tinybench: "npm:^6.0.0" - typescript: "npm:^5.9.2" - languageName: unknown - linkType: soft - "@napi-rs/tar-android-arm-eabi@npm:1.1.0": version: 1.1.0 resolution: "@napi-rs/tar-android-arm-eabi@npm:1.1.0" @@ -2020,6 +1998,28 @@ __metadata: languageName: node linkType: hard +"feopack@workspace:.": + version: 0.0.0-use.local + resolution: "feopack@workspace:." + dependencies: + "@emnapi/core": "npm:^1.5.0" + "@emnapi/runtime": "npm:^1.5.0" + "@napi-rs/cli": "npm:^3.2.0" + "@oxc-node/core": "npm:^0.0.35" + "@taplo/cli": "npm:^0.7.0" + "@tybys/wasm-util": "npm:^0.10.0" + ava: "npm:^6.4.1" + chalk: "npm:^5.6.2" + husky: "npm:^9.1.7" + lint-staged: "npm:^16.1.6" + npm-run-all2: "npm:^8.0.4" + oxlint: "npm:^1.14.0" + prettier: "npm:^3.6.2" + tinybench: "npm:^6.0.0" + typescript: "npm:^5.9.2" + languageName: unknown + linkType: soft + "figures@npm:^6.1.0": version: 6.1.0 resolution: "figures@npm:6.1.0"