@rollipop/rolldown 1.0.0-rc.2 → 1.0.0-rc.3
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/dist/cli-setup.mjs +1 -1
- package/dist/cli.mjs +27 -996
- package/dist/config.d.mts +10 -5
- package/dist/config.mjs +9 -12
- package/dist/experimental-index.d.mts +72 -14
- package/dist/experimental-index.mjs +64 -11
- package/dist/experimental-runtime-types.d.ts +0 -5
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +24 -1
- package/dist/get-log-filter.d.mts +3 -7
- package/dist/get-log-filter.mjs +23 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +10 -9
- package/dist/parallel-plugin-worker.mjs +5 -4
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +26 -2
- package/dist/parse-ast-index.mjs +61 -2
- package/dist/plugins-index.d.mts +8 -5
- package/dist/plugins-index.mjs +8 -5
- package/dist/shared/{binding-Bo6UcGYl.d.mts → binding-C4ZlFAt6.d.mts} +302 -117
- package/dist/shared/{binding-9QXxzPo6.mjs → binding-D25Pz9Tj.mjs} +32 -26
- package/dist/shared/{bindingify-input-options-C--dZCPv.mjs → bindingify-input-options-D6jfpJ6l.mjs} +52 -113
- package/dist/shared/{constructors-DsYXT8FB.mjs → constructors-BAGdj697.mjs} +8 -5
- package/dist/shared/{constructors-B64fS2o1.d.mts → constructors-C-tyKVjw.d.mts} +9 -4
- package/dist/shared/{define-config-DT_Hpxdr.d.mts → define-config-BKLqq_zt.d.mts} +148 -43
- package/dist/shared/error-BoaGIj5N.mjs +90 -0
- package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
- package/dist/shared/{load-config-TBowPn4n.mjs → load-config-CV5K8wKJ.mjs} +10 -2
- package/dist/shared/{logs-NH298mHo.mjs → logs-CCc_0vhs.mjs} +1 -1
- package/dist/shared/{normalize-string-or-regex-CaBvmZZK.mjs → normalize-string-or-regex-tBSnk6HY.mjs} +2 -2
- package/dist/shared/parse-DWZRPGsB.mjs +77 -0
- package/dist/shared/{rolldown-5hTSdYMy.mjs → rolldown-CZ1SIh-x.mjs} +1 -1
- package/dist/shared/{rolldown-build-B7oitB1K.mjs → rolldown-build-BYA-VVk0.mjs} +1019 -26
- package/dist/shared/transform-CIcvJTbn.mjs +93 -0
- package/dist/shared/transform-DoG7c5_r.d.mts +132 -0
- package/dist/shared/{watch-CkctCkiN.mjs → watch-DV7vV2OV.mjs} +6 -5
- package/dist/utils-index.d.mts +376 -0
- package/dist/utils-index.mjs +2426 -0
- package/package.json +17 -16
- package/dist/shared/parse-ast-index-BQ9Myuc2.mjs +0 -99
- /package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-BMj_QknW.mjs} +0 -0
- /package/dist/shared/{logging-CE90D8JR.d.mts → logging-C6h4g8dA.d.mts} +0 -0
- /package/dist/shared/{misc-CCZIsXVO.mjs → misc-Xty885dB.mjs} +0 -0
- /package/dist/shared/{prompt-CI-U8Lh4.mjs → prompt-B56gTa4S.mjs} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { n as __toESM, t as require_binding } from "./binding-D25Pz9Tj.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.115.0/node_modules/oxc-parser/src-js/wrap.js
|
|
4
|
+
function wrap(result) {
|
|
5
|
+
let program, module, comments, errors;
|
|
6
|
+
return {
|
|
7
|
+
get program() {
|
|
8
|
+
if (!program) program = jsonParseAst(result.program);
|
|
9
|
+
return program;
|
|
10
|
+
},
|
|
11
|
+
get module() {
|
|
12
|
+
if (!module) module = result.module;
|
|
13
|
+
return module;
|
|
14
|
+
},
|
|
15
|
+
get comments() {
|
|
16
|
+
if (!comments) comments = result.comments;
|
|
17
|
+
return comments;
|
|
18
|
+
},
|
|
19
|
+
get errors() {
|
|
20
|
+
if (!errors) errors = result.errors;
|
|
21
|
+
return errors;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function jsonParseAst(programJson) {
|
|
26
|
+
const { node: program, fixes } = JSON.parse(programJson);
|
|
27
|
+
for (const fixPath of fixes) applyFix(program, fixPath);
|
|
28
|
+
return program;
|
|
29
|
+
}
|
|
30
|
+
function applyFix(program, fixPath) {
|
|
31
|
+
let node = program;
|
|
32
|
+
for (const key of fixPath) node = node[key];
|
|
33
|
+
if (node.bigint) node.value = BigInt(node.bigint);
|
|
34
|
+
else try {
|
|
35
|
+
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
36
|
+
} catch {}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils/parse.ts
|
|
41
|
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
42
|
+
/**
|
|
43
|
+
* Parse JS/TS source asynchronously on a separate thread.
|
|
44
|
+
*
|
|
45
|
+
* Note that not all of the workload can happen on a separate thread.
|
|
46
|
+
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
|
|
47
|
+
* has to happen on current thread. This synchronous deserialization work typically outweighs
|
|
48
|
+
* the asynchronous parsing by a factor of between 3 and 20.
|
|
49
|
+
*
|
|
50
|
+
* i.e. the majority of the workload cannot be parallelized by using this method.
|
|
51
|
+
*
|
|
52
|
+
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
|
|
53
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
|
|
54
|
+
*
|
|
55
|
+
* @category Utilities
|
|
56
|
+
*/
|
|
57
|
+
async function parse(filename, sourceText, options) {
|
|
58
|
+
return wrap(await (0, import_binding.parse)(filename, sourceText, options));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse JS/TS source synchronously on current thread.
|
|
62
|
+
*
|
|
63
|
+
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
|
|
64
|
+
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
|
|
65
|
+
* (see {@linkcode parse} documentation for details).
|
|
66
|
+
*
|
|
67
|
+
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
|
|
68
|
+
* with {@linkcode parseSync} rather than using {@linkcode parse}.
|
|
69
|
+
*
|
|
70
|
+
* @category Utilities
|
|
71
|
+
*/
|
|
72
|
+
function parseSync(filename, sourceText, options) {
|
|
73
|
+
return wrap((0, import_binding.parseSync)(filename, sourceText, options));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { parseSync as n, parse as t };
|