Skip to content

Commit 115149b

Browse files
committed
Fix bindings.js after NAPI-RS upgrade
1 parent 14d1aaf commit 115149b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/oxlint/scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ console.log('Modifying bindings.js...');
1111
const bindingsPath = join(oxlintDirPath, 'src-js/bindings.js');
1212
let bindingsJs = readFileSync(bindingsPath, 'utf8');
1313
bindingsJs = bindingsJs.replace(/require\('@oxlint\/binding-(.+?)'\)/g, (_, name) => {
14-
name = name.replace(/-msvc$/g, '');
14+
name = name.replace(/-msvc(\/|$)/g, '$1');
1515
return `require('@oxlint/${name}')`;
1616
});
1717
writeFileSync(bindingsPath, bindingsJs);

apps/oxlint/src-js/bindings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function requireNative() {
116116
}
117117
try {
118118
const binding = require('@oxlint/win32-x64')
119-
const bindingPackageVersion = require('@oxlint/win32-x64-msvc/package.json').version
119+
const bindingPackageVersion = require('@oxlint/win32-x64/package.json').version
120120
if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121121
throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122122
}
@@ -132,7 +132,7 @@ function requireNative() {
132132
}
133133
try {
134134
const binding = require('@oxlint/win32-ia32')
135-
const bindingPackageVersion = require('@oxlint/win32-ia32-msvc/package.json').version
135+
const bindingPackageVersion = require('@oxlint/win32-ia32/package.json').version
136136
if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137137
throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138138
}
@@ -148,7 +148,7 @@ function requireNative() {
148148
}
149149
try {
150150
const binding = require('@oxlint/win32-arm64')
151-
const bindingPackageVersion = require('@oxlint/win32-arm64-msvc/package.json').version
151+
const bindingPackageVersion = require('@oxlint/win32-arm64/package.json').version
152152
if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153153
throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154154
}

0 commit comments

Comments
 (0)