@rollipop/rolldown 1.0.24 → 1.0.26

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 (49) hide show
  1. package/THIRD-PARTY-LICENSE +33 -0
  2. package/dist/cli.mjs +9 -10
  3. package/dist/config.d.mts +16 -17
  4. package/dist/config.mjs +2 -2
  5. package/dist/experimental-default-runtime.mjs +116 -0
  6. package/dist/experimental-index.d.mts +220 -205
  7. package/dist/experimental-index.mjs +47 -22
  8. package/dist/experimental-runtime-base.mjs +95 -0
  9. package/dist/experimental-runtime-types.d.ts +111 -41
  10. package/dist/experimental-runtime.d.ts +177 -0
  11. package/dist/experimental-runtime.mjs +257 -0
  12. package/dist/filter-index.d.mts +6 -5
  13. package/dist/filter-index.mjs +1 -3
  14. package/dist/get-log-filter.d.mts +2 -2
  15. package/dist/index.d.mts +4 -4
  16. package/dist/index.mjs +4 -4
  17. package/dist/parallel-plugin-worker.mjs +2 -2
  18. package/dist/parallel-plugin.d.mts +3 -4
  19. package/dist/parse-ast-index.d.mts +19 -20
  20. package/dist/parse-ast-index.mjs +2 -2
  21. package/dist/plugins-index.d.mts +27 -28
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/shared/{binding-DLP3kSP5.mjs → binding-D_XVvOPT.mjs} +124 -50
  24. package/dist/shared/{binding-FraDreAW.d.mts → binding-We_IfeZk.d.mts} +48 -25
  25. package/dist/shared/{bindingify-input-options-DQnooxIa.mjs → bindingify-input-options-BXQG8xz-.mjs} +213 -262
  26. package/dist/shared/{constructors-CXtPAgZN.d.mts → constructors-BIHQ8UmW.d.mts} +9 -10
  27. package/dist/shared/{constructors-DpCCe7z3.mjs → constructors-CNB5XL7Q.mjs} +10 -6
  28. package/dist/shared/{rolldown-build-Blclcr5k.mjs → create-bundler-option-Be4KJzGL.mjs} +39 -156
  29. package/dist/shared/define-config-thpMQ05a.d.mts +4096 -0
  30. package/dist/shared/{error-CIdnbKmG.mjs → error-bm-jLrD1.mjs} +1 -1
  31. package/dist/shared/get-log-filter-B6CU6b90.d.mts +34 -0
  32. package/dist/shared/{load-config-5r6l-9qr.mjs → load-config-Bu7-JwX4.mjs} +2 -2
  33. package/dist/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  34. package/dist/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
  35. package/dist/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
  36. package/dist/shared/{normalize-string-or-regex-oITfWWWc.mjs → normalize-string-or-regex-CiPu-0L6.mjs} +2 -2
  37. package/dist/shared/{parse-CI_bqXWS.mjs → parse-DFZrcERz.mjs} +2 -2
  38. package/dist/shared/{prompt--dNycKSZ.mjs → prompt-CH6TK0bC.mjs} +2 -6
  39. package/dist/shared/{resolve-tsconfig-9cpL_qUM.mjs → resolve-tsconfig-CsDgQmsO.mjs} +2 -2
  40. package/dist/shared/rolldown-CnVo3ESi.mjs +178 -0
  41. package/dist/shared/transform-CsZGbS4Q.d.mts +148 -0
  42. package/dist/shared/{watch-DElgNTzo.mjs → watch-WV6bq5kw.mjs} +16 -13
  43. package/dist/utils-index.d.mts +29 -30
  44. package/dist/utils-index.mjs +6 -8
  45. package/package.json +25 -16
  46. package/dist/shared/define-config-oNOGrLUX.d.mts +0 -4008
  47. package/dist/shared/get-log-filter-B4LpBryx.d.mts +0 -35
  48. package/dist/shared/rolldown-DBxQ1pTJ.mjs +0 -40
  49. package/dist/shared/transform-DmrnpNrQ.d.mts +0 -149
@@ -0,0 +1,33 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
11
+ ---
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2020 Evan Wallace
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
package/dist/cli.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { n as onExit, t as watch } from "./shared/watch-DElgNTzo.mjs";
2
- import { S as version, x as description } from "./shared/bindingify-input-options-DQnooxIa.mjs";
3
- import { t as arraify } from "./shared/misc-CoQm4NHO.mjs";
4
- import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-Blclcr5k.mjs";
5
- import { t as rolldown } from "./shared/rolldown-DBxQ1pTJ.mjs";
6
- import { t as loadConfig } from "./shared/load-config-5r6l-9qr.mjs";
1
+ import { n as onExit, t as watch } from "./shared/watch-WV6bq5kw.mjs";
2
+ import { C as version, S as description } from "./shared/bindingify-input-options-BXQG8xz-.mjs";
3
+ import { t as arraify } from "./shared/misc-DOSKtd97.mjs";
4
+ import { a as getOutputCliKeys, c as styleText, i as getInputCliKeys, n as logger, o as validateCliOptions, r as getCliSchemaInfo } from "./shared/create-bundler-option-Be4KJzGL.mjs";
5
+ import { t as rolldown } from "./shared/rolldown-CnVo3ESi.mjs";
6
+ import { t as loadConfig } from "./shared/load-config-Bu7-JwX4.mjs";
7
7
  import path from "node:path";
8
8
  import g$1 from "node:process";
9
9
  import { performance } from "node:perf_hooks";
@@ -862,7 +862,7 @@ function getClearScreenFunction(options) {
862
862
  };
863
863
  }
864
864
  //#endregion
865
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/usingCtx.js
865
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/usingCtx.js
866
866
  function _usingCtx() {
867
867
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
868
868
  var n = Error();
@@ -947,7 +947,8 @@ async function bundleWithCliOptions(cliOptions) {
947
947
  const { output: outputs } = await _usingCtx$1.a(await rolldown(cliOptions.input)).generate(cliOptions.output);
948
948
  if (outputs.length === 0) {
949
949
  logger.error("No output generated");
950
- process.exit(1);
950
+ process.exitCode = 1;
951
+ return;
951
952
  }
952
953
  for (const file of outputs) {
953
954
  if (outputs.length > 1) logger.log(`\n${styleText(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
@@ -1000,8 +1001,6 @@ async function watchInner(config, cliOptions) {
1000
1001
  case "ERROR":
1001
1002
  await event.result.close();
1002
1003
  logger.error(event.error);
1003
- break;
1004
- default: break;
1005
1004
  }
1006
1005
  });
1007
1006
  logger.log(`Waiting for changes...`);
package/dist/config.d.mts CHANGED
@@ -1,27 +1,26 @@
1
- import { L as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-oNOGrLUX.mjs";
2
-
1
+ import { R as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-thpMQ05a.mjs";
3
2
  //#region src/utils/load-config.d.ts
4
3
  type ConfigLoader = "bundle" | "native";
5
4
  interface LoadConfigOptions {
6
5
  /**
7
- * How to load the config file.
8
- * - `'bundle'` (default): bundle the config with Rolldown, then import it.
9
- * - `'native'`: import the config directly, delegating TypeScript/loader
10
- * handling to the runtime. Faster, but requires runtime support.
11
- *
12
- * @default 'bundle'
13
- */
6
+ * How to load the config file.
7
+ * - `'bundle'` (default): bundle the config with Rolldown, then import it.
8
+ * - `'native'`: import the config directly, delegating TypeScript/loader
9
+ * handling to the runtime. Faster, but requires runtime support.
10
+ *
11
+ * @default 'bundle'
12
+ */
14
13
  configLoader?: ConfigLoader;
15
14
  }
16
15
  /**
17
- * Load config from a file in a way that Rolldown does.
18
- *
19
- * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
20
- * @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
21
- * @returns The loaded config export
22
- *
23
- * @category Config
24
- */
16
+ * Load config from a file in a way that Rolldown does.
17
+ *
18
+ * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
19
+ * @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
20
+ * @returns The loaded config export
21
+ *
22
+ * @category Config
23
+ */
25
24
  declare function loadConfig(configPath: string, options?: LoadConfigOptions): Promise<ConfigExport>;
26
25
  //#endregion
27
26
  export { VERSION, defineConfig, loadConfig };
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { b as VERSION } from "./shared/bindingify-input-options-DQnooxIa.mjs";
1
+ import { x as VERSION } from "./shared/bindingify-input-options-BXQG8xz-.mjs";
2
2
  import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
3
- import { t as loadConfig } from "./shared/load-config-5r6l-9qr.mjs";
3
+ import { t as loadConfig } from "./shared/load-config-Bu7-JwX4.mjs";
4
4
  export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,116 @@
1
+ // @ts-check
2
+
3
+ /** @import { DevRuntime } from './runtime-extra-dev-common-origin.js' */
4
+
5
+ /** @type {typeof DevRuntime} */
6
+ // @ts-expect-error -- there's no way to declare a variable by JSDoc
7
+ var BaseDevRuntime = DevRuntime;
8
+
9
+ class ModuleHotContext {
10
+ /**
11
+ * @type {{ deps: [string], fn: (moduleExports: Record<string, any>[]) => void }[]}
12
+ */
13
+ acceptCallbacks = [];
14
+ /**
15
+ * @param {string} moduleId
16
+ * @param {InstanceType<BaseDevRuntime>} devRuntime
17
+ */
18
+ constructor(moduleId, devRuntime) {
19
+ this.moduleId = moduleId;
20
+ this.devRuntime = devRuntime;
21
+ }
22
+
23
+ /**
24
+ * @overload
25
+ * @param {(mod: Record<string, any>) => void} cb
26
+ * @returns {void}
27
+ */
28
+ /**
29
+ * @param {...any} args
30
+ * @returns {void}
31
+ */
32
+ accept(...args) {
33
+ if (args.length === 1) {
34
+ const [cb] = /** @type {[(mod: Record<string, any>) => void]} */ (args);
35
+ const acceptingPath = this.moduleId;
36
+ this.acceptCallbacks.push({
37
+ deps: [acceptingPath],
38
+ fn: cb,
39
+ });
40
+ } else if (args.length === 0) {}
41
+ else {
42
+ throw new Error('Invalid arguments for `import.meta.hot.accept`');
43
+ }
44
+ }
45
+
46
+ invalidate() {
47
+ socket.send(JSON.stringify({
48
+ type: 'hmr:invalidate',
49
+ moduleId: this.moduleId,
50
+ }));
51
+ }
52
+ }
53
+
54
+ class DefaultDevRuntime extends BaseDevRuntime {
55
+ /**
56
+ * @type {Map<string, ModuleHotContext>}
57
+ */
58
+ moduleHotContexts = new Map();
59
+ /**
60
+ * @override
61
+ * @param {string} moduleId
62
+ */
63
+ createModuleHotContext(moduleId) {
64
+ const hotContext = new ModuleHotContext(moduleId, this);
65
+ this.moduleHotContexts.set(moduleId, hotContext);
66
+ return hotContext;
67
+ }
68
+ }
69
+
70
+ /** @param {string} url */
71
+ function loadScript(url) {
72
+ var script = document.createElement('script');
73
+ script.src = url;
74
+ script.type = 'module';
75
+ script.onerror = function() {
76
+ console.error('Failed to load script: ' + url);
77
+ };
78
+ document.body.appendChild(script);
79
+ }
80
+
81
+ console.debug('HMR runtime loaded', '$ADDR');
82
+ // Generate client ID immediately at runtime initialization
83
+ // This ensures the client ID is available before any lazy imports
84
+ const clientId = crypto.randomUUID();
85
+ const addr = new URL('ws://$ADDR');
86
+ addr.searchParams.set('clientId', clientId);
87
+
88
+ const socket = new WebSocket(addr);
89
+
90
+ (/** @type {any} */ (globalThis)).__rolldown_runtime__ ??=
91
+ new DefaultDevRuntime(clientId);
92
+
93
+ /** @param {MessageEvent} event */
94
+ socket.onmessage = function(event) {
95
+ const data = JSON.parse(event.data);
96
+ console.debug('Received message:', data);
97
+ if (data.type === 'connected') {
98
+ // Server acknowledged the connection
99
+ console.debug('[hmr]: Connection established with server');
100
+ } else if (data.type === 'hmr:update') {
101
+ if (typeof process === 'object') {
102
+ import(data.path);
103
+ console.debug(`[hmr]: Importing HMR patch: ${data.path}`);
104
+ } else {
105
+ console.debug(`[hmr]: Loading HMR patch: ${data.path}`);
106
+ loadScript(data.url);
107
+ }
108
+ } else if (data.type === 'hmr:reload') {
109
+ console.log('[hmr]: Full reload required, reloading page');
110
+ if (typeof location !== 'undefined') {
111
+ location.reload();
112
+ } else {
113
+ console.log('[hmr]: location is undefined, cannot reload page');
114
+ }
115
+ }
116
+ };