@rolldown/browser 1.0.0-beta.7-commit.a0a7d95
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/browser-bundler.mjs +3514 -0
- package/dist/browser.js +4626 -0
- package/dist/cli.cjs +1759 -0
- package/dist/cli.mjs +1828 -0
- package/dist/experimental-index.cjs +87 -0
- package/dist/experimental-index.mjs +67 -0
- package/dist/index.cjs +9 -0
- package/dist/index.mjs +5 -0
- package/dist/parallel-plugin-worker.cjs +43 -0
- package/dist/parallel-plugin-worker.mjs +48 -0
- package/dist/parallel-plugin.cjs +9 -0
- package/dist/parallel-plugin.mjs +8 -0
- package/dist/parse-ast-index.cjs +4 -0
- package/dist/parse-ast-index.mjs +4 -0
- package/dist/rolldown-binding.wasi-browser.js +102 -0
- package/dist/rolldown-binding.wasi.cjs +127 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-BuCFLigr.mjs +12 -0
- package/dist/shared/chunk-Dc32QXFI.cjs +31 -0
- package/dist/shared/parse-ast-index-C29iO6Jv.cjs +316 -0
- package/dist/shared/parse-ast-index-GcZLh6_d.mjs +273 -0
- package/dist/shared/prompt-B3VJLbs9.mjs +854 -0
- package/dist/shared/prompt-wpCBKCzA.cjs +855 -0
- package/dist/shared/src-6_rb-jCl.cjs +3147 -0
- package/dist/shared/src-QrPvO0Ec.mjs +4375 -0
- package/dist/types/api/build.d.ts +18 -0
- package/dist/types/api/experimental.d.ts +7 -0
- package/dist/types/api/rolldown/index.d.ts +3 -0
- package/dist/types/api/rolldown/rolldown-build.d.ts +15 -0
- package/dist/types/api/watch/index.d.ts +3 -0
- package/dist/types/api/watch/watch-emitter.d.ts +31 -0
- package/dist/types/api/watch/watcher.d.ts +13 -0
- package/dist/types/binding.d.ts +1504 -0
- package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
- package/dist/types/builtin-plugin/constructors.d.ts +22 -0
- package/dist/types/builtin-plugin/replace-plugin.d.ts +27 -0
- package/dist/types/builtin-plugin/transform-plugin.d.ts +9 -0
- package/dist/types/builtin-plugin/utils.d.ts +8 -0
- package/dist/types/cli/arguments/alias.d.ts +16 -0
- package/dist/types/cli/arguments/index.d.ts +15 -0
- package/dist/types/cli/arguments/normalize.d.ts +16 -0
- package/dist/types/cli/arguments/utils.d.ts +8 -0
- package/dist/types/cli/commands/bundle.d.ts +3 -0
- package/dist/types/cli/commands/help.d.ts +1 -0
- package/dist/types/cli/index.d.ts +1 -0
- package/dist/types/cli/load-config.d.ts +5 -0
- package/dist/types/cli/logger.d.ts +5 -0
- package/dist/types/constants/plugin-context.d.ts +7 -0
- package/dist/types/constants/plugin.d.ts +45 -0
- package/dist/types/experimental-index.d.ts +9 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/log/log-handler.d.ts +4 -0
- package/dist/types/log/logger.d.ts +6 -0
- package/dist/types/log/logging.d.ts +12 -0
- package/dist/types/log/logs.d.ts +18 -0
- package/dist/types/options/generated/checks-options.d.ts +57 -0
- package/dist/types/options/input-options.d.ts +185 -0
- package/dist/types/options/normalized-input-options.d.ts +18 -0
- package/dist/types/options/normalized-output-options.d.ts +70 -0
- package/dist/types/options/output-options.d.ts +182 -0
- package/dist/types/options/watch-options.d.ts +5 -0
- package/dist/types/parallel-plugin-worker.d.ts +1 -0
- package/dist/types/parallel-plugin.d.ts +1 -0
- package/dist/types/parse-ast-index.d.ts +5 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +10 -0
- package/dist/types/plugin/bindingify-hook-filter.d.ts +7 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +14 -0
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +8 -0
- package/dist/types/plugin/bindingify-plugin.d.ts +17 -0
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +5 -0
- package/dist/types/plugin/hook-filter.d.ts +49 -0
- package/dist/types/plugin/index.d.ts +141 -0
- package/dist/types/plugin/minimal-plugin-context.d.ts +24 -0
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +10 -0
- package/dist/types/plugin/parallel-plugin.d.ts +9 -0
- package/dist/types/plugin/plugin-context-data.d.ts +21 -0
- package/dist/types/plugin/plugin-context.d.ts +67 -0
- package/dist/types/plugin/plugin-driver.d.ts +10 -0
- package/dist/types/plugin/transform-plugin-context.d.ts +28 -0
- package/dist/types/plugin/with-filter.d.ts +10 -0
- package/dist/types/types/assert.d.ts +14 -0
- package/dist/types/types/config-export.d.ts +5 -0
- package/dist/types/types/misc.d.ts +40 -0
- package/dist/types/types/module-info.d.ts +15 -0
- package/dist/types/types/module-side-effects.d.ts +12 -0
- package/dist/types/types/output-bundle.d.ts +4 -0
- package/dist/types/types/rolldown-options.d.ts +5 -0
- package/dist/types/types/rolldown-output.d.ts +66 -0
- package/dist/types/types/schema.d.ts +33 -0
- package/dist/types/types/sourcemap.d.ts +14 -0
- package/dist/types/types/utils.d.ts +13 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types/utils/asset-source.d.ts +4 -0
- package/dist/types/utils/async-flatten.d.ts +1 -0
- package/dist/types/utils/bindingify-input-options.d.ts +7 -0
- package/dist/types/utils/bindingify-output-options.d.ts +5 -0
- package/dist/types/utils/code-frame.d.ts +1 -0
- package/dist/types/utils/compose-js-plugins.d.ts +2 -0
- package/dist/types/utils/create-bundler-option.d.ts +11 -0
- package/dist/types/utils/create-bundler.d.ts +9 -0
- package/dist/types/utils/define-config.d.ts +5 -0
- package/dist/types/utils/error.d.ts +2 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +17 -0
- package/dist/types/utils/misc.d.ts +7 -0
- package/dist/types/utils/normalize-hook.d.ts +7 -0
- package/dist/types/utils/normalize-plugin-option.d.ts +13 -0
- package/dist/types/utils/normalize-string-or-regex.d.ts +2 -0
- package/dist/types/utils/plugin/index.d.ts +2 -0
- package/dist/types/utils/resolved-external.d.ts +4 -0
- package/dist/types/utils/transform-module-info.d.ts +4 -0
- package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
- package/dist/types/utils/transform-rendered-module.d.ts +3 -0
- package/dist/types/utils/transform-side-effects.d.ts +3 -0
- package/dist/types/utils/transform-sourcemap.d.ts +3 -0
- package/dist/types/utils/transform-to-rollup-output.d.ts +11 -0
- package/dist/types/utils/validator.d.ts +6 -0
- package/dist/wasi-worker-browser.mjs +39 -0
- package/dist/wasi-worker.mjs +63 -0
- package/package.json +85 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_chunk = require('./shared/chunk-Dc32QXFI.cjs');
|
|
3
|
+
const require_src = require('./shared/src-6_rb-jCl.cjs');
|
|
4
|
+
require('./shared/parse-ast-index-C29iO6Jv.cjs');
|
|
5
|
+
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
|
|
6
|
+
const node_url = require_chunk.__toESM(require("node:url"));
|
|
7
|
+
|
|
8
|
+
//#region src/api/experimental.ts
|
|
9
|
+
const experimental_scan = async (input) => {
|
|
10
|
+
const { bundler, stopWorkers } = await require_src.createBundler(input, {});
|
|
11
|
+
const output = await bundler.scan();
|
|
12
|
+
require_src.handleOutputErrors(output);
|
|
13
|
+
await stopWorkers?.();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/plugin/parallel-plugin.ts
|
|
18
|
+
function defineParallelPlugin(pluginPath) {
|
|
19
|
+
return (options) => {
|
|
20
|
+
return { _parallel: {
|
|
21
|
+
fileUrl: (0, node_url.pathToFileURL)(pluginPath).href,
|
|
22
|
+
options
|
|
23
|
+
} };
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/builtin-plugin/alias-plugin.ts
|
|
29
|
+
function aliasPlugin(config) {
|
|
30
|
+
return new require_src.BuiltinPlugin("builtin:alias", config);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/builtin-plugin/replace-plugin.ts
|
|
35
|
+
function replacePlugin(values = {}, options = {}) {
|
|
36
|
+
return new require_src.BuiltinPlugin("builtin:replace", {
|
|
37
|
+
...options,
|
|
38
|
+
values
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/builtin-plugin/transform-plugin.ts
|
|
44
|
+
function normalizeEcmaTransformPluginConfig(config) {
|
|
45
|
+
if (!config) return void 0;
|
|
46
|
+
let normalizedConfig = {
|
|
47
|
+
...config,
|
|
48
|
+
exclude: require_src.normalizedStringOrRegex(config.exclude),
|
|
49
|
+
include: require_src.normalizedStringOrRegex(config.include)
|
|
50
|
+
};
|
|
51
|
+
return normalizedConfig;
|
|
52
|
+
}
|
|
53
|
+
function transformPlugin(config) {
|
|
54
|
+
return new require_src.BuiltinPlugin("builtin:transform", normalizeEcmaTransformPluginConfig(config));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.aliasPlugin = aliasPlugin
|
|
59
|
+
exports.buildImportAnalysisPlugin = require_src.buildImportAnalysisPlugin
|
|
60
|
+
exports.composePlugins = require_src.composeJsPlugins
|
|
61
|
+
exports.defineParallelPlugin = defineParallelPlugin
|
|
62
|
+
exports.dynamicImportVarsPlugin = require_src.dynamicImportVarsPlugin
|
|
63
|
+
exports.importGlobPlugin = require_src.importGlobPlugin
|
|
64
|
+
exports.isolatedDeclarationPlugin = require_src.isolatedDeclarationPlugin
|
|
65
|
+
exports.jsonPlugin = require_src.jsonPlugin
|
|
66
|
+
exports.loadFallbackPlugin = require_src.loadFallbackPlugin
|
|
67
|
+
exports.manifestPlugin = require_src.manifestPlugin
|
|
68
|
+
exports.moduleFederationPlugin = require_src.moduleFederationPlugin
|
|
69
|
+
exports.modulePreloadPolyfillPlugin = require_src.modulePreloadPolyfillPlugin
|
|
70
|
+
Object.defineProperty(exports, 'moduleRunnerTransform', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return src_rolldown_binding_wasi_cjs.moduleRunnerTransform;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
exports.replacePlugin = replacePlugin
|
|
77
|
+
exports.scan = experimental_scan
|
|
78
|
+
Object.defineProperty(exports, 'transform', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return src_rolldown_binding_wasi_cjs.transform;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
exports.transformPlugin = transformPlugin
|
|
85
|
+
exports.viteResolvePlugin = require_src.viteResolvePlugin
|
|
86
|
+
exports.wasmFallbackPlugin = require_src.wasmFallbackPlugin
|
|
87
|
+
exports.wasmHelperPlugin = require_src.wasmHelperPlugin
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_transform_to_rollup_output, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "./shared/src-QrPvO0Ec.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-GcZLh6_d.mjs";
|
|
3
|
+
import { moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
//#region src/api/experimental.ts
|
|
7
|
+
init_create_bundler();
|
|
8
|
+
init_transform_to_rollup_output();
|
|
9
|
+
const experimental_scan = async (input) => {
|
|
10
|
+
const { bundler, stopWorkers } = await createBundler(input, {});
|
|
11
|
+
const output = await bundler.scan();
|
|
12
|
+
handleOutputErrors(output);
|
|
13
|
+
await stopWorkers?.();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/plugin/parallel-plugin.ts
|
|
18
|
+
function defineParallelPlugin(pluginPath) {
|
|
19
|
+
return (options) => {
|
|
20
|
+
return { _parallel: {
|
|
21
|
+
fileUrl: pathToFileURL(pluginPath).href,
|
|
22
|
+
options
|
|
23
|
+
} };
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/builtin-plugin/alias-plugin.ts
|
|
29
|
+
init_constructors();
|
|
30
|
+
function aliasPlugin(config) {
|
|
31
|
+
return new BuiltinPlugin("builtin:alias", config);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/builtin-plugin/replace-plugin.ts
|
|
36
|
+
init_constructors();
|
|
37
|
+
function replacePlugin(values = {}, options = {}) {
|
|
38
|
+
return new BuiltinPlugin("builtin:replace", {
|
|
39
|
+
...options,
|
|
40
|
+
values
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/builtin-plugin/transform-plugin.ts
|
|
46
|
+
init_constructors();
|
|
47
|
+
init_normalize_string_or_regex();
|
|
48
|
+
function normalizeEcmaTransformPluginConfig(config) {
|
|
49
|
+
if (!config) return void 0;
|
|
50
|
+
let normalizedConfig = {
|
|
51
|
+
...config,
|
|
52
|
+
exclude: normalizedStringOrRegex(config.exclude),
|
|
53
|
+
include: normalizedStringOrRegex(config.include)
|
|
54
|
+
};
|
|
55
|
+
return normalizedConfig;
|
|
56
|
+
}
|
|
57
|
+
function transformPlugin(config) {
|
|
58
|
+
return new BuiltinPlugin("builtin:transform", normalizeEcmaTransformPluginConfig(config));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/experimental-index.ts
|
|
63
|
+
init_compose_js_plugins();
|
|
64
|
+
init_constructors();
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_src = require('./shared/src-6_rb-jCl.cjs');
|
|
2
|
+
require('./shared/parse-ast-index-C29iO6Jv.cjs');
|
|
3
|
+
|
|
4
|
+
exports.VERSION = require_src.VERSION
|
|
5
|
+
exports.build = require_src.build
|
|
6
|
+
exports.defineConfig = require_src.defineConfig
|
|
7
|
+
exports.rolldown = require_src.rolldown
|
|
8
|
+
exports.watch = require_src.watch
|
|
9
|
+
exports.withFilter = require_src.withFilter
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_chunk = require('./shared/chunk-Dc32QXFI.cjs');
|
|
2
|
+
const require_src = require('./shared/src-6_rb-jCl.cjs');
|
|
3
|
+
require('./shared/parse-ast-index-C29iO6Jv.cjs');
|
|
4
|
+
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
|
|
5
|
+
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
6
|
+
|
|
7
|
+
//#region src/parallel-plugin-worker.ts
|
|
8
|
+
const { registryId, pluginInfos, threadNumber } = node_worker_threads.workerData;
|
|
9
|
+
(async () => {
|
|
10
|
+
try {
|
|
11
|
+
const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
12
|
+
const pluginModule = await import(pluginInfo.fileUrl);
|
|
13
|
+
const definePluginImpl = pluginModule.default;
|
|
14
|
+
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
15
|
+
return {
|
|
16
|
+
index: pluginInfo.index,
|
|
17
|
+
plugin: require_src.bindingifyPlugin(
|
|
18
|
+
plugin,
|
|
19
|
+
{},
|
|
20
|
+
{},
|
|
21
|
+
// TODO need to find a way to share pluginContextData
|
|
22
|
+
new require_src.PluginContextData(),
|
|
23
|
+
[],
|
|
24
|
+
() => {},
|
|
25
|
+
"info",
|
|
26
|
+
// TODO: support this.meta.watchMode
|
|
27
|
+
false
|
|
28
|
+
)
|
|
29
|
+
};
|
|
30
|
+
}));
|
|
31
|
+
(0, src_rolldown_binding_wasi_cjs.registerPlugins)(registryId, plugins);
|
|
32
|
+
node_worker_threads.parentPort.postMessage({ type: "success" });
|
|
33
|
+
} catch (error) {
|
|
34
|
+
node_worker_threads.parentPort.postMessage({
|
|
35
|
+
type: "error",
|
|
36
|
+
error
|
|
37
|
+
});
|
|
38
|
+
} finally {
|
|
39
|
+
node_worker_threads.parentPort.unref();
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __commonJS } from "./shared/chunk-BuCFLigr.mjs";
|
|
2
|
+
import { PluginContextData, bindingifyPlugin, init_bindingify_plugin, init_plugin_context_data } from "./shared/src-QrPvO0Ec.mjs";
|
|
3
|
+
import "./shared/parse-ast-index-GcZLh6_d.mjs";
|
|
4
|
+
import { registerPlugins } from "./rolldown-binding.wasi.cjs";
|
|
5
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
6
|
+
|
|
7
|
+
//#region src/parallel-plugin-worker.ts
|
|
8
|
+
var require_parallel_plugin_worker = __commonJS({ "src/parallel-plugin-worker.ts"() {
|
|
9
|
+
init_bindingify_plugin();
|
|
10
|
+
init_plugin_context_data();
|
|
11
|
+
const { registryId, pluginInfos, threadNumber } = workerData;
|
|
12
|
+
(async () => {
|
|
13
|
+
try {
|
|
14
|
+
const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
15
|
+
const pluginModule = await import(pluginInfo.fileUrl);
|
|
16
|
+
const definePluginImpl = pluginModule.default;
|
|
17
|
+
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
18
|
+
return {
|
|
19
|
+
index: pluginInfo.index,
|
|
20
|
+
plugin: bindingifyPlugin(
|
|
21
|
+
plugin,
|
|
22
|
+
{},
|
|
23
|
+
{},
|
|
24
|
+
// TODO need to find a way to share pluginContextData
|
|
25
|
+
new PluginContextData(),
|
|
26
|
+
[],
|
|
27
|
+
() => {},
|
|
28
|
+
"info",
|
|
29
|
+
// TODO: support this.meta.watchMode
|
|
30
|
+
false
|
|
31
|
+
)
|
|
32
|
+
};
|
|
33
|
+
}));
|
|
34
|
+
registerPlugins(registryId, plugins);
|
|
35
|
+
parentPort.postMessage({ type: "success" });
|
|
36
|
+
} catch (error) {
|
|
37
|
+
parentPort.postMessage({
|
|
38
|
+
type: "error",
|
|
39
|
+
error
|
|
40
|
+
});
|
|
41
|
+
} finally {
|
|
42
|
+
parentPort.unref();
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
} });
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export default require_parallel_plugin_worker();
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
instantiateNapiModule as __emnapiInstantiateNapiModule,
|
|
3
|
+
getDefaultContext as __emnapiGetDefaultContext,
|
|
4
|
+
WASI as __WASI,
|
|
5
|
+
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
6
|
+
} from '@napi-rs/wasm-runtime'
|
|
7
|
+
import { memfs } from '@napi-rs/wasm-runtime/fs'
|
|
8
|
+
import __wasmUrl from './rolldown-binding.wasm32-wasi.wasm?url'
|
|
9
|
+
|
|
10
|
+
export const { fs: __fs, vol: __volume } = memfs()
|
|
11
|
+
|
|
12
|
+
const __wasi = new __WASI({
|
|
13
|
+
version: 'preview1',
|
|
14
|
+
fs: __fs,
|
|
15
|
+
preopens: {
|
|
16
|
+
'/': '/',
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const __emnapiContext = __emnapiGetDefaultContext()
|
|
21
|
+
|
|
22
|
+
const __sharedMemory = new WebAssembly.Memory({
|
|
23
|
+
initial: 16384,
|
|
24
|
+
maximum: 65536,
|
|
25
|
+
shared: true,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
instance: __napiInstance,
|
|
32
|
+
module: __wasiModule,
|
|
33
|
+
napiModule: __napiModule,
|
|
34
|
+
} = await __emnapiInstantiateNapiModule(__wasmFile, {
|
|
35
|
+
context: __emnapiContext,
|
|
36
|
+
asyncWorkPoolSize: 4,
|
|
37
|
+
wasi: __wasi,
|
|
38
|
+
onCreateWorker() {
|
|
39
|
+
const worker = new Worker(new URL('./wasi-worker-browser.mjs', import.meta.url), {
|
|
40
|
+
type: 'module',
|
|
41
|
+
})
|
|
42
|
+
worker.addEventListener('message', __wasmCreateOnMessageForFsProxy(__fs))
|
|
43
|
+
|
|
44
|
+
return worker
|
|
45
|
+
},
|
|
46
|
+
overwriteImports(importObject) {
|
|
47
|
+
importObject.env = {
|
|
48
|
+
...importObject.env,
|
|
49
|
+
...importObject.napi,
|
|
50
|
+
...importObject.emnapi,
|
|
51
|
+
memory: __sharedMemory,
|
|
52
|
+
}
|
|
53
|
+
return importObject
|
|
54
|
+
},
|
|
55
|
+
beforeInit({ instance }) {
|
|
56
|
+
for (const name of Object.keys(instance.exports)) {
|
|
57
|
+
if (name.startsWith('__napi_register__')) {
|
|
58
|
+
instance.exports[name]()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
export const BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
64
|
+
export const BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
65
|
+
export const BindingError = __napiModule.exports.BindingError
|
|
66
|
+
export const BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
67
|
+
export const BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
68
|
+
export const BindingOutputAsset = __napiModule.exports.BindingOutputAsset
|
|
69
|
+
export const BindingOutputChunk = __napiModule.exports.BindingOutputChunk
|
|
70
|
+
export const BindingOutputs = __napiModule.exports.BindingOutputs
|
|
71
|
+
export const BindingPluginContext = __napiModule.exports.BindingPluginContext
|
|
72
|
+
export const BindingRenderedChunk = __napiModule.exports.BindingRenderedChunk
|
|
73
|
+
export const BindingRenderedChunkMeta = __napiModule.exports.BindingRenderedChunkMeta
|
|
74
|
+
export const BindingRenderedModule = __napiModule.exports.BindingRenderedModule
|
|
75
|
+
export const BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
76
|
+
export const BindingWatcher = __napiModule.exports.BindingWatcher
|
|
77
|
+
export const BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
78
|
+
export const BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
79
|
+
export const Bundler = __napiModule.exports.Bundler
|
|
80
|
+
export const ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
81
|
+
export const ParseResult = __napiModule.exports.ParseResult
|
|
82
|
+
export const BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
83
|
+
export const BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
84
|
+
export const BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
85
|
+
export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
86
|
+
export const ExportExportNameKind = __napiModule.exports.ExportExportNameKind
|
|
87
|
+
export const ExportImportNameKind = __napiModule.exports.ExportImportNameKind
|
|
88
|
+
export const ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind
|
|
89
|
+
export const getBufferOffset = __napiModule.exports.getBufferOffset
|
|
90
|
+
export const HelperMode = __napiModule.exports.HelperMode
|
|
91
|
+
export const ImportNameKind = __napiModule.exports.ImportNameKind
|
|
92
|
+
export const isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
93
|
+
export const moduleRunnerTransform = __napiModule.exports.moduleRunnerTransform
|
|
94
|
+
export const parseAsync = __napiModule.exports.parseAsync
|
|
95
|
+
export const parseSync = __napiModule.exports.parseSync
|
|
96
|
+
export const parseSyncRaw = __napiModule.exports.parseSyncRaw
|
|
97
|
+
export const rawTransferSupported = __napiModule.exports.rawTransferSupported
|
|
98
|
+
export const registerPlugins = __napiModule.exports.registerPlugins
|
|
99
|
+
export const Severity = __napiModule.exports.Severity
|
|
100
|
+
export const shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
101
|
+
export const startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
102
|
+
export const transform = __napiModule.exports.transform
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
const __nodeFs = require('node:fs')
|
|
7
|
+
const __nodePath = require('node:path')
|
|
8
|
+
const { WASI: __nodeWASI } = require('node:wasi')
|
|
9
|
+
const { Worker } = require('node:worker_threads')
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
|
13
|
+
getDefaultContext: __emnapiGetDefaultContext,
|
|
14
|
+
createOnMessage: __wasmCreateOnMessageForFsProxy,
|
|
15
|
+
} = require('@napi-rs/wasm-runtime')
|
|
16
|
+
|
|
17
|
+
const __rootDir = __nodePath.parse(process.cwd()).root
|
|
18
|
+
|
|
19
|
+
const __wasi = new __nodeWASI({
|
|
20
|
+
version: 'preview1',
|
|
21
|
+
env: process.env,
|
|
22
|
+
preopens: {
|
|
23
|
+
[__rootDir]: __rootDir,
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const __emnapiContext = __emnapiGetDefaultContext()
|
|
28
|
+
|
|
29
|
+
const __sharedMemory = new WebAssembly.Memory({
|
|
30
|
+
initial: 16384,
|
|
31
|
+
maximum: 65536,
|
|
32
|
+
shared: true,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
let __wasmFilePath = __nodePath.join(__dirname, 'rolldown-binding.wasm32-wasi.wasm')
|
|
36
|
+
const __wasmDebugFilePath = __nodePath.join(__dirname, 'rolldown-binding.wasm32-wasi.debug.wasm')
|
|
37
|
+
|
|
38
|
+
if (__nodeFs.existsSync(__wasmDebugFilePath)) {
|
|
39
|
+
__wasmFilePath = __wasmDebugFilePath
|
|
40
|
+
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
|
|
41
|
+
try {
|
|
42
|
+
__wasmFilePath = __nodePath.resolve('@rolldown/binding-wasm32-wasi')
|
|
43
|
+
} catch {
|
|
44
|
+
throw new Error('Cannot find rolldown-binding.wasm32-wasi.wasm file, and @rolldown/binding-wasm32-wasi package is not installed.')
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule } = __emnapiInstantiateNapiModuleSync(__nodeFs.readFileSync(__wasmFilePath), {
|
|
49
|
+
context: __emnapiContext,
|
|
50
|
+
asyncWorkPoolSize: (function() {
|
|
51
|
+
const threadsSizeFromEnv = Number(process.env.NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process.env.UV_THREADPOOL_SIZE)
|
|
52
|
+
// NaN > 0 is false
|
|
53
|
+
if (threadsSizeFromEnv > 0) {
|
|
54
|
+
return threadsSizeFromEnv
|
|
55
|
+
} else {
|
|
56
|
+
return 4
|
|
57
|
+
}
|
|
58
|
+
})(),
|
|
59
|
+
reuseWorker: true,
|
|
60
|
+
wasi: __wasi,
|
|
61
|
+
onCreateWorker() {
|
|
62
|
+
const worker = new Worker(__nodePath.join(__dirname, 'wasi-worker.mjs'), {
|
|
63
|
+
env: process.env,
|
|
64
|
+
})
|
|
65
|
+
worker.onmessage = ({ data }) => {
|
|
66
|
+
__wasmCreateOnMessageForFsProxy(__nodeFs)(data)
|
|
67
|
+
}
|
|
68
|
+
return worker
|
|
69
|
+
},
|
|
70
|
+
overwriteImports(importObject) {
|
|
71
|
+
importObject.env = {
|
|
72
|
+
...importObject.env,
|
|
73
|
+
...importObject.napi,
|
|
74
|
+
...importObject.emnapi,
|
|
75
|
+
memory: __sharedMemory,
|
|
76
|
+
}
|
|
77
|
+
return importObject
|
|
78
|
+
},
|
|
79
|
+
beforeInit({ instance }) {
|
|
80
|
+
for (const name of Object.keys(instance.exports)) {
|
|
81
|
+
if (name.startsWith('__napi_register__')) {
|
|
82
|
+
instance.exports[name]()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
module.exports.BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
89
|
+
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
90
|
+
module.exports.BindingError = __napiModule.exports.BindingError
|
|
91
|
+
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
92
|
+
module.exports.BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
93
|
+
module.exports.BindingOutputAsset = __napiModule.exports.BindingOutputAsset
|
|
94
|
+
module.exports.BindingOutputChunk = __napiModule.exports.BindingOutputChunk
|
|
95
|
+
module.exports.BindingOutputs = __napiModule.exports.BindingOutputs
|
|
96
|
+
module.exports.BindingPluginContext = __napiModule.exports.BindingPluginContext
|
|
97
|
+
module.exports.BindingRenderedChunk = __napiModule.exports.BindingRenderedChunk
|
|
98
|
+
module.exports.BindingRenderedChunkMeta = __napiModule.exports.BindingRenderedChunkMeta
|
|
99
|
+
module.exports.BindingRenderedModule = __napiModule.exports.BindingRenderedModule
|
|
100
|
+
module.exports.BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
101
|
+
module.exports.BindingWatcher = __napiModule.exports.BindingWatcher
|
|
102
|
+
module.exports.BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
103
|
+
module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
104
|
+
module.exports.Bundler = __napiModule.exports.Bundler
|
|
105
|
+
module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
106
|
+
module.exports.ParseResult = __napiModule.exports.ParseResult
|
|
107
|
+
module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
108
|
+
module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
109
|
+
module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
110
|
+
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
111
|
+
module.exports.ExportExportNameKind = __napiModule.exports.ExportExportNameKind
|
|
112
|
+
module.exports.ExportImportNameKind = __napiModule.exports.ExportImportNameKind
|
|
113
|
+
module.exports.ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind
|
|
114
|
+
module.exports.getBufferOffset = __napiModule.exports.getBufferOffset
|
|
115
|
+
module.exports.HelperMode = __napiModule.exports.HelperMode
|
|
116
|
+
module.exports.ImportNameKind = __napiModule.exports.ImportNameKind
|
|
117
|
+
module.exports.isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
118
|
+
module.exports.moduleRunnerTransform = __napiModule.exports.moduleRunnerTransform
|
|
119
|
+
module.exports.parseAsync = __napiModule.exports.parseAsync
|
|
120
|
+
module.exports.parseSync = __napiModule.exports.parseSync
|
|
121
|
+
module.exports.parseSyncRaw = __napiModule.exports.parseSyncRaw
|
|
122
|
+
module.exports.rawTransferSupported = __napiModule.exports.rawTransferSupported
|
|
123
|
+
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
124
|
+
module.exports.Severity = __napiModule.exports.Severity
|
|
125
|
+
module.exports.shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
126
|
+
module.exports.startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
127
|
+
module.exports.transform = __napiModule.exports.transform
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __esm = (fn, res) => function() {
|
|
5
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
+
};
|
|
7
|
+
var __commonJS = (cb, mod) => function() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { __commonJS, __esm };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
|
|
26
|
+
Object.defineProperty(exports, '__toESM', {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return __toESM;
|
|
30
|
+
}
|
|
31
|
+
});
|