@vizejs/vite-plugin 0.115.0 → 0.117.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
@@ -97,7 +97,7 @@ interface LinterConfig {
97
97
  /**
98
98
  * Built-in lint preset
99
99
  */
100
- preset?: "happy-path" | "opinionated" | "essential" | "incremental" | "nuxt";
100
+ preset?: "happy-path" | "opinionated" | "essential" | "incremental" | "ecosystem" | "nuxt";
101
101
  /**
102
102
  * Rules to enable/disable
103
103
  */
@@ -290,6 +290,10 @@ interface LanguageServerConfig {
290
290
  * Enable editor-oriented IDE features
291
291
  */
292
292
  editor?: boolean;
293
+ /**
294
+ * Enable Vue ecosystem lint and editor helpers
295
+ */
296
+ ecosystem?: boolean;
293
297
  /**
294
298
  * Enable completions
295
299
  */
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { createHash } from "node:crypto";
3
3
  import * as native from "@vizejs/native";
4
- import { applyViteDefineReplacements, chunkVitePrecompileFiles, classifyVitePluginRequest, createViteBareImportBases, createViteBareImportCandidates, createViteVirtualId, detectViteHmrUpdateType, diffVitePrecompileFiles, generateViteHmrCode, hasViteHmrChanges, isViteBareSpecifier, normalizeViteCssModuleFilename, normalizeViteDevMiddlewareUrl, normalizeVitePrecompileBatchSize, normalizeViteRequireBase, normalizeViteResolvedVuePath, resolveViteAliasRequest, resolveViteCssImports, resolveViteRelativeImport, resolveViteVuePath, rewriteViteDynamicTemplateImports, rewriteViteStaticAssetUrls, scopeViteCssForPipeline, shouldApplyViteDefineInVirtualModule, splitViteIdQuery, toViteBrowserImportPrefix } from "@vizejs/native";
4
+ import { applyViteDefineReplacements, chunkVitePrecompileFiles, classifyVitePluginRequest, createViteBareImportBases, createViteBareImportCandidates, createViteVirtualId, detectViteHmrUpdateType, diffVitePrecompileFiles, generateViteHmrCode, hasViteHmrChanges, isViteBareSpecifier, normalizeViteCssModuleFilename, normalizeViteDevMiddlewareUrl, normalizeVitePrecompileBatchSize, normalizeViteRequireBase, normalizeViteResolvedVuePath, resolveViteAliasRequest, resolveViteCssImports, resolveViteRelativeImport, resolveViteVuePath, rewriteViteDynamicTemplateImports, rewriteViteStaticAssetUrls, scopeViteCssForPipeline, shouldApplyViteDefineInVirtualModule, splitViteIdQuery, toViteBrowserImportPrefix, transformViteCssVarsForPipeline } from "@vizejs/native";
5
5
  import { CONFIG_FILE_NAMES, defineConfig, loadConfig } from "vize";
6
6
  import fs from "node:fs";
7
7
  import { glob } from "tinyglobby";
@@ -40,6 +40,9 @@ function toHmrHashes(module) {
40
40
  function scopeCssForPipeline(css, scopeId) {
41
41
  return scopeViteCssForPipeline(css, scopeId);
42
42
  }
43
+ function transformCssVarsForPipeline(css, scopeId) {
44
+ return transformViteCssVarsForPipeline(css, scopeId);
45
+ }
43
46
  /**
44
47
  * Resolve CSS @import statements by inlining the imported files,
45
48
  * then resolve @custom-media definitions within the combined CSS.
@@ -883,18 +886,7 @@ function loadHook(state, id, loadOptions) {
883
886
  const block = fallbackCompiled.styles[blockIndex];
884
887
  let styleContent = block.content;
885
888
  if (scoped && block.scoped && (!lang || lang === "css")) styleContent = scopeCssForPipeline(styleContent, scoped);
886
- if (scoped && block.scoped && lang && lang !== "css") {
887
- const lines = styleContent.split("\n");
888
- const hoisted = [];
889
- const body = [];
890
- for (const line of lines) {
891
- const trimmed = line.trimStart();
892
- if (trimmed.startsWith("@use ") || trimmed.startsWith("@forward ") || trimmed.startsWith("@import ")) hoisted.push(line);
893
- else body.push(line);
894
- }
895
- const bodyContent = body.join("\n");
896
- styleContent = `${hoisted.length > 0 ? hoisted.join("\n") + "\n\n" : ""}[${scoped}] {\n${bodyContent}\n}`;
897
- }
889
+ styleContent = transformCssVarsForPipeline(styleContent, fallbackCompiled.scopeId);
898
890
  return {
899
891
  code: styleContent,
900
892
  map: null
@@ -1122,6 +1114,27 @@ function createVueCompatPlugin(state) {
1122
1114
  } }
1123
1115
  };
1124
1116
  }
1117
+ function normalizeVirtualStyleId(id) {
1118
+ if (!id.startsWith("\0") || !id.includes("?vue")) return id;
1119
+ return id.slice(1).replace(/\.module\.\w+$/, "").replace(/\.\w+$/, "");
1120
+ }
1121
+ function transformScopedPreprocessorCss(code, id) {
1122
+ const request = classifyVitePluginRequest(normalizeVirtualStyleId(id));
1123
+ if (!request.isVueStyleQuery || !request.styleScoped || !request.styleLang || request.styleLang === "css") return null;
1124
+ return scopeCssForPipeline(code, request.styleScoped);
1125
+ }
1126
+ function createStylePostTransformPlugin() {
1127
+ return {
1128
+ name: "vize:style-post-transform",
1129
+ transform(code, id) {
1130
+ const scoped = transformScopedPreprocessorCss(code, id);
1131
+ return scoped === null ? null : {
1132
+ code: scoped,
1133
+ map: null
1134
+ };
1135
+ }
1136
+ };
1137
+ }
1125
1138
  function createPostTransformPlugin(state) {
1126
1139
  return {
1127
1140
  name: "vize:post-transform",
@@ -1379,6 +1392,7 @@ function vize(options = {}) {
1379
1392
  if (state.server === null) clearBuildCaches(state);
1380
1393
  }
1381
1394
  },
1395
+ createStylePostTransformPlugin(),
1382
1396
  createPostTransformPlugin(state)
1383
1397
  ];
1384
1398
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.115.0",
3
+ "version": "0.117.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -37,9 +37,9 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@vizejs/native": "0.115.0",
40
+ "@vizejs/native": "0.117.0",
41
41
  "tinyglobby": "0.2.16",
42
- "vize": "0.115.0"
42
+ "vize": "0.117.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "25.7.0",