@vizejs/unplugin 0.655.0 → 0.656.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 +2 -0
- package/dist/babel.cjs +1 -1
- package/dist/babel.mjs +1 -1
- package/dist/esbuild.cjs +1 -1
- package/dist/esbuild.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rolldown.cjs +1 -1
- package/dist/rolldown.mjs +1 -1
- package/dist/rollup.cjs +1 -1
- package/dist/rollup.mjs +1 -1
- package/dist/{unplugin-DlBOlt7-.mjs → unplugin-DX7ymghn.mjs} +16 -1
- package/dist/{unplugin-BsA3s_G_.cjs → unplugin-pPxtpl3x.cjs} +15 -0
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -115,6 +115,8 @@ 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.
|
|
119
|
+
- External `<style src="...">` blocks and `@import` in plain inline CSS are unsupported and cause an explicit build error. Inline those styles without external imports, or use `@vizejs/vite-plugin` for stylesheet dependency resolution. The unplugin does not read, watch, or cache those external stylesheets.
|
|
118
120
|
- CSS Modules and preprocessors depend on the host bundler CSS pipeline and are more likely to change than the Vite path.
|
|
119
121
|
- 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`.
|
|
120
122
|
- 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.
|
package/dist/babel.cjs
CHANGED
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-
|
|
1
|
+
import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-DX7ymghn.mjs";
|
|
2
2
|
//#region src/babel.ts
|
|
3
3
|
function vizeBabelPlugin(_api, rawOptions = {}) {
|
|
4
4
|
const options = normalizeOptions(rawOptions);
|
package/dist/esbuild.cjs
CHANGED
package/dist/esbuild.mjs
CHANGED
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-
|
|
5
|
+
const require_unplugin = require("./unplugin-pPxtpl3x.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-
|
|
1
|
+
import { n as vizeUnplugin } from "./unplugin-DX7ymghn.mjs";
|
|
2
2
|
export { vizeUnplugin as default, vizeUnplugin };
|
package/dist/rolldown.cjs
CHANGED
package/dist/rolldown.mjs
CHANGED
package/dist/rollup.cjs
CHANGED
package/dist/rollup.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import fs from "node:fs";
|
|
|
4
4
|
import { createUnplugin } from "unplugin";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import * as native from "@vizejs/native";
|
|
7
|
-
import { generateSfcScopeId } from "@vizejs/native";
|
|
7
|
+
import { generateSfcScopeId, parseCssAst } from "@vizejs/native";
|
|
8
8
|
import { transform } from "oxc-transform";
|
|
9
9
|
//#region src/filter.ts
|
|
10
10
|
function createFilter(include, exclude) {
|
|
@@ -212,6 +212,20 @@ function toStyleBlockInfo(block) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
//#endregion
|
|
215
|
+
//#region src/style-dependencies.ts
|
|
216
|
+
function hasImportRule(ast) {
|
|
217
|
+
if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
|
|
218
|
+
return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
|
|
219
|
+
}
|
|
220
|
+
/** The inline runtime style path cannot resolve external CSS dependencies. */
|
|
221
|
+
function assertSupportedStyleDependencies(styles, filename) {
|
|
222
|
+
for (const style of styles) {
|
|
223
|
+
if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> is not supported by @vizejs/unplugin. Use inline CSS without external imports, or @vizejs/vite-plugin for external stylesheet resolution.`);
|
|
224
|
+
if (style.module || style.lang && style.lang !== "css" || !style.content.includes("@")) continue;
|
|
225
|
+
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.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
215
229
|
//#region src/compiler.ts
|
|
216
230
|
const { compileSfc, compileJsx } = native;
|
|
217
231
|
function buildSignature(options) {
|
|
@@ -268,6 +282,7 @@ function compileVueModule(filePath, source, options, cache) {
|
|
|
268
282
|
scopeId: `data-v-${scopeId}`
|
|
269
283
|
});
|
|
270
284
|
if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
|
|
285
|
+
assertSupportedStyleDependencies(result.styles, filePath);
|
|
271
286
|
const compiled = {
|
|
272
287
|
code: result.code,
|
|
273
288
|
css: result.css,
|
|
@@ -213,6 +213,20 @@ function toStyleBlockInfo(block) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
|
+
//#region src/style-dependencies.ts
|
|
217
|
+
function hasImportRule(ast) {
|
|
218
|
+
if (typeof ast !== "object" || ast === null || !("rules" in ast)) return false;
|
|
219
|
+
return Array.isArray(ast.rules) && ast.rules.some((rule) => typeof rule === "object" && rule !== null && "type" in rule && rule.type === "import");
|
|
220
|
+
}
|
|
221
|
+
/** The inline runtime style path cannot resolve external CSS dependencies. */
|
|
222
|
+
function assertSupportedStyleDependencies(styles, filename) {
|
|
223
|
+
for (const style of styles) {
|
|
224
|
+
if (style.src !== void 0) throw new Error(`[vize] ${filename}: <style src=${JSON.stringify(style.src)}> is not supported by @vizejs/unplugin. Use inline CSS without external imports, or @vizejs/vite-plugin for external stylesheet resolution.`);
|
|
225
|
+
if (style.module || style.lang && style.lang !== "css" || !style.content.includes("@")) continue;
|
|
226
|
+
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.`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
//#endregion
|
|
216
230
|
//#region src/compiler.ts
|
|
217
231
|
const { compileSfc, compileJsx } = _vizejs_native;
|
|
218
232
|
function buildSignature(options) {
|
|
@@ -269,6 +283,7 @@ function compileVueModule(filePath, source, options, cache) {
|
|
|
269
283
|
scopeId: `data-v-${scopeId}`
|
|
270
284
|
});
|
|
271
285
|
if (result.errors.length > 0) throw new Error(result.errors.join("\n"));
|
|
286
|
+
assertSupportedStyleDependencies(result.styles, filePath);
|
|
272
287
|
const compiled = {
|
|
273
288
|
code: result.code,
|
|
274
289
|
css: result.css,
|
package/dist/webpack.cjs
CHANGED
package/dist/webpack.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.656.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.
|
|
71
|
+
"@vizejs/native": "0.656.0",
|
|
72
72
|
"oxc-transform": "0.144.0",
|
|
73
73
|
"unplugin": "3.3.0"
|
|
74
74
|
},
|