@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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AddonFunction, AsyncPluginHooks, BuildOptions, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION$1 as VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build$1 as build, defineConfig$1 as defineConfig, rolldown$1 as rolldown, watch$1 as watch } from "./shared/define-config.d-BBxr6_Bs.mjs";
|
|
2
|
+
|
|
3
|
+
export { AddonFunction, AsyncPluginHooks, BuildOptions, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
|
|
2
|
+
const require_src = require('./shared/src-DKImwtxN.cjs');
|
|
3
|
+
require('./shared/dist-BMVjvV-v.cjs');
|
|
4
|
+
require('./shared/parse-ast-index-BuelS_NF.cjs');
|
|
5
|
+
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
|
|
6
|
+
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
7
|
+
|
|
8
|
+
//#region src/parallel-plugin-worker.ts
|
|
9
|
+
const { registryId, pluginInfos, threadNumber } = node_worker_threads.workerData;
|
|
10
|
+
(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const plugins = await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
|
13
|
+
const pluginModule = await import(pluginInfo.fileUrl);
|
|
14
|
+
const definePluginImpl = pluginModule.default;
|
|
15
|
+
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
|
16
|
+
return {
|
|
17
|
+
index: pluginInfo.index,
|
|
18
|
+
plugin: require_src.bindingifyPlugin(plugin, {}, {}, new require_src.PluginContextData(), [], () => {}, "info", false)
|
|
19
|
+
};
|
|
20
|
+
}));
|
|
21
|
+
(0, src_rolldown_binding_wasi_cjs.registerPlugins)(registryId, plugins);
|
|
22
|
+
node_worker_threads.parentPort.postMessage({ type: "success" });
|
|
23
|
+
} catch (error) {
|
|
24
|
+
node_worker_threads.parentPort.postMessage({
|
|
25
|
+
type: "error",
|
|
26
|
+
error
|
|
27
|
+
});
|
|
28
|
+
} finally {
|
|
29
|
+
node_worker_threads.parentPort.unref();
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PluginContextData, bindingifyPlugin } from "./shared/src-AQQVsE86.mjs";
|
|
2
|
+
import "./shared/dist-JdACkHJM.mjs";
|
|
3
|
+
import "./shared/parse-ast-index-C31FpvkE.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
|
+
const { registryId, pluginInfos, threadNumber } = 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: bindingifyPlugin(plugin, {}, {}, new PluginContextData(), [], () => {}, "info", false)
|
|
18
|
+
};
|
|
19
|
+
}));
|
|
20
|
+
registerPlugins(registryId, plugins);
|
|
21
|
+
parentPort.postMessage({ type: "success" });
|
|
22
|
+
} catch (error) {
|
|
23
|
+
parentPort.postMessage({
|
|
24
|
+
type: "error",
|
|
25
|
+
error
|
|
26
|
+
});
|
|
27
|
+
} finally {
|
|
28
|
+
parentPort.unref();
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MaybePromise, Plugin } from "./shared/define-config.d-DII1FzpF.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/parallel-plugin-implementation.d.ts
|
|
4
|
+
type ParallelPluginImplementation = Plugin;
|
|
5
|
+
type Context = {
|
|
6
|
+
/**
|
|
7
|
+
* Thread number
|
|
8
|
+
*/
|
|
9
|
+
threadNumber: number
|
|
10
|
+
};
|
|
11
|
+
declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Context, ParallelPluginImplementation, defineParallelPluginImplementation };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MaybePromise, Plugin } from "./shared/define-config.d-BBxr6_Bs.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/parallel-plugin-implementation.d.ts
|
|
4
|
+
type ParallelPluginImplementation = Plugin;
|
|
5
|
+
type Context = {
|
|
6
|
+
/**
|
|
7
|
+
* Thread number
|
|
8
|
+
*/
|
|
9
|
+
threadNumber: number
|
|
10
|
+
};
|
|
11
|
+
declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Context, ParallelPluginImplementation, defineParallelPluginImplementation };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ParseResult, ParserOptions } from "./rolldown-binding.wasi.cjs";
|
|
2
|
+
import { Program } from "@oxc-project/types";
|
|
3
|
+
|
|
4
|
+
//#region src/parse-ast-index.d.ts
|
|
5
|
+
declare function parseAst(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Program;
|
|
6
|
+
declare function parseAstAsync(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Promise<Program>;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ParseResult, ParserOptions, parseAst, parseAstAsync };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ParseResult, ParserOptions } from "./rolldown-binding.wasi.cjs";
|
|
2
|
+
import { Program } from "@oxc-project/types";
|
|
3
|
+
|
|
4
|
+
//#region src/parse-ast-index.d.ts
|
|
5
|
+
declare function parseAst(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Program;
|
|
6
|
+
declare function parseAstAsync(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Promise<Program>;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ParseResult, ParserOptions, parseAst, parseAstAsync };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createOnMessage as __wasmCreateOnMessageForFsProxy,
|
|
3
|
+
getDefaultContext as __emnapiGetDefaultContext,
|
|
4
|
+
instantiateNapiModule as __emnapiInstantiateNapiModule,
|
|
5
|
+
WASI as __WASI,
|
|
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 default __napiModule.exports
|
|
64
|
+
export const BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
65
|
+
export const BindingBundleErrorEventData = __napiModule.exports.BindingBundleErrorEventData
|
|
66
|
+
export const BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
67
|
+
export const BindingError = __napiModule.exports.BindingError
|
|
68
|
+
export const BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
69
|
+
export const BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
70
|
+
export const BindingOutputAsset = __napiModule.exports.BindingOutputAsset
|
|
71
|
+
export const BindingOutputChunk = __napiModule.exports.BindingOutputChunk
|
|
72
|
+
export const BindingOutputs = __napiModule.exports.BindingOutputs
|
|
73
|
+
export const BindingPluginContext = __napiModule.exports.BindingPluginContext
|
|
74
|
+
export const BindingRenderedChunk = __napiModule.exports.BindingRenderedChunk
|
|
75
|
+
export const BindingRenderedChunkMeta = __napiModule.exports.BindingRenderedChunkMeta
|
|
76
|
+
export const BindingRenderedModule = __napiModule.exports.BindingRenderedModule
|
|
77
|
+
export const BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
78
|
+
export const BindingWatcher = __napiModule.exports.BindingWatcher
|
|
79
|
+
export const BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
80
|
+
export const BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
81
|
+
export const Bundler = __napiModule.exports.Bundler
|
|
82
|
+
export const ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
83
|
+
export const ParseResult = __napiModule.exports.ParseResult
|
|
84
|
+
export const ResolverFactory = __napiModule.exports.ResolverFactory
|
|
85
|
+
export const BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
86
|
+
export const BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
87
|
+
export const BindingJsx = __napiModule.exports.BindingJsx
|
|
88
|
+
export const BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
89
|
+
export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
90
|
+
export const EnforceExtension = __napiModule.exports.EnforceExtension
|
|
91
|
+
export const ExportExportNameKind = __napiModule.exports.ExportExportNameKind
|
|
92
|
+
export const ExportImportNameKind = __napiModule.exports.ExportImportNameKind
|
|
93
|
+
export const ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind
|
|
94
|
+
export const FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
95
|
+
export const getBufferOffset = __napiModule.exports.getBufferOffset
|
|
96
|
+
export const HelperMode = __napiModule.exports.HelperMode
|
|
97
|
+
export const ImportNameKind = __napiModule.exports.ImportNameKind
|
|
98
|
+
export const isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
99
|
+
export const moduleRunnerTransform = __napiModule.exports.moduleRunnerTransform
|
|
100
|
+
export const ModuleType = __napiModule.exports.ModuleType
|
|
101
|
+
export const parseAsync = __napiModule.exports.parseAsync
|
|
102
|
+
export const parseAsyncRaw = __napiModule.exports.parseAsyncRaw
|
|
103
|
+
export const parseSync = __napiModule.exports.parseSync
|
|
104
|
+
export const parseSyncRaw = __napiModule.exports.parseSyncRaw
|
|
105
|
+
export const rawTransferSupported = __napiModule.exports.rawTransferSupported
|
|
106
|
+
export const registerPlugins = __napiModule.exports.registerPlugins
|
|
107
|
+
export const Severity = __napiModule.exports.Severity
|
|
108
|
+
export const shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
109
|
+
export const startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
110
|
+
export const sync = __napiModule.exports.sync
|
|
111
|
+
export const transform = __napiModule.exports.transform
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
createOnMessage: __wasmCreateOnMessageForFsProxy,
|
|
13
|
+
getDefaultContext: __emnapiGetDefaultContext,
|
|
14
|
+
instantiateNapiModuleSync: __emnapiInstantiateNapiModuleSync,
|
|
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
|
+
module.exports = __napiModule.exports
|
|
88
|
+
module.exports.BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
89
|
+
module.exports.BindingBundleErrorEventData = __napiModule.exports.BindingBundleErrorEventData
|
|
90
|
+
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
91
|
+
module.exports.BindingError = __napiModule.exports.BindingError
|
|
92
|
+
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
93
|
+
module.exports.BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
94
|
+
module.exports.BindingOutputAsset = __napiModule.exports.BindingOutputAsset
|
|
95
|
+
module.exports.BindingOutputChunk = __napiModule.exports.BindingOutputChunk
|
|
96
|
+
module.exports.BindingOutputs = __napiModule.exports.BindingOutputs
|
|
97
|
+
module.exports.BindingPluginContext = __napiModule.exports.BindingPluginContext
|
|
98
|
+
module.exports.BindingRenderedChunk = __napiModule.exports.BindingRenderedChunk
|
|
99
|
+
module.exports.BindingRenderedChunkMeta = __napiModule.exports.BindingRenderedChunkMeta
|
|
100
|
+
module.exports.BindingRenderedModule = __napiModule.exports.BindingRenderedModule
|
|
101
|
+
module.exports.BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
102
|
+
module.exports.BindingWatcher = __napiModule.exports.BindingWatcher
|
|
103
|
+
module.exports.BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
104
|
+
module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
105
|
+
module.exports.Bundler = __napiModule.exports.Bundler
|
|
106
|
+
module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
107
|
+
module.exports.ParseResult = __napiModule.exports.ParseResult
|
|
108
|
+
module.exports.ResolverFactory = __napiModule.exports.ResolverFactory
|
|
109
|
+
module.exports.BindingBuiltinPluginName = __napiModule.exports.BindingBuiltinPluginName
|
|
110
|
+
module.exports.BindingHookSideEffects = __napiModule.exports.BindingHookSideEffects
|
|
111
|
+
module.exports.BindingJsx = __napiModule.exports.BindingJsx
|
|
112
|
+
module.exports.BindingLogLevel = __napiModule.exports.BindingLogLevel
|
|
113
|
+
module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
114
|
+
module.exports.EnforceExtension = __napiModule.exports.EnforceExtension
|
|
115
|
+
module.exports.ExportExportNameKind = __napiModule.exports.ExportExportNameKind
|
|
116
|
+
module.exports.ExportImportNameKind = __napiModule.exports.ExportImportNameKind
|
|
117
|
+
module.exports.ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind
|
|
118
|
+
module.exports.FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
119
|
+
module.exports.getBufferOffset = __napiModule.exports.getBufferOffset
|
|
120
|
+
module.exports.HelperMode = __napiModule.exports.HelperMode
|
|
121
|
+
module.exports.ImportNameKind = __napiModule.exports.ImportNameKind
|
|
122
|
+
module.exports.isolatedDeclaration = __napiModule.exports.isolatedDeclaration
|
|
123
|
+
module.exports.moduleRunnerTransform = __napiModule.exports.moduleRunnerTransform
|
|
124
|
+
module.exports.ModuleType = __napiModule.exports.ModuleType
|
|
125
|
+
module.exports.parseAsync = __napiModule.exports.parseAsync
|
|
126
|
+
module.exports.parseAsyncRaw = __napiModule.exports.parseAsyncRaw
|
|
127
|
+
module.exports.parseSync = __napiModule.exports.parseSync
|
|
128
|
+
module.exports.parseSyncRaw = __napiModule.exports.parseSyncRaw
|
|
129
|
+
module.exports.rawTransferSupported = __napiModule.exports.rawTransferSupported
|
|
130
|
+
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
131
|
+
module.exports.Severity = __napiModule.exports.Severity
|
|
132
|
+
module.exports.shutdownAsyncRuntime = __napiModule.exports.shutdownAsyncRuntime
|
|
133
|
+
module.exports.startAsyncRuntime = __napiModule.exports.startAsyncRuntime
|
|
134
|
+
module.exports.sync = __napiModule.exports.sync
|
|
135
|
+
module.exports.transform = __napiModule.exports.transform
|
|
Binary file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, '__commonJS', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return __commonJS;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, '__toESM', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return __toESM;
|
|
38
|
+
}
|
|
39
|
+
});
|