rolldown 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 (32) hide show
  1. package/dist/cli.cjs +5 -5
  2. package/dist/cli.mjs +1075 -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.cjs +2 -2
  7. package/dist/experimental-index.d.mts +2 -2
  8. package/dist/experimental-index.mjs +12 -3
  9. package/dist/filter-index.d.mts +2 -2
  10. package/dist/filter-index.mjs +2 -1
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.mjs +4 -3
  14. package/dist/parallel-plugin-worker.cjs +2 -2
  15. package/dist/parallel-plugin-worker.mjs +34 -28
  16. package/dist/parallel-plugin.d.mts +2 -2
  17. package/dist/parse-ast-index.cjs +1 -1
  18. package/dist/parse-ast-index.d.mts +1 -1
  19. package/dist/parse-ast-index.mjs +2 -1
  20. package/dist/shared/chunk--iN_1bjD.mjs +33 -0
  21. package/dist/shared/{define-config-CpexVifn.d.mts → define-config-BL025qn5.d.mts} +1 -1
  22. package/dist/shared/{load-config-DTXGCmId.cjs → load-config-DEyy-phc.cjs} +1 -1
  23. package/dist/shared/{load-config-WuIFSl0A.mjs → load-config-ZOGX0N6a.mjs} +19 -14
  24. package/dist/shared/{misc-BN0nse6C.mjs → misc-DGAe2XOW.mjs} +4 -1
  25. package/dist/shared/{parse-ast-index-PSQWLeSo.mjs → parse-ast-index-BkTjw5qC.mjs} +30 -40
  26. package/dist/shared/{parse-ast-index-BvK1MT-L.cjs → parse-ast-index-D7OUxwJp.cjs} +1 -1
  27. package/dist/shared/prompt-Dc0i9ubg.mjs +854 -0
  28. package/dist/shared/{src-DrHV5x1X.cjs → src-BOhIOXwi.cjs} +86 -16
  29. package/dist/shared/{src-BB5r5vkG.mjs → src-aebl8_bs.mjs} +1428 -1110
  30. package/package.json +20 -20
  31. package/dist/shared/prompt-C3zHEaSG.mjs +0 -852
  32. /package/dist/shared/{binding-Dod8fhx9.d.mts → binding-CHPrEDXp.d.mts} +0 -0
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
- const require_parse_ast_index = require('./parse-ast-index-BvK1MT-L.cjs');
2
+ const require_parse_ast_index = require('./parse-ast-index-D7OUxwJp.cjs');
3
3
  const require_misc = require('./misc-BKp5iIef.cjs');
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -9,7 +9,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
9
9
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
10
10
 
11
11
  //#region package.json
12
- var version = "1.0.0-beta.10-commit.885ee53";
12
+ var version = "1.0.0-beta.10-commit.bf212da";
13
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
14
14
 
15
15
  //#endregion
@@ -1411,11 +1411,15 @@ function safeParse(schema, input, config2) {
1411
1411
  }
1412
1412
 
1413
1413
  //#endregion
1414
- //#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
1415
- var store;
1416
- function getGlobalDefs() {
1417
- return store;
1418
- }
1414
+ //#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
1415
+ /**
1416
+ * Adds an error message to the errors array.
1417
+ *
1418
+ * @param errors The array of error messages.
1419
+ * @param message The error message to add.
1420
+ *
1421
+ * @returns The new errors.
1422
+ */
1419
1423
  function addError(errors, message) {
1420
1424
  if (errors) {
1421
1425
  errors.push(message);
@@ -1423,6 +1427,12 @@ function addError(errors, message) {
1423
1427
  }
1424
1428
  return [message];
1425
1429
  }
1430
+ /**
1431
+ * Throws an error or logs a warning based on the configuration.
1432
+ *
1433
+ * @param message The message to throw or log.
1434
+ * @param config The conversion configuration.
1435
+ */
1426
1436
  function handleError(message, config) {
1427
1437
  switch (config?.errorMode) {
1428
1438
  case "ignore": break;
@@ -1433,7 +1443,17 @@ function handleError(message, config) {
1433
1443
  default: throw new Error(message);
1434
1444
  }
1435
1445
  }
1446
+ /**
1447
+ * Converts any supported Valibot action to the JSON Schema format.
1448
+ *
1449
+ * @param jsonSchema The JSON Schema object.
1450
+ * @param valibotAction The Valibot action object.
1451
+ * @param config The conversion configuration.
1452
+ *
1453
+ * @returns The converted JSON Schema.
1454
+ */
1436
1455
  function convertAction(jsonSchema, valibotAction, config) {
1456
+ if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
1437
1457
  let errors;
1438
1458
  switch (valibotAction.type) {
1439
1459
  case "base64": {
@@ -1596,7 +1616,28 @@ function convertAction(jsonSchema, valibotAction, config) {
1596
1616
  if (errors) for (const message of errors) handleError(message, config);
1597
1617
  return jsonSchema;
1598
1618
  }
1599
- var refCount = 0;
1619
+ /**
1620
+ * Flattens a Valibot pipe by recursively expanding nested pipes.
1621
+ *
1622
+ * @param pipe The pipeline to flatten.
1623
+ *
1624
+ * @returns A flat pipeline.
1625
+ */
1626
+ function flattenPipe(pipe$1) {
1627
+ return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
1628
+ }
1629
+ let refCount = 0;
1630
+ /**
1631
+ * Converts any supported Valibot schema to the JSON Schema format.
1632
+ *
1633
+ * @param jsonSchema The JSON Schema object.
1634
+ * @param valibotSchema The Valibot schema object.
1635
+ * @param config The conversion configuration.
1636
+ * @param context The conversion context.
1637
+ * @param skipRef Whether to skip using a reference.
1638
+ *
1639
+ * @returns The converted JSON Schema.
1640
+ */
1600
1641
  function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
1601
1642
  if (!skipRef) {
1602
1643
  const referenceId = context.referenceMap.get(valibotSchema);
@@ -1615,10 +1656,20 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1615
1656
  }
1616
1657
  }
1617
1658
  if ("pipe" in valibotSchema) {
1618
- for (let index = 0; index < valibotSchema.pipe.length; index++) {
1619
- const valibotPipeItem = valibotSchema.pipe[index];
1659
+ const flatPipe = flattenPipe(valibotSchema.pipe);
1660
+ let startIndex = 0;
1661
+ let stopIndex = flatPipe.length - 1;
1662
+ if (config?.typeMode === "input") {
1663
+ 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"));
1664
+ if (inputStopIndex !== -1) stopIndex = inputStopIndex;
1665
+ } else if (config?.typeMode === "output") {
1666
+ const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
1667
+ if (outputStartIndex !== -1) startIndex = outputStartIndex;
1668
+ }
1669
+ for (let index = startIndex; index <= stopIndex; index++) {
1670
+ const valibotPipeItem = flatPipe[index];
1620
1671
  if (valibotPipeItem.kind === "schema") {
1621
- if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
1672
+ if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
1622
1673
  jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
1623
1674
  } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
1624
1675
  }
@@ -1737,7 +1788,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1737
1788
  const refOverride = config.overrideRef({
1738
1789
  ...context,
1739
1790
  referenceId,
1740
- valibotSchema,
1791
+ valibotSchema: wrappedValibotSchema,
1741
1792
  jsonSchema
1742
1793
  });
1743
1794
  if (refOverride) jsonSchema.$ref = refOverride;
@@ -1759,6 +1810,25 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1759
1810
  if (errors) for (const message of errors) handleError(message, config);
1760
1811
  return jsonSchema;
1761
1812
  }
1813
+ let store;
1814
+ /**
1815
+ * Returns the current global schema definitions.
1816
+ *
1817
+ * @returns The schema definitions.
1818
+ *
1819
+ * @beta
1820
+ */
1821
+ function getGlobalDefs() {
1822
+ return store;
1823
+ }
1824
+ /**
1825
+ * Converts a Valibot schema to the JSON Schema format.
1826
+ *
1827
+ * @param schema The Valibot schema object.
1828
+ * @param config The JSON Schema configuration.
1829
+ *
1830
+ * @returns The converted JSON Schema.
1831
+ */
1762
1832
  function toJsonSchema(schema, config) {
1763
1833
  const context = {
1764
1834
  definitions: {},
@@ -2318,7 +2388,7 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
2318
2388
  }
2319
2389
 
2320
2390
  //#endregion
2321
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-D6FCK2GA.js
2391
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2322
2392
  function u$1(o, n, a) {
2323
2393
  let t$1 = (r) => o(r, ...n);
2324
2394
  return a === void 0 ? t$1 : Object.assign(t$1, {
@@ -2328,7 +2398,7 @@ function u$1(o, n, a) {
2328
2398
  }
2329
2399
 
2330
2400
  //#endregion
2331
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-WIMGWYZL.js
2401
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2332
2402
  function u(r, n, o) {
2333
2403
  let a = r.length - n.length;
2334
2404
  if (a === 0) return r(...n);
@@ -2337,7 +2407,7 @@ function u(r, n, o) {
2337
2407
  }
2338
2408
 
2339
2409
  //#endregion
2340
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-3IFJP4R5.js
2410
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2341
2411
  function d(...r) {
2342
2412
  return u(i, r);
2343
2413
  }
@@ -2348,7 +2418,7 @@ var i = (r, t$1) => {
2348
2418
  };
2349
2419
 
2350
2420
  //#endregion
2351
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-5NQBDF4H.js
2421
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2352
2422
  function t(...n) {
2353
2423
  return u(Object.keys, n);
2354
2424
  }