@oxc-minify/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/minify.wasi-browser.js +2 -2
- package/minify.wasi.cjs +20 -17
- package/minify.wasi.d.cts +24 -3
- package/minify.wasm32-wasi.wasm +0 -0
- package/package.json +3 -3
- package/wasi-worker-browser.mjs +1 -3
- package/wasi-worker.mjs +31 -23
package/minify.wasi-browser.js
CHANGED
|
@@ -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/minify.wasi.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["LegalCommentsMode","minify","minifySync","Severity"],"managedRootEntries":["browser.js","index.js","minify.wasm","minify.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
|
},
|
package/minify.wasi.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
export interface CodegenOptions {
|
|
4
5
|
/**
|
|
5
6
|
* Remove whitespace.
|
|
@@ -7,6 +8,24 @@ export interface CodegenOptions {
|
|
|
7
8
|
* @default true
|
|
8
9
|
*/
|
|
9
10
|
removeWhitespace?: boolean
|
|
11
|
+
/**
|
|
12
|
+
* Escape non-ASCII characters in string literals, untagged template literals, regular
|
|
13
|
+
* expression literals and identifier names.
|
|
14
|
+
*
|
|
15
|
+
* Uses `\uXXXX` for characters up to U+FFFF and `\u{...}` for higher code points.
|
|
16
|
+
* Regular expressions use escaped UTF-16 surrogate pairs for higher code points instead;
|
|
17
|
+
* escaping changes the observable `RegExp.prototype.source` value.
|
|
18
|
+
*
|
|
19
|
+
* Code point escapes (`\u{...}`) require ES2015 or later; this option does not provide
|
|
20
|
+
* ES5-compatible output.
|
|
21
|
+
*
|
|
22
|
+
* Non-ASCII characters are left unescaped in tagged template quasis (whose raw text is
|
|
23
|
+
* observable), JSX names and text, JSX attribute strings, hashbangs and preserved comments.
|
|
24
|
+
* JavaScript expressions inside tagged templates and JSX are escaped normally.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
asciiOnly?: boolean
|
|
10
29
|
/**
|
|
11
30
|
* How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
|
|
12
31
|
*
|
|
@@ -18,7 +37,7 @@ export interface CodegenOptions {
|
|
|
18
37
|
*
|
|
19
38
|
* @default "none" (when minifying)
|
|
20
39
|
*/
|
|
21
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
|
|
40
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
|
|
22
41
|
}
|
|
23
42
|
|
|
24
43
|
export interface CompressOptions {
|
|
@@ -121,7 +140,7 @@ export declare const enum LegalCommentsMode {
|
|
|
121
140
|
/** Move all legal comments to the end of the file. */
|
|
122
141
|
Eof = 'eof',
|
|
123
142
|
/** Extract legal comments without linking. */
|
|
124
|
-
External = 'external'
|
|
143
|
+
External = 'external',
|
|
125
144
|
}
|
|
126
145
|
|
|
127
146
|
export interface MangleOptions {
|
|
@@ -291,6 +310,7 @@ export interface TreeShakeOptions {
|
|
|
291
310
|
*/
|
|
292
311
|
invalidImportSideEffects?: boolean
|
|
293
312
|
}
|
|
313
|
+
|
|
294
314
|
export interface Comment {
|
|
295
315
|
type: 'Line' | 'Block'
|
|
296
316
|
value: string
|
|
@@ -315,8 +335,9 @@ export interface OxcError {
|
|
|
315
335
|
export declare const enum Severity {
|
|
316
336
|
Error = 'Error',
|
|
317
337
|
Warning = 'Warning',
|
|
318
|
-
Advice = 'Advice'
|
|
338
|
+
Advice = 'Advice',
|
|
319
339
|
}
|
|
340
|
+
|
|
320
341
|
export interface SourceMap {
|
|
321
342
|
file?: string
|
|
322
343
|
mappings: string
|
package/minify.wasm32-wasi.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxc-minify/binding-wasm32-wasi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.150.0",
|
|
4
4
|
"main": "minify.wasi.cjs",
|
|
5
5
|
"files": [
|
|
6
6
|
"minify.wasm32-wasi.wasm",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"browser": "minify.wasi-browser.js",
|
|
41
41
|
"type": "module",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@napi-rs/wasm-runtime": "~1.2.
|
|
43
|
+
"@napi-rs/wasm-runtime": "~1.2.4",
|
|
44
44
|
"@emnapi/core": "2.0.0-alpha.3",
|
|
45
45
|
"@emnapi/runtime": "2.0.0-alpha.3"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
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
|
+
}
|