File tree Expand file tree Collapse file tree 7 files changed +20
-14
lines changed Expand file tree Collapse file tree 7 files changed +20
-14
lines changed Original file line number Diff line number Diff line change 88 "build-dev" : " napi build --esm --platform" ,
99 "build-test" : " pnpm run build-dev" ,
1010 "build" : " pnpm run build-dev --features allocator --release" ,
11- "postbuild-dev" : " node patch.mjs " ,
11+ "postbuild-dev" : " node scripts/ patch.js " ,
1212 "test" : " tsc && vitest run --dir ./test"
1313 },
1414 "engines" : {
Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
2+ import { join as pathJoin } from 'node:path' ;
23
3- const filename = './index.js' ;
4- let data = fs . readFileSync ( filename , 'utf-8' ) ;
4+ const path = pathJoin ( import . meta. dirname , '../index.js' ) ;
5+
6+ let data = fs . readFileSync ( path , 'utf-8' ) ;
57data = data . replace (
68 '\nif (!nativeBinding) {' ,
79 ( s ) =>
@@ -15,4 +17,4 @@ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
1517}
1618` + s ,
1719) ;
18- fs . writeFileSync ( filename , data ) ;
20+ fs . writeFileSync ( path , data ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export function wrap(result) {
2020 } ;
2121}
2222
23- // Used by `napi/playground/patch.mjs `.
23+ // Used by `napi/playground/scripts/ patch.js `.
2424//
2525// Set `value` field of `Literal`s which are `BigInt`s or `RegExp`s.
2626//
Original file line number Diff line number Diff line change 1414 },
1515 "scripts" : {
1616 "build-test" : " echo 'Skipped because there are no tests.'" ,
17- "build-dev" : " pnpm run build:napi && node patch.mjs " ,
18- "build" : " pnpm run build:napi --release && node patch.mjs " ,
17+ "build-dev" : " pnpm run build:napi && node scripts/ patch.js " ,
18+ "build" : " pnpm run build:napi --release && node scripts/ patch.js " ,
1919 "build:napi" : " napi build --platform --esm --target wasm32-wasip1-threads"
2020 },
2121 "dependencies" : {
Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
2+ import { join as pathJoin } from 'node:path' ;
23
3- const filename = './playground.wasi-browser.js' ;
4- let data = fs . readFileSync ( filename , 'utf-8' ) ;
4+ const path = pathJoin ( import . meta. dirname , '../playground.wasi-browser.js' ) ;
5+
6+ let data = fs . readFileSync ( path , 'utf-8' ) ;
57data = data . replace (
68 `export const Oxc = __napiModule.exports.Oxc` ,
79 `
@@ -24,4 +26,4 @@ export function Oxc() {
2426}
2527` ,
2628) ;
27- fs . writeFileSync ( filename , data ) ;
29+ fs . writeFileSync ( path , data ) ;
Original file line number Diff line number Diff line change 88 "build-dev" : " napi build --esm --platform" ,
99 "build-test" : " pnpm run build-dev" ,
1010 "build" : " pnpm run build-dev --features allocator --release" ,
11- "postbuild-dev" : " node patch.mjs " ,
11+ "postbuild-dev" : " node scripts/ patch.js " ,
1212 "test" : " tsc && vitest run --dir ./test"
1313 },
1414 "engines" : {
Original file line number Diff line number Diff line change 11import fs from 'node:fs' ;
2+ import { join as pathJoin } from 'node:path' ;
23
3- const filename = './index.js' ;
4- let data = fs . readFileSync ( filename , 'utf-8' ) ;
4+ const path = pathJoin ( import . meta. dirname , '../index.js' ) ;
5+
6+ let data = fs . readFileSync ( path , 'utf-8' ) ;
57data = data . replace (
68 '\nif (!nativeBinding) {' ,
79 ( s ) =>
@@ -15,4 +17,4 @@ if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
1517}
1618` + s ,
1719) ;
18- fs . writeFileSync ( filename , data ) ;
20+ fs . writeFileSync ( path , data ) ;
You can’t perform that action at this time.
0 commit comments