@vizejs/vite-plugin 0.671.0 → 0.672.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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as VizeInspectorLintPlanProvider, b as VizeConfig, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, h as VueOptionsEntry, i as VizeVueFeatures, l as VizeVueVersion, m as VueOptions, n as CompiledModule, o as VizeInspectorLintPlanRequest, p as UserConfigExport, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv } from "./types-gYK-MbLv.mjs";
1
+ import { a as VizeInspectorLintPlanProvider, b as VizeConfig, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, h as VueOptionsEntry, i as VizeVueFeatures, l as VizeVueVersion, m as VueOptions, n as CompiledModule, o as VizeInspectorLintPlanRequest, p as UserConfigExport, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv } from "./types-ChOAu19s.mjs";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/plugin/compiler-config.d.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as vize } from "./plugin-BRR28jru.mjs";
1
+ import { t as vize } from "./plugin-NwXGnmXs.mjs";
2
2
  import { u as rewriteStaticAssetUrls } from "./vue-version-BFh0eI6J.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-LlMZcDZI.mjs";
4
4
  //#region src/index.ts
@@ -1,4 +1,4 @@
1
- import { f as ResolvedVizeConfig } from "../types-gYK-MbLv.mjs";
1
+ import { f as ResolvedVizeConfig } from "../types-ChOAu19s.mjs";
2
2
  import { ResolvedConfig } from "vite";
3
3
 
4
4
  //#region src/internal/config-bridge.d.ts
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-NwXGnmXs.mjs";
2
+ export { vize };
@@ -1376,7 +1376,8 @@ function compileFile(filePath, cache, options, source, diagnostics) {
1376
1376
  scriptHash: result.scriptHash,
1377
1377
  macroArtifacts: result.macroArtifacts ?? [],
1378
1378
  styles: normalizeStyleBlocks(result.styles, resolved),
1379
- dependencies: [...resolved.dependencies, ...result.dependencies ?? []]
1379
+ dependencies: [...resolved.dependencies, ...result.dependencies ?? []],
1380
+ ...result.moduleShape ? { moduleShape: result.moduleShape } : {}
1380
1381
  };
1381
1382
  cache.set(filePath, compiled);
1382
1383
  return compiled;
@@ -1447,6 +1448,7 @@ function compileBatch(files, cache, options) {
1447
1448
  delete fileResult.macroArtifacts;
1448
1449
  if (fallback.macroArtifacts !== void 0) fileResult.macroArtifacts = fallback.macroArtifacts;
1449
1450
  delete fileResult.moduleShape;
1451
+ if (fallback.moduleShape !== void 0) fileResult.moduleShape = fallback.moduleShape;
1450
1452
  }
1451
1453
  for (const fileResult of result.results) {
1452
1454
  if (fileResult.errors.length > 0) continue;
@@ -1465,7 +1467,8 @@ function compileBatch(files, cache, options) {
1465
1467
  scriptHash: fileResult.scriptHash,
1466
1468
  macroArtifacts: fileResult.macroArtifacts ?? [],
1467
1469
  styles: normalizeStyleBlocks(fileResult.styles, inlinedByPath.get(fileResult.path)),
1468
- dependencies: [...inlinedByPath.get(fileResult.path)?.dependencies ?? [], ...fileResult.dependencies ?? []]
1470
+ dependencies: [...inlinedByPath.get(fileResult.path)?.dependencies ?? [], ...fileResult.dependencies ?? []],
1471
+ ...fileResult.moduleShape ? { moduleShape: fileResult.moduleShape } : {}
1469
1472
  });
1470
1473
  if (fileResult.errors.length > 0) console.error(formatCompileErrorMessage(fileResult.path, fileResult.errors));
1471
1474
  if (fileResult.warnings.length > 0) fileResult.warnings.forEach((warning) => {
@@ -1530,7 +1533,7 @@ function resolveCompilerIdentity() {
1530
1533
  */
1531
1534
  function computePrecompileCacheKey(compileOptions) {
1532
1535
  const material = stableStringify({
1533
- format: 4,
1536
+ format: 5,
1534
1537
  compiler: resolveCompilerIdentity(),
1535
1538
  options: compileOptions
1536
1539
  });
@@ -1649,7 +1652,7 @@ function encodePrecompileManifest(options) {
1649
1652
  const indexBody = compressBody(Buffer.from(JSON.stringify(index), "utf8"));
1650
1653
  const payloadBody = compressBody(Buffer.concat(records));
1651
1654
  const header = Buffer.from(JSON.stringify({
1652
- format: 4,
1655
+ format: 5,
1653
1656
  key,
1654
1657
  codec: hasZstd ? "zstd" : "gzip",
1655
1658
  index: indexBody.length,
@@ -1725,7 +1728,7 @@ function decodePrecompileManifest(bytes, options) {
1725
1728
  return reject("unparsable header");
1726
1729
  }
1727
1730
  if (typeof header !== "object" || header === null || Array.isArray(header)) return reject("unrecognized header");
1728
- if (header.format !== 4 || header.key !== key) return reject("foreign format or key");
1731
+ if (header.format !== 5 || header.key !== key) return reject("foreign format or key");
1729
1732
  if (!isByteLength(header.index) || !isByteLength(header.payload)) return reject("unrecognized body lengths");
1730
1733
  const indexStart = headerEnd + 1;
1731
1734
  const payloadStart = indexStart + header.index;
@@ -2520,10 +2523,15 @@ function registerSfcModule(state, code, filePath, isSsr) {
2520
2523
  }
2521
2524
  //#endregion
2522
2525
  //#region src/plugin/tree-shaking.ts
2523
- /** Template-only client output has no authored top-level script effects. */
2526
+ /**
2527
+ * Whether the module emits nothing but its render export: template-only client
2528
+ * output with no `<style>` block and no CSS. Style imports, injected CSS and
2529
+ * attached `styles` are side effects, so an SFC imported for its styles stays,
2530
+ * as with `@vitejs/plugin-vue` (#11544).
2531
+ */
2524
2532
  function isPureTemplateOnlyModule(compiled) {
2525
2533
  const shape = compiled?.moduleShape;
2526
- return !!(shape?.hasNamedRenderExport && !shape.hasDefaultExport && !shape.hasSfcMainDefined);
2534
+ return !!(shape?.hasNamedRenderExport && !shape.hasDefaultExport && !shape.hasSfcMainDefined && !compiled.styles?.length && !compiled.css);
2527
2535
  }
2528
2536
  function resolveTemplateOnlySfcId(state, source, isSsr, querySuffix) {
2529
2537
  const id = toPluginVisibleVirtualId(source, isSsr, querySuffix);
@@ -1197,9 +1197,8 @@ interface CompiledModule {
1197
1197
  dependencies?: string[];
1198
1198
  /**
1199
1199
  * Module shape reported by the native compiler, so `generateOutput` need not
1200
- * re-parse the emitted module (#3425). Absent for a cache entry written before
1201
- * the field existed, and for the rspack and unplugin builders, which never set
1202
- * it — both fall back to parsing.
1200
+ * re-parse the emitted module (#3425). Every compile here carries it (#11544);
1201
+ * the rspack and unplugin builders never set it and fall back to parsing.
1203
1202
  */
1204
1203
  moduleShape?: ModuleOutputInfo;
1205
1204
  }
@@ -1,4 +1,4 @@
1
- import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-gYK-MbLv.mjs";
1
+ import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-ChOAu19s.mjs";
2
2
  import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
3
3
 
4
4
  //#region src/vite-plus/types.d.ts
@@ -400,7 +400,7 @@ function defineConfig(config = {}, integration = {}) {
400
400
  const legacy = compiler !== false && (await import("./vue-version-DOjZaMiI.mjs")).isLegacyVueCompatibilityMode(compiler);
401
401
  const plugins = compiler === false || legacy ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
402
402
  if (compiler !== false) {
403
- const { vize } = await import("./plugin-B4z8Tx1Z.mjs");
403
+ const { vize } = await import("./plugin-Bmz-K8re.mjs");
404
404
  plugins.push(vize({
405
405
  ...plugin,
406
406
  configMode: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.671.0",
3
+ "version": "0.672.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -51,13 +51,13 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@vizejs/native": "0.671.0",
55
- "@vizejs/unplugin": "0.671.0",
54
+ "@vizejs/native": "0.672.0",
55
+ "@vizejs/unplugin": "0.672.0",
56
56
  "jsonc-parser": "^3.3.1",
57
57
  "oxc-parser": "0.144.0",
58
58
  "picomatch": "4.0.5",
59
59
  "tinyglobby": "0.2.17",
60
- "vize": "0.671.0"
60
+ "vize": "0.672.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "25.9.2",
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-BRR28jru.mjs";
2
- export { vize };