Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion napi/minify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build-dev": "napi build --esm --platform",
"build-test": "pnpm run build-dev",
"build": "pnpm run build-dev --features allocator --release",
"postbuild-dev": "node patch.mjs",
"postbuild-dev": "node scripts/patch.js",
"test": "tsc && vitest run --dir ./test"
},
"engines": {
Expand Down
8 changes: 5 additions & 3 deletions napi/minify/patch.mjs → napi/minify/scripts/patch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import fs from 'node:fs';
import { join as pathJoin } from 'node:path';

const filename = './index.js';
let data = fs.readFileSync(filename, 'utf-8');
const path = pathJoin(import.meta.dirname, '../index.js');

let data = fs.readFileSync(path, 'utf-8');
data = data.replace(
'\nif (!nativeBinding) {',
(s) =>
Expand All @@ -15,4 +17,4 @@ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
}
` + s,
);
fs.writeFileSync(filename, data);
fs.writeFileSync(path, data);
2 changes: 1 addition & 1 deletion napi/parser/src-js/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function wrap(result) {
};
}

// Used by `napi/playground/patch.mjs`.
// Used by `napi/playground/scripts/patch.js`.
//
// Set `value` field of `Literal`s which are `BigInt`s or `RegExp`s.
//
Expand Down
4 changes: 2 additions & 2 deletions napi/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
},
"scripts": {
"build-test": "echo 'Skipped because there are no tests.'",
"build-dev": "pnpm run build:napi && node patch.mjs",
"build": "pnpm run build:napi --release && node patch.mjs",
"build-dev": "pnpm run build:napi && node scripts/patch.js",
"build": "pnpm run build:napi --release && node scripts/patch.js",
"build:napi": "napi build --platform --esm --target wasm32-wasip1-threads"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import fs from 'node:fs';
import { join as pathJoin } from 'node:path';

const filename = './playground.wasi-browser.js';
let data = fs.readFileSync(filename, 'utf-8');
const path = pathJoin(import.meta.dirname, '../playground.wasi-browser.js');

let data = fs.readFileSync(path, 'utf-8');
data = data.replace(
`export const Oxc = __napiModule.exports.Oxc`,
`
Expand All @@ -24,4 +26,4 @@ export function Oxc() {
}
`,
);
fs.writeFileSync(filename, data);
fs.writeFileSync(path, data);
2 changes: 1 addition & 1 deletion napi/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build-dev": "napi build --esm --platform",
"build-test": "pnpm run build-dev",
"build": "pnpm run build-dev --features allocator --release",
"postbuild-dev": "node patch.mjs",
"postbuild-dev": "node scripts/patch.js",
"test": "tsc && vitest run --dir ./test"
},
"engines": {
Expand Down
8 changes: 5 additions & 3 deletions napi/transform/patch.mjs → napi/transform/scripts/patch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import fs from 'node:fs';
import { join as pathJoin } from 'node:path';

const filename = './index.js';
let data = fs.readFileSync(filename, 'utf-8');
const path = pathJoin(import.meta.dirname, '../index.js');

let data = fs.readFileSync(path, 'utf-8');
data = data.replace(
'\nif (!nativeBinding) {',
(s) =>
Expand All @@ -15,4 +17,4 @@ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
}
` + s,
);
fs.writeFileSync(filename, data);
fs.writeFileSync(path, data);
Loading