@vizejs/vite-plugin 0.164.0 → 0.165.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 -1
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1348,12 +1348,26 @@ function createStylePostTransformPlugin() {
1348
1348
  }
1349
1349
  };
1350
1350
  }
1351
+ function stripQuery(id) {
1352
+ const queryStart = id.search(/[?#]/);
1353
+ return queryStart === -1 ? id : id.slice(0, queryStart);
1354
+ }
1355
+ function isSfcLikeSource(code) {
1356
+ return /^<(?:template|script|style)(?:\s|>|\/)/.test(code.trimStart());
1357
+ }
1358
+ function shouldPostTransformSfcLikeModule(state, id) {
1359
+ const filename = stripQuery(id);
1360
+ if (filename.endsWith(".vue") || filename.endsWith(".vue.ts") || filename.includes("node_modules")) return false;
1361
+ if (filename.endsWith(".setup.ts")) return true;
1362
+ if (state.filter(filename) || state.filter(id)) return true;
1363
+ return /\.(?:md|markdown)$/i.test(filename);
1364
+ }
1351
1365
  function createPostTransformPlugin(state) {
1352
1366
  return {
1353
1367
  name: "vize:post-transform",
1354
1368
  enforce: "post",
1355
1369
  async transform(code, id, transformOptions) {
1356
- if (!id.endsWith(".vue") && !id.endsWith(".vue.ts") && !id.includes("node_modules") && id.endsWith(".setup.ts") && /<script\s+setup[\s>]/.test(code)) {
1370
+ if (shouldPostTransformSfcLikeModule(state, id) && isSfcLikeSource(code)) {
1357
1371
  state.logger.log(`post-transform: compiling virtual SFC content from ${id}`);
1358
1372
  try {
1359
1373
  const isSsr = !!transformOptions?.ssr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.164.0",
3
+ "version": "0.165.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.164.0",
42
+ "@vizejs/native": "0.165.0",
43
43
  "tinyglobby": "0.2.16",
44
- "vize": "0.164.0"
44
+ "vize": "0.165.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "25.7.0",