@ohos-ports/rolldown 1.2.6-beta.0

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 (54) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +11 -0
  3. package/THIRD-PARTY-LICENSE +33 -0
  4. package/bin/cli.mjs +11 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.mjs +1208 -0
  7. package/dist/config.d.mts +26 -0
  8. package/dist/config.mjs +4 -0
  9. package/dist/experimental-default-runtime.mjs +116 -0
  10. package/dist/experimental-index.d.mts +324 -0
  11. package/dist/experimental-index.mjs +383 -0
  12. package/dist/experimental-runtime-base.mjs +95 -0
  13. package/dist/experimental-runtime-types.d.ts +177 -0
  14. package/dist/experimental-runtime.d.ts +177 -0
  15. package/dist/experimental-runtime.mjs +257 -0
  16. package/dist/filter-index.d.mts +196 -0
  17. package/dist/filter-index.mjs +376 -0
  18. package/dist/get-log-filter.d.mts +3 -0
  19. package/dist/get-log-filter.mjs +68 -0
  20. package/dist/index.d.mts +4 -0
  21. package/dist/index.mjs +56 -0
  22. package/dist/parallel-plugin-worker.d.mts +1 -0
  23. package/dist/parallel-plugin-worker.mjs +29 -0
  24. package/dist/parallel-plugin.d.mts +12 -0
  25. package/dist/parallel-plugin.mjs +6 -0
  26. package/dist/parse-ast-index.d.mts +30 -0
  27. package/dist/parse-ast-index.mjs +60 -0
  28. package/dist/plugins-index.d.mts +32 -0
  29. package/dist/plugins-index.mjs +40 -0
  30. package/dist/shared/binding-CtPG-2KR.mjs +675 -0
  31. package/dist/shared/binding-Og__jmUi.d.mts +2065 -0
  32. package/dist/shared/bindingify-input-options-4JJxbZl2.mjs +2416 -0
  33. package/dist/shared/constructors-Qrp2Xr6w.d.mts +35 -0
  34. package/dist/shared/constructors-ltBDfHX1.mjs +69 -0
  35. package/dist/shared/create-bundler-option-DSPiA5F7.mjs +3220 -0
  36. package/dist/shared/define-config-Demdg3_4.mjs +6 -0
  37. package/dist/shared/define-config-Nbz-lniw.d.mts +4101 -0
  38. package/dist/shared/dist-DKbukT1H.mjs +154 -0
  39. package/dist/shared/error-HDibX49O.mjs +85 -0
  40. package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  41. package/dist/shared/load-config-BMUrE9HH.mjs +137 -0
  42. package/dist/shared/logging-xuHO4mAy.d.mts +50 -0
  43. package/dist/shared/logs-DmYCAKcW.mjs +192 -0
  44. package/dist/shared/misc-DOSKtd97.mjs +29 -0
  45. package/dist/shared/normalize-string-or-regex-DWz4it3p.mjs +68 -0
  46. package/dist/shared/parse-D0g29RgN.mjs +74 -0
  47. package/dist/shared/prompt-CH6TK0bC.mjs +885 -0
  48. package/dist/shared/resolve-tsconfig-CLYpUIZC.mjs +128 -0
  49. package/dist/shared/rolldown-C9Hfg50O.mjs +179 -0
  50. package/dist/shared/transform-DR4CXeQm.d.mts +152 -0
  51. package/dist/shared/watch-UbzgabQn.mjs +377 -0
  52. package/dist/utils-index.d.mts +375 -0
  53. package/dist/utils-index.mjs +2416 -0
  54. package/package.json +159 -0
@@ -0,0 +1,68 @@
1
+ import { n as __toESM, t as require_binding } from "./binding-CtPG-2KR.mjs";
2
+ import { l as logPluginError, n as error } from "./logs-DmYCAKcW.mjs";
3
+ //#region src/builtin-plugin/utils.ts
4
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
+ var BuiltinPlugin = class {
6
+ name;
7
+ _options;
8
+ /** Vite-specific option to control plugin ordering */
9
+ enforce;
10
+ constructor(name, _options) {
11
+ this.name = name;
12
+ this._options = _options;
13
+ }
14
+ };
15
+ function makeBuiltinPluginCallable(plugin) {
16
+ let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
17
+ const wrappedPlugin = plugin;
18
+ for (const key in callablePlugin) {
19
+ const wrappedHook = async function(...args) {
20
+ try {
21
+ return await callablePlugin[key](...args);
22
+ } catch (e) {
23
+ if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
24
+ return error(logPluginError(e, plugin.name, {
25
+ hook: key,
26
+ id: key === "transform" ? args[2] : void 0
27
+ }));
28
+ }
29
+ };
30
+ const order = callablePlugin.getOrder(key);
31
+ if (order == void 0) wrappedPlugin[key] = wrappedHook;
32
+ else wrappedPlugin[key] = {
33
+ handler: wrappedHook,
34
+ order
35
+ };
36
+ }
37
+ return wrappedPlugin;
38
+ }
39
+ function bindingifyBuiltInPlugin(plugin) {
40
+ return {
41
+ __name: plugin.name,
42
+ options: plugin._options
43
+ };
44
+ }
45
+ function bindingifyManifestPlugin(plugin, pluginContextData) {
46
+ const { isOutputOptionsForLegacyChunks, ...options } = plugin._options;
47
+ return {
48
+ __name: plugin.name,
49
+ options: {
50
+ ...options,
51
+ isLegacy: isOutputOptionsForLegacyChunks ? (opts) => {
52
+ return isOutputOptionsForLegacyChunks(pluginContextData.getOutputOptions(opts));
53
+ } : void 0
54
+ }
55
+ };
56
+ }
57
+ //#endregion
58
+ //#region src/utils/normalize-string-or-regex.ts
59
+ function normalizedStringOrRegex(pattern) {
60
+ if (!pattern) return;
61
+ if (!isReadonlyArray(pattern)) return [pattern];
62
+ return pattern;
63
+ }
64
+ function isReadonlyArray(input) {
65
+ return Array.isArray(input);
66
+ }
67
+ //#endregion
68
+ export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
@@ -0,0 +1,74 @@
1
+ import { n as __toESM, t as require_binding } from "./binding-CtPG-2KR.mjs";
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.147.0/node_modules/oxc-parser/src-js/wrap.js
3
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
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
+ //#endregion
39
+ //#region src/utils/parse.ts
40
+ /**
41
+ * Parse JS/TS source asynchronously on a separate thread.
42
+ *
43
+ * Note that not all of the workload can happen on a separate thread.
44
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
45
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
46
+ * the asynchronous parsing by a factor of between 3 and 20.
47
+ *
48
+ * i.e. the majority of the workload cannot be parallelized by using this method.
49
+ *
50
+ * Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
51
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
52
+ *
53
+ * @category Utilities
54
+ */
55
+ async function parse(filename, sourceText, options) {
56
+ return wrap(await (0, import_binding.parse)(filename, sourceText, options));
57
+ }
58
+ /**
59
+ * Parse JS/TS source synchronously on current thread.
60
+ *
61
+ * This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
62
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
63
+ * (see {@linkcode parse} documentation for details).
64
+ *
65
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
66
+ * with {@linkcode parseSync} rather than using {@linkcode parse}.
67
+ *
68
+ * @category Utilities
69
+ */
70
+ function parseSync(filename, sourceText, options) {
71
+ return wrap((0, import_binding.parseSync)(filename, sourceText, options));
72
+ }
73
+ //#endregion
74
+ export { parseSync as n, parse as t };