@vizejs/vite-plugin 0.429.1 → 0.430.1

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.
@@ -28,7 +28,15 @@ function recommendEditor(source, extensions) {
28
28
  };
29
29
  if (extensions) {
30
30
  if (parsed.recommendations !== void 0 && (!Array.isArray(parsed.recommendations) || !parsed.recommendations.every((value) => typeof value === "string"))) throw new Error("extensions.json recommendations must be a string array.");
31
- const merged = [...new Set([...parsed.recommendations ?? [], ...recommendations])];
31
+ const merged = [...parsed.recommendations ?? []];
32
+ const seen = new Set(merged.map((id) => id.toLowerCase()));
33
+ for (const recommendation of recommendations) {
34
+ const id = recommendation.toLowerCase();
35
+ if (!seen.has(id)) {
36
+ merged.push(recommendation);
37
+ seen.add(id);
38
+ }
39
+ }
32
40
  if (JSON.stringify(merged) !== JSON.stringify(parsed.recommendations)) set(["recommendations"], merged);
33
41
  } else for (const [keys, value] of defaults) if (keys.reduce((object, key) => object?.[key], parsed) === void 0) set(keys, value);
34
42
  return result;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-CwtUr1uY.mjs";
1
+ import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-NyrQJOwS.mjs";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/virtual.d.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-DfwtlJyA.mjs";
1
+ import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-DZV6zTPW.mjs";
2
2
  import { a as vizeConfigStore, i as resolveConfigExport, n as defineConfig, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-PP6EAmWc.mjs";
3
3
  //#region src/index.ts
4
4
  const __internal = { rewriteStaticAssetUrls };
@@ -1,4 +1,4 @@
1
- import { f as ResolvedVizeConfig } from "../types-CwtUr1uY.mjs";
1
+ import { f as ResolvedVizeConfig } from "../types-NyrQJOwS.mjs";
2
2
  import { ResolvedConfig } from "vite";
3
3
 
4
4
  //#region src/internal/config-bridge.d.ts
@@ -1,4 +1,4 @@
1
- import { n as runTask } from "../runner-8x__0QxE.mjs";
1
+ import { n as runTask } from "../runner-D0tDOiOp.mjs";
2
2
  //#region src/internal/vite-plus-task.ts
3
3
  try {
4
4
  process.exitCode = await runTask(process.argv.slice(2));
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-DZV6zTPW.mjs";
2
+ export { vize };
@@ -634,15 +634,11 @@ function generateOutputWithMap(compiled, options) {
634
634
  } else if (hasExportDefault && hasSfcMainDefined) {
635
635
  if (compiled.hasScoped && compiled.scopeId) emitted.edit(insertBeforeSfcMainDefaultExport(emitted.code, `_sfc_main.__scopeId = "data-v-${compiled.scopeId}";`, { moduleInfo }));
636
636
  } else if (!hasExportDefault && !hasSfcMainDefined && hasNamedRenderExport) {
637
- emitted.edit(`${emitted.code}\nconst _sfc_main = {};`);
638
- if (compiled.hasScoped && compiled.scopeId) emitted.edit(`${emitted.code}\n_sfc_main.__scopeId = "data-v-${compiled.scopeId}";`);
639
- emitted.edit(`${emitted.code}\n_sfc_main.render = render;`);
640
- emitted.edit(`${emitted.code}\nexport default _sfc_main;`);
637
+ const scope = compiled.hasScoped && compiled.scopeId ? `, __scopeId: "data-v-${compiled.scopeId}"` : "";
638
+ emitted.edit(`${emitted.code}\nconst _sfc_main = { render${scope} };\nexport default _sfc_main;`);
641
639
  } else if (!hasExportDefault && !hasSfcMainDefined && hasNamedSsrRenderExport) {
642
- emitted.edit(`${emitted.code}\nconst _sfc_main = {};`);
643
- if (compiled.hasScoped && compiled.scopeId) emitted.edit(`${emitted.code}\n_sfc_main.__scopeId = "data-v-${compiled.scopeId}";`);
644
- emitted.edit(`${emitted.code}\n_sfc_main.ssrRender = ssrRender;`);
645
- emitted.edit(`${emitted.code}\nexport default _sfc_main;`);
640
+ const scope = compiled.hasScoped && compiled.scopeId ? `, __scopeId: "data-v-${compiled.scopeId}"` : "";
641
+ emitted.edit(`${emitted.code}\nconst _sfc_main = { ssrRender${scope} };\nexport default _sfc_main;`);
646
642
  }
647
643
  if (usesStyleImports(compiled, options)) {
648
644
  const styleImports = [];
@@ -895,26 +891,31 @@ function toNativePrecompileMetadataEntries(metadata) {
895
891
  function getEnvironmentCache(state, ssr) {
896
892
  return ssr ? state.ssrCache : state.cache;
897
893
  }
898
- function getCompileOptionsForRequest(state, ssr) {
894
+ function getCompileOptionsForRequest(state, ssr, file) {
895
+ const mergedOptions = file === void 0 ? state.mergedOptions : state.fileCompilerOptions?.(file) ?? state.mergedOptions;
899
896
  const options = {
900
- sourceMap: state.mergedOptions?.sourceMap ?? (!state.isProduction || !!state.viteBuildSourcemap),
897
+ sourceMap: mergedOptions?.sourceMap ?? (!state.isProduction || !!state.viteBuildSourcemap),
901
898
  ssr,
902
- vapor: !ssr && (state.mergedOptions?.vapor ?? false),
903
- customRenderer: state.mergedOptions?.customRenderer ?? false,
904
- templateSyntax: state.mergedOptions?.templateSyntax ?? "standard",
899
+ vapor: !ssr && (mergedOptions?.vapor ?? false),
900
+ customRenderer: mergedOptions?.customRenderer ?? false,
901
+ templateSyntax: mergedOptions?.templateSyntax ?? "standard",
905
902
  templateComments: !state.isProduction,
906
- ...resolvePluginVueCompileOptions(state.mergedOptions ?? {})
903
+ ...resolvePluginVueCompileOptions(mergedOptions ?? {})
907
904
  };
908
- if (state.mergedOptions?.customElements !== void 0) options.customElements = state.mergedOptions.customElements;
909
- if (state.mergedOptions?.mode !== void 0) options.mode = state.mergedOptions.mode;
910
- if (state.mergedOptions?.runtimeModuleName !== void 0) options.runtimeModuleName = state.mergedOptions.runtimeModuleName;
911
- if (state.mergedOptions?.runtimeGlobalName !== void 0) options.runtimeGlobalName = state.mergedOptions.runtimeGlobalName;
912
- if (state.mergedOptions?.vueVersion !== void 0) options.vueVersion = state.mergedOptions.vueVersion;
913
- if (state.mergedOptions?.experimentalInTagComments) options.experimentalInTagComments = true;
914
- if (state.mergedOptions?.experimentalPatternedTemplate) options.experimentalPatternedTemplate = true;
915
- if (state.mergedOptions?.experimentalSelfComponent) options.experimentalSelfComponent = true;
916
- if (state.mergedOptions?.experimentalStrictSlotChildren) options.experimentalStrictSlotChildren = true;
917
- if (state.mergedOptions?.experimentalServerScript) options.experimentalServerScript = true;
905
+ if (mergedOptions?.customElements !== void 0) options.customElements = mergedOptions.customElements;
906
+ if (mergedOptions?.mode !== void 0) options.mode = mergedOptions.mode;
907
+ if (mergedOptions?.runtimeModuleName !== void 0) options.runtimeModuleName = mergedOptions.runtimeModuleName;
908
+ if (mergedOptions?.runtimeGlobalName !== void 0) options.runtimeGlobalName = mergedOptions.runtimeGlobalName;
909
+ if (mergedOptions?.vueVersion !== void 0) options.vueVersion = mergedOptions.vueVersion;
910
+ if (mergedOptions?.experimentalInTagComments) options.experimentalInTagComments = true;
911
+ if (mergedOptions?.experimentalPatternedTemplate) options.experimentalPatternedTemplate = true;
912
+ if (mergedOptions?.experimentalSelfComponent) options.experimentalSelfComponent = true;
913
+ if (mergedOptions?.experimentalStrictSlotChildren) options.experimentalStrictSlotChildren = true;
914
+ if (mergedOptions?.experimentalServerScript) options.experimentalServerScript = true;
915
+ if (state.isProduction) {
916
+ options.isProd = true;
917
+ if (!ssr && options.mode !== "function") options.inlineTemplate = true;
918
+ }
918
919
  return options;
919
920
  }
920
921
  function syncCollectedCssForFile(state, filePath, compiled) {
@@ -1057,6 +1058,8 @@ function buildCompileFileOptions(filePath, options) {
1057
1058
  ...options.templateComments === void 0 ? {} : { templateComments: options.templateComments },
1058
1059
  ...options.templateHoistStatic === void 0 ? {} : { templateHoistStatic: options.templateHoistStatic },
1059
1060
  ...options.templatePrefixIdentifiers === void 0 ? {} : { templatePrefixIdentifiers: options.templatePrefixIdentifiers },
1061
+ ...options.inlineTemplate === void 0 ? {} : { inlineTemplate: options.inlineTemplate },
1062
+ ...options.isProd === void 0 ? {} : { isProd: options.isProd },
1060
1063
  ...options.mode === void 0 ? {} : { mode: options.mode },
1061
1064
  ...options.templateSyntax === void 0 ? {} : { templateSyntax: options.templateSyntax },
1062
1065
  ...options.runtimeModuleName === void 0 ? {} : { runtimeModuleName: options.runtimeModuleName },
@@ -1085,6 +1088,8 @@ function buildCompileBatchOptions(options) {
1085
1088
  ...options.templateComments === void 0 ? {} : { templateComments: options.templateComments },
1086
1089
  ...options.templateHoistStatic === void 0 ? {} : { templateHoistStatic: options.templateHoistStatic },
1087
1090
  ...options.templatePrefixIdentifiers === void 0 ? {} : { templatePrefixIdentifiers: options.templatePrefixIdentifiers },
1091
+ ...options.inlineTemplate === void 0 ? {} : { inlineTemplate: options.inlineTemplate },
1092
+ ...options.isProd === void 0 ? {} : { isProd: options.isProd },
1088
1093
  ...options.mode === void 0 ? {} : { mode: options.mode },
1089
1094
  ...options.templateSyntax === void 0 ? {} : { templateSyntax: options.templateSyntax },
1090
1095
  ...options.runtimeModuleName === void 0 ? {} : { runtimeModuleName: options.runtimeModuleName },
@@ -1331,7 +1336,7 @@ function resolveCompilerIdentity() {
1331
1336
  */
1332
1337
  function computePrecompileCacheKey(compileOptions) {
1333
1338
  const material = stableStringify({
1334
- format: 3,
1339
+ format: 4,
1335
1340
  compiler: resolveCompilerIdentity(),
1336
1341
  options: compileOptions
1337
1342
  });
@@ -1450,7 +1455,7 @@ function encodePrecompileManifest(options) {
1450
1455
  const indexBody = compressBody(Buffer.from(JSON.stringify(index), "utf8"));
1451
1456
  const payloadBody = compressBody(Buffer.concat(records));
1452
1457
  const header = Buffer.from(JSON.stringify({
1453
- format: 3,
1458
+ format: 4,
1454
1459
  key,
1455
1460
  codec: hasZstd ? "zstd" : "gzip",
1456
1461
  index: indexBody.length,
@@ -1526,7 +1531,7 @@ function decodePrecompileManifest(bytes, options) {
1526
1531
  return reject("unparsable header");
1527
1532
  }
1528
1533
  if (typeof header !== "object" || header === null || Array.isArray(header)) return reject("unrecognized header");
1529
- if (header.format !== 3 || header.key !== key) return reject("foreign format or key");
1534
+ if (header.format !== 4 || header.key !== key) return reject("foreign format or key");
1530
1535
  if (!isByteLength(header.index) || !isByteLength(header.payload)) return reject("unrecognized body lengths");
1531
1536
  const indexStart = headerEnd + 1;
1532
1537
  const payloadStart = indexStart + header.index;
@@ -1725,6 +1730,32 @@ function writeManifest(file, container, onDiagnostic) {
1725
1730
  }
1726
1731
  }
1727
1732
  //#endregion
1733
+ //#region src/plugin/precompile-scopes.ts
1734
+ function compileScopedBatch(files, state) {
1735
+ const groups = /* @__PURE__ */ new Map();
1736
+ for (const file of files) {
1737
+ const options = getCompileOptionsForRequest(state, false, file.path);
1738
+ const key = JSON.stringify(buildCompileBatchOptions(options));
1739
+ const group = groups.get(key);
1740
+ if (group) group.files.push(file);
1741
+ else groups.set(key, {
1742
+ options,
1743
+ files: [file]
1744
+ });
1745
+ }
1746
+ const results = [];
1747
+ let timeMs = 0;
1748
+ for (const group of groups.values()) {
1749
+ const result = compileBatch(group.files, state.cache, group.options);
1750
+ results.push(...result.results);
1751
+ timeMs += result.timeMs;
1752
+ }
1753
+ return {
1754
+ results,
1755
+ timeMs
1756
+ };
1757
+ }
1758
+ //#endregion
1728
1759
  //#region src/plugin/precompile-run.ts
1729
1760
  /**
1730
1761
  * The pre-compilation pass.
@@ -1741,36 +1772,16 @@ function writeManifest(file, container, onDiagnostic) {
1741
1772
  * that reaches the native compiler reaches the key with it.
1742
1773
  */
1743
1774
  function resolvePrecompileBatchOptions(state) {
1744
- const requestOptions = getCompileOptionsForRequest(state, false);
1745
- return {
1746
- sourceMap: requestOptions.sourceMap,
1747
- ssr: false,
1748
- vapor: state.mergedOptions.vapor ?? false,
1749
- mode: state.mergedOptions.mode,
1750
- customRenderer: state.mergedOptions.customRenderer ?? false,
1751
- customElements: state.mergedOptions.customElements,
1752
- templateSyntax: state.mergedOptions.templateSyntax ?? "standard",
1753
- experimentalInTagComments: state.mergedOptions.experimentalInTagComments ?? false,
1754
- experimentalPatternedTemplate: state.mergedOptions.experimentalPatternedTemplate ?? false,
1755
- experimentalSelfComponent: state.mergedOptions.experimentalSelfComponent ?? false,
1756
- experimentalStrictSlotChildren: state.mergedOptions.experimentalStrictSlotChildren ?? false,
1757
- experimentalServerScript: state.mergedOptions.experimentalServerScript ?? false,
1758
- runtimeModuleName: state.mergedOptions.runtimeModuleName,
1759
- runtimeGlobalName: state.mergedOptions.runtimeGlobalName,
1760
- vueVersion: state.mergedOptions.vueVersion,
1761
- whitespace: requestOptions.whitespace,
1762
- styleTrim: requestOptions.styleTrim,
1763
- templateCacheHandlers: requestOptions.templateCacheHandlers,
1764
- templateComments: requestOptions.templateComments,
1765
- templateHoistStatic: requestOptions.templateHoistStatic,
1766
- templatePrefixIdentifiers: requestOptions.templatePrefixIdentifiers
1767
- };
1775
+ return getCompileOptionsForRequest(state, false);
1768
1776
  }
1769
1777
  function openCacheForRun(state, batchOptions) {
1770
1778
  if (!state.root) return createDisabledPrecompileCache();
1771
1779
  return openPrecompileCache({
1772
1780
  root: state.root,
1773
- compileOptions: buildCompileBatchOptions(batchOptions),
1781
+ compileOptions: {
1782
+ options: buildCompileBatchOptions(batchOptions),
1783
+ scopes: state.compilerScopeIdentity
1784
+ },
1774
1785
  onDiagnostic: (message, error) => error === void 0 ? state.logger.warn(message) : state.logger.warn(message, error)
1775
1786
  });
1776
1787
  }
@@ -1814,8 +1825,7 @@ async function compileAll(state) {
1814
1825
  if (state.extractCss) state.collectedCss.delete(file);
1815
1826
  state.pendingHmrUpdateTypes.delete(file);
1816
1827
  }
1817
- const batchOptions = resolvePrecompileBatchOptions(state);
1818
- const cache = openCacheForRun(state, batchOptions);
1828
+ const cache = openCacheForRun(state, resolvePrecompileBatchOptions(state));
1819
1829
  const cacheEnabled = cache.file !== null;
1820
1830
  let successCount = 0;
1821
1831
  let restoredCount = 0;
@@ -1860,7 +1870,7 @@ async function compileAll(state) {
1860
1870
  });
1861
1871
  }
1862
1872
  if (fileContents.length === 0) continue;
1863
- const result = compileBatch(fileContents, state.cache, batchOptions);
1873
+ const result = compileScopedBatch(fileContents, state);
1864
1874
  const chunkFailedCount = result.results.filter((fileResult) => fileResult.errors.length > 0).length;
1865
1875
  failedCount += chunkFailedCount;
1866
1876
  successCount += result.results.length - chunkFailedCount;
@@ -1878,7 +1888,8 @@ async function compileAll(state) {
1878
1888
  if (metadata) state.precompileMetadata.set(fileResult.path, metadata);
1879
1889
  const compiled = state.cache.get(fileResult.path);
1880
1890
  const sourceHash = sourceHashes.get(fileResult.path);
1881
- if (compiled && sourceHash !== void 0) cache.set(fileResult.path, sourceHash, compiled);
1891
+ if (fileResult.warnings.length > 0) cache.delete(fileResult.path);
1892
+ else if (compiled && sourceHash !== void 0) cache.set(fileResult.path, sourceHash, compiled);
1882
1893
  syncCollectedCssForFile({
1883
1894
  ...state,
1884
1895
  extractCss: state.extractCss && !isPluginVueCustomElement(state.mergedOptions, fileResult.path)
@@ -2060,6 +2071,27 @@ async function resolveRelativeVueSfcImport(ctx, state, id, cleanImporter, isSsrR
2060
2071
  return isDependencyScan ? resolvedPath : toPluginVisibleVirtualId(resolvedPath, isSsrRequest, effectiveQuery);
2061
2072
  }
2062
2073
  //#endregion
2074
+ //#region src/plugin/tree-shaking.ts
2075
+ /** Template-only client output has no authored top-level script effects. */
2076
+ function isPureTemplateOnlyModule(compiled) {
2077
+ const shape = compiled?.moduleShape;
2078
+ return !!(shape?.hasNamedRenderExport && !shape.hasDefaultExport && !shape.hasSfcMainDefined);
2079
+ }
2080
+ function resolveTemplateOnlySfcId(state, source, isSsr, querySuffix) {
2081
+ const id = toPluginVisibleVirtualId(source, isSsr, querySuffix);
2082
+ return state.isProduction && !isSsr && isPureTemplateOnlyModule(state.cache.get(source)) ? {
2083
+ id,
2084
+ moduleSideEffects: false
2085
+ } : id;
2086
+ }
2087
+ function loadedSfcModule(code, map, isProduction, isSsr, compiled) {
2088
+ return {
2089
+ code,
2090
+ map,
2091
+ ...isProduction && !isSsr && isPureTemplateOnlyModule(compiled) ? { moduleSideEffects: false } : {}
2092
+ };
2093
+ }
2094
+ //#endregion
2063
2095
  //#region src/plugin/resolve.ts
2064
2096
  function resolveVuePath(state, id, importer) {
2065
2097
  return resolveViteVuePath(state.root, id, importer);
@@ -2291,7 +2323,7 @@ function resolveVuePeerRuntimeEntryWithNode(state, id, importer) {
2291
2323
  const nodeResolved = resolveBareImportWithNode(state, id, importer);
2292
2324
  return nodeResolved ? resolveProjectLocalResolvedPath(state, nodeResolved) : null;
2293
2325
  }
2294
- function resolveVuePeerRuntimeEntryFromBaseWithNode(state, id, base) {
2326
+ function resolveVuePeerRuntimeEntryFromBaseWithNode(id, base) {
2295
2327
  const { request, querySuffix } = splitViteIdQuery(id);
2296
2328
  const packageName = getBarePackageName(request);
2297
2329
  if (!packageName || !VUE_PEER_RUNTIME_PACKAGES.has(packageName)) return null;
@@ -2302,13 +2334,12 @@ function resolveVuePeerRuntimeEntryFromBaseWithNode(state, id, base) {
2302
2334
  return null;
2303
2335
  }
2304
2336
  const packageRoot = path.dirname(packageJson);
2305
- if (!resolveProjectLocalResolvedPath(state, packageRoot)) return null;
2306
2337
  if (request === packageName) for (const relativeEntry of VUE_PEER_RUNTIME_ESM_ENTRIES.get(packageName) ?? ["index.mjs"]) {
2307
2338
  const entry = path.join(packageRoot, relativeEntry);
2308
2339
  if (fs.existsSync(entry)) return `${entry}${querySuffix}`;
2309
2340
  }
2310
2341
  try {
2311
- return resolveProjectLocalResolvedPath(state, `${createRequire(base).resolve(request)}${querySuffix}`);
2342
+ return `${createRequire(base).resolve(request)}${querySuffix}`;
2312
2343
  } catch {
2313
2344
  return null;
2314
2345
  }
@@ -2319,8 +2350,7 @@ function resolveProjectNuxtVuePeerRuntimeEntryWithNode(state, id) {
2319
2350
  const nuxtPackageJson = resolveBareImportWithNode(state, "nuxt/package.json", path.join(state.root, "package.json"));
2320
2351
  if (!nuxtPackageJson) return null;
2321
2352
  const nuxtPackageRoot = path.dirname(splitViteIdQuery(nuxtPackageJson).request);
2322
- if (!resolveProjectLocalResolvedPath(state, nuxtPackageRoot)) return null;
2323
- return resolveVuePeerRuntimeEntryFromBaseWithNode(state, id, path.join(nuxtPackageRoot, "package.json"));
2353
+ return resolveVuePeerRuntimeEntryFromBaseWithNode(id, path.join(state.root, "package.json")) ?? resolveVuePeerRuntimeEntryFromBaseWithNode(id, path.join(nuxtPackageRoot, "package.json"));
2324
2354
  }
2325
2355
  function isOptimizedVueDependency(id) {
2326
2356
  const { request } = splitViteIdQuery(id);
@@ -2345,15 +2375,18 @@ function normalizeResolvedVuePath(id) {
2345
2375
  return normalizeViteResolvedVuePath(id);
2346
2376
  }
2347
2377
  async function resolveProjectVueRuntime(ctx, state, id, importer, isSsrRequest) {
2348
- if (isSsrRequest || !isProjectVueRuntimeRequest(id) || !isProjectLocalImporter(state, importer)) return null;
2349
- const isBuild = state.server === null;
2350
- const viteImporter = normalizeViteRequireBase(importer) ?? importer;
2378
+ if (isSsrRequest || !isProjectVueRuntimeRequest(id)) return null;
2351
2379
  if (isVuePeerRuntimeRequest(id)) {
2352
2380
  const nuxtPeerEntry = resolveProjectNuxtVuePeerRuntimeEntryWithNode(state, id);
2353
2381
  if (nuxtPeerEntry) {
2354
2382
  state.logger.log(`resolveId: resolved Nuxt Vue peer runtime ${id} to ${nuxtPeerEntry}`);
2355
2383
  return nuxtPeerEntry;
2356
2384
  }
2385
+ }
2386
+ if (!isProjectLocalImporter(state, importer)) return null;
2387
+ const isBuild = state.server === null;
2388
+ const viteImporter = normalizeViteRequireBase(importer) ?? importer;
2389
+ if (isVuePeerRuntimeRequest(id)) {
2357
2390
  if (!isBuild && isProjectSourceImporter(state.root, importer)) {
2358
2391
  state.logger.log(`resolveId: deferring source Vue peer runtime ${id} to Vite optimizer`);
2359
2392
  return null;
@@ -2709,7 +2742,8 @@ async function resolveIdHook(ctx, state, id, importer, options) {
2709
2742
  state.logger.log(`resolveId: id=${id}, resolved=${resolved}, hasCache=${hasCache}, fileExists=${fileExists}, importer=${importer ?? "none"}`);
2710
2743
  if (hasCache || fileExists) {
2711
2744
  if (preserveQueryAsPath) return `${resolved}${request.querySuffix}`;
2712
- return isDependencyScan ? resolved : toPluginVisibleVirtualId(resolved, isSsrRequest, request.querySuffix);
2745
+ if (isDependencyScan) return resolved;
2746
+ return resolveTemplateOnlySfcId(state, resolved, isSsrRequest, request.querySuffix);
2713
2747
  }
2714
2748
  }
2715
2749
  return null;
@@ -2933,7 +2967,7 @@ function getCompiledStyleSource(state, realPath, ssr) {
2933
2967
  const cache = getEnvironmentCache(state, ssr);
2934
2968
  const compiled = cache.get(realPath) ?? state.cache.get(realPath) ?? state.ssrCache.get(realPath);
2935
2969
  if (compiled || !shouldLoadCompiledVueSfcPath(state, realPath) || !fs.existsSync(realPath)) return compiled;
2936
- return compileFile(realPath, cache, getCompileOptionsForRequest(state, ssr));
2970
+ return compileFile(realPath, cache, getCompileOptionsForRequest(state, ssr, realPath));
2937
2971
  }
2938
2972
  //#endregion
2939
2973
  //#region src/plugin/load.ts
@@ -2958,7 +2992,7 @@ function findMacroArtifactModule(state, realPath, ssr, kind) {
2958
2992
  let compiled = cache.get(realPath) ?? state.cache.get(realPath) ?? state.ssrCache.get(realPath);
2959
2993
  if (!compiled && fs.existsSync(realPath)) {
2960
2994
  const source = fs.readFileSync(realPath, "utf-8");
2961
- compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, ssr), source);
2995
+ compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, ssr, realPath), source);
2962
2996
  }
2963
2997
  syncCollectedCssForFile({
2964
2998
  ...state,
@@ -2981,7 +3015,7 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions)
2981
3015
  let compiled = cache.get(realPath);
2982
3016
  if (!compiled && fs.existsSync(realPath)) {
2983
3017
  state.logger.log(`load: on-demand compiling ${realPath}`);
2984
- compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, isSsr), void 0, { logWarnings: shouldLogSfcWarnings(state, realPath) });
3018
+ compiled = compileFile(realPath, cache, getCompileOptionsForRequest(state, isSsr, realPath), void 0, { logWarnings: shouldLogSfcWarnings(state, realPath) });
2985
3019
  }
2986
3020
  syncCollectedCssForFile({
2987
3021
  ...state,
@@ -3009,10 +3043,7 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions)
3009
3043
  rewritten.edit(rewriteStaticAssetUrls(rewritten.code, state.dynamicImportAliasRules));
3010
3044
  rewritten.edit(rewriteImportMetaGlobBase(rewritten.code, realPath, state.root));
3011
3045
  rewritten.edit(registerSfcModule(state, rewritten.code, realPath, isSsr));
3012
- return {
3013
- code: rewritten.code,
3014
- map: rewritten.map
3015
- };
3046
+ return loadedSfcModule(rewritten.code, rewritten.map, state.isProduction, isSsr, compiled);
3016
3047
  }
3017
3048
  function loadDefinePageArtifact(state, realPath, ssr) {
3018
3049
  return {
@@ -3132,13 +3163,13 @@ function transformJsxRequest(state, code, id, options) {
3132
3163
  if (!shouldTransformJsxRequest(state, request)) return;
3133
3164
  const realPath = request.normalizedFsId ? classifyVitePluginRequest(request.normalizedFsId).path : request.path;
3134
3165
  const ssr = options?.ssr ?? false;
3135
- const sourceMap = getCompileOptionsForRequest(state, ssr).sourceMap;
3166
+ const fileOptions = state.fileCompilerOptions?.(realPath) ?? state.mergedOptions;
3136
3167
  const { code: compiled, map, warnings } = compileJsxModule(realPath, code, {
3137
- jsxMode: state.mergedOptions.jsxMode,
3138
- jsxCompat: state.mergedOptions.jsxCompat,
3139
- vapor: state.mergedOptions.vapor ?? false,
3168
+ jsxMode: fileOptions.jsxMode,
3169
+ jsxCompat: fileOptions.jsxCompat,
3170
+ vapor: fileOptions.vapor ?? false,
3140
3171
  ssr,
3141
- sourceMap
3172
+ sourceMap: getCompileOptionsForRequest(state, ssr, realPath).sourceMap
3142
3173
  });
3143
3174
  for (const warning of warnings) state.logger.warn(`Warning in ${realPath}: ${warning}`);
3144
3175
  return {
@@ -3274,7 +3305,7 @@ async function handleHotUpdateHook(state, ctx, options = {}) {
3274
3305
  if (initialModules?.size === 0) return [];
3275
3306
  const source = await read();
3276
3307
  const prevCompiled = state.cache.get(file);
3277
- compileFile(file, state.cache, getCompileOptionsForRequest(state, false), source);
3308
+ compileFile(file, state.cache, getCompileOptionsForRequest(state, false, file), source);
3278
3309
  state.ssrCache.delete(file);
3279
3310
  const newCompiled = state.cache.get(file);
3280
3311
  try {
@@ -3512,7 +3543,7 @@ function createPostTransformPlugin(state) {
3512
3543
  try {
3513
3544
  const isSsr = !!transformOptions?.ssr;
3514
3545
  const extractCss = shouldExtractCssForRequest(state, isSsr);
3515
- const compiled = compileFile(id, getEnvironmentCache(state, isSsr), getCompileOptionsForRequest(state, isSsr), code);
3546
+ const compiled = compileFile(id, getEnvironmentCache(state, isSsr), getCompileOptionsForRequest(state, isSsr, id), code);
3516
3547
  syncCollectedCssForFile({
3517
3548
  ...state,
3518
3549
  extractCss
@@ -3913,6 +3944,151 @@ function createLegacyVueCompatibilityPlugin(options) {
3913
3944
  };
3914
3945
  }
3915
3946
  //#endregion
3947
+ //#region src/plugin/index-helpers.ts
3948
+ function shouldExtractCssForBuild(state, context) {
3949
+ if (!state.isProduction) return false;
3950
+ const environmentName = context.environment?.name;
3951
+ if (environmentName === "client" || environmentName === "browser") return true;
3952
+ if (environmentName === "ssr" || environmentName === "server") return false;
3953
+ return state.extractCss;
3954
+ }
3955
+ function resolveCompatibilityOptions(options, compilerConfig = {}) {
3956
+ const compatibility = {
3957
+ ...compilerConfig.compatibility,
3958
+ ...options.compatibility
3959
+ };
3960
+ const vueVersion = options.vueVersion ?? compatibility.vueVersion ?? 3;
3961
+ if (compatibility.hostCompiler === void 0 && isLegacyVueVersion(vueVersion)) compatibility.hostCompiler = true;
3962
+ return compatibility;
3963
+ }
3964
+ function aliasSortKey(find) {
3965
+ return typeof find === "string" ? find.length : find.source.length;
3966
+ }
3967
+ /** Vite 8 supplies SSR identity through the environment instead of hook arguments. */
3968
+ function resolveHookSsr(context, options) {
3969
+ return options?.ssr ?? (context.environment?.name === "ssr" || context.environment?.name === "server");
3970
+ }
3971
+ //#endregion
3972
+ //#region src/plugin/compiler-config.ts
3973
+ function mergeCompilerOptions(options, sharedConfig) {
3974
+ const viteConfig = sharedConfig?.vite ?? {};
3975
+ const compilerConfig = sharedConfig?.compiler ?? {};
3976
+ const compatibility = resolveCompatibilityOptions(options, compilerConfig);
3977
+ const vueVersion = options.vueVersion ?? compatibility.vueVersion ?? 3;
3978
+ const mode = options.mode ?? compilerConfig.mode ?? (compatibility.scriptSetupInStandalone === true ? "function" : "module");
3979
+ const templateSyntax = options.templateSyntax ?? compilerConfig.templateSyntax ?? "standard";
3980
+ return {
3981
+ ...options,
3982
+ ssr: options.ssr ?? compilerConfig.ssr ?? false,
3983
+ sourceMap: options.sourceMap ?? compilerConfig.sourceMap,
3984
+ ...resolveExperimentalCompilerOptions(options, compilerConfig, sharedConfig?.experimentals),
3985
+ customRenderer: options.customRenderer ?? compilerConfig.customRenderer ?? false,
3986
+ customElements: options.customElements ?? compilerConfig.customElements,
3987
+ templateSyntax,
3988
+ whitespace: options.whitespace ?? compilerConfig.whitespace,
3989
+ template: {
3990
+ ...options.template,
3991
+ compilerOptions: {
3992
+ cacheHandlers: compilerConfig.cacheHandlers,
3993
+ hoistStatic: compilerConfig.hoistStatic,
3994
+ prefixIdentifiers: compilerConfig.prefixIdentifiers,
3995
+ ...options.template?.compilerOptions
3996
+ }
3997
+ },
3998
+ compatibility,
3999
+ vueVersion,
4000
+ mode,
4001
+ runtimeModuleName: options.runtimeModuleName ?? compilerConfig.runtimeModuleName ?? "vue",
4002
+ runtimeGlobalName: options.runtimeGlobalName ?? compilerConfig.runtimeGlobalName ?? "Vue",
4003
+ include: options.include ?? viteConfig.include,
4004
+ exclude: options.exclude ?? viteConfig.exclude,
4005
+ scanPatterns: options.scanPatterns ?? viteConfig.scanPatterns,
4006
+ precompileBatchSize: options.precompileBatchSize ?? viteConfig.precompileBatchSize,
4007
+ ignorePatterns: options.ignorePatterns ?? viteConfig.ignorePatterns
4008
+ };
4009
+ }
4010
+ //#endregion
4011
+ //#region src/plugin/compiler-scopes.ts
4012
+ const picomatch = createRequire(import.meta.url)("picomatch");
4013
+ function normalizePattern(source) {
4014
+ if (!source.includes("/")) return source.replaceAll("\\", "/");
4015
+ return source.replace(/\\(.)/g, (_, char) => "\\[]*?{}".includes(char) ? char === "]" ? "[]]" : `[${char}]` : `/${char}`);
4016
+ }
4017
+ function compileSequence(patterns, files) {
4018
+ const steps = patterns.flatMap((source) => {
4019
+ const negated = source.startsWith("!");
4020
+ const pattern = normalizePattern(negated ? source.slice(1) : source).replace(/^(\.\/)+/, "");
4021
+ if (!pattern) return [];
4022
+ try {
4023
+ return [{
4024
+ negated,
4025
+ matches: picomatch(pattern, {
4026
+ dot: true,
4027
+ noext: true,
4028
+ nonegate: true,
4029
+ strictBrackets: true
4030
+ })
4031
+ }];
4032
+ } catch (error) {
4033
+ console.warn(`[vize] Ignoring invalid entry glob '${source}':`, error);
4034
+ return [];
4035
+ }
4036
+ });
4037
+ return (file) => {
4038
+ let matched = files && steps.length > 0 && steps.every((step) => step.negated);
4039
+ for (const step of steps) {
4040
+ let candidate = file;
4041
+ while (candidate) {
4042
+ if (step.matches(candidate)) {
4043
+ matched = !step.negated;
4044
+ break;
4045
+ }
4046
+ const slash = candidate.lastIndexOf("/");
4047
+ candidate = slash < 0 ? "" : candidate.slice(0, slash);
4048
+ }
4049
+ }
4050
+ return matched;
4051
+ };
4052
+ }
4053
+ function compileScopes(config, root) {
4054
+ return config.entries.flatMap((entry) => {
4055
+ if (!entry.compiler) return [];
4056
+ const files = entry.files === void 0 ? () => true : compileSequence(entry.files, true);
4057
+ const ignores = compileSequence(entry.ignores ?? [], false);
4058
+ return [{
4059
+ base: path.resolve(root, (entry.basePath ?? "").replaceAll("\\", "/")),
4060
+ compiler: entry.compiler,
4061
+ matches: (relative) => files(relative) && !ignores(relative)
4062
+ }];
4063
+ });
4064
+ }
4065
+ function resolveScopes(config, scopes, file) {
4066
+ let compiler = config.compiler ?? {};
4067
+ for (const scope of scopes) {
4068
+ const relative = path.relative(scope.base, file).replaceAll("\\", "/");
4069
+ if (relative === ".." || relative.startsWith("../") || path.isAbsolute(relative)) continue;
4070
+ if (!scope.matches(relative)) continue;
4071
+ compiler = {
4072
+ ...compiler,
4073
+ ...scope.compiler,
4074
+ compatibility: {
4075
+ ...compiler.compatibility,
4076
+ ...scope.compiler.compatibility
4077
+ }
4078
+ };
4079
+ }
4080
+ return compiler;
4081
+ }
4082
+ function createFileCompilerOptions(config, root, explicit) {
4083
+ if (!config) return void 0;
4084
+ const scopes = compileScopes(config, root);
4085
+ if (scopes.length === 0) return void 0;
4086
+ return (file) => mergeCompilerOptions(explicit, {
4087
+ ...config,
4088
+ compiler: resolveScopes(config, scopes, file)
4089
+ });
4090
+ }
4091
+ //#endregion
3916
4092
  //#region src/plugin/config-lifecycle.ts
3917
4093
  const compatibilityOwners = /* @__PURE__ */ new Map();
3918
4094
  const compatibilityRegistrations = /* @__PURE__ */ new WeakMap();
@@ -4000,31 +4176,6 @@ function resolveVueFeatureDefines(features, define) {
4000
4176
  };
4001
4177
  }
4002
4178
  //#endregion
4003
- //#region src/plugin/index-helpers.ts
4004
- function shouldExtractCssForBuild(state, context) {
4005
- if (!state.isProduction) return false;
4006
- const environmentName = context.environment?.name;
4007
- if (environmentName === "client" || environmentName === "browser") return true;
4008
- if (environmentName === "ssr" || environmentName === "server") return false;
4009
- return state.extractCss;
4010
- }
4011
- function resolveCompatibilityOptions(options, compilerConfig = {}) {
4012
- const compatibility = {
4013
- ...compilerConfig.compatibility,
4014
- ...options.compatibility
4015
- };
4016
- const vueVersion = options.vueVersion ?? compatibility.vueVersion ?? 3;
4017
- if (compatibility.hostCompiler === void 0 && isLegacyVueVersion(vueVersion)) compatibility.hostCompiler = true;
4018
- return compatibility;
4019
- }
4020
- function aliasSortKey(find) {
4021
- return typeof find === "string" ? find.length : find.source.length;
4022
- }
4023
- /** Vite 8 supplies SSR identity through the environment instead of hook arguments. */
4024
- function resolveHookSsr(context, options) {
4025
- return options?.ssr ?? (context.environment?.name === "ssr" || context.environment?.name === "server");
4026
- }
4027
- //#endregion
4028
4179
  //#region src/plugin/index.ts
4029
4180
  function vize(options = {}) {
4030
4181
  if (isLegacyVueCompatibilityMode(options)) return [createLegacyVueCompatibilityPlugin(options)];
@@ -4093,32 +4244,9 @@ function vize(options = {}) {
4093
4244
  };
4094
4245
  const sharedConfigPromise = resolveSharedConfig(options, state.root, configEnv, state.logger);
4095
4246
  const sharedConfig = await register(resolvedConfig, state.root, sharedConfigPromise);
4096
- const viteConfig = sharedConfig?.vite ?? {};
4097
- const compilerConfig = sharedConfig?.compiler ?? {};
4098
- const compatibility = resolveCompatibilityOptions(options, compilerConfig);
4099
- const vueVersion = options.vueVersion ?? compatibility.vueVersion ?? 3;
4100
- const mode = options.mode ?? compilerConfig.mode ?? (compatibility.scriptSetupInStandalone === true ? "function" : "module");
4101
- const templateSyntax = options.templateSyntax ?? compilerConfig.templateSyntax ?? "standard";
4102
- state.mergedOptions = {
4103
- ...options,
4104
- ssr: options.ssr ?? compilerConfig.ssr ?? false,
4105
- sourceMap: options.sourceMap ?? compilerConfig.sourceMap,
4106
- ...resolveExperimentalCompilerOptions(options, compilerConfig, sharedConfig?.experimentals),
4107
- customRenderer: options.customRenderer ?? compilerConfig.customRenderer ?? false,
4108
- customElements: options.customElements ?? compilerConfig.customElements,
4109
- templateSyntax,
4110
- whitespace: options.whitespace ?? compilerConfig.whitespace,
4111
- compatibility,
4112
- vueVersion,
4113
- mode,
4114
- runtimeModuleName: options.runtimeModuleName ?? compilerConfig.runtimeModuleName ?? "vue",
4115
- runtimeGlobalName: options.runtimeGlobalName ?? compilerConfig.runtimeGlobalName ?? "Vue",
4116
- include: options.include ?? viteConfig.include,
4117
- exclude: options.exclude ?? viteConfig.exclude,
4118
- scanPatterns: options.scanPatterns ?? viteConfig.scanPatterns,
4119
- precompileBatchSize: options.precompileBatchSize ?? viteConfig.precompileBatchSize,
4120
- ignorePatterns: options.ignorePatterns ?? viteConfig.ignorePatterns
4121
- };
4247
+ state.mergedOptions = mergeCompilerOptions(options, sharedConfig);
4248
+ state.fileCompilerOptions = createFileCompilerOptions(sharedConfig, state.root, options);
4249
+ state.compilerScopeIdentity = sharedConfig?.entries;
4122
4250
  state.dynamicImportAliasRules = [];
4123
4251
  for (const alias of resolvedConfig.resolve.alias) {
4124
4252
  if (typeof alias.find !== "string" || typeof alias.replacement !== "string") continue;
@@ -1,8 +1,8 @@
1
1
  import { i as resolveConfigExport, r as loadConfig } from "./config-PP6EAmWc.mjs";
2
2
  import { createRequire } from "node:module";
3
- import { randomUUID } from "node:crypto";
3
+ import { createHash, randomUUID } from "node:crypto";
4
4
  import path from "node:path";
5
- import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
+ import { mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { glob } from "tinyglobby";
7
7
  import { spawn, spawnSync } from "node:child_process";
8
8
  import os from "node:os";
@@ -27,11 +27,43 @@ function resolveVitePlus() {
27
27
  };
28
28
  }
29
29
  const catalogs = /* @__PURE__ */ new Map();
30
+ function catalogCacheFile(binary) {
31
+ try {
32
+ const stat = statSync(binary);
33
+ const key = createHash("sha256").update(binary).update("\0").update(String(stat.mtimeMs)).update("\0").update(String(stat.size)).digest("hex");
34
+ return path.join(os.tmpdir(), "vize-oxlint-rules", `${key}.json`);
35
+ } catch {
36
+ return;
37
+ }
38
+ }
39
+ function readCatalogCache(file) {
40
+ if (!file) return void 0;
41
+ try {
42
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
43
+ if (!Array.isArray(parsed) || parsed.some((rule) => typeof rule !== "string")) return void 0;
44
+ return new Set(parsed);
45
+ } catch {
46
+ return;
47
+ }
48
+ }
49
+ function writeCatalogCache(file, rules) {
50
+ if (!file) return;
51
+ try {
52
+ mkdirSync(path.dirname(file), { recursive: true });
53
+ writeFileSync(file, JSON.stringify([...rules].sort()), { mode: 384 });
54
+ } catch {}
55
+ }
30
56
  /** Only disable rules supported by the consumer's bundled Oxlint. */
31
57
  function availableVueRules() {
32
58
  const { binary } = resolveVitePlus();
33
59
  const cached = catalogs.get(binary);
34
60
  if (cached) return cached;
61
+ const cacheFile = catalogCacheFile(binary);
62
+ const stored = readCatalogCache(cacheFile);
63
+ if (stored) {
64
+ catalogs.set(binary, stored);
65
+ return stored;
66
+ }
35
67
  const directory = mkdtempSync(path.join(os.tmpdir(), "vize-oxlint-rules-"));
36
68
  try {
37
69
  writeFileSync(path.join(directory, "package.json"), "{\"name\":\"vize-rule-catalog\",\"private\":true}");
@@ -43,14 +75,20 @@ function availableVueRules() {
43
75
  ], {
44
76
  cwd: directory,
45
77
  encoding: "utf8",
46
- timeout: 1e4,
78
+ timeout: 6e4,
47
79
  maxBuffer: 4 * 1024 * 1024
48
80
  });
81
+ if (result.error && "code" in result.error && result.error.code === "ETIMEDOUT") {
82
+ const available = /* @__PURE__ */ new Set();
83
+ catalogs.set(binary, available);
84
+ return available;
85
+ }
49
86
  if (result.error || result.status !== 0) throw new Error(`Cannot read installed Vite+ lint rules: ${result.error?.message ?? result.stderr}`);
50
87
  const rules = JSON.parse(result.stdout);
51
88
  if (!Array.isArray(rules)) throw new Error("Installed Vite+ returned an invalid lint rule catalog");
52
89
  const available = new Set(rules.filter((rule) => rule.scope === "vue").map((rule) => rule.value));
53
90
  catalogs.set(binary, available);
91
+ writeCatalogCache(cacheFile, available);
54
92
  return available;
55
93
  } finally {
56
94
  rmSync(directory, {
@@ -60,6 +98,25 @@ function availableVueRules() {
60
98
  }
61
99
  }
62
100
  //#endregion
101
+ //#region src/vite-plus/config-paths.ts
102
+ /** Keep project-relative scopes when the serialized config lives in OS temp. */
103
+ function relocateTaskConfig(config, root) {
104
+ const absolutePattern = (pattern) => {
105
+ const negative = pattern.startsWith("!");
106
+ const value = negative ? pattern.slice(1) : pattern;
107
+ return `${negative ? "!" : ""}${path.resolve(root, value).replaceAll("\\", "/")}`;
108
+ };
109
+ return {
110
+ ...config,
111
+ basePath: path.resolve(root, config.basePath ?? ""),
112
+ ignores: config.ignores?.map(absolutePattern),
113
+ entries: (config.entries ?? []).map((entry) => ({
114
+ ...entry,
115
+ basePath: path.resolve(root, entry.basePath ?? "")
116
+ }))
117
+ };
118
+ }
119
+ //#endregion
63
120
  //#region src/vite-plus/runner.ts
64
121
  /** Run every selected checker, even when an earlier tool reports diagnostics. */
65
122
  async function runTools(task, args, metadata, vp, native, execute) {
@@ -68,7 +125,7 @@ async function runTools(task, args, metadata, vp, native, execute) {
68
125
  const fmt = task === "check" || task === "fmt" || task === "fmt:check";
69
126
  const fix = task === "lint:fix" || args.includes("--fix");
70
127
  const formatCheck = task === "fmt:check" || task === "check" && !fix || args.includes("--check");
71
- if (task === "check" && args.some((arg) => arg.startsWith("-") && arg !== "--fix")) throw new Error("Vize check tasks accept paths and --fix. Put native tool options in defineConfig().");
128
+ if ((task === "check" || lint) && args.some((arg) => arg.startsWith("-") && arg !== "--fix")) throw new Error(`Vize ${task} tasks accept paths and --fix. Put native tool options in ${task === "check" ? "the corresponding config section" : "lint.vize"}.`);
72
129
  let status = 0;
73
130
  async function run(binary, argv) {
74
131
  const code = await execute(process.execPath, [binary, ...argv]);
@@ -106,10 +163,11 @@ async function runTools(task, args, metadata, vp, native, execute) {
106
163
  })).filter((file) => file.endsWith(".vue"));
107
164
  if (vue.length) await vize("fmt", [formatCheck ? "--check" : "--write", ...vue]);
108
165
  }
109
- await run(vp, [
166
+ const oxfmtPatterns = patterns.filter((pattern) => !pattern.endsWith(".vue"));
167
+ if (oxfmtPatterns.length || patterns.length === 0) await run(vp, [
110
168
  "fmt",
111
169
  formatCheck ? "--check" : "--write",
112
- ...patterns
170
+ ...oxfmtPatterns
113
171
  ]);
114
172
  }
115
173
  return status;
@@ -118,7 +176,7 @@ async function runTask(argv) {
118
176
  const [task, ...rest] = argv;
119
177
  const args = rest[0] === "--" ? rest.slice(1) : rest;
120
178
  if (task === "editor:setup") {
121
- const { setupEditor } = await import("./editor-D3tfVb0Z.mjs");
179
+ const { setupEditor } = await import("./editor-Dtf01qrY.mjs");
122
180
  await setupEditor();
123
181
  return 0;
124
182
  }
@@ -182,9 +240,9 @@ async function runNative(command, argv, metadata, native = nativeBinary(), spawn
182
240
  command
183
241
  };
184
242
  const config = metadata.config === void 0 ? await loadConfig(process.cwd(), { env }) ?? {} : await resolveConfigExport(metadata.config, env);
185
- const file = path.resolve(`.vize-vp-${randomUUID()}.json`);
243
+ const file = path.join(os.tmpdir(), `.vize-vp-${randomUUID()}.json`);
186
244
  try {
187
- await writeFile(file, JSON.stringify(config), {
245
+ await writeFile(file, JSON.stringify(relocateTaskConfig(config, process.cwd())), {
188
246
  flag: "wx",
189
247
  mode: 384
190
248
  });
@@ -185,6 +185,26 @@ interface LinterConfig {
185
185
  * Enable native type-aware lint rules from the active lint configuration
186
186
  */
187
187
  typeAware?: boolean;
188
+ /**
189
+ * Analyze relationships between input components
190
+ */
191
+ crossFile?: boolean;
192
+ /**
193
+ * Display the provide/inject tree; enables cross-file analysis
194
+ */
195
+ crossFileTree?: boolean;
196
+ /**
197
+ * Display cross-file complexity; enables cross-file analysis
198
+ */
199
+ crossFileComplexity?: boolean;
200
+ /**
201
+ * Enable the native reactivity-loss rule unless rules explicitly disable it
202
+ */
203
+ strictReactivity?: boolean;
204
+ /**
205
+ * Fail when warnings exceed this limit; absent means unlimited
206
+ */
207
+ maxWarnings?: number;
188
208
  /**
189
209
  * Rules to enable/disable
190
210
  */
@@ -205,6 +225,16 @@ interface LinterConfig {
205
225
  };
206
226
  }
207
227
  interface LintRuleOptions {
228
+ "type/strict-boolean-expressions"?: {
229
+ allowString?: boolean;
230
+ allowNumber?: boolean;
231
+ allowNullableObject?: boolean;
232
+ allowNullableBoolean?: boolean;
233
+ allowNullableString?: boolean;
234
+ allowNullableNumber?: boolean;
235
+ allowNullableEnum?: boolean;
236
+ allowAny?: boolean;
237
+ };
208
238
  "script/no-restricted-globals"?: NoRestrictedGlobalsOptions;
209
239
  "script/no-restricted-members"?: NoRestrictedMembersOptions;
210
240
  "vue/component-name-in-template-casing"?: {
@@ -333,11 +363,19 @@ interface TypeCheckerConfig {
333
363
  * Reserved Corsa server count. The direct project-session runner currently supports only 1.
334
364
  */
335
365
  servers?: number;
366
+ /**
367
+ * Hard bound in milliseconds for each editor Corsa request. Defaults to 60000; use a larger value for large cold projects.
368
+ */
369
+ lspRequestTimeoutMs?: number;
336
370
  }
337
371
  /**
338
372
  * Formatter options
339
373
  */
340
374
  interface FormatterConfig {
375
+ /**
376
+ * Oxfmt-compatible import sorting; false disables it
377
+ */
378
+ sortImports?: false | SortImportsConfig;
341
379
  /**
342
380
  * Max line width
343
381
  */
@@ -423,6 +461,25 @@ interface FormatterConfig {
423
461
  */
424
462
  sortBlocks?: boolean;
425
463
  }
464
+ interface SortImportsConfig {
465
+ partitionByNewline?: boolean;
466
+ partitionByComment?: boolean;
467
+ sortSideEffects?: boolean;
468
+ order?: "asc" | "desc";
469
+ ignoreCase?: boolean;
470
+ newlinesBetween?: boolean;
471
+ internalPattern?: string[];
472
+ groups?: (string | string[] | {
473
+ newlinesBetween: boolean;
474
+ })[];
475
+ customGroups?: ImportSortCustomGroup[];
476
+ }
477
+ interface ImportSortCustomGroup {
478
+ groupName: string;
479
+ elementNamePattern?: string[];
480
+ selector?: string;
481
+ modifiers?: string[];
482
+ }
426
483
  /**
427
484
  * Language server options
428
485
  */
@@ -1,4 +1,4 @@
1
- import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-CwtUr1uY.mjs";
1
+ import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-NyrQJOwS.mjs";
2
2
  import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
3
3
 
4
4
  //#region src/vite-plus/types.d.ts
@@ -1,10 +1,11 @@
1
1
  import { i as resolveConfigExport, r as loadConfig } from "./config-PP6EAmWc.mjs";
2
2
  import { t as mergeSharedConfig } from "./shared-config-dMxrrTkb.mjs";
3
- import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-8x__0QxE.mjs";
3
+ import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-D0tDOiOp.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import path from "node:path";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { fileURLToPath } from "node:url";
8
+ import os from "node:os";
8
9
  import { readFile, rm, stat, writeFile } from "node:fs/promises";
9
10
  import { parse } from "jsonc-parser";
10
11
  //#region src/vite-plus/conflicts.ts
@@ -141,6 +142,10 @@ function normalizeConfig(source, integration) {
141
142
  const { compiler: compilerOption, typecheck, vize, lint, fmt, extends: _bases, ...rest } = source;
142
143
  const { vize: nativeLint, ...oxlint } = lint ?? {};
143
144
  const { vize: nativeFmt, ...oxfmt } = fmt ?? {};
145
+ const formatter = {
146
+ ...oxfmt.sortImports === void 0 ? {} : { sortImports: oxfmt.sortImports },
147
+ ...typeof nativeFmt === "object" ? nativeFmt : {}
148
+ };
144
149
  const alias = vize && typeof vize === "object" && !Array.isArray(vize) ? vize.lint : void 0;
145
150
  const lintConfig = typeof alias === "object" && typeof nativeLint === "object" ? {
146
151
  ...alias,
@@ -167,7 +172,7 @@ function normalizeConfig(source, integration) {
167
172
  ...compiler === false ? {} : { compiler: nativeCompiler(compiler) },
168
173
  ...typeof typecheck === "object" ? { typeChecker: typecheck } : {},
169
174
  ...typeof lintConfig === "object" ? { linter: withoutTaskLintOptions(lintConfig) } : {},
170
- ...typeof nativeFmt === "object" ? { formatter: nativeFmt } : {}
175
+ ...Object.keys(formatter).length ? { formatter } : {}
171
176
  }, env)) ?? {};
172
177
  };
173
178
  const metadata = {
@@ -230,7 +235,7 @@ async function emitDeclarations(options, metadata) {
230
235
  const errors = [];
231
236
  const source = parse(await readFile(file, "utf8"), errors, { allowTrailingComma: true });
232
237
  if (errors.length || !source || typeof source !== "object") throw new Error(`Invalid TypeScript config: ${file}`);
233
- const temporary = path.join(path.dirname(file), `.vize-vp-${randomUUID()}.json`);
238
+ const temporary = path.join(os.tmpdir(), `.vize-vp-${randomUUID()}.json`);
234
239
  copies.set(file, temporary);
235
240
  const references = source.references ? await Promise.all(source.references.map(async (reference) => ({
236
241
  ...reference,
@@ -321,8 +326,8 @@ function defineConfig(config = {}, integration = {}) {
321
326
  const { options } = metadata;
322
327
  const plugins = compiler === false ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
323
328
  if (compiler !== false) {
324
- const { vize } = await import("./plugin-Cxx-XPU9.mjs");
325
- plugins.unshift(vize({
329
+ const { vize } = await import("./plugin-9jvcWEU8.mjs");
330
+ plugins.push(vize({
326
331
  ...compiler,
327
332
  configMode: false,
328
333
  config: metadata.config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.429.1",
3
+ "version": "0.430.1",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -51,12 +51,13 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@vizejs/native": "0.429.1",
55
- "@vizejs/unplugin": "0.429.1",
54
+ "@vizejs/native": "0.430.1",
55
+ "@vizejs/unplugin": "0.430.1",
56
56
  "jsonc-parser": "^3.3.1",
57
57
  "oxc-parser": "0.144.0",
58
+ "picomatch": "4.0.5",
58
59
  "tinyglobby": "0.2.17",
59
- "vize": "0.429.1"
60
+ "vize": "0.430.1"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@types/node": "25.9.2",
@@ -89,7 +90,8 @@
89
90
  "check": "vp check src vite.config.ts",
90
91
  "check:fix": "vp check --fix src vite.config.ts",
91
92
  "fmt": "vp fmt --write src vite.config.ts",
92
- "test": "pnpm --dir ../../native build:debug && node src/test.ts && node --test src/vite-plus/*.test.ts",
93
+ "test": "node scripts/run-tests.mjs",
94
+ "test:prepared": "node scripts/run-tests.mjs --require-prepared && node src/test.ts && node --test src/vite-plus/*.test.ts",
93
95
  "test:types:real-vite": "vp exec node type-tests/plugin-vue/check.mjs"
94
96
  }
95
97
  }
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-DfwtlJyA.mjs";
2
- export { vize };