@vizejs/unplugin 0.662.0 → 0.663.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/README.md CHANGED
@@ -115,10 +115,10 @@ TypeScript/JSX transforms in the pipeline if your SFC scripts use those syntaxes
115
115
  ## Caveats
116
116
 
117
117
  - Vite is still the recommended integration if you need the most complete behavior today.
118
- - Plain inline CSS is injected into JavaScript at runtime; CSS asset extraction and SSR stylesheet delivery are not provided by this path.
118
+ - Every `<style>` block is a stylesheet module for the bundler's CSS pipeline, which writes the CSS file, as with `unplugin-vue`. The module is named like Vue's style requests, `App.vue?vue&type=style&index=0&lang.css` (`lang.module.css`, `lang.scss`), so a pipeline that handles a `.css` or `.scss` file handles the block: tsdown with `@tsdown/css` writes `style.css`, esbuild writes `<entry>.css` (set `outdir` or `outfile`), Rollup needs a CSS plugin such as `rollup-plugin-postcss`, and webpack uses your `.css` rule. A build with no CSS pipeline fails on the first style block. Rolldown alone does not bundle CSS, so build through tsdown or Vite.
119
119
  - `<style src>`, `<script src>` and `<template src>` follow Vue's SFC spec, as in `@vitejs/plugin-vue`: a `./` or `../` path is read next to the SFC, and any other `src` (a package such as `modern-normalize/modern-normalize.css`, an alias, an absolute path, or a bare `foo.css`) is a module request resolved by the bundler's own resolver. The file is inlined before compilation and watched. A request that resolves to no file, including an external module, is a build error.
120
- - `@import` in plain CSS is a build error. Plain CSS is injected at runtime as a string, so an `@import` would be fetched relative to the page. Inline the imported CSS, move the block to a preprocessor or CSS Module (handled by the host CSS pipeline), or use `@vizejs/vite-plugin`.
121
- - CSS Modules and preprocessors depend on the host bundler CSS pipeline and are more likely to change than the Vite path. Each block is a module named like Vue's style requests, `App.vue?vue&type=style&index=0&lang.css` (`lang.module.css`, `lang.scss`), so a pipeline that handles a `.css` or `.scss` file (`@tsdown/css`, `rollup-plugin-postcss`, esbuild) handles the block, and a host without one reports the same error it reports for such a file.
120
+ - Babel and esbuild without `bundle` bundle no stylesheet, so there plain CSS is injected into JavaScript at run time, and an `@import` in it is a build error. Preprocessor and CSS Module blocks still need a CSS pipeline.
121
+ - CSS Modules and preprocessors depend on the host bundler CSS pipeline and are more likely to change than the Vite path.
122
122
  - Scoped preprocessor styles are compiled before they are scoped, as in Vue: Webpack uses your `.scss`/`.less`/`.styl` rules, while Rollup, Rolldown and esbuild run the project's installed `sass` (or `sass-embedded`), `less` or `stylus`.
123
123
  - If your bundler inlines the Vue runtime, Vize injects the usual Vue 3 compile-time feature flags for Rollup-like and Webpack hosts when its compiler is active.
124
124
  - Test carefully before depending on this package in production.
package/dist/babel.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_unplugin = require("./unplugin-Dl8hs9VI.cjs");
1
+ const require_unplugin = require("./unplugin-7UpIpoaj.cjs");
2
2
  //#region src/babel.ts
3
3
  function vizeBabelPlugin(_api, rawOptions = {}) {
4
4
  const options = require_unplugin.normalizeOptions(rawOptions);
@@ -18,6 +18,7 @@ function vizeBabelPlugin(_api, rawOptions = {}) {
18
18
  return parse(require_unplugin.generateOutput(compiled, {
19
19
  isProduction: options.isProduction,
20
20
  isDev: false,
21
+ cssPipeline: false,
21
22
  filePath: filename
22
23
  }), {
23
24
  ...parserOptions,
package/dist/babel.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-BbWP410q.mjs";
1
+ import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-hYMgbR_K.mjs";
2
2
  //#region src/babel.ts
3
3
  function vizeBabelPlugin(_api, rawOptions = {}) {
4
4
  const options = normalizeOptions(rawOptions);
@@ -18,6 +18,7 @@ function vizeBabelPlugin(_api, rawOptions = {}) {
18
18
  return parse(generateOutput(compiled, {
19
19
  isProduction: options.isProduction,
20
20
  isDev: false,
21
+ cssPipeline: false,
21
22
  filePath: filename
22
23
  }), {
23
24
  ...parserOptions,
package/dist/esbuild.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/esbuild.ts
2
- var esbuild_default = require("./unplugin-Dl8hs9VI.cjs").vizeUnplugin.esbuild;
2
+ var esbuild_default = require("./unplugin-7UpIpoaj.cjs").vizeUnplugin.esbuild;
3
3
  //#endregion
4
4
  module.exports = esbuild_default;
package/dist/esbuild.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as vizeUnplugin } from "./unplugin-BbWP410q.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-hYMgbR_K.mjs";
2
2
  //#region src/esbuild.ts
3
3
  var esbuild_default = vizeUnplugin.esbuild;
4
4
  //#endregion
package/dist/index.cjs CHANGED
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_unplugin = require("./unplugin-Dl8hs9VI.cjs");
5
+ const require_unplugin = require("./unplugin-7UpIpoaj.cjs");
6
6
  exports.default = require_unplugin.vizeUnplugin;
7
7
  exports.vizeUnplugin = require_unplugin.vizeUnplugin;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as vizeUnplugin } from "./unplugin-BbWP410q.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-hYMgbR_K.mjs";
2
2
  export { vizeUnplugin as default, vizeUnplugin };
package/dist/rolldown.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/rolldown.ts
2
- var rolldown_default = require("./unplugin-Dl8hs9VI.cjs").vizeUnplugin.rollup;
2
+ var rolldown_default = require("./unplugin-7UpIpoaj.cjs").vizeUnplugin.rollup;
3
3
  //#endregion
4
4
  module.exports = rolldown_default;
package/dist/rolldown.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as vizeUnplugin } from "./unplugin-BbWP410q.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-hYMgbR_K.mjs";
2
2
  //#region src/rolldown.ts
3
3
  var rolldown_default = vizeUnplugin.rollup;
4
4
  //#endregion
package/dist/rollup.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/rollup.ts
2
- var rollup_default = require("./unplugin-Dl8hs9VI.cjs").vizeUnplugin.rollup;
2
+ var rollup_default = require("./unplugin-7UpIpoaj.cjs").vizeUnplugin.rollup;
3
3
  //#endregion
4
4
  module.exports = rollup_default;
package/dist/rollup.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as vizeUnplugin } from "./unplugin-BbWP410q.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-hYMgbR_K.mjs";
2
2
  //#region src/rollup.ts
3
3
  var rollup_default = vizeUnplugin.rollup;
4
4
  //#endregion
@@ -142,6 +142,23 @@ function parseVueRequest(id) {
142
142
  };
143
143
  }
144
144
  //#endregion
145
+ //#region src/style-dependencies.ts
146
+ function hasImportRule(ast) {
147
+ if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
148
+ return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
149
+ }
150
+ /** `src` blocks are inlined before compilation; one left here was unreadable. */
151
+ function assertInlinedStyleSrc(styles, filename) {
152
+ for (const style of styles) if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> could not be inlined by @vizejs/unplugin. Write it as <style src="./file.css"> with a quoted relative path, or use @vizejs/vite-plugin.`);
153
+ }
154
+ /** CSS injected at run time is a string in the page, so nothing resolves its `@import`. */
155
+ function assertInjectableCss(styles, filename) {
156
+ for (const style of styles) {
157
+ if (!style.content.includes("@")) continue;
158
+ if (hasImportRule((0, _vizejs_native.parseCssAst)(style.content, { filename }).ast)) throw new Error(`[vize] ${filename}: CSS @import in <style> needs a bundler CSS pipeline. @vizejs/unplugin injects CSS at run time under Babel and esbuild without \`bundle\`, where nothing resolves the import. Inline the imported CSS, bundle the build, or use @vizejs/vite-plugin.`);
159
+ }
160
+ }
161
+ //#endregion
145
162
  //#region src/style.ts
146
163
  function needsPreprocessor(block) {
147
164
  return require_webpack_styles.isPreprocessorLang(block.lang);
@@ -149,6 +166,7 @@ function needsPreprocessor(block) {
149
166
  function isCssModule(block) {
150
167
  return block.module !== false;
151
168
  }
169
+ /** Blocks only a host CSS pipeline can serve. */
152
170
  function hasDelegatedStyles(compiled) {
153
171
  return compiled.styles.some((style) => needsPreprocessor(style) || isCssModule(style));
154
172
  }
@@ -194,7 +212,7 @@ const CSS_MODULE_LOCALS_HELPER = `const ${CSS_MODULE_LOCALS} = (ns) =>
194
212
  ? ns.default
195
213
  : Object.fromEntries(Object.entries(ns).filter(([key]) => key !== "default")));`;
196
214
  function generateOutput(compiled, options) {
197
- const { isProduction, isDev, extractCss, filePath, styleRequest } = options;
215
+ const { isProduction, isDev, cssPipeline, filePath, styleRequest } = options;
198
216
  let output = compiled.code;
199
217
  const exportDefaultRegex = /^export default /m;
200
218
  const hasExportDefault = exportDefaultRegex.test(output);
@@ -211,7 +229,7 @@ function generateOutput(compiled, options) {
211
229
  output += "\n_sfc_main.render = render;";
212
230
  output += "\nexport default _sfc_main;";
213
231
  }
214
- if (hasDelegatedStyles(compiled) && filePath) {
232
+ if (cssPipeline || hasDelegatedStyles(compiled)) {
215
233
  const styleImports = [];
216
234
  const cssModuleImports = [];
217
235
  for (const block of compiled.styles) {
@@ -236,7 +254,10 @@ function generateOutput(compiled, options) {
236
254
  }).join("\n");
237
255
  output = output.replace(/^export default _sfc_main;?$/m, `${cssModuleSetup}\nexport default _sfc_main;`);
238
256
  }
239
- } else if (compiled.css && !(isProduction && extractCss)) output = prependInlineStyleInjection(output, compiled.css, compiled.scopeId);
257
+ } else if (compiled.css) {
258
+ assertInjectableCss(compiled.styles, filePath);
259
+ output = prependInlineStyleInjection(output, compiled.css, compiled.scopeId);
260
+ }
240
261
  if (!isProduction && isDev && hasExportDefault && supportsTemplateOnlyHmr(output)) output += "";
241
262
  return output;
242
263
  }
@@ -251,20 +272,6 @@ function toStyleBlockInfo(block) {
251
272
  };
252
273
  }
253
274
  //#endregion
254
- //#region src/style-dependencies.ts
255
- function hasImportRule(ast) {
256
- if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
257
- return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
258
- }
259
- /** The inline runtime style path cannot resolve external CSS dependencies. */
260
- function assertSupportedStyleDependencies(styles, filename) {
261
- for (const style of styles) {
262
- if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> could not be inlined by @vizejs/unplugin. Write it as <style src="./file.css"> with a quoted relative path, or use @vizejs/vite-plugin.`);
263
- if (style.module || style.lang && style.lang !== "css" || !style.content.includes("@")) continue;
264
- if (hasImportRule((0, _vizejs_native.parseCssAst)(style.content, { filename }).ast)) throw new Error(`[vize] ${filename}: CSS @import in <style> is not supported by @vizejs/unplugin's inline style output. Inline the imported CSS, or use @vizejs/vite-plugin for stylesheet dependency resolution.`);
265
- }
266
- }
267
- //#endregion
268
275
  //#region ../shared/sfc-src.ts
269
276
  /**
270
277
  * Whether a block `src` is a path relative to the SFC. Any other `src`
@@ -458,7 +465,7 @@ function compileVueModule(filePath, source, options, cache, srcResolutions) {
458
465
  inlineTemplate: options.isProduction && !options.ssr && options.mode !== "function"
459
466
  });
460
467
  if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
461
- assertSupportedStyleDependencies(result.styles, filePath);
468
+ assertInlinedStyleSrc(result.styles, filePath);
462
469
  const compiled = {
463
470
  code: result.code,
464
471
  css: result.css,
@@ -617,6 +624,19 @@ async function loadStyleBlock(context, id, options, cache) {
617
624
  if (!scoped) return source;
618
625
  return require_webpack_styles.scopeCss(block.lang && require_webpack_styles.isPreprocessorLang(block.lang) ? await require_webpack_styles.preprocessStyle(source, block.lang, request.filename, options.root) : source, scoped);
619
626
  }
627
+ /**
628
+ * Whether the host bundles the stylesheets a module imports. esbuild without
629
+ * `bundle` never follows an import, so its CSS can only be injected.
630
+ */
631
+ function bundlesStylesheets(context, framework) {
632
+ if (framework !== "esbuild") return true;
633
+ return (context.getNativeBuildContext?.())?.build?.initialOptions?.bundle === true;
634
+ }
635
+ const CSS_PIPELINE_HINT = "[vize] <style> blocks are stylesheet modules for the bundler's CSS pipeline, and this build did not bundle one. tsdown needs @tsdown/css; Rollup needs a CSS plugin such as rollup-plugin-postcss; Rolldown alone does not bundle CSS, so build through tsdown or Vite.";
636
+ /** A Rollup or Rolldown build error raised on a style module with no CSS pipeline. */
637
+ function isStylePipelineError(error) {
638
+ return [error, ...error.errors ?? []].some((item) => typeof item.id === "string" && isVueStyleRequest(item.id) || item.code === "UNSUPPORTED_FEATURE");
639
+ }
620
640
  /** The bundler's own module resolver, or null for a host that offers none. */
621
641
  function hostResolver(context) {
622
642
  const ctx = context;
@@ -657,6 +677,15 @@ const vizeUnplugin = (0, unplugin.createUnplugin)((rawOptions = {}, meta) => {
657
677
  const cache = /* @__PURE__ */ new Map();
658
678
  const webpackStyleFiles = meta.framework === "webpack";
659
679
  let virtualModules;
680
+ let loadedStyles = false;
681
+ const rollupHooks = {
682
+ buildStart() {
683
+ loadedStyles = false;
684
+ },
685
+ buildEnd(error) {
686
+ if (error && loadedStyles && isStylePipelineError(error)) this.warn(CSS_PIPELINE_HINT);
687
+ }
688
+ };
660
689
  return {
661
690
  name: "unplugin-vize",
662
691
  resolveId(id) {
@@ -670,6 +699,7 @@ const vizeUnplugin = (0, unplugin.createUnplugin)((rawOptions = {}, meta) => {
670
699
  async load(id) {
671
700
  if (options.hostCompiler) return null;
672
701
  if (!isVueStyleRequest(id)) return null;
702
+ loadedStyles = true;
673
703
  return {
674
704
  code: await loadStyleBlock(this, id, options, cache),
675
705
  map: null
@@ -700,6 +730,7 @@ const vizeUnplugin = (0, unplugin.createUnplugin)((rawOptions = {}, meta) => {
700
730
  const transformed = await stripTypeScript(id, generateOutput(compiled, {
701
731
  isProduction: options.isProduction,
702
732
  isDev: false,
733
+ cssPipeline: bundlesStylesheets(this, meta.framework),
703
734
  filePath: id,
704
735
  styleRequest: webpackStyleFiles ? (block, scoped) => {
705
736
  const stylePath = require_webpack_styles.webpackStylePath(id, block, scoped);
@@ -716,6 +747,8 @@ const vizeUnplugin = (0, unplugin.createUnplugin)((rawOptions = {}, meta) => {
716
747
  watchChange(id) {
717
748
  if (isVueFile(id)) cache.delete(id);
718
749
  },
750
+ rollup: rollupHooks,
751
+ rolldown: rollupHooks,
719
752
  webpack(compiler) {
720
753
  if (!options.hostCompiler) {
721
754
  virtualModules = require_webpack_styles.findVirtualModules(compiler);
@@ -140,6 +140,23 @@ function parseVueRequest(id) {
140
140
  };
141
141
  }
142
142
  //#endregion
143
+ //#region src/style-dependencies.ts
144
+ function hasImportRule(ast) {
145
+ if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
146
+ return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
147
+ }
148
+ /** `src` blocks are inlined before compilation; one left here was unreadable. */
149
+ function assertInlinedStyleSrc(styles, filename) {
150
+ for (const style of styles) if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> could not be inlined by @vizejs/unplugin. Write it as <style src="./file.css"> with a quoted relative path, or use @vizejs/vite-plugin.`);
151
+ }
152
+ /** CSS injected at run time is a string in the page, so nothing resolves its `@import`. */
153
+ function assertInjectableCss(styles, filename) {
154
+ for (const style of styles) {
155
+ if (!style.content.includes("@")) continue;
156
+ if (hasImportRule(parseCssAst(style.content, { filename }).ast)) throw new Error(`[vize] ${filename}: CSS @import in <style> needs a bundler CSS pipeline. @vizejs/unplugin injects CSS at run time under Babel and esbuild without \`bundle\`, where nothing resolves the import. Inline the imported CSS, bundle the build, or use @vizejs/vite-plugin.`);
157
+ }
158
+ }
159
+ //#endregion
143
160
  //#region src/style.ts
144
161
  function needsPreprocessor(block) {
145
162
  return isPreprocessorLang(block.lang);
@@ -147,6 +164,7 @@ function needsPreprocessor(block) {
147
164
  function isCssModule(block) {
148
165
  return block.module !== false;
149
166
  }
167
+ /** Blocks only a host CSS pipeline can serve. */
150
168
  function hasDelegatedStyles(compiled) {
151
169
  return compiled.styles.some((style) => needsPreprocessor(style) || isCssModule(style));
152
170
  }
@@ -192,7 +210,7 @@ const CSS_MODULE_LOCALS_HELPER = `const ${CSS_MODULE_LOCALS} = (ns) =>
192
210
  ? ns.default
193
211
  : Object.fromEntries(Object.entries(ns).filter(([key]) => key !== "default")));`;
194
212
  function generateOutput(compiled, options) {
195
- const { isProduction, isDev, extractCss, filePath, styleRequest } = options;
213
+ const { isProduction, isDev, cssPipeline, filePath, styleRequest } = options;
196
214
  let output = compiled.code;
197
215
  const exportDefaultRegex = /^export default /m;
198
216
  const hasExportDefault = exportDefaultRegex.test(output);
@@ -209,7 +227,7 @@ function generateOutput(compiled, options) {
209
227
  output += "\n_sfc_main.render = render;";
210
228
  output += "\nexport default _sfc_main;";
211
229
  }
212
- if (hasDelegatedStyles(compiled) && filePath) {
230
+ if (cssPipeline || hasDelegatedStyles(compiled)) {
213
231
  const styleImports = [];
214
232
  const cssModuleImports = [];
215
233
  for (const block of compiled.styles) {
@@ -234,7 +252,10 @@ function generateOutput(compiled, options) {
234
252
  }).join("\n");
235
253
  output = output.replace(/^export default _sfc_main;?$/m, `${cssModuleSetup}\nexport default _sfc_main;`);
236
254
  }
237
- } else if (compiled.css && !(isProduction && extractCss)) output = prependInlineStyleInjection(output, compiled.css, compiled.scopeId);
255
+ } else if (compiled.css) {
256
+ assertInjectableCss(compiled.styles, filePath);
257
+ output = prependInlineStyleInjection(output, compiled.css, compiled.scopeId);
258
+ }
238
259
  if (!isProduction && isDev && hasExportDefault && supportsTemplateOnlyHmr(output)) output += "";
239
260
  return output;
240
261
  }
@@ -249,20 +270,6 @@ function toStyleBlockInfo(block) {
249
270
  };
250
271
  }
251
272
  //#endregion
252
- //#region src/style-dependencies.ts
253
- function hasImportRule(ast) {
254
- if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
255
- return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
256
- }
257
- /** The inline runtime style path cannot resolve external CSS dependencies. */
258
- function assertSupportedStyleDependencies(styles, filename) {
259
- for (const style of styles) {
260
- if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> could not be inlined by @vizejs/unplugin. Write it as <style src="./file.css"> with a quoted relative path, or use @vizejs/vite-plugin.`);
261
- if (style.module || style.lang && style.lang !== "css" || !style.content.includes("@")) continue;
262
- if (hasImportRule(parseCssAst(style.content, { filename }).ast)) throw new Error(`[vize] ${filename}: CSS @import in <style> is not supported by @vizejs/unplugin's inline style output. Inline the imported CSS, or use @vizejs/vite-plugin for stylesheet dependency resolution.`);
263
- }
264
- }
265
- //#endregion
266
273
  //#region ../shared/sfc-src.ts
267
274
  /**
268
275
  * Whether a block `src` is a path relative to the SFC. Any other `src`
@@ -456,7 +463,7 @@ function compileVueModule(filePath, source, options, cache, srcResolutions) {
456
463
  inlineTemplate: options.isProduction && !options.ssr && options.mode !== "function"
457
464
  });
458
465
  if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
459
- assertSupportedStyleDependencies(result.styles, filePath);
466
+ assertInlinedStyleSrc(result.styles, filePath);
460
467
  const compiled = {
461
468
  code: result.code,
462
469
  css: result.css,
@@ -615,6 +622,19 @@ async function loadStyleBlock(context, id, options, cache) {
615
622
  if (!scoped) return source;
616
623
  return scopeCss(block.lang && isPreprocessorLang(block.lang) ? await preprocessStyle(source, block.lang, request.filename, options.root) : source, scoped);
617
624
  }
625
+ /**
626
+ * Whether the host bundles the stylesheets a module imports. esbuild without
627
+ * `bundle` never follows an import, so its CSS can only be injected.
628
+ */
629
+ function bundlesStylesheets(context, framework) {
630
+ if (framework !== "esbuild") return true;
631
+ return (context.getNativeBuildContext?.())?.build?.initialOptions?.bundle === true;
632
+ }
633
+ const CSS_PIPELINE_HINT = "[vize] <style> blocks are stylesheet modules for the bundler's CSS pipeline, and this build did not bundle one. tsdown needs @tsdown/css; Rollup needs a CSS plugin such as rollup-plugin-postcss; Rolldown alone does not bundle CSS, so build through tsdown or Vite.";
634
+ /** A Rollup or Rolldown build error raised on a style module with no CSS pipeline. */
635
+ function isStylePipelineError(error) {
636
+ return [error, ...error.errors ?? []].some((item) => typeof item.id === "string" && isVueStyleRequest(item.id) || item.code === "UNSUPPORTED_FEATURE");
637
+ }
618
638
  /** The bundler's own module resolver, or null for a host that offers none. */
619
639
  function hostResolver(context) {
620
640
  const ctx = context;
@@ -655,6 +675,15 @@ const vizeUnplugin = createUnplugin((rawOptions = {}, meta) => {
655
675
  const cache = /* @__PURE__ */ new Map();
656
676
  const webpackStyleFiles = meta.framework === "webpack";
657
677
  let virtualModules;
678
+ let loadedStyles = false;
679
+ const rollupHooks = {
680
+ buildStart() {
681
+ loadedStyles = false;
682
+ },
683
+ buildEnd(error) {
684
+ if (error && loadedStyles && isStylePipelineError(error)) this.warn(CSS_PIPELINE_HINT);
685
+ }
686
+ };
658
687
  return {
659
688
  name: "unplugin-vize",
660
689
  resolveId(id) {
@@ -668,6 +697,7 @@ const vizeUnplugin = createUnplugin((rawOptions = {}, meta) => {
668
697
  async load(id) {
669
698
  if (options.hostCompiler) return null;
670
699
  if (!isVueStyleRequest(id)) return null;
700
+ loadedStyles = true;
671
701
  return {
672
702
  code: await loadStyleBlock(this, id, options, cache),
673
703
  map: null
@@ -698,6 +728,7 @@ const vizeUnplugin = createUnplugin((rawOptions = {}, meta) => {
698
728
  const transformed = await stripTypeScript(id, generateOutput(compiled, {
699
729
  isProduction: options.isProduction,
700
730
  isDev: false,
731
+ cssPipeline: bundlesStylesheets(this, meta.framework),
701
732
  filePath: id,
702
733
  styleRequest: webpackStyleFiles ? (block, scoped) => {
703
734
  const stylePath = webpackStylePath(id, block, scoped);
@@ -714,6 +745,8 @@ const vizeUnplugin = createUnplugin((rawOptions = {}, meta) => {
714
745
  watchChange(id) {
715
746
  if (isVueFile(id)) cache.delete(id);
716
747
  },
748
+ rollup: rollupHooks,
749
+ rolldown: rollupHooks,
717
750
  webpack(compiler) {
718
751
  if (!options.hostCompiler) {
719
752
  virtualModules = findVirtualModules(compiler);
package/dist/webpack.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/webpack.ts
2
- var webpack_default = require("./unplugin-Dl8hs9VI.cjs").vizeUnplugin.webpack;
2
+ var webpack_default = require("./unplugin-7UpIpoaj.cjs").vizeUnplugin.webpack;
3
3
  //#endregion
4
4
  module.exports = webpack_default;
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as vizeUnplugin } from "./unplugin-BbWP410q.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-hYMgbR_K.mjs";
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = vizeUnplugin.webpack;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/unplugin",
3
- "version": "0.662.0",
3
+ "version": "0.663.0",
4
4
  "description": "Experimental Vue SFC integrations for Rollup, Rolldown, Webpack, esbuild, and Babel powered by Vize",
5
5
  "keywords": [
6
6
  "babel",
@@ -68,7 +68,7 @@
68
68
  "access": "public"
69
69
  },
70
70
  "dependencies": {
71
- "@vizejs/native": "0.662.0",
71
+ "@vizejs/native": "0.663.0",
72
72
  "oxc-transform": "0.144.0",
73
73
  "unplugin": "3.3.0"
74
74
  },