@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.
Files changed (35) hide show
  1. package/dist/browser.mjs +113 -119
  2. package/dist/cli.cjs +7 -7
  3. package/dist/cli.mjs +3 -3
  4. package/dist/experimental-index.cjs +3 -3
  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 -3
  8. package/dist/filter-index.cjs +12 -0
  9. package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +2 -2
  10. package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +2 -2
  11. package/dist/filter-index.mjs +4 -0
  12. package/dist/index.cjs +4 -5
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -4
  16. package/dist/parallel-plugin-worker.cjs +3 -3
  17. package/dist/parallel-plugin-worker.mjs +3 -3
  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.wasm32-wasi.wasm +0 -0
  23. package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
  24. package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
  25. package/dist/shared/{input-options.d-D_2wMOSn.d.mts → input-options.d-9IzFBPMw.d.mts} +13 -16
  26. package/dist/shared/{input-options.d-C0G2toUx.d.cts → input-options.d-BFt2wKBM.d.cts} +13 -16
  27. package/dist/shared/{src-RM00Zc4c.mjs → src-DN1_B1_m.mjs} +53 -126
  28. package/dist/shared/{src-DbbYa-_8.cjs → src-glXqJCVJ.cjs} +64 -138
  29. package/package.json +1 -1
  30. package/dist/filter-expression-index.cjs +0 -11
  31. package/dist/filter-expression-index.mjs +0 -4
  32. package/dist/shared/filter-expression-index-CIS7Rrin.mjs +0 -69
  33. package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
  34. /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
  35. /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { __esm } from "./chunk-DSsiIF1Z.mjs";
2
- import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-DWHg_E7J.mjs";
3
- import { and, code, exclude, id, include, init_filter_expression_index, moduleType, or } from "./filter-expression-index-CIS7Rrin.mjs";
2
+ import { and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./filter-index-DmisSKZF.mjs";
3
+ import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-B5wGnMSg.mjs";
4
4
  import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
5
  import path from "node:path";
6
6
  import { toJsonSchema } from "@valibot/to-json-schema";
@@ -10,7 +10,7 @@ import { availableParallelism } from "node:os";
10
10
  import { Worker } from "node:worker_threads";
11
11
 
12
12
  //#region package.json
13
- var version = "1.0.0-beta.8-commit.852c603";
13
+ var version = "1.0.0-beta.8-commit.baf6ca1";
14
14
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
15
15
 
16
16
  //#endregion
@@ -102,31 +102,6 @@ var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
102
102
  };
103
103
  } });
104
104
 
105
- //#endregion
106
- //#region src/utils/misc.ts
107
- function arraify(value) {
108
- return Array.isArray(value) ? value : [value];
109
- }
110
- function isNullish(value) {
111
- return value === null || value === void 0;
112
- }
113
- function isPromiseLike(value) {
114
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
115
- }
116
- function unimplemented(info) {
117
- if (info) throw new Error(`unimplemented: ${info}`);
118
- throw new Error("unimplemented");
119
- }
120
- function unreachable(info) {
121
- if (info) throw new Error(`unreachable: ${info}`);
122
- throw new Error("unreachable");
123
- }
124
- function unsupported(info) {
125
- throw new Error(`UNSUPPORTED: ${info}`);
126
- }
127
- function noop(..._args) {}
128
- var init_misc = __esm({ "src/utils/misc.ts"() {} });
129
-
130
105
  //#endregion
131
106
  //#region src/log/logging.ts
132
107
  var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
@@ -274,7 +249,7 @@ var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
274
249
  //#endregion
275
250
  //#region src/constants/plugin.ts
276
251
  var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
277
- var init_plugin$2 = __esm({ "src/constants/plugin.ts"() {
252
+ var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
278
253
  ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
279
254
  "options",
280
255
  "buildStart",
@@ -363,7 +338,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
363
338
  var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX;
364
339
  var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
365
340
  init_constructors();
366
- init_plugin$2();
341
+ init_plugin$1();
367
342
  init_logging();
368
343
  init_logs();
369
344
  init_async_flatten();
@@ -2237,7 +2212,6 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
2237
2212
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2238
2213
  if (typeof matcher === "string" || matcher instanceof RegExp) return [include(id(matcher))];
2239
2214
  if (Array.isArray(matcher)) return matcher.map((m$10) => include(id(m$10)));
2240
- if (matcher.custom) return matcher.custom;
2241
2215
  let ret = [];
2242
2216
  let isCode = stringKind === "code";
2243
2217
  if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(isCode ? code(m$10) : id(m$10))));
@@ -2246,8 +2220,8 @@ function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
2246
2220
  }
2247
2221
  function transformFilterMatcherToFilterExprs(filterOption) {
2248
2222
  if (!filterOption) return void 0;
2249
- const { id: id$1, code: code$1, moduleType: moduleType$1, custom } = filterOption;
2250
- if (custom) return custom;
2223
+ if (Array.isArray(filterOption)) return filterOption;
2224
+ const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2251
2225
  let ret = [];
2252
2226
  let idIncludes = [];
2253
2227
  let idExcludes = [];
@@ -2257,33 +2231,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
2257
2231
  if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
2258
2232
  ret.push(...idExcludes);
2259
2233
  ret.push(...codeExcludes);
2260
- let cursor;
2234
+ let andExprList = [];
2261
2235
  if (moduleType$1) {
2262
2236
  let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
2263
- cursor = joinFilterExprsWithOr(moduleTypes.map((m$10) => moduleType(m$10)));
2264
- }
2265
- if (idIncludes.length) {
2266
- let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
2267
- if (!cursor) cursor = joinedOrExpr;
2268
- else cursor = and(cursor, joinedOrExpr);
2269
- }
2270
- if (codeIncludes.length) {
2271
- let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
2272
- if (!cursor) cursor = joinedOrExpr;
2273
- else cursor = and(cursor, joinedOrExpr);
2237
+ andExprList.push(or(...moduleTypes.map((m$10) => moduleType(m$10))));
2274
2238
  }
2275
- if (cursor) ret.push(include(cursor));
2239
+ if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
2240
+ if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
2241
+ if (andExprList.length) ret.push(include(and(...andExprList)));
2276
2242
  return ret;
2277
2243
  }
2278
- function joinFilterExprsWithOr(filterExprs) {
2279
- if (filterExprs.length === 1) return filterExprs[0];
2280
- return or(filterExprs[0], joinFilterExprsWithOr(filterExprs.slice(1)));
2281
- }
2282
- function bindingifyGeneralHookFilter(matcher, stringKind) {
2283
- let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
2284
- let custom = [];
2285
- if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
2286
- return { custom: custom.length > 0 ? custom : void 0 };
2244
+ function bindingifyGeneralHookFilter(stringKind, pattern) {
2245
+ let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
2246
+ let ret = [];
2247
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2248
+ return ret.length > 0 ? { value: ret } : void 0;
2287
2249
  }
2288
2250
  function bindingifyFilterExpr(expr) {
2289
2251
  let list = [];
@@ -2293,9 +2255,21 @@ function bindingifyFilterExpr(expr) {
2293
2255
  function bindingifyFilterExprImpl(expr, list) {
2294
2256
  switch (expr.kind) {
2295
2257
  case "and": {
2296
- bindingifyFilterExprImpl(expr.right, list);
2297
- bindingifyFilterExprImpl(expr.left, list);
2298
- list.push({ kind: "And" });
2258
+ let args = expr.args;
2259
+ for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
2260
+ list.push({
2261
+ kind: "And",
2262
+ payload: args.length
2263
+ });
2264
+ break;
2265
+ }
2266
+ case "or": {
2267
+ let args = expr.args;
2268
+ for (let i$22 = args.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args[i$22], list);
2269
+ list.push({
2270
+ kind: "Or",
2271
+ payload: args.length
2272
+ });
2299
2273
  break;
2300
2274
  }
2301
2275
  case "not": {
@@ -2306,21 +2280,21 @@ function bindingifyFilterExprImpl(expr, list) {
2306
2280
  case "id": {
2307
2281
  list.push({
2308
2282
  kind: "Id",
2309
- value: expr.pattern
2283
+ payload: expr.pattern
2310
2284
  });
2311
2285
  break;
2312
2286
  }
2313
2287
  case "moduleType": {
2314
2288
  list.push({
2315
2289
  kind: "ModuleType",
2316
- value: expr.pattern
2290
+ payload: expr.pattern
2317
2291
  });
2318
2292
  break;
2319
2293
  }
2320
2294
  case "code": {
2321
2295
  list.push({
2322
2296
  kind: "Code",
2323
- value: expr.pattern
2297
+ payload: expr.pattern
2324
2298
  });
2325
2299
  break;
2326
2300
  }
@@ -2334,31 +2308,34 @@ function bindingifyFilterExprImpl(expr, list) {
2334
2308
  list.push({ kind: "Exclude" });
2335
2309
  break;
2336
2310
  }
2337
- default: throw new Error(`Unknown filter expression kind: ${expr.kind}`);
2311
+ default: throw new Error(`Unknown filter expression: ${expr}`);
2338
2312
  }
2339
2313
  }
2340
2314
  function bindingifyResolveIdFilter(filterOption) {
2341
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2315
+ if (!filterOption) return void 0;
2316
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2317
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2342
2318
  }
2343
2319
  function bindingifyLoadFilter(filterOption) {
2344
- return filterOption?.id ? bindingifyGeneralHookFilter(filterOption.id, "id") : void 0;
2320
+ if (!filterOption) return void 0;
2321
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2322
+ return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2345
2323
  }
2346
2324
  function bindingifyTransformFilter(filterOption) {
2347
2325
  if (!filterOption) return void 0;
2348
- let custom = transformFilterMatcherToFilterExprs(filterOption);
2326
+ let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2349
2327
  let ret = [];
2350
- if (custom) ret = custom.map(bindingifyFilterExpr);
2351
- return { custom: ret.length > 0 ? ret : void 0 };
2328
+ if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2329
+ return { value: ret.length > 0 ? ret : void 0 };
2352
2330
  }
2353
2331
  function bindingifyRenderChunkFilter(filterOption) {
2354
- if (filterOption) {
2355
- const { code: code$1 } = filterOption;
2356
- return { custom: code$1 ? bindingifyGeneralHookFilter(code$1, "code").custom : void 0 };
2357
- }
2332
+ if (!filterOption) return void 0;
2333
+ if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2334
+ return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2358
2335
  }
2359
2336
  var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
2360
2337
  init_dist();
2361
- init_filter_expression_index();
2338
+ init_filter_index();
2362
2339
  init_misc();
2363
2340
  } });
2364
2341
 
@@ -3805,8 +3782,8 @@ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.
3805
3782
  //#endregion
3806
3783
  //#region src/utils/plugin/index.ts
3807
3784
  var isPluginHookName;
3808
- var init_plugin$1 = __esm({ "src/utils/plugin/index.ts"() {
3809
- init_plugin$2();
3785
+ var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
3786
+ init_plugin$1();
3810
3787
  isPluginHookName = function() {
3811
3788
  const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
3812
3789
  return function isPluginHookName$1(hookName) {
@@ -4116,7 +4093,7 @@ var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
4116
4093
  init_plugin_context$1();
4117
4094
  init_misc();
4118
4095
  init_normalize_hook();
4119
- init_plugin$1();
4096
+ init_plugin();
4120
4097
  unsupportedHookName = [
4121
4098
  "augmentChunkHash",
4122
4099
  "generateBundle",
@@ -4475,55 +4452,6 @@ var init_watch = __esm({ "src/api/watch/index.ts"() {
4475
4452
  };
4476
4453
  } });
4477
4454
 
4478
- //#endregion
4479
- //#region src/plugin/with-filter.ts
4480
- function withFilterImpl(pluginOption, filterObjectList) {
4481
- if (isPromiseLike(pluginOption)) return pluginOption.then((p$3) => withFilter(p$3, filterObjectList));
4482
- if (pluginOption == false || pluginOption == null) return pluginOption;
4483
- if (Array.isArray(pluginOption)) return pluginOption.map((p$3) => withFilter(p$3, filterObjectList));
4484
- let plugin = pluginOption;
4485
- let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
4486
- if (filterObjectIndex === -1) return plugin;
4487
- let filterObject = filterObjectList[filterObjectIndex];
4488
- Object.keys(plugin).forEach((key) => {
4489
- switch (key) {
4490
- case "transform":
4491
- case "resolveId":
4492
- case "load":
4493
- if (!plugin[key]) return;
4494
- if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
4495
- else plugin[key] = {
4496
- handler: plugin[key],
4497
- filter: filterObject[key]
4498
- };
4499
- break;
4500
- default: break;
4501
- }
4502
- });
4503
- return plugin;
4504
- }
4505
- function withFilter(pluginOption, filterObject) {
4506
- return withFilterImpl(pluginOption, arraify(filterObject));
4507
- }
4508
- function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
4509
- if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
4510
- 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++) {
4511
- let pattern = overrideFilterObjectList[i$22].pluginNamePattern[j$1];
4512
- if (typeof pattern === "string" && pattern === pluginName) return i$22;
4513
- else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$22;
4514
- }
4515
- return -1;
4516
- }
4517
- var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
4518
- init_misc();
4519
- } });
4520
-
4521
- //#endregion
4522
- //#region src/plugin/index.ts
4523
- var init_plugin = __esm({ "src/plugin/index.ts"() {
4524
- init_with_filter();
4525
- } });
4526
-
4527
4455
  //#endregion
4528
4456
  //#region src/utils/define-config.ts
4529
4457
  function defineConfig(config) {
@@ -4538,10 +4466,9 @@ var init_src = __esm({ "src/index.ts"() {
4538
4466
  init_build();
4539
4467
  init_rolldown();
4540
4468
  init_watch();
4541
- init_plugin();
4542
4469
  init_define_config();
4543
4470
  VERSION = version;
4544
4471
  } });
4545
4472
 
4546
4473
  //#endregion
4547
- export { BuiltinPlugin, PluginContextData, VERSION, arraify, 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_misc, 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, withFilter };
4474
+ 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 };