@rolldown/browser 1.0.0-beta.42 → 1.0.0-beta.43
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/dist/cli.mjs +10 -4
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +2 -2
- package/dist/experimental-index.browser.mjs +21 -4
- package/dist/experimental-index.d.mts +10 -4
- package/dist/experimental-index.mjs +21 -4
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.mjs +1 -1
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -2
- package/dist/rolldown-binding.wasi.cjs +1 -2
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CtbNz6TD.d.mts → binding-BkaKdpud.d.mts} +20 -4
- package/dist/shared/{define-config-xBdWOg15.d.mts → define-config-D5LB7YAC.d.mts} +60 -3
- package/dist/shared/{load-config-B4-CoeU7.mjs → load-config-DBsf9ada.mjs} +1 -1
- package/dist/shared/{src-DbG0hppv.mjs → src-Dqrw8WuH.mjs} +56 -10
- package/dist/{src-D_rsgcbb.js → src-DXN0YLUN.js} +127 -81
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-
|
|
1
|
+
import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
2
|
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
3
|
import { arraify } from "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
|
-
import { loadConfig } from "./shared/load-config-
|
|
5
|
+
import { loadConfig } from "./shared/load-config-DBsf9ada.mjs";
|
|
6
|
+
import { createTokioRuntime } from "./rolldown-binding.wasi.cjs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { parseArgs } from "node:util";
|
|
8
9
|
import process$1 from "node:process";
|
|
@@ -312,8 +313,13 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
|
312
313
|
process.exit(1);
|
|
313
314
|
}
|
|
314
315
|
const resolvedConfig = typeof config === "function" ? await config(rawArgs) : config;
|
|
315
|
-
if (cliOptions.watch)
|
|
316
|
-
|
|
316
|
+
if (cliOptions.watch) {
|
|
317
|
+
createTokioRuntime(32);
|
|
318
|
+
await watchInner(resolvedConfig, cliOptions);
|
|
319
|
+
} else {
|
|
320
|
+
createTokioRuntime(4);
|
|
321
|
+
await bundleInner(resolvedConfig, cliOptions);
|
|
322
|
+
}
|
|
317
323
|
}
|
|
318
324
|
async function bundleWithCliOptions(cliOptions) {
|
|
319
325
|
try {
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { ConfigExport, defineConfig } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { ConfigExport, defineConfig } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/load-config.d.ts
|
|
5
5
|
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineConfig, version } from "./shared/src-
|
|
1
|
+
import { defineConfig, version } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
2
|
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
3
|
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
4
|
+
import { loadConfig } from "./shared/load-config-DBsf9ada.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./src-
|
|
2
|
-
import {
|
|
1
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex } from "./src-DXN0YLUN.js";
|
|
2
|
+
import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-engine.ts
|
|
5
5
|
var DevEngine = class DevEngine {
|
|
@@ -8,8 +8,25 @@ var DevEngine = class DevEngine {
|
|
|
8
8
|
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
9
9
|
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
10
10
|
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
11
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
12
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
13
|
+
const result = normalizeBindingResult(rawResult);
|
|
14
|
+
if (result instanceof Error) {
|
|
15
|
+
userOnHmrUpdates(result);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const [updates, changedFiles] = result;
|
|
19
|
+
userOnHmrUpdates({
|
|
20
|
+
updates,
|
|
21
|
+
changedFiles
|
|
22
|
+
});
|
|
23
|
+
} : void 0;
|
|
24
|
+
const userOnOutput = devOptions.onOutput;
|
|
11
25
|
const bindingDevOptions = {
|
|
12
|
-
onHmrUpdates:
|
|
26
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
27
|
+
onOutput: userOnOutput ? function(rawResult) {
|
|
28
|
+
userOnOutput(normalizeBindingResult(rawResult));
|
|
29
|
+
} : void 0,
|
|
13
30
|
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
|
|
14
31
|
watch: devOptions.watch && {
|
|
15
32
|
skipWrite: devOptions.watch.skipWrite,
|
|
@@ -645,4 +662,4 @@ function transformPlugin(config) {
|
|
|
645
662
|
}
|
|
646
663
|
|
|
647
664
|
//#endregion
|
|
648
|
-
export {
|
|
665
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-
|
|
2
|
-
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingOutputs, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-options.d.ts
|
|
5
|
+
type DevOnHmrUpdates = (result: Error | {
|
|
6
|
+
updates: BindingClientHmrUpdate[];
|
|
7
|
+
changedFiles: string[];
|
|
8
|
+
}) => void | Promise<void>;
|
|
9
|
+
type DevOnOutput = (result: Error | BindingOutputs) => void | Promise<void>;
|
|
5
10
|
interface DevWatchOptions {
|
|
6
11
|
/**
|
|
7
12
|
* If `true`, files are not written to disk.
|
|
@@ -43,7 +48,8 @@ interface DevWatchOptions {
|
|
|
43
48
|
debounceTickRate?: number;
|
|
44
49
|
}
|
|
45
50
|
interface DevOptions {
|
|
46
|
-
onHmrUpdates?:
|
|
51
|
+
onHmrUpdates?: DevOnHmrUpdates;
|
|
52
|
+
onOutput?: DevOnOutput;
|
|
47
53
|
/**
|
|
48
54
|
* Strategy for triggering rebuilds after HMR updates.
|
|
49
55
|
* - `'always'`: Always trigger a rebuild after HMR updates
|
|
@@ -152,4 +158,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
|
|
|
152
158
|
};
|
|
153
159
|
declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
154
160
|
//#endregion
|
|
155
|
-
export { BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
161
|
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-
|
|
1
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
2
|
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
3
|
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
import { logger } from "./shared/logger-B83ocDok.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { BindingDevEngine, BindingRebuildStrategy, BindingRebuildStrategy as BindingRebuildStrategy$1, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
|
|
8
8
|
//#region src/api/dev/dev-engine.ts
|
|
@@ -12,8 +12,25 @@ var DevEngine = class DevEngine {
|
|
|
12
12
|
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
|
13
13
|
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
|
14
14
|
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
15
|
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
|
16
|
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
|
17
|
+
const result = normalizeBindingResult(rawResult);
|
|
18
|
+
if (result instanceof Error) {
|
|
19
|
+
userOnHmrUpdates(result);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const [updates, changedFiles] = result;
|
|
23
|
+
userOnHmrUpdates({
|
|
24
|
+
updates,
|
|
25
|
+
changedFiles
|
|
26
|
+
});
|
|
27
|
+
} : void 0;
|
|
28
|
+
const userOnOutput = devOptions.onOutput;
|
|
15
29
|
const bindingDevOptions = {
|
|
16
|
-
onHmrUpdates:
|
|
30
|
+
onHmrUpdates: bindingOnHmrUpdates,
|
|
31
|
+
onOutput: userOnOutput ? function(rawResult) {
|
|
32
|
+
userOnOutput(normalizeBindingResult(rawResult));
|
|
33
|
+
} : void 0,
|
|
17
34
|
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? BindingRebuildStrategy$1.Always : devOptions.rebuildStrategy === "auto" ? BindingRebuildStrategy$1.Auto : BindingRebuildStrategy$1.Never : void 0,
|
|
18
35
|
watch: devOptions.watch && {
|
|
19
36
|
skipWrite: devOptions.watch.skipWrite,
|
|
@@ -211,4 +228,4 @@ function transformPlugin(config) {
|
|
|
211
228
|
}
|
|
212
229
|
|
|
213
230
|
//#endregion
|
|
214
|
-
export {
|
|
231
|
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
package/dist/filter-index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { withFilter } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { withFilter } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
|
|
4
4
|
export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./src-
|
|
1
|
+
import { BindingMagicString, VERSION, build, defineConfig, rolldown, watch } from "./src-DXN0YLUN.js";
|
|
2
2
|
|
|
3
|
-
export { VERSION, build, defineConfig, rolldown, watch };
|
|
3
|
+
export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PreRenderedChunk } from "./shared/binding-
|
|
2
|
-
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-
|
|
3
|
-
export { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
|
|
1
|
+
import { BindingMagicString, PreRenderedChunk } from "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { AddonFunction, AsyncPluginHooks, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
|
+
export { AddonFunction, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, ChunkFileNamesFunction, ChunkingContext, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownFileStats, RolldownFsModule, RolldownOptions, RolldownOptionsFunction, 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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VERSION, build, defineConfig, rolldown, watch } from "./shared/src-
|
|
1
|
+
import { BindingMagicString, VERSION, build, defineConfig, rolldown, watch } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
2
|
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
3
|
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
|
|
5
|
-
export { VERSION, build, defineConfig, rolldown, watch };
|
|
5
|
+
export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginContextData, bindingifyPlugin } from "./shared/src-
|
|
1
|
+
import { PluginContextData, bindingifyPlugin } from "./shared/src-Dqrw8WuH.mjs";
|
|
2
2
|
import "./shared/parse-ast-index-Gktxd-oi.mjs";
|
|
3
3
|
import "./shared/dist-CU0dSkK2.mjs";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { MaybePromise, Plugin } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-BkaKdpud.mjs";
|
|
2
|
+
import { MaybePromise, Plugin } from "./shared/define-config-D5LB7YAC.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/parallel-plugin-implementation.d.ts
|
|
5
5
|
type ParallelPluginImplementation = Plugin;
|
|
@@ -88,9 +88,7 @@ export const BindingBundler = __napiModule.exports.BindingBundler
|
|
|
88
88
|
export const BindingBundlerImpl = __napiModule.exports.BindingBundlerImpl
|
|
89
89
|
export const BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
90
90
|
export const BindingChunkingContext = __napiModule.exports.BindingChunkingContext
|
|
91
|
-
export const BindingClientHmrUpdate = __napiModule.exports.BindingClientHmrUpdate
|
|
92
91
|
export const BindingDevEngine = __napiModule.exports.BindingDevEngine
|
|
93
|
-
export const BindingHmrOutput = __napiModule.exports.BindingHmrOutput
|
|
94
92
|
export const BindingMagicString = __napiModule.exports.BindingMagicString
|
|
95
93
|
export const BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
96
94
|
export const BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
@@ -117,6 +115,7 @@ export const BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
|
117
115
|
export const BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
|
|
118
116
|
export const BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
|
|
119
117
|
export const BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
|
|
118
|
+
export const createTokioRuntime = __napiModule.exports.createTokioRuntime
|
|
120
119
|
export const FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
121
120
|
export const initTraceSubscriber = __napiModule.exports.initTraceSubscriber
|
|
122
121
|
export const registerPlugins = __napiModule.exports.registerPlugins
|
|
@@ -133,9 +133,7 @@ module.exports.BindingBundler = __napiModule.exports.BindingBundler
|
|
|
133
133
|
module.exports.BindingBundlerImpl = __napiModule.exports.BindingBundlerImpl
|
|
134
134
|
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
135
135
|
module.exports.BindingChunkingContext = __napiModule.exports.BindingChunkingContext
|
|
136
|
-
module.exports.BindingClientHmrUpdate = __napiModule.exports.BindingClientHmrUpdate
|
|
137
136
|
module.exports.BindingDevEngine = __napiModule.exports.BindingDevEngine
|
|
138
|
-
module.exports.BindingHmrOutput = __napiModule.exports.BindingHmrOutput
|
|
139
137
|
module.exports.BindingMagicString = __napiModule.exports.BindingMagicString
|
|
140
138
|
module.exports.BindingModuleInfo = __napiModule.exports.BindingModuleInfo
|
|
141
139
|
module.exports.BindingNormalizedOptions = __napiModule.exports.BindingNormalizedOptions
|
|
@@ -162,6 +160,7 @@ module.exports.BindingPluginOrder = __napiModule.exports.BindingPluginOrder
|
|
|
162
160
|
module.exports.BindingPropertyReadSideEffects = __napiModule.exports.BindingPropertyReadSideEffects
|
|
163
161
|
module.exports.BindingPropertyWriteSideEffects = __napiModule.exports.BindingPropertyWriteSideEffects
|
|
164
162
|
module.exports.BindingRebuildStrategy = __napiModule.exports.BindingRebuildStrategy
|
|
163
|
+
module.exports.createTokioRuntime = __napiModule.exports.createTokioRuntime
|
|
165
164
|
module.exports.FilterTokenKind = __napiModule.exports.FilterTokenKind
|
|
166
165
|
module.exports.initTraceSubscriber = __napiModule.exports.initTraceSubscriber
|
|
167
166
|
module.exports.registerPlugins = __napiModule.exports.registerPlugins
|
|
Binary file
|
|
@@ -1164,9 +1164,21 @@ declare class BindingBundlerImpl {
|
|
|
1164
1164
|
get closed(): boolean;
|
|
1165
1165
|
getWatchFiles(): Promise<Array<string>>;
|
|
1166
1166
|
}
|
|
1167
|
-
declare class
|
|
1168
|
-
|
|
1169
|
-
|
|
1167
|
+
declare class BindingMagicString {
|
|
1168
|
+
constructor(source: string);
|
|
1169
|
+
replace(from: string, to: string): void;
|
|
1170
|
+
replaceAll(from: string, to: string): void;
|
|
1171
|
+
prepend(content: string): void;
|
|
1172
|
+
append(content: string): void;
|
|
1173
|
+
prependLeft(index: number, content: string): void;
|
|
1174
|
+
prependRight(index: number, content: string): void;
|
|
1175
|
+
appendLeft(index: number, content: string): void;
|
|
1176
|
+
appendRight(index: number, content: string): void;
|
|
1177
|
+
overwrite(start: number, end: number, content: string): void;
|
|
1178
|
+
toString(): string;
|
|
1179
|
+
hasChanged(): boolean;
|
|
1180
|
+
length(): number;
|
|
1181
|
+
isEmpty(): boolean;
|
|
1170
1182
|
}
|
|
1171
1183
|
declare class BindingOutputAsset {
|
|
1172
1184
|
get fileName(): string;
|
|
@@ -1246,6 +1258,10 @@ interface BindingBuildImportAnalysisPluginConfig {
|
|
|
1246
1258
|
isRelativeBase: boolean;
|
|
1247
1259
|
}
|
|
1248
1260
|
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:esm-external-require' | 'builtin:transform' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
|
|
1261
|
+
interface BindingClientHmrUpdate {
|
|
1262
|
+
clientId: string;
|
|
1263
|
+
update: BindingHmrUpdate;
|
|
1264
|
+
}
|
|
1249
1265
|
interface BindingDynamicImportVarsPluginConfig {
|
|
1250
1266
|
include?: Array<BindingStringOrRegex>;
|
|
1251
1267
|
exclude?: Array<BindingStringOrRegex>;
|
|
@@ -1417,4 +1433,4 @@ interface PreRenderedChunk {
|
|
|
1417
1433
|
exports: Array<string>;
|
|
1418
1434
|
}
|
|
1419
1435
|
//#endregion
|
|
1420
|
-
export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
|
|
1436
|
+
export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingClientHmrUpdate, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingMagicString, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingOutputs, BindingReactRefreshWrapperPluginConfig, BindingRebuildStrategy, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, MinifyOptions, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-
|
|
1
|
+
import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingMagicString, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-BkaKdpud.mjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
3
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
4
|
|
|
@@ -253,6 +253,37 @@ interface OutputOptions {
|
|
|
253
253
|
minify?: boolean | "dce-only" | MinifyOptions;
|
|
254
254
|
name?: string;
|
|
255
255
|
globals?: Record<string, string> | GlobalsFunction;
|
|
256
|
+
/**
|
|
257
|
+
* Maps external module IDs to paths.
|
|
258
|
+
*
|
|
259
|
+
* Allows customizing the path used when importing external dependencies.
|
|
260
|
+
* This is particularly useful for loading dependencies from CDNs or custom locations.
|
|
261
|
+
*
|
|
262
|
+
* - Object form: Maps module IDs to their replacement paths
|
|
263
|
+
* - Function form: Takes a module ID and returns its replacement path
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```js
|
|
267
|
+
* {
|
|
268
|
+
* paths: {
|
|
269
|
+
* 'd3': 'https://cdn.jsdelivr.net/npm/d3@7'
|
|
270
|
+
* }
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```js
|
|
276
|
+
* {
|
|
277
|
+
* paths: (id) => {
|
|
278
|
+
* if (id.startsWith('lodash')) {
|
|
279
|
+
* return `https://cdn.jsdelivr.net/npm/${id}`
|
|
280
|
+
* }
|
|
281
|
+
* return id
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
paths?: Record<string, string> | ((id: string) => string);
|
|
256
287
|
generatedCode?: Partial<GeneratedCodeOptions>;
|
|
257
288
|
externalLiveBindings?: boolean;
|
|
258
289
|
inlineDynamicImports?: boolean;
|
|
@@ -314,7 +345,7 @@ interface OutputOptions {
|
|
|
314
345
|
* By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.
|
|
315
346
|
*
|
|
316
347
|
* If you want to disable this behavior, it's recommended to both set
|
|
317
|
-
* - `preserveEntrySignatures: false`
|
|
348
|
+
* - `preserveEntrySignatures: false | 'allow-extension'`
|
|
318
349
|
* - `strictExecutionOrder: true`
|
|
319
350
|
*
|
|
320
351
|
* to avoid generating invalid chunks.
|
|
@@ -612,6 +643,7 @@ interface NormalizedInputOptions {
|
|
|
612
643
|
}
|
|
613
644
|
//#endregion
|
|
614
645
|
//#region src/options/normalized-output-options.d.ts
|
|
646
|
+
type PathsFunction = (id: string) => string;
|
|
615
647
|
type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
|
|
616
648
|
interface NormalizedOutputOptions {
|
|
617
649
|
name: string | undefined;
|
|
@@ -635,6 +667,7 @@ interface NormalizedOutputOptions {
|
|
|
635
667
|
esModule: boolean | "if-default-prop";
|
|
636
668
|
extend: boolean;
|
|
637
669
|
globals: Record<string, string> | GlobalsFunction;
|
|
670
|
+
paths: Record<string, string> | PathsFunction | undefined;
|
|
638
671
|
hashCharacters: "base64" | "base36" | "hex";
|
|
639
672
|
sourcemapDebugIds: boolean;
|
|
640
673
|
sourcemapIgnoreList: boolean | SourcemapIgnoreListOption | StringOrRegExp | undefined;
|
|
@@ -952,7 +985,9 @@ interface ResolveIdExtraOptions {
|
|
|
952
985
|
}
|
|
953
986
|
type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
954
987
|
type LoadResult = NullValue | string | SourceDescription;
|
|
955
|
-
type TransformResult = NullValue | string |
|
|
988
|
+
type TransformResult = NullValue | string | Omit<SourceDescription, "code"> & {
|
|
989
|
+
code?: string | BindingMagicString;
|
|
990
|
+
};
|
|
956
991
|
type RenderedChunkMeta = {
|
|
957
992
|
chunks: Record<string, RenderedChunk>;
|
|
958
993
|
};
|
|
@@ -970,6 +1005,7 @@ interface FunctionPluginHooks {
|
|
|
970
1005
|
[DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
971
1006
|
[DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
|
|
972
1007
|
moduleType: ModuleType;
|
|
1008
|
+
magicString?: BindingMagicString;
|
|
973
1009
|
}) => TransformResult;
|
|
974
1010
|
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
975
1011
|
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
@@ -1238,6 +1274,17 @@ interface InputOptions {
|
|
|
1238
1274
|
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
|
|
1239
1275
|
moduleTypes?: ModuleTypes;
|
|
1240
1276
|
experimental?: {
|
|
1277
|
+
/**
|
|
1278
|
+
* Lets modules be executed in the order they are declared.
|
|
1279
|
+
*
|
|
1280
|
+
* - Type: `boolean`
|
|
1281
|
+
* - Default: `false`
|
|
1282
|
+
*
|
|
1283
|
+
* This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.
|
|
1284
|
+
*
|
|
1285
|
+
* > [!WARNING]
|
|
1286
|
+
* > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
|
|
1287
|
+
*/
|
|
1241
1288
|
strictExecutionOrder?: boolean;
|
|
1242
1289
|
disableLiveBindings?: boolean;
|
|
1243
1290
|
viteMode?: boolean;
|
|
@@ -1326,6 +1373,16 @@ interface InputOptions {
|
|
|
1326
1373
|
*/
|
|
1327
1374
|
incrementalBuild?: boolean;
|
|
1328
1375
|
transformHiresSourcemap?: boolean | "boundary";
|
|
1376
|
+
/**
|
|
1377
|
+
* Use native Rust implementation of MagicString for source map generation.
|
|
1378
|
+
*
|
|
1379
|
+
* - Type: `boolean`
|
|
1380
|
+
* - Default: `false`
|
|
1381
|
+
*
|
|
1382
|
+
* When enabled, rolldown will use a native Rust implementation of MagicString
|
|
1383
|
+
* for better performance during source map generation.
|
|
1384
|
+
*/
|
|
1385
|
+
nativeMagicString?: boolean;
|
|
1329
1386
|
};
|
|
1330
1387
|
/**
|
|
1331
1388
|
* Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-Gktxd-oi.mjs";
|
|
2
2
|
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CU0dSkK2.mjs";
|
|
3
3
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
4
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fsp from "node:fs/promises";
|
|
7
7
|
import os from "node:os";
|
|
@@ -243,7 +243,7 @@ if (isMainThread) {
|
|
|
243
243
|
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region package.json
|
|
246
|
-
var version = "1.0.0-beta.
|
|
246
|
+
var version = "1.0.0-beta.43";
|
|
247
247
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
248
248
|
|
|
249
249
|
//#endregion
|
|
@@ -2015,7 +2015,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2015
2015
|
chunkImportMap: optional(union([boolean(), object({
|
|
2016
2016
|
baseUrl: optional(string()),
|
|
2017
2017
|
fileName: optional(string())
|
|
2018
|
-
})]))
|
|
2018
|
+
})])),
|
|
2019
|
+
nativeMagicString: optional(boolean())
|
|
2019
2020
|
})),
|
|
2020
2021
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2021
2022
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
@@ -2082,6 +2083,7 @@ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
2082
2083
|
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2083
2084
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2084
2085
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2086
|
+
const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2085
2087
|
const AdvancedChunksSchema = strictObject({
|
|
2086
2088
|
includeDependenciesRecursively: optional(boolean()),
|
|
2087
2089
|
minSize: optional(number()),
|
|
@@ -2156,6 +2158,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2156
2158
|
])), description("Minify the bundled file")),
|
|
2157
2159
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2158
2160
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2161
|
+
paths: pipe(optional(union([record(string(), string()), PathsFunctionSchema])), description("Maps external module IDs to paths")),
|
|
2159
2162
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2160
2163
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2161
2164
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
@@ -2280,6 +2283,10 @@ function unwrapBindingResult(container) {
|
|
|
2280
2283
|
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2281
2284
|
return container;
|
|
2282
2285
|
}
|
|
2286
|
+
function normalizeBindingResult(container) {
|
|
2287
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2288
|
+
return container;
|
|
2289
|
+
}
|
|
2283
2290
|
function normalizeBindingError(e$2) {
|
|
2284
2291
|
return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2285
2292
|
kind: e$2.field0.kind,
|
|
@@ -2604,7 +2611,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2604
2611
|
this.data.updateModuleOption(id$1, rawOptions);
|
|
2605
2612
|
let loadPromise = this.data.loadModulePromiseMap.get(id$1);
|
|
2606
2613
|
if (!loadPromise) {
|
|
2607
|
-
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0).catch(() => {
|
|
2614
|
+
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
|
2608
2615
|
this.data.loadModulePromiseMap.delete(id$1);
|
|
2609
2616
|
});
|
|
2610
2617
|
this.data.loadModulePromiseMap.set(id$1, loadPromise);
|
|
@@ -2706,6 +2713,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2706
2713
|
addWatchFile(id$1) {
|
|
2707
2714
|
this.inner.addWatchFile(id$1);
|
|
2708
2715
|
}
|
|
2716
|
+
sendMagicString(s$1) {
|
|
2717
|
+
this.inner.sendMagicString(s$1);
|
|
2718
|
+
}
|
|
2709
2719
|
};
|
|
2710
2720
|
|
|
2711
2721
|
//#endregion
|
|
@@ -2805,7 +2815,29 @@ function bindingifyTransform(args$1) {
|
|
|
2805
2815
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2806
2816
|
return {
|
|
2807
2817
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
2808
|
-
|
|
2818
|
+
Object.defineProperties(meta$1, {
|
|
2819
|
+
magicString: { get() {
|
|
2820
|
+
return new BindingMagicString(code$1);
|
|
2821
|
+
} },
|
|
2822
|
+
ast: { get() {
|
|
2823
|
+
let lang = "js";
|
|
2824
|
+
switch (meta$1.moduleType) {
|
|
2825
|
+
case "js":
|
|
2826
|
+
case "jsx":
|
|
2827
|
+
case "ts":
|
|
2828
|
+
case "tsx":
|
|
2829
|
+
lang = meta$1.moduleType;
|
|
2830
|
+
break;
|
|
2831
|
+
default: break;
|
|
2832
|
+
}
|
|
2833
|
+
return parseAst(code$1, {
|
|
2834
|
+
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
2835
|
+
lang
|
|
2836
|
+
});
|
|
2837
|
+
} }
|
|
2838
|
+
});
|
|
2839
|
+
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
2840
|
+
const ret = await handler.call(transformCtx, code$1, id$1, meta$1);
|
|
2809
2841
|
if (ret == null) return;
|
|
2810
2842
|
if (typeof ret === "string") return { code: ret };
|
|
2811
2843
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
@@ -2813,9 +2845,18 @@ function bindingifyTransform(args$1) {
|
|
|
2813
2845
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2814
2846
|
invalidate: false
|
|
2815
2847
|
});
|
|
2848
|
+
let normalizedCode = void 0;
|
|
2849
|
+
let map = ret.map;
|
|
2850
|
+
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
2851
|
+
else if (ret.code instanceof BindingMagicString) {
|
|
2852
|
+
let magicString = ret.code;
|
|
2853
|
+
normalizedCode = magicString.toString();
|
|
2854
|
+
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
2855
|
+
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
|
2856
|
+
}
|
|
2816
2857
|
return {
|
|
2817
|
-
code:
|
|
2818
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1,
|
|
2858
|
+
code: normalizedCode,
|
|
2859
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, map)),
|
|
2819
2860
|
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
2820
2861
|
moduleType: ret.moduleType
|
|
2821
2862
|
};
|
|
@@ -3543,6 +3584,9 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3543
3584
|
get globals() {
|
|
3544
3585
|
return this.inner.globals || this.outputOptions.globals;
|
|
3545
3586
|
}
|
|
3587
|
+
get paths() {
|
|
3588
|
+
return this.outputOptions.paths;
|
|
3589
|
+
}
|
|
3546
3590
|
get hashCharacters() {
|
|
3547
3591
|
return this.inner.hashCharacters;
|
|
3548
3592
|
}
|
|
@@ -3797,7 +3841,8 @@ function bindingifyExperimental(experimental) {
|
|
|
3797
3841
|
chunkModulesOrder,
|
|
3798
3842
|
chunkImportMap: experimental?.chunkImportMap,
|
|
3799
3843
|
onDemandWrapping: experimental?.onDemandWrapping,
|
|
3800
|
-
incrementalBuild: experimental?.incrementalBuild
|
|
3844
|
+
incrementalBuild: experimental?.incrementalBuild,
|
|
3845
|
+
nativeMagicString: experimental?.nativeMagicString
|
|
3801
3846
|
};
|
|
3802
3847
|
}
|
|
3803
3848
|
function bindingifyResolve(resolve) {
|
|
@@ -3986,7 +4031,7 @@ var ChunkingContextImpl = class {
|
|
|
3986
4031
|
//#endregion
|
|
3987
4032
|
//#region src/utils/bindingify-output-options.ts
|
|
3988
4033
|
function bindingifyOutputOptions(outputOptions) {
|
|
3989
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
4034
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3990
4035
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3991
4036
|
return {
|
|
3992
4037
|
dir,
|
|
@@ -4005,6 +4050,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
4005
4050
|
outro: bindingifyAddon(outro),
|
|
4006
4051
|
extend: outputOptions.extend,
|
|
4007
4052
|
globals,
|
|
4053
|
+
paths,
|
|
4008
4054
|
generatedCode,
|
|
4009
4055
|
esModule,
|
|
4010
4056
|
name,
|
|
@@ -4405,4 +4451,4 @@ function defineConfig(config) {
|
|
|
4405
4451
|
const VERSION = version;
|
|
4406
4452
|
|
|
4407
4453
|
//#endregion
|
|
4408
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, ansis_default, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
|
|
4454
|
+
export { BindingMagicString$1 as BindingMagicString, BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, ansis_default, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
var __create = Object.create;
|
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "1.0.0-beta.
|
|
30
|
+
var version = "1.0.0-beta.43";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/utils/code-frame.ts
|
|
@@ -2368,7 +2368,8 @@ const InputOptionsSchema = strictObject({
|
|
|
2368
2368
|
chunkImportMap: optional(union([boolean(), object({
|
|
2369
2369
|
baseUrl: optional(string()),
|
|
2370
2370
|
fileName: optional(string())
|
|
2371
|
-
})]))
|
|
2371
|
+
})])),
|
|
2372
|
+
nativeMagicString: optional(boolean())
|
|
2372
2373
|
})),
|
|
2373
2374
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2374
2375
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
@@ -2435,6 +2436,7 @@ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
2435
2436
|
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2436
2437
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2437
2438
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2439
|
+
const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2438
2440
|
const AdvancedChunksSchema = strictObject({
|
|
2439
2441
|
includeDependenciesRecursively: optional(boolean()),
|
|
2440
2442
|
minSize: optional(number()),
|
|
@@ -2509,6 +2511,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2509
2511
|
])), description("Minify the bundled file")),
|
|
2510
2512
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2511
2513
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2514
|
+
paths: pipe(optional(union([record(string(), string()), PathsFunctionSchema])), description("Maps external module IDs to paths")),
|
|
2512
2515
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2513
2516
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2514
2517
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
@@ -2596,6 +2599,77 @@ function validateOption(key, options) {
|
|
|
2596
2599
|
}
|
|
2597
2600
|
}
|
|
2598
2601
|
|
|
2602
|
+
//#endregion
|
|
2603
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.94.0/node_modules/oxc-parser/src-js/wrap.js
|
|
2604
|
+
function wrap$1(result) {
|
|
2605
|
+
let program, module$1, comments, errors;
|
|
2606
|
+
return {
|
|
2607
|
+
get program() {
|
|
2608
|
+
if (!program) program = jsonParseAst(result.program);
|
|
2609
|
+
return program;
|
|
2610
|
+
},
|
|
2611
|
+
get module() {
|
|
2612
|
+
if (!module$1) module$1 = result.module;
|
|
2613
|
+
return module$1;
|
|
2614
|
+
},
|
|
2615
|
+
get comments() {
|
|
2616
|
+
if (!comments) comments = result.comments;
|
|
2617
|
+
return comments;
|
|
2618
|
+
},
|
|
2619
|
+
get errors() {
|
|
2620
|
+
if (!errors) errors = result.errors;
|
|
2621
|
+
return errors;
|
|
2622
|
+
}
|
|
2623
|
+
};
|
|
2624
|
+
}
|
|
2625
|
+
function jsonParseAst(programJson) {
|
|
2626
|
+
const { node: program, fixes } = JSON.parse(programJson);
|
|
2627
|
+
for (const fixPath of fixes) applyFix(program, fixPath);
|
|
2628
|
+
return program;
|
|
2629
|
+
}
|
|
2630
|
+
function applyFix(program, fixPath) {
|
|
2631
|
+
let node = program;
|
|
2632
|
+
for (const key of fixPath) node = node[key];
|
|
2633
|
+
if (node.bigint) node.value = BigInt(node.bigint);
|
|
2634
|
+
else try {
|
|
2635
|
+
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
2636
|
+
} catch (_err) {}
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
//#endregion
|
|
2640
|
+
//#region src/parse-ast-index.ts
|
|
2641
|
+
function wrap(result, sourceText) {
|
|
2642
|
+
result = wrap$1(result);
|
|
2643
|
+
if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
|
|
2644
|
+
return result.program;
|
|
2645
|
+
}
|
|
2646
|
+
function normalizeParseError(sourceText, errors) {
|
|
2647
|
+
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2648
|
+
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
2649
|
+
if (i$1 >= 5) {
|
|
2650
|
+
message += "\n...";
|
|
2651
|
+
break;
|
|
2652
|
+
}
|
|
2653
|
+
const e$2 = errors[i$1];
|
|
2654
|
+
message += e$2.message + "\n" + e$2.labels.map((label) => {
|
|
2655
|
+
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
2656
|
+
if (!location) return;
|
|
2657
|
+
return getCodeFrame(sourceText, location.line, location.column);
|
|
2658
|
+
}).filter(Boolean).join("\n");
|
|
2659
|
+
}
|
|
2660
|
+
return error(logParseError(message));
|
|
2661
|
+
}
|
|
2662
|
+
const defaultParserOptions = {
|
|
2663
|
+
lang: "js",
|
|
2664
|
+
preserveParens: false
|
|
2665
|
+
};
|
|
2666
|
+
function parseAst(sourceText, options, filename) {
|
|
2667
|
+
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
|
2668
|
+
...defaultParserOptions,
|
|
2669
|
+
...options
|
|
2670
|
+
}), sourceText);
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2599
2673
|
//#endregion
|
|
2600
2674
|
//#region src/types/sourcemap.ts
|
|
2601
2675
|
function bindingifySourcemap$1(map) {
|
|
@@ -2618,6 +2692,10 @@ function unwrapBindingResult(container) {
|
|
|
2618
2692
|
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2619
2693
|
return container;
|
|
2620
2694
|
}
|
|
2695
|
+
function normalizeBindingResult(container) {
|
|
2696
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2697
|
+
return container;
|
|
2698
|
+
}
|
|
2621
2699
|
function normalizeBindingError(e$2) {
|
|
2622
2700
|
return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2623
2701
|
kind: e$2.field0.kind,
|
|
@@ -2972,77 +3050,6 @@ function bindingPluginOrder(order) {
|
|
|
2972
3050
|
}
|
|
2973
3051
|
}
|
|
2974
3052
|
|
|
2975
|
-
//#endregion
|
|
2976
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.94.0/node_modules/oxc-parser/src-js/wrap.js
|
|
2977
|
-
function wrap$1(result) {
|
|
2978
|
-
let program, module$1, comments, errors;
|
|
2979
|
-
return {
|
|
2980
|
-
get program() {
|
|
2981
|
-
if (!program) program = jsonParseAst(result.program);
|
|
2982
|
-
return program;
|
|
2983
|
-
},
|
|
2984
|
-
get module() {
|
|
2985
|
-
if (!module$1) module$1 = result.module;
|
|
2986
|
-
return module$1;
|
|
2987
|
-
},
|
|
2988
|
-
get comments() {
|
|
2989
|
-
if (!comments) comments = result.comments;
|
|
2990
|
-
return comments;
|
|
2991
|
-
},
|
|
2992
|
-
get errors() {
|
|
2993
|
-
if (!errors) errors = result.errors;
|
|
2994
|
-
return errors;
|
|
2995
|
-
}
|
|
2996
|
-
};
|
|
2997
|
-
}
|
|
2998
|
-
function jsonParseAst(programJson) {
|
|
2999
|
-
const { node: program, fixes } = JSON.parse(programJson);
|
|
3000
|
-
for (const fixPath of fixes) applyFix(program, fixPath);
|
|
3001
|
-
return program;
|
|
3002
|
-
}
|
|
3003
|
-
function applyFix(program, fixPath) {
|
|
3004
|
-
let node = program;
|
|
3005
|
-
for (const key of fixPath) node = node[key];
|
|
3006
|
-
if (node.bigint) node.value = BigInt(node.bigint);
|
|
3007
|
-
else try {
|
|
3008
|
-
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
3009
|
-
} catch (_err) {}
|
|
3010
|
-
}
|
|
3011
|
-
|
|
3012
|
-
//#endregion
|
|
3013
|
-
//#region src/parse-ast-index.ts
|
|
3014
|
-
function wrap(result, sourceText) {
|
|
3015
|
-
result = wrap$1(result);
|
|
3016
|
-
if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
|
|
3017
|
-
return result.program;
|
|
3018
|
-
}
|
|
3019
|
-
function normalizeParseError(sourceText, errors) {
|
|
3020
|
-
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
3021
|
-
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
3022
|
-
if (i$1 >= 5) {
|
|
3023
|
-
message += "\n...";
|
|
3024
|
-
break;
|
|
3025
|
-
}
|
|
3026
|
-
const e$2 = errors[i$1];
|
|
3027
|
-
message += e$2.message + "\n" + e$2.labels.map((label) => {
|
|
3028
|
-
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
3029
|
-
if (!location) return;
|
|
3030
|
-
return getCodeFrame(sourceText, location.line, location.column);
|
|
3031
|
-
}).filter(Boolean).join("\n");
|
|
3032
|
-
}
|
|
3033
|
-
return error(logParseError(message));
|
|
3034
|
-
}
|
|
3035
|
-
const defaultParserOptions = {
|
|
3036
|
-
lang: "js",
|
|
3037
|
-
preserveParens: false
|
|
3038
|
-
};
|
|
3039
|
-
function parseAst(sourceText, options, filename) {
|
|
3040
|
-
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
|
3041
|
-
...defaultParserOptions,
|
|
3042
|
-
...options
|
|
3043
|
-
}), sourceText);
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
3053
|
//#endregion
|
|
3047
3054
|
//#region src/utils/asset-source.ts
|
|
3048
3055
|
function transformAssetSource(bindingAssetSource$1) {
|
|
@@ -3102,7 +3109,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
3102
3109
|
this.data.updateModuleOption(id$1, rawOptions);
|
|
3103
3110
|
let loadPromise = this.data.loadModulePromiseMap.get(id$1);
|
|
3104
3111
|
if (!loadPromise) {
|
|
3105
|
-
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0).catch(() => {
|
|
3112
|
+
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
|
3106
3113
|
this.data.loadModulePromiseMap.delete(id$1);
|
|
3107
3114
|
});
|
|
3108
3115
|
this.data.loadModulePromiseMap.set(id$1, loadPromise);
|
|
@@ -3204,6 +3211,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
3204
3211
|
addWatchFile(id$1) {
|
|
3205
3212
|
this.inner.addWatchFile(id$1);
|
|
3206
3213
|
}
|
|
3214
|
+
sendMagicString(s$1) {
|
|
3215
|
+
this.inner.sendMagicString(s$1);
|
|
3216
|
+
}
|
|
3207
3217
|
};
|
|
3208
3218
|
|
|
3209
3219
|
//#endregion
|
|
@@ -3303,7 +3313,29 @@ function bindingifyTransform(args$1) {
|
|
|
3303
3313
|
const { handler, meta, options } = normalizeHook(hook);
|
|
3304
3314
|
return {
|
|
3305
3315
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
3306
|
-
|
|
3316
|
+
Object.defineProperties(meta$1, {
|
|
3317
|
+
magicString: { get() {
|
|
3318
|
+
return new BindingMagicString(code$1);
|
|
3319
|
+
} },
|
|
3320
|
+
ast: { get() {
|
|
3321
|
+
let lang = "js";
|
|
3322
|
+
switch (meta$1.moduleType) {
|
|
3323
|
+
case "js":
|
|
3324
|
+
case "jsx":
|
|
3325
|
+
case "ts":
|
|
3326
|
+
case "tsx":
|
|
3327
|
+
lang = meta$1.moduleType;
|
|
3328
|
+
break;
|
|
3329
|
+
default: break;
|
|
3330
|
+
}
|
|
3331
|
+
return parseAst(code$1, {
|
|
3332
|
+
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
3333
|
+
lang
|
|
3334
|
+
});
|
|
3335
|
+
} }
|
|
3336
|
+
});
|
|
3337
|
+
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3338
|
+
const ret = await handler.call(transformCtx, code$1, id$1, meta$1);
|
|
3307
3339
|
if (ret == null) return;
|
|
3308
3340
|
if (typeof ret === "string") return { code: ret };
|
|
3309
3341
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
@@ -3311,9 +3343,18 @@ function bindingifyTransform(args$1) {
|
|
|
3311
3343
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
3312
3344
|
invalidate: false
|
|
3313
3345
|
});
|
|
3346
|
+
let normalizedCode = void 0;
|
|
3347
|
+
let map = ret.map;
|
|
3348
|
+
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
3349
|
+
else if (ret.code instanceof BindingMagicString) {
|
|
3350
|
+
let magicString = ret.code;
|
|
3351
|
+
normalizedCode = magicString.toString();
|
|
3352
|
+
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
3353
|
+
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
|
3354
|
+
}
|
|
3314
3355
|
return {
|
|
3315
|
-
code:
|
|
3316
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1,
|
|
3356
|
+
code: normalizedCode,
|
|
3357
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, map)),
|
|
3317
3358
|
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
3318
3359
|
moduleType: ret.moduleType
|
|
3319
3360
|
};
|
|
@@ -4041,6 +4082,9 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
4041
4082
|
get globals() {
|
|
4042
4083
|
return this.inner.globals || this.outputOptions.globals;
|
|
4043
4084
|
}
|
|
4085
|
+
get paths() {
|
|
4086
|
+
return this.outputOptions.paths;
|
|
4087
|
+
}
|
|
4044
4088
|
get hashCharacters() {
|
|
4045
4089
|
return this.inner.hashCharacters;
|
|
4046
4090
|
}
|
|
@@ -4295,7 +4339,8 @@ function bindingifyExperimental(experimental) {
|
|
|
4295
4339
|
chunkModulesOrder,
|
|
4296
4340
|
chunkImportMap: experimental?.chunkImportMap,
|
|
4297
4341
|
onDemandWrapping: experimental?.onDemandWrapping,
|
|
4298
|
-
incrementalBuild: experimental?.incrementalBuild
|
|
4342
|
+
incrementalBuild: experimental?.incrementalBuild,
|
|
4343
|
+
nativeMagicString: experimental?.nativeMagicString
|
|
4299
4344
|
};
|
|
4300
4345
|
}
|
|
4301
4346
|
function bindingifyResolve(resolve$1) {
|
|
@@ -4484,7 +4529,7 @@ var ChunkingContextImpl = class {
|
|
|
4484
4529
|
//#endregion
|
|
4485
4530
|
//#region src/utils/bindingify-output-options.ts
|
|
4486
4531
|
function bindingifyOutputOptions(outputOptions) {
|
|
4487
|
-
const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
4532
|
+
const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
4488
4533
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
4489
4534
|
return {
|
|
4490
4535
|
dir,
|
|
@@ -4503,6 +4548,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
4503
4548
|
outro: bindingifyAddon(outro),
|
|
4504
4549
|
extend: outputOptions.extend,
|
|
4505
4550
|
globals,
|
|
4551
|
+
paths,
|
|
4506
4552
|
generatedCode,
|
|
4507
4553
|
esModule,
|
|
4508
4554
|
name,
|
|
@@ -4841,4 +4887,4 @@ function defineConfig(config) {
|
|
|
4841
4887
|
const VERSION = version;
|
|
4842
4888
|
|
|
4843
4889
|
//#endregion
|
|
4844
|
-
export { BuiltinPlugin, PluginDriver, RolldownBuild, VERSION, build, createBundlerOptions, defineConfig, makeBuiltinPluginCallable, normalizedStringOrRegex, rolldown, watch };
|
|
4890
|
+
export { BindingMagicString$1 as BindingMagicString, BuiltinPlugin, PluginDriver, RolldownBuild, VERSION, build, createBundlerOptions, defineConfig, makeBuiltinPluginCallable, normalizeBindingResult, normalizedStringOrRegex, rolldown, watch };
|
package/package.json
CHANGED