@rolldown/browser 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.10

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 (82) hide show
  1. package/dist/cli.mjs +961 -1551
  2. package/dist/config.d.mts +9 -6
  3. package/dist/config.mjs +9 -11
  4. package/dist/constructors-DsfxKD6A.js +68 -0
  5. package/dist/error-BeZaDkS8.js +157 -0
  6. package/dist/experimental-index.browser.mjs +278 -44
  7. package/dist/experimental-index.d.mts +228 -68
  8. package/dist/experimental-index.mjs +274 -55
  9. package/dist/experimental-runtime-types.d.ts +98 -0
  10. package/dist/filter-index.d.mts +104 -2
  11. package/dist/filter-index.mjs +144 -5
  12. package/dist/get-log-filter.d.mts +3 -0
  13. package/dist/get-log-filter.mjs +68 -0
  14. package/dist/index.browser.mjs +238 -3
  15. package/dist/index.d.mts +4 -3
  16. package/dist/index.mjs +53 -6
  17. package/dist/{shared/parse-ast-index-BHaE0ECV.cjs → normalize-string-or-regex-TtAGUp42.js} +74 -147
  18. package/dist/parallel-plugin-worker.mjs +27 -35
  19. package/dist/parallel-plugin.d.mts +7 -7
  20. package/dist/parallel-plugin.mjs +1 -2
  21. package/dist/parse-ast-index.d.mts +28 -5
  22. package/dist/parse-ast-index.mjs +60 -4
  23. package/dist/plugins-index.browser.mjs +40 -0
  24. package/dist/plugins-index.d.mts +33 -0
  25. package/dist/plugins-index.mjs +40 -0
  26. package/dist/resolve-tsconfig-DThkUPSZ.js +112 -0
  27. package/dist/rolldown-binding.wasi-browser.js +46 -24
  28. package/dist/rolldown-binding.wasi.cjs +67 -24
  29. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  30. package/dist/rolldown-build-Chx5S-TB.js +5349 -0
  31. package/dist/shared/bindingify-input-options-Czbczr8Z.mjs +2168 -0
  32. package/dist/shared/composable-filters-B2ByPP8y.mjs +224 -0
  33. package/dist/shared/constructors-BVnf_fH1.d.mts +37 -0
  34. package/dist/shared/constructors-CemeNi29.mjs +68 -0
  35. package/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  36. package/dist/shared/define-config-i6TWE2hm.d.mts +3855 -0
  37. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  38. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  39. package/dist/shared/{load-config-D7UduHRZ.mjs → load-config-CxvL5JxT.mjs} +32 -36
  40. package/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  41. package/dist/shared/{parse-ast-index-vu376yZ1.mjs → logs-D80CXhvg.mjs} +25 -123
  42. package/dist/shared/normalize-string-or-regex-CF3Uz6aU.mjs +57 -0
  43. package/dist/shared/parse-CRhjbrcT.mjs +73 -0
  44. package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-BYQIwEjg.mjs} +301 -310
  45. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  46. package/dist/shared/rolldown-C3wFxOwq.mjs +40 -0
  47. package/dist/shared/rolldown-build-ChZOz6BP.mjs +3318 -0
  48. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  49. package/dist/shared/types-Cx3HYorz.d.mts +1302 -0
  50. package/dist/shared/utils-6wxe_LMG.d.mts +22 -0
  51. package/dist/shared/watch-C1jC1oFT.mjs +373 -0
  52. package/dist/utils-index.browser.mjs +2414 -0
  53. package/dist/utils-index.d.mts +374 -0
  54. package/dist/utils-index.mjs +2415 -0
  55. package/package.json +33 -38
  56. package/dist/cli.cjs +0 -1748
  57. package/dist/cli.d.cts +0 -1
  58. package/dist/config.cjs +0 -12
  59. package/dist/config.d.cts +0 -11
  60. package/dist/experimental-index.cjs +0 -129
  61. package/dist/experimental-index.d.cts +0 -96
  62. package/dist/filter-index.cjs +0 -53
  63. package/dist/filter-index.d.cts +0 -3
  64. package/dist/index.cjs +0 -9
  65. package/dist/index.d.cts +0 -3
  66. package/dist/parallel-plugin-worker.cjs +0 -33
  67. package/dist/parallel-plugin-worker.d.cts +0 -1
  68. package/dist/parallel-plugin.cjs +0 -8
  69. package/dist/parallel-plugin.d.cts +0 -14
  70. package/dist/parse-ast-index.cjs +0 -4
  71. package/dist/parse-ast-index.d.cts +0 -9
  72. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  73. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  74. package/dist/shared/define-config.d-D4lKXE9V.d.cts +0 -1165
  75. package/dist/shared/define-config.d-Dm9iNdt9.d.mts +0 -1165
  76. package/dist/shared/dist-BMVjvV-v.cjs +0 -249
  77. package/dist/shared/dist-CAn6dxW6.mjs +0 -153
  78. package/dist/shared/load-config-CtKjQ8Mn.cjs +0 -125
  79. package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
  80. package/dist/shared/src-D0nc44MQ.mjs +0 -4691
  81. package/dist/shared/src-s89s870G.cjs +0 -4647
  82. package/dist/src-CeWghjQt.js +0 -4329
@@ -0,0 +1,112 @@
1
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-CQ6njWsV.mjs";
2
+ import { TsconfigCache, collapseSourcemaps, enhancedTransform, enhancedTransformSync, minify, minifySync, resolveTsconfig } from "../rolldown-binding.wasi.cjs";
3
+ //#region src/utils/minify.ts
4
+ /**
5
+ * Minify asynchronously.
6
+ *
7
+ * Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
8
+ *
9
+ * @category Utilities
10
+ * @experimental
11
+ */
12
+ async function minify$1(filename, sourceText, options) {
13
+ const inputMap = bindingifySourcemap(options?.inputMap);
14
+ const result = await minify(filename, sourceText, options);
15
+ if (result.map && inputMap) result.map = {
16
+ version: 3,
17
+ ...collapseSourcemaps([inputMap, bindingifySourcemap(result.map)])
18
+ };
19
+ return result;
20
+ }
21
+ /**
22
+ * Minify synchronously.
23
+ *
24
+ * @category Utilities
25
+ * @experimental
26
+ */
27
+ function minifySync$1(filename, sourceText, options) {
28
+ const inputMap = bindingifySourcemap(options?.inputMap);
29
+ const result = minifySync(filename, sourceText, options);
30
+ if (result.map && inputMap) result.map = {
31
+ version: 3,
32
+ ...collapseSourcemaps([inputMap, bindingifySourcemap(result.map)])
33
+ };
34
+ return result;
35
+ }
36
+ //#endregion
37
+ //#region src/utils/transform.ts
38
+ const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
39
+ /**
40
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
41
+ *
42
+ * Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
43
+ *
44
+ * @param filename The name of the file being transformed. If this is a
45
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
46
+ * @param sourceText The source code to transform.
47
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
48
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
49
+ * Only used when `options.tsconfig` is `true`.
50
+ *
51
+ * @returns a promise that resolves to an object containing the transformed code,
52
+ * source maps, and any errors that occurred during parsing or transformation.
53
+ *
54
+ * @category Utilities
55
+ * @experimental
56
+ */
57
+ async function transform(filename, sourceText, options, cache) {
58
+ const result = await enhancedTransform(filename, sourceText, options, cache, yarnPnp$1);
59
+ return {
60
+ ...result,
61
+ errors: result.errors.map(normalizeBindingError),
62
+ warnings: result.warnings.map((w) => w.field0)
63
+ };
64
+ }
65
+ /**
66
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
67
+ *
68
+ * @param filename The name of the file being transformed. If this is a
69
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
70
+ * @param sourceText The source code to transform.
71
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
72
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
73
+ * Only used when `options.tsconfig` is `true`.
74
+ *
75
+ * @returns an object containing the transformed code, source maps, and any errors
76
+ * that occurred during parsing or transformation.
77
+ *
78
+ * @category Utilities
79
+ * @experimental
80
+ */
81
+ function transformSync(filename, sourceText, options, cache) {
82
+ const result = enhancedTransformSync(filename, sourceText, options, cache, yarnPnp$1);
83
+ return {
84
+ ...result,
85
+ errors: result.errors.map(normalizeBindingError),
86
+ warnings: result.warnings.map((w) => w.field0)
87
+ };
88
+ }
89
+ //#endregion
90
+ //#region src/utils/resolve-tsconfig.ts
91
+ const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
92
+ /**
93
+ * Cache for tsconfig resolution to avoid redundant file system operations.
94
+ *
95
+ * The cache stores resolved tsconfig configurations keyed by their file paths.
96
+ * When transforming multiple files in the same project, tsconfig lookups are
97
+ * deduplicated, improving performance.
98
+ *
99
+ * @category Utilities
100
+ * @experimental
101
+ */
102
+ var TsconfigCache$1 = class extends TsconfigCache {
103
+ constructor() {
104
+ super(yarnPnp);
105
+ }
106
+ };
107
+ /** @hidden This is only expected to be used by Vite */
108
+ function resolveTsconfig$1(filename, cache) {
109
+ return resolveTsconfig(filename, cache, yarnPnp);
110
+ }
111
+ //#endregion
112
+ export { minify$1 as a, transformSync as i, resolveTsconfig$1 as n, minifySync$1 as o, transform as r, TsconfigCache$1 as t };
@@ -0,0 +1,40 @@
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-ChZOz6BP.mjs";
2
+ //#region src/api/rolldown/index.ts
3
+ /**
4
+ * The API compatible with Rollup's `rollup` function.
5
+ *
6
+ * Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
7
+ *
8
+ * @param input The input options object.
9
+ * @returns A Promise that resolves to a bundle object.
10
+ *
11
+ * @example
12
+ * ```js
13
+ * import { rolldown } from 'rolldown';
14
+ *
15
+ * let bundle, failed = false;
16
+ * try {
17
+ * bundle = await rolldown({
18
+ * input: 'src/main.js',
19
+ * });
20
+ * await bundle.write({
21
+ * format: 'esm',
22
+ * });
23
+ * } catch (e) {
24
+ * console.error(e);
25
+ * failed = true;
26
+ * }
27
+ * if (bundle) {
28
+ * await bundle.close();
29
+ * }
30
+ * process.exitCode = failed ? 1 : 0;
31
+ * ```
32
+ *
33
+ * @category Programmatic APIs
34
+ */
35
+ const rolldown = async (input) => {
36
+ validateOption("input", input);
37
+ return new RolldownBuild(await PluginDriver.callOptionsHook(input));
38
+ };
39
+ //#endregion
40
+ export { rolldown as t };