@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.
Files changed (35) hide show
  1. package/dist/browser.mjs +343 -188
  2. package/dist/cli.cjs +8 -7
  3. package/dist/cli.mjs +4 -3
  4. package/dist/experimental-index.cjs +3 -2
  5. package/dist/experimental-index.d.cts +1 -1
  6. package/dist/experimental-index.d.mts +1 -1
  7. package/dist/experimental-index.mjs +3 -2
  8. package/dist/filter-index.cjs +12 -0
  9. package/dist/filter-index.d.cts +3 -0
  10. package/dist/filter-index.d.mts +3 -0
  11. package/dist/filter-index.mjs +4 -0
  12. package/dist/index.cjs +4 -4
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -3
  16. package/dist/parallel-plugin-worker.cjs +3 -2
  17. package/dist/parallel-plugin-worker.mjs +3 -2
  18. package/dist/parallel-plugin.d.cts +1 -1
  19. package/dist/parallel-plugin.d.mts +1 -1
  20. package/dist/parse-ast-index.cjs +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/rolldown-binding.wasi-browser.js +1 -0
  23. package/dist/rolldown-binding.wasi.cjs +1 -0
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
  26. package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
  27. package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-9IzFBPMw.d.mts} +82 -23
  28. package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-BFt2wKBM.d.cts} +82 -23
  29. package/dist/shared/{src-D9guL4ht.mjs → src-DN1_B1_m.mjs} +1783 -1740
  30. package/dist/shared/{src-CJ9XODOK.cjs → src-glXqJCVJ.cjs} +260 -219
  31. package/package.json +1 -1
  32. /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
  33. /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
  34. /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
  35. /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
package/dist/browser.mjs CHANGED
@@ -5,7 +5,7 @@ import colors from "ansis";
5
5
  import * as v from "valibot";
6
6
 
7
7
  //#region package.json
8
- var version = "1.0.0-beta.8-commit.a98d94e";
8
+ var version = "1.0.0-beta.8-commit.baf6ca1";
9
9
 
10
10
  //#endregion
11
11
  //#region src/builtin-plugin/utils.ts
@@ -33,9 +33,6 @@ function arraify(value) {
33
33
  function isNullish(value) {
34
34
  return value === null || value === void 0;
35
35
  }
36
- function isPromiseLike(value) {
37
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
38
- }
39
36
  function unimplemented(info) {
40
37
  if (info) throw new Error(`unimplemented: ${info}`);
41
38
  throw new Error("unimplemented");
@@ -119,18 +116,18 @@ function rangeContains(range, index) {
119
116
  function getLocator(source, options = {}) {
120
117
  const { offsetLine = 0, offsetColumn = 0 } = options;
121
118
  let start = 0;
122
- const ranges = source.split("\n").map((line, i$1) => {
119
+ const ranges = source.split("\n").map((line, i$2) => {
123
120
  const end = start + line.length + 1;
124
121
  /** @type {import('./types').Range} */
125
122
  const range = {
126
123
  start,
127
124
  end,
128
- line: i$1
125
+ line: i$2
129
126
  };
130
127
  start = end;
131
128
  return range;
132
129
  });
133
- let i = 0;
130
+ let i$1 = 0;
134
131
  /**
135
132
  * @param {string | number} search
136
133
  * @param {number} [index]
@@ -139,16 +136,16 @@ function getLocator(source, options = {}) {
139
136
  function locator(search, index) {
140
137
  if (typeof search === "string") search = source.indexOf(search, index ?? 0);
141
138
  if (search === -1) return void 0;
142
- let range = ranges[i];
143
- const d = search >= range.end ? 1 : -1;
139
+ let range = ranges[i$1];
140
+ const d$1 = search >= range.end ? 1 : -1;
144
141
  while (range) {
145
142
  if (rangeContains(range, search)) return {
146
143
  line: offsetLine + range.line,
147
144
  column: offsetColumn + search - range.start,
148
145
  character: search
149
146
  };
150
- i += d;
151
- range = ranges[i];
147
+ i$1 += d$1;
148
+ range = ranges[i$1];
152
149
  }
153
150
  }
154
151
  return locator;
@@ -196,14 +193,14 @@ function logMultiplyNotifyOption() {
196
193
  message: `Found multiply notify option at watch options, using first one to start notify watcher.`
197
194
  };
198
195
  }
199
- function logPluginError(error$1, plugin, { hook, id } = {}) {
196
+ function logPluginError(error$1, plugin, { hook, id: id$1 } = {}) {
200
197
  try {
201
- const code = error$1.code;
202
- if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
198
+ const code$1 = error$1.code;
199
+ if (!error$1.pluginCode && code$1 != null && (typeof code$1 !== "string" || !code$1.startsWith("PLUGIN_"))) error$1.pluginCode = code$1;
203
200
  error$1.code = PLUGIN_ERROR;
204
201
  error$1.plugin = plugin;
205
202
  if (hook) error$1.hook = hook;
206
- if (id) error$1.id = id;
203
+ if (id$1) error$1.id = id$1;
207
204
  } catch (_) {} finally {
208
205
  return error$1;
209
206
  }
@@ -218,12 +215,12 @@ function error(base) {
218
215
  }
219
216
  throw base;
220
217
  }
221
- function augmentCodeLocation(properties, pos, source, id) {
218
+ function augmentCodeLocation(properties, pos, source, id$1) {
222
219
  if (typeof pos === "object") {
223
220
  const { line, column } = pos;
224
221
  properties.loc = {
225
222
  column,
226
- file: id,
223
+ file: id$1,
227
224
  line
228
225
  };
229
226
  } else {
@@ -233,7 +230,7 @@ function augmentCodeLocation(properties, pos, source, id) {
233
230
  const { line, column } = location;
234
231
  properties.loc = {
235
232
  column,
236
- file: id,
233
+ file: id$1,
237
234
  line
238
235
  };
239
236
  }
@@ -246,13 +243,13 @@ function augmentCodeLocation(properties, pos, source, id) {
246
243
  //#endregion
247
244
  //#region src/log/log-handler.ts
248
245
  const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
249
- function getLogHandler(level, code, logger, pluginName, logLevel) {
246
+ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
250
247
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
251
248
  return (log, pos) => {
252
249
  if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
253
250
  log = normalizeLog(log);
254
251
  if (log.code && !log.pluginCode) log.pluginCode = log.code;
255
- log.code = code;
252
+ log.code = code$1;
256
253
  log.plugin = pluginName;
257
254
  logger(level, log);
258
255
  };
@@ -329,9 +326,9 @@ const getExtendedLogMessage = (log) => {
329
326
  if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
330
327
  return prefix + log.message;
331
328
  };
332
- function relativeId(id) {
333
- if (!path.isAbsolute(id)) return id;
334
- return path.relative(path.resolve(), id);
329
+ function relativeId(id$1) {
330
+ if (!path.isAbsolute(id$1)) return id$1;
331
+ return path.relative(path.resolve(), id$1);
335
332
  }
336
333
 
337
334
  //#endregion
@@ -898,7 +895,7 @@ function validateOption(key, options) {
898
895
  const issuePaths = issue.path.map((path$1) => path$1.key);
899
896
  let issueMsg = issue.message;
900
897
  if (issue.type === "union") {
901
- const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
898
+ const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
902
899
  if (subIssue) {
903
900
  if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
904
901
  issueMsg = subIssue.message;
@@ -970,13 +967,13 @@ function normalizeErrors(rawErrors) {
970
967
  stack: void 0
971
968
  }));
972
969
  let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
973
- for (let i = 0; i < errors.length; i++) {
970
+ for (let i$1 = 0; i$1 < errors.length; i$1++) {
974
971
  summary += "\n";
975
- if (i >= 5) {
972
+ if (i$1 >= 5) {
976
973
  summary += "...";
977
974
  break;
978
975
  }
979
- summary += getErrorMessage(errors[i]);
976
+ summary += getErrorMessage(errors[i$1]);
980
977
  }
981
978
  const wrapper = new Error(summary);
982
979
  Object.defineProperty(wrapper, "errors", {
@@ -995,9 +992,9 @@ function getErrorMessage(e) {
995
992
  if (Object.hasOwn(e, "kind")) return e.message;
996
993
  let s = "";
997
994
  if (e.plugin) s += `[plugin ${e.plugin}]`;
998
- const id = e.id ?? e.loc?.file;
999
- if (id) {
1000
- s += " " + id;
995
+ const id$1 = e.id ?? e.loc?.file;
996
+ if (id$1) {
997
+ s += " " + id$1;
1001
998
  if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
1002
999
  }
1003
1000
  if (s) s += "\n";
@@ -1052,41 +1049,257 @@ function isEmptySourcemapFiled(array) {
1052
1049
  if (array.length === 0 || !array[0]) return true;
1053
1050
  return false;
1054
1051
  }
1055
- function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
1052
+ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
1056
1053
  if (!rawMap) return;
1057
1054
  let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
1058
1055
  if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
1059
- if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
1056
+ if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
1060
1057
  return map;
1061
1058
  }
1062
1059
 
1060
+ //#endregion
1061
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
1062
+ function u$1(o, n, a) {
1063
+ let t$1 = (r) => o(r, ...n);
1064
+ return a === void 0 ? t$1 : Object.assign(t$1, {
1065
+ lazy: a,
1066
+ lazyArgs: n
1067
+ });
1068
+ }
1069
+
1070
+ //#endregion
1071
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
1072
+ function u(r, n, o) {
1073
+ let a = r.length - n.length;
1074
+ if (a === 0) return r(...n);
1075
+ if (a === 1) return u$1(r, n, o);
1076
+ throw new Error("Wrong number of arguments");
1077
+ }
1078
+
1079
+ //#endregion
1080
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-3IFJP4R5.js
1081
+ function d(...r) {
1082
+ return u(i, r);
1083
+ }
1084
+ var i = (r, t$1) => {
1085
+ let a = [[], []];
1086
+ for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
1087
+ return a;
1088
+ };
1089
+
1090
+ //#endregion
1091
+ //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
1092
+ function t(...n) {
1093
+ return u(Object.keys, n);
1094
+ }
1095
+
1096
+ //#endregion
1097
+ //#region src/filter-index.ts
1098
+ var And = class {
1099
+ kind;
1100
+ args;
1101
+ constructor(...args) {
1102
+ if (args.length === 0) throw new Error("`And` expects at least one operand");
1103
+ this.args = args;
1104
+ this.kind = "and";
1105
+ }
1106
+ };
1107
+ var Or = class {
1108
+ kind;
1109
+ args;
1110
+ constructor(...args) {
1111
+ if (args.length === 0) throw new Error("`Or` expects at least one operand");
1112
+ this.args = args;
1113
+ this.kind = "or";
1114
+ }
1115
+ };
1116
+ var Id = class {
1117
+ kind;
1118
+ pattern;
1119
+ constructor(pattern) {
1120
+ this.pattern = pattern;
1121
+ this.kind = "id";
1122
+ }
1123
+ };
1124
+ var ModuleType = class {
1125
+ kind;
1126
+ pattern;
1127
+ constructor(pattern) {
1128
+ this.pattern = pattern;
1129
+ this.kind = "moduleType";
1130
+ }
1131
+ };
1132
+ var Code = class {
1133
+ kind;
1134
+ pattern;
1135
+ constructor(expr) {
1136
+ this.pattern = expr;
1137
+ this.kind = "code";
1138
+ }
1139
+ };
1140
+ var Include = class {
1141
+ kind;
1142
+ expr;
1143
+ constructor(expr) {
1144
+ this.expr = expr;
1145
+ this.kind = "include";
1146
+ }
1147
+ };
1148
+ var Exclude = class {
1149
+ kind;
1150
+ expr;
1151
+ constructor(expr) {
1152
+ this.expr = expr;
1153
+ this.kind = "exclude";
1154
+ }
1155
+ };
1156
+ function and(...args) {
1157
+ return new And(...args);
1158
+ }
1159
+ function or(...args) {
1160
+ return new Or(...args);
1161
+ }
1162
+ function id(pattern) {
1163
+ return new Id(pattern);
1164
+ }
1165
+ function moduleType(pattern) {
1166
+ return new ModuleType(pattern);
1167
+ }
1168
+ function code(pattern) {
1169
+ return new Code(pattern);
1170
+ }
1171
+ function include(expr) {
1172
+ return new Include(expr);
1173
+ }
1174
+ function exclude(expr) {
1175
+ return new Exclude(expr);
1176
+ }
1177
+
1063
1178
  //#endregion
1064
1179
  //#region src/plugin/bindingify-hook-filter.ts
1065
- function bindingifyStringFilter(matcher) {
1066
- if (typeof matcher === "string" || matcher instanceof RegExp) return { include: [matcher] };
1067
- if (Array.isArray(matcher)) return { include: matcher };
1068
- return {
1069
- include: matcher.include ? arraify(matcher.include) : void 0,
1070
- exclude: matcher.exclude ? arraify(matcher.exclude) : void 0
1071
- };
1180
+ function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
1181
+ if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
1182
+ if (Array.isArray(matcher)) return matcher.map((m) => include(id(m)));
1183
+ let ret = [];
1184
+ let isCode = stringKind === "code";
1185
+ if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(isCode ? code(m) : id(m))));
1186
+ if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(isCode ? code(m) : id(m))));
1187
+ return ret;
1188
+ }
1189
+ function transformFilterMatcherToFilterExprs(filterOption) {
1190
+ if (!filterOption) return void 0;
1191
+ if (Array.isArray(filterOption)) return filterOption;
1192
+ const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
1193
+ let ret = [];
1194
+ let idIncludes = [];
1195
+ let idExcludes = [];
1196
+ let codeIncludes = [];
1197
+ let codeExcludes = [];
1198
+ if (id$1) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
1199
+ if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
1200
+ ret.push(...idExcludes);
1201
+ ret.push(...codeExcludes);
1202
+ let andExprList = [];
1203
+ if (moduleType$1) {
1204
+ let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
1205
+ andExprList.push(or(...moduleTypes.map((m) => moduleType(m))));
1206
+ }
1207
+ if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
1208
+ if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
1209
+ if (andExprList.length) ret.push(include(and(...andExprList)));
1210
+ return ret;
1211
+ }
1212
+ function bindingifyGeneralHookFilter(stringKind, pattern) {
1213
+ let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
1214
+ let ret = [];
1215
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
1216
+ return ret.length > 0 ? { value: ret } : void 0;
1217
+ }
1218
+ function bindingifyFilterExpr(expr) {
1219
+ let list = [];
1220
+ bindingifyFilterExprImpl(expr, list);
1221
+ return list;
1222
+ }
1223
+ function bindingifyFilterExprImpl(expr, list) {
1224
+ switch (expr.kind) {
1225
+ case "and": {
1226
+ let args = expr.args;
1227
+ for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
1228
+ list.push({
1229
+ kind: "And",
1230
+ payload: args.length
1231
+ });
1232
+ break;
1233
+ }
1234
+ case "or": {
1235
+ let args = expr.args;
1236
+ for (let i$1 = args.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args[i$1], list);
1237
+ list.push({
1238
+ kind: "Or",
1239
+ payload: args.length
1240
+ });
1241
+ break;
1242
+ }
1243
+ case "not": {
1244
+ bindingifyFilterExprImpl(expr.expr, list);
1245
+ list.push({ kind: "Not" });
1246
+ break;
1247
+ }
1248
+ case "id": {
1249
+ list.push({
1250
+ kind: "Id",
1251
+ payload: expr.pattern
1252
+ });
1253
+ break;
1254
+ }
1255
+ case "moduleType": {
1256
+ list.push({
1257
+ kind: "ModuleType",
1258
+ payload: expr.pattern
1259
+ });
1260
+ break;
1261
+ }
1262
+ case "code": {
1263
+ list.push({
1264
+ kind: "Code",
1265
+ payload: expr.pattern
1266
+ });
1267
+ break;
1268
+ }
1269
+ case "include": {
1270
+ bindingifyFilterExprImpl(expr.expr, list);
1271
+ list.push({ kind: "Include" });
1272
+ break;
1273
+ }
1274
+ case "exclude": {
1275
+ bindingifyFilterExprImpl(expr.expr, list);
1276
+ list.push({ kind: "Exclude" });
1277
+ break;
1278
+ }
1279
+ default: throw new Error(`Unknown filter expression: ${expr}`);
1280
+ }
1072
1281
  }
1073
1282
  function bindingifyResolveIdFilter(filterOption) {
1074
- return filterOption?.id ? bindingifyStringFilter(filterOption.id) : void 0;
1283
+ if (!filterOption) return void 0;
1284
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
1285
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1075
1286
  }
1076
1287
  function bindingifyLoadFilter(filterOption) {
1077
- return filterOption?.id ? bindingifyStringFilter(filterOption.id) : void 0;
1288
+ if (!filterOption) return void 0;
1289
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
1290
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1078
1291
  }
1079
1292
  function bindingifyTransformFilter(filterOption) {
1080
1293
  if (!filterOption) return void 0;
1081
- const { id, code, moduleType } = filterOption;
1082
- let moduleTypeRet;
1083
- if (moduleType) if (Array.isArray(moduleType)) moduleTypeRet = moduleType;
1084
- else moduleTypeRet = moduleType.include;
1085
- return {
1086
- id: id ? bindingifyStringFilter(id) : void 0,
1087
- code: code ? bindingifyStringFilter(code) : void 0,
1088
- moduleType: moduleTypeRet
1089
- };
1294
+ let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
1295
+ let ret = [];
1296
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
1297
+ return { value: ret.length > 0 ? ret : void 0 };
1298
+ }
1299
+ function bindingifyRenderChunkFilter(filterOption) {
1300
+ if (!filterOption) return void 0;
1301
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
1302
+ return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
1090
1303
  }
1091
1304
 
1092
1305
  //#endregion
@@ -1152,12 +1365,12 @@ function wrap(result, sourceText) {
1152
1365
  }
1153
1366
  function normalizeParseError(sourceText, errors) {
1154
1367
  let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
1155
- for (let i = 0; i < errors.length; i++) {
1156
- if (i >= 5) {
1368
+ for (let i$1 = 0; i$1 < errors.length; i$1++) {
1369
+ if (i$1 >= 5) {
1157
1370
  message += "\n...";
1158
1371
  break;
1159
1372
  }
1160
- const e = errors[i];
1373
+ const e = errors[i$1];
1161
1374
  message += e.message + "\n" + e.labels.map((label) => {
1162
1375
  const location = locate(sourceText, label.start, { offsetLine: 1 });
1163
1376
  if (!location) return;
@@ -1197,39 +1410,37 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1197
1410
  this.data = data;
1198
1411
  this.onLog = onLog;
1199
1412
  this.currentLoadingModule = currentLoadingModule;
1200
- this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
1413
+ this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
1201
1414
  }
1202
1415
  async load(options) {
1203
- const id = options.id;
1204
- if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
1205
- const moduleInfo = this.data.getModuleInfo(id, this.context);
1416
+ const id$1 = options.id;
1417
+ if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
1418
+ const moduleInfo = this.data.getModuleInfo(id$1, this.context);
1206
1419
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
1207
1420
  const rawOptions = {
1208
1421
  meta: options.meta || {},
1209
1422
  moduleSideEffects: options.moduleSideEffects || null,
1210
1423
  invalidate: false
1211
1424
  };
1212
- this.data.updateModuleOption(id, rawOptions);
1425
+ this.data.updateModuleOption(id$1, rawOptions);
1213
1426
  async function createLoadModulePromise(context, data) {
1214
- const loadPromise = data.loadModulePromiseMap.get(id);
1427
+ const loadPromise = data.loadModulePromiseMap.get(id$1);
1215
1428
  if (loadPromise) return loadPromise;
1216
- let resolveFn;
1217
1429
  const promise = new Promise((resolve, _) => {
1218
- resolveFn = resolve;
1430
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve);
1219
1431
  });
1220
- data.loadModulePromiseMap.set(id, promise);
1432
+ data.loadModulePromiseMap.set(id$1, promise);
1221
1433
  try {
1222
- await context.load(id, bindingifySideEffects(options.moduleSideEffects), (_success) => {
1223
- resolveFn();
1224
- });
1434
+ await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
1225
1435
  } catch (e) {
1226
- data.loadModulePromiseMap.delete(id);
1436
+ data.loadModulePromiseMap.delete(id$1);
1437
+ data.loadModulePromiseResolveFnMap.delete(id$1);
1227
1438
  throw e;
1228
1439
  }
1229
1440
  return promise;
1230
1441
  }
1231
1442
  await createLoadModulePromise(this.context, this.data);
1232
- return this.data.getModuleInfo(id, this.context);
1443
+ return this.data.getModuleInfo(id$1, this.context);
1233
1444
  }
1234
1445
  async resolve(source, importer, options) {
1235
1446
  let receipt = void 0;
@@ -1272,8 +1483,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1272
1483
  getModuleIds() {
1273
1484
  return this.data.getModuleIds(this.context);
1274
1485
  }
1275
- addWatchFile(id) {
1276
- this.context.addWatchFile(id);
1486
+ addWatchFile(id$1) {
1487
+ this.context.addWatchFile(id$1);
1277
1488
  }
1278
1489
  parse(input, options) {
1279
1490
  return parseAst(input, options);
@@ -1407,18 +1618,18 @@ function bindingifyTransform(args) {
1407
1618
  if (!hook) return {};
1408
1619
  const { handler, meta, options } = normalizeHook(hook);
1409
1620
  return {
1410
- plugin: async (ctx, code, id, meta$1) => {
1411
- const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel, args.watchMode), code, id, meta$1);
1621
+ plugin: async (ctx, code$1, id$1, meta$1) => {
1622
+ const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id$1, code$1, args.onLog, args.logLevel, args.watchMode), code$1, id$1, meta$1);
1412
1623
  if (ret == null) return void 0;
1413
1624
  if (typeof ret === "string") return { code: ret };
1414
- let moduleOption = args.pluginContextData.updateModuleOption(id, {
1625
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
1415
1626
  meta: ret.meta ?? {},
1416
1627
  moduleSideEffects: ret.moduleSideEffects ?? null,
1417
1628
  invalidate: false
1418
1629
  });
1419
1630
  return {
1420
1631
  code: ret.code,
1421
- map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id, code, ret.map)),
1632
+ map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
1422
1633
  sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
1423
1634
  moduleType: ret.moduleType
1424
1635
  };
@@ -1432,16 +1643,16 @@ function bindingifyLoad(args) {
1432
1643
  if (!hook) return {};
1433
1644
  const { handler, meta, options } = normalizeHook(hook);
1434
1645
  return {
1435
- plugin: async (ctx, id) => {
1436
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
1646
+ plugin: async (ctx, id$1) => {
1647
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
1437
1648
  if (ret == null) return;
1438
1649
  if (typeof ret === "string") return { code: ret };
1439
- let moduleOption = args.pluginContextData.updateModuleOption(id, {
1650
+ let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
1440
1651
  meta: ret.meta || {},
1441
1652
  moduleSideEffects: ret.moduleSideEffects ?? null,
1442
1653
  invalidate: false
1443
1654
  });
1444
- let map = preProcessSourceMap(ret, id);
1655
+ let map = preProcessSourceMap(ret, id$1);
1445
1656
  return {
1446
1657
  code: ret.code,
1447
1658
  map: bindingifySourcemap$1(map),
@@ -1453,11 +1664,11 @@ function bindingifyLoad(args) {
1453
1664
  filter: bindingifyLoadFilter(options.filter)
1454
1665
  };
1455
1666
  }
1456
- function preProcessSourceMap(ret, id) {
1667
+ function preProcessSourceMap(ret, id$1) {
1457
1668
  if (!ret.map) return;
1458
1669
  let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
1459
1670
  if (!isEmptySourcemapFiled(map.sources)) {
1460
- const directory = path.dirname(id) || ".";
1671
+ const directory = path.dirname(id$1) || ".";
1461
1672
  const sourceRoot = map.sourceRoot || ".";
1462
1673
  map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
1463
1674
  }
@@ -1531,9 +1742,9 @@ function transformRenderedChunk(chunk) {
1531
1742
  }
1532
1743
  function transformChunkModules(modules) {
1533
1744
  const result = {};
1534
- for (let i = 0; i < modules.values.length; i++) {
1535
- let key = modules.keys[i];
1536
- const mod = modules.values[i];
1745
+ for (let i$1 = 0; i$1 < modules.values.length; i$1++) {
1746
+ let key = modules.keys[i$1];
1747
+ const mod = modules.values[i$1];
1537
1748
  result[key] = transformToRenderedModule(mod);
1538
1749
  }
1539
1750
  return result;
@@ -1881,11 +2092,11 @@ function bindingifyRenderStart(args) {
1881
2092
  function bindingifyRenderChunk(args) {
1882
2093
  const hook = args.plugin.renderChunk;
1883
2094
  if (!hook) return {};
1884
- const { handler, meta } = normalizeHook(hook);
2095
+ const { handler, meta, options } = normalizeHook(hook);
1885
2096
  return {
1886
- plugin: async (ctx, code, chunk, opts, meta$1) => {
2097
+ plugin: async (ctx, code$1, chunk, opts, meta$1) => {
1887
2098
  if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
1888
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
2099
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
1889
2100
  if (ret == null) return;
1890
2101
  if (typeof ret === "string") return { code: ret };
1891
2102
  if (!ret.map) return { code: ret.code };
@@ -1894,7 +2105,8 @@ function bindingifyRenderChunk(args) {
1894
2105
  map: bindingifySourcemap$1(ret.map)
1895
2106
  };
1896
2107
  },
1897
- meta: bindingifyPluginHookMeta(meta)
2108
+ meta: bindingifyPluginHookMeta(meta),
2109
+ filter: bindingifyRenderChunkFilter(options.filter)
1898
2110
  };
1899
2111
  }
1900
2112
  function bindingifyAugmentChunkHash(args) {
@@ -2020,8 +2232,8 @@ function bindingifyWatchChange(args) {
2020
2232
  if (!hook) return {};
2021
2233
  const { handler, meta } = normalizeHook(hook);
2022
2234
  return {
2023
- plugin: async (ctx, id, event) => {
2024
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
2235
+ plugin: async (ctx, id$1, event) => {
2236
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
2025
2237
  },
2026
2238
  meta: bindingifyPluginHookMeta(meta)
2027
2239
  };
@@ -2119,7 +2331,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2119
2331
  const { plugin: transform$1, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
2120
2332
  const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
2121
2333
  const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2122
- const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
2334
+ const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
2123
2335
  const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
2124
2336
  const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2125
2337
  const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
@@ -2154,6 +2366,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2154
2366
  loadFilter,
2155
2367
  renderChunk,
2156
2368
  renderChunkMeta,
2369
+ renderChunkFilter,
2157
2370
  augmentChunkHash,
2158
2371
  augmentChunkHashMeta,
2159
2372
  renderStart,
@@ -2226,47 +2439,48 @@ var PluginContextData = class {
2226
2439
  moduleOptionMap = new Map();
2227
2440
  resolveOptionsMap = new Map();
2228
2441
  loadModulePromiseMap = new Map();
2442
+ loadModulePromiseResolveFnMap = new Map();
2229
2443
  renderedChunkMeta = null;
2230
- updateModuleOption(id, option) {
2231
- const existing = this.moduleOptionMap.get(id);
2444
+ updateModuleOption(id$1, option) {
2445
+ const existing = this.moduleOptionMap.get(id$1);
2232
2446
  if (existing) {
2233
2447
  if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
2234
2448
  if (option.meta != null) Object.assign(existing.meta, option.meta);
2235
2449
  if (option.invalidate != null) existing.invalidate = option.invalidate;
2236
2450
  } else {
2237
- this.moduleOptionMap.set(id, option);
2451
+ this.moduleOptionMap.set(id$1, option);
2238
2452
  return option;
2239
2453
  }
2240
2454
  return existing;
2241
2455
  }
2242
- getModuleOption(id) {
2243
- const option = this.moduleOptionMap.get(id);
2456
+ getModuleOption(id$1) {
2457
+ const option = this.moduleOptionMap.get(id$1);
2244
2458
  if (!option) {
2245
2459
  const raw = {
2246
2460
  moduleSideEffects: null,
2247
2461
  meta: {}
2248
2462
  };
2249
- this.moduleOptionMap.set(id, raw);
2463
+ this.moduleOptionMap.set(id$1, raw);
2250
2464
  return raw;
2251
2465
  }
2252
2466
  return option;
2253
2467
  }
2254
- getModuleInfo(id, context) {
2255
- const bindingInfo = context.getModuleInfo(id);
2468
+ getModuleInfo(id$1, context) {
2469
+ const bindingInfo = context.getModuleInfo(id$1);
2256
2470
  if (bindingInfo) {
2257
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
2258
- return this.proxyModuleInfo(id, info);
2471
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
2472
+ return this.proxyModuleInfo(id$1, info);
2259
2473
  }
2260
2474
  return null;
2261
2475
  }
2262
- proxyModuleInfo(id, info) {
2476
+ proxyModuleInfo(id$1, info) {
2263
2477
  let moduleSideEffects = info.moduleSideEffects;
2264
2478
  Object.defineProperty(info, "moduleSideEffects", {
2265
2479
  get() {
2266
2480
  return moduleSideEffects;
2267
2481
  },
2268
2482
  set: (v$1) => {
2269
- this.updateModuleOption(id, {
2483
+ this.updateModuleOption(id$1, {
2270
2484
  moduleSideEffects: v$1,
2271
2485
  meta: info.meta,
2272
2486
  invalidate: true
@@ -2297,9 +2511,14 @@ var PluginContextData = class {
2297
2511
  getRenderChunkMeta() {
2298
2512
  return this.renderedChunkMeta;
2299
2513
  }
2514
+ markModuleLoaded(id$1, _success) {
2515
+ const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
2516
+ if (resolve) resolve();
2517
+ }
2300
2518
  clear() {
2301
2519
  this.renderedChunkMeta = null;
2302
2520
  this.loadModulePromiseMap.clear();
2521
+ this.loadModulePromiseResolveFnMap.clear();
2303
2522
  }
2304
2523
  };
2305
2524
 
@@ -2363,7 +2582,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
2363
2582
  },
2364
2583
  makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
2365
2584
  debug: inputOptions.debug,
2366
- invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData)
2585
+ invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
2586
+ markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData)
2367
2587
  };
2368
2588
  }
2369
2589
  function bindingifyHmr(hmr) {
@@ -2374,15 +2594,15 @@ function bindingifyHmr(hmr) {
2374
2594
  }
2375
2595
  function bindingifyExternal(external) {
2376
2596
  if (external) {
2377
- if (typeof external === "function") return (id, importer, isResolved) => {
2378
- if (id.startsWith("\0")) return false;
2379
- return external(id, importer, isResolved) ?? false;
2597
+ if (typeof external === "function") return (id$1, importer, isResolved) => {
2598
+ if (id$1.startsWith("\0")) return false;
2599
+ return external(id$1, importer, isResolved) ?? false;
2380
2600
  };
2381
2601
  const externalArr = arraify(external);
2382
- return (id, _importer, _isResolved) => {
2602
+ return (id$1, _importer, _isResolved) => {
2383
2603
  return externalArr.some((pat) => {
2384
- if (pat instanceof RegExp) return pat.test(id);
2385
- return id === pat;
2604
+ if (pat instanceof RegExp) return pat.test(id$1);
2605
+ return id$1 === pat;
2386
2606
  });
2387
2607
  };
2388
2608
  }
@@ -2503,31 +2723,6 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
2503
2723
  };
2504
2724
  }
2505
2725
 
2506
- //#endregion
2507
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-D6FCK2GA.js
2508
- function u$1(o, n, a) {
2509
- let t$1 = (r) => o(r, ...n);
2510
- return a === void 0 ? t$1 : Object.assign(t$1, {
2511
- lazy: a,
2512
- lazyArgs: n
2513
- });
2514
- }
2515
-
2516
- //#endregion
2517
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-WIMGWYZL.js
2518
- function u(r, n, o) {
2519
- let a = r.length - n.length;
2520
- if (a === 0) return r(...n);
2521
- if (a === 1) return u$1(r, n, o);
2522
- throw new Error("Wrong number of arguments");
2523
- }
2524
-
2525
- //#endregion
2526
- //#region ../../node_modules/.pnpm/remeda@2.21.2/node_modules/remeda/dist/chunk-5NQBDF4H.js
2527
- function t(...n) {
2528
- return u(Object.keys, n);
2529
- }
2530
-
2531
2726
  //#endregion
2532
2727
  //#region src/utils/plugin/index.ts
2533
2728
  const isPluginHookName = function() {
@@ -2687,10 +2882,10 @@ function createComposedPlugin(plugins) {
2687
2882
  case "load": {
2688
2883
  if (batchedHooks.load) {
2689
2884
  const batchedHandlers = batchedHooks.load;
2690
- composed.load = async function(id) {
2885
+ composed.load = async function(id$1) {
2691
2886
  for (const [handler, plugin] of batchedHandlers) {
2692
2887
  const { handler: handlerFn } = normalizeHook(handler);
2693
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id);
2888
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
2694
2889
  if (!isNullish(result)) return result;
2695
2890
  }
2696
2891
  };
@@ -2700,11 +2895,11 @@ function createComposedPlugin(plugins) {
2700
2895
  case "transform": {
2701
2896
  if (batchedHooks.transform) {
2702
2897
  const batchedHandlers = batchedHooks.transform;
2703
- composed.transform = async function(initialCode, id, moduleType) {
2704
- let code = initialCode;
2898
+ composed.transform = async function(initialCode, id$1, moduleType$1) {
2899
+ let code$1 = initialCode;
2705
2900
  let moduleSideEffects = void 0;
2706
2901
  function updateOutput(newCode, newModuleSideEffects) {
2707
- code = newCode;
2902
+ code$1 = newCode;
2708
2903
  moduleSideEffects = newModuleSideEffects ?? void 0;
2709
2904
  }
2710
2905
  for (const [handler, plugin] of batchedHandlers) {
@@ -2712,14 +2907,14 @@ function createComposedPlugin(plugins) {
2712
2907
  this.getCombinedSourcemap = () => {
2713
2908
  throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
2714
2909
  };
2715
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
2910
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
2716
2911
  if (!isNullish(result)) {
2717
2912
  if (typeof result === "string") updateOutput(result);
2718
2913
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
2719
2914
  }
2720
2915
  }
2721
2916
  return {
2722
- code,
2917
+ code: code$1,
2723
2918
  moduleSideEffects
2724
2919
  };
2725
2920
  };
@@ -2741,10 +2936,10 @@ function createComposedPlugin(plugins) {
2741
2936
  case "renderChunk": {
2742
2937
  if (batchedHooks.renderChunk) {
2743
2938
  const batchedHandlers = batchedHooks.renderChunk;
2744
- composed.renderChunk = async function(code, chunk, options, meta) {
2939
+ composed.renderChunk = async function(code$1, chunk, options, meta) {
2745
2940
  for (const [handler, plugin] of batchedHandlers) {
2746
2941
  const { handler: handlerFn } = normalizeHook(handler);
2747
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, chunk, options, meta);
2942
+ const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
2748
2943
  if (!isNullish(result)) return result;
2749
2944
  }
2750
2945
  };
@@ -2781,10 +2976,10 @@ function createComposedPlugin(plugins) {
2781
2976
  case "watchChange": {
2782
2977
  if (batchedHooks.watchChange) {
2783
2978
  const batchedHandlers = batchedHooks.watchChange;
2784
- composed.watchChange = async function(id, event) {
2979
+ composed.watchChange = async function(id$1, event) {
2785
2980
  await Promise.all(batchedHandlers.map(([handler, plugin]) => {
2786
2981
  const { handler: handlerFn } = normalizeHook(handler);
2787
- return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id, event);
2982
+ return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
2788
2983
  }));
2789
2984
  };
2790
2985
  }
@@ -2993,8 +3188,8 @@ var WatcherEmitter = class {
2993
3188
  break;
2994
3189
  case "event":
2995
3190
  for (const listener of listeners) {
2996
- const code = event.bundleEventKind();
2997
- switch (code) {
3191
+ const code$1 = event.bundleEventKind();
3192
+ switch (code$1) {
2998
3193
  case "BUNDLE_END":
2999
3194
  const { duration, output } = event.bundleEndData();
3000
3195
  await listener({
@@ -3011,7 +3206,7 @@ var WatcherEmitter = class {
3011
3206
  });
3012
3207
  break;
3013
3208
  default:
3014
- await listener({ code });
3209
+ await listener({ code: code$1 });
3015
3210
  break;
3016
3211
  }
3017
3212
  }
@@ -3089,46 +3284,6 @@ const watch = (input) => {
3089
3284
  return emitter;
3090
3285
  };
3091
3286
 
3092
- //#endregion
3093
- //#region src/plugin/with-filter.ts
3094
- function withFilterImpl(pluginOption, filterObjectList) {
3095
- if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
3096
- if (pluginOption == false || pluginOption == null) return pluginOption;
3097
- if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
3098
- let plugin = pluginOption;
3099
- let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
3100
- if (filterObjectIndex === -1) return plugin;
3101
- let filterObject = filterObjectList[filterObjectIndex];
3102
- Object.keys(plugin).forEach((key) => {
3103
- switch (key) {
3104
- case "transform":
3105
- case "resolveId":
3106
- case "load":
3107
- if (!plugin[key]) return;
3108
- if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
3109
- else plugin[key] = {
3110
- handler: plugin[key],
3111
- filter: filterObject[key]
3112
- };
3113
- break;
3114
- default: break;
3115
- }
3116
- });
3117
- return plugin;
3118
- }
3119
- function withFilter(pluginOption, filterObject) {
3120
- return withFilterImpl(pluginOption, arraify(filterObject));
3121
- }
3122
- function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
3123
- if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
3124
- for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
3125
- let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
3126
- if (typeof pattern === "string" && pattern === pluginName) return i;
3127
- else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
3128
- }
3129
- return -1;
3130
- }
3131
-
3132
3287
  //#endregion
3133
3288
  //#region src/utils/define-config.ts
3134
3289
  function defineConfig(config) {
@@ -3140,4 +3295,4 @@ function defineConfig(config) {
3140
3295
  const VERSION = version;
3141
3296
 
3142
3297
  //#endregion
3143
- export { VERSION, build, defineConfig, rolldown, watch, withFilter };
3298
+ export { VERSION, build, defineConfig, rolldown, watch };