@rolldown/browser 1.0.0-beta.8-commit.a98d94e → 1.0.0-beta.8-commit.baf6ca1
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/browser.mjs +343 -188
- package/dist/cli.cjs +8 -7
- package/dist/cli.mjs +4 -3
- package/dist/experimental-index.cjs +3 -2
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +3 -2
- package/dist/filter-index.cjs +12 -0
- package/dist/filter-index.d.cts +3 -0
- package/dist/filter-index.d.mts +3 -0
- package/dist/filter-index.mjs +4 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/parallel-plugin-worker.cjs +3 -2
- package/dist/parallel-plugin-worker.mjs +3 -2
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -0
- package/dist/rolldown-binding.wasi.cjs +1 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
- package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
- package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-9IzFBPMw.d.mts} +82 -23
- package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-BFt2wKBM.d.cts} +82 -23
- package/dist/shared/{src-D9guL4ht.mjs → src-DN1_B1_m.mjs} +1783 -1740
- package/dist/shared/{src-CJ9XODOK.cjs → src-glXqJCVJ.cjs} +260 -219
- package/package.json +1 -1
- /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
- /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
- /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
- /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/misc.ts
|
|
4
|
+
function arraify(value) {
|
|
5
|
+
return Array.isArray(value) ? value : [value];
|
|
6
|
+
}
|
|
7
|
+
function isNullish(value) {
|
|
8
|
+
return value === null || value === void 0;
|
|
9
|
+
}
|
|
10
|
+
function isPromiseLike(value) {
|
|
11
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
12
|
+
}
|
|
13
|
+
function unimplemented(info) {
|
|
14
|
+
if (info) throw new Error(`unimplemented: ${info}`);
|
|
15
|
+
throw new Error("unimplemented");
|
|
16
|
+
}
|
|
17
|
+
function unreachable(info) {
|
|
18
|
+
if (info) throw new Error(`unreachable: ${info}`);
|
|
19
|
+
throw new Error("unreachable");
|
|
20
|
+
}
|
|
21
|
+
function unsupported(info) {
|
|
22
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
23
|
+
}
|
|
24
|
+
function noop(..._args) {}
|
|
25
|
+
var init_misc = __esm({ "src/utils/misc.ts"() {} });
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/plugin/with-filter.ts
|
|
29
|
+
function withFilterImpl(pluginOption, filterObjectList) {
|
|
30
|
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
31
|
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
32
|
+
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
33
|
+
let plugin = pluginOption;
|
|
34
|
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
35
|
+
if (filterObjectIndex === -1) return plugin;
|
|
36
|
+
let filterObject = filterObjectList[filterObjectIndex];
|
|
37
|
+
Object.keys(plugin).forEach((key) => {
|
|
38
|
+
switch (key) {
|
|
39
|
+
case "transform":
|
|
40
|
+
case "resolveId":
|
|
41
|
+
case "load":
|
|
42
|
+
if (!plugin[key]) return;
|
|
43
|
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
44
|
+
else plugin[key] = {
|
|
45
|
+
handler: plugin[key],
|
|
46
|
+
filter: filterObject[key]
|
|
47
|
+
};
|
|
48
|
+
break;
|
|
49
|
+
default: break;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return plugin;
|
|
53
|
+
}
|
|
54
|
+
function withFilter(pluginOption, filterObject) {
|
|
55
|
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
56
|
+
}
|
|
57
|
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
58
|
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
59
|
+
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
60
|
+
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
61
|
+
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
62
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
63
|
+
}
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
|
|
67
|
+
init_misc();
|
|
68
|
+
} });
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/plugin/index.ts
|
|
72
|
+
var init_plugin = __esm({ "src/plugin/index.ts"() {
|
|
73
|
+
init_with_filter();
|
|
74
|
+
} });
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/filter-index.ts
|
|
78
|
+
function and(...args) {
|
|
79
|
+
return new And(...args);
|
|
80
|
+
}
|
|
81
|
+
function or(...args) {
|
|
82
|
+
return new Or(...args);
|
|
83
|
+
}
|
|
84
|
+
function not(expr) {
|
|
85
|
+
return new Not(expr);
|
|
86
|
+
}
|
|
87
|
+
function id(pattern) {
|
|
88
|
+
return new Id(pattern);
|
|
89
|
+
}
|
|
90
|
+
function moduleType(pattern) {
|
|
91
|
+
return new ModuleType(pattern);
|
|
92
|
+
}
|
|
93
|
+
function code(pattern) {
|
|
94
|
+
return new Code(pattern);
|
|
95
|
+
}
|
|
96
|
+
function include(expr) {
|
|
97
|
+
return new Include(expr);
|
|
98
|
+
}
|
|
99
|
+
function exclude(expr) {
|
|
100
|
+
return new Exclude(expr);
|
|
101
|
+
}
|
|
102
|
+
var And, Or, Not, Id, ModuleType, Code, Include, Exclude;
|
|
103
|
+
var init_filter_index = __esm({ "src/filter-index.ts"() {
|
|
104
|
+
init_plugin();
|
|
105
|
+
And = class {
|
|
106
|
+
kind;
|
|
107
|
+
args;
|
|
108
|
+
constructor(...args) {
|
|
109
|
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
110
|
+
this.args = args;
|
|
111
|
+
this.kind = "and";
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
Or = class {
|
|
115
|
+
kind;
|
|
116
|
+
args;
|
|
117
|
+
constructor(...args) {
|
|
118
|
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
119
|
+
this.args = args;
|
|
120
|
+
this.kind = "or";
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
Not = class {
|
|
124
|
+
kind;
|
|
125
|
+
expr;
|
|
126
|
+
constructor(expr) {
|
|
127
|
+
this.expr = expr;
|
|
128
|
+
this.kind = "not";
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
Id = class {
|
|
132
|
+
kind;
|
|
133
|
+
pattern;
|
|
134
|
+
constructor(pattern) {
|
|
135
|
+
this.pattern = pattern;
|
|
136
|
+
this.kind = "id";
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
ModuleType = class {
|
|
140
|
+
kind;
|
|
141
|
+
pattern;
|
|
142
|
+
constructor(pattern) {
|
|
143
|
+
this.pattern = pattern;
|
|
144
|
+
this.kind = "moduleType";
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
Code = class {
|
|
148
|
+
kind;
|
|
149
|
+
pattern;
|
|
150
|
+
constructor(expr) {
|
|
151
|
+
this.pattern = expr;
|
|
152
|
+
this.kind = "code";
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
Include = class {
|
|
156
|
+
kind;
|
|
157
|
+
expr;
|
|
158
|
+
constructor(expr) {
|
|
159
|
+
this.expr = expr;
|
|
160
|
+
this.kind = "include";
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
Exclude = class {
|
|
164
|
+
kind;
|
|
165
|
+
expr;
|
|
166
|
+
constructor(expr) {
|
|
167
|
+
this.expr = expr;
|
|
168
|
+
this.kind = "exclude";
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
} });
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
export { And, and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, not, or, unimplemented, unreachable, unsupported, withFilter };
|
|
@@ -5,12 +5,6 @@ import { Program } from "@oxc-project/types";
|
|
|
5
5
|
type LogLevel = "info" | "debug" | "warn";
|
|
6
6
|
type LogLevelOption = LogLevel | "silent";
|
|
7
7
|
type LogLevelWithError = LogLevel | "error";
|
|
8
|
-
type RollupLog$1 = any;
|
|
9
|
-
type RollupLogWithString = RollupLog$1 | string;
|
|
10
|
-
type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/types/misc.d.ts
|
|
14
8
|
interface RollupLog {
|
|
15
9
|
binding?: string;
|
|
16
10
|
cause?: unknown;
|
|
@@ -35,19 +29,18 @@ interface RollupLog {
|
|
|
35
29
|
stack?: string;
|
|
36
30
|
url?: string;
|
|
37
31
|
}
|
|
32
|
+
type RollupLogWithString = RollupLog | string;
|
|
38
33
|
interface RollupError extends RollupLog {
|
|
39
34
|
name?: string;
|
|
40
35
|
stack?: string;
|
|
41
36
|
watchFiles?: string[];
|
|
42
37
|
}
|
|
43
|
-
type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}) => void;
|
|
38
|
+
type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/misc.d.ts
|
|
48
42
|
type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
49
43
|
type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
50
|
-
type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
51
44
|
|
|
52
45
|
//#endregion
|
|
53
46
|
//#region src/utils/asset-source.d.ts
|
|
@@ -372,6 +365,15 @@ type RolldownWatcher = WatcherEmitter;
|
|
|
372
365
|
//#region src/api/watch/index.d.ts
|
|
373
366
|
declare const watch: (input: WatchOptions$1 | WatchOptions$1[]) => RolldownWatcher;
|
|
374
367
|
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/log/log-handler.d.ts
|
|
370
|
+
type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
|
|
371
|
+
type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
|
|
372
|
+
column: number
|
|
373
|
+
line: number
|
|
374
|
+
}) => void;
|
|
375
|
+
type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
376
|
+
|
|
375
377
|
//#endregion
|
|
376
378
|
//#region src/options/normalized-input-options.d.ts
|
|
377
379
|
interface NormalizedInputOptions {
|
|
@@ -415,9 +417,63 @@ interface NormalizedOutputOptions {
|
|
|
415
417
|
plugins: RolldownPlugin[];
|
|
416
418
|
}
|
|
417
419
|
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
|
+
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
|
+
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
|
+
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
|
+
declare class And {
|
|
426
|
+
kind: "and";
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
429
|
+
}
|
|
430
|
+
declare class Or {
|
|
431
|
+
kind: "or";
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
434
|
+
}
|
|
435
|
+
declare class Not {
|
|
436
|
+
kind: "not";
|
|
437
|
+
expr: FilterExpression;
|
|
438
|
+
constructor(expr: FilterExpression);
|
|
439
|
+
}
|
|
440
|
+
declare class Id {
|
|
441
|
+
kind: "id";
|
|
442
|
+
pattern: StringOrRegExp;
|
|
443
|
+
constructor(pattern: StringOrRegExp);
|
|
444
|
+
}
|
|
445
|
+
declare class ModuleType$1 {
|
|
446
|
+
kind: "moduleType";
|
|
447
|
+
pattern: ModuleType;
|
|
448
|
+
constructor(pattern: ModuleType);
|
|
449
|
+
}
|
|
450
|
+
declare class Code {
|
|
451
|
+
kind: "code";
|
|
452
|
+
pattern: StringOrRegExp;
|
|
453
|
+
constructor(expr: StringOrRegExp);
|
|
454
|
+
}
|
|
455
|
+
declare class Include {
|
|
456
|
+
kind: "include";
|
|
457
|
+
expr: FilterExpression;
|
|
458
|
+
constructor(expr: FilterExpression);
|
|
459
|
+
}
|
|
460
|
+
declare class Exclude$1 {
|
|
461
|
+
kind: "exclude";
|
|
462
|
+
expr: FilterExpression;
|
|
463
|
+
constructor(expr: FilterExpression);
|
|
464
|
+
}
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
467
|
+
declare function not(expr: FilterExpression): Not;
|
|
468
|
+
declare function id(pattern: StringOrRegExp): Id;
|
|
469
|
+
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
470
|
+
declare function code(pattern: StringOrRegExp): Code;
|
|
471
|
+
declare function include(expr: FilterExpression): Include;
|
|
472
|
+
declare function exclude(expr: FilterExpression): Exclude$1;
|
|
473
|
+
|
|
418
474
|
//#endregion
|
|
419
475
|
//#region src/plugin/hook-filter.d.ts
|
|
420
|
-
type
|
|
476
|
+
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
421
477
|
include?: MaybeArray<Value>
|
|
422
478
|
exclude?: MaybeArray<Value>
|
|
423
479
|
};
|
|
@@ -458,10 +514,11 @@ interface HookFilter {
|
|
|
458
514
|
* }}
|
|
459
515
|
* ```
|
|
460
516
|
*/
|
|
461
|
-
id?:
|
|
517
|
+
id?: GeneralHookFilter;
|
|
462
518
|
moduleType?: ModuleTypeFilter;
|
|
463
|
-
code?:
|
|
519
|
+
code?: GeneralHookFilter;
|
|
464
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
465
522
|
|
|
466
523
|
//#endregion
|
|
467
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -800,13 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
800
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
801
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
802
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
803
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
804
861
|
} : K extends "load" ? {
|
|
805
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
806
863
|
} : K extends "resolveId" ? {
|
|
807
|
-
filter?: {
|
|
808
|
-
id?:
|
|
809
|
-
}
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
865
|
+
id?: GeneralHookFilter<RegExp>
|
|
866
|
+
}>
|
|
867
|
+
} : K extends "renderChunk" ? {
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
810
869
|
} : {};
|
|
811
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
812
871
|
/**
|
|
@@ -961,8 +1020,8 @@ interface InputOptions {
|
|
|
961
1020
|
shimMissingExports?: boolean;
|
|
962
1021
|
treeshake?: boolean | TreeshakingOptions;
|
|
963
1022
|
logLevel?: LogLevelOption;
|
|
964
|
-
onLog?: (level: LogLevel, log: RollupLog
|
|
965
|
-
onwarn?: (warning: RollupLog
|
|
1023
|
+
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
|
|
1024
|
+
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
|
|
966
1025
|
moduleTypes?: ModuleTypes;
|
|
967
1026
|
experimental?: {
|
|
968
1027
|
enableComposingJsPlugins?: boolean
|
|
@@ -1065,4 +1124,4 @@ interface InputOptions {
|
|
|
1065
1124
|
}
|
|
1066
1125
|
|
|
1067
1126
|
//#endregion
|
|
1068
|
-
export { AddonFunction, AsyncPluginHooks, BuildOptions, BuiltinPlugin as BuiltinPlugin$1, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog
|
|
1127
|
+
export { AddonFunction, And as And$1, AsyncPluginHooks, BuildOptions, BuiltinPlugin as BuiltinPlugin$1, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FilterExpression, FilterExpressionKind, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TopLevelFilterExpression, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION as VERSION$1, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, and as and$1, build as build$1, buildImportAnalysisPlugin as buildImportAnalysisPlugin$1, code as code$1, defineConfig as defineConfig$1, defineParallelPlugin, dynamicImportVarsPlugin as dynamicImportVarsPlugin$1, exclude as exclude$1, id as id$1, importGlobPlugin as importGlobPlugin$1, include as include$1, isolatedDeclarationPlugin as isolatedDeclarationPlugin$1, jsonPlugin as jsonPlugin$1, loadFallbackPlugin as loadFallbackPlugin$1, manifestPlugin as manifestPlugin$1, moduleFederationPlugin as moduleFederationPlugin$1, modulePreloadPolyfillPlugin as modulePreloadPolyfillPlugin$1, moduleType as moduleType$1, not as not$1, or as or$1, reportPlugin as reportPlugin$1, rolldown as rolldown$1, viteResolvePlugin as viteResolvePlugin$1, wasmFallbackPlugin as wasmFallbackPlugin$1, wasmHelperPlugin as wasmHelperPlugin$1, watch as watch$1, withFilter as withFilter$1 };
|
|
@@ -5,12 +5,6 @@ import { Program } from "@oxc-project/types";
|
|
|
5
5
|
type LogLevel = "info" | "debug" | "warn";
|
|
6
6
|
type LogLevelOption = LogLevel | "silent";
|
|
7
7
|
type LogLevelWithError = LogLevel | "error";
|
|
8
|
-
type RollupLog$1 = any;
|
|
9
|
-
type RollupLogWithString = RollupLog$1 | string;
|
|
10
|
-
type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/types/misc.d.ts
|
|
14
8
|
interface RollupLog {
|
|
15
9
|
binding?: string;
|
|
16
10
|
cause?: unknown;
|
|
@@ -35,19 +29,18 @@ interface RollupLog {
|
|
|
35
29
|
stack?: string;
|
|
36
30
|
url?: string;
|
|
37
31
|
}
|
|
32
|
+
type RollupLogWithString = RollupLog | string;
|
|
38
33
|
interface RollupError extends RollupLog {
|
|
39
34
|
name?: string;
|
|
40
35
|
stack?: string;
|
|
41
36
|
watchFiles?: string[];
|
|
42
37
|
}
|
|
43
|
-
type
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}) => void;
|
|
38
|
+
type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/misc.d.ts
|
|
48
42
|
type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
|
|
49
43
|
type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
50
|
-
type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
51
44
|
|
|
52
45
|
//#endregion
|
|
53
46
|
//#region src/utils/asset-source.d.ts
|
|
@@ -372,6 +365,15 @@ type RolldownWatcher = WatcherEmitter;
|
|
|
372
365
|
//#region src/api/watch/index.d.ts
|
|
373
366
|
declare const watch: (input: WatchOptions$1 | WatchOptions$1[]) => RolldownWatcher;
|
|
374
367
|
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/log/log-handler.d.ts
|
|
370
|
+
type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
|
|
371
|
+
type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
|
|
372
|
+
column: number
|
|
373
|
+
line: number
|
|
374
|
+
}) => void;
|
|
375
|
+
type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
|
|
376
|
+
|
|
375
377
|
//#endregion
|
|
376
378
|
//#region src/options/normalized-input-options.d.ts
|
|
377
379
|
interface NormalizedInputOptions {
|
|
@@ -415,9 +417,63 @@ interface NormalizedOutputOptions {
|
|
|
415
417
|
plugins: RolldownPlugin[];
|
|
416
418
|
}
|
|
417
419
|
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
|
+
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
|
+
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
|
+
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
|
+
declare class And {
|
|
426
|
+
kind: "and";
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
429
|
+
}
|
|
430
|
+
declare class Or {
|
|
431
|
+
kind: "or";
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
434
|
+
}
|
|
435
|
+
declare class Not {
|
|
436
|
+
kind: "not";
|
|
437
|
+
expr: FilterExpression;
|
|
438
|
+
constructor(expr: FilterExpression);
|
|
439
|
+
}
|
|
440
|
+
declare class Id {
|
|
441
|
+
kind: "id";
|
|
442
|
+
pattern: StringOrRegExp;
|
|
443
|
+
constructor(pattern: StringOrRegExp);
|
|
444
|
+
}
|
|
445
|
+
declare class ModuleType$1 {
|
|
446
|
+
kind: "moduleType";
|
|
447
|
+
pattern: ModuleType;
|
|
448
|
+
constructor(pattern: ModuleType);
|
|
449
|
+
}
|
|
450
|
+
declare class Code {
|
|
451
|
+
kind: "code";
|
|
452
|
+
pattern: StringOrRegExp;
|
|
453
|
+
constructor(expr: StringOrRegExp);
|
|
454
|
+
}
|
|
455
|
+
declare class Include {
|
|
456
|
+
kind: "include";
|
|
457
|
+
expr: FilterExpression;
|
|
458
|
+
constructor(expr: FilterExpression);
|
|
459
|
+
}
|
|
460
|
+
declare class Exclude$1 {
|
|
461
|
+
kind: "exclude";
|
|
462
|
+
expr: FilterExpression;
|
|
463
|
+
constructor(expr: FilterExpression);
|
|
464
|
+
}
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
467
|
+
declare function not(expr: FilterExpression): Not;
|
|
468
|
+
declare function id(pattern: StringOrRegExp): Id;
|
|
469
|
+
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
470
|
+
declare function code(pattern: StringOrRegExp): Code;
|
|
471
|
+
declare function include(expr: FilterExpression): Include;
|
|
472
|
+
declare function exclude(expr: FilterExpression): Exclude$1;
|
|
473
|
+
|
|
418
474
|
//#endregion
|
|
419
475
|
//#region src/plugin/hook-filter.d.ts
|
|
420
|
-
type
|
|
476
|
+
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
421
477
|
include?: MaybeArray<Value>
|
|
422
478
|
exclude?: MaybeArray<Value>
|
|
423
479
|
};
|
|
@@ -458,10 +514,11 @@ interface HookFilter {
|
|
|
458
514
|
* }}
|
|
459
515
|
* ```
|
|
460
516
|
*/
|
|
461
|
-
id?:
|
|
517
|
+
id?: GeneralHookFilter;
|
|
462
518
|
moduleType?: ModuleTypeFilter;
|
|
463
|
-
code?:
|
|
519
|
+
code?: GeneralHookFilter;
|
|
464
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
465
522
|
|
|
466
523
|
//#endregion
|
|
467
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -800,13 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
800
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
801
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
802
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
803
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
804
861
|
} : K extends "load" ? {
|
|
805
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
806
863
|
} : K extends "resolveId" ? {
|
|
807
|
-
filter?: {
|
|
808
|
-
id?:
|
|
809
|
-
}
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
865
|
+
id?: GeneralHookFilter<RegExp>
|
|
866
|
+
}>
|
|
867
|
+
} : K extends "renderChunk" ? {
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
810
869
|
} : {};
|
|
811
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
812
871
|
/**
|
|
@@ -961,8 +1020,8 @@ interface InputOptions {
|
|
|
961
1020
|
shimMissingExports?: boolean;
|
|
962
1021
|
treeshake?: boolean | TreeshakingOptions;
|
|
963
1022
|
logLevel?: LogLevelOption;
|
|
964
|
-
onLog?: (level: LogLevel, log: RollupLog
|
|
965
|
-
onwarn?: (warning: RollupLog
|
|
1023
|
+
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
|
|
1024
|
+
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
|
|
966
1025
|
moduleTypes?: ModuleTypes;
|
|
967
1026
|
experimental?: {
|
|
968
1027
|
enableComposingJsPlugins?: boolean
|
|
@@ -1065,4 +1124,4 @@ interface InputOptions {
|
|
|
1065
1124
|
}
|
|
1066
1125
|
|
|
1067
1126
|
//#endregion
|
|
1068
|
-
export { AddonFunction, AsyncPluginHooks, BuildOptions, BuiltinPlugin, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog
|
|
1127
|
+
export { AddonFunction, And, AsyncPluginHooks, BuildOptions, BuiltinPlugin, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FilterExpression, FilterExpressionKind, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TopLevelFilterExpression, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, and, build, buildImportAnalysisPlugin, code, defineConfig, defineParallelPlugin, dynamicImportVarsPlugin, exclude, id, importGlobPlugin, include, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleType, not, or, reportPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, withFilter };
|