@rollipop/rolldown 0.0.0 → 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 (50) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +11 -1
  3. package/bin/cli.mjs +2 -0
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/cli.mjs +1191 -0
  6. package/dist/config.d.mts +14 -0
  7. package/dist/config.mjs +4 -0
  8. package/dist/experimental-index.d.mts +316 -0
  9. package/dist/experimental-index.mjs +350 -0
  10. package/dist/experimental-runtime-types.d.ts +98 -0
  11. package/dist/filter-index.d.mts +196 -0
  12. package/dist/filter-index.mjs +386 -0
  13. package/dist/get-log-filter.d.mts +3 -0
  14. package/dist/get-log-filter.mjs +68 -0
  15. package/dist/index.d.mts +4 -0
  16. package/dist/index.mjs +50 -0
  17. package/dist/parallel-plugin-worker.d.mts +1 -0
  18. package/dist/parallel-plugin-worker.mjs +28 -0
  19. package/dist/parallel-plugin.d.mts +13 -0
  20. package/dist/parallel-plugin.mjs +6 -0
  21. package/dist/parse-ast-index.d.mts +32 -0
  22. package/dist/parse-ast-index.mjs +60 -0
  23. package/dist/plugins-index.d.mts +33 -0
  24. package/dist/plugins-index.mjs +40 -0
  25. package/dist/shared/binding-D_jQsHun.mjs +583 -0
  26. package/dist/shared/binding-hSQGgsUz.d.mts +1877 -0
  27. package/dist/shared/bindingify-input-options-DfXGy4QO.mjs +2193 -0
  28. package/dist/shared/constructors-B-HbV10G.mjs +68 -0
  29. package/dist/shared/constructors-DMl58KN5.d.mts +37 -0
  30. package/dist/shared/define-config-BSxBeCq6.d.mts +3810 -0
  31. package/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  32. package/dist/shared/error-D5tMcn3l.mjs +85 -0
  33. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  34. package/dist/shared/load-config-CNjYgiQv.mjs +120 -0
  35. package/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  36. package/dist/shared/logs-D80CXhvg.mjs +180 -0
  37. package/dist/shared/misc-DJYbNKZX.mjs +21 -0
  38. package/dist/shared/normalize-string-or-regex-B8PEhdn1.mjs +66 -0
  39. package/dist/shared/parse-iQx2ihYn.mjs +74 -0
  40. package/dist/shared/prompt-BYQIwEjg.mjs +845 -0
  41. package/dist/shared/resolve-tsconfig-CxoM-bno.mjs +113 -0
  42. package/dist/shared/rolldown-C0o3hS3w.mjs +40 -0
  43. package/dist/shared/rolldown-build-80GULIOI.mjs +3326 -0
  44. package/dist/shared/transform-DY2pi3Qm.d.mts +149 -0
  45. package/dist/shared/watch-C2am0Ahc.mjs +374 -0
  46. package/dist/utils-index.d.mts +376 -0
  47. package/dist/utils-index.mjs +2414 -0
  48. package/package.json +130 -2
  49. package/.editorconfig +0 -10
  50. package/.gitattributes +0 -4
@@ -0,0 +1,113 @@
1
+ import { n as __toESM, t as require_binding } from "./binding-D_jQsHun.mjs";
2
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-D5tMcn3l.mjs";
3
+ //#region src/utils/minify.ts
4
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
+ /**
6
+ * Minify asynchronously.
7
+ *
8
+ * Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
9
+ *
10
+ * @category Utilities
11
+ * @experimental
12
+ */
13
+ async function minify(filename, sourceText, options) {
14
+ const inputMap = bindingifySourcemap(options?.inputMap);
15
+ const result = await (0, import_binding.minify)(filename, sourceText, options);
16
+ if (result.map && inputMap) result.map = {
17
+ version: 3,
18
+ ...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
19
+ };
20
+ return result;
21
+ }
22
+ /**
23
+ * Minify synchronously.
24
+ *
25
+ * @category Utilities
26
+ * @experimental
27
+ */
28
+ function minifySync(filename, sourceText, options) {
29
+ const inputMap = bindingifySourcemap(options?.inputMap);
30
+ const result = (0, import_binding.minifySync)(filename, sourceText, options);
31
+ if (result.map && inputMap) result.map = {
32
+ version: 3,
33
+ ...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
34
+ };
35
+ return result;
36
+ }
37
+ //#endregion
38
+ //#region src/utils/transform.ts
39
+ const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
40
+ /**
41
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
42
+ *
43
+ * Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
44
+ *
45
+ * @param filename The name of the file being transformed. If this is a
46
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
47
+ * @param sourceText The source code to transform.
48
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
49
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
50
+ * Only used when `options.tsconfig` is `true`.
51
+ *
52
+ * @returns a promise that resolves to an object containing the transformed code,
53
+ * source maps, and any errors that occurred during parsing or transformation.
54
+ *
55
+ * @category Utilities
56
+ * @experimental
57
+ */
58
+ async function transform(filename, sourceText, options, cache) {
59
+ const result = await (0, import_binding.enhancedTransform)(filename, sourceText, options, cache, yarnPnp$1);
60
+ return {
61
+ ...result,
62
+ errors: result.errors.map(normalizeBindingError),
63
+ warnings: result.warnings.map((w) => w.field0)
64
+ };
65
+ }
66
+ /**
67
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
68
+ *
69
+ * @param filename The name of the file being transformed. If this is a
70
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
71
+ * @param sourceText The source code to transform.
72
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
73
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
74
+ * Only used when `options.tsconfig` is `true`.
75
+ *
76
+ * @returns an object containing the transformed code, source maps, and any errors
77
+ * that occurred during parsing or transformation.
78
+ *
79
+ * @category Utilities
80
+ * @experimental
81
+ */
82
+ function transformSync(filename, sourceText, options, cache) {
83
+ const result = (0, import_binding.enhancedTransformSync)(filename, sourceText, options, cache, yarnPnp$1);
84
+ return {
85
+ ...result,
86
+ errors: result.errors.map(normalizeBindingError),
87
+ warnings: result.warnings.map((w) => w.field0)
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/utils/resolve-tsconfig.ts
92
+ const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
93
+ /**
94
+ * Cache for tsconfig resolution to avoid redundant file system operations.
95
+ *
96
+ * The cache stores resolved tsconfig configurations keyed by their file paths.
97
+ * When transforming multiple files in the same project, tsconfig lookups are
98
+ * deduplicated, improving performance.
99
+ *
100
+ * @category Utilities
101
+ * @experimental
102
+ */
103
+ var TsconfigCache = class extends import_binding.TsconfigCache {
104
+ constructor() {
105
+ super(yarnPnp);
106
+ }
107
+ };
108
+ /** @hidden This is only expected to be used by Vite */
109
+ function resolveTsconfig(filename, cache) {
110
+ return (0, import_binding.resolveTsconfig)(filename, cache, yarnPnp);
111
+ }
112
+ //#endregion
113
+ export { minify as a, transformSync as i, resolveTsconfig as n, minifySync as o, transform as r, TsconfigCache as t };
@@ -0,0 +1,40 @@
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-80GULIOI.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 };