rolldown 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli.cjs +782 -854
- package/dist/cjs/experimental-index.cjs +68 -26
- package/dist/cjs/index.cjs +6 -8
- package/dist/cjs/parallel-plugin-worker.cjs +20 -14
- package/dist/cjs/parallel-plugin.cjs +1 -3
- package/dist/esm/cli.mjs +722 -796
- package/dist/esm/experimental-index.mjs +44 -7
- package/dist/esm/index.mjs +2 -4
- package/dist/esm/parallel-plugin-worker.mjs +15 -10
- package/dist/esm/parallel-plugin.mjs +1 -3
- package/dist/shared/{chunk-JoMxl5V2.cjs → chunk-BK2Ye-xa.cjs} +19 -6
- package/dist/shared/{consola.36c0034f-Xyw7SC_7.mjs → consola_36c0034f-DWsVjwtA.mjs} +218 -283
- package/dist/shared/{consola.36c0034f-HcmWcfPe.cjs → consola_36c0034f-_8_dG1Nr.cjs} +249 -295
- package/dist/shared/{prompt-hoPhcrA-.mjs → prompt-DGW8ZJmn.mjs} +125 -174
- package/dist/shared/{prompt-9Ij3R3TG.cjs → prompt-RFvZMmjc.cjs} +157 -204
- package/dist/shared/src-COU7qQBJ.cjs +2899 -0
- package/dist/shared/src-DEPa5yhI.mjs +2771 -0
- package/dist/types/api/build.d.ts +14 -0
- package/dist/types/api/experimental.d.ts +7 -0
- package/dist/types/api/rolldown/index.d.ts +3 -0
- package/dist/types/api/rolldown/rolldown-build.d.ts +12 -0
- package/dist/types/api/watch/index.d.ts +3 -0
- package/dist/types/{watcher.d.ts → api/watch/watcher.d.ts} +5 -3
- package/dist/types/binding.d.ts +175 -40
- package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
- package/dist/types/builtin-plugin/constructors.d.ts +20 -0
- package/dist/types/builtin-plugin/replace-plugin.d.ts +28 -0
- package/dist/types/{options/normalized-ecma-transform-plugin-config.d.ts → builtin-plugin/transform-plugin.d.ts} +2 -1
- package/dist/types/builtin-plugin/utils.d.ts +8 -0
- package/dist/types/cli/arguments/normalize.d.ts +2 -6
- package/dist/types/cli/arguments/schema.d.ts +169 -81
- package/dist/types/constants/plugin.d.ts +3 -1
- package/dist/types/experimental-index.d.ts +5 -2
- package/dist/types/index.d.ts +13 -10
- package/dist/types/log/locate-character/index.d.ts +13 -0
- package/dist/types/log/logger.d.ts +2 -16
- package/dist/types/log/logging.d.ts +6 -3
- package/dist/types/log/logs.d.ts +2 -0
- package/dist/types/options/input-options-schema.d.ts +596 -0
- package/dist/types/options/input-options.d.ts +74 -430
- package/dist/types/options/normalized-input-options.d.ts +17 -11
- package/dist/types/options/normalized-output-options.d.ts +57 -21
- package/dist/types/options/output-options-schema.d.ts +147 -0
- package/dist/types/options/output-options.d.ts +72 -265
- package/dist/types/options/watch-options.d.ts +5 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -11
- package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -5
- package/dist/types/plugin/bindingify-output-hooks.d.ts +13 -16
- package/dist/types/plugin/bindingify-plugin.d.ts +12 -3
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +3 -5
- package/dist/types/plugin/hook-filter.d.ts +1 -1
- package/dist/types/plugin/index.d.ts +21 -18
- package/dist/types/plugin/minimal-plugin-context.d.ts +15 -0
- package/dist/types/plugin/plugin-context-data.d.ts +4 -5
- package/dist/types/plugin/plugin-context.d.ts +9 -4
- package/dist/types/plugin/plugin-driver.d.ts +4 -5
- package/dist/types/plugin/transform-plugin-context.d.ts +4 -3
- package/dist/types/rollup-types.d.ts +1 -1
- package/dist/types/treeshake/index.d.ts +0 -12
- package/dist/types/treeshake/module-side-effects.d.ts +111 -11
- package/dist/types/types/rolldown-output.d.ts +11 -2
- package/dist/types/types/utils.d.ts +1 -0
- package/dist/types/utils/bindingify-input-options.d.ts +7 -0
- package/dist/types/utils/bindingify-output-options.d.ts +3 -0
- package/dist/types/utils/define-config.d.ts +3 -0
- package/dist/types/utils/error.d.ts +1 -0
- package/dist/types/utils/normalize-hook.d.ts +1 -1
- package/dist/types/utils/normalize-plugin-option.d.ts +8 -3
- package/dist/types/{options/utils.d.ts → utils/normalize-string-or-regex.d.ts} +1 -1
- package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
- package/dist/types/utils/transform-rendered-module.d.ts +3 -0
- package/dist/types/utils/transform-sourcemap.d.ts +2 -0
- package/dist/types/utils/transform-to-rollup-output.d.ts +1 -0
- package/package.json +30 -22
- package/dist/shared/rolldown-binding.wasi.cjs +0 -187
- package/dist/shared/src_index-3pqhEViJ.cjs +0 -2785
- package/dist/shared/src_index-ywYMd4vB.mjs +0 -2786
- package/dist/shared/wasi-worker-browser.mjs +0 -39
- package/dist/shared/wasi-worker.mjs +0 -63
- package/dist/shared/watcher-worker.js +0 -1
- package/dist/types/constants/types.d.ts +0 -1
- package/dist/types/options/bindingify-input-options.d.ts +0 -4
- package/dist/types/options/bindingify-output-options.d.ts +0 -3
- package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -8
- package/dist/types/options/watch-option.d.ts +0 -5
- package/dist/types/plugin/builtin-plugin.d.ts +0 -81
- package/dist/types/rolldown-build.d.ts +0 -10
- package/dist/types/rolldown.d.ts +0 -12
- package/dist/types/types/rendered-module.d.ts +0 -2
- package/dist/types/utils/normalize-input-options.d.ts +0 -3
- package/dist/types/utils/normalize-output-options.d.ts +0 -3
- package/dist/types/utils/normalize-tree-shake.d.ts +0 -3
- /package/dist/types/{utils/type-assert.d.ts → types/assert.d.ts} +0 -0
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import type { BindingHookResolveIdExtraArgs, BindingTransformHookExtraArgs
|
|
1
|
+
import type { BindingHookResolveIdExtraArgs, BindingTransformHookExtraArgs } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
3
|
import type { NullValue, MaybePromise, PartialNull, MakeAsync } from '../types/utils';
|
|
4
4
|
import type { SourceMapInput } from '../types/sourcemap';
|
|
5
5
|
import type { ModuleInfo } from '../types/module-info';
|
|
6
6
|
import type { OutputBundle } from '../types/output-bundle';
|
|
7
|
-
import { PluginContext } from './plugin-context';
|
|
7
|
+
import type { PluginContext } from './plugin-context';
|
|
8
8
|
import type { TransformPluginContext } from './transform-plugin-context';
|
|
9
9
|
import type { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
10
10
|
import type { LogLevel } from '../log/logging';
|
|
11
11
|
import type { RollupLog } from '../rollup';
|
|
12
|
-
import type { MinimalPluginContext } from '
|
|
13
|
-
import { InputOptions, OutputOptions } from '..';
|
|
14
|
-
import { BuiltinPlugin } from '
|
|
15
|
-
import { ParallelPlugin } from './parallel-plugin';
|
|
12
|
+
import type { MinimalPluginContext } from './minimal-plugin-context';
|
|
13
|
+
import type { InputOptions, OutputOptions } from '..';
|
|
14
|
+
import type { BuiltinPlugin } from '../builtin-plugin/constructors';
|
|
15
|
+
import type { ParallelPlugin } from './parallel-plugin';
|
|
16
16
|
import type { DefinedHookNames } from '../constants/plugin';
|
|
17
|
-
import { DEFINED_HOOK_NAMES } from '../constants/plugin';
|
|
18
|
-
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
19
|
-
import { HookFilter } from './hook-filter';
|
|
17
|
+
import type { DEFINED_HOOK_NAMES } from '../constants/plugin';
|
|
18
|
+
import type { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
19
|
+
import type { HookFilter } from './hook-filter';
|
|
20
|
+
import { RolldownRenderedChunk } from '../types/rolldown-output';
|
|
20
21
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
21
22
|
export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
22
23
|
export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
|
|
@@ -69,11 +70,11 @@ export interface FunctionPluginHooks {
|
|
|
69
70
|
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
70
71
|
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
71
72
|
[DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
72
|
-
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk:
|
|
73
|
+
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RolldownRenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
73
74
|
code: string;
|
|
74
75
|
map?: SourceMapInput;
|
|
75
76
|
};
|
|
76
|
-
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk:
|
|
77
|
+
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RolldownRenderedChunk) => string | void;
|
|
77
78
|
[DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
|
|
78
79
|
[DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
79
80
|
[DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
@@ -85,12 +86,12 @@ export interface FunctionPluginHooks {
|
|
|
85
86
|
}
|
|
86
87
|
export type ChangeEvent = 'create' | 'update' | 'delete';
|
|
87
88
|
export type PluginOrder = 'pre' | 'post' | null;
|
|
88
|
-
export type ObjectHookMeta
|
|
89
|
+
export type ObjectHookMeta = {
|
|
89
90
|
order?: PluginOrder;
|
|
90
|
-
}
|
|
91
|
+
};
|
|
91
92
|
export type ObjectHook<T, O = {}> = T | ({
|
|
92
93
|
handler: T;
|
|
93
|
-
} & ObjectHookMeta
|
|
94
|
+
} & ObjectHookMeta & O);
|
|
94
95
|
export type SyncPluginHooks = DefinedHookNames['augmentChunkHash' | 'onLog' | 'outputOptions'];
|
|
95
96
|
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
96
97
|
export type FirstPluginHooks = DefinedHookNames['load' | 'resolveDynamicImport' | 'resolveId'];
|
|
@@ -98,15 +99,15 @@ export type SequentialPluginHooks = DefinedHookNames['augmentChunkHash' | 'gener
|
|
|
98
99
|
export type AddonHooks = DefinedHookNames['banner' | 'footer' | 'intro' | 'outro'];
|
|
99
100
|
export type OutputPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle'];
|
|
100
101
|
export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
101
|
-
export type
|
|
102
|
+
export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform' ? {
|
|
102
103
|
filter?: HookFilter;
|
|
103
104
|
} : K extends 'load' | 'resolveId' ? {
|
|
104
105
|
filter?: Pick<HookFilter, 'id'>;
|
|
105
106
|
} : {};
|
|
106
107
|
export type PluginHooks = {
|
|
107
|
-
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
|
|
108
|
+
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K>>;
|
|
108
109
|
};
|
|
109
|
-
export type AddonHookFunction = (this: PluginContext, chunk:
|
|
110
|
+
export type AddonHookFunction = (this: PluginContext, chunk: RolldownRenderedChunk) => string | Promise<string>;
|
|
110
111
|
export type AddonHook = string | AddonHookFunction;
|
|
111
112
|
export interface OutputPlugin extends Partial<{
|
|
112
113
|
[K in OutputPluginHooks]: PluginHooks[K];
|
|
@@ -119,5 +120,7 @@ export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
|
119
120
|
api?: A;
|
|
120
121
|
}
|
|
121
122
|
export type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
|
|
122
|
-
export type
|
|
123
|
+
export type RolldownPluginOption<A = any> = MaybePromise<NullValue<RolldownPlugin<A>> | false | RolldownPluginOption[]>;
|
|
124
|
+
export type RolldownOutputPlugin = OutputPlugin | BuiltinPlugin;
|
|
125
|
+
export type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> | false | RolldownOutputPluginOption[]>;
|
|
123
126
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LoggingFunction, LogHandler, LogLevelOption, RollupError } from '../rollup';
|
|
2
|
+
import type { Plugin } from '../plugin';
|
|
3
|
+
export interface PluginContextMeta {
|
|
4
|
+
rollupVersion: string;
|
|
5
|
+
rolldownVersion: string;
|
|
6
|
+
watchMode: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class MinimalPluginContext {
|
|
9
|
+
info: LoggingFunction;
|
|
10
|
+
warn: LoggingFunction;
|
|
11
|
+
debug: LoggingFunction;
|
|
12
|
+
meta: PluginContextMeta;
|
|
13
|
+
readonly error: (error: RollupError | string) => never;
|
|
14
|
+
constructor(onLog: LogHandler, logLevel: LogLevelOption, plugin: Plugin);
|
|
15
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BindingPluginContext } from '../binding';
|
|
2
|
-
import {
|
|
2
|
+
import { ModuleOptions } from '..';
|
|
3
3
|
import { PluginContextResolveOptions } from './plugin-context';
|
|
4
4
|
export declare class PluginContextData {
|
|
5
|
-
modules: Map<string, ModuleInfo>;
|
|
6
|
-
moduleIds: Array<string> | null;
|
|
7
5
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
8
6
|
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
7
|
+
loadModulePromiseMap: Map<string, Promise<void>>;
|
|
9
8
|
updateModuleOption(id: string, option: ModuleOptions): void;
|
|
10
|
-
getModuleOption(id: string): ModuleOptions
|
|
11
|
-
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
|
|
9
|
+
getModuleOption(id: string): ModuleOptions;
|
|
10
|
+
getModuleInfo(id: string, context: BindingPluginContext): import("..").ModuleInfo | null;
|
|
12
11
|
getModuleIds(context: BindingPluginContext): ArrayIterator<string>;
|
|
13
12
|
saveResolveOptions(options: PluginContextResolveOptions): number;
|
|
14
13
|
getSavedResolveOptions(receipt: number): PluginContextResolveOptions | undefined;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { BindingPluginContext } from '../binding';
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import { MinimalPluginContext } from '../log/logger';
|
|
2
|
+
import type { CustomPluginOptions, ModuleOptions, Plugin, ResolvedId } from './index';
|
|
3
|
+
import { MinimalPluginContext } from '../plugin/minimal-plugin-context';
|
|
5
4
|
import { AssetSource } from '../utils/asset-source';
|
|
6
5
|
import { ModuleInfo } from '../types/module-info';
|
|
7
6
|
import { PluginContextData } from './plugin-context-data';
|
|
8
7
|
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
8
|
+
import { PartialNull } from '../types/utils';
|
|
9
|
+
import type { LogHandler, LogLevelOption } from '../rollup';
|
|
9
10
|
export interface EmittedAsset {
|
|
10
11
|
type: 'asset';
|
|
11
12
|
name?: string;
|
|
@@ -22,6 +23,10 @@ export interface PrivatePluginContextResolveOptions extends PluginContextResolve
|
|
|
22
23
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
23
24
|
}
|
|
24
25
|
export declare class PluginContext extends MinimalPluginContext {
|
|
26
|
+
readonly load: (options: {
|
|
27
|
+
id: string;
|
|
28
|
+
resolveDependencies?: boolean;
|
|
29
|
+
} & Partial<PartialNull<ModuleOptions>>) => Promise<ModuleInfo>;
|
|
25
30
|
readonly resolve: (source: string, importer?: string, options?: PluginContextResolveOptions) => Promise<ResolvedId | null>;
|
|
26
31
|
readonly emitFile: (file: EmittedAsset) => string;
|
|
27
32
|
readonly getFileName: (referenceId: string) => string;
|
|
@@ -32,5 +37,5 @@ export declare class PluginContext extends MinimalPluginContext {
|
|
|
32
37
|
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
33
38
|
*/
|
|
34
39
|
readonly parse: (input: string, options?: any) => any;
|
|
35
|
-
constructor(
|
|
40
|
+
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string);
|
|
36
41
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Plugin
|
|
2
|
-
import {
|
|
3
|
-
import { InputOptions, OutputOptions } from '..';
|
|
1
|
+
import { Plugin } from './';
|
|
2
|
+
import { InputOptions, OutputOptions, RolldownPlugin } from '..';
|
|
4
3
|
export declare class PluginDriver {
|
|
5
4
|
callOptionsHook(inputOptions: InputOptions): Promise<InputOptions>;
|
|
6
|
-
callOutputOptionsHook(
|
|
5
|
+
callOutputOptionsHook(rawPlugins: RolldownPlugin[], outputOptions: OutputOptions): OutputOptions;
|
|
7
6
|
}
|
|
8
|
-
export declare function getObjectPlugins(plugins:
|
|
7
|
+
export declare function getObjectPlugins(plugins: RolldownPlugin[]): Plugin[];
|
|
9
8
|
export declare function getSortedPlugins(hookName: 'options' | 'outputOptions' | 'onLog', plugins: readonly Plugin[]): Plugin[];
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { BindingPluginContext, BindingTransformPluginContext } from '../binding';
|
|
2
|
-
import type { RollupError } from '../rollup';
|
|
2
|
+
import type { LogHandler, LogLevelOption, RollupError } from '../rollup';
|
|
3
3
|
import { PluginContext } from './plugin-context';
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
|
-
import { NormalizedInputOptions } from '..';
|
|
6
5
|
import type { Plugin } from './index';
|
|
6
|
+
import { SourceMap } from '../types/rolldown-output';
|
|
7
7
|
export declare class TransformPluginContext extends PluginContext {
|
|
8
8
|
error: (error: RollupError | string, pos?: number | {
|
|
9
9
|
column: number;
|
|
10
10
|
line: number;
|
|
11
11
|
}) => never;
|
|
12
|
-
|
|
12
|
+
getCombinedSourcemap: () => SourceMap;
|
|
13
|
+
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { OutputOptions, InputOptions, Plugin, OutputPlugin, OutputChunk, NormalizedInputOptions, OutputAsset, OutputBundle, SourceMapInput, } from './rollup';
|
|
1
|
+
export type { OutputOptions, InputOptions, Plugin, OutputPlugin, OutputChunk, NormalizedInputOptions, OutputAsset, OutputBundle, SourceMapInput, RenderedChunk, } from './rollup';
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export declare const TreeshakingOptionsSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
2
|
-
moduleSideEffects: import("zod").ZodUnion<[import("zod").ZodBoolean, import("zod").ZodString]>;
|
|
3
|
-
}, {
|
|
4
|
-
moduleSideEffects: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodBoolean, import("zod").ZodString]>>;
|
|
5
|
-
}>, "strict", import("zod").ZodTypeAny, {
|
|
6
|
-
moduleSideEffects?: string | boolean | undefined;
|
|
7
|
-
}, {
|
|
8
|
-
moduleSideEffects?: string | boolean | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
export interface TreeshakingOptions {
|
|
11
|
-
moduleSideEffects?: boolean | RegExp;
|
|
12
|
-
}
|
|
13
1
|
export * from './module-side-effects';
|
|
@@ -1,15 +1,115 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const HasModuleSideEffectsSchema: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodBoolean], z.ZodUnknown>, z.ZodBoolean>;
|
|
3
|
-
export type HasModuleSideEffects = z.infer<typeof HasModuleSideEffectsSchema>;
|
|
4
2
|
export type ModuleSideEffectsOption = z.infer<typeof ModuleSideEffectsOptionSchema>;
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export declare const ModuleSideEffectsRuleSchema: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
5
|
+
external: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
sideEffects: z.ZodBoolean;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
sideEffects: boolean;
|
|
9
|
+
external?: boolean | undefined;
|
|
10
|
+
test?: RegExp | undefined;
|
|
10
11
|
}, {
|
|
11
|
-
|
|
12
|
+
sideEffects: boolean;
|
|
13
|
+
external?: boolean | undefined;
|
|
14
|
+
test?: RegExp | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
sideEffects: boolean;
|
|
17
|
+
external?: boolean | undefined;
|
|
18
|
+
test?: RegExp | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
sideEffects: boolean;
|
|
21
|
+
external?: boolean | undefined;
|
|
22
|
+
test?: RegExp | undefined;
|
|
12
23
|
}>;
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
export declare const ModuleSideEffectsOptionSchema: z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
25
|
+
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
26
|
+
external: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
sideEffects: z.ZodBoolean;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
sideEffects: boolean;
|
|
30
|
+
external?: boolean | undefined;
|
|
31
|
+
test?: RegExp | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
sideEffects: boolean;
|
|
34
|
+
external?: boolean | undefined;
|
|
35
|
+
test?: RegExp | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
sideEffects: boolean;
|
|
38
|
+
external?: boolean | undefined;
|
|
39
|
+
test?: RegExp | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
sideEffects: boolean;
|
|
42
|
+
external?: boolean | undefined;
|
|
43
|
+
test?: RegExp | undefined;
|
|
44
|
+
}>, "many">]>, z.ZodLiteral<"no-external">]>;
|
|
45
|
+
export declare const TreeshakingOptionsSchema: z.ZodUnion<[z.ZodObject<{
|
|
46
|
+
moduleSideEffects: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
47
|
+
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
48
|
+
external: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
sideEffects: z.ZodBoolean;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
sideEffects: boolean;
|
|
52
|
+
external?: boolean | undefined;
|
|
53
|
+
test?: RegExp | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
sideEffects: boolean;
|
|
56
|
+
external?: boolean | undefined;
|
|
57
|
+
test?: RegExp | undefined;
|
|
58
|
+
}>, {
|
|
59
|
+
sideEffects: boolean;
|
|
60
|
+
external?: boolean | undefined;
|
|
61
|
+
test?: RegExp | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
sideEffects: boolean;
|
|
64
|
+
external?: boolean | undefined;
|
|
65
|
+
test?: RegExp | undefined;
|
|
66
|
+
}>, "many">]>, z.ZodLiteral<"no-external">]>>;
|
|
67
|
+
annotations: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
69
|
+
moduleSideEffects: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
70
|
+
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
71
|
+
external: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
sideEffects: z.ZodBoolean;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
sideEffects: boolean;
|
|
75
|
+
external?: boolean | undefined;
|
|
76
|
+
test?: RegExp | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
sideEffects: boolean;
|
|
79
|
+
external?: boolean | undefined;
|
|
80
|
+
test?: RegExp | undefined;
|
|
81
|
+
}>, {
|
|
82
|
+
sideEffects: boolean;
|
|
83
|
+
external?: boolean | undefined;
|
|
84
|
+
test?: RegExp | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
sideEffects: boolean;
|
|
87
|
+
external?: boolean | undefined;
|
|
88
|
+
test?: RegExp | undefined;
|
|
89
|
+
}>, "many">]>, z.ZodLiteral<"no-external">]>>;
|
|
90
|
+
annotations: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
92
|
+
moduleSideEffects: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
93
|
+
test: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
|
|
94
|
+
external: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
sideEffects: z.ZodBoolean;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
sideEffects: boolean;
|
|
98
|
+
external?: boolean | undefined;
|
|
99
|
+
test?: RegExp | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
sideEffects: boolean;
|
|
102
|
+
external?: boolean | undefined;
|
|
103
|
+
test?: RegExp | undefined;
|
|
104
|
+
}>, {
|
|
105
|
+
sideEffects: boolean;
|
|
106
|
+
external?: boolean | undefined;
|
|
107
|
+
test?: RegExp | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
sideEffects: boolean;
|
|
110
|
+
external?: boolean | undefined;
|
|
111
|
+
test?: RegExp | undefined;
|
|
112
|
+
}>, "many">]>, z.ZodLiteral<"no-external">]>>;
|
|
113
|
+
annotations: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodBoolean]>;
|
|
115
|
+
export type TreeshakingOptions = z.infer<typeof TreeshakingOptionsSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssetSource } from '../utils/asset-source';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RenderedChunk } from '../binding';
|
|
3
3
|
export interface RolldownOutputAsset {
|
|
4
4
|
type: 'asset';
|
|
5
5
|
fileName: string;
|
|
@@ -15,6 +15,15 @@ export interface SourceMap {
|
|
|
15
15
|
sourcesContent: string[];
|
|
16
16
|
version: number;
|
|
17
17
|
}
|
|
18
|
+
export interface RolldownRenderedModule {
|
|
19
|
+
readonly code: string | null;
|
|
20
|
+
renderedLength: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RolldownRenderedChunk extends Omit<RenderedChunk, 'modules'> {
|
|
23
|
+
modules: {
|
|
24
|
+
[id: string]: RolldownRenderedModule;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
18
27
|
export interface RolldownOutputChunk {
|
|
19
28
|
type: 'chunk';
|
|
20
29
|
code: string;
|
|
@@ -23,7 +32,7 @@ export interface RolldownOutputChunk {
|
|
|
23
32
|
exports: string[];
|
|
24
33
|
fileName: string;
|
|
25
34
|
modules: {
|
|
26
|
-
[id: string]:
|
|
35
|
+
[id: string]: RolldownRenderedModule;
|
|
27
36
|
};
|
|
28
37
|
imports: string[];
|
|
29
38
|
dynamicImports: string[];
|
|
@@ -10,3 +10,4 @@ export type PartialNull<T> = {
|
|
|
10
10
|
};
|
|
11
11
|
export type MakeAsync<Function_> = Function_ extends (this: infer This, ...parameters: infer Arguments) => infer Return ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
|
|
12
12
|
export type MaybeArray<T> = T | T[];
|
|
13
|
+
export type StringOrRegExp = string | RegExp;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RolldownPlugin } from 'rolldown';
|
|
2
|
+
import type { InputOptions } from '../options/input-options';
|
|
3
|
+
import type { OutputOptions } from '../options/output-options';
|
|
4
|
+
import type { BindingInputOptions } from '../binding';
|
|
5
|
+
import { LogHandler } from '../rollup';
|
|
6
|
+
import { LogLevelOption } from '../log/logging';
|
|
7
|
+
export declare function bindingifyInputOptions(rawPlugins: RolldownPlugin[], inputOptions: InputOptions, outputOptions: OutputOptions, onLog: LogHandler, logLevel: LogLevelOption): BindingInputOptions;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import type { RolldownOptions } from '../types/rolldown-options';
|
|
1
2
|
import type { ConfigExport } from '../types/config-export';
|
|
3
|
+
export declare function defineConfig(config: RolldownOptions): RolldownOptions;
|
|
4
|
+
export declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
|
|
2
5
|
export declare function defineConfig(config: ConfigExport): ConfigExport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeErrors(rawErrors: unknown[]): Error;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyFn } from '../types/utils';
|
|
2
2
|
import type { ObjectHook, ObjectHookMeta } from '../plugin';
|
|
3
|
-
export declare function normalizeHook<Hook extends ObjectHook<AnyFn | string>>(hook: Hook): Hook extends ObjectHook<infer RawHook, infer CustomOptions> ? {
|
|
3
|
+
export declare function normalizeHook<Hook extends ObjectHook<AnyFn | string>>(hook: Hook): Hook extends ObjectHook<infer RawHook, infer CustomOptions> ? Hook extends RawHook ? never : {
|
|
4
4
|
handler: RawHook;
|
|
5
5
|
options: CustomOptions;
|
|
6
6
|
meta: ObjectHookMeta;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RolldownPlugin, RolldownOutputPlugin } from '../plugin';
|
|
2
2
|
import type { InputOptions } from '../options/input-options';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OutputOptions } from '../options/output-options';
|
|
4
|
+
import { LogHandler } from '../rollup';
|
|
4
5
|
export declare const normalizePluginOption: {
|
|
5
6
|
(plugins: InputOptions['plugins']): Promise<RolldownPlugin[]>;
|
|
6
|
-
(plugins: OutputOptions['plugins']): Promise<
|
|
7
|
+
(plugins: OutputOptions['plugins']): Promise<RolldownOutputPlugin[]>;
|
|
7
8
|
(plugins: unknown): Promise<any[]>;
|
|
8
9
|
};
|
|
10
|
+
export declare function checkOutputPluginOption(plugins: RolldownOutputPlugin[], onLog: LogHandler): RolldownOutputPlugin[];
|
|
11
|
+
export declare function normalizePlugins<T extends RolldownPlugin>(plugins: T[], anonymousPrefix: string): T[];
|
|
12
|
+
export declare const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
13
|
+
export declare const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BindingStringOrRegex } from '../binding
|
|
1
|
+
import type { BindingStringOrRegex } from '../binding';
|
|
2
2
|
export declare function normalizedStringOrRegex(pattern?: Array<string | RegExp> | (string | RegExp)): BindingStringOrRegex[] | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RenderedChunk } from '../binding';
|
|
2
|
+
import { RolldownRenderedChunk } from '../types/rolldown-output';
|
|
3
|
+
export declare function transformRenderedChunk(chunk: RenderedChunk): RolldownRenderedChunk;
|
|
4
|
+
export declare function transformChunkModules(modules: RenderedChunk['modules']): RolldownRenderedChunk['modules'];
|
|
@@ -1 +1,3 @@
|
|
|
1
|
+
import { ExistingRawSourceMap, SourceMapInput } from '../types/sourcemap';
|
|
1
2
|
export declare function isEmptySourcemapFiled(array: undefined | (string | null)[]): boolean;
|
|
3
|
+
export declare function normalizeTransformHookSourcemap(id: string, originalCode: string, rawMap?: SourceMapInput): ExistingRawSourceMap | undefined;
|
|
@@ -2,6 +2,7 @@ import type { RolldownOutput } from '../types/rolldown-output';
|
|
|
2
2
|
import type { OutputBundle } from '../types/output-bundle';
|
|
3
3
|
import type { BindingOutputs, JsChangedOutputs } from '../binding';
|
|
4
4
|
export declare function transformToRollupOutput(output: BindingOutputs, changed?: ChangedOutputs): RolldownOutput;
|
|
5
|
+
export declare function handleOutputErrors(output: BindingOutputs): void;
|
|
5
6
|
export declare function transformToOutputBundle(output: BindingOutputs, changed: ChangedOutputs): OutputBundle;
|
|
6
7
|
export interface ChangedOutputs {
|
|
7
8
|
updated: Set<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"require": "./dist/cjs/parallel-plugin.cjs",
|
|
45
45
|
"import": "./dist/esm/parallel-plugin.mjs"
|
|
46
46
|
},
|
|
47
|
-
"./watcher-worker": "./dist/shared/watcher-worker.js",
|
|
48
47
|
"./package.json": "./package.json"
|
|
49
48
|
},
|
|
50
49
|
"imports": {
|
|
@@ -82,13 +81,22 @@
|
|
|
82
81
|
"dependencies": {
|
|
83
82
|
"zod": "^3.23.8"
|
|
84
83
|
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"@babel/runtime": ">=7"
|
|
86
|
+
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"@babel/runtime": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
85
92
|
"devDependencies": {
|
|
93
|
+
"@jridgewell/sourcemap-codec": "^1.5.0",
|
|
86
94
|
"@napi-rs/cli": "^3.0.0-alpha.60",
|
|
87
95
|
"@napi-rs/wasm-runtime": "^0.2.4",
|
|
96
|
+
"@types/fs-extra": "^11.0.4",
|
|
88
97
|
"@types/lodash-es": "^4.17.12",
|
|
89
98
|
"colorette": "^2.0.20",
|
|
90
99
|
"consola": "^3.2.3",
|
|
91
|
-
"cross-env": "^7.0.3",
|
|
92
100
|
"emnapi": "^1.2.0",
|
|
93
101
|
"execa": "^9.2.0",
|
|
94
102
|
"fs-extra": "^11.2.0",
|
|
@@ -98,28 +106,28 @@
|
|
|
98
106
|
"remeda": "^2.10.0",
|
|
99
107
|
"rollup": "^4.18.0",
|
|
100
108
|
"signal-exit": "4.1.0",
|
|
109
|
+
"source-map": "^0.7.4",
|
|
110
|
+
"tsx": "^4.19.2",
|
|
101
111
|
"type-fest": "^4.20.0",
|
|
102
112
|
"unbuild": "^2.0.0",
|
|
103
|
-
"vite": "^5.2.13",
|
|
104
|
-
"vitest": "^2.0.0",
|
|
105
113
|
"why-is-node-running": "^3.0.0",
|
|
106
114
|
"zod-to-json-schema": "^3.23.2",
|
|
107
115
|
"@rolldown/testing": "0.0.1",
|
|
108
|
-
"rolldown": "0.
|
|
116
|
+
"rolldown": "0.15.0"
|
|
109
117
|
},
|
|
110
118
|
"optionalDependencies": {
|
|
111
|
-
"@rolldown/binding-darwin-arm64": "0.
|
|
112
|
-
"@rolldown/binding-
|
|
113
|
-
"@rolldown/binding-linux-arm-gnueabihf": "0.
|
|
114
|
-
"@rolldown/binding-
|
|
115
|
-
"@rolldown/binding-
|
|
116
|
-
"@rolldown/binding-linux-arm64-
|
|
117
|
-
"@rolldown/binding-linux-x64-
|
|
118
|
-
"@rolldown/binding-linux-x64-
|
|
119
|
-
"@rolldown/binding-
|
|
120
|
-
"@rolldown/binding-win32-
|
|
121
|
-
"@rolldown/binding-win32-
|
|
122
|
-
"@rolldown/binding-
|
|
119
|
+
"@rolldown/binding-darwin-arm64": "0.15.0",
|
|
120
|
+
"@rolldown/binding-freebsd-x64": "0.15.0",
|
|
121
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.15.0",
|
|
122
|
+
"@rolldown/binding-darwin-x64": "0.15.0",
|
|
123
|
+
"@rolldown/binding-linux-arm64-gnu": "0.15.0",
|
|
124
|
+
"@rolldown/binding-linux-arm64-musl": "0.15.0",
|
|
125
|
+
"@rolldown/binding-linux-x64-gnu": "0.15.0",
|
|
126
|
+
"@rolldown/binding-linux-x64-musl": "0.15.0",
|
|
127
|
+
"@rolldown/binding-wasm32-wasi": "0.15.0",
|
|
128
|
+
"@rolldown/binding-win32-arm64-msvc": "0.15.0",
|
|
129
|
+
"@rolldown/binding-win32-ia32-msvc": "0.15.0",
|
|
130
|
+
"@rolldown/binding-win32-x64-msvc": "0.15.0"
|
|
123
131
|
},
|
|
124
132
|
"scripts": {
|
|
125
133
|
"# Scrips for binding #": "_",
|
|
@@ -130,15 +138,15 @@
|
|
|
130
138
|
"build-binding:wasi:release": "pnpm build-binding --profile release-wasi --target wasm32-wasip1-threads",
|
|
131
139
|
"# Scrips for node #": "_",
|
|
132
140
|
"bak_build-node": "unbuild",
|
|
133
|
-
"build-node": "
|
|
141
|
+
"build-node": "tsx ./build.ts",
|
|
134
142
|
"build-types": "tsc -p ./tsconfig.dts.json",
|
|
135
143
|
"build-types-check": "tsc -p ./tsconfig.check.json",
|
|
136
144
|
"build-native:debug": "run-s build-binding build-types build-node build-types-check",
|
|
137
145
|
"build-native:release": "run-s build-binding:release build-types build-node build-types-check",
|
|
138
|
-
"build-wasi:debug": "run-s build-binding:wasi build-node",
|
|
139
|
-
"build-wasi:release": "run-s build-binding:wasi:release build-node",
|
|
146
|
+
"build-wasi:debug": "run-s build-binding build-binding:wasi build-node",
|
|
147
|
+
"build-wasi:release": "run-s build-binding build-binding:wasi:release build-node",
|
|
140
148
|
"# Scrips for checking #": "_",
|
|
141
|
-
"test": "
|
|
149
|
+
"test": "pnpm run --filter rolldown-tests go",
|
|
142
150
|
"test:update": "vitest run -u",
|
|
143
151
|
"type-check": "tsc"
|
|
144
152
|
}
|