@vizejs/vite-plugin 0.151.0 → 0.152.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.
Files changed (2) hide show
  1. package/dist/index.mjs +15 -5
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1058,6 +1058,7 @@ function formatUnknownError(error) {
1058
1058
  }
1059
1059
  //#endregion
1060
1060
  //#region src/plugin/hmr.ts
1061
+ const VIZE_COMPONENTS_CSS_FILE = "assets/vize-components.css";
1061
1062
  async function handleHotUpdateHook(state, ctx) {
1062
1063
  const { file, server, read } = ctx;
1063
1064
  if (file.endsWith(".vue") && state.filter(file)) try {
@@ -1125,17 +1126,26 @@ async function handleHotUpdateHook(state, ctx) {
1125
1126
  state.logger.error(`Re-compilation failed for ${file}:`, e);
1126
1127
  }
1127
1128
  }
1128
- function handleGenerateBundleHook(state, emitFile) {
1129
+ function handleGenerateBundleHook(state, emitFile, bundle) {
1129
1130
  if (!state.extractCss || state.collectedCss.size === 0) return;
1130
1131
  let allCss = "";
1131
1132
  for (const css of state.collectedCss.values()) allCss += allCss ? `\n\n${css}` : css;
1132
1133
  if (allCss.trim()) {
1133
1134
  emitFile({
1134
1135
  type: "asset",
1135
- fileName: "assets/vize-components.css",
1136
+ fileName: VIZE_COMPONENTS_CSS_FILE,
1136
1137
  source: allCss
1137
1138
  });
1138
- state.logger.log(`Extracted CSS to assets/vize-components.css (${state.collectedCss.size} components)`);
1139
+ attachComponentsCssToEntryChunks(bundle);
1140
+ state.logger.log(`Extracted CSS to ${VIZE_COMPONENTS_CSS_FILE} (${state.collectedCss.size} components)`);
1141
+ }
1142
+ }
1143
+ function attachComponentsCssToEntryChunks(bundle) {
1144
+ for (const item of Object.values(bundle)) {
1145
+ if (item.type !== "chunk" || !item.isEntry && !item.isDynamicEntry) continue;
1146
+ item.viteMetadata ??= {};
1147
+ item.viteMetadata.importedCss ??= /* @__PURE__ */ new Set();
1148
+ item.viteMetadata.importedCss.add(VIZE_COMPONENTS_CSS_FILE);
1139
1149
  }
1140
1150
  }
1141
1151
  //#endregion
@@ -1498,8 +1508,8 @@ function vize(options = {}) {
1498
1508
  async handleHotUpdate(ctx) {
1499
1509
  return handleHotUpdateHook(state, ctx);
1500
1510
  },
1501
- generateBundle() {
1502
- handleGenerateBundleHook(state, this.emitFile.bind(this));
1511
+ generateBundle(_, bundle) {
1512
+ handleGenerateBundleHook(state, this.emitFile.bind(this), bundle);
1503
1513
  },
1504
1514
  closeBundle() {
1505
1515
  if (state.server === null) clearBuildCaches(state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.151.0",
3
+ "version": "0.152.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -39,9 +39,9 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@vizejs/native": "0.151.0",
42
+ "@vizejs/native": "0.152.0",
43
43
  "tinyglobby": "0.2.16",
44
- "vize": "0.151.0"
44
+ "vize": "0.152.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "25.7.0",