@rolldown/browser 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/browser.mjs +113 -119
- package/dist/cli.cjs +7 -7
- package/dist/cli.mjs +3 -3
- package/dist/experimental-index.cjs +3 -3
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +3 -3
- 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 +4 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/parallel-plugin-worker.cjs +3 -3
- package/dist/parallel-plugin-worker.mjs +3 -3
- 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.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-D_2wMOSn.d.mts → input-options.d-9IzFBPMw.d.mts} +13 -16
- package/dist/shared/{input-options.d-C0G2toUx.d.cts → input-options.d-BFt2wKBM.d.cts} +13 -16
- package/dist/shared/{src-RM00Zc4c.mjs → src-DN1_B1_m.mjs} +53 -126
- package/dist/shared/{src-DbbYa-_8.cjs → src-glXqJCVJ.cjs} +64 -138
- package/package.json +1 -1
- package/dist/filter-expression-index.cjs +0 -11
- package/dist/filter-expression-index.mjs +0 -4
- package/dist/shared/filter-expression-index-CIS7Rrin.mjs +0 -69
- package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
- /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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const require_filter_index = require('./filter-index-ChddWdsi.cjs');
|
|
4
|
+
const require_parse_ast_index = require('./parse-ast-index-DTWvag1h.cjs');
|
|
5
5
|
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
|
|
6
6
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
7
7
|
const __valibot_to_json_schema = require_chunk.__toESM(require("@valibot/to-json-schema"));
|
|
@@ -11,7 +11,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
11
11
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "1.0.0-beta.8-commit.
|
|
14
|
+
var version = "1.0.0-beta.8-commit.baf6ca1";
|
|
15
15
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -98,30 +98,6 @@ function isolatedDeclarationPlugin(config) {
|
|
|
98
98
|
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/utils/misc.ts
|
|
103
|
-
function arraify(value) {
|
|
104
|
-
return Array.isArray(value) ? value : [value];
|
|
105
|
-
}
|
|
106
|
-
function isNullish(value) {
|
|
107
|
-
return value === null || value === void 0;
|
|
108
|
-
}
|
|
109
|
-
function isPromiseLike(value) {
|
|
110
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
111
|
-
}
|
|
112
|
-
function unimplemented(info) {
|
|
113
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
114
|
-
throw new Error("unimplemented");
|
|
115
|
-
}
|
|
116
|
-
function unreachable(info) {
|
|
117
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
118
|
-
throw new Error("unreachable");
|
|
119
|
-
}
|
|
120
|
-
function unsupported(info) {
|
|
121
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
122
|
-
}
|
|
123
|
-
function noop(..._args) {}
|
|
124
|
-
|
|
125
101
|
//#endregion
|
|
126
102
|
//#region src/log/logging.ts
|
|
127
103
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -140,7 +116,7 @@ const logLevelPriority = {
|
|
|
140
116
|
//#region src/log/log-handler.ts
|
|
141
117
|
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
142
118
|
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
143
|
-
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
119
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return require_filter_index.noop;
|
|
144
120
|
return (log, pos) => {
|
|
145
121
|
if (pos != null) logger(LOG_LEVEL_WARN, require_parse_ast_index.logInvalidLogPosition(pluginName));
|
|
146
122
|
log = normalizeLog(log);
|
|
@@ -243,7 +219,7 @@ function normalizeHook(hook) {
|
|
|
243
219
|
meta: { order }
|
|
244
220
|
};
|
|
245
221
|
}
|
|
246
|
-
unreachable("Invalid hook type");
|
|
222
|
+
require_filter_index.unreachable("Invalid hook type");
|
|
247
223
|
}
|
|
248
224
|
|
|
249
225
|
//#endregion
|
|
@@ -925,7 +901,7 @@ function joinNewLine(s1, s2) {
|
|
|
925
901
|
function transformModuleInfo(info, option) {
|
|
926
902
|
return {
|
|
927
903
|
get ast() {
|
|
928
|
-
return unsupported("ModuleInfo#ast");
|
|
904
|
+
return require_filter_index.unsupported("ModuleInfo#ast");
|
|
929
905
|
},
|
|
930
906
|
get code() {
|
|
931
907
|
return info.code;
|
|
@@ -1008,19 +984,18 @@ function t(...n) {
|
|
|
1008
984
|
//#endregion
|
|
1009
985
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
1010
986
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
1011
|
-
if (typeof matcher === "string" || matcher instanceof RegExp) return [
|
|
1012
|
-
if (Array.isArray(matcher)) return matcher.map((m) =>
|
|
1013
|
-
if (matcher.custom) return matcher.custom;
|
|
987
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [require_filter_index.include(require_filter_index.id(matcher))];
|
|
988
|
+
if (Array.isArray(matcher)) return matcher.map((m) => require_filter_index.include(require_filter_index.id(m)));
|
|
1014
989
|
let ret = [];
|
|
1015
990
|
let isCode = stringKind === "code";
|
|
1016
|
-
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) =>
|
|
1017
|
-
if (matcher.include) ret.push(...arraify(matcher.include).map((m) =>
|
|
991
|
+
if (matcher.exclude) ret.push(...require_filter_index.arraify(matcher.exclude).map((m) => require_filter_index.exclude(isCode ? require_filter_index.code(m) : require_filter_index.id(m))));
|
|
992
|
+
if (matcher.include) ret.push(...require_filter_index.arraify(matcher.include).map((m) => require_filter_index.include(isCode ? require_filter_index.code(m) : require_filter_index.id(m))));
|
|
1018
993
|
return ret;
|
|
1019
994
|
}
|
|
1020
995
|
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
1021
996
|
if (!filterOption) return void 0;
|
|
1022
|
-
|
|
1023
|
-
|
|
997
|
+
if (Array.isArray(filterOption)) return filterOption;
|
|
998
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
1024
999
|
let ret = [];
|
|
1025
1000
|
let idIncludes = [];
|
|
1026
1001
|
let idExcludes = [];
|
|
@@ -1030,33 +1005,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
1030
1005
|
if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
1031
1006
|
ret.push(...idExcludes);
|
|
1032
1007
|
ret.push(...codeExcludes);
|
|
1033
|
-
let
|
|
1008
|
+
let andExprList = [];
|
|
1034
1009
|
if (moduleType$1) {
|
|
1035
1010
|
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1038
|
-
if (idIncludes.length) {
|
|
1039
|
-
let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
|
|
1040
|
-
if (!cursor) cursor = joinedOrExpr;
|
|
1041
|
-
else cursor = require_filter_expression_index.and(cursor, joinedOrExpr);
|
|
1011
|
+
andExprList.push(require_filter_index.or(...moduleTypes.map((m) => require_filter_index.moduleType(m))));
|
|
1042
1012
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
else cursor = require_filter_expression_index.and(cursor, joinedOrExpr);
|
|
1047
|
-
}
|
|
1048
|
-
if (cursor) ret.push(require_filter_expression_index.include(cursor));
|
|
1013
|
+
if (idIncludes.length) andExprList.push(require_filter_index.or(...idIncludes.map((item) => item.expr)));
|
|
1014
|
+
if (codeIncludes.length) andExprList.push(require_filter_index.or(...codeIncludes.map((item) => item.expr)));
|
|
1015
|
+
if (andExprList.length) ret.push(require_filter_index.include(require_filter_index.and(...andExprList)));
|
|
1049
1016
|
return ret;
|
|
1050
1017
|
}
|
|
1051
|
-
function
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
|
|
1057
|
-
let custom = [];
|
|
1058
|
-
if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
|
|
1059
|
-
return { custom: custom.length > 0 ? custom : void 0 };
|
|
1018
|
+
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
|
1019
|
+
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
|
1020
|
+
let ret = [];
|
|
1021
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
1022
|
+
return ret.length > 0 ? { value: ret } : void 0;
|
|
1060
1023
|
}
|
|
1061
1024
|
function bindingifyFilterExpr(expr) {
|
|
1062
1025
|
let list = [];
|
|
@@ -1066,9 +1029,21 @@ function bindingifyFilterExpr(expr) {
|
|
|
1066
1029
|
function bindingifyFilterExprImpl(expr, list) {
|
|
1067
1030
|
switch (expr.kind) {
|
|
1068
1031
|
case "and": {
|
|
1069
|
-
|
|
1070
|
-
bindingifyFilterExprImpl(
|
|
1071
|
-
list.push({
|
|
1032
|
+
let args = expr.args;
|
|
1033
|
+
for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
|
|
1034
|
+
list.push({
|
|
1035
|
+
kind: "And",
|
|
1036
|
+
payload: args.length
|
|
1037
|
+
});
|
|
1038
|
+
break;
|
|
1039
|
+
}
|
|
1040
|
+
case "or": {
|
|
1041
|
+
let args = expr.args;
|
|
1042
|
+
for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
|
|
1043
|
+
list.push({
|
|
1044
|
+
kind: "Or",
|
|
1045
|
+
payload: args.length
|
|
1046
|
+
});
|
|
1072
1047
|
break;
|
|
1073
1048
|
}
|
|
1074
1049
|
case "not": {
|
|
@@ -1079,21 +1054,21 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
1079
1054
|
case "id": {
|
|
1080
1055
|
list.push({
|
|
1081
1056
|
kind: "Id",
|
|
1082
|
-
|
|
1057
|
+
payload: expr.pattern
|
|
1083
1058
|
});
|
|
1084
1059
|
break;
|
|
1085
1060
|
}
|
|
1086
1061
|
case "moduleType": {
|
|
1087
1062
|
list.push({
|
|
1088
1063
|
kind: "ModuleType",
|
|
1089
|
-
|
|
1064
|
+
payload: expr.pattern
|
|
1090
1065
|
});
|
|
1091
1066
|
break;
|
|
1092
1067
|
}
|
|
1093
1068
|
case "code": {
|
|
1094
1069
|
list.push({
|
|
1095
1070
|
kind: "Code",
|
|
1096
|
-
|
|
1071
|
+
payload: expr.pattern
|
|
1097
1072
|
});
|
|
1098
1073
|
break;
|
|
1099
1074
|
}
|
|
@@ -1107,27 +1082,30 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
1107
1082
|
list.push({ kind: "Exclude" });
|
|
1108
1083
|
break;
|
|
1109
1084
|
}
|
|
1110
|
-
default: throw new Error(`Unknown filter expression
|
|
1085
|
+
default: throw new Error(`Unknown filter expression: ${expr}`);
|
|
1111
1086
|
}
|
|
1112
1087
|
}
|
|
1113
1088
|
function bindingifyResolveIdFilter(filterOption) {
|
|
1114
|
-
|
|
1089
|
+
if (!filterOption) return void 0;
|
|
1090
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1091
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
1115
1092
|
}
|
|
1116
1093
|
function bindingifyLoadFilter(filterOption) {
|
|
1117
|
-
|
|
1094
|
+
if (!filterOption) return void 0;
|
|
1095
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1096
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
1118
1097
|
}
|
|
1119
1098
|
function bindingifyTransformFilter(filterOption) {
|
|
1120
1099
|
if (!filterOption) return void 0;
|
|
1121
|
-
let
|
|
1100
|
+
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
1122
1101
|
let ret = [];
|
|
1123
|
-
if (
|
|
1124
|
-
return {
|
|
1102
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
1103
|
+
return { value: ret.length > 0 ? ret : void 0 };
|
|
1125
1104
|
}
|
|
1126
1105
|
function bindingifyRenderChunkFilter(filterOption) {
|
|
1127
|
-
if (filterOption)
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1106
|
+
if (!filterOption) return void 0;
|
|
1107
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
1108
|
+
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
1131
1109
|
}
|
|
1132
1110
|
|
|
1133
1111
|
//#endregion
|
|
@@ -1209,12 +1187,12 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
1209
1187
|
const info = this.data.getModuleOption(res.id) || {};
|
|
1210
1188
|
return {
|
|
1211
1189
|
...res,
|
|
1212
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
1190
|
+
external: res.external === "relative" ? require_filter_index.unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
1213
1191
|
...info
|
|
1214
1192
|
};
|
|
1215
1193
|
}
|
|
1216
1194
|
emitFile = (file) => {
|
|
1217
|
-
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
1195
|
+
if (file.type === "prebuilt-chunk") return require_filter_index.unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
1218
1196
|
if (file.type === "chunk") return this.context.emitChunk(file);
|
|
1219
1197
|
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
1220
1198
|
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
@@ -1559,7 +1537,7 @@ function bindingifyFormat(format) {
|
|
|
1559
1537
|
case "iife": return "iife";
|
|
1560
1538
|
case "umd": return "umd";
|
|
1561
1539
|
case "experimental-app": return "app";
|
|
1562
|
-
default: unimplemented(`output.format: ${format}`);
|
|
1540
|
+
default: require_filter_index.unimplemented(`output.format: ${format}`);
|
|
1563
1541
|
}
|
|
1564
1542
|
}
|
|
1565
1543
|
function bindingifySourcemap(sourcemap) {
|
|
@@ -2353,7 +2331,7 @@ function bindingifyExternal(external) {
|
|
|
2353
2331
|
if (id$1.startsWith("\0")) return false;
|
|
2354
2332
|
return external(id$1, importer, isResolved) ?? false;
|
|
2355
2333
|
};
|
|
2356
|
-
const externalArr = arraify(external);
|
|
2334
|
+
const externalArr = require_filter_index.arraify(external);
|
|
2357
2335
|
return (id$1, _importer, _isResolved) => {
|
|
2358
2336
|
return externalArr.some((pat) => {
|
|
2359
2337
|
if (pat instanceof RegExp) return pat.test(id$1);
|
|
@@ -2368,7 +2346,7 @@ function bindingifyResolve(resolve) {
|
|
|
2368
2346
|
return {
|
|
2369
2347
|
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
|
2370
2348
|
find: name,
|
|
2371
|
-
replacements: arraify(replacement)
|
|
2349
|
+
replacements: require_filter_index.arraify(replacement)
|
|
2372
2350
|
})) : void 0,
|
|
2373
2351
|
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
|
2374
2352
|
target: name,
|
|
@@ -2615,7 +2593,7 @@ function createComposedPlugin(plugins) {
|
|
|
2615
2593
|
if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
|
|
2616
2594
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2617
2595
|
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
|
|
2618
|
-
if (!isNullish(result)) return result;
|
|
2596
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2619
2597
|
}
|
|
2620
2598
|
};
|
|
2621
2599
|
}
|
|
@@ -2641,7 +2619,7 @@ function createComposedPlugin(plugins) {
|
|
|
2641
2619
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2642
2620
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2643
2621
|
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
|
|
2644
|
-
if (!isNullish(result)) return result;
|
|
2622
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2645
2623
|
}
|
|
2646
2624
|
};
|
|
2647
2625
|
}
|
|
@@ -2663,7 +2641,7 @@ function createComposedPlugin(plugins) {
|
|
|
2663
2641
|
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
2664
2642
|
};
|
|
2665
2643
|
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
|
|
2666
|
-
if (!isNullish(result)) {
|
|
2644
|
+
if (!require_filter_index.isNullish(result)) {
|
|
2667
2645
|
if (typeof result === "string") updateOutput(result);
|
|
2668
2646
|
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
2669
2647
|
}
|
|
@@ -2695,7 +2673,7 @@ function createComposedPlugin(plugins) {
|
|
|
2695
2673
|
for (const [handler, plugin] of batchedHandlers) {
|
|
2696
2674
|
const { handler: handlerFn } = normalizeHook(handler);
|
|
2697
2675
|
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
|
|
2698
|
-
if (!isNullish(result)) return result;
|
|
2676
|
+
if (!require_filter_index.isNullish(result)) return result;
|
|
2699
2677
|
}
|
|
2700
2678
|
};
|
|
2701
2679
|
}
|
|
@@ -3062,8 +3040,8 @@ var Watcher = class {
|
|
|
3062
3040
|
}
|
|
3063
3041
|
};
|
|
3064
3042
|
async function createWatcher(emitter, input) {
|
|
3065
|
-
const options = arraify(input);
|
|
3066
|
-
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
3043
|
+
const options = require_filter_index.arraify(input);
|
|
3044
|
+
const bundlerOptions = await Promise.all(options.map((option) => require_filter_index.arraify(option.output || {}).map(async (output) => {
|
|
3067
3045
|
const inputOptions = await PluginDriver.callOptionsHook(option, true);
|
|
3068
3046
|
return createBundlerOptions(inputOptions, output, true);
|
|
3069
3047
|
})).flat());
|
|
@@ -3091,46 +3069,6 @@ const watch = (input) => {
|
|
|
3091
3069
|
return emitter;
|
|
3092
3070
|
};
|
|
3093
3071
|
|
|
3094
|
-
//#endregion
|
|
3095
|
-
//#region src/plugin/with-filter.ts
|
|
3096
|
-
function withFilterImpl(pluginOption, filterObjectList) {
|
|
3097
|
-
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
3098
|
-
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
3099
|
-
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
3100
|
-
let plugin = pluginOption;
|
|
3101
|
-
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
3102
|
-
if (filterObjectIndex === -1) return plugin;
|
|
3103
|
-
let filterObject = filterObjectList[filterObjectIndex];
|
|
3104
|
-
Object.keys(plugin).forEach((key) => {
|
|
3105
|
-
switch (key) {
|
|
3106
|
-
case "transform":
|
|
3107
|
-
case "resolveId":
|
|
3108
|
-
case "load":
|
|
3109
|
-
if (!plugin[key]) return;
|
|
3110
|
-
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
3111
|
-
else plugin[key] = {
|
|
3112
|
-
handler: plugin[key],
|
|
3113
|
-
filter: filterObject[key]
|
|
3114
|
-
};
|
|
3115
|
-
break;
|
|
3116
|
-
default: break;
|
|
3117
|
-
}
|
|
3118
|
-
});
|
|
3119
|
-
return plugin;
|
|
3120
|
-
}
|
|
3121
|
-
function withFilter(pluginOption, filterObject) {
|
|
3122
|
-
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
3123
|
-
}
|
|
3124
|
-
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
3125
|
-
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
3126
|
-
for (let i$1 = 0; i$1 < overrideFilterObjectList.length; i$1++) for (let j = 0; j < (overrideFilterObjectList[i$1].pluginNamePattern ?? []).length; j++) {
|
|
3127
|
-
let pattern = overrideFilterObjectList[i$1].pluginNamePattern[j];
|
|
3128
|
-
if (typeof pattern === "string" && pattern === pluginName) return i$1;
|
|
3129
|
-
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$1;
|
|
3130
|
-
}
|
|
3131
|
-
return -1;
|
|
3132
|
-
}
|
|
3133
|
-
|
|
3134
3072
|
//#endregion
|
|
3135
3073
|
//#region src/utils/define-config.ts
|
|
3136
3074
|
function defineConfig(config) {
|
|
@@ -3160,12 +3098,6 @@ Object.defineProperty(exports, 'VERSION', {
|
|
|
3160
3098
|
return VERSION;
|
|
3161
3099
|
}
|
|
3162
3100
|
});
|
|
3163
|
-
Object.defineProperty(exports, 'arraify', {
|
|
3164
|
-
enumerable: true,
|
|
3165
|
-
get: function () {
|
|
3166
|
-
return arraify;
|
|
3167
|
-
}
|
|
3168
|
-
});
|
|
3169
3101
|
Object.defineProperty(exports, 'bindingifyPlugin', {
|
|
3170
3102
|
enumerable: true,
|
|
3171
3103
|
get: function () {
|
|
@@ -3333,10 +3265,4 @@ Object.defineProperty(exports, 'watch', {
|
|
|
3333
3265
|
get: function () {
|
|
3334
3266
|
return watch;
|
|
3335
3267
|
}
|
|
3336
|
-
});
|
|
3337
|
-
Object.defineProperty(exports, 'withFilter', {
|
|
3338
|
-
enumerable: true,
|
|
3339
|
-
get: function () {
|
|
3340
|
-
return withFilter;
|
|
3341
|
-
}
|
|
3342
3268
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolldown/browser",
|
|
3
|
-
"version": "1.0.0-beta.8-commit.
|
|
3
|
+
"version": "1.0.0-beta.8-commit.baf6ca1",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"type": "module",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const require_filter_expression_index = require('./shared/filter-expression-index-CRtoeipP.cjs');
|
|
2
|
-
|
|
3
|
-
exports.And = require_filter_expression_index.And
|
|
4
|
-
exports.and = require_filter_expression_index.and
|
|
5
|
-
exports.code = require_filter_expression_index.code
|
|
6
|
-
exports.exclude = require_filter_expression_index.exclude
|
|
7
|
-
exports.id = require_filter_expression_index.id
|
|
8
|
-
exports.include = require_filter_expression_index.include
|
|
9
|
-
exports.moduleType = require_filter_expression_index.moduleType
|
|
10
|
-
exports.not = require_filter_expression_index.not
|
|
11
|
-
exports.or = require_filter_expression_index.or
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/filter-expression-index.ts
|
|
4
|
-
function and(left, right) {
|
|
5
|
-
return {
|
|
6
|
-
kind: "and",
|
|
7
|
-
left,
|
|
8
|
-
right
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function or(left, right) {
|
|
12
|
-
return {
|
|
13
|
-
kind: "or",
|
|
14
|
-
left,
|
|
15
|
-
right
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function not(expr) {
|
|
19
|
-
return {
|
|
20
|
-
kind: "not",
|
|
21
|
-
expr
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function id(pattern) {
|
|
25
|
-
return {
|
|
26
|
-
kind: "id",
|
|
27
|
-
pattern
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function moduleType(pattern) {
|
|
31
|
-
return {
|
|
32
|
-
kind: "moduleType",
|
|
33
|
-
pattern
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function code(pattern) {
|
|
37
|
-
return {
|
|
38
|
-
kind: "code",
|
|
39
|
-
pattern
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function include(expr) {
|
|
43
|
-
return {
|
|
44
|
-
kind: "include",
|
|
45
|
-
expr
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function exclude(expr) {
|
|
49
|
-
return {
|
|
50
|
-
kind: "exclude",
|
|
51
|
-
expr
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
var And;
|
|
55
|
-
var init_filter_expression_index = __esm({ "src/filter-expression-index.ts"() {
|
|
56
|
-
And = class {
|
|
57
|
-
kind;
|
|
58
|
-
left;
|
|
59
|
-
right;
|
|
60
|
-
constructor(left, right) {
|
|
61
|
-
this.left = left;
|
|
62
|
-
this.right = right;
|
|
63
|
-
this.kind = "and";
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
} });
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
export { And, and, code, exclude, id, include, init_filter_expression_index, moduleType, not, or };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
//#region src/filter-expression-index.ts
|
|
4
|
-
var And = class {
|
|
5
|
-
kind;
|
|
6
|
-
left;
|
|
7
|
-
right;
|
|
8
|
-
constructor(left, right) {
|
|
9
|
-
this.left = left;
|
|
10
|
-
this.right = right;
|
|
11
|
-
this.kind = "and";
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
function and(left, right) {
|
|
15
|
-
return {
|
|
16
|
-
kind: "and",
|
|
17
|
-
left,
|
|
18
|
-
right
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function or(left, right) {
|
|
22
|
-
return {
|
|
23
|
-
kind: "or",
|
|
24
|
-
left,
|
|
25
|
-
right
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function not(expr) {
|
|
29
|
-
return {
|
|
30
|
-
kind: "not",
|
|
31
|
-
expr
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function id(pattern) {
|
|
35
|
-
return {
|
|
36
|
-
kind: "id",
|
|
37
|
-
pattern
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function moduleType(pattern) {
|
|
41
|
-
return {
|
|
42
|
-
kind: "moduleType",
|
|
43
|
-
pattern
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function code(pattern) {
|
|
47
|
-
return {
|
|
48
|
-
kind: "code",
|
|
49
|
-
pattern
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function include(expr) {
|
|
53
|
-
return {
|
|
54
|
-
kind: "include",
|
|
55
|
-
expr
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function exclude(expr) {
|
|
59
|
-
return {
|
|
60
|
-
kind: "exclude",
|
|
61
|
-
expr
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//#endregion
|
|
66
|
-
Object.defineProperty(exports, 'And', {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return And;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, 'and', {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return and;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, 'code', {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return code;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(exports, 'exclude', {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return exclude;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, 'id', {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return id;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, 'include', {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return include;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(exports, 'moduleType', {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return moduleType;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(exports, 'not', {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return not;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(exports, 'or', {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function () {
|
|
117
|
-
return or;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
File without changes
|
|
File without changes
|