@vizejs/vite-plugin 0.734.0 → 0.735.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.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as vize } from "./plugin-V378Ukom.mjs";
1
+ import { t as vize } from "./plugin-DA_ajuJ7.mjs";
2
2
  import { u as rewriteStaticAssetUrls } from "./vue-version-B0qUneRk.mjs";
3
3
  import { a as resolveViteConfigExport, i as resolveConfigExport, n as defineConfig, o as vizeConfigStore, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-BghntRXT.mjs";
4
4
  //#region src/index.ts
@@ -1160,7 +1160,7 @@ function normalizeCachePath(file) {
1160
1160
  * of their nearest existing parent.
1161
1161
  */
1162
1162
  function filesystemPathIdentities(file) {
1163
- const resolved = path.resolve(file);
1163
+ const resolved = path.resolve(withoutVerbatimPrefix(file));
1164
1164
  const identities = new Set([resolved]);
1165
1165
  let existing = resolved;
1166
1166
  const missing = [];
@@ -1178,6 +1178,41 @@ function filesystemPathIdentities(file) {
1178
1178
  }
1179
1179
  return [...identities];
1180
1180
  }
1181
+ const DOS_DEVICES = new Set([
1182
+ "CON",
1183
+ "PRN",
1184
+ "AUX",
1185
+ "NUL",
1186
+ "CONIN$",
1187
+ "CONOUT$"
1188
+ ]);
1189
+ for (const device of ["COM", "LPT"]) for (const port of "0123456789¹²³") DOS_DEVICES.add(device + port);
1190
+ /**
1191
+ * `\\?\C:\x` → `C:\x` and `\\?\UNC\host\share\x` → `\\host\share\x` (also the
1192
+ * `//?/` spelling), when the plain spelling names the same file. chokidar
1193
+ * cannot watch verbatim paths: it walks their parents up to a bare `C:`.
1194
+ */
1195
+ function withoutVerbatimPrefix(file) {
1196
+ const separator = file.startsWith("\\\\?\\") ? "\\" : file.startsWith("//?/") ? "/" : "";
1197
+ if (!separator) return file;
1198
+ const rest = file.slice(4);
1199
+ const names = rest.split(separator);
1200
+ const head = names.shift() ?? "";
1201
+ let plain = rest;
1202
+ if (head.toUpperCase() === "UNC") {
1203
+ if (!isWin32Name(names.shift() ?? "") || !isWin32Name(names.shift() ?? "")) return file;
1204
+ plain = separator + separator + rest.slice(4);
1205
+ } else if (!/^[a-z]:$/i.test(head) || names.length === 0) return file;
1206
+ return names.every((name) => name === "" || isWin32Name(name)) ? plain : file;
1207
+ }
1208
+ /** Verbatim paths keep `..`, trailing dots and spaces, and device names literally. */
1209
+ function isWin32Name(name) {
1210
+ if (name === "" || name.length > 255 || name.endsWith(".") || name.endsWith(" ")) return false;
1211
+ for (const character of name) if (character < " " || "<>:\"/\\|?*".includes(character)) return false;
1212
+ const dot = name.indexOf(".");
1213
+ const stem = (dot === -1 ? name : name.slice(0, dot)).replace(/ +$/, "");
1214
+ return !DOS_DEVICES.has(stem.toUpperCase());
1215
+ }
1181
1216
  //#endregion
1182
1217
  //#region src/plugin/compiled-module-cache.ts
1183
1218
  var CompiledModuleCache = class extends Map {
@@ -2221,7 +2256,7 @@ function watchTypeProject(cache, context, addWatchFile, api = native) {
2221
2256
  const inputs = api.typeProjectInputs(context.root, context.revision, knownRevision);
2222
2257
  if (!inputs) throw new Error("[vize] TypeScript project changed while compiling; reload the component.");
2223
2258
  if (knownRevision === context.revision) return;
2224
- for (const input of inputs) addWatchFile(input);
2259
+ for (const input of new Set(inputs.map(withoutVerbatimPrefix))) addWatchFile(input);
2225
2260
  if (!projects) {
2226
2261
  projects = /* @__PURE__ */ new Map();
2227
2262
  watched.set(cache, projects);
@@ -3578,7 +3613,7 @@ function vueOwnerPath(state, requestPath) {
3578
3613
  return owner;
3579
3614
  }
3580
3615
  function loadSrcBlock(state, owner, block, blockType, addWatchFile) {
3581
- const blockPath = path.resolve(path.dirname(owner), block.src ?? "");
3616
+ const blockPath = withoutVerbatimPrefix(path.resolve(path.dirname(owner), block.src ?? ""));
3582
3617
  addWatchFile?.(blockPath);
3583
3618
  state.server?.watcher.add(blockPath);
3584
3619
  try {
@@ -3596,11 +3631,20 @@ function loadSrcBlock(state, owner, block, blockType, addWatchFile) {
3596
3631
  * Vite records a transform's addWatchFile calls as module imports. Compiler
3597
3632
  * inputs include absent config candidates and type-only files, so watch them
3598
3633
  * through the dev server's filesystem watcher. Build hooks keep Rollup watches.
3634
+ * Each file is watched once, in its plain spelling.
3599
3635
  */
3600
3636
  function createDependencyWatch(server, addWatchFile) {
3601
- return server ? (file) => {
3637
+ const watch = server ? (file) => {
3602
3638
  server.watcher.add(file);
3603
3639
  } : addWatchFile;
3640
+ if (!watch) return void 0;
3641
+ const watched = /* @__PURE__ */ new Set();
3642
+ return (file) => {
3643
+ const plain = withoutVerbatimPrefix(file);
3644
+ if (watched.has(plain)) return;
3645
+ watched.add(plain);
3646
+ watch(plain);
3647
+ };
3604
3648
  }
3605
3649
  //#endregion
3606
3650
  //#region src/plugin/sfc-module.ts
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-DA_ajuJ7.mjs";
2
+ export { vize };
@@ -429,7 +429,7 @@ async function configureResolvedConfig(source, integration) {
429
429
  const legacy = !resolvingMetadata && compiler !== false && (await import("./vue-version-DL5NF2G-.mjs")).isLegacyVueCompatibilityMode(compiler);
430
430
  const plugins = resolvingMetadata || compiler === false || legacy ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
431
431
  if (compiler !== false && !resolvingMetadata) {
432
- const { vize } = await import("./plugin-Dm9Q5nxK.mjs");
432
+ const { vize } = await import("./plugin-zPkC5wI3.mjs");
433
433
  plugins.push(vize({
434
434
  ...plugin,
435
435
  configMode: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.734.0",
3
+ "version": "0.735.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -54,13 +54,13 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@vizejs/native": "0.734.0",
58
- "@vizejs/unplugin": "0.734.0",
57
+ "@vizejs/native": "0.735.0",
58
+ "@vizejs/unplugin": "0.735.0",
59
59
  "jsonc-parser": "^3.3.1",
60
60
  "oxc-parser": "0.157.0",
61
61
  "picomatch": "4.0.7",
62
62
  "tinyglobby": "0.2.17",
63
- "vize": "0.734.0"
63
+ "vize": "0.735.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/node": "25.9.2",
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-V378Ukom.mjs";
2
- export { vize };