rolldown 0.15.0 → 0.15.1-commit.09cccaf
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 +249 -183
- package/dist/cjs/experimental-index.cjs +2 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/parallel-plugin-worker.cjs +2 -2
- package/dist/esm/cli.mjs +343 -277
- package/dist/esm/experimental-index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{chunk-BK2Ye-xa.cjs → chunk-BFvIen8E.cjs} +0 -11
- package/dist/shared/{consola_36c0034f-_8_dG1Nr.cjs → consola_36c0034f-B7L-radJ.cjs} +2 -2
- package/dist/shared/{consola_36c0034f-DWsVjwtA.mjs → consola_36c0034f-D9ce-831.mjs} +10 -10
- package/dist/shared/{prompt-RFvZMmjc.cjs → prompt-BiXtYIJ2.cjs} +3 -3
- package/dist/shared/{prompt-DGW8ZJmn.mjs → prompt-DlQ-08lk.mjs} +2 -2
- package/dist/shared/{src-COU7qQBJ.cjs → src-BKghi7SX.cjs} +321 -216
- package/dist/shared/{src-DEPa5yhI.mjs → src-BKlslLnW.mjs} +332 -233
- package/dist/tsconfig.dts.tsbuildinfo +1 -0
- package/dist/types/api/build.d.ts +2 -0
- package/dist/types/api/watch/index.d.ts +2 -2
- package/dist/types/api/watch/watch-emitter.d.ts +31 -0
- package/dist/types/api/watch/watcher.d.ts +7 -27
- package/dist/types/binding.d.ts +114 -19
- package/dist/types/builtin-plugin/constructors.d.ts +1 -5
- package/dist/types/cli/arguments/index.d.ts +5 -3
- package/dist/types/cli/arguments/schema.d.ts +10 -397
- package/dist/types/cli/colors.d.ts +11 -1
- package/dist/types/cli/load-config.d.ts +3 -0
- package/dist/types/cli/logger.d.ts +5 -0
- package/dist/types/constants/plugin.d.ts +8 -1
- package/dist/types/index.d.ts +4 -5
- package/dist/types/log/logHandler.d.ts +1 -1
- package/dist/types/log/logger.d.ts +1 -1
- package/dist/types/log/logging.d.ts +6 -6
- package/dist/types/log/logs.d.ts +3 -1
- package/dist/types/options/input-options-schema.d.ts +3 -595
- package/dist/types/options/input-options.d.ts +26 -3
- package/dist/types/options/normalized-input-options.d.ts +2 -2
- package/dist/types/options/normalized-output-options.d.ts +22 -18
- package/dist/types/options/output-options-schema.d.ts +2 -146
- package/dist/types/options/output-options.d.ts +4 -3
- package/dist/types/plugin/bindingify-plugin.d.ts +1 -1
- package/dist/types/plugin/index.d.ts +6 -6
- package/dist/types/plugin/minimal-plugin-context.d.ts +4 -4
- package/dist/types/plugin/plugin-context-data.d.ts +2 -1
- package/dist/types/plugin/plugin-context.d.ts +15 -11
- package/dist/types/plugin/transform-plugin-context.d.ts +8 -5
- package/dist/types/treeshake/module-side-effects.d.ts +14 -115
- package/dist/types/types/misc.d.ts +40 -0
- package/dist/types/types/module-info.d.ts +1 -0
- package/dist/types/types/output-bundle.d.ts +2 -2
- package/dist/types/types/rolldown-output.d.ts +14 -11
- package/dist/types/utils/bindingify-input-options.d.ts +2 -2
- package/dist/types/utils/create-bundler-option.d.ts +11 -0
- package/dist/types/utils/error.d.ts +2 -1
- package/dist/types/utils/misc.d.ts +1 -1
- package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
- package/dist/types/utils/transform-rendered-chunk.d.ts +4 -4
- package/dist/types/utils/transform-rendered-module.d.ts +2 -2
- package/dist/types/utils/transform-sourcemap.d.ts +1 -1
- package/dist/types/utils/zod-ext.d.ts +6 -5
- package/package.json +17 -17
- package/dist/types/cli/utils.d.ts +0 -6
- package/dist/types/log/locate-character/index.d.ts +0 -13
- package/dist/types/rollup-types.d.ts +0 -1
- package/dist/types/rollup.d.ts +0 -1114
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LogHandler } from '../
|
|
1
|
+
import type { LogHandler } from '../types/misc';
|
|
2
2
|
import { BindingNormalizedOptions } from '../binding';
|
|
3
3
|
import { InputOptions } from '..';
|
|
4
4
|
export interface NormalizedInputOptions {
|
|
@@ -14,5 +14,5 @@ export declare class NormalizedInputOptionsImpl implements NormalizedInputOption
|
|
|
14
14
|
get shimMissingExports(): boolean;
|
|
15
15
|
get input(): string[] | Record<string, string>;
|
|
16
16
|
get cwd(): string | undefined;
|
|
17
|
-
get platform():
|
|
17
|
+
get platform(): 'browser' | 'node' | 'neutral';
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BindingNormalizedOptions } from '../binding';
|
|
2
|
-
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../
|
|
2
|
+
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../types/misc';
|
|
3
3
|
import type { ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
|
|
4
4
|
export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | 'umd' | 'app';
|
|
5
5
|
export interface NormalizedOutputOptions {
|
|
@@ -29,35 +29,39 @@ export interface NormalizedOutputOptions {
|
|
|
29
29
|
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
|
30
30
|
minify: boolean;
|
|
31
31
|
comments: 'none' | 'preserve-legal';
|
|
32
|
+
polyfillRequire: boolean;
|
|
32
33
|
}
|
|
34
|
+
type UnsupportedFnRet = () => never;
|
|
33
35
|
export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOptions {
|
|
34
36
|
inner: BindingNormalizedOptions;
|
|
35
37
|
constructor(inner: BindingNormalizedOptions);
|
|
36
38
|
get dir(): string | undefined;
|
|
37
|
-
get entryFileNames(): string |
|
|
38
|
-
get chunkFileNames(): string |
|
|
39
|
+
get entryFileNames(): string | UnsupportedFnRet;
|
|
40
|
+
get chunkFileNames(): string | UnsupportedFnRet;
|
|
39
41
|
get assetFileNames(): string;
|
|
40
|
-
get format():
|
|
41
|
-
get exports():
|
|
42
|
-
get sourcemap(): boolean |
|
|
43
|
-
get cssEntryFileNames(): string |
|
|
44
|
-
get cssChunkFileNames(): string |
|
|
42
|
+
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd';
|
|
43
|
+
get exports(): 'default' | 'named' | 'none' | 'auto';
|
|
44
|
+
get sourcemap(): boolean | 'inline' | 'hidden';
|
|
45
|
+
get cssEntryFileNames(): string | UnsupportedFnRet;
|
|
46
|
+
get cssChunkFileNames(): string | UnsupportedFnRet;
|
|
45
47
|
get shimMissingExports(): boolean;
|
|
46
48
|
get name(): string | undefined;
|
|
47
49
|
get file(): string | undefined;
|
|
48
50
|
get inlineDynamicImports(): boolean;
|
|
49
51
|
get externalLiveBindings(): boolean;
|
|
50
|
-
get banner(): string |
|
|
51
|
-
get footer(): string |
|
|
52
|
-
get intro(): string |
|
|
53
|
-
get outro(): string |
|
|
54
|
-
get esModule(): boolean |
|
|
52
|
+
get banner(): string | UnsupportedFnRet | undefined;
|
|
53
|
+
get footer(): string | UnsupportedFnRet | undefined;
|
|
54
|
+
get intro(): string | UnsupportedFnRet | undefined;
|
|
55
|
+
get outro(): string | UnsupportedFnRet | undefined;
|
|
56
|
+
get esModule(): boolean | 'if-default-prop';
|
|
55
57
|
get extend(): boolean;
|
|
56
|
-
get globals(): Record<string, string> |
|
|
57
|
-
get hashCharacters():
|
|
58
|
+
get globals(): Record<string, string> | UnsupportedFnRet;
|
|
59
|
+
get hashCharacters(): 'base64' | 'base36' | 'hex';
|
|
58
60
|
get sourcemapDebugIds(): boolean;
|
|
59
|
-
get sourcemapIgnoreList():
|
|
60
|
-
get sourcemapPathTransform():
|
|
61
|
+
get sourcemapIgnoreList(): UnsupportedFnRet | undefined;
|
|
62
|
+
get sourcemapPathTransform(): UnsupportedFnRet | undefined;
|
|
61
63
|
get minify(): boolean;
|
|
62
|
-
get comments():
|
|
64
|
+
get comments(): 'none' | 'preserve-legal';
|
|
65
|
+
get polyfillRequire(): boolean;
|
|
63
66
|
}
|
|
67
|
+
export {};
|
|
@@ -1,147 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import { RolldownRenderedChunk } from '../types/rolldown-output';
|
|
5
|
-
export declare const outputCliOptionsSchema: z.ZodObject<Omit<z.objectUtil.extendShape<{
|
|
6
|
-
dir: z.ZodOptional<z.ZodString>;
|
|
7
|
-
file: z.ZodOptional<z.ZodString>;
|
|
8
|
-
exports: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"named">]>, z.ZodLiteral<"default">]>, z.ZodLiteral<"none">]>>;
|
|
9
|
-
hashCharacters: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"base64">, z.ZodLiteral<"base36">]>, z.ZodLiteral<"hex">]>>;
|
|
10
|
-
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>, z.ZodLiteral<"umd">]>>;
|
|
11
|
-
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
12
|
-
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<SourcemapIgnoreListOption, z.ZodTypeDef, SourcemapIgnoreListOption>]>>;
|
|
13
|
-
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
14
|
-
banner: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RolldownRenderedChunk, z.ZodTypeDef, RolldownRenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
15
|
-
footer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RolldownRenderedChunk, z.ZodTypeDef, RolldownRenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
16
|
-
intro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RolldownRenderedChunk, z.ZodTypeDef, RolldownRenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
17
|
-
outro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RolldownRenderedChunk, z.ZodTypeDef, RolldownRenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
18
|
-
extend: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
esModule: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"if-default-prop">, z.ZodBoolean]>>;
|
|
20
|
-
assetFileNames: z.ZodOptional<z.ZodString>;
|
|
21
|
-
entryFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
22
|
-
chunkFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
23
|
-
cssEntryFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
24
|
-
cssChunkFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
25
|
-
minify: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
name: z.ZodOptional<z.ZodString>;
|
|
27
|
-
globals: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodString>]>>;
|
|
28
|
-
externalLiveBindings: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
29
|
-
inlineDynamicImports: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
30
|
-
advancedChunks: z.ZodOptional<z.ZodObject<{
|
|
31
|
-
minSize: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
minShareCount: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
-
name: z.ZodString;
|
|
35
|
-
test: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>>;
|
|
36
|
-
priority: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
minSize: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
minShareCount: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
}, "strict", z.ZodTypeAny, {
|
|
40
|
-
name: string;
|
|
41
|
-
test?: string | RegExp | undefined;
|
|
42
|
-
minSize?: number | undefined;
|
|
43
|
-
minShareCount?: number | undefined;
|
|
44
|
-
priority?: number | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
name: string;
|
|
47
|
-
test?: string | RegExp | undefined;
|
|
48
|
-
minSize?: number | undefined;
|
|
49
|
-
minShareCount?: number | undefined;
|
|
50
|
-
priority?: number | undefined;
|
|
51
|
-
}>, "many">>;
|
|
52
|
-
}, "strict", z.ZodTypeAny, {
|
|
53
|
-
minSize?: number | undefined;
|
|
54
|
-
minShareCount?: number | undefined;
|
|
55
|
-
groups?: {
|
|
56
|
-
name: string;
|
|
57
|
-
test?: string | RegExp | undefined;
|
|
58
|
-
minSize?: number | undefined;
|
|
59
|
-
minShareCount?: number | undefined;
|
|
60
|
-
priority?: number | undefined;
|
|
61
|
-
}[] | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
minSize?: number | undefined;
|
|
64
|
-
minShareCount?: number | undefined;
|
|
65
|
-
groups?: {
|
|
66
|
-
name: string;
|
|
67
|
-
test?: string | RegExp | undefined;
|
|
68
|
-
minSize?: number | undefined;
|
|
69
|
-
minShareCount?: number | undefined;
|
|
70
|
-
priority?: number | undefined;
|
|
71
|
-
}[] | undefined;
|
|
72
|
-
}>>;
|
|
73
|
-
comments: z.ZodOptional<z.ZodEnum<["none", "preserve-legal"]>>;
|
|
74
|
-
}, {
|
|
75
|
-
banner: z.ZodOptional<z.ZodString>;
|
|
76
|
-
footer: z.ZodOptional<z.ZodString>;
|
|
77
|
-
intro: z.ZodOptional<z.ZodString>;
|
|
78
|
-
outro: z.ZodOptional<z.ZodString>;
|
|
79
|
-
esModule: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
-
globals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
81
|
-
advancedChunks: z.ZodOptional<z.ZodObject<{
|
|
82
|
-
minSize: z.ZodOptional<z.ZodNumber>;
|
|
83
|
-
minShareCount: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
}, "strict", z.ZodTypeAny, {
|
|
85
|
-
minSize?: number | undefined;
|
|
86
|
-
minShareCount?: number | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
minSize?: number | undefined;
|
|
89
|
-
minShareCount?: number | undefined;
|
|
90
|
-
}>>;
|
|
91
|
-
}>, "sourcemapIgnoreList" | "sourcemapPathTransform">, "strict", z.ZodTypeAny, {
|
|
92
|
-
name?: string | undefined;
|
|
93
|
-
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
94
|
-
banner?: string | undefined;
|
|
95
|
-
footer?: string | undefined;
|
|
96
|
-
intro?: string | undefined;
|
|
97
|
-
outro?: string | undefined;
|
|
98
|
-
esModule?: boolean | undefined;
|
|
99
|
-
globals?: Record<string, string> | undefined;
|
|
100
|
-
advancedChunks?: {
|
|
101
|
-
minSize?: number | undefined;
|
|
102
|
-
minShareCount?: number | undefined;
|
|
103
|
-
} | undefined;
|
|
104
|
-
dir?: string | undefined;
|
|
105
|
-
file?: string | undefined;
|
|
106
|
-
hashCharacters?: "base64" | "base36" | "hex" | undefined;
|
|
107
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" | undefined;
|
|
108
|
-
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
109
|
-
extend?: boolean | undefined;
|
|
110
|
-
assetFileNames?: string | undefined;
|
|
111
|
-
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
112
|
-
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
113
|
-
cssEntryFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
114
|
-
cssChunkFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
115
|
-
minify?: boolean | undefined;
|
|
116
|
-
externalLiveBindings?: boolean | undefined;
|
|
117
|
-
inlineDynamicImports?: boolean | undefined;
|
|
118
|
-
comments?: "none" | "preserve-legal" | undefined;
|
|
119
|
-
}, {
|
|
120
|
-
name?: string | undefined;
|
|
121
|
-
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
122
|
-
banner?: string | undefined;
|
|
123
|
-
footer?: string | undefined;
|
|
124
|
-
intro?: string | undefined;
|
|
125
|
-
outro?: string | undefined;
|
|
126
|
-
esModule?: boolean | undefined;
|
|
127
|
-
globals?: Record<string, string> | undefined;
|
|
128
|
-
advancedChunks?: {
|
|
129
|
-
minSize?: number | undefined;
|
|
130
|
-
minShareCount?: number | undefined;
|
|
131
|
-
} | undefined;
|
|
132
|
-
dir?: string | undefined;
|
|
133
|
-
file?: string | undefined;
|
|
134
|
-
hashCharacters?: "base64" | "base36" | "hex" | undefined;
|
|
135
|
-
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" | undefined;
|
|
136
|
-
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
137
|
-
extend?: boolean | undefined;
|
|
138
|
-
assetFileNames?: string | undefined;
|
|
139
|
-
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
140
|
-
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
141
|
-
cssEntryFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
142
|
-
cssChunkFileNames?: string | ((args_0: PreRenderedChunk, ...args: unknown[]) => string) | undefined;
|
|
143
|
-
minify?: boolean | undefined;
|
|
144
|
-
externalLiveBindings?: boolean | undefined;
|
|
145
|
-
inlineDynamicImports?: boolean | undefined;
|
|
146
|
-
comments?: "none" | "preserve-legal" | undefined;
|
|
147
|
-
}>;
|
|
2
|
+
import type { OutputCliOptions } from '../options/output-options';
|
|
3
|
+
export declare const outputCliOptionsSchema: z.ZodType<OutputCliOptions>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { StringOrRegExp } from '../types/utils';
|
|
2
2
|
import type { PreRenderedChunk } from '../binding';
|
|
3
|
-
import { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../
|
|
3
|
+
import { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../types/misc';
|
|
4
4
|
import { RolldownOutputPluginOption } from '../plugin';
|
|
5
|
-
import {
|
|
5
|
+
import { RenderedChunk } from '../types/rolldown-output';
|
|
6
6
|
export type ModuleFormat = 'es' | 'cjs' | 'esm' | 'module' | 'commonjs' | 'iife' | 'umd' | 'experimental-app';
|
|
7
|
-
export type AddonFunction = (chunk:
|
|
7
|
+
export type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
8
8
|
export type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
|
|
9
9
|
export type GlobalsFunction = (name: string) => string;
|
|
10
10
|
export interface OutputOptions {
|
|
@@ -60,6 +60,7 @@ export interface OutputOptions {
|
|
|
60
60
|
*/
|
|
61
61
|
comments?: 'none' | 'preserve-legal';
|
|
62
62
|
plugins?: RolldownOutputPluginOption;
|
|
63
|
+
polyfillRequire?: boolean;
|
|
63
64
|
}
|
|
64
65
|
interface OverwriteOutputOptionsForCli {
|
|
65
66
|
banner?: string;
|
|
@@ -2,7 +2,7 @@ import type { BindingPluginOptions } from '../binding';
|
|
|
2
2
|
import type { Plugin } from './index';
|
|
3
3
|
import type { OutputOptions } from '../options/output-options';
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
|
-
import type { LogHandler, LogLevelOption } from '../
|
|
5
|
+
import type { LogHandler, LogLevelOption } from '../types/misc';
|
|
6
6
|
import type { InputOptions } from '../options/input-options';
|
|
7
7
|
export interface BindingifyPluginArgs {
|
|
8
8
|
plugin: Plugin;
|
|
@@ -8,7 +8,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
|
-
import type { RollupLog } from '../
|
|
11
|
+
import type { RollupLog } from '../types/misc';
|
|
12
12
|
import type { MinimalPluginContext } from './minimal-plugin-context';
|
|
13
13
|
import type { InputOptions, OutputOptions } from '..';
|
|
14
14
|
import type { BuiltinPlugin } from '../builtin-plugin/constructors';
|
|
@@ -17,7 +17,7 @@ import type { DefinedHookNames } from '../constants/plugin';
|
|
|
17
17
|
import type { DEFINED_HOOK_NAMES } from '../constants/plugin';
|
|
18
18
|
import type { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
19
19
|
import type { HookFilter } from './hook-filter';
|
|
20
|
-
import {
|
|
20
|
+
import { RenderedChunk } from '../types/rolldown-output';
|
|
21
21
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
22
22
|
export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
23
23
|
export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
|
|
@@ -70,11 +70,11 @@ export interface FunctionPluginHooks {
|
|
|
70
70
|
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
71
71
|
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
72
72
|
[DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
73
|
-
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk:
|
|
73
|
+
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
74
74
|
code: string;
|
|
75
75
|
map?: SourceMapInput;
|
|
76
76
|
};
|
|
77
|
-
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk:
|
|
77
|
+
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
78
78
|
[DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
|
|
79
79
|
[DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
80
80
|
[DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
@@ -107,14 +107,14 @@ export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends
|
|
|
107
107
|
export type PluginHooks = {
|
|
108
108
|
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K>>;
|
|
109
109
|
};
|
|
110
|
-
export type AddonHookFunction = (this: PluginContext, chunk:
|
|
110
|
+
export type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
|
|
111
111
|
export type AddonHook = string | AddonHookFunction;
|
|
112
112
|
export interface OutputPlugin extends Partial<{
|
|
113
113
|
[K in OutputPluginHooks]: PluginHooks[K];
|
|
114
114
|
}>, Partial<{
|
|
115
115
|
[K in AddonHooks]: ObjectHook<AddonHook>;
|
|
116
116
|
}> {
|
|
117
|
-
name
|
|
117
|
+
name: string;
|
|
118
118
|
}
|
|
119
119
|
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
120
120
|
api?: A;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { LoggingFunction, LogHandler, LogLevelOption, RollupError } from '../
|
|
2
|
-
import type { Plugin } from '../plugin';
|
|
1
|
+
import type { LoggingFunction, LogHandler, LogLevelOption, RollupError } from '../types/misc';
|
|
3
2
|
export interface PluginContextMeta {
|
|
4
3
|
rollupVersion: string;
|
|
5
4
|
rolldownVersion: string;
|
|
6
5
|
watchMode: boolean;
|
|
7
6
|
}
|
|
8
7
|
export declare class MinimalPluginContext {
|
|
8
|
+
readonly pluginName: string;
|
|
9
9
|
info: LoggingFunction;
|
|
10
10
|
warn: LoggingFunction;
|
|
11
11
|
debug: LoggingFunction;
|
|
12
12
|
meta: PluginContextMeta;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
constructor(onLog: LogHandler, logLevel: LogLevelOption, pluginName: string);
|
|
14
|
+
error(e: RollupError | string): never;
|
|
15
15
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { BindingPluginContext } from '../binding';
|
|
2
2
|
import { ModuleOptions } from '..';
|
|
3
3
|
import { PluginContextResolveOptions } from './plugin-context';
|
|
4
|
+
import type { ModuleInfo } from '../types/module-info';
|
|
4
5
|
export declare class PluginContextData {
|
|
5
6
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
6
7
|
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
7
8
|
loadModulePromiseMap: Map<string, Promise<void>>;
|
|
8
9
|
updateModuleOption(id: string, option: ModuleOptions): void;
|
|
9
10
|
getModuleOption(id: string): ModuleOptions;
|
|
10
|
-
getModuleInfo(id: string, context: BindingPluginContext):
|
|
11
|
+
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
|
|
11
12
|
getModuleIds(context: BindingPluginContext): ArrayIterator<string>;
|
|
12
13
|
saveResolveOptions(options: PluginContextResolveOptions): number;
|
|
13
14
|
getSavedResolveOptions(receipt: number): PluginContextResolveOptions | undefined;
|
|
@@ -6,7 +6,7 @@ import { ModuleInfo } from '../types/module-info';
|
|
|
6
6
|
import { PluginContextData } from './plugin-context-data';
|
|
7
7
|
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
8
8
|
import { PartialNull } from '../types/utils';
|
|
9
|
-
import type { LogHandler, LogLevelOption } from '../
|
|
9
|
+
import type { LogHandler, LogLevelOption } from '../types/misc';
|
|
10
10
|
export interface EmittedAsset {
|
|
11
11
|
type: 'asset';
|
|
12
12
|
name?: string;
|
|
@@ -23,19 +23,23 @@ export interface PrivatePluginContextResolveOptions extends PluginContextResolve
|
|
|
23
23
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
24
24
|
}
|
|
25
25
|
export declare class PluginContext extends MinimalPluginContext {
|
|
26
|
-
|
|
26
|
+
private context;
|
|
27
|
+
private data;
|
|
28
|
+
private onLog;
|
|
29
|
+
private currentLoadingModule?;
|
|
30
|
+
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string | undefined);
|
|
31
|
+
load(options: {
|
|
27
32
|
id: string;
|
|
28
33
|
resolveDependencies?: boolean;
|
|
29
|
-
} & Partial<PartialNull<ModuleOptions>>)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
} & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
|
|
35
|
+
resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
|
|
36
|
+
emitFile(file: EmittedAsset): string;
|
|
37
|
+
getFileName(referenceId: string): string;
|
|
38
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
|
39
|
+
getModuleIds(): IterableIterator<string>;
|
|
40
|
+
addWatchFile(id: string): void;
|
|
36
41
|
/**
|
|
37
42
|
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
38
43
|
*/
|
|
39
|
-
|
|
40
|
-
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string);
|
|
44
|
+
parse(_input: string, _options?: any): any;
|
|
41
45
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { BindingPluginContext, BindingTransformPluginContext } from '../binding';
|
|
2
|
-
import type { LogHandler, LogLevelOption, RollupError } from '../
|
|
2
|
+
import type { LogHandler, LogLevelOption, RollupError } from '../types/misc';
|
|
3
3
|
import { PluginContext } from './plugin-context';
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
5
|
import type { Plugin } from './index';
|
|
6
6
|
import { SourceMap } from '../types/rolldown-output';
|
|
7
7
|
export declare class TransformPluginContext extends PluginContext {
|
|
8
|
-
|
|
8
|
+
private inner;
|
|
9
|
+
private moduleId;
|
|
10
|
+
private moduleSource;
|
|
11
|
+
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
|
|
12
|
+
error(e: RollupError | string, pos?: number | {
|
|
9
13
|
column: number;
|
|
10
14
|
line: number;
|
|
11
|
-
})
|
|
12
|
-
getCombinedSourcemap
|
|
13
|
-
constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
|
|
15
|
+
}): never;
|
|
16
|
+
getCombinedSourcemap(): SourceMap;
|
|
14
17
|
}
|
|
@@ -1,115 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}>, {
|
|
16
|
-
sideEffects: boolean;
|
|
17
|
-
external?: boolean | undefined;
|
|
18
|
-
test?: RegExp | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
sideEffects: boolean;
|
|
21
|
-
external?: boolean | undefined;
|
|
22
|
-
test?: RegExp | undefined;
|
|
23
|
-
}>;
|
|
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
|
+
import type Z from 'zod';
|
|
2
|
+
export interface ModuleSideEffectsRule {
|
|
3
|
+
test?: RegExp;
|
|
4
|
+
external?: boolean;
|
|
5
|
+
sideEffects: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const ModuleSideEffectsRuleSchema: Z.ZodType<ModuleSideEffectsRule>;
|
|
8
|
+
export type ModuleSideEffectsOption = boolean | ModuleSideEffectsRule[] | ((id: string, isResolved: boolean) => boolean | undefined) | 'no-external';
|
|
9
|
+
export declare const ModuleSideEffectsOptionSchema: Z.ZodType<ModuleSideEffectsOption>;
|
|
10
|
+
export type TreeshakingOptions = {
|
|
11
|
+
moduleSideEffects?: ModuleSideEffectsOption;
|
|
12
|
+
annotations?: boolean;
|
|
13
|
+
} | boolean;
|
|
14
|
+
export declare const TreeshakingOptionsSchema: Z.ZodType<TreeshakingOptions>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface RollupLog {
|
|
2
|
+
binding?: string;
|
|
3
|
+
cause?: unknown;
|
|
4
|
+
code?: string;
|
|
5
|
+
exporter?: string;
|
|
6
|
+
frame?: string;
|
|
7
|
+
hook?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
ids?: string[];
|
|
10
|
+
loc?: {
|
|
11
|
+
column: number;
|
|
12
|
+
file?: string;
|
|
13
|
+
line: number;
|
|
14
|
+
};
|
|
15
|
+
message: string;
|
|
16
|
+
meta?: any;
|
|
17
|
+
names?: string[];
|
|
18
|
+
plugin?: string;
|
|
19
|
+
pluginCode?: unknown;
|
|
20
|
+
pos?: number;
|
|
21
|
+
reexporter?: string;
|
|
22
|
+
stack?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RollupError extends RollupLog {
|
|
26
|
+
name?: string;
|
|
27
|
+
stack?: string;
|
|
28
|
+
watchFiles?: string[];
|
|
29
|
+
}
|
|
30
|
+
export type LogLevel = 'warn' | 'info' | 'debug';
|
|
31
|
+
export type LogLevelOption = LogLevel | 'silent';
|
|
32
|
+
export type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
|
|
33
|
+
export type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
|
|
34
|
+
column: number;
|
|
35
|
+
line: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
export type LogHandler = (level: LogLevel, log: RollupLog) => void;
|
|
38
|
+
export type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
39
|
+
export type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
40
|
+
export type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OutputAsset, OutputChunk } from './rolldown-output';
|
|
2
2
|
export interface OutputBundle {
|
|
3
|
-
[fileName: string]:
|
|
3
|
+
[fileName: string]: OutputAsset | OutputChunk;
|
|
4
4
|
}
|