@voidzero-dev/vite-plus-core 1.0.0 → 1.2.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 (68) hide show
  1. package/LICENSE +36 -177
  2. package/dist/rolldown/cli.mjs +33 -29
  3. package/dist/rolldown/config.d.mts +3 -3
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +29 -29
  6. package/dist/rolldown/experimental-index.mjs +8 -8
  7. package/dist/rolldown/experimental-runtime-types.d.ts +39 -7
  8. package/dist/rolldown/experimental-runtime.d.ts +39 -7
  9. package/dist/rolldown/experimental-runtime.mjs +284 -255
  10. package/dist/rolldown/filter-index.d.mts +1 -1
  11. package/dist/rolldown/index.d.mts +3 -3
  12. package/dist/rolldown/index.mjs +4 -4
  13. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  14. package/dist/rolldown/parallel-plugin.d.mts +3 -3
  15. package/dist/rolldown/parse-ast-index.d.mts +6 -7
  16. package/dist/rolldown/parse-ast-index.mjs +1 -1
  17. package/dist/rolldown/plugins-index.d.mts +5 -5
  18. package/dist/rolldown/plugins-index.mjs +2 -2
  19. package/dist/rolldown/shared/{binding-BY0qR5iS.mjs → binding-DlR5d34p.mjs} +27 -28
  20. package/dist/rolldown/shared/{binding-BTa6BPQe.d.mts → binding-tzp6Hc_3.d.mts} +1 -1
  21. package/dist/rolldown/shared/{bindingify-input-options-B8JHmN6_.mjs → bindingify-input-options-DhjlrWZE.mjs} +203 -20
  22. package/dist/rolldown/shared/{constructors-xEvVj3lN.mjs → constructors-B2hkJoIA.mjs} +1 -1
  23. package/dist/rolldown/shared/{constructors-DuOq7MqW.d.mts → constructors-Dw9H1IvX.d.mts} +2 -2
  24. package/dist/rolldown/shared/{create-bundler-option-COco-7P6.mjs → create-bundler-option-1AEe_J0o.mjs} +36 -10
  25. package/dist/rolldown/shared/{define-config-C7HCoqY8.d.mts → define-config-CGhm2DU-.d.mts} +94 -5
  26. package/dist/rolldown/shared/{error-C7pxws0W.mjs → error-Dsqzw0Oa.mjs} +2 -1
  27. package/dist/rolldown/shared/{load-config-DkUBnDsI.mjs → load-config-bvw8z7Ft.mjs} +2 -2
  28. package/dist/rolldown/shared/{normalize-string-or-regex-F14uvr6D.mjs → normalize-string-or-regex-B7Gsiuz7.mjs} +1 -1
  29. package/dist/rolldown/shared/{parse-BWeE7Vr9.mjs → parse-BCSSrLHf.mjs} +2 -2
  30. package/dist/rolldown/shared/{resolve-tsconfig-DHwpIs5e.mjs → resolve-tsconfig-DyR2RUTm.mjs} +2 -2
  31. package/dist/rolldown/shared/{rolldown-Bue0gNT5.mjs → rolldown-C8QomUuX.mjs} +4 -4
  32. package/dist/rolldown/shared/{transform-DK_nCt9j.d.mts → transform-D4RDjIPI.d.mts} +1 -1
  33. package/dist/rolldown/shared/{watch-RXhXN1aG.mjs → watch-CPI70Lkn.mjs} +4 -4
  34. package/dist/rolldown/utils-index.d.mts +5 -5
  35. package/dist/rolldown/utils-index.mjs +5 -5
  36. package/dist/tsdown/{build-JVmLFaZt-DRlLhpV3.js → build-KEepWO_k-BOsPZ2cH.js} +26 -25
  37. package/dist/tsdown/{debug-CpC4hV25-C-OYr2iI.js → debug-DKTolR2K-BMJOFfj2.js} +4 -5
  38. package/dist/tsdown/{detect-Bg-d8iUV-Du8LljhG.js → detect-DHDepxVX-CpWW52Jd.js} +38 -34
  39. package/dist/tsdown/dist-BebyOHRu.js +6224 -0
  40. package/dist/tsdown/index-types.d.ts +216 -216
  41. package/dist/tsdown/index.js +4 -4
  42. package/dist/tsdown/{main-CyNcZUzu.js → main-Du9xCnhX.js} +105 -19
  43. package/dist/tsdown/npm_entry_picomatch.cjs +36 -25
  44. package/dist/tsdown/{resolver-DE0_sy8o-Bi3xbRxi.js → resolver-DE0_sy8o-DNoi-dFQ.js} +3 -2
  45. package/dist/tsdown/run.js +28 -26
  46. package/dist/tsdown/{src-pN7Bl6zo.js → src-CBWRkeF5.js} +4 -4
  47. package/dist/tsdown/{target-DgdLrXba-DpO9JXxB.js → target-HZbF5Cux-Cmv1LI5D.js} +175 -9
  48. package/dist/tsdown/{tsc-BLb4pSBY.js → tsc-YwU2b8yT.js} +4 -4
  49. package/dist/tsdown/tsdown-css.js +4 -4
  50. package/dist/tsdown/tsdown-exe.js +5 -43
  51. package/dist/vite/client/bundledDevClient.mjs +109 -345
  52. package/dist/vite/client/client.mjs +80 -28
  53. package/dist/vite/node/chunks/build.js +19 -19
  54. package/dist/vite/node/chunks/node.js +5210 -4942
  55. package/dist/vite/node/chunks/postcss-import.js +10 -10
  56. package/dist/vite/node/cli.js +24 -21
  57. package/dist/vite/node/index.d.ts +5 -2
  58. package/dist/vite/node/index.js +1 -2
  59. package/dist/vite/node/internal.js +1 -2
  60. package/dist/vite/node/module-runner.d.ts +1 -0
  61. package/dist/vite/node/module-runner.js +32 -27
  62. package/package.json +46 -30
  63. package/dist/rolldown/experimental-default-runtime.mjs +0 -116
  64. package/dist/rolldown/experimental-runtime-base.mjs +0 -95
  65. package/dist/tsdown/dist-VDcV1Qyy.js +0 -2952
  66. package/dist/tsdown/require-BbBF8Ii0-BDaWJgzA.js +0 -320
  67. package/dist/tsdown/style-DiMP8pYv-DIC5PXeH.js +0 -88
  68. package/dist/tsdown/version-CQ98ZBpL-D6GAHapk.js +0 -169
@@ -1,6 +1,6 @@
1
1
  import { mt as __require, pt as __commonJSMin } from "./node.js";
2
2
  import { t as require_lib } from "./lib.js";
3
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/format-import-prelude.js
3
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/format-import-prelude.js
4
4
  var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
5
  module.exports = function formatImportPrelude(layer, media, supports) {
6
6
  const parts = [];
@@ -15,7 +15,7 @@ var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, mod
15
15
  };
16
16
  }));
17
17
  //#endregion
18
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/base64-encoded-import.js
18
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/base64-encoded-import.js
19
19
  var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20
20
  const formatImportPrelude = require_format_import_prelude();
21
21
  module.exports = function base64EncodedConditionalImport(prelude, conditions) {
@@ -28,7 +28,7 @@ var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, mod
28
28
  };
29
29
  }));
30
30
  //#endregion
31
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-conditions.js
31
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/apply-conditions.js
32
32
  var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
33
33
  const base64EncodedConditionalImport = require_base64_encoded_import();
34
34
  module.exports = function applyConditions(bundle, atRule) {
@@ -103,7 +103,7 @@ var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module)
103
103
  };
104
104
  }));
105
105
  //#endregion
106
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-raws.js
106
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/apply-raws.js
107
107
  var require_apply_raws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
108
108
  module.exports = function applyRaws(bundle) {
109
109
  bundle.forEach((stmt, index) => {
@@ -114,7 +114,7 @@ var require_apply_raws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
114
114
  };
115
115
  }));
116
116
  //#endregion
117
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/apply-styles.js
117
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/apply-styles.js
118
118
  var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
119
119
  module.exports = function applyStyles(bundle, styles) {
120
120
  styles.nodes = [];
@@ -134,7 +134,7 @@ var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134
134
  };
135
135
  }));
136
136
  //#endregion
137
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/data-url.js
137
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/data-url.js
138
138
  var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
139
139
  const anyDataURLRegexp = /^data:text\/css(?:;(base64|plain))?,/i;
140
140
  const base64DataURLRegexp = /^data:text\/css;base64,/i;
@@ -153,7 +153,7 @@ var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
153
153
  };
154
154
  }));
155
155
  //#endregion
156
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/parse-statements.js
156
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/parse-statements.js
157
157
  var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module) => {
158
158
  const valueParser = require_lib();
159
159
  const { stringify } = valueParser;
@@ -278,7 +278,7 @@ var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module)
278
278
  }
279
279
  }));
280
280
  //#endregion
281
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/process-content.js
281
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/process-content.js
282
282
  var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) => {
283
283
  const path$2 = __require("path");
284
284
  let sugarss;
@@ -312,7 +312,7 @@ var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) =
312
312
  }
313
313
  }));
314
314
  //#endregion
315
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/lib/parse-styles.js
315
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/lib/parse-styles.js
316
316
  var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
317
317
  const path$1 = __require("path");
318
318
  const dataURL = require_data_url();
@@ -416,7 +416,7 @@ var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
416
416
  module.exports = parseStyles;
417
417
  }));
418
418
  //#endregion
419
- //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.28/node_modules/postcss-import/index.js
419
+ //#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.29/node_modules/postcss-import/index.js
420
420
  var require_postcss_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
421
421
  const path = __require("path");
422
422
  const applyConditions = require_apply_conditions();
@@ -3,7 +3,7 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { performance } from "node:perf_hooks";
5
5
  import { inspect } from "node:util";
6
- //#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
6
+ //#region ../../node_modules/.pnpm/cac@7.0.1/node_modules/cac/dist/index.js
7
7
  function toArr(any) {
8
8
  return any == null ? [] : Array.isArray(any) ? any : [any];
9
9
  }
@@ -104,23 +104,23 @@ function findAllBrackets(v) {
104
104
  }
105
105
  function getMriOptions(options) {
106
106
  const result = {
107
- alias: {},
107
+ alias: Object.create(null),
108
108
  boolean: []
109
109
  };
110
110
  for (const [index, option] of options.entries()) {
111
111
  if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
112
- if (option.isBoolean) if (option.negated) {
113
- if (!options.some((o, i) => {
114
- return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
115
- })) result.boolean.push(option.names[0]);
116
- } else result.boolean.push(option.names[0]);
112
+ if (option.isBoolean) {
113
+ if (option.negated) {
114
+ if (!options.some((o, i) => {
115
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
116
+ })) result.boolean.push(option.names[0]);
117
+ } else result.boolean.push(option.names[0]);
118
+ }
117
119
  }
118
120
  return result;
119
121
  }
120
122
  function findLongest(arr) {
121
- return arr.sort((a, b) => {
122
- return a.length > b.length ? -1 : 1;
123
- })[0];
123
+ return arr.sort((a, b) => b.length - a.length)[0];
124
124
  }
125
125
  function padRight(str, length) {
126
126
  return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
@@ -130,7 +130,13 @@ function camelcase(input) {
130
130
  return p1 + p2.toUpperCase();
131
131
  });
132
132
  }
133
+ const UNSAFE_KEYS = /* @__PURE__ */ new Set([
134
+ "__proto__",
135
+ "constructor",
136
+ "prototype"
137
+ ]);
133
138
  function setDotProp(obj, keys, val) {
139
+ if (keys.some((key) => UNSAFE_KEYS.has(key))) return;
134
140
  let current = obj;
135
141
  for (let i = 0; i < keys.length; i++) {
136
142
  const key = keys[i];
@@ -146,12 +152,9 @@ function setDotProp(obj, keys, val) {
146
152
  }
147
153
  }
148
154
  function setByType(obj, transforms) {
149
- for (const key of Object.keys(transforms)) {
150
- const transform = transforms[key];
151
- if (transform.shouldTransform) {
152
- obj[key] = [obj[key]].flat();
153
- if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
154
- }
155
+ for (const [key, transform] of Object.entries(transforms)) if (transform.shouldTransform) {
156
+ obj[key] = [obj[key]].flat();
157
+ if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
155
158
  }
156
159
  }
157
160
  function getFileName(input) {
@@ -194,7 +197,7 @@ var Option = class {
194
197
  name = name.replace(/^no-/, "");
195
198
  }
196
199
  return camelcaseOptionName(name);
197
- }).sort((a, b) => a.length > b.length ? 1 : -1);
200
+ }).sort((a, b) => a.length - b.length);
198
201
  this.name = this.names.at(-1);
199
202
  if (this.negated && this.config.default == null) this.config.default = true;
200
203
  if (rawName.includes("<")) this.required = true;
@@ -297,7 +300,7 @@ var Command = class {
297
300
  * @param name Option name
298
301
  */
299
302
  hasOption(name) {
300
- name = name.split(".")[0];
303
+ name = name.split(".", 1)[0];
301
304
  return this.options.find((option) => {
302
305
  return option.names.includes(name);
303
306
  });
@@ -372,7 +375,7 @@ var Command = class {
372
375
  const { options: parsedOptions, globalCommand } = this.cli;
373
376
  const options = [...globalCommand.options, ...this.options];
374
377
  for (const option of options) {
375
- const value = parsedOptions[option.name.split(".")[0]];
378
+ const value = parsedOptions[option.name.split(".", 1)[0]];
376
379
  if (option.required) {
377
380
  const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
378
381
  if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
@@ -591,8 +594,8 @@ var CAC = class extends EventTarget {
591
594
  transforms[cliOption.name].transformFunction = cliOption.config.type[0];
592
595
  }
593
596
  }
594
- for (const key of Object.keys(parsed)) if (key !== "_") {
595
- setDotProp(options, key.split("."), parsed[key]);
597
+ for (const [key, value] of Object.entries(parsed)) if (key !== "_") {
598
+ setDotProp(options, key.split("."), value);
596
599
  setByType(options, transforms);
597
600
  }
598
601
  return {
@@ -1100,6 +1100,7 @@ export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | u
1100
1100
  type MemoryFile = {
1101
1101
  source: string | Uint8Array;
1102
1102
  etag?: string;
1103
+ contentType?: string;
1103
1104
  };
1104
1105
  declare class MemoryFiles {
1105
1106
  private files;
@@ -1112,7 +1113,8 @@ declare class MemoryFiles {
1112
1113
  declare class BundledDev {
1113
1114
  private environment;
1114
1115
  private _devEngine;
1115
- private viteRuntime?;
1116
+ /** the vite client and the rolldown runtime; set before the first build so `hasBuildOutput` can count them */
1117
+ private staticFiles;
1116
1118
  private initialBuildCompleted;
1117
1119
  private _closed;
1118
1120
  private clients;
@@ -1144,6 +1146,7 @@ declare class BundledDev {
1144
1146
  */
1145
1147
  markPayloadDelivered(filename: string): void;
1146
1148
  close(): Promise<void>;
1149
+ private storeStaticFiles;
1147
1150
  private storeOutputFiles;
1148
1151
  private getRolldownOptions;
1149
1152
  private handleHmrOutput;
@@ -3130,7 +3133,7 @@ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: stri
3130
3133
  */
3131
3134
  export declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
3132
3135
  //#endregion
3133
- //#region ../../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.28_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/index.d.ts
3136
+ //#region ../../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_yaml@2.9.1/node_modules/postcss-load-config/src/index.d.ts
3134
3137
  type ConfigPlugin = Transformer | PostCSS.Plugin | Processor;
3135
3138
  interface Config {
3136
3139
  parser?: string | ProcessOptions['parser'] | false;
@@ -1,2 +1 @@
1
- import { $ as normalizePath, A as optimizeDeps, B as createServerModuleRunner, D as formatPostcssSourceMap, E as createBuilder, F as searchForWorkspaceRoot, G as perEnvironmentState, H as buildErrorMessage, I as isFileLoadingAllowed, J as perEnvironmentPlugin, K as loadEnv, L as isFileServingAllowed, M as createServerHotChannel, N as createServer, O as preprocessCSS, Q as mergeConfig, R as send, S as preview, T as build, U as transformWithOxc, V as createServerModuleRunnerTransport, W as transformWithEsbuild, X as isCSSRequest, Y as createFilter, Z as mergeAlias, _ as runnerImport, a as minifySync, at as DEFAULT_CLIENT_MAIN_FIELDS, b as DevEnvironment, c as parseAstAsync, ct as DEFAULT_SERVER_MAIN_FIELDS, d as isFetchableDevEnvironment, dt as defaultAllowedOrigins, et as rolldownVersion, g as sortUserPlugins, h as resolveConfig, i as minify, it as DEFAULT_CLIENT_CONDITIONS, k as createIdResolver, l as parseSync, lt as VERSION, m as loadConfigFromFile, n as esbuildVersion, nt as withFilter, o as parse, ot as DEFAULT_EXTERNAL_CONDITIONS, p as defineConfig, q as resolveEnvPrefix, r as esmExternalRequirePlugin, rt as createLogger, s as parseAst, st as DEFAULT_SERVER_CONDITIONS, t as Visitor, tt as rollupVersion, u as createFetchableDevEnvironment, v as createRunnableDevEnvironment, w as BuildEnvironment, x as fetchModule, y as isRunnableDevEnvironment, z as ssrTransform } from "./chunks/node.js";
2
- export { BuildEnvironment, DevEnvironment, Visitor, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
1
+ export { w as BuildEnvironment, b as DevEnvironment, t as Visitor, T as build, H as buildErrorMessage, E as createBuilder, u as createFetchableDevEnvironment, Y as createFilter, k as createIdResolver, rt as createLogger, v as createRunnableDevEnvironment, N as createServer, M as createServerHotChannel, B as createServerModuleRunner, V as createServerModuleRunnerTransport, dt as defaultAllowedOrigins, it as defaultClientConditions, at as defaultClientMainFields, ot as defaultExternalConditions, st as defaultServerConditions, ct as defaultServerMainFields, p as defineConfig, n as esbuildVersion, r as esmExternalRequirePlugin, x as fetchModule, D as formatPostcssSourceMap, X as isCSSRequest, d as isFetchableDevEnvironment, I as isFileLoadingAllowed, L as isFileServingAllowed, y as isRunnableDevEnvironment, m as loadConfigFromFile, K as loadEnv, Z as mergeAlias, Q as mergeConfig, i as minify, a as minifySync, z as moduleRunnerTransform, $ as normalizePath, A as optimizeDeps, o as parse, s as parseAst, c as parseAstAsync, l as parseSync, J as perEnvironmentPlugin, G as perEnvironmentState, O as preprocessCSS, S as preview, h as resolveConfig, q as resolveEnvPrefix, et as rolldownVersion, tt as rollupVersion, _ as runnerImport, F as searchForWorkspaceRoot, R as send, g as sortUserPlugins, W as transformWithEsbuild, U as transformWithOxc, lt as version, nt as withFilter } from "./chunks/node.js";
@@ -1,2 +1 @@
1
- import { viteReactRefreshWrapperPlugin as reactRefreshWrapperPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
2
- export { reactRefreshWrapperPlugin };
1
+ export { viteReactRefreshWrapperPlugin as reactRefreshWrapperPlugin } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
@@ -37,6 +37,7 @@ interface HotModule {
37
37
  interface HotCallback {
38
38
  deps: string[];
39
39
  fn: (modules: Array<ModuleNamespace | undefined>) => void;
40
+ exports?: readonly string[];
40
41
  }
41
42
  interface HMRLogger {
42
43
  error(msg: string | Error): void;
@@ -39,6 +39,19 @@ function promiseWithResolvers() {
39
39
  reject
40
40
  };
41
41
  }
42
+ const percentEncodedRE = /(?:%[0-9a-f]{2})+/gi, whitespaceOnlyRE = /^\s+$/;
43
+ /** Reverses {@link encodeSourceURL}. */
44
+ function decodeSourceURL(url) {
45
+ return url.replace(percentEncodedRE, (match) => {
46
+ let decoded;
47
+ try {
48
+ decoded = decodeURIComponent(match);
49
+ } catch {
50
+ return match;
51
+ }
52
+ return whitespaceOnlyRE.test(decoded) ? decoded : match;
53
+ });
54
+ }
42
55
  //#endregion
43
56
  //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
44
57
  var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = /* @__PURE__ */ new Uint8Array(64), charToInt = /* @__PURE__ */ new Uint8Array(128);
@@ -389,8 +402,8 @@ var HMRContext = class {
389
402
  else if (Array.isArray(deps)) this.acceptDeps(deps, callback);
390
403
  else throw Error("invalid hot.accept() usage.");
391
404
  }
392
- acceptExports(_, callback) {
393
- this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod));
405
+ acceptExports(exportNames, callback) {
406
+ this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod), typeof exportNames == "string" ? [exportNames] : exportNames);
394
407
  }
395
408
  dispose(cb) {
396
409
  this.hmrClient.disposeMap.set(this.ownerPath, cb);
@@ -423,11 +436,7 @@ var HMRContext = class {
423
436
  let existing = map.get(event);
424
437
  if (existing === void 0) return;
425
438
  let pruned = existing.filter((l) => l !== cb);
426
- if (pruned.length === 0) {
427
- map.delete(event);
428
- return;
429
- }
430
- map.set(event, pruned);
439
+ pruned.length === 0 ? map.delete(event) : map.set(event, pruned);
431
440
  };
432
441
  removeFromMap(this.hmrClient.customListenersMap), removeFromMap(this.newListeners);
433
442
  }
@@ -438,14 +447,15 @@ var HMRContext = class {
438
447
  data
439
448
  });
440
449
  }
441
- acceptDeps(deps, callback = () => {}) {
450
+ acceptDeps(deps, callback = () => {}, exports) {
442
451
  let mod = this.hmrClient.hotModulesMap.get(this.ownerPath) || {
443
452
  id: this.ownerPath,
444
453
  callbacks: []
445
454
  };
446
455
  mod.callbacks.push({
447
456
  deps,
448
- fn: callback
457
+ fn: callback,
458
+ exports
449
459
  }), this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
450
460
  }
451
461
  }, HMRClient = class {
@@ -674,15 +684,11 @@ const createWebSocketModuleRunnerTransport = (options) => {
674
684
  socket.addEventListener("open", () => {
675
685
  isOpened = !0, resolve();
676
686
  }, { once: !0 }), socket.addEventListener("close", () => {
677
- if (!isOpened) {
678
- reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
679
- return;
680
- }
681
- onMessage({
687
+ isOpened ? (onMessage({
682
688
  type: "custom",
683
689
  event: "vite:ws:disconnect",
684
690
  data: { webSocket: socket }
685
- }), onDisconnection();
691
+ }), onDisconnection()) : reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
686
692
  });
687
693
  }), onMessage({
688
694
  type: "custom",
@@ -898,11 +904,8 @@ function getModulesEntrypoints(runner, modules, visited = /* @__PURE__ */ new Se
898
904
  visited.add(moduleId);
899
905
  let module = runner.evaluatedModules.getModuleById(moduleId);
900
906
  if (module) {
901
- if (!module.importers.size) {
902
- entrypoints.add(module.url);
903
- continue;
904
- }
905
- for (let importer of module.importers) getModulesEntrypoints(runner, [importer], visited, entrypoints);
907
+ if (!module.importers.size) entrypoints.add(module.url);
908
+ else for (let importer of module.importers) getModulesEntrypoints(runner, [importer], visited, entrypoints);
906
909
  }
907
910
  }
908
911
  return entrypoints;
@@ -940,10 +943,11 @@ function supportRelativeURL(file, url) {
940
943
  return protocol && /^\/\w:/.test(startPath) ? (protocol += "/", protocol + slash(posixResolve(startPath, url))) : protocol + posixResolve(startPath, url);
941
944
  }
942
945
  function getRunnerSourceMap(position) {
946
+ let id = decodeSourceURL(position.source);
943
947
  for (let moduleGraph of evaluatedModulesCache) {
944
- let sourceMap = moduleGraph.getModuleSourceMapById(position.source);
948
+ let sourceMap = moduleGraph.getModuleSourceMapById(id);
945
949
  if (sourceMap) return {
946
- url: position.source,
950
+ url: id,
947
951
  map: sourceMap,
948
952
  vite: !0
949
953
  };
@@ -1059,13 +1063,14 @@ function wrapCallSite(frame, state) {
1059
1063
  }), frame.isNative()) return state.curPosition = null, frame;
1060
1064
  let source = frame.getFileName() || frame.getScriptNameOrSourceURL();
1061
1065
  if (source) {
1062
- let position = mapSourcePosition({
1066
+ let unmapped = {
1063
1067
  name: null,
1064
1068
  source,
1065
1069
  line: frame.getLineNumber() ?? 0,
1066
1070
  column: (frame.getColumnNumber() ?? 1) - 1
1067
- });
1068
- state.curPosition = position, frame = cloneCallSite(frame);
1071
+ }, position = mapSourcePosition(unmapped);
1072
+ if (state.curPosition = position, position === unmapped && !state.nextPosition?.name && frame.getColumnNumber() != null && frame.getScriptNameOrSourceURL() === source) return frame;
1073
+ frame = cloneCallSite(frame);
1069
1074
  let originalFunctionName = frame.getFunctionName;
1070
1075
  return frame.getFunctionName = function() {
1071
1076
  let name = state.nextPosition == null ? originalFunctionName() : state.nextPosition.name || originalFunctionName();
@@ -1081,9 +1086,9 @@ function wrapCallSite(frame, state) {
1081
1086
  }, frame;
1082
1087
  }
1083
1088
  let origin = frame.isEval() && frame.getEvalOrigin();
1084
- return origin ? (origin = mapEvalOrigin(origin), frame = cloneCallSite(frame), frame.getEvalOrigin = function() {
1089
+ return origin && (origin = mapEvalOrigin(origin), frame = cloneCallSite(frame), frame.getEvalOrigin = function() {
1085
1090
  return origin || void 0;
1086
- }, frame) : frame;
1091
+ }), frame;
1087
1092
  }
1088
1093
  function prepareStackTrace(error, stack) {
1089
1094
  let errorString = `${error.name || "Error"}: ${error.message || ""}`, state = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidzero-dev/vite-plus-core",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -107,44 +107,47 @@
107
107
  "./types/internal/*": null
108
108
  },
109
109
  "dependencies": {
110
- "@oxc-project/runtime": "=0.151.0",
111
- "@oxc-project/types": "=0.151.0",
110
+ "@oxc-project/runtime": "=0.154.0",
111
+ "@oxc-project/types": "=0.154.0",
112
112
  "lightningcss": "^1.33.0",
113
- "postcss": "^8.5.6",
114
- "yuku-codegen": "^0.9.3",
115
- "yuku-parser": "^0.9.3"
113
+ "postcss": "^8.5.29",
114
+ "yuku-parser": "0.19.0"
116
115
  },
117
116
  "devDependencies": {
118
- "@ast-grep/napi": "^0.43.0",
117
+ "@ast-grep/napi": "^0.45.0",
119
118
  "@emnapi/core": "2.0.0-alpha.5",
120
119
  "@emnapi/runtime": "2.0.0-alpha.5",
121
120
  "@napi-rs/cli": "^3.10.0",
122
- "@oxc-node/cli": "^0.1.3",
123
- "@tsdown/css": "^0.23.0",
124
- "@tsdown/exe": "^0.23.0",
125
- "@vitejs/devtools": "^0.7.5",
121
+ "@oxc-node/cli": "^0.1.6",
122
+ "@tsdown/css": "^0.23.1",
123
+ "@tsdown/exe": "^0.23.1",
124
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
125
+ "@vitejs/devtools": "^0.7.6",
126
126
  "es-module-lexer": "^1.7.0",
127
127
  "hookable": "^6.0.1",
128
128
  "magic-string": "^0.30.21",
129
- "oxc-parser": "=0.151.0",
130
- "oxfmt": "=0.70.0",
129
+ "oxc-parser": "=0.154.0",
130
+ "oxfmt": "=0.73.0",
131
131
  "picocolors": "^1.1.1",
132
132
  "picomatch": "^4.0.2",
133
133
  "pkg-types": "^2.3.0",
134
- "rolldown": "1.2.11",
134
+ "rolldown": "1.2.13",
135
135
  "rolldown-plugin-dts": "^0.28.0",
136
136
  "rollup": "^4.63.0",
137
137
  "rollup-plugin-license": "^3.6.0",
138
138
  "semver": "^7.8.0",
139
139
  "tinyglobby": "^0.2.15",
140
140
  "tree-kill": "^1.2.2",
141
- "tsdown": "^0.23.0",
142
- "vite": "npm:@voidzero-dev/vite-plus-core@1.0.0"
141
+ "tsdown": "^0.23.1",
142
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.2.0"
143
143
  },
144
144
  "peerDependencies": {
145
145
  "@arethetypeswrong/core": "^0.18.1",
146
146
  "@types/node": "^20.19.0 || >=22.12.0",
147
+ "@typescript/native-preview": "*",
147
148
  "@vitejs/devtools": "^0.7.1",
149
+ "@volar/typescript": "~2.4.0",
150
+ "@vue/language-core": "~3.2.0 || ~3.3.0",
148
151
  "esbuild": "^0.27.0 || ^0.28.0",
149
152
  "jiti": ">=1.21.0",
150
153
  "less": "^4.0.0",
@@ -158,9 +161,25 @@
158
161
  "typescript": "^5.0.0 || ^6.0.0 || ^7.0.0",
159
162
  "unplugin-unused": ">=0.5.0",
160
163
  "unrun": "*",
164
+ "vue-tsc": "~3.2.0 || ~3.3.0",
161
165
  "yaml": "^2.4.2"
162
166
  },
163
167
  "peerDependenciesMeta": {
168
+ "@typescript/native-preview": {
169
+ "optional": true
170
+ },
171
+ "@volar/typescript": {
172
+ "optional": true
173
+ },
174
+ "@vue/language-core": {
175
+ "optional": true
176
+ },
177
+ "typescript": {
178
+ "optional": true
179
+ },
180
+ "vue-tsc": {
181
+ "optional": true
182
+ },
164
183
  "@arethetypeswrong/core": {
165
184
  "optional": true
166
185
  },
@@ -173,9 +192,6 @@
173
192
  "tsx": {
174
193
  "optional": true
175
194
  },
176
- "typescript": {
177
- "optional": true
178
- },
179
195
  "unplugin-unused": {
180
196
  "optional": true
181
197
  },
@@ -215,22 +231,22 @@
215
231
  },
216
232
  "optionalDependencies": {
217
233
  "fsevents": "~2.3.3",
218
- "@voidzero-dev/vite-plus-darwin-arm64": "1.0.0",
219
- "@voidzero-dev/vite-plus-darwin-x64": "1.0.0",
220
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.0.0",
221
- "@voidzero-dev/vite-plus-linux-arm64-musl": "1.0.0",
222
- "@voidzero-dev/vite-plus-linux-x64-gnu": "1.0.0",
223
- "@voidzero-dev/vite-plus-linux-x64-musl": "1.0.0",
224
- "@voidzero-dev/vite-plus-win32-x64-msvc": "1.0.0",
225
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.0.0"
234
+ "@voidzero-dev/vite-plus-darwin-arm64": "1.2.0",
235
+ "@voidzero-dev/vite-plus-darwin-x64": "1.2.0",
236
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.2.0",
237
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "1.2.0",
238
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "1.2.0",
239
+ "@voidzero-dev/vite-plus-linux-x64-musl": "1.2.0",
240
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "1.2.0",
241
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.2.0"
226
242
  },
227
243
  "engines": {
228
244
  "node": "^20.19.0 || ^22.18.0 || >=24.11.0"
229
245
  },
230
246
  "bundledVersions": {
231
- "vite": "8.3.1",
232
- "rolldown": "1.2.11",
233
- "tsdown": "0.23.0"
247
+ "vite": "8.3.4",
248
+ "rolldown": "1.2.13",
249
+ "tsdown": "0.23.1"
234
250
  },
235
251
  "scripts": {
236
252
  "build": "oxnode -C dev ./build.ts"
@@ -1,116 +0,0 @@
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
- };