@oxc-minify/binding-wasm32-wasi 0.149.0 → 0.151.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 +427 -26
- package/minify.wasi.cjs +460 -41
- package/minify.wasi.d.cts +27 -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.d.cts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/** The WASI flavor this loader instantiates. */
|
|
5
|
+
export declare const __napiBindingTarget: 'wasm32-wasi'
|
|
6
|
+
|
|
3
7
|
export interface CodegenOptions {
|
|
4
8
|
/**
|
|
5
9
|
* Remove whitespace.
|
|
@@ -7,6 +11,24 @@ export interface CodegenOptions {
|
|
|
7
11
|
* @default true
|
|
8
12
|
*/
|
|
9
13
|
removeWhitespace?: boolean
|
|
14
|
+
/**
|
|
15
|
+
* Escape non-ASCII characters in string literals, untagged template literals, regular
|
|
16
|
+
* expression literals and identifier names.
|
|
17
|
+
*
|
|
18
|
+
* Uses `\uXXXX` for characters up to U+FFFF and `\u{...}` for higher code points.
|
|
19
|
+
* Regular expressions use escaped UTF-16 surrogate pairs for higher code points instead;
|
|
20
|
+
* escaping changes the observable `RegExp.prototype.source` value.
|
|
21
|
+
*
|
|
22
|
+
* Code point escapes (`\u{...}`) require ES2015 or later; this option does not provide
|
|
23
|
+
* ES5-compatible output.
|
|
24
|
+
*
|
|
25
|
+
* Non-ASCII characters are left unescaped in tagged template quasis (whose raw text is
|
|
26
|
+
* observable), JSX names and text, JSX attribute strings, hashbangs and preserved comments.
|
|
27
|
+
* JavaScript expressions inside tagged templates and JSX are escaped normally.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
asciiOnly?: boolean
|
|
10
32
|
/**
|
|
11
33
|
* How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
|
|
12
34
|
*
|
|
@@ -18,7 +40,7 @@ export interface CodegenOptions {
|
|
|
18
40
|
*
|
|
19
41
|
* @default "none" (when minifying)
|
|
20
42
|
*/
|
|
21
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
|
|
43
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string }
|
|
22
44
|
}
|
|
23
45
|
|
|
24
46
|
export interface CompressOptions {
|
|
@@ -121,7 +143,7 @@ export declare const enum LegalCommentsMode {
|
|
|
121
143
|
/** Move all legal comments to the end of the file. */
|
|
122
144
|
Eof = 'eof',
|
|
123
145
|
/** Extract legal comments without linking. */
|
|
124
|
-
External = 'external'
|
|
146
|
+
External = 'external',
|
|
125
147
|
}
|
|
126
148
|
|
|
127
149
|
export interface MangleOptions {
|
|
@@ -291,6 +313,7 @@ export interface TreeShakeOptions {
|
|
|
291
313
|
*/
|
|
292
314
|
invalidImportSideEffects?: boolean
|
|
293
315
|
}
|
|
316
|
+
|
|
294
317
|
export interface Comment {
|
|
295
318
|
type: 'Line' | 'Block'
|
|
296
319
|
value: string
|
|
@@ -315,8 +338,9 @@ export interface OxcError {
|
|
|
315
338
|
export declare const enum Severity {
|
|
316
339
|
Error = 'Error',
|
|
317
340
|
Warning = 'Warning',
|
|
318
|
-
Advice = 'Advice'
|
|
341
|
+
Advice = 'Advice',
|
|
319
342
|
}
|
|
343
|
+
|
|
320
344
|
export interface SourceMap {
|
|
321
345
|
file?: string
|
|
322
346
|
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.151.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
|
+
}
|