rolldown 0.10.3 → 0.10.4
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 +25 -597
- package/dist/cjs/index.cjs +20 -9
- package/dist/cjs/parallel-plugin-worker.cjs +8 -3
- package/dist/cjs/parallel-plugin.cjs +13 -2
- package/dist/esm/cli.mjs +21 -596
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/parallel-plugin-worker.mjs +4 -2
- package/dist/esm/parallel-plugin.mjs +2 -1
- package/dist/shared/{chunk-WMSF1LUG.cjs → chunk-eib2uzZZ.cjs} +10 -3
- package/dist/shared/{rolldown-7z0huS4W.mjs → rolldown-ftFKbC6A.mjs} +5 -3
- package/dist/shared/{rolldown-pt4wPK1i.cjs → rolldown-l_Cw2GW3.cjs} +7 -3
- package/dist/shared/utils_index-D-jBnBMP.cjs +1375 -0
- package/dist/shared/utils_index-ywWHgCJG.mjs +1406 -0
- package/dist/types/cli/colors.d.ts +2 -0
- package/dist/types/cli/commands/bundle.d.ts +1 -0
- package/dist/types/cli/constants.d.ts +1 -0
- package/dist/types/cli/index.d.ts +1 -0
- package/dist/types/cli/utils.d.ts +6 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/log/logHandler.d.ts +4 -0
- package/dist/types/log/logger.d.ts +13 -0
- package/dist/types/log/logging.d.ts +14 -0
- package/dist/types/log/logs.d.ts +13 -0
- package/dist/types/options/bindingify-input-options.d.ts +4 -0
- package/dist/types/options/bindingify-output-options.d.ts +3 -0
- package/dist/types/options/input-options.d.ts +93 -0
- package/dist/types/options/normalized-input-options.d.ts +10 -0
- package/dist/types/options/normalized-output-options.d.ts +20 -0
- package/dist/types/options/output-options.d.ts +40 -0
- package/dist/types/parallel-plugin-worker.d.ts +1 -0
- package/dist/types/parallel-plugin.d.ts +1 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +10 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +10 -0
- package/dist/types/plugin/bindingify-plugin.d.ts +5 -0
- package/dist/types/plugin/index.d.ts +65 -0
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +10 -0
- package/dist/types/plugin/plugin-context.d.ts +12 -0
- package/dist/types/plugin/plugin-driver.d.ts +4 -0
- package/dist/types/plugin/transfrom-plugin-context.d.ts +13 -0
- package/dist/types/rolldown-build.d.ts +10 -0
- package/dist/types/rolldown.d.ts +9 -0
- package/dist/types/rollup-types.d.ts +1 -0
- package/dist/types/types/config-export.d.ts +5 -0
- package/dist/types/types/module-info.d.ts +13 -0
- package/dist/types/types/output-bundle.d.ts +4 -0
- package/dist/types/types/rendered-module.d.ts +2 -0
- package/dist/types/types/rolldown-options.d.ts +5 -0
- package/dist/types/types/rolldown-output.d.ts +38 -0
- package/dist/types/types/sourcemap.d.ts +10 -0
- package/dist/types/types/utils.d.ts +7 -0
- package/dist/types/utils/async-flatten.d.ts +1 -0
- package/dist/types/utils/code-frame.d.ts +1 -0
- package/dist/types/utils/create-bundler.d.ts +7 -0
- package/dist/types/utils/define-config.d.ts +2 -0
- package/dist/types/utils/ensure-array.d.ts +1 -0
- package/dist/types/utils/index.d.ts +13 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +20 -0
- package/dist/types/utils/normalize-hook.d.ts +5 -0
- package/dist/types/utils/normalize-input-options.d.ts +3 -0
- package/dist/types/utils/normalize-output-options.d.ts +3 -0
- package/dist/types/utils/normalize-plugin-option.d.ts +8 -0
- package/dist/types/utils/transform-module-info.d.ts +3 -0
- package/dist/types/utils/transform-side-effects.d.ts +3 -0
- package/dist/types/utils/transform-sourcemap.d.ts +1 -0
- package/dist/types/utils/transform-to-rollup-output.d.ts +5 -0
- package/dist/types/utils/type-assert.d.ts +12 -0
- package/dist/types/utils/zod-ext.d.ts +15 -0
- package/package.json +22 -22
- package/dist/shared/consola_36c0034f-ED9jtJgC.mjs +0 -942
- package/dist/shared/consola_36c0034f-RVbq7gBJ.cjs +0 -945
- package/dist/shared/prompt-Q6AgPcFh.cjs +0 -859
- package/dist/shared/prompt-uoOfg_gh.mjs +0 -860
- package/dist/shared/utils_index-0Q22WhZL.cjs +0 -5331
- package/dist/shared/utils_index-Wfcc8MjH.mjs +0 -5361
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="colorette" />
|
|
2
|
+
export declare const bold: import("colorette").Color, cyan: import("colorette").Color, dim: import("colorette").Color, gray: import("colorette").Color, green: import("colorette").Color, red: import("colorette").Color, underline: import("colorette").Color, yellow: import("colorette").Color;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bundle(configPath: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_CONFIG_FILENAME = "rolldown.config.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RolldownOutput, RolldownOutputChunk } from './types/rolldown-output';
|
|
2
|
+
import type { InputOptions } from './options/input-options';
|
|
3
|
+
import type { OutputOptions } from './options/output-options';
|
|
4
|
+
import type { RolldownOptions } from './types/rolldown-options';
|
|
5
|
+
import type { Plugin } from './plugin';
|
|
6
|
+
import { defineParallelPlugin, DefineParallelPluginResult } from './plugin';
|
|
7
|
+
import { defineConfig } from './utils/define-config';
|
|
8
|
+
import { rolldown, experimental_scan } from './rolldown';
|
|
9
|
+
import { ConfigExport } from './types/config-export';
|
|
10
|
+
export { defineConfig, defineParallelPlugin, rolldown, experimental_scan };
|
|
11
|
+
export type { RolldownOutputChunk, RolldownOptions, RolldownOutput, InputOptions, OutputOptions, Plugin, DefineParallelPluginResult, ConfigExport, };
|
|
12
|
+
export type { RolldownOutput as RollupOutput, RolldownOptions as RollupOptions };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LoggingFunctionWithPosition, LogHandler, RollupLog } from '../rollup';
|
|
2
|
+
import { type LogLevel, type LogLevelOption } from './logging';
|
|
3
|
+
export declare const normalizeLog: (log: RollupLog | string | (() => RollupLog | string)) => RollupLog;
|
|
4
|
+
export declare function getLogHandler(level: LogLevel, code: string, logger: LogHandler, pluginName: string, logLevel: LogLevelOption): LoggingFunctionWithPosition;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LoggingFunction, LogHandler, RollupError } from '../rollup';
|
|
2
|
+
import type { Plugin } from '../plugin';
|
|
3
|
+
import { type LogLevelOption } from './logging';
|
|
4
|
+
import type { InputOptions } from '../options/input-options';
|
|
5
|
+
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
6
|
+
export interface MinimalPluginContext {
|
|
7
|
+
debug: LoggingFunction;
|
|
8
|
+
error: (error: RollupError | string) => never;
|
|
9
|
+
info: LoggingFunction;
|
|
10
|
+
warn: LoggingFunction;
|
|
11
|
+
}
|
|
12
|
+
export declare function getLogger(plugins: Plugin[], onLog: LogHandler, logLevel: LogLevelOption): LogHandler;
|
|
13
|
+
export declare const getOnLog: (config: InputOptions, logLevel: LogLevelOption, printLog?: LogHandler) => NormalizedInputOptions['onLog'];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const LogLevelSchema: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>;
|
|
3
|
+
export declare const LogLevelWithErrorSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"error">]>;
|
|
4
|
+
export type LogLevel = z.infer<typeof LogLevelSchema>;
|
|
5
|
+
export declare const LogLevelOptionSchema: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"silent">]>;
|
|
6
|
+
export type LogLevelOption = z.infer<typeof LogLevelOptionSchema>;
|
|
7
|
+
export declare const LOG_LEVEL_SILENT: LogLevelOption;
|
|
8
|
+
export declare const LOG_LEVEL_ERROR = "error";
|
|
9
|
+
export declare const LOG_LEVEL_WARN: LogLevel;
|
|
10
|
+
export declare const LOG_LEVEL_INFO: LogLevel;
|
|
11
|
+
export declare const LOG_LEVEL_DEBUG: LogLevel;
|
|
12
|
+
export declare const logLevelPriority: Record<LogLevelOption, number>;
|
|
13
|
+
export declare const RollupLogSchema: z.ZodAny;
|
|
14
|
+
export declare const RollupLogWithStringSchema: z.ZodUnion<[z.ZodAny, z.ZodString]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RollupLog } from '../rollup';
|
|
2
|
+
export declare function logInvalidLogPosition(pluginName: string): RollupLog;
|
|
3
|
+
export declare function logPluginError(error: Omit<RollupLog, 'code'> & {
|
|
4
|
+
code?: unknown;
|
|
5
|
+
}, plugin: string, { hook, id }?: {
|
|
6
|
+
hook?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
}): RollupLog;
|
|
9
|
+
export declare function error(base: Error | RollupLog): never;
|
|
10
|
+
export declare function augmentCodeLocation(properties: RollupLog, pos: number | {
|
|
11
|
+
column: number;
|
|
12
|
+
line: number;
|
|
13
|
+
}, source: string, id: string): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BindingInputOptions } from '../binding';
|
|
2
|
+
import type { NormalizedInputOptions } from './normalized-input-options';
|
|
3
|
+
import type { NormalizedOutputOptions } from './normalized-output-options';
|
|
4
|
+
export declare function bindingifyInputOptions(options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingInputOptions;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Plugin, ParallelPlugin } from '../plugin';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const inputOptionsSchema: z.ZodObject<{
|
|
4
|
+
input: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
5
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodType<Plugin | ParallelPlugin, z.ZodTypeDef, Plugin | ParallelPlugin>, "many">>;
|
|
6
|
+
external: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">]>, z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodString>, z.ZodBoolean], z.ZodUnknown>, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodVoid, z.ZodNull]>, z.ZodUndefined]>, z.ZodBoolean]>>>]>>;
|
|
7
|
+
resolve: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
alias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
9
|
+
aliasFields: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
|
|
10
|
+
conditionNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
exportsFields: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString, "many">, "many">>;
|
|
12
|
+
extensions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
mainFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
mainFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
modules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
symlinks: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
tsconfigFilename: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
modules?: string[] | undefined;
|
|
20
|
+
alias?: Record<string, string> | undefined;
|
|
21
|
+
aliasFields?: string[][] | undefined;
|
|
22
|
+
conditionNames?: string[] | undefined;
|
|
23
|
+
exportsFields?: string[][] | undefined;
|
|
24
|
+
extensions?: string[] | undefined;
|
|
25
|
+
mainFields?: string[] | undefined;
|
|
26
|
+
mainFiles?: string[] | undefined;
|
|
27
|
+
symlinks?: boolean | undefined;
|
|
28
|
+
tsconfigFilename?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
modules?: string[] | undefined;
|
|
31
|
+
alias?: Record<string, string> | undefined;
|
|
32
|
+
aliasFields?: string[][] | undefined;
|
|
33
|
+
conditionNames?: string[] | undefined;
|
|
34
|
+
exportsFields?: string[][] | undefined;
|
|
35
|
+
extensions?: string[] | undefined;
|
|
36
|
+
mainFields?: string[] | undefined;
|
|
37
|
+
mainFiles?: string[] | undefined;
|
|
38
|
+
symlinks?: boolean | undefined;
|
|
39
|
+
tsconfigFilename?: string | undefined;
|
|
40
|
+
}>>;
|
|
41
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
42
|
+
platform: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"node">, z.ZodLiteral<"browser">]>, z.ZodLiteral<"neutral">]>>;
|
|
43
|
+
shimMissingExports: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
logLevel: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"silent">]>>;
|
|
45
|
+
onLog: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodAny, z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"debug">]>, z.ZodLiteral<"warn">]>, z.ZodLiteral<"error">]>, z.ZodUnion<[z.ZodAny, z.ZodString]>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodUnknown>>;
|
|
46
|
+
onwarn: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny, z.ZodFunction<z.ZodTuple<[z.ZodUnion<[z.ZodUnion<[z.ZodAny, z.ZodString]>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodAny, z.ZodString]>>]>], z.ZodUnknown>, z.ZodUnknown>], z.ZodUnknown>, z.ZodUnknown>>;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
input?: string | string[] | Record<string, string> | undefined;
|
|
49
|
+
plugins?: (Plugin | ParallelPlugin)[] | undefined;
|
|
50
|
+
external?: string | RegExp | (string | RegExp)[] | ((args_0: string, args_1: string | undefined, args_2: boolean, ...args_3: unknown[]) => boolean | void | null | undefined) | undefined;
|
|
51
|
+
resolve?: {
|
|
52
|
+
modules?: string[] | undefined;
|
|
53
|
+
alias?: Record<string, string> | undefined;
|
|
54
|
+
aliasFields?: string[][] | undefined;
|
|
55
|
+
conditionNames?: string[] | undefined;
|
|
56
|
+
exportsFields?: string[][] | undefined;
|
|
57
|
+
extensions?: string[] | undefined;
|
|
58
|
+
mainFields?: string[] | undefined;
|
|
59
|
+
mainFiles?: string[] | undefined;
|
|
60
|
+
symlinks?: boolean | undefined;
|
|
61
|
+
tsconfigFilename?: string | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
cwd?: string | undefined;
|
|
64
|
+
platform?: "node" | "browser" | "neutral" | undefined;
|
|
65
|
+
shimMissingExports?: boolean | undefined;
|
|
66
|
+
logLevel?: "info" | "debug" | "warn" | "silent" | undefined;
|
|
67
|
+
onLog?: ((args_0: "info" | "debug" | "warn", args_1: any, args_2: (args_0: "info" | "debug" | "warn" | "error", args_1: any, ...args_2: unknown[]) => unknown, ...args_3: unknown[]) => unknown) | undefined;
|
|
68
|
+
onwarn?: ((args_0: any, args_1: (args_0: any, ...args_1: unknown[]) => unknown, ...args_2: unknown[]) => unknown) | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
input?: string | string[] | Record<string, string> | undefined;
|
|
71
|
+
plugins?: (Plugin | ParallelPlugin)[] | undefined;
|
|
72
|
+
external?: string | RegExp | (string | RegExp)[] | ((args_0: string, args_1: string | undefined, args_2: boolean, ...args_3: unknown[]) => boolean | void | null | undefined) | undefined;
|
|
73
|
+
resolve?: {
|
|
74
|
+
modules?: string[] | undefined;
|
|
75
|
+
alias?: Record<string, string> | undefined;
|
|
76
|
+
aliasFields?: string[][] | undefined;
|
|
77
|
+
conditionNames?: string[] | undefined;
|
|
78
|
+
exportsFields?: string[][] | undefined;
|
|
79
|
+
extensions?: string[] | undefined;
|
|
80
|
+
mainFields?: string[] | undefined;
|
|
81
|
+
mainFiles?: string[] | undefined;
|
|
82
|
+
symlinks?: boolean | undefined;
|
|
83
|
+
tsconfigFilename?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
cwd?: string | undefined;
|
|
86
|
+
platform?: "node" | "browser" | "neutral" | undefined;
|
|
87
|
+
shimMissingExports?: boolean | undefined;
|
|
88
|
+
logLevel?: "info" | "debug" | "warn" | "silent" | undefined;
|
|
89
|
+
onLog?: ((args_0: "info" | "debug" | "warn", args_1: any, args_2: (args_0: "info" | "debug" | "warn" | "error", args_1: any, ...args_2: unknown[]) => unknown, ...args_3: unknown[]) => unknown) | undefined;
|
|
90
|
+
onwarn?: ((args_0: any, args_1: (args_0: any, ...args_1: unknown[]) => unknown, ...args_2: unknown[]) => unknown) | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export type InputOptions = z.infer<typeof inputOptionsSchema>;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LogLevelOption, RollupLog, NormalizedInputOptions as RollupNormalizedInputOptions } from '../rollup';
|
|
2
|
+
import type { InputOptions } from './input-options';
|
|
3
|
+
import type { Plugin, ParallelPlugin } from '../plugin';
|
|
4
|
+
import type { LogLevel } from '../log/logging';
|
|
5
|
+
export interface NormalizedInputOptions extends InputOptions {
|
|
6
|
+
input: RollupNormalizedInputOptions['input'];
|
|
7
|
+
plugins: (Plugin | ParallelPlugin)[];
|
|
8
|
+
onLog: (level: LogLevel, log: RollupLog) => void;
|
|
9
|
+
logLevel: LogLevelOption;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../rollup';
|
|
2
|
+
import type { OutputOptions } from './output-options';
|
|
3
|
+
import type { Plugin, ParallelPlugin } from '../plugin';
|
|
4
|
+
import type { RenderedChunk } from '@src/binding';
|
|
5
|
+
type InternalModuleFormat = 'es' | 'cjs';
|
|
6
|
+
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
7
|
+
export interface NormalizedOutputOptions extends OutputOptions {
|
|
8
|
+
plugins: (Plugin | ParallelPlugin)[];
|
|
9
|
+
dir: string | undefined;
|
|
10
|
+
format: InternalModuleFormat;
|
|
11
|
+
exports: 'named';
|
|
12
|
+
sourcemap: boolean | 'inline' | 'hidden';
|
|
13
|
+
sourcemapIgnoreList: SourcemapIgnoreListOption;
|
|
14
|
+
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
|
15
|
+
banner: AddonFunction;
|
|
16
|
+
footer: AddonFunction;
|
|
17
|
+
entryFileNames: string;
|
|
18
|
+
chunkFileNames: string;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RenderedChunk } from '../binding';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const outputOptionsSchema: z.ZodObject<{
|
|
4
|
+
dir: z.ZodOptional<z.ZodString>;
|
|
5
|
+
exports: z.ZodOptional<z.ZodLiteral<"named">>;
|
|
6
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"es">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>>;
|
|
7
|
+
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
8
|
+
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<SourcemapIgnoreListOption, z.ZodTypeDef, SourcemapIgnoreListOption>]>>;
|
|
9
|
+
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
10
|
+
banner: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
11
|
+
footer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
12
|
+
entryFileNames: z.ZodOptional<z.ZodString>;
|
|
13
|
+
chunkFileNames: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strict", z.ZodTypeAny, {
|
|
15
|
+
exports?: "named" | undefined;
|
|
16
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
17
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
18
|
+
dir?: string | undefined;
|
|
19
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
20
|
+
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
21
|
+
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
22
|
+
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
23
|
+
entryFileNames?: string | undefined;
|
|
24
|
+
chunkFileNames?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
exports?: "named" | undefined;
|
|
27
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
28
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
29
|
+
dir?: string | undefined;
|
|
30
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
|
|
31
|
+
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
32
|
+
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
33
|
+
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
34
|
+
entryFileNames?: string | undefined;
|
|
35
|
+
chunkFileNames?: string | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export type OutputOptions = z.infer<typeof outputOptionsSchema>;
|
|
38
|
+
export type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
39
|
+
export type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineParallelPluginImplementation, type ParallelPluginImplementation, type Context, } from './plugin/parallel-plugin-implementation';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingPluginOptions } from '../binding';
|
|
2
|
+
import type { Plugin } from './index';
|
|
3
|
+
import { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
|
+
export declare function bindingifyBuildStart(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['buildStart'];
|
|
5
|
+
export declare function bindingifyBuildEnd(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['buildEnd'];
|
|
6
|
+
export declare function bindingifyResolveId(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['resolveId'];
|
|
7
|
+
export declare function bindingifyResolveDynamicImport(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['resolveDynamicImport'];
|
|
8
|
+
export declare function bindingifyTransform(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['transform'];
|
|
9
|
+
export declare function bindingifyLoad(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['load'];
|
|
10
|
+
export declare function bindingifyModuleParsed(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['moduleParsed'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BindingPluginOptions } from '../binding';
|
|
2
|
+
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
|
+
import type { Plugin } from './index';
|
|
4
|
+
import { NormalizedOutputOptions } from '@src/options/normalized-output-options';
|
|
5
|
+
export declare function bindingifyRenderStart(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['renderStart'];
|
|
6
|
+
export declare function bindingifyRenderChunk(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['renderChunk'];
|
|
7
|
+
export declare function bindingifyAugmentChunkHash(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['augmentChunkHash'];
|
|
8
|
+
export declare function bindingifyRenderError(plugin: Plugin, options: NormalizedInputOptions): BindingPluginOptions['renderError'];
|
|
9
|
+
export declare function bindingifyGenerateBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['generateBundle'];
|
|
10
|
+
export declare function bindingifyWriteBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions['writeBundle'];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BindingPluginOptions } from '../binding';
|
|
2
|
+
import type { Plugin } from './index';
|
|
3
|
+
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
|
+
import type { NormalizedOutputOptions } from '@src/options/normalized-output-options';
|
|
5
|
+
export declare function bindingifyPlugin(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions): BindingPluginOptions;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { BindingHookResolveIdExtraOptions, RenderedChunk } from '../binding';
|
|
2
|
+
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
|
+
import type { AnyFn, AnyObj, NullValue, MaybePromise } from '../types/utils';
|
|
4
|
+
import type { SourceMapInput } from '../types/sourcemap';
|
|
5
|
+
import type { ModuleInfo } from '../types/module-info';
|
|
6
|
+
import type { OutputBundle } from '../types/output-bundle';
|
|
7
|
+
import type { PluginContext } from './plugin-context';
|
|
8
|
+
import type { TransformPluginContext } from './transfrom-plugin-context';
|
|
9
|
+
import type { NormalizedOutputOptions } from '@src/options/normalized-output-options';
|
|
10
|
+
import type { LogLevel } from '../log/logging';
|
|
11
|
+
import type { RollupLog } from '../rollup';
|
|
12
|
+
import type { MinimalPluginContext } from '../log/logger';
|
|
13
|
+
type FormalHook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = {
|
|
14
|
+
handler: Handler;
|
|
15
|
+
} & HookOptions;
|
|
16
|
+
export type Hook<Handler extends AnyFn, HookOptions extends AnyObj = AnyObj> = FormalHook<Handler, HookOptions> | Handler;
|
|
17
|
+
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
18
|
+
export type ResolveIdResult = string | NullValue | false | {
|
|
19
|
+
id: string;
|
|
20
|
+
external?: boolean;
|
|
21
|
+
moduleSideEffects?: ModuleSideEffects;
|
|
22
|
+
};
|
|
23
|
+
export interface Plugin {
|
|
24
|
+
name?: string;
|
|
25
|
+
onLog?: Hook<(this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean>;
|
|
26
|
+
options?: Hook<(this: MinimalPluginContext, options: NormalizedInputOptions) => NullValue>;
|
|
27
|
+
buildStart?: Hook<(this: PluginContext, options: NormalizedInputOptions) => MaybePromise<NullValue>>;
|
|
28
|
+
resolveId?: Hook<(this: PluginContext, source: string, importer: string | undefined, extraOptions: BindingHookResolveIdExtraOptions) => MaybePromise<ResolveIdResult>>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
31
|
+
* This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
|
|
32
|
+
*/
|
|
33
|
+
resolveDynamicImport?: Hook<(this: PluginContext, source: string, importer: string | undefined) => MaybePromise<ResolveIdResult>>;
|
|
34
|
+
load?: Hook<(this: PluginContext, id: string) => MaybePromise<NullValue | string | {
|
|
35
|
+
code: string;
|
|
36
|
+
map?: SourceMapInput;
|
|
37
|
+
moduleSideEffects?: ModuleSideEffects;
|
|
38
|
+
}>>;
|
|
39
|
+
transform?: Hook<(this: TransformPluginContext, code: string, id: string) => MaybePromise<NullValue | string | {
|
|
40
|
+
code: string;
|
|
41
|
+
map?: string | null | SourceMapInput;
|
|
42
|
+
moduleSideEffects?: ModuleSideEffects;
|
|
43
|
+
}>>;
|
|
44
|
+
moduleParsed?: Hook<(this: PluginContext, moduleInfo: ModuleInfo) => MaybePromise<NullValue>>;
|
|
45
|
+
buildEnd?: Hook<(this: PluginContext, err?: Error) => MaybePromise<NullValue>>;
|
|
46
|
+
renderStart?: Hook<(this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => MaybePromise<NullValue>>;
|
|
47
|
+
renderChunk?: Hook<(this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => MaybePromise<NullValue | string | {
|
|
48
|
+
code: string;
|
|
49
|
+
map?: string | null | SourceMapInput;
|
|
50
|
+
}>>;
|
|
51
|
+
augmentChunkHash?: Hook<(this: PluginContext, chunk: RenderedChunk) => MaybePromise<string | void>>;
|
|
52
|
+
renderError?: Hook<(this: PluginContext, error: Error) => MaybePromise<NullValue>>;
|
|
53
|
+
generateBundle?: Hook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => MaybePromise<NullValue>>;
|
|
54
|
+
writeBundle?: Hook<(this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => MaybePromise<NullValue>>;
|
|
55
|
+
}
|
|
56
|
+
export type ParallelPlugin = {
|
|
57
|
+
/** @internal */
|
|
58
|
+
_parallel: {
|
|
59
|
+
fileUrl: string;
|
|
60
|
+
options: unknown;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
|
|
64
|
+
export declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MaybePromise } from '../types/utils';
|
|
2
|
+
import type { Plugin } from './index';
|
|
3
|
+
export type ParallelPluginImplementation = Plugin;
|
|
4
|
+
export type Context = {
|
|
5
|
+
/**
|
|
6
|
+
* Thread number
|
|
7
|
+
*/
|
|
8
|
+
threadNumber: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RollupError, LoggingFunction } from '../rollup';
|
|
2
|
+
import type { BindingPluginContext } from '../binding';
|
|
3
|
+
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
|
+
import type { Plugin } from './index';
|
|
5
|
+
export declare class PluginContext {
|
|
6
|
+
debug: LoggingFunction;
|
|
7
|
+
info: LoggingFunction;
|
|
8
|
+
warn: LoggingFunction;
|
|
9
|
+
error: (error: RollupError | string) => never;
|
|
10
|
+
resolve: BindingPluginContext['resolve'];
|
|
11
|
+
constructor(options: NormalizedInputOptions, context: BindingPluginContext, plugin: Plugin);
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BindingPluginContext, BindingTransformPluginContext } from '@src/binding';
|
|
2
|
+
import type { SourceMap } from '@src/types/rolldown-output';
|
|
3
|
+
import type { LoggingFunction, RollupError } from '../rollup';
|
|
4
|
+
import type { PluginContext } from './plugin-context';
|
|
5
|
+
export declare class TransformPluginContext {
|
|
6
|
+
debug: LoggingFunction;
|
|
7
|
+
info: LoggingFunction;
|
|
8
|
+
warn: LoggingFunction;
|
|
9
|
+
error: (error: RollupError | string) => never;
|
|
10
|
+
resolve: BindingPluginContext['resolve'];
|
|
11
|
+
getCombinedSourcemap: () => SourceMap;
|
|
12
|
+
constructor(inner: BindingTransformPluginContext, context: PluginContext, moduleId: string, moduleSource: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OutputOptions } from './options/output-options';
|
|
2
|
+
import type { RolldownOutput } from './types/rolldown-output';
|
|
3
|
+
import type { InputOptions } from './options/input-options';
|
|
4
|
+
export declare class RolldownBuild {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(inputOptions: InputOptions);
|
|
7
|
+
generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
8
|
+
write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
9
|
+
destroy(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InputOptions } from './options/input-options';
|
|
2
|
+
import { RolldownBuild } from './rolldown-build';
|
|
3
|
+
export declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* This is an experimental API. It's behavior may change in the future.
|
|
7
|
+
* Calling this API will only execute the scan stage of rolldown.
|
|
8
|
+
*/
|
|
9
|
+
export declare const experimental_scan: (input: InputOptions) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { OutputOptions, InputOptions, Plugin, OutputPlugin, OutputChunk, NormalizedInputOptions, OutputAsset, OutputBundle, SourceMapInput, } from './rollup';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ModuleInfo {
|
|
2
|
+
/**
|
|
3
|
+
* Unsupported at rolldown
|
|
4
|
+
*/
|
|
5
|
+
ast: any;
|
|
6
|
+
code: string | null;
|
|
7
|
+
id: string;
|
|
8
|
+
importers: string[];
|
|
9
|
+
dynamicImporters: string[];
|
|
10
|
+
importedIds: string[];
|
|
11
|
+
dynamicallyImportedIds: string[];
|
|
12
|
+
isEntry: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RenderedModule } from './rendered-module';
|
|
2
|
+
export interface RolldownOutputAsset {
|
|
3
|
+
type: 'asset';
|
|
4
|
+
fileName: string;
|
|
5
|
+
source: string | Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export interface SourceMap {
|
|
8
|
+
file: string;
|
|
9
|
+
mappings: string;
|
|
10
|
+
names: string[];
|
|
11
|
+
sources: string[];
|
|
12
|
+
sourcesContent: string[];
|
|
13
|
+
version: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RolldownOutputChunk {
|
|
16
|
+
type: 'chunk';
|
|
17
|
+
code: string;
|
|
18
|
+
isEntry: boolean;
|
|
19
|
+
exports: string[];
|
|
20
|
+
fileName: string;
|
|
21
|
+
modules: {
|
|
22
|
+
[id: string]: RenderedModule;
|
|
23
|
+
};
|
|
24
|
+
imports: string[];
|
|
25
|
+
dynamicImports: string[];
|
|
26
|
+
facadeModuleId: string | null;
|
|
27
|
+
isDynamicEntry: boolean;
|
|
28
|
+
moduleIds: string[];
|
|
29
|
+
map: SourceMap | null;
|
|
30
|
+
sourcemapFileName: string | null;
|
|
31
|
+
preliminaryFileName: string;
|
|
32
|
+
}
|
|
33
|
+
export interface RolldownOutput {
|
|
34
|
+
output: [
|
|
35
|
+
RolldownOutputChunk,
|
|
36
|
+
...(RolldownOutputChunk | RolldownOutputAsset)[]
|
|
37
|
+
];
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface SourceMapInputObject {
|
|
2
|
+
file?: string;
|
|
3
|
+
mappings: string;
|
|
4
|
+
names?: string[];
|
|
5
|
+
sources?: (string | null)[];
|
|
6
|
+
sourcesContent?: (string | null)[];
|
|
7
|
+
sourceRoot?: string;
|
|
8
|
+
version: number;
|
|
9
|
+
}
|
|
10
|
+
export type SourceMapInput = SourceMapInputObject | string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function asyncFlatten<T>(array: T[]): Promise<T[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCodeFrame(source: string, line: number, column: number): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Bundler } from '../binding';
|
|
2
|
+
import type { InputOptions } from '../options/input-options';
|
|
3
|
+
import type { OutputOptions } from '../options/output-options';
|
|
4
|
+
export declare function createBundler(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<{
|
|
5
|
+
bundler: Bundler;
|
|
6
|
+
stopWorkers?: () => Promise<void>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureArray<T>(items: (T | false | null | undefined)[] | T | false | null | undefined): T[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './async-flatten';
|
|
2
|
+
export * from './transform-to-rollup-output';
|
|
3
|
+
export * from './normalize-plugin-option';
|
|
4
|
+
export * from './ensure-array';
|
|
5
|
+
export * from './create-bundler';
|
|
6
|
+
export * from './transform-sourcemap';
|
|
7
|
+
export * from './transform-module-info';
|
|
8
|
+
export * from './code-frame';
|
|
9
|
+
export declare function arraify<T>(value: T | T[]): T[];
|
|
10
|
+
export declare function unimplemented(info?: string): never;
|
|
11
|
+
export declare function unreachable(info?: string): never;
|
|
12
|
+
export declare function unsupported(info: string): never;
|
|
13
|
+
export declare function noop(..._args: any[]): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Worker } from 'node:worker_threads';
|
|
3
|
+
import type { ParallelPlugin, Plugin } from '../plugin';
|
|
4
|
+
import { ParallelJsPluginRegistry } from '../binding';
|
|
5
|
+
export type WorkerData = {
|
|
6
|
+
registryId: number;
|
|
7
|
+
pluginInfos: ParallelPluginInfo[];
|
|
8
|
+
threadNumber: number;
|
|
9
|
+
};
|
|
10
|
+
type ParallelPluginInfo = {
|
|
11
|
+
index: number;
|
|
12
|
+
fileUrl: string;
|
|
13
|
+
options: unknown;
|
|
14
|
+
};
|
|
15
|
+
export declare function initializeParallelPlugins(plugins: (Plugin | ParallelPlugin)[]): Promise<{
|
|
16
|
+
registry: ParallelJsPluginRegistry;
|
|
17
|
+
stopWorkers: () => Promise<void>;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
export declare function initializeWorkers(registryId: number, count: number, pluginInfos: ParallelPluginInfo[]): Promise<Worker[]>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Hook } from '../plugin';
|
|
2
|
+
import type { AnyFn, AnyObj } from '../types/utils';
|
|
3
|
+
type NotFn<T> = T extends AnyFn ? never : T;
|
|
4
|
+
export declare function normalizeHook<H extends Hook<AnyFn, AnyObj>>(hook: H): H extends Hook<infer Handler, infer Options> ? [Handler, NotFn<Options>] : never;
|
|
5
|
+
export {};
|