@oxc-transform-react/binding-wasm32-wasi 0.148.0 → 0.150.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxc-transform-react/binding-wasm32-wasi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.150.0",
|
|
4
4
|
"main": "transform-react.wasi.cjs",
|
|
5
5
|
"files": [
|
|
6
6
|
"transform-react.wasm32-wasi.wasm",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"browser": "transform-react.wasi-browser.js",
|
|
42
42
|
"type": "module",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@napi-rs/wasm-runtime": "~1.2.
|
|
44
|
+
"@napi-rs/wasm-runtime": "~1.2.4",
|
|
45
45
|
"@emnapi/core": "2.0.0-alpha.3",
|
|
46
46
|
"@emnapi/runtime": "2.0.0-alpha.3"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -51,11 +51,11 @@ let __emnapiWasmEnvCleanupDrained = false
|
|
|
51
51
|
let __emnapiWasmEnvCleanupDrainPromise
|
|
52
52
|
let __wasiDisposed = false
|
|
53
53
|
let __wasiDisposePromise
|
|
54
|
-
let __completeWasiDisposal = function() {}
|
|
54
|
+
let __completeWasiDisposal = function () {}
|
|
55
55
|
// Overridden by loader flavors that have a last-resort reclaim for a rollback
|
|
56
56
|
// that stopped short of destroying the context. See
|
|
57
57
|
// `__rollbackWasiInitialization`.
|
|
58
|
-
let __retainWasiRollbackForRetry = function() {}
|
|
58
|
+
let __retainWasiRollbackForRetry = function () {}
|
|
59
59
|
|
|
60
60
|
function __isThenable(value) {
|
|
61
61
|
return (
|
package/transform-react.wasi.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["Severity","transform","transformSync"],"managedRootEntries":["browser.js","index.js","transform-react.wasm","transform-react.debug.wasm"]}
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/* prettier-ignore */
|
|
4
|
-
|
|
5
3
|
/* auto-generated by NAPI-RS */
|
|
6
4
|
|
|
7
5
|
const __nodeFs = require('node:fs')
|
|
@@ -91,6 +89,7 @@ function __createWasiWorker(filename) {
|
|
|
91
89
|
return new Worker(filename, {
|
|
92
90
|
env: process.env,
|
|
93
91
|
execArgv: __workerExecArgv,
|
|
92
|
+
workerData: { hostRoot: __hostRoot, rootDir: __rootDir },
|
|
94
93
|
})
|
|
95
94
|
} catch (error) {
|
|
96
95
|
if (!error || error.code !== 'ERR_WORKER_INVALID_EXEC_ARGV') {
|
|
@@ -106,14 +105,18 @@ function __createWasiWorker(filename) {
|
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
const
|
|
108
|
+
const __cwd = process.cwd()
|
|
109
|
+
const __rootDir = __nodePath.parse(__cwd).root
|
|
110
|
+
const __hostRoot =
|
|
111
|
+
process.platform === 'android' ? __cwd : __rootDir
|
|
110
112
|
|
|
111
113
|
const __wasi = new __nodeWASI({
|
|
112
114
|
version: 'preview1',
|
|
113
115
|
env: process.env,
|
|
114
116
|
preopens: {
|
|
115
|
-
[__rootDir]:
|
|
116
|
-
|
|
117
|
+
[__rootDir]: __hostRoot,
|
|
118
|
+
[__hostRoot]: __hostRoot,
|
|
119
|
+
},
|
|
117
120
|
})
|
|
118
121
|
|
|
119
122
|
const __sharedMemory = new WebAssembly.Memory({
|
|
@@ -155,11 +158,11 @@ let __emnapiWasmEnvCleanupDrained = false
|
|
|
155
158
|
let __emnapiWasmEnvCleanupDrainPromise
|
|
156
159
|
let __wasiDisposed = false
|
|
157
160
|
let __wasiDisposePromise
|
|
158
|
-
let __completeWasiDisposal = function() {}
|
|
161
|
+
let __completeWasiDisposal = function () {}
|
|
159
162
|
// Overridden by loader flavors that have a last-resort reclaim for a rollback
|
|
160
163
|
// that stopped short of destroying the context. See
|
|
161
164
|
// `__rollbackWasiInitialization`.
|
|
162
|
-
let __retainWasiRollbackForRetry = function() {}
|
|
165
|
+
let __retainWasiRollbackForRetry = function () {}
|
|
163
166
|
|
|
164
167
|
function __isThenable(value) {
|
|
165
168
|
return (
|
|
@@ -846,7 +849,7 @@ try {
|
|
|
846
849
|
napiModule: __napiModule,
|
|
847
850
|
} = __emnapiInstantiateNapiModuleSync(__wasmFile, {
|
|
848
851
|
context: __emnapiContext,
|
|
849
|
-
asyncWorkPoolSize: (function() {
|
|
852
|
+
asyncWorkPoolSize: (function () {
|
|
850
853
|
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
|
|
851
854
|
// NaN > 0 is false
|
|
852
855
|
if (threadsSizeFromEnv > 0) {
|
|
@@ -871,21 +874,21 @@ try {
|
|
|
871
874
|
// According to https://github.com/nodejs/node/blob/19e0d472728c79d418b74bddff588bea70a403d0/lib/internal/worker.js#L415,
|
|
872
875
|
// a worker is consist of two handles: kPublicPort and kHandle.
|
|
873
876
|
{
|
|
874
|
-
const kPublicPort = Object.getOwnPropertySymbols(worker).find(s =>
|
|
875
|
-
s.toString().includes(
|
|
876
|
-
)
|
|
877
|
+
const kPublicPort = Object.getOwnPropertySymbols(worker).find((s) =>
|
|
878
|
+
s.toString().includes('kPublicPort'),
|
|
879
|
+
)
|
|
877
880
|
if (kPublicPort) {
|
|
878
|
-
worker[kPublicPort].ref = () => {}
|
|
881
|
+
worker[kPublicPort].ref = () => {}
|
|
879
882
|
}
|
|
880
883
|
|
|
881
|
-
const kHandle = Object.getOwnPropertySymbols(worker).find(s =>
|
|
882
|
-
s.toString().includes(
|
|
883
|
-
)
|
|
884
|
+
const kHandle = Object.getOwnPropertySymbols(worker).find((s) =>
|
|
885
|
+
s.toString().includes('kHandle'),
|
|
886
|
+
)
|
|
884
887
|
if (kHandle) {
|
|
885
|
-
worker[kHandle].ref = () => {}
|
|
888
|
+
worker[kHandle].ref = () => {}
|
|
886
889
|
}
|
|
887
890
|
|
|
888
|
-
worker.unref()
|
|
891
|
+
worker.unref()
|
|
889
892
|
}
|
|
890
893
|
return worker
|
|
891
894
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
export interface Comment {
|
|
4
5
|
type: 'Line' | 'Block'
|
|
5
6
|
value: string
|
|
@@ -24,8 +25,9 @@ export interface OxcError {
|
|
|
24
25
|
export declare const enum Severity {
|
|
25
26
|
Error = 'Error',
|
|
26
27
|
Warning = 'Warning',
|
|
27
|
-
Advice = 'Advice'
|
|
28
|
+
Advice = 'Advice',
|
|
28
29
|
}
|
|
30
|
+
|
|
29
31
|
export interface SourceMap {
|
|
30
32
|
file?: string
|
|
31
33
|
mappings: string
|
|
@@ -36,6 +38,7 @@ export interface SourceMap {
|
|
|
36
38
|
version: number
|
|
37
39
|
x_google_ignoreList?: Array<number>
|
|
38
40
|
}
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* Configure how TSX and JSX are transformed.
|
|
41
44
|
*
|
|
Binary file
|
package/wasi-worker-browser.mjs
CHANGED
|
@@ -13,10 +13,9 @@ const handler = new MessageHandler({
|
|
|
13
13
|
// eslint-disable-next-line no-console
|
|
14
14
|
console.log.apply(console, arguments)
|
|
15
15
|
},
|
|
16
|
-
printErr: function() {
|
|
16
|
+
printErr: function () {
|
|
17
17
|
// eslint-disable-next-line no-console
|
|
18
18
|
console.error.apply(console, arguments)
|
|
19
|
-
|
|
20
19
|
},
|
|
21
20
|
})
|
|
22
21
|
return instantiateNapiModuleSync(wasmModule, {
|
|
@@ -37,7 +36,6 @@ const handler = new MessageHandler({
|
|
|
37
36
|
},
|
|
38
37
|
})
|
|
39
38
|
},
|
|
40
|
-
|
|
41
39
|
})
|
|
42
40
|
|
|
43
41
|
globalThis.onmessage = function (e) {
|
package/wasi-worker.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import { createRequire } from
|
|
3
|
-
import { parse } from
|
|
4
|
-
import { WASI } from
|
|
5
|
-
import { parentPort, Worker } from
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import { parse } from 'node:path'
|
|
4
|
+
import { WASI } from 'node:wasi'
|
|
5
|
+
import { parentPort, Worker, workerData } from 'node:worker_threads'
|
|
6
6
|
|
|
7
|
-
const require = createRequire(import.meta.url)
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
8
|
|
|
9
9
|
const {
|
|
10
10
|
instantiateNapiModuleSync,
|
|
@@ -12,12 +12,12 @@ const {
|
|
|
12
12
|
getDefaultContext,
|
|
13
13
|
emnapiAsyncWorkPlugin,
|
|
14
14
|
emnapiTSFNPlugin,
|
|
15
|
-
} = require(
|
|
15
|
+
} = require('@napi-rs/wasm-runtime')
|
|
16
16
|
|
|
17
17
|
if (parentPort) {
|
|
18
|
-
parentPort.on(
|
|
19
|
-
globalThis.onmessage({ data })
|
|
20
|
-
})
|
|
18
|
+
parentPort.on('message', (data) => {
|
|
19
|
+
globalThis.onmessage({ data })
|
|
20
|
+
})
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
Object.assign(globalThis, {
|
|
@@ -25,18 +25,25 @@ Object.assign(globalThis, {
|
|
|
25
25
|
require,
|
|
26
26
|
Worker,
|
|
27
27
|
importScripts: function (f) {
|
|
28
|
-
|
|
28
|
+
// oxlint-disable-next-line no-eval -- WASI importScripts polyfill
|
|
29
|
+
;(0, eval)(fs.readFileSync(f, 'utf8') + '//# sourceURL=' + f)
|
|
29
30
|
},
|
|
30
31
|
postMessage: function (msg) {
|
|
31
32
|
if (parentPort) {
|
|
32
|
-
parentPort.postMessage(msg)
|
|
33
|
+
parentPort.postMessage(msg)
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
|
-
})
|
|
36
|
+
})
|
|
36
37
|
|
|
37
|
-
const emnapiContext = getDefaultContext()
|
|
38
|
+
const emnapiContext = getDefaultContext()
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
+
const __cwd = process.cwd()
|
|
41
|
+
const __rootDir =
|
|
42
|
+
(workerData && typeof workerData.rootDir === 'string' && workerData.rootDir) ||
|
|
43
|
+
parse(__cwd).root
|
|
44
|
+
const __hostRoot =
|
|
45
|
+
(workerData && typeof workerData.hostRoot === 'string' && workerData.hostRoot) ||
|
|
46
|
+
(process.platform === 'android' ? __cwd : __rootDir)
|
|
40
47
|
|
|
41
48
|
const handler = new MessageHandler({
|
|
42
49
|
onLoad({ wasmModule, wasmMemory }) {
|
|
@@ -44,9 +51,10 @@ const handler = new MessageHandler({
|
|
|
44
51
|
version: 'preview1',
|
|
45
52
|
env: process.env,
|
|
46
53
|
preopens: {
|
|
47
|
-
[__rootDir]:
|
|
54
|
+
[__rootDir]: __hostRoot,
|
|
55
|
+
[__hostRoot]: __hostRoot,
|
|
48
56
|
},
|
|
49
|
-
})
|
|
57
|
+
})
|
|
50
58
|
|
|
51
59
|
return instantiateNapiModuleSync(wasmModule, {
|
|
52
60
|
childThread: true,
|
|
@@ -62,13 +70,13 @@ const handler = new MessageHandler({
|
|
|
62
70
|
...importObject.env,
|
|
63
71
|
...importObject.napi,
|
|
64
72
|
...importObject.emnapi,
|
|
65
|
-
memory: wasmMemory
|
|
66
|
-
}
|
|
73
|
+
memory: wasmMemory,
|
|
74
|
+
}
|
|
67
75
|
},
|
|
68
|
-
})
|
|
76
|
+
})
|
|
69
77
|
},
|
|
70
|
-
})
|
|
78
|
+
})
|
|
71
79
|
|
|
72
80
|
globalThis.onmessage = function (e) {
|
|
73
|
-
handler.handle(e)
|
|
74
|
-
}
|
|
81
|
+
handler.handle(e)
|
|
82
|
+
}
|