@voidzero-dev/vite-plus-core 0.2.7 → 0.2.9

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 (75) hide show
  1. package/LICENSE +65 -1
  2. package/dist/rolldown/cli.mjs +17 -14
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-default-runtime.mjs +116 -0
  6. package/dist/rolldown/experimental-index.d.mts +10 -4
  7. package/dist/rolldown/experimental-index.mjs +32 -16
  8. package/dist/rolldown/experimental-runtime-base.mjs +95 -0
  9. package/dist/rolldown/experimental-runtime.d.ts +177 -0
  10. package/dist/rolldown/experimental-runtime.mjs +257 -0
  11. package/dist/rolldown/filter-index.d.mts +1 -1
  12. package/dist/rolldown/filter-index.mjs +1 -3
  13. package/dist/rolldown/index.d.mts +3 -3
  14. package/dist/rolldown/index.mjs +4 -4
  15. package/dist/rolldown/parallel-plugin-worker.mjs +3 -3
  16. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  17. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  18. package/dist/rolldown/parse-ast-index.mjs +2 -2
  19. package/dist/rolldown/plugins-index.d.mts +3 -3
  20. package/dist/rolldown/plugins-index.mjs +2 -2
  21. package/dist/rolldown/shared/binding-CKyeQZen.mjs +673 -0
  22. package/dist/rolldown/shared/{binding-Dbbi0RbO.d.mts → binding-CVtkJvyl.d.mts} +11 -0
  23. package/dist/rolldown/shared/{bindingify-input-options-DVQ4K-zY.mjs → bindingify-input-options-44iPAymO.mjs} +449 -273
  24. package/dist/rolldown/shared/{constructors-CuGa75s-.mjs → constructors-6Zc-JFd7.mjs} +10 -6
  25. package/dist/rolldown/shared/{constructors-CSWbNgBZ.d.mts → constructors-XaIbWpwJ.d.mts} +2 -2
  26. package/dist/rolldown/shared/{rolldown-build-BGXNOfvH.mjs → create-bundler-option-e1FU0w0P.mjs} +72 -179
  27. package/dist/rolldown/shared/{define-config-B-IDOhDz.d.mts → define-config-DVsXPNaU.d.mts} +85 -26
  28. package/dist/rolldown/shared/{error-DFGNOCle.mjs → error-BzLGqhSQ.mjs} +1 -1
  29. package/dist/rolldown/shared/{load-config-R0z2olkB.mjs → load-config-C6QXSnoS.mjs} +2 -2
  30. package/dist/rolldown/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
  31. package/dist/rolldown/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
  32. package/dist/rolldown/shared/{normalize-string-or-regex-SiXbePVH.mjs → normalize-string-or-regex-DYjJ67tj.mjs} +2 -2
  33. package/dist/rolldown/shared/{parse-D5dkElpf.mjs → parse-uDDyc1el.mjs} +2 -2
  34. package/dist/rolldown/shared/{prompt-pZFoa1TT.mjs → prompt-uaCPq0_A.mjs} +2 -6
  35. package/dist/rolldown/shared/{resolve-tsconfig-2TXRF_zr.mjs → resolve-tsconfig-Bcd82vVT.mjs} +2 -2
  36. package/dist/rolldown/shared/rolldown-CCbQNGZt.mjs +178 -0
  37. package/dist/rolldown/shared/{transform-Cs2bUDRH.d.mts → transform-WmU_cI8e.d.mts} +1 -1
  38. package/dist/rolldown/shared/{watch-DVucf-VG.mjs → watch-vuOCmvFs.mjs} +17 -14
  39. package/dist/rolldown/utils-index.d.mts +3 -3
  40. package/dist/rolldown/utils-index.mjs +15 -13
  41. package/dist/tsdown/{build-D_enfyvD-DX5mX46j.js → build-D_enfyvD-Dg1eKRD4.js} +22 -19
  42. package/dist/tsdown/{debug-CKcBYQLP-GQrJ--dM.js → debug-CKcBYQLP-C3NhYhrk.js} +4 -6
  43. package/dist/tsdown/{detect-DGhJGEqb-Cz6qOZuP.js → detect-DGhJGEqb-6CTf16BW.js} +1 -1
  44. package/dist/tsdown/{dist-DCMiHFrJ.js → dist-CMKwGGNp.js} +1 -3
  45. package/dist/tsdown/{dist-CWolxbYK.js → dist-DyXLnzyh.js} +43 -10
  46. package/dist/tsdown/index-types.d.ts +6 -6
  47. package/dist/tsdown/index.js +4 -4
  48. package/dist/tsdown/internal-DKworeK4.js +3 -0
  49. package/dist/tsdown/{main-DI8qthUB.js → main-DiierkER.js} +211 -197
  50. package/dist/tsdown/npm_entry_picomatch.cjs +11 -7
  51. package/dist/tsdown/npm_entry_tree-kill.cjs +15 -15
  52. package/dist/tsdown/{resolver-cwLsPb2o-DvUqSYux.js → resolver-cwLsPb2o-Dk4xdAGE.js} +3 -3
  53. package/dist/tsdown/run.js +6 -6
  54. package/dist/tsdown/{src-CPDzmpAq.js → src-drVPfX63.js} +5 -5
  55. package/dist/tsdown/{target-Bab3CUeB-Di6tCARH.js → target-Bab3CUeB-DQ0pKhCv.js} +6 -6
  56. package/dist/tsdown/{tsc-BQoNcjeB.js → tsc-JnMl2z7d.js} +4 -5
  57. package/dist/tsdown/tsdown-css.js +7 -9
  58. package/dist/tsdown/tsdown-exe.js +4 -4
  59. package/dist/vite/client/bundledDevClient.mjs +1781 -0
  60. package/dist/vite/client/client.mjs +67 -92
  61. package/dist/vite/node/chunks/build.js +98 -88
  62. package/dist/vite/node/chunks/dist.js +62 -114
  63. package/dist/vite/node/chunks/dist2.js +198 -159
  64. package/dist/vite/node/chunks/node.js +3690 -3135
  65. package/dist/vite/node/chunks/postcss-import.js +20 -19
  66. package/dist/vite/node/index.d.ts +73 -17
  67. package/dist/vite/node/module-runner.js +42 -26
  68. package/dist/vite/types/customEvent.d.ts +3 -1
  69. package/dist/vite/types/hmrPayload.d.ts +20 -6
  70. package/package.json +36 -16
  71. package/dist/rolldown/shared/binding-Dby9rwGk.mjs +0 -588
  72. package/dist/rolldown/shared/rolldown-BnV7isAX.mjs +0 -40
  73. package/dist/tsdown/internal-DAh_SWnB.js +0 -3
  74. package/dist/tsdown/load-tsc-BKULZsrs-Bha6Vsu1.js +0 -18
  75. package/dist/tsdown/tsc-context-BhMGQ9Qr.js +0 -23
package/LICENSE CHANGED
@@ -1490,6 +1490,35 @@ Repository: https://github.com/isaacs/node-which
1490
1490
 
1491
1491
  ---------------------------------------
1492
1492
 
1493
+ ## js-tokens
1494
+ License: MIT
1495
+ By: Simon Lydell
1496
+ Repository: https://github.com/lydell/js-tokens
1497
+
1498
+ > The MIT License (MIT)
1499
+ >
1500
+ > Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell
1501
+ >
1502
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
1503
+ > of this software and associated documentation files (the "Software"), to deal
1504
+ > in the Software without restriction, including without limitation the rights
1505
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1506
+ > copies of the Software, and to permit persons to whom the Software is
1507
+ > furnished to do so, subject to the following conditions:
1508
+ >
1509
+ > The above copyright notice and this permission notice shall be included in
1510
+ > all copies or substantial portions of the Software.
1511
+ >
1512
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1513
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1514
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1515
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1516
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1517
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1518
+ > THE SOFTWARE.
1519
+
1520
+ ---------------------------------------
1521
+
1493
1522
  ## launch-editor, launch-editor-middleware
1494
1523
  License: MIT
1495
1524
  By: Evan You
@@ -4134,6 +4163,13 @@ Repository: https://github.com/vitejs/vite
4134
4163
  >
4135
4164
  > ---------------------------------------
4136
4165
  >
4166
+ > ## is-reference
4167
+ > License: MIT
4168
+ > By: Rich Harris
4169
+ > Repository: https://github.com/Rich-Harris/is-reference
4170
+ >
4171
+ > ---------------------------------------
4172
+ >
4137
4173
  > ## isexe, which
4138
4174
  > License: ISC
4139
4175
  > By: Isaac Z. Schlueter
@@ -4164,7 +4200,7 @@ Repository: https://github.com/vitejs/vite
4164
4200
  >
4165
4201
  > > The MIT License (MIT)
4166
4202
  > >
4167
- > > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Simon Lydell
4203
+ > > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Simon Lydell
4168
4204
  > >
4169
4205
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
4170
4206
  > > of this software and associated documentation files (the "Software"), to deal
@@ -5200,6 +5236,34 @@ Repository: https://github.com/vitejs/vite
5200
5236
  > > COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5201
5237
  > > IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5202
5238
  > > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5239
+ >
5240
+ > ---------------------------------------
5241
+ >
5242
+ > ## zimmerframe
5243
+ > License: MIT
5244
+ > Repository: https://github.com/sveltejs/zimmerframe
5245
+ >
5246
+ > > MIT License
5247
+ > >
5248
+ > > Copyright (c) 2023 [these people](https://github.com/Rich-Harris/zimmerframe/graphs/contributors)
5249
+ > >
5250
+ > > Permission is hereby granted, free of charge, to any person obtaining a copy
5251
+ > > of this software and associated documentation files (the "Software"), to deal
5252
+ > > in the Software without restriction, including without limitation the rights
5253
+ > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5254
+ > > copies of the Software, and to permit persons to whom the Software is
5255
+ > > furnished to do so, subject to the following conditions:
5256
+ > >
5257
+ > > The above copyright notice and this permission notice shall be included in all
5258
+ > > copies or substantial portions of the Software.
5259
+ > >
5260
+ > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5261
+ > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5262
+ > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5263
+ > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5264
+ > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5265
+ > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5266
+ > > SOFTWARE.
5203
5267
 
5204
5268
  ---------------------------------------
5205
5269
 
@@ -1,9 +1,9 @@
1
- import { n as onExit, t as watch } from "./shared/watch-DVucf-VG.mjs";
2
- import { S as version, x as description } from "./shared/bindingify-input-options-DVQ4K-zY.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-BGXNOfvH.mjs";
5
- import { t as rolldown } from "./shared/rolldown-BnV7isAX.mjs";
6
- import { t as loadConfig } from "./shared/load-config-R0z2olkB.mjs";
1
+ import { n as onExit, t as watch } from "./shared/watch-vuOCmvFs.mjs";
2
+ import { D as version, E as description } from "./shared/bindingify-input-options-44iPAymO.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-e1FU0w0P.mjs";
5
+ import { t as rolldown } from "./shared/rolldown-CCbQNGZt.mjs";
6
+ import { t as loadConfig } from "./shared/load-config-C6QXSnoS.mjs";
7
7
  import path from "node:path";
8
8
  import g$1 from "node:process";
9
9
  import { performance } from "node:perf_hooks";
@@ -719,8 +719,10 @@ function normalizeCliOptions(cliOptions, positionals) {
719
719
  process.exit(1);
720
720
  }
721
721
  }
722
- if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
723
- else result.input.input = positionals;
722
+ if (!result.config && positionals.length > 0) {
723
+ if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
724
+ else result.input.input = positionals;
725
+ }
724
726
  return result;
725
727
  }
726
728
  //#endregion
@@ -769,8 +771,10 @@ function parseCliArguments() {
769
771
  if (config?.abbreviation) rawName += `-${config.abbreviation}, `;
770
772
  if (config?.reverse) rawName += `--no-${key}`;
771
773
  else rawName += `--${key}`;
772
- if (info.type !== "boolean" && !config?.reverse) if (config?.requireValue) rawName += ` <${config?.hint ?? key}>`;
773
- else rawName += ` [${config?.hint ?? key}]`;
774
+ if (info.type !== "boolean" && !config?.reverse) {
775
+ if (config?.requireValue) rawName += ` <${config?.hint ?? key}>`;
776
+ else rawName += ` [${config?.hint ?? key}]`;
777
+ }
774
778
  cli.option(rawName, info.description ?? config?.description ?? "");
775
779
  }
776
780
  let parsedInput = [];
@@ -862,7 +866,7 @@ function getClearScreenFunction(options) {
862
866
  };
863
867
  }
864
868
  //#endregion
865
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/usingCtx.js
869
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/usingCtx.js
866
870
  function _usingCtx() {
867
871
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
868
872
  var n = Error();
@@ -947,7 +951,8 @@ async function bundleWithCliOptions(cliOptions) {
947
951
  const { output: outputs } = await _usingCtx$1.a(await rolldown(cliOptions.input)).generate(cliOptions.output);
948
952
  if (outputs.length === 0) {
949
953
  logger.error("No output generated");
950
- process.exit(1);
954
+ process.exitCode = 1;
955
+ return;
951
956
  }
952
957
  for (const file of outputs) {
953
958
  if (outputs.length > 1) logger.log(`\n${styleText(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
@@ -1000,8 +1005,6 @@ async function watchInner(config, cliOptions) {
1000
1005
  case "ERROR":
1001
1006
  await event.result.close();
1002
1007
  logger.error(event.error);
1003
- break;
1004
- default: break;
1005
1008
  }
1006
1009
  });
1007
1010
  logger.log(`Waiting for changes...`);
@@ -1,4 +1,4 @@
1
- import { L as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-B-IDOhDz.mjs";
1
+ import { R as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-DVsXPNaU.mjs";
2
2
  //#region src/utils/load-config.d.ts
3
3
  type ConfigLoader = "bundle" | "native";
4
4
  interface LoadConfigOptions {
@@ -1,4 +1,4 @@
1
- import { b as VERSION } from "./shared/bindingify-input-options-DVQ4K-zY.mjs";
1
+ import { T as VERSION } from "./shared/bindingify-input-options-44iPAymO.mjs";
2
2
  import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
3
- import { t as loadConfig } from "./shared/load-config-R0z2olkB.mjs";
3
+ import { t as loadConfig } from "./shared/load-config-C6QXSnoS.mjs";
4
4
  export { VERSION, defineConfig, loadConfig };
@@ -0,0 +1,116 @@
1
+ // @ts-check
2
+
3
+ /** @import { DevRuntime } from './runtime-extra-dev-common.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
+ };
@@ -1,7 +1,7 @@
1
- import { H as ResolverFactory, J as moduleRunnerTransform, K as isolatedDeclaration, L as NapiResolveOptions, M as IsolatedDeclarationsOptions, N as IsolatedDeclarationsResult, V as ResolveResult, _ as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, k as BindingViteTransformPluginConfig, n as BindingBundleAnalyzerPluginConfig, p as BindingRebuildStrategy, q as isolatedDeclarationSync, r as BindingBundleState, u as BindingLazyChunkOutput, v as BindingTsconfigRawOptions, w as BindingViteManifestPluginConfig } from "./shared/binding-Dbbi0RbO.mjs";
2
- import { Bt as OutputOptions, F as BuiltinPlugin, Q as defineParallelPlugin, Wt as StringOrRegExp, Yt as RolldownOutput, Zt as freeExternalMemory, l as InputOptions, lt as NormalizedOutputOptions } from "./shared/define-config-B-IDOhDz.mjs";
3
- import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-Cs2bUDRH.mjs";
4
- import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CSWbNgBZ.mjs";
1
+ import { H as ResolverFactory, J as moduleRunnerTransform, K as isolatedDeclaration, L as NapiResolveOptions, M as IsolatedDeclarationsOptions, N as IsolatedDeclarationsResult, V as ResolveResult, _ as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, k as BindingViteTransformPluginConfig, n as BindingBundleAnalyzerPluginConfig, p as BindingRebuildStrategy, q as isolatedDeclarationSync, r as BindingBundleState, u as BindingLazyChunkOutput, v as BindingTsconfigRawOptions, w as BindingViteManifestPluginConfig } from "./shared/binding-CVtkJvyl.mjs";
2
+ import { $ as defineParallelPlugin, Gt as StringOrRegExp, I as BuiltinPlugin, Qt as freeExternalMemory, Vt as OutputOptions, Xt as RolldownOutput, l as InputOptions, ut as NormalizedOutputOptions } from "./shared/define-config-DVsXPNaU.mjs";
3
+ import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-WmU_cI8e.mjs";
4
+ import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-XaIbWpwJ.mjs";
5
5
  //#region src/api/dev/dev-options.d.ts
6
6
  type DevOnHmrUpdates = (result: Error | {
7
7
  updates: BindingClientHmrUpdate[];
@@ -10,6 +10,12 @@ type DevOnHmrUpdates = (result: Error | {
10
10
  type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
11
11
  type DevOnAdditionalAssets = (output: RolldownOutput) => void | Promise<void>;
12
12
  interface DevWatchOptions {
13
+ /**
14
+ * If `false`, no file system watcher is started, so file changes are never
15
+ * picked up and no rebuild or HMR update is triggered on their own.
16
+ * @default true
17
+ */
18
+ enabled?: boolean;
13
19
  /**
14
20
  * If `true`, files are not written to disk.
15
21
  * @default false
@@ -1,17 +1,18 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
2
- import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-SiXbePVH.mjs";
3
- import { o as transformToRollupOutput } from "./shared/bindingify-input-options-DVQ4K-zY.mjs";
4
- import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-BGXNOfvH.mjs";
5
- import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-DFGNOCle.mjs";
6
- import { n as parseSync$1, t as parse$1 } from "./shared/parse-D5dkElpf.mjs";
7
- import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CuGa75s-.mjs";
8
- import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-2TXRF_zr.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-CKyeQZen.mjs";
2
+ import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-DYjJ67tj.mjs";
3
+ import { u as transformToRollupOutput } from "./shared/bindingify-input-options-44iPAymO.mjs";
4
+ import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./shared/create-bundler-option-e1FU0w0P.mjs";
5
+ import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BzLGqhSQ.mjs";
6
+ import { n as parseSync$1, t as parse$1 } from "./shared/parse-uDDyc1el.mjs";
7
+ import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-6Zc-JFd7.mjs";
8
+ import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-Bcd82vVT.mjs";
9
9
  import { pathToFileURL } from "node:url";
10
10
  //#region src/api/dev/dev-engine.ts
11
11
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
12
12
  var DevEngine = class DevEngine {
13
13
  #inner;
14
14
  #cachedBuildFinishPromise = null;
15
+ #asyncRuntimeReleased = false;
15
16
  static async create(inputOptions, outputOptions = {}, devOptions = {}) {
16
17
  inputOptions = await PluginDriver.callOptionsHook(inputOptions);
17
18
  const options = await createBundlerOptions(inputOptions, outputOptions, false);
@@ -46,6 +47,7 @@ var DevEngine = class DevEngine {
46
47
  } : void 0,
47
48
  rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : import_binding.BindingRebuildStrategy.Never : void 0,
48
49
  watch: devOptions.watch && {
50
+ enabled: devOptions.watch.enabled,
49
51
  skipWrite: devOptions.watch.skipWrite,
50
52
  usePolling: devOptions.watch.usePolling,
51
53
  pollInterval: devOptions.watch.pollInterval,
@@ -58,6 +60,7 @@ var DevEngine = class DevEngine {
58
60
  }
59
61
  };
60
62
  const inner = new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions);
63
+ (0, import_binding.startAsyncRuntime)();
61
64
  return new DevEngine(inner);
62
65
  }
63
66
  constructor(inner) {
@@ -101,7 +104,13 @@ var DevEngine = class DevEngine {
101
104
  await this.#inner.removeClient(clientId);
102
105
  }
103
106
  async close() {
104
- await this.#inner.close();
107
+ const shouldRelease = !this.#asyncRuntimeReleased;
108
+ this.#asyncRuntimeReleased = true;
109
+ try {
110
+ await this.#inner.close();
111
+ } finally {
112
+ if (shouldRelease) (0, import_binding.shutdownAsyncRuntime)();
113
+ }
105
114
  }
106
115
  /**
107
116
  * Compile a lazy entry module and return HMR-style patch code.
@@ -182,18 +191,25 @@ function freeExternalMemory(handle, keepDataAlive = false) {
182
191
  const scan = async (rawInputOptions, rawOutputOptions = {}) => {
183
192
  validateOption("input", rawInputOptions);
184
193
  validateOption("output", rawOutputOptions);
185
- const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
194
+ const inputOptions = await PluginDriver.callOptionsHook(rawInputOptions);
195
+ const ret = await createBundlerOptions(inputOptions, rawOutputOptions, false);
186
196
  const bundler = new import_binding.BindingBundler();
187
- if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
197
+ (0, import_binding.startAsyncRuntime)();
198
+ let cleanedUp = false;
188
199
  async function cleanup() {
189
- await bundler.close();
190
- await ret.stopWorkers?.();
191
- (0, import_binding.shutdownAsyncRuntime)();
192
- RolldownBuild.asyncRuntimeShutdown = true;
200
+ if (cleanedUp) return;
201
+ cleanedUp = true;
202
+ try {
203
+ await bundler.close();
204
+ await ret.stopWorkers?.();
205
+ } finally {
206
+ (0, import_binding.shutdownAsyncRuntime)();
207
+ }
193
208
  }
194
209
  let cleanupPromise = Promise.resolve();
195
210
  try {
196
- unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
211
+ const result = await bundler.scan(ret.bundlerOptions);
212
+ unwrapBindingResult(result);
197
213
  } catch (err) {
198
214
  await cleanup();
199
215
  throw err;
@@ -0,0 +1,95 @@
1
+ export var __create = Object.create;
2
+ export var __defProp = Object.defineProperty;
3
+ export var __name = (target, value) => __defProp(target, 'name', { value, configurable: true });
4
+ export var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ export var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ export var __getProtoOf = Object.getPrototypeOf;
7
+ export var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ export var __esm = (fn, res, err) =>
9
+ function () {
10
+ if (err) throw err[0];
11
+ try {
12
+ return (fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res);
13
+ } catch (e) {
14
+ throw ((err = [e]), e);
15
+ }
16
+ };
17
+ export var __esmMin = (fn, res, err) => () => {
18
+ if (err) throw err[0];
19
+ try {
20
+ return (fn && (res = fn((fn = 0))), res);
21
+ } catch (e) {
22
+ throw ((err = [e]), e);
23
+ }
24
+ };
25
+ export var __commonJS = (cb, mod) =>
26
+ function () {
27
+ return (
28
+ mod || ((0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), cb = null), mod.exports
29
+ );
30
+ };
31
+ export var __commonJSMin = (cb, mod) => () => (
32
+ mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports
33
+ );
34
+ export var __exportAll = (all, no_symbols) => {
35
+ let target = {};
36
+ for (var name in all) {
37
+ __defProp(target, name, { get: all[name], enumerable: true });
38
+ }
39
+ if (!no_symbols) {
40
+ __defProp(target, Symbol.toStringTag, { value: 'Module' });
41
+ }
42
+ return target;
43
+ };
44
+ export var __copyProps = (to, from, except, desc) => {
45
+ if ((from && typeof from === 'object') || typeof from === 'function') {
46
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
47
+ key = keys[i];
48
+ if (!__hasOwnProp.call(to, key) && key !== except) {
49
+ __defProp(to, key, {
50
+ get: ((k) => from[k]).bind(null, key),
51
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
52
+ });
53
+ }
54
+ }
55
+ }
56
+ return to;
57
+ };
58
+ export var __reExport = (target, mod, secondTarget) => (
59
+ __copyProps(target, mod, 'default'), secondTarget && __copyProps(secondTarget, mod, 'default')
60
+ );
61
+ export var __toESM = (mod, isNodeMode, target) => (
62
+ (target = mod != null ? __create(__getProtoOf(mod)) : {}),
63
+ __copyProps(
64
+ // `__esModule` alone is not enough: the module must own a `default` (#10360).
65
+ isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, 'default')
66
+ ? __defProp(target, 'default', { value: mod, enumerable: true })
67
+ : target,
68
+ mod,
69
+ )
70
+ );
71
+ export var __toCommonJS = (mod) =>
72
+ __hasOwnProp.call(mod, 'module.exports')
73
+ ? mod['module.exports']
74
+ : __copyProps(__defProp({}, '__esModule', { value: true }), mod);
75
+ export var __toBinaryNode = (base64) => new Uint8Array(Buffer.from(base64, 'base64'));
76
+ export var __toBinary = /* @__PURE__ */ (() => {
77
+ var table = new Uint8Array(128);
78
+ for (var i = 0; i < 64; i++) {
79
+ table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
80
+ }
81
+ return (base64) => {
82
+ var n = base64.length,
83
+ bytes = new Uint8Array((((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3) / 4) | 0);
84
+ for (var i = 0, j = 0; i < n; ) {
85
+ var c0 = table[base64.charCodeAt(i++)],
86
+ c1 = table[base64.charCodeAt(i++)];
87
+ var c2 = table[base64.charCodeAt(i++)],
88
+ c3 = table[base64.charCodeAt(i++)];
89
+ bytes[j++] = (c0 << 2) | (c1 >> 4);
90
+ bytes[j++] = (c1 << 4) | (c2 >> 2);
91
+ bytes[j++] = (c2 << 6) | c3;
92
+ }
93
+ return bytes;
94
+ };
95
+ })();