@rolldown/browser 1.0.0-beta.10
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/LICENSE +25 -0
- package/bin/cli.mjs +2 -0
- package/dist/cli.cjs +1748 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +1771 -0
- package/dist/config.cjs +12 -0
- package/dist/config.d.cts +11 -0
- package/dist/config.d.mts +11 -0
- package/dist/config.mjs +10 -0
- package/dist/experimental-index.browser.mjs +76 -0
- package/dist/experimental-index.cjs +129 -0
- package/dist/experimental-index.d.cts +96 -0
- package/dist/experimental-index.d.mts +96 -0
- package/dist/experimental-index.mjs +84 -0
- package/dist/filter-index.cjs +53 -0
- package/dist/filter-index.d.cts +3 -0
- package/dist/filter-index.d.mts +3 -0
- package/dist/filter-index.mjs +43 -0
- package/dist/index.browser.mjs +3 -0
- package/dist/index.cjs +9 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +5 -0
- package/dist/parallel-plugin-worker.cjs +33 -0
- package/dist/parallel-plugin-worker.d.cts +1 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/parallel-plugin-worker.mjs +32 -0
- package/dist/parallel-plugin.cjs +8 -0
- package/dist/parallel-plugin.d.cts +14 -0
- package/dist/parallel-plugin.d.mts +14 -0
- package/dist/parallel-plugin.mjs +7 -0
- package/dist/parse-ast-index.cjs +4 -0
- package/dist/parse-ast-index.d.cts +9 -0
- package/dist/parse-ast-index.d.mts +9 -0
- package/dist/parse-ast-index.mjs +3 -0
- package/dist/rolldown-binding.wasi-browser.js +111 -0
- package/dist/rolldown-binding.wasi.cjs +135 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-DDkG_k5U.cjs +39 -0
- package/dist/shared/define-config.d-BBxr6_Bs.d.mts +1167 -0
- package/dist/shared/define-config.d-DII1FzpF.d.cts +1167 -0
- package/dist/shared/dist-BMVjvV-v.cjs +249 -0
- package/dist/shared/dist-JdACkHJM.mjs +147 -0
- package/dist/shared/load-config-CS9U8pRI.cjs +125 -0
- package/dist/shared/load-config-MCu-vRGz.mjs +119 -0
- package/dist/shared/parse-ast-index-BuelS_NF.cjs +314 -0
- package/dist/shared/parse-ast-index-C31FpvkE.mjs +260 -0
- package/dist/shared/prompt-8EeOGx1_.cjs +854 -0
- package/dist/shared/prompt-C3zHEaSG.mjs +852 -0
- package/dist/shared/src-AQQVsE86.mjs +4449 -0
- package/dist/shared/src-DKImwtxN.cjs +4647 -0
- package/dist/src-8Q9XjZLd.js +4329 -0
- package/dist/wasi-worker-browser.mjs +39 -0
- package/dist/wasi-worker.mjs +63 -0
- package/package.json +71 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { instantiateNapiModuleSync, MessageHandler, WASI, createFsProxy } from '@napi-rs/wasm-runtime'
|
|
2
|
+
import { memfsExported as __memfsExported } from '@napi-rs/wasm-runtime/fs'
|
|
3
|
+
|
|
4
|
+
const fs = createFsProxy(__memfsExported)
|
|
5
|
+
|
|
6
|
+
const handler = new MessageHandler({
|
|
7
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
8
|
+
const wasi = new WASI({
|
|
9
|
+
fs,
|
|
10
|
+
preopens: {
|
|
11
|
+
'/': '/',
|
|
12
|
+
},
|
|
13
|
+
print: function () {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log.apply(console, arguments)
|
|
16
|
+
},
|
|
17
|
+
printErr: function() {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.error.apply(console, arguments)
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
23
|
+
childThread: true,
|
|
24
|
+
wasi,
|
|
25
|
+
overwriteImports(importObject) {
|
|
26
|
+
importObject.env = {
|
|
27
|
+
...importObject.env,
|
|
28
|
+
...importObject.napi,
|
|
29
|
+
...importObject.emnapi,
|
|
30
|
+
memory: wasmMemory,
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
globalThis.onmessage = function (e) {
|
|
38
|
+
handler.handle(e)
|
|
39
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 } from "node:worker_threads";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
const { instantiateNapiModuleSync, MessageHandler, getDefaultContext } = require("@napi-rs/wasm-runtime");
|
|
10
|
+
|
|
11
|
+
if (parentPort) {
|
|
12
|
+
parentPort.on("message", (data) => {
|
|
13
|
+
globalThis.onmessage({ data });
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Object.assign(globalThis, {
|
|
18
|
+
self: globalThis,
|
|
19
|
+
require,
|
|
20
|
+
Worker,
|
|
21
|
+
importScripts: function (f) {
|
|
22
|
+
;(0, eval)(fs.readFileSync(f, "utf8") + "//# sourceURL=" + f);
|
|
23
|
+
},
|
|
24
|
+
postMessage: function (msg) {
|
|
25
|
+
if (parentPort) {
|
|
26
|
+
parentPort.postMessage(msg);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const emnapiContext = getDefaultContext();
|
|
32
|
+
|
|
33
|
+
const __rootDir = parse(process.cwd()).root;
|
|
34
|
+
|
|
35
|
+
const handler = new MessageHandler({
|
|
36
|
+
onLoad({ wasmModule, wasmMemory }) {
|
|
37
|
+
const wasi = new WASI({
|
|
38
|
+
version: 'preview1',
|
|
39
|
+
env: process.env,
|
|
40
|
+
preopens: {
|
|
41
|
+
[__rootDir]: __rootDir,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return instantiateNapiModuleSync(wasmModule, {
|
|
46
|
+
childThread: true,
|
|
47
|
+
wasi,
|
|
48
|
+
context: emnapiContext,
|
|
49
|
+
overwriteImports(importObject) {
|
|
50
|
+
importObject.env = {
|
|
51
|
+
...importObject.env,
|
|
52
|
+
...importObject.napi,
|
|
53
|
+
...importObject.emnapi,
|
|
54
|
+
memory: wasmMemory
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
globalThis.onmessage = function (e) {
|
|
62
|
+
handler.handle(e);
|
|
63
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rolldown/browser",
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
|
+
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
|
+
"homepage": "https://rolldown.rs/",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
10
|
+
"directory": "packages/browser"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"webpack",
|
|
15
|
+
"parcel",
|
|
16
|
+
"esbuild",
|
|
17
|
+
"rollup",
|
|
18
|
+
"bundler",
|
|
19
|
+
"rolldown"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"bin",
|
|
23
|
+
"dist",
|
|
24
|
+
"!*/.tsbuildinfo"
|
|
25
|
+
],
|
|
26
|
+
"bin": {
|
|
27
|
+
"rolldown": "./bin/cli.mjs"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"module": "./dist/index.mjs",
|
|
31
|
+
"types": "./dist/index.d.cts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"browser": "./dist/index.browser.mjs",
|
|
35
|
+
"require": "./dist/index.cjs",
|
|
36
|
+
"import": "./dist/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./experimental": {
|
|
39
|
+
"browser": "./dist/experimental-index.browser.mjs",
|
|
40
|
+
"require": "./dist/experimental-index.cjs",
|
|
41
|
+
"import": "./dist/experimental-index.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./parallel-plugin": {
|
|
44
|
+
"require": "./dist/parallel-plugin.cjs",
|
|
45
|
+
"import": "./dist/parallel-plugin.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./parseAst": {
|
|
48
|
+
"require": "./dist/parse-ast-index.cjs",
|
|
49
|
+
"import": "./dist/parse-ast-index.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./package.json": "./package.json"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"registry": "https://registry.npmjs.org/",
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@napi-rs/wasm-runtime": "^0.2.8",
|
|
59
|
+
"@oxc-project/runtime": "0.72.1",
|
|
60
|
+
"@oxc-project/types": "0.72.1",
|
|
61
|
+
"ansis": "^4.0.0",
|
|
62
|
+
"pathe": "^2.0.3"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "pnpm run build:debug",
|
|
66
|
+
"build:debug": "pnpm run --filter rolldown build-browser:debug",
|
|
67
|
+
"build:release": "pnpm run --filter rolldown build-browser:release",
|
|
68
|
+
"build-node": "BROWSER_PKG=1 pnpm run --filter rolldown build-node",
|
|
69
|
+
"preinstall": "npx only-allow pnpm"
|
|
70
|
+
}
|
|
71
|
+
}
|