@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.
- package/bin/cli.mjs +0 -1
- package/dist/cli.mjs +28 -1008
- package/dist/config.d.mts +10 -5
- package/dist/config.mjs +10 -14
- package/dist/experimental-index.d.mts +86 -14
- package/dist/experimental-index.mjs +77 -22
- package/dist/experimental-runtime-types.d.ts +0 -5
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +25 -8
- package/dist/get-log-filter.d.mts +3 -7
- package/dist/get-log-filter.mjs +23 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +10 -12
- package/dist/parallel-plugin-worker.mjs +7 -8
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parallel-plugin.mjs +1 -2
- package/dist/parse-ast-index.d.mts +26 -2
- package/dist/parse-ast-index.mjs +61 -4
- package/dist/plugins-index.d.mts +8 -5
- package/dist/plugins-index.mjs +9 -8
- package/dist/shared/{binding-Bo6UcGYl.d.mts → binding-BohGL_65.d.mts} +310 -120
- package/dist/shared/{binding-9QXxzPo6.mjs → binding-BuW0Fhs2.mjs} +39 -42
- package/dist/shared/{bindingify-input-options-C--dZCPv.mjs → bindingify-input-options-o_7NioSs.mjs} +77 -161
- package/dist/shared/{constructors-B64fS2o1.d.mts → constructors-Dg8A45sy.d.mts} +9 -4
- package/dist/shared/{constructors-DsYXT8FB.mjs → constructors-FqGyV5fj.mjs} +8 -7
- package/dist/shared/{define-config-DT_Hpxdr.d.mts → define-config-BvszQ-i2.d.mts} +212 -71
- package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-DJOr6Iwt.mjs} +1 -2
- package/dist/shared/error-BjNWBTlf.mjs +85 -0
- package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
- package/dist/shared/{load-config-TBowPn4n.mjs → load-config-2dmAH96P.mjs} +11 -5
- package/dist/shared/{logs-NH298mHo.mjs → logs-D80CXhvg.mjs} +6 -9
- package/dist/shared/{misc-CCZIsXVO.mjs → misc-DJYbNKZX.mjs} +1 -2
- package/dist/shared/{normalize-string-or-regex-CaBvmZZK.mjs → normalize-string-or-regex-BU5HSJy4.mjs} +3 -6
- package/dist/shared/parse-Bt4kI3ey.mjs +74 -0
- package/dist/shared/{prompt-CI-U8Lh4.mjs → prompt-BYQIwEjg.mjs} +1 -3
- package/dist/shared/{rolldown-5hTSdYMy.mjs → rolldown-B4lV-glW.mjs} +2 -4
- package/dist/shared/rolldown-build-tLuGZc7p.mjs +3318 -0
- package/dist/shared/transform-BoJxrM-e.d.mts +132 -0
- package/dist/shared/transform-Cbhgjik0.mjs +90 -0
- package/dist/shared/{watch-CkctCkiN.mjs → watch-hs9ntURJ.mjs} +71 -76
- package/dist/utils-index.d.mts +376 -0
- package/dist/utils-index.mjs +2417 -0
- package/package.json +18 -17
- package/dist/cli-setup.d.mts +0 -1
- package/dist/cli-setup.mjs +0 -17
- package/dist/shared/parse-ast-index-BQ9Myuc2.mjs +0 -99
- package/dist/shared/rolldown-build-B7oitB1K.mjs +0 -2374
- /package/dist/shared/{logging-CE90D8JR.d.mts → logging-C6h4g8dA.d.mts} +0 -0
package/dist/parse-ast-index.mjs
CHANGED
|
@@ -1,4 +1,61 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { n as
|
|
3
|
-
|
|
4
|
-
|
|
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 };
|
package/dist/plugins-index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as esmExternalRequirePlugin } from "./shared/constructors-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
package/dist/plugins-index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-
|
|
3
|
-
import { t as esmExternalRequirePlugin } from "./shared/constructors-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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 };
|