@voidzero-dev/vite-plus-core 0.3.1 → 0.3.2

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 (62) hide show
  1. package/LICENSE +0 -29
  2. package/dist/rolldown/cli.mjs +6 -6
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +7 -2
  6. package/dist/rolldown/experimental-index.mjs +10 -9
  7. package/dist/rolldown/filter-index.d.mts +1 -1
  8. package/dist/rolldown/index.d.mts +1 -1
  9. package/dist/rolldown/index.mjs +4 -4
  10. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  11. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  12. package/dist/rolldown/parse-ast-index.mjs +1 -1
  13. package/dist/rolldown/plugins-index.d.mts +2 -2
  14. package/dist/rolldown/plugins-index.mjs +2 -2
  15. package/dist/rolldown/shared/{binding-DmImI4pj.mjs → binding-DH95uVkp.mjs} +27 -27
  16. package/dist/rolldown/shared/{bindingify-input-options-BYClWKnj.mjs → bindingify-input-options-BL4xrXys.mjs} +5 -5
  17. package/dist/rolldown/shared/{constructors-BM20b11r.d.mts → constructors-BnIg8feC.d.mts} +1 -1
  18. package/dist/rolldown/shared/{constructors-mRbcbLyX.mjs → constructors-CrhQ-yy_.mjs} +1 -1
  19. package/dist/rolldown/shared/{create-bundler-option-CHTBktos.mjs → create-bundler-option-Dk9AZBn_.mjs} +33 -9
  20. package/dist/rolldown/shared/{define-config-DNX0WekP.d.mts → define-config-DjHYbH6S.d.mts} +4 -0
  21. package/dist/rolldown/shared/{error-BP8lJHle.mjs → error-CRNyaqoL.mjs} +1 -1
  22. package/dist/rolldown/shared/{load-config-Cx5fx_8Q.mjs → load-config-CKqTUKwB.mjs} +1 -1
  23. package/dist/rolldown/shared/{normalize-string-or-regex-Dm69lpQ-.mjs → normalize-string-or-regex-BgP6W4eD.mjs} +1 -1
  24. package/dist/rolldown/shared/{parse-8sr82jSR.mjs → parse-DYyNe0IU.mjs} +2 -2
  25. package/dist/rolldown/shared/{resolve-tsconfig-BlNGaH3Y.mjs → resolve-tsconfig-jh43hFM_.mjs} +2 -2
  26. package/dist/rolldown/shared/{rolldown-CaX_Wmqc.mjs → rolldown-BpXK1q5_.mjs} +4 -4
  27. package/dist/rolldown/shared/{watch-YKfJgIxz.mjs → watch-Due6uYkS.mjs} +4 -4
  28. package/dist/rolldown/utils-index.d.mts +1 -1
  29. package/dist/rolldown/utils-index.mjs +5 -5
  30. package/dist/tsdown/{build-JVmLFaZt-kqQJ2U7s.js → build-JVmLFaZt-BN9yuB6k.js} +13 -426
  31. package/dist/tsdown/{debug-CpC4hV25-tvH_Dsg5.js → debug-CpC4hV25-BeCITV83.js} +4 -90
  32. package/dist/tsdown/{detect-Bg-d8iUV-KfbO7neP.js → detect-Bg-d8iUV-Cr_BRLVW.js} +1 -1
  33. package/dist/tsdown/{dist-Cuw3Ngo4.js → dist-ByW_jJfv.js} +5 -5
  34. package/dist/tsdown/index-types.d.ts +52 -52
  35. package/dist/tsdown/index.js +4 -4
  36. package/dist/tsdown/internal-DTYQdXId.js +3 -0
  37. package/dist/tsdown/{main-CyNcZUzu.js → main-bgV9NlwM.js} +88 -3
  38. package/dist/tsdown/{resolver-DE0_sy8o-ZQqHQjRu.js → resolver-DE0_sy8o-UMsN-SXx.js} +2 -2
  39. package/dist/tsdown/run.js +4 -4
  40. package/dist/tsdown/{src-BWidcM5N.js → src-D5xv98Iu.js} +4 -4
  41. package/dist/tsdown/target-DgdLrXba-DaJJ11xX.js +586 -0
  42. package/dist/tsdown/{tsc-ChjRhsoQ.js → tsc-BFDF_Im9.js} +3 -3
  43. package/dist/tsdown/tsdown-css.js +5 -3
  44. package/dist/tsdown/tsdown-exe.js +4 -15
  45. package/dist/vite/client/bundledDevClient.mjs +75 -40
  46. package/dist/vite/client/client.mjs +288 -260
  47. package/dist/vite/node/chunks/build.js +19 -19
  48. package/dist/vite/node/chunks/node.js +32770 -32305
  49. package/dist/vite/node/chunks/postcss-import.js +10 -10
  50. package/dist/vite/node/cli.js +12 -8
  51. package/dist/vite/node/index.d.ts +1568 -1577
  52. package/dist/vite/node/index.js +1 -1
  53. package/dist/vite/node/module-runner.d.ts +1 -1
  54. package/dist/vite/node/module-runner.js +199 -200
  55. package/dist/vite/types/customEvent.d.ts +2 -0
  56. package/dist/vite/types/hmrPayload.d.ts +2 -0
  57. package/dist/vite/types/internal/cssPreprocessorOptions.d.ts +2 -2
  58. package/dist/vite/types/internal/devtoolsOptions.d.ts +9 -0
  59. package/package.json +20 -23
  60. package/dist/tsdown/internal-D-JfB5uT.js +0 -29
  61. package/dist/tsdown/internal-lhH-5yya.js +0 -62
  62. package/dist/tsdown/version-CQ98ZBpL-Obdnv4J7.js +0 -141
@@ -41,7 +41,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
41
41
  }) : target, mod));
42
42
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
43
  //#endregion
44
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
44
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
45
45
  function _typeof(o) {
46
46
  "@babel/helpers - typeof";
47
47
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -51,7 +51,7 @@ function _typeof(o) {
51
51
  }, _typeof(o);
52
52
  }
53
53
  //#endregion
54
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
54
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
55
55
  function toPrimitive(t, r) {
56
56
  if ("object" != _typeof(t) || !t) return t;
57
57
  var e = t[Symbol.toPrimitive];
@@ -63,13 +63,13 @@ function toPrimitive(t, r) {
63
63
  return ("string" === r ? String : Number)(t);
64
64
  }
65
65
  //#endregion
66
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
66
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
67
67
  function toPropertyKey(t) {
68
68
  var i = toPrimitive(t, "string");
69
69
  return "symbol" == _typeof(i) ? i : i + "";
70
70
  }
71
71
  //#endregion
72
- //#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
72
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
73
73
  function _defineProperty(e, r, t) {
74
74
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
75
75
  value: t,
@@ -632,14 +632,14 @@ var BundledDevHMRClient = class extends HMRClient {
632
632
  if (importerIndex > -1) {
633
633
  const importChain = [
634
634
  importer,
635
- ...[...currentChain].reverse(),
635
+ ...currentChain.toReversed(),
636
636
  ...nodeChain.slice(importerIndex, -1).reverse()
637
637
  ];
638
638
  this.logger.debug(`circular imports detected: ${importChain.join(" -> ")}`);
639
639
  return true;
640
640
  }
641
641
  if (!currentChain.includes(importer)) {
642
- const result = this.isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
642
+ const result = this.isNodeWithinCircularImports(importer, nodeChain, [...currentChain, importer], traversedModules);
643
643
  if (result) return result;
644
644
  }
645
645
  }
@@ -782,9 +782,33 @@ var BundledDevHMRContext = class extends HMRContext {
782
782
  };
783
783
  //#endregion
784
784
  //#region ../../vite/packages/vite/src/shared/constants.ts
785
+ /**
786
+ * Prefix for resolved Ids that are not valid browser import specifiers
787
+ */
788
+ const VALID_ID_PREFIX = `/@id/`;
789
+ /**
790
+ * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
791
+ * module ID with `\0`, a convention from the rollup ecosystem.
792
+ * This prevents other plugins from trying to process the id (like node resolution),
793
+ * and core features like sourcemaps can use this info to differentiate between
794
+ * virtual modules and regular files.
795
+ * `\0` is not a permitted char in import URLs so we have to replace them during
796
+ * import analysis. The id will be decoded back before entering the plugins pipeline.
797
+ * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
798
+ * modules in the browser end up encoded as `/@id/__x00__{id}`
799
+ */
800
+ const NULL_BYTE_PLACEHOLDER = `__x00__`;
785
801
  let SOURCEMAPPING_URL = "sourceMa";
786
802
  SOURCEMAPPING_URL += "ppingURL";
787
803
  typeof process !== "undefined" && process.platform;
804
+ /**
805
+ * Prepend `/@id/` and replace null byte so the id is URL-safe.
806
+ * This is prepended to resolved ids that are not valid browser
807
+ * import specifiers by the importAnalysis plugin.
808
+ */
809
+ function wrapId(id) {
810
+ return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
811
+ }
788
812
  (async function() {}).constructor;
789
813
  function promiseWithResolvers() {
790
814
  let resolve;
@@ -1002,39 +1026,6 @@ const createWebSocketModuleRunnerTransport = (options) => {
1002
1026
  };
1003
1027
  };
1004
1028
  //#endregion
1005
- //#region ../../vite/packages/vite/src/shared/hmrHandler.ts
1006
- function createHMRHandler(handler) {
1007
- const queue = new Queue();
1008
- return (payload) => queue.enqueue(() => handler(payload));
1009
- }
1010
- var Queue = class {
1011
- constructor() {
1012
- _defineProperty(this, "queue", []);
1013
- _defineProperty(this, "pending", false);
1014
- }
1015
- enqueue(promise) {
1016
- return new Promise((resolve, reject) => {
1017
- this.queue.push({
1018
- promise,
1019
- resolve,
1020
- reject
1021
- });
1022
- this.dequeue();
1023
- });
1024
- }
1025
- dequeue() {
1026
- if (this.pending) return false;
1027
- const item = this.queue.shift();
1028
- if (!item) return false;
1029
- this.pending = true;
1030
- item.promise().then(item.resolve).catch(item.reject).finally(() => {
1031
- this.pending = false;
1032
- this.dequeue();
1033
- });
1034
- return true;
1035
- }
1036
- };
1037
- //#endregion
1038
1029
  //#region ../../vite/packages/vite/src/shared/forwardConsole.ts
1039
1030
  function setupForwardConsoleHandler(transport, options, console = globalThis.console) {
1040
1031
  if (!options.enabled) return;
@@ -1163,6 +1154,39 @@ function stringifyConsoleArg(value) {
1163
1154
  }
1164
1155
  }
1165
1156
  //#endregion
1157
+ //#region ../../vite/packages/vite/src/shared/hmrHandler.ts
1158
+ function createHMRHandler(handler) {
1159
+ const queue = new Queue();
1160
+ return (payload) => queue.enqueue(() => handler(payload));
1161
+ }
1162
+ var Queue = class {
1163
+ constructor() {
1164
+ _defineProperty(this, "queue", []);
1165
+ _defineProperty(this, "pending", false);
1166
+ }
1167
+ enqueue(promise) {
1168
+ return new Promise((resolve, reject) => {
1169
+ this.queue.push({
1170
+ promise,
1171
+ resolve,
1172
+ reject
1173
+ });
1174
+ this.dequeue();
1175
+ });
1176
+ }
1177
+ dequeue() {
1178
+ if (this.pending) return false;
1179
+ const item = this.queue.shift();
1180
+ if (!item) return false;
1181
+ this.pending = true;
1182
+ item.promise().then(item.resolve).catch(item.reject).finally(() => {
1183
+ this.pending = false;
1184
+ this.dequeue();
1185
+ });
1186
+ return true;
1187
+ }
1188
+ };
1189
+ //#endregion
1166
1190
  //#region ../../vite/packages/vite/src/client/overlay.ts
1167
1191
  const hmrConfigName = __HMR_CONFIG_NAME__;
1168
1192
  const base$1 = __BASE__ || "/";
@@ -1482,14 +1506,18 @@ const debounceReload = (time) => {
1482
1506
  };
1483
1507
  };
1484
1508
  const pageReload = debounceReload(20);
1509
+ function wrapIdIfNeeded(id) {
1510
+ return id[0] === "." || id[0] === "/" ? id : wrapId(id);
1511
+ }
1485
1512
  const hmrClient = new HMRClient({
1486
1513
  error: (err) => console.error("[vite]", err),
1487
1514
  debug: (...msg) => console.debug("[vite]", ...msg)
1488
1515
  }, transport, async function importUpdatedModule({ acceptedPath, timestamp, explicitImportRequired, isWithinCircularImport }) {
1489
1516
  const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
1517
+ const browserPath = wrapIdIfNeeded(acceptedPathWithoutQuery);
1490
1518
  const importPromise = import(
1491
1519
  /* @vite-ignore */
1492
- base + acceptedPathWithoutQuery.slice(1) + `?${explicitImportRequired ? "import&" : ""}t=${timestamp}${query ? `&${query}` : ""}`
1520
+ base + browserPath.slice(1) + `?${explicitImportRequired ? "import&" : ""}t=${timestamp}${query ? `&${query}` : ""}`
1493
1521
  );
1494
1522
  if (isWithinCircularImport) importPromise.catch(() => {
1495
1523
  console.info(`[hmr] ${acceptedPath} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order. To debug and break the circular import, you can run \`vite --debug hmr\` to log the circular dependency path if a file change triggered it.`);
@@ -1798,6 +1826,13 @@ function injectQuery(url, queryToInject) {
1798
1826
  if (typeof DevRuntime !== "undefined") {
1799
1827
  var _ref;
1800
1828
  class ViteDevRuntime extends DevRuntime {
1829
+ payloadDelivered(filename) {
1830
+ transport.send({
1831
+ type: "custom",
1832
+ event: "vite:bundled-dev:payload-delivered",
1833
+ data: { filename }
1834
+ });
1835
+ }
1801
1836
  createModuleHotContext(moduleId) {
1802
1837
  const ctx = new BundledDevHMRContext(bundledDevHmrClient, moduleId);
1803
1838
  ctx._internal = {