rolldown 1.0.0-beta.8-commit.852c603 → 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/cli.cjs +6 -6
- package/dist/cli.mjs +2 -2
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +2 -2
- package/dist/filter-index.cjs +12 -0
- package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +2 -2
- package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +2 -2
- package/dist/filter-index.mjs +4 -0
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/shared/filter-index-DblXSw9s.cjs +255 -0
- package/dist/shared/filter-index-hnEzlqRW.mjs +174 -0
- package/dist/shared/{input-options.d-BHwth6VM.d.cts → input-options.d-C7BRiiq8.d.cts} +13 -16
- package/dist/shared/{input-options.d-CN-JV5dt.d.mts → input-options.d-CN3-qk1U.d.mts} +13 -16
- package/dist/shared/{src-CaxK4-gB.mjs → src-gyFaNJxP.mjs} +52 -125
- package/dist/shared/{src-B4f_CmD8.cjs → src-kB4wOq3x.cjs} +63 -137
- package/package.json +18 -18
- package/dist/filter-expression-index.cjs +0 -11
- package/dist/filter-expression-index.mjs +0 -4
- package/dist/shared/filter-expression-index-BKmgnKlV.mjs +0 -69
- package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
|
@@ -418,21 +418,19 @@ interface NormalizedOutputOptions {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
//#endregion
|
|
421
|
-
//#region src/filter-
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
422
|
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
423
|
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
424
|
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
425
|
declare class And {
|
|
426
426
|
kind: "and";
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
430
429
|
}
|
|
431
430
|
declare class Or {
|
|
432
431
|
kind: "or";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
436
434
|
}
|
|
437
435
|
declare class Not {
|
|
438
436
|
kind: "not";
|
|
@@ -464,8 +462,8 @@ declare class Exclude$1 {
|
|
|
464
462
|
expr: FilterExpression;
|
|
465
463
|
constructor(expr: FilterExpression);
|
|
466
464
|
}
|
|
467
|
-
declare function and(
|
|
468
|
-
declare function or(
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
469
467
|
declare function not(expr: FilterExpression): Not;
|
|
470
468
|
declare function id(pattern: StringOrRegExp): Id;
|
|
471
469
|
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
@@ -478,7 +476,6 @@ declare function exclude(expr: FilterExpression): Exclude$1;
|
|
|
478
476
|
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
479
477
|
include?: MaybeArray<Value>
|
|
480
478
|
exclude?: MaybeArray<Value>
|
|
481
|
-
custom?: TopLevelFilterExpression[]
|
|
482
479
|
};
|
|
483
480
|
interface FormalModuleTypeFilter {
|
|
484
481
|
include?: ModuleType[];
|
|
@@ -520,8 +517,8 @@ interface HookFilter {
|
|
|
520
517
|
id?: GeneralHookFilter;
|
|
521
518
|
moduleType?: ModuleTypeFilter;
|
|
522
519
|
code?: GeneralHookFilter;
|
|
523
|
-
custom?: TopLevelFilterExpression[];
|
|
524
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
525
522
|
|
|
526
523
|
//#endregion
|
|
527
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -860,15 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
860
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
861
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
862
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
863
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
864
861
|
} : K extends "load" ? {
|
|
865
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
866
863
|
} : K extends "resolveId" ? {
|
|
867
|
-
filter?: {
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
868
865
|
id?: GeneralHookFilter<RegExp>
|
|
869
|
-
}
|
|
866
|
+
}>
|
|
870
867
|
} : K extends "renderChunk" ? {
|
|
871
|
-
filter?: Pick<HookFilter, "code"
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
872
869
|
} : {};
|
|
873
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
874
871
|
/**
|
|
@@ -418,21 +418,19 @@ interface NormalizedOutputOptions {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
//#endregion
|
|
421
|
-
//#region src/filter-
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
422
|
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
423
|
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
424
|
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
425
|
declare class And {
|
|
426
426
|
kind: "and";
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
430
429
|
}
|
|
431
430
|
declare class Or {
|
|
432
431
|
kind: "or";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
436
434
|
}
|
|
437
435
|
declare class Not {
|
|
438
436
|
kind: "not";
|
|
@@ -464,8 +462,8 @@ declare class Exclude$1 {
|
|
|
464
462
|
expr: FilterExpression;
|
|
465
463
|
constructor(expr: FilterExpression);
|
|
466
464
|
}
|
|
467
|
-
declare function and(
|
|
468
|
-
declare function or(
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
469
467
|
declare function not(expr: FilterExpression): Not;
|
|
470
468
|
declare function id(pattern: StringOrRegExp): Id;
|
|
471
469
|
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
@@ -478,7 +476,6 @@ declare function exclude(expr: FilterExpression): Exclude$1;
|
|
|
478
476
|
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
479
477
|
include?: MaybeArray<Value>
|
|
480
478
|
exclude?: MaybeArray<Value>
|
|
481
|
-
custom?: TopLevelFilterExpression[]
|
|
482
479
|
};
|
|
483
480
|
interface FormalModuleTypeFilter {
|
|
484
481
|
include?: ModuleType[];
|
|
@@ -520,8 +517,8 @@ interface HookFilter {
|
|
|
520
517
|
id?: GeneralHookFilter;
|
|
521
518
|
moduleType?: ModuleTypeFilter;
|
|
522
519
|
code?: GeneralHookFilter;
|
|
523
|
-
custom?: TopLevelFilterExpression[];
|
|
524
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
525
522
|
|
|
526
523
|
//#endregion
|
|
527
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -860,15 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
860
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
861
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
862
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
863
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
864
861
|
} : K extends "load" ? {
|
|
865
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
866
863
|
} : K extends "resolveId" ? {
|
|
867
|
-
filter?: {
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
868
865
|
id?: GeneralHookFilter<RegExp>
|
|
869
|
-
}
|
|
866
|
+
}>
|
|
870
867
|
} : K extends "renderChunk" ? {
|
|
871
|
-
filter?: Pick<HookFilter, "code"
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
872
869
|
} : {};
|
|
873
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
874
871
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esm } from "./chunk-DUYDk_2O.mjs";
|
|
2
2
|
import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-D0SmlXT6.mjs";
|
|
3
|
-
import { and, code, exclude, id, include,
|
|
3
|
+
import { and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./filter-index-hnEzlqRW.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
6
6
|
import colors from "ansis";
|
|
@@ -9,7 +9,7 @@ import { availableParallelism } from "node:os";
|
|
|
9
9
|
import { Worker } from "node:worker_threads";
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.8-commit.
|
|
12
|
+
var version = "1.0.0-beta.8-commit.baf6ca1";
|
|
13
13
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
@@ -101,31 +101,6 @@ var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
|
|
|
101
101
|
};
|
|
102
102
|
} });
|
|
103
103
|
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region src/utils/misc.ts
|
|
106
|
-
function arraify(value) {
|
|
107
|
-
return Array.isArray(value) ? value : [value];
|
|
108
|
-
}
|
|
109
|
-
function isNullish(value) {
|
|
110
|
-
return value === null || value === void 0;
|
|
111
|
-
}
|
|
112
|
-
function isPromiseLike(value) {
|
|
113
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
114
|
-
}
|
|
115
|
-
function unimplemented(info) {
|
|
116
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
117
|
-
throw new Error("unimplemented");
|
|
118
|
-
}
|
|
119
|
-
function unreachable(info) {
|
|
120
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
121
|
-
throw new Error("unreachable");
|
|
122
|
-
}
|
|
123
|
-
function unsupported(info) {
|
|
124
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
125
|
-
}
|
|
126
|
-
function noop(..._args) {}
|
|
127
|
-
var init_misc = __esm({ "src/utils/misc.ts"() {} });
|
|
128
|
-
|
|
129
104
|
//#endregion
|
|
130
105
|
//#region src/log/logging.ts
|
|
131
106
|
var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
|
|
@@ -273,7 +248,7 @@ var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
|
|
|
273
248
|
//#endregion
|
|
274
249
|
//#region src/constants/plugin.ts
|
|
275
250
|
var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
|
|
276
|
-
var init_plugin$
|
|
251
|
+
var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
|
|
277
252
|
ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
278
253
|
"options",
|
|
279
254
|
"buildStart",
|
|
@@ -362,7 +337,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
362
337
|
var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX;
|
|
363
338
|
var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
|
|
364
339
|
init_constructors();
|
|
365
|
-
init_plugin$
|
|
340
|
+
init_plugin$1();
|
|
366
341
|
init_logging();
|
|
367
342
|
init_logs();
|
|
368
343
|
init_async_flatten();
|
|
@@ -2236,7 +2211,6 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
|
|
|
2236
2211
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2237
2212
|
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
|
|
2238
2213
|
if (Array.isArray(matcher)) return matcher.map((m$10) => include(id(m$10)));
|
|
2239
|
-
if (matcher.custom) return matcher.custom;
|
|
2240
2214
|
let ret = [];
|
|
2241
2215
|
let isCode = stringKind === "code";
|
|
2242
2216
|
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(isCode ? code(m$10) : id(m$10))));
|
|
@@ -2245,8 +2219,8 @@ function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
|
2245
2219
|
}
|
|
2246
2220
|
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2247
2221
|
if (!filterOption) return void 0;
|
|
2248
|
-
|
|
2249
|
-
|
|
2222
|
+
if (Array.isArray(filterOption)) return filterOption;
|
|
2223
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2250
2224
|
let ret = [];
|
|
2251
2225
|
let idIncludes = [];
|
|
2252
2226
|
let idExcludes = [];
|
|
@@ -2256,33 +2230,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
2256
2230
|
if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
|
|
2257
2231
|
ret.push(...idExcludes);
|
|
2258
2232
|
ret.push(...codeExcludes);
|
|
2259
|
-
let
|
|
2233
|
+
let andExprList = [];
|
|
2260
2234
|
if (moduleType$1) {
|
|
2261
2235
|
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
2262
|
-
|
|
2263
|
-
}
|
|
2264
|
-
if (idIncludes.length) {
|
|
2265
|
-
let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
|
|
2266
|
-
if (!cursor) cursor = joinedOrExpr;
|
|
2267
|
-
else cursor = and(cursor, joinedOrExpr);
|
|
2268
|
-
}
|
|
2269
|
-
if (codeIncludes.length) {
|
|
2270
|
-
let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
|
|
2271
|
-
if (!cursor) cursor = joinedOrExpr;
|
|
2272
|
-
else cursor = and(cursor, joinedOrExpr);
|
|
2236
|
+
andExprList.push(or(...moduleTypes.map((m$10) => moduleType(m$10))));
|
|
2273
2237
|
}
|
|
2274
|
-
if (
|
|
2238
|
+
if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
|
|
2239
|
+
if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
|
|
2240
|
+
if (andExprList.length) ret.push(include(and(...andExprList)));
|
|
2275
2241
|
return ret;
|
|
2276
2242
|
}
|
|
2277
|
-
function
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
|
|
2283
|
-
let custom = [];
|
|
2284
|
-
if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
|
|
2285
|
-
return { custom: custom.length > 0 ? custom : void 0 };
|
|
2243
|
+
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
|
2244
|
+
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
|
2245
|
+
let ret = [];
|
|
2246
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2247
|
+
return ret.length > 0 ? { value: ret } : void 0;
|
|
2286
2248
|
}
|
|
2287
2249
|
function bindingifyFilterExpr(expr) {
|
|
2288
2250
|
let list = [];
|
|
@@ -2292,9 +2254,21 @@ function bindingifyFilterExpr(expr) {
|
|
|
2292
2254
|
function bindingifyFilterExprImpl(expr, list) {
|
|
2293
2255
|
switch (expr.kind) {
|
|
2294
2256
|
case "and": {
|
|
2295
|
-
|
|
2296
|
-
bindingifyFilterExprImpl(
|
|
2297
|
-
list.push({
|
|
2257
|
+
let args = expr.args;
|
|
2258
|
+
for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
|
|
2259
|
+
list.push({
|
|
2260
|
+
kind: "And",
|
|
2261
|
+
payload: args.length
|
|
2262
|
+
});
|
|
2263
|
+
break;
|
|
2264
|
+
}
|
|
2265
|
+
case "or": {
|
|
2266
|
+
let args = expr.args;
|
|
2267
|
+
for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
|
|
2268
|
+
list.push({
|
|
2269
|
+
kind: "Or",
|
|
2270
|
+
payload: args.length
|
|
2271
|
+
});
|
|
2298
2272
|
break;
|
|
2299
2273
|
}
|
|
2300
2274
|
case "not": {
|
|
@@ -2305,21 +2279,21 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2305
2279
|
case "id": {
|
|
2306
2280
|
list.push({
|
|
2307
2281
|
kind: "Id",
|
|
2308
|
-
|
|
2282
|
+
payload: expr.pattern
|
|
2309
2283
|
});
|
|
2310
2284
|
break;
|
|
2311
2285
|
}
|
|
2312
2286
|
case "moduleType": {
|
|
2313
2287
|
list.push({
|
|
2314
2288
|
kind: "ModuleType",
|
|
2315
|
-
|
|
2289
|
+
payload: expr.pattern
|
|
2316
2290
|
});
|
|
2317
2291
|
break;
|
|
2318
2292
|
}
|
|
2319
2293
|
case "code": {
|
|
2320
2294
|
list.push({
|
|
2321
2295
|
kind: "Code",
|
|
2322
|
-
|
|
2296
|
+
payload: expr.pattern
|
|
2323
2297
|
});
|
|
2324
2298
|
break;
|
|
2325
2299
|
}
|
|
@@ -2333,31 +2307,34 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2333
2307
|
list.push({ kind: "Exclude" });
|
|
2334
2308
|
break;
|
|
2335
2309
|
}
|
|
2336
|
-
default: throw new Error(`Unknown filter expression
|
|
2310
|
+
default: throw new Error(`Unknown filter expression: ${expr}`);
|
|
2337
2311
|
}
|
|
2338
2312
|
}
|
|
2339
2313
|
function bindingifyResolveIdFilter(filterOption) {
|
|
2340
|
-
|
|
2314
|
+
if (!filterOption) return void 0;
|
|
2315
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2316
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2341
2317
|
}
|
|
2342
2318
|
function bindingifyLoadFilter(filterOption) {
|
|
2343
|
-
|
|
2319
|
+
if (!filterOption) return void 0;
|
|
2320
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2321
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2344
2322
|
}
|
|
2345
2323
|
function bindingifyTransformFilter(filterOption) {
|
|
2346
2324
|
if (!filterOption) return void 0;
|
|
2347
|
-
let
|
|
2325
|
+
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
2348
2326
|
let ret = [];
|
|
2349
|
-
if (
|
|
2350
|
-
return {
|
|
2327
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2328
|
+
return { value: ret.length > 0 ? ret : void 0 };
|
|
2351
2329
|
}
|
|
2352
2330
|
function bindingifyRenderChunkFilter(filterOption) {
|
|
2353
|
-
if (filterOption)
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
}
|
|
2331
|
+
if (!filterOption) return void 0;
|
|
2332
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2333
|
+
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2357
2334
|
}
|
|
2358
2335
|
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2359
2336
|
init_dist();
|
|
2360
|
-
|
|
2337
|
+
init_filter_index();
|
|
2361
2338
|
init_misc();
|
|
2362
2339
|
} });
|
|
2363
2340
|
|
|
@@ -3804,8 +3781,8 @@ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.
|
|
|
3804
3781
|
//#endregion
|
|
3805
3782
|
//#region src/utils/plugin/index.ts
|
|
3806
3783
|
var isPluginHookName;
|
|
3807
|
-
var init_plugin
|
|
3808
|
-
init_plugin$
|
|
3784
|
+
var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
|
|
3785
|
+
init_plugin$1();
|
|
3809
3786
|
isPluginHookName = function() {
|
|
3810
3787
|
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
3811
3788
|
return function isPluginHookName$1(hookName) {
|
|
@@ -4115,7 +4092,7 @@ var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
|
4115
4092
|
init_plugin_context$1();
|
|
4116
4093
|
init_misc();
|
|
4117
4094
|
init_normalize_hook();
|
|
4118
|
-
init_plugin
|
|
4095
|
+
init_plugin();
|
|
4119
4096
|
unsupportedHookName = [
|
|
4120
4097
|
"augmentChunkHash",
|
|
4121
4098
|
"generateBundle",
|
|
@@ -4474,55 +4451,6 @@ var init_watch = __esm({ "src/api/watch/index.ts"() {
|
|
|
4474
4451
|
};
|
|
4475
4452
|
} });
|
|
4476
4453
|
|
|
4477
|
-
//#endregion
|
|
4478
|
-
//#region src/plugin/with-filter.ts
|
|
4479
|
-
function withFilterImpl(pluginOption, filterObjectList) {
|
|
4480
|
-
if (isPromiseLike(pluginOption)) return pluginOption.then((p$3) => withFilter(p$3, filterObjectList));
|
|
4481
|
-
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
4482
|
-
if (Array.isArray(pluginOption)) return pluginOption.map((p$3) => withFilter(p$3, filterObjectList));
|
|
4483
|
-
let plugin = pluginOption;
|
|
4484
|
-
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
4485
|
-
if (filterObjectIndex === -1) return plugin;
|
|
4486
|
-
let filterObject = filterObjectList[filterObjectIndex];
|
|
4487
|
-
Object.keys(plugin).forEach((key) => {
|
|
4488
|
-
switch (key) {
|
|
4489
|
-
case "transform":
|
|
4490
|
-
case "resolveId":
|
|
4491
|
-
case "load":
|
|
4492
|
-
if (!plugin[key]) return;
|
|
4493
|
-
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
4494
|
-
else plugin[key] = {
|
|
4495
|
-
handler: plugin[key],
|
|
4496
|
-
filter: filterObject[key]
|
|
4497
|
-
};
|
|
4498
|
-
break;
|
|
4499
|
-
default: break;
|
|
4500
|
-
}
|
|
4501
|
-
});
|
|
4502
|
-
return plugin;
|
|
4503
|
-
}
|
|
4504
|
-
function withFilter(pluginOption, filterObject) {
|
|
4505
|
-
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
4506
|
-
}
|
|
4507
|
-
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
4508
|
-
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
4509
|
-
for (let i$22 = 0; i$22 < overrideFilterObjectList.length; i$22++) for (let j$1 = 0; j$1 < (overrideFilterObjectList[i$22].pluginNamePattern ?? []).length; j$1++) {
|
|
4510
|
-
let pattern = overrideFilterObjectList[i$22].pluginNamePattern[j$1];
|
|
4511
|
-
if (typeof pattern === "string" && pattern === pluginName) return i$22;
|
|
4512
|
-
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$22;
|
|
4513
|
-
}
|
|
4514
|
-
return -1;
|
|
4515
|
-
}
|
|
4516
|
-
var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
|
|
4517
|
-
init_misc();
|
|
4518
|
-
} });
|
|
4519
|
-
|
|
4520
|
-
//#endregion
|
|
4521
|
-
//#region src/plugin/index.ts
|
|
4522
|
-
var init_plugin = __esm({ "src/plugin/index.ts"() {
|
|
4523
|
-
init_with_filter();
|
|
4524
|
-
} });
|
|
4525
|
-
|
|
4526
4454
|
//#endregion
|
|
4527
4455
|
//#region src/utils/define-config.ts
|
|
4528
4456
|
function defineConfig(config) {
|
|
@@ -4537,10 +4465,9 @@ var init_src = __esm({ "src/index.ts"() {
|
|
|
4537
4465
|
init_build();
|
|
4538
4466
|
init_rolldown();
|
|
4539
4467
|
init_watch();
|
|
4540
|
-
init_plugin();
|
|
4541
4468
|
init_define_config();
|
|
4542
4469
|
VERSION = version;
|
|
4543
4470
|
} });
|
|
4544
4471
|
|
|
4545
4472
|
//#endregion
|
|
4546
|
-
export { BuiltinPlugin, PluginContextData, VERSION,
|
|
4473
|
+
export { BuiltinPlugin, PluginContextData, VERSION, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|