rolldown 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.
Files changed (33) hide show
  1. package/dist/cli.cjs +8 -7
  2. package/dist/cli.mjs +4 -3
  3. package/dist/experimental-index.cjs +3 -2
  4. package/dist/experimental-index.d.cts +1 -1
  5. package/dist/experimental-index.d.mts +2 -2
  6. package/dist/experimental-index.mjs +3 -2
  7. package/dist/filter-index.cjs +12 -0
  8. package/dist/filter-index.d.cts +4 -0
  9. package/dist/filter-index.d.mts +4 -0
  10. package/dist/filter-index.mjs +4 -0
  11. package/dist/index.cjs +4 -4
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.mts +3 -3
  14. package/dist/index.mjs +4 -3
  15. package/dist/parallel-plugin-worker.cjs +3 -2
  16. package/dist/parallel-plugin-worker.mjs +3 -2
  17. package/dist/parallel-plugin.d.cts +1 -1
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/shared/filter-index-DblXSw9s.cjs +255 -0
  23. package/dist/shared/filter-index-hnEzlqRW.mjs +174 -0
  24. package/dist/shared/{input-options.d-DW_DouH4.d.cts → input-options.d-C7BRiiq8.d.cts} +82 -23
  25. package/dist/shared/{input-options.d-BS41m-u8.d.mts → input-options.d-CN3-qk1U.d.mts} +83 -24
  26. package/dist/shared/{parse-ast-index-BU0vRbCC.cjs → parse-ast-index-Bbz37LOL.cjs} +1 -0
  27. package/dist/shared/{parse-ast-index-C5zEG9SJ.mjs → parse-ast-index-D0SmlXT6.mjs} +1 -0
  28. package/dist/shared/{src-IKFm0rpN.mjs → src-gyFaNJxP.mjs} +1783 -1740
  29. package/dist/shared/{src-Bv1wl15e.cjs → src-kB4wOq3x.cjs} +260 -219
  30. package/package.json +19 -15
  31. /package/dist/shared/{binding.d-N_CFNfq2.d.mts → binding.d-BaNmLM9c.d.mts} +0 -0
  32. /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
  33. /package/dist/shared/{prompt-V-Wm9PcC.mjs → prompt-UMUDMApt.mjs} +0 -0
@@ -0,0 +1,174 @@
1
+ import { __esm } from "./chunk-DUYDk_2O.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 LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
44
- type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
45
- column: number
46
- line: number
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 StringFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
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?: StringFilter;
517
+ id?: GeneralHookFilter;
462
518
  moduleType?: ModuleTypeFilter;
463
- code?: StringFilter;
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?: StringFilter<RegExp>
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$1, defaultHandler: LogOrStringHandler) => void;
965
- onwarn?: (warning: RollupLog$1, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
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, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog$1 as RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, StringFilter, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, build, buildImportAnalysisPlugin, defineConfig, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, reportPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, withFilter };
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, 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 };
@@ -1,16 +1,10 @@
1
- import { BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingDynamicImportVarsPluginConfig, BindingGlobImportPluginConfig, BindingHmrOutput, BindingHookResolveIdExtraArgs, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReportPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding.d-N_CFNfq2.mjs";
1
+ import { BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingDynamicImportVarsPluginConfig, BindingGlobImportPluginConfig, BindingHmrOutput, BindingHookResolveIdExtraArgs, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReportPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding.d-BaNmLM9c.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/log/logging.d.ts
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 LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
44
- type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
45
- column: number
46
- line: number
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 StringFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
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?: StringFilter;
517
+ id?: GeneralHookFilter;
462
518
  moduleType?: ModuleTypeFilter;
463
- code?: StringFilter;
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?: StringFilter<RegExp>
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$1, defaultHandler: LogOrStringHandler) => void;
965
- onwarn?: (warning: RollupLog$1, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
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, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog$1 as RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, StringFilter, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION as VERSION$1, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, build as build$1, buildImportAnalysisPlugin as buildImportAnalysisPlugin$1, defineConfig as defineConfig$1, defineParallelPlugin, dynamicImportVarsPlugin as dynamicImportVarsPlugin$1, importGlobPlugin as importGlobPlugin$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, 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 };
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, 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 };
@@ -353,6 +353,7 @@ var require_binding = require_chunk.__commonJS({ "src/binding.js"(exports, modul
353
353
  module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
354
354
  module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
355
355
  module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
356
+ module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
356
357
  module.exports.getBufferOffset = nativeBinding.getBufferOffset;
357
358
  module.exports.HelperMode = nativeBinding.HelperMode;
358
359
  module.exports.ImportNameKind = nativeBinding.ImportNameKind;
@@ -353,6 +353,7 @@ var require_binding = __commonJS({ "src/binding.js"(exports, module) {
353
353
  module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
354
354
  module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
355
355
  module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
356
+ module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
356
357
  module.exports.getBufferOffset = nativeBinding.getBufferOffset;
357
358
  module.exports.HelperMode = nativeBinding.HelperMode;
358
359
  module.exports.ImportNameKind = nativeBinding.ImportNameKind;