@rolldown/browser 1.0.0-beta.10-commit.885ee53 → 1.0.0-beta.10-commit.bf212da

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 (37) hide show
  1. package/dist/cli.cjs +5 -5
  2. package/dist/cli.mjs +1077 -1036
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.mts +2 -2
  5. package/dist/config.mjs +5 -4
  6. package/dist/experimental-index.browser.mjs +1 -1
  7. package/dist/experimental-index.cjs +2 -2
  8. package/dist/experimental-index.d.mts +2 -2
  9. package/dist/experimental-index.mjs +14 -3
  10. package/dist/filter-index.d.mts +2 -2
  11. package/dist/filter-index.mjs +2 -1
  12. package/dist/index.browser.mjs +1 -1
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -3
  16. package/dist/parallel-plugin-worker.cjs +2 -2
  17. package/dist/parallel-plugin-worker.mjs +33 -27
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/parse-ast-index.mjs +2 -1
  22. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  23. package/dist/shared/chunk-DSsiIF1Z.mjs +30 -0
  24. package/dist/shared/{define-config-cqCLLLZ-.d.mts → define-config-BIXBk1MV.d.mts} +1 -1
  25. package/dist/shared/dist-DeDsdiza.mjs +153 -0
  26. package/dist/shared/{load-config-F7nMcxMb.mjs → load-config--2oCCJCi.mjs} +19 -14
  27. package/dist/shared/{load-config-0bnuUeT5.cjs → load-config-CrWUKkBw.cjs} +1 -1
  28. package/dist/shared/{parse-ast-index-C31FpvkE.mjs → parse-ast-index-B3Tue26H.mjs} +28 -10
  29. package/dist/shared/{parse-ast-index-BuelS_NF.cjs → parse-ast-index-DL8_b_QU.cjs} +1 -1
  30. package/dist/shared/prompt-jPdbaKAj.mjs +854 -0
  31. package/dist/shared/{src-6t_bV_L5.mjs → src-_MeBFVb3.mjs} +1422 -1132
  32. package/dist/shared/{src-B3FAi7gC.cjs → src-heZFfrWc.cjs} +86 -16
  33. package/dist/{src-1eaUHc8G.js → src-DOq2164b.js} +6 -6
  34. package/package.json +1 -1
  35. package/dist/shared/dist-BoWaIc-K.mjs +0 -147
  36. package/dist/shared/prompt-C3zHEaSG.mjs +0 -852
  37. /package/dist/shared/{binding-Dod8fhx9.d.mts → binding-CHPrEDXp.d.mts} +0 -0
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
2
  const require_dist = require('./dist-BMVjvV-v.cjs');
3
- const require_parse_ast_index = require('./parse-ast-index-BuelS_NF.cjs');
3
+ const require_parse_ast_index = require('./parse-ast-index-DL8_b_QU.cjs');
4
4
  const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
6
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -8,7 +8,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
8
8
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
9
9
 
10
10
  //#region package.json
11
- var version = "1.0.0-beta.10-commit.885ee53";
11
+ var version = "1.0.0-beta.10-commit.bf212da";
12
12
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
13
 
14
14
  //#endregion
@@ -1409,11 +1409,15 @@ function safeParse(schema, input, config2) {
1409
1409
  }
1410
1410
 
1411
1411
  //#endregion
1412
- //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.2.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
1413
- var store;
1414
- function getGlobalDefs() {
1415
- return store;
1416
- }
1412
+ //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
1413
+ /**
1414
+ * Adds an error message to the errors array.
1415
+ *
1416
+ * @param errors The array of error messages.
1417
+ * @param message The error message to add.
1418
+ *
1419
+ * @returns The new errors.
1420
+ */
1417
1421
  function addError(errors, message) {
1418
1422
  if (errors) {
1419
1423
  errors.push(message);
@@ -1421,6 +1425,12 @@ function addError(errors, message) {
1421
1425
  }
1422
1426
  return [message];
1423
1427
  }
1428
+ /**
1429
+ * Throws an error or logs a warning based on the configuration.
1430
+ *
1431
+ * @param message The message to throw or log.
1432
+ * @param config The conversion configuration.
1433
+ */
1424
1434
  function handleError(message, config) {
1425
1435
  switch (config?.errorMode) {
1426
1436
  case "ignore": break;
@@ -1431,7 +1441,17 @@ function handleError(message, config) {
1431
1441
  default: throw new Error(message);
1432
1442
  }
1433
1443
  }
1444
+ /**
1445
+ * Converts any supported Valibot action to the JSON Schema format.
1446
+ *
1447
+ * @param jsonSchema The JSON Schema object.
1448
+ * @param valibotAction The Valibot action object.
1449
+ * @param config The conversion configuration.
1450
+ *
1451
+ * @returns The converted JSON Schema.
1452
+ */
1434
1453
  function convertAction(jsonSchema, valibotAction, config) {
1454
+ if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
1435
1455
  let errors;
1436
1456
  switch (valibotAction.type) {
1437
1457
  case "base64": {
@@ -1594,7 +1614,28 @@ function convertAction(jsonSchema, valibotAction, config) {
1594
1614
  if (errors) for (const message of errors) handleError(message, config);
1595
1615
  return jsonSchema;
1596
1616
  }
1597
- var refCount = 0;
1617
+ /**
1618
+ * Flattens a Valibot pipe by recursively expanding nested pipes.
1619
+ *
1620
+ * @param pipe The pipeline to flatten.
1621
+ *
1622
+ * @returns A flat pipeline.
1623
+ */
1624
+ function flattenPipe(pipe$1) {
1625
+ return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
1626
+ }
1627
+ let refCount = 0;
1628
+ /**
1629
+ * Converts any supported Valibot schema to the JSON Schema format.
1630
+ *
1631
+ * @param jsonSchema The JSON Schema object.
1632
+ * @param valibotSchema The Valibot schema object.
1633
+ * @param config The conversion configuration.
1634
+ * @param context The conversion context.
1635
+ * @param skipRef Whether to skip using a reference.
1636
+ *
1637
+ * @returns The converted JSON Schema.
1638
+ */
1598
1639
  function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
1599
1640
  if (!skipRef) {
1600
1641
  const referenceId = context.referenceMap.get(valibotSchema);
@@ -1613,10 +1654,20 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1613
1654
  }
1614
1655
  }
1615
1656
  if ("pipe" in valibotSchema) {
1616
- for (let index = 0; index < valibotSchema.pipe.length; index++) {
1617
- const valibotPipeItem = valibotSchema.pipe[index];
1657
+ const flatPipe = flattenPipe(valibotSchema.pipe);
1658
+ let startIndex = 0;
1659
+ let stopIndex = flatPipe.length - 1;
1660
+ if (config?.typeMode === "input") {
1661
+ const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "parse_json" || item.type === "raw_transform" || item.type === "reduce_items" || item.type === "stringify_json" || item.type === "transform"));
1662
+ if (inputStopIndex !== -1) stopIndex = inputStopIndex;
1663
+ } else if (config?.typeMode === "output") {
1664
+ const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
1665
+ if (outputStartIndex !== -1) startIndex = outputStartIndex;
1666
+ }
1667
+ for (let index = startIndex; index <= stopIndex; index++) {
1668
+ const valibotPipeItem = flatPipe[index];
1618
1669
  if (valibotPipeItem.kind === "schema") {
1619
- if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
1670
+ if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
1620
1671
  jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
1621
1672
  } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
1622
1673
  }
@@ -1735,7 +1786,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1735
1786
  const refOverride = config.overrideRef({
1736
1787
  ...context,
1737
1788
  referenceId,
1738
- valibotSchema,
1789
+ valibotSchema: wrappedValibotSchema,
1739
1790
  jsonSchema
1740
1791
  });
1741
1792
  if (refOverride) jsonSchema.$ref = refOverride;
@@ -1757,6 +1808,25 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1757
1808
  if (errors) for (const message of errors) handleError(message, config);
1758
1809
  return jsonSchema;
1759
1810
  }
1811
+ let store;
1812
+ /**
1813
+ * Returns the current global schema definitions.
1814
+ *
1815
+ * @returns The schema definitions.
1816
+ *
1817
+ * @beta
1818
+ */
1819
+ function getGlobalDefs() {
1820
+ return store;
1821
+ }
1822
+ /**
1823
+ * Converts a Valibot schema to the JSON Schema format.
1824
+ *
1825
+ * @param schema The Valibot schema object.
1826
+ * @param config The JSON Schema configuration.
1827
+ *
1828
+ * @returns The converted JSON Schema.
1829
+ */
1760
1830
  function toJsonSchema(schema, config) {
1761
1831
  const context = {
1762
1832
  definitions: {},
@@ -2426,7 +2496,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2426
2496
  }
2427
2497
 
2428
2498
  //#endregion
2429
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-D6FCK2GA.js
2499
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2430
2500
  function u$1(o$1, n$1, a$2) {
2431
2501
  let t$2 = (r$1) => o$1(r$1, ...n$1);
2432
2502
  return a$2 === void 0 ? t$2 : Object.assign(t$2, {
@@ -2436,7 +2506,7 @@ function u$1(o$1, n$1, a$2) {
2436
2506
  }
2437
2507
 
2438
2508
  //#endregion
2439
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-WIMGWYZL.js
2509
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2440
2510
  function u(r$1, n$1, o$1) {
2441
2511
  let a$2 = r$1.length - n$1.length;
2442
2512
  if (a$2 === 0) return r$1(...n$1);
@@ -2445,7 +2515,7 @@ function u(r$1, n$1, o$1) {
2445
2515
  }
2446
2516
 
2447
2517
  //#endregion
2448
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-3IFJP4R5.js
2518
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2449
2519
  function d(...r$1) {
2450
2520
  return u(i, r$1);
2451
2521
  }
@@ -2456,7 +2526,7 @@ var i = (r$1, t$2) => {
2456
2526
  };
2457
2527
 
2458
2528
  //#endregion
2459
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-5NQBDF4H.js
2529
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2460
2530
  function t(...n$1) {
2461
2531
  return u(Object.keys, n$1);
2462
2532
  }
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
 
29
29
  //#endregion
30
30
  //#region package.json
31
- var version = "1.0.0-beta.10-commit.885ee53";
31
+ var version = "1.0.0-beta.10-commit.bf212da";
32
32
 
33
33
  //#endregion
34
34
  //#region src/builtin-plugin/utils.ts
@@ -2322,7 +2322,7 @@ function exclude(expr) {
2322
2322
  }
2323
2323
 
2324
2324
  //#endregion
2325
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-D6FCK2GA.js
2325
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2326
2326
  function u$1(o$1, n$1, a$2) {
2327
2327
  let t$2 = (r$1) => o$1(r$1, ...n$1);
2328
2328
  return a$2 === void 0 ? t$2 : Object.assign(t$2, {
@@ -2332,7 +2332,7 @@ function u$1(o$1, n$1, a$2) {
2332
2332
  }
2333
2333
 
2334
2334
  //#endregion
2335
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-WIMGWYZL.js
2335
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2336
2336
  function u(r$1, n$1, o$1) {
2337
2337
  let a$2 = r$1.length - n$1.length;
2338
2338
  if (a$2 === 0) return r$1(...n$1);
@@ -2341,7 +2341,7 @@ function u(r$1, n$1, o$1) {
2341
2341
  }
2342
2342
 
2343
2343
  //#endregion
2344
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-3IFJP4R5.js
2344
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2345
2345
  function d(...r$1) {
2346
2346
  return u(i, r$1);
2347
2347
  }
@@ -2352,7 +2352,7 @@ var i = (r$1, t$2) => {
2352
2352
  };
2353
2353
 
2354
2354
  //#endregion
2355
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-5NQBDF4H.js
2355
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2356
2356
  function t(...n$1) {
2357
2357
  return u(Object.keys, n$1);
2358
2358
  }
@@ -2514,7 +2514,7 @@ function bindingPluginOrder(order) {
2514
2514
  }
2515
2515
 
2516
2516
  //#endregion
2517
- //#region ../../node_modules/.pnpm/oxc-parser@0.72.1/node_modules/oxc-parser/wrap.mjs
2517
+ //#region ../../node_modules/.pnpm/oxc-parser@0.72.2/node_modules/oxc-parser/wrap.mjs
2518
2518
  function wrap$1(result) {
2519
2519
  let program, module$1, comments, errors;
2520
2520
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.10-commit.885ee53",
3
+ "version": "1.0.0-beta.10-commit.bf212da",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",
@@ -1,147 +0,0 @@
1
- //#region src/utils/misc.ts
2
- function arraify(value) {
3
- return Array.isArray(value) ? value : [value];
4
- }
5
- function isNullish(value) {
6
- return value === null || value === void 0;
7
- }
8
- function isPromiseLike(value) {
9
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
10
- }
11
- function unimplemented(info) {
12
- if (info) throw new Error(`unimplemented: ${info}`);
13
- throw new Error("unimplemented");
14
- }
15
- function unreachable(info) {
16
- if (info) throw new Error(`unreachable: ${info}`);
17
- throw new Error("unreachable");
18
- }
19
- function unsupported(info) {
20
- throw new Error(`UNSUPPORTED: ${info}`);
21
- }
22
- function noop(..._args) {}
23
-
24
- //#endregion
25
- //#region ../pluginutils/dist/index.js
26
- var And = class {
27
- kind;
28
- args;
29
- constructor(...args) {
30
- if (args.length === 0) throw new Error("`And` expects at least one operand");
31
- this.args = args;
32
- this.kind = "and";
33
- }
34
- };
35
- var Or = class {
36
- kind;
37
- args;
38
- constructor(...args) {
39
- if (args.length === 0) throw new Error("`Or` expects at least one operand");
40
- this.args = args;
41
- this.kind = "or";
42
- }
43
- };
44
- var Not = class {
45
- kind;
46
- expr;
47
- constructor(expr) {
48
- this.expr = expr;
49
- this.kind = "not";
50
- }
51
- };
52
- var Id = class {
53
- kind;
54
- pattern;
55
- params;
56
- constructor(pattern, params) {
57
- this.pattern = pattern;
58
- this.kind = "id";
59
- this.params = params ?? { cleanUrl: false };
60
- }
61
- };
62
- var ModuleType = class {
63
- kind;
64
- pattern;
65
- constructor(pattern) {
66
- this.pattern = pattern;
67
- this.kind = "moduleType";
68
- }
69
- };
70
- var Code = class {
71
- kind;
72
- pattern;
73
- constructor(expr) {
74
- this.pattern = expr;
75
- this.kind = "code";
76
- }
77
- };
78
- var Query = class {
79
- kind;
80
- key;
81
- pattern;
82
- constructor(key, pattern) {
83
- this.pattern = pattern;
84
- this.key = key;
85
- this.kind = "query";
86
- }
87
- };
88
- var Include = class {
89
- kind;
90
- expr;
91
- constructor(expr) {
92
- this.expr = expr;
93
- this.kind = "include";
94
- }
95
- };
96
- var Exclude = class {
97
- kind;
98
- expr;
99
- constructor(expr) {
100
- this.expr = expr;
101
- this.kind = "exclude";
102
- }
103
- };
104
- function and(...args) {
105
- return new And(...args);
106
- }
107
- function or(...args) {
108
- return new Or(...args);
109
- }
110
- function not(expr) {
111
- return new Not(expr);
112
- }
113
- function id(pattern, params) {
114
- return new Id(pattern, params);
115
- }
116
- function moduleType(pattern) {
117
- return new ModuleType(pattern);
118
- }
119
- function code(pattern) {
120
- return new Code(pattern);
121
- }
122
- function query(key, pattern) {
123
- return new Query(key, pattern);
124
- }
125
- function include(expr) {
126
- return new Include(expr);
127
- }
128
- function exclude(expr) {
129
- return new Exclude(expr);
130
- }
131
- /**
132
- * convert a queryObject to FilterExpression like
133
- * ```js
134
- * and(query(k1, v1), query(k2, v2))
135
- * ```
136
- * @param queryFilterObject The query filter object needs to be matched.
137
- * @returns a `And` FilterExpression
138
- */
139
- function queries(queryFilter) {
140
- let arr = Object.entries(queryFilter).map(([key, value]) => {
141
- return new Query(key, value);
142
- });
143
- return and(...arr);
144
- }
145
-
146
- //#endregion
147
- export { and, arraify, code, exclude, id, include, isNullish, isPromiseLike, moduleType, noop, not, or, queries, query, unimplemented, unreachable, unsupported };