@rollipop/rolldown 1.0.0-rc.2 → 1.0.0-rc.4

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 (48) hide show
  1. package/bin/cli.mjs +0 -1
  2. package/dist/cli.mjs +28 -1008
  3. package/dist/config.d.mts +10 -5
  4. package/dist/config.mjs +10 -14
  5. package/dist/experimental-index.d.mts +86 -14
  6. package/dist/experimental-index.mjs +77 -22
  7. package/dist/experimental-runtime-types.d.ts +0 -5
  8. package/dist/filter-index.d.mts +2 -2
  9. package/dist/filter-index.mjs +25 -8
  10. package/dist/get-log-filter.d.mts +3 -7
  11. package/dist/get-log-filter.mjs +23 -3
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +10 -12
  14. package/dist/parallel-plugin-worker.mjs +7 -8
  15. package/dist/parallel-plugin.d.mts +2 -2
  16. package/dist/parallel-plugin.mjs +1 -2
  17. package/dist/parse-ast-index.d.mts +26 -2
  18. package/dist/parse-ast-index.mjs +61 -4
  19. package/dist/plugins-index.d.mts +8 -5
  20. package/dist/plugins-index.mjs +9 -8
  21. package/dist/shared/{binding-Bo6UcGYl.d.mts → binding-BohGL_65.d.mts} +310 -120
  22. package/dist/shared/{binding-9QXxzPo6.mjs → binding-BuW0Fhs2.mjs} +39 -42
  23. package/dist/shared/{bindingify-input-options-C--dZCPv.mjs → bindingify-input-options-o_7NioSs.mjs} +77 -161
  24. package/dist/shared/{constructors-B64fS2o1.d.mts → constructors-Dg8A45sy.d.mts} +9 -4
  25. package/dist/shared/{constructors-DsYXT8FB.mjs → constructors-FqGyV5fj.mjs} +8 -7
  26. package/dist/shared/{define-config-DT_Hpxdr.d.mts → define-config-BvszQ-i2.d.mts} +212 -71
  27. package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  28. package/dist/shared/error-BjNWBTlf.mjs +85 -0
  29. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  30. package/dist/shared/{load-config-TBowPn4n.mjs → load-config-2dmAH96P.mjs} +11 -5
  31. package/dist/shared/{logs-NH298mHo.mjs → logs-D80CXhvg.mjs} +6 -9
  32. package/dist/shared/{misc-CCZIsXVO.mjs → misc-DJYbNKZX.mjs} +1 -2
  33. package/dist/shared/{normalize-string-or-regex-CaBvmZZK.mjs → normalize-string-or-regex-BU5HSJy4.mjs} +3 -6
  34. package/dist/shared/parse-Bt4kI3ey.mjs +74 -0
  35. package/dist/shared/{prompt-CI-U8Lh4.mjs → prompt-BYQIwEjg.mjs} +1 -3
  36. package/dist/shared/{rolldown-5hTSdYMy.mjs → rolldown-B4lV-glW.mjs} +2 -4
  37. package/dist/shared/rolldown-build-tLuGZc7p.mjs +3318 -0
  38. package/dist/shared/transform-BoJxrM-e.d.mts +132 -0
  39. package/dist/shared/transform-Cbhgjik0.mjs +90 -0
  40. package/dist/shared/{watch-CkctCkiN.mjs → watch-hs9ntURJ.mjs} +71 -76
  41. package/dist/utils-index.d.mts +376 -0
  42. package/dist/utils-index.mjs +2417 -0
  43. package/package.json +18 -17
  44. package/dist/cli-setup.d.mts +0 -1
  45. package/dist/cli-setup.mjs +0 -17
  46. package/dist/shared/parse-ast-index-BQ9Myuc2.mjs +0 -99
  47. package/dist/shared/rolldown-build-B7oitB1K.mjs +0 -2374
  48. /package/dist/shared/{logging-CE90D8JR.d.mts → logging-C6h4g8dA.d.mts} +0 -0
@@ -1,4 +1,61 @@
1
- import "./shared/binding-9QXxzPo6.mjs";
2
- import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-BQ9Myuc2.mjs";
3
-
4
- export { parseAst, parseAstAsync };
1
+ import "./shared/binding-BuW0Fhs2.mjs";
2
+ import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-D80CXhvg.mjs";
3
+ import { n as parseSync, t as parse } from "./shared/parse-Bt4kI3ey.mjs";
4
+ //#region src/parse-ast-index.ts
5
+ function wrap(result, filename, sourceText) {
6
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
7
+ return result.program;
8
+ }
9
+ function normalizeParseError(filename, sourceText, errors) {
10
+ let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
11
+ const pos = errors[0]?.labels?.[0]?.start;
12
+ for (let i = 0; i < errors.length; i++) {
13
+ if (i >= 5) {
14
+ message += "\n...";
15
+ break;
16
+ }
17
+ const e = errors[i];
18
+ message += e.message + "\n" + e.labels.map((label) => {
19
+ const location = locate(sourceText, label.start, { offsetLine: 1 });
20
+ if (!location) return;
21
+ return getCodeFrame(sourceText, location.line, location.column);
22
+ }).filter(Boolean).join("\n");
23
+ }
24
+ const log = logParseError(message, filename, pos);
25
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
26
+ return error(log);
27
+ }
28
+ const defaultParserOptions = {
29
+ lang: "js",
30
+ preserveParens: false
31
+ };
32
+ /**
33
+ * Parse code synchronously and return the AST.
34
+ *
35
+ * This function is similar to Rollup's `parseAst` function.
36
+ * Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
37
+ *
38
+ * @category Utilities
39
+ */
40
+ function parseAst(sourceText, options, filename) {
41
+ return wrap(parseSync(filename ?? "file.js", sourceText, {
42
+ ...defaultParserOptions,
43
+ ...options
44
+ }), filename, sourceText);
45
+ }
46
+ /**
47
+ * Parse code asynchronously and return the AST.
48
+ *
49
+ * This function is similar to Rollup's `parseAstAsync` function.
50
+ * Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
51
+ *
52
+ * @category Utilities
53
+ */
54
+ async function parseAstAsync(sourceText, options, filename) {
55
+ return wrap(await parse(filename ?? "file.js", sourceText, {
56
+ ...defaultParserOptions,
57
+ ...options
58
+ }), filename, sourceText);
59
+ }
60
+ //#endregion
61
+ export { parseAst, parseAstAsync };
@@ -1,13 +1,13 @@
1
- import { d as BindingReplacePluginConfig } from "./shared/binding-Bo6UcGYl.mjs";
2
- import { M as BuiltinPlugin } from "./shared/define-config-DT_Hpxdr.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors-B64fS2o1.mjs";
1
+ import { m as BindingReplacePluginConfig } from "./shared/binding-BohGL_65.mjs";
2
+ import { N as BuiltinPlugin } from "./shared/define-config-BvszQ-i2.mjs";
3
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-Dg8A45sy.mjs";
4
4
 
5
5
  //#region src/builtin-plugin/replace-plugin.d.ts
6
6
  /**
7
7
  * Replaces targeted strings in files while bundling.
8
8
  *
9
9
  * @example
10
- * // Basic usage
10
+ * **Basic usage**
11
11
  * ```js
12
12
  * replacePlugin({
13
13
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -15,7 +15,7 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-B64fS2o1.mj
15
15
  * })
16
16
  * ```
17
17
  * @example
18
- * // With options
18
+ * **With options**
19
19
  * ```js
20
20
  * replacePlugin({
21
21
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -24,6 +24,9 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-B64fS2o1.mj
24
24
  * preventAssignment: false,
25
25
  * })
26
26
  * ```
27
+ *
28
+ * @see https://rolldown.rs/builtin-plugins/replace
29
+ * @category Builtin Plugins
27
30
  */
28
31
  declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
29
32
  //#endregion
@@ -1,13 +1,12 @@
1
- import "./shared/binding-9QXxzPo6.mjs";
2
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-CaBvmZZK.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors-DsYXT8FB.mjs";
4
-
1
+ import "./shared/binding-BuW0Fhs2.mjs";
2
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-BU5HSJy4.mjs";
3
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-FqGyV5fj.mjs";
5
4
  //#region src/builtin-plugin/replace-plugin.ts
6
5
  /**
7
6
  * Replaces targeted strings in files while bundling.
8
7
  *
9
8
  * @example
10
- * // Basic usage
9
+ * **Basic usage**
11
10
  * ```js
12
11
  * replacePlugin({
13
12
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -15,7 +14,7 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-DsYXT8FB.mj
15
14
  * })
16
15
  * ```
17
16
  * @example
18
- * // With options
17
+ * **With options**
19
18
  * ```js
20
19
  * replacePlugin({
21
20
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -24,6 +23,9 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-DsYXT8FB.mj
24
23
  * preventAssignment: false,
25
24
  * })
26
25
  * ```
26
+ *
27
+ * @see https://rolldown.rs/builtin-plugins/replace
28
+ * @category Builtin Plugins
27
29
  */
28
30
  function replacePlugin(values = {}, options = {}) {
29
31
  Object.keys(values).forEach((key) => {
@@ -35,6 +37,5 @@ function replacePlugin(values = {}, options = {}) {
35
37
  values
36
38
  }));
37
39
  }
38
-
39
40
  //#endregion
40
- export { esmExternalRequirePlugin, replacePlugin };
41
+ export { esmExternalRequirePlugin, replacePlugin };