@vizejs/rspack-plugin 0.178.0 → 0.180.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.
@@ -6,6 +6,8 @@ interface SfcCompileOptionsNapi {
6
6
  ssr?: boolean;
7
7
  /** Enable Vapor mode compilation */
8
8
  vapor?: boolean;
9
+ /** Template syntax compatibility mode */
10
+ templateSyntax?: "standard" | "strict" | "quirks";
9
11
  /** Preserve TypeScript in output when true */
10
12
  isTs?: boolean;
11
13
  /** Scope ID for scoped CSS (e.g., "data-v-abc123") */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SfcCompileOptionsNapi, c as StyleBlockInfo, d as VizeStyleLoaderOptions, i as MacroArtifact, l as VizeLoaderOptions, n as CustomBlockInfo, o as SfcCompileResultNapi, r as LoaderEntry, s as SfcSrcInfo, t as CompiledModule, u as VizeRspackPluginOptions } from "./index-DQ8S8WoC.mjs";
1
+ import { a as SfcCompileOptionsNapi, c as StyleBlockInfo, d as VizeStyleLoaderOptions, i as MacroArtifact, l as VizeLoaderOptions, n as CustomBlockInfo, o as SfcCompileResultNapi, r as LoaderEntry, s as SfcSrcInfo, t as CompiledModule, u as VizeRspackPluginOptions } from "./index-UcNdg-h0.mjs";
2
2
  import vizeLoader from "./loader/index.mjs";
3
3
  import vizeStyleLoader from "./loader/style-loader.mjs";
4
4
  import vizeScopeLoader from "./loader/scope-loader.mjs";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,o as r,r as i,s as a,t as o}from"./utils-CFK8mca_.mjs";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./loader-zhnTzdd6.mjs";import m from"./loader/style-loader.mjs";import h from"./loader/scope-loader.mjs";const g=`@vizejs/rspack-plugin/style-loader`,_=`@vizejs/rspack-plugin/scope-loader`,v={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function y(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&b(e));if(r===-1)return{applied:!1,clonedCount:0,warnings:n};let i=e[r];if(i.oneOf)return{applied:!1,clonedCount:0,warnings:n};let a=[];for(let t=0;t<e.length;t++){if(t===r)continue;let n=e[t];if(n===`...`)continue;let i=C(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...w(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...T(t));let s={use:E(k(i),t)},c=[...o,s];e[r]={test:i.test,oneOf:c};for(let e of a)D(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function b(e){return S(e.test)?k(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?x(t):!1}):!1}function x(e){return e===`@vizejs/rspack-plugin/loader`||e.includes(`rspack-vize-plugin`)&&e.includes(`loader`)&&!e.includes(`style-loader`)&&!e.includes(`scope-loader`)}function S(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function C(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(v))if(n.includes(e)||n===e)return t;return t.test(`foo.css`)&&!t.test(`foo.vue`)?`css`:t.test(`foo.scss`)&&!t.test(`foo.vue`)?`scss`:t.test(`foo.sass`)&&!t.test(`foo.vue`)?`sass`:t.test(`foo.less`)&&!t.test(`foo.vue`)?`less`:t.test(`foo.styl`)&&!t.test(`foo.vue`)?`styl`:null}function w(e,t,n){let r=k(e);if(r.length===0)return[];let i=[{loader:_},...A(r),{loader:g}],a=(t,n)=>{let r={resourceQuery:t,use:A(i)};return e.type?r.type=e.type:n&&(r.type=n),r};return n?[a(RegExp(`(?=.*type=style)(?=.*lang=${t})(?=.*module=)`),`css/module`),a(RegExp(`(?=.*type=style)(?=.*lang=${t})`),`css/auto`)]:[a(RegExp(`(?=.*type=style)(?=.*lang=${t})`))]}function T(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:_},{loader:g}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:_},{loader:g}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:_},{loader:g}]}]}function E(e,t){return A(e).map(e=>{if(typeof e==`string`)return x(e)?{loader:e,options:{css:{native:t}}}:e;if(typeof e!=`object`||!e)return e;let n=e.loader;if(!n||!x(n))return e;let r=e.options;if(!r||typeof r!=`object`||Array.isArray(r))return{...e,options:{css:{native:t}}};let i=r,a=i.css;return!a||typeof a!=`object`||Array.isArray(a)?{...e,options:{...i,css:{native:t}}}:{...e,options:{...i,css:{...a,native:t}}}})}function D(e){let t=e.resourceQuery;if(t)return typeof t==`object`&&!Array.isArray(t)&&!(t instanceof RegExp)&&`not`in t,void 0;e.resourceQuery={not:[/vue/]}}function O(e){return e?Array.isArray(e)?e:[e]:[]}function k(e){let t=O(e.use);if(t.length>0)return t;let n=e.loader;if(n){let t=e.options;return t?[{loader:n,options:t}]:[n]}return[]}function A(e){return e.map(e=>{if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t={...e};return`options`in e&&e.options&&typeof e.options==`object`&&(t.options={...e.options}),t}return e})}var j=class e{static name=`VizePlugin`;options;constructor(e={}){this.options=e}apply(t){let n=t.getInfrastructureLogger(e.name),r=this.options.isProduction??t.options.mode===`production`;this.options.vapor&&!r&&n.debug(`Vapor mode is enabled.`);let i=u(t.options),a=t.webpack?.rspackVersion,o=f(this.options.css?.native,t.options,a);if(this.options.css?.native&&i===`disabled`&&n.warn("`css.native: true` is set but `experiments.css` is not enabled in rspack config."),this.options.autoRules??!0){let e=t.options.module?.rules;if(e){let t=y(e,o);t.applied&&n.debug(`Auto-injected ${t.clonedCount} style rule(s) for Vue SFC sub-requests.`);for(let e of t.warnings)n.warn(e)}}if(this.options.typescript??!0){let e=t.options.module?.rules;e&&(e.some(e=>{if(e===`...`||typeof e!=`object`||!e)return!1;let t=e;if(t.enforce!==`post`)return!1;let n=t.test;return n instanceof RegExp?n.test(`App.vue`):typeof n==`string`?n.includes(`.vue`):!1})||(e.push({test:/\.vue$/,resourceQuery:{not:[/type=/]},enforce:`post`,loader:`builtin:swc-loader`,options:{jsc:{parser:{syntax:`typescript`}}},type:`javascript/auto`}),n.debug(`Auto-injected TypeScript post-processing rule for .vue files.`)))}let{DefinePlugin:s}=t.webpack,c=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))c.add(e)}let l={};c.has(`__VUE_OPTIONS_API__`)||(l.__VUE_OPTIONS_API__=JSON.stringify(!0)),c.has(`__VUE_PROD_DEVTOOLS__`)||(l.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),c.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(l.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(l).length>0&&new s(l).apply(t),r||t.hooks.watchRun.tap(e.name,e=>{let t=e.modifiedFiles,r=e.removedFiles;if(t)for(let e of t)e.endsWith(`.vue`)&&this.shouldHandleFile(e)&&n.debug(`Vue file changed: ${e}`);if(r)for(let e of r)e.endsWith(`.vue`)&&this.shouldHandleFile(e)&&n.debug(`Vue file removed: ${e}`)})}shouldHandleFile(e){return!(!t(e,this.options.include,!0)||t(e,this.options.exclude,!1))}};export{j as VizePlugin,o as addScopeToCssFallback,y as applyRuleCloning,l as clearCompilationCache,d as compileFile,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,s as genHotReloadCode,c as generateOutput,r as generateScopeId,a as inlineSrcBlocks,t as matchesPattern,p as vizeLoader,h as vizeScopeLoader,m as vizeStyleLoader};
1
+ import{a as e,c as t,i as n,o as r,r as i,s as a,t as o}from"./utils-CFK8mca_.mjs";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./loader-BslWL-th.mjs";import m from"./loader/style-loader.mjs";import h from"./loader/scope-loader.mjs";const g=`@vizejs/rspack-plugin/style-loader`,_=`@vizejs/rspack-plugin/scope-loader`,v={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function y(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&b(e));if(r===-1)return{applied:!1,clonedCount:0,warnings:n};let i=e[r];if(i.oneOf)return{applied:!1,clonedCount:0,warnings:n};let a=[];for(let t=0;t<e.length;t++){if(t===r)continue;let n=e[t];if(n===`...`)continue;let i=C(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...w(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...T(t));let s={use:E(k(i),t)},c=[...o,s];e[r]={test:i.test,oneOf:c};for(let e of a)D(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function b(e){return S(e.test)?k(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?x(t):!1}):!1}function x(e){return e===`@vizejs/rspack-plugin/loader`||e.includes(`rspack-vize-plugin`)&&e.includes(`loader`)&&!e.includes(`style-loader`)&&!e.includes(`scope-loader`)}function S(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function C(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(v))if(n.includes(e)||n===e)return t;return t.test(`foo.css`)&&!t.test(`foo.vue`)?`css`:t.test(`foo.scss`)&&!t.test(`foo.vue`)?`scss`:t.test(`foo.sass`)&&!t.test(`foo.vue`)?`sass`:t.test(`foo.less`)&&!t.test(`foo.vue`)?`less`:t.test(`foo.styl`)&&!t.test(`foo.vue`)?`styl`:null}function w(e,t,n){let r=k(e);if(r.length===0)return[];let i=[{loader:_},...A(r),{loader:g}],a=(t,n)=>{let r={resourceQuery:t,use:A(i)};return e.type?r.type=e.type:n&&(r.type=n),r};return n?[a(RegExp(`(?=.*type=style)(?=.*lang=${t})(?=.*module=)`),`css/module`),a(RegExp(`(?=.*type=style)(?=.*lang=${t})`),`css/auto`)]:[a(RegExp(`(?=.*type=style)(?=.*lang=${t})`))]}function T(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:_},{loader:g}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:_},{loader:g}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:_},{loader:g}]}]}function E(e,t){return A(e).map(e=>{if(typeof e==`string`)return x(e)?{loader:e,options:{css:{native:t}}}:e;if(typeof e!=`object`||!e)return e;let n=e.loader;if(!n||!x(n))return e;let r=e.options;if(!r||typeof r!=`object`||Array.isArray(r))return{...e,options:{css:{native:t}}};let i=r,a=i.css;return!a||typeof a!=`object`||Array.isArray(a)?{...e,options:{...i,css:{native:t}}}:{...e,options:{...i,css:{...a,native:t}}}})}function D(e){let t=e.resourceQuery;if(t)return typeof t==`object`&&!Array.isArray(t)&&!(t instanceof RegExp)&&`not`in t,void 0;e.resourceQuery={not:[/vue/]}}function O(e){return e?Array.isArray(e)?e:[e]:[]}function k(e){let t=O(e.use);if(t.length>0)return t;let n=e.loader;if(n){let t=e.options;return t?[{loader:n,options:t}]:[n]}return[]}function A(e){return e.map(e=>{if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t={...e};return`options`in e&&e.options&&typeof e.options==`object`&&(t.options={...e.options}),t}return e})}var j=class e{static name=`VizePlugin`;options;constructor(e={}){this.options=e}apply(t){let n=t.getInfrastructureLogger(e.name),r=this.options.isProduction??t.options.mode===`production`;this.options.vapor&&!r&&n.debug(`Vapor mode is enabled.`);let i=u(t.options),a=t.webpack?.rspackVersion,o=f(this.options.css?.native,t.options,a);if(this.options.css?.native&&i===`disabled`&&n.warn("`css.native: true` is set but `experiments.css` is not enabled in rspack config."),this.options.autoRules??!0){let e=t.options.module?.rules;if(e){let t=y(e,o);t.applied&&n.debug(`Auto-injected ${t.clonedCount} style rule(s) for Vue SFC sub-requests.`);for(let e of t.warnings)n.warn(e)}}if(this.options.typescript??!0){let e=t.options.module?.rules;e&&(e.some(e=>{if(e===`...`||typeof e!=`object`||!e)return!1;let t=e;if(t.enforce!==`post`)return!1;let n=t.test;return n instanceof RegExp?n.test(`App.vue`):typeof n==`string`?n.includes(`.vue`):!1})||(e.push({test:/\.vue$/,resourceQuery:{not:[/type=/]},enforce:`post`,loader:`builtin:swc-loader`,options:{jsc:{parser:{syntax:`typescript`}}},type:`javascript/auto`}),n.debug(`Auto-injected TypeScript post-processing rule for .vue files.`)))}let{DefinePlugin:s}=t.webpack,c=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))c.add(e)}let l={};c.has(`__VUE_OPTIONS_API__`)||(l.__VUE_OPTIONS_API__=JSON.stringify(!0)),c.has(`__VUE_PROD_DEVTOOLS__`)||(l.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),c.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(l.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(l).length>0&&new s(l).apply(t),r||t.hooks.watchRun.tap(e.name,e=>{let t=e.modifiedFiles,r=e.removedFiles;if(t)for(let e of t)e.endsWith(`.vue`)&&this.shouldHandleFile(e)&&n.debug(`Vue file changed: ${e}`);if(r)for(let e of r)e.endsWith(`.vue`)&&this.shouldHandleFile(e)&&n.debug(`Vue file removed: ${e}`)})}shouldHandleFile(e){return!(!t(e,this.options.include,!0)||t(e,this.options.exclude,!1))}};export{j as VizePlugin,o as addScopeToCssFallback,y as applyRuleCloning,l as clearCompilationCache,d as compileFile,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,s as genHotReloadCode,c as generateOutput,r as generateScopeId,a as inlineSrcBlocks,t as matchesPattern,p as vizeLoader,h as vizeScopeLoader,m as vizeStyleLoader};
@@ -1,4 +1,4 @@
1
- import { l as VizeLoaderOptions } from "../index-DQ8S8WoC.mjs";
1
+ import { l as VizeLoaderOptions } from "../index-UcNdg-h0.mjs";
2
2
  import { LoaderContext } from "@rspack/core";
3
3
 
4
4
  //#region src/loader/index.d.ts
@@ -1 +1 @@
1
- import{t as e}from"../loader-zhnTzdd6.mjs";export{e as default};
1
+ import{t as e}from"../loader-BslWL-th.mjs";export{e as default};
@@ -1,4 +1,4 @@
1
- import { d as VizeStyleLoaderOptions } from "../index-DQ8S8WoC.mjs";
1
+ import { d as VizeStyleLoaderOptions } from "../index-UcNdg-h0.mjs";
2
2
  import { LoaderContext } from "@rspack/core";
3
3
 
4
4
  //#region src/loader/style-loader.d.ts
@@ -21,4 +21,4 @@ export default _sfc_main;`):a&&o&&e.hasScoped&&e.scopeId&&(n=n.replace(/^export
21
21
  `):``;n=n.replace(/^export default _sfc_main;/m,`${r}\n${i}\nexport default _sfc_main;`)}}if(t.filePath&&!t.isProduction){let e=t.rootContext?u.relative(t.rootContext,t.filePath).replace(/\\/g,`/`):u.basename(t.filePath);n=n.replace(/^export default _sfc_main;/m,`_sfc_main.__file = ${JSON.stringify(e)};\nexport default _sfc_main;`)}if(t.hmr&&e.scopeId&&(n=n.replace(/^export default _sfc_main;/m,`${h(e.scopeId)}\nexport default _sfc_main;`)),e.customBlocks.length>0){let r=e.customBlocks.map((e,n)=>{let r=[`vue`,`type=${e.type}`,`index=${n}`,...e.src?[`src=true`]:[]];for(let[t,n]of Object.entries(e.attrs))t!==`src`&&(n===!0?r.push(t):r.push(`${t}=${n}`));let i=`${t.requestPath}?${r.join(`&`)}`;return`import block${n} from ${JSON.stringify(i)};\nif (typeof block${n} === 'function') block${n}(_sfc_main);`}).join(`
22
22
  `);n=n.replace(/^export default _sfc_main;/m,`${r}\nexport default _sfc_main;`)}return e.templateAssetUrls.length>0&&(n=e.templateAssetUrls.map(({url:e,varName:t})=>{let n=e.startsWith(`~`)?e.slice(1):e,r=n.indexOf(`#`);return r>=0&&(n=n.slice(0,r)),`import ${t} from ${JSON.stringify(n)};`}).join(`
23
23
  `)+`
24
- `+n),n}const{compileSfc:v}=c,y=new Map;function b(e){return d(`sha256`).update(e).digest(`hex`).slice(0,16)}function x(){y.clear()}function S(e,n,a={}){let o=a.compilerOptions?.isTs??/<script[^>]*\blang=["']ts["']/.test(n),c=a.ssr??a.compilerOptions?.ssr??!1,l=a.vapor??a.compilerOptions?.vapor??!1,u=a.sourceMap??a.compilerOptions?.sourceMap??!0,d=a.isCustomElement??!1,f=a.rootContext??``,p=a.isProduction??!1,m=a.transformAssetUrls??!0,h=`${e}:ssr=${c}:vapor=${l}:ts=${o}:map=${u}:ce=${d}:root=${f}:prod=${p}:${m===!1?`tau=false`:m===!0?`tau=true`:`tau=${JSON.stringify(m)}`}`,g=b(n),_=y.get(h);if(_&&_.contentHash===g)return _.result;let x=i(e,a.rootContext,a.isProduction,n),S=v(n,{...a.compilerOptions,filename:e,sourceMap:a.sourceMap??a.compilerOptions?.sourceMap??!0,ssr:c,vapor:l,isTs:o,scopeId:`data-v-${x}`}),C=r(n,m),w={code:S.code,css:S.css,errors:S.errors,warnings:S.warnings,scopeId:x,hasScoped:S.hasScoped,styles:S.styles.map(t),customBlocks:S.customBlocks.map(s),isCustomElement:d,templateAssetUrls:C,macroArtifacts:S.macroArtifacts??[]};return w.errors.length===0&&y.set(h,{contentHash:g,result:w}),w}const C=/\.ce\.vue$/;function w(e){let t=this.async(),r=this.getOptions(),i=this.resourcePath,s=this.resourceQuery,c=O(this,i),d=this.mode===`production`||process.env.NODE_ENV===`production`,f=!(r.ssr??!1)&&!d&&r.hotReload!==!1,p=E(this,r);if(this.addDependency(i),s?.includes(`type=style`)){t(Error(`[vize] Main loader received style sub-request: ${i}${s}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(s&&s.includes(`vue`)&&s.includes(`type=`)&&!s.includes(`type=style`)){let n=new URLSearchParams(s.slice(1)),r=n.get(`type`);if(r&&r!==`style`){let o=parseInt(n.get(`index`)||`0`,10),s=a(e)[o];if(s){if(s.src){let e=u.resolve(u.dirname(i),s.src);this.addDependency(e);try{t(null,l.readFileSync(e,`utf-8`))}catch{t(Error(`[vize] Custom block <${r} src="${s.src}"> not found (resolved: ${e}) in ${i}`))}return}t(null,s.content)}else t(null,``);return}}if(!T(i,r)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${i}. Passing through source unchanged.`)),t(null,e);return}try{let a=D(i,r.customElement),s=n(e),m=e;if(s.scriptSrc){let e=u.resolve(u.dirname(i),s.scriptSrc);this.addDependency(e);try{let t=l.readFileSync(e,`utf-8`);m=o(m,t,null)}catch{t(Error(`[vize] <script src="${s.scriptSrc}"> not found (resolved: ${e}) in ${i}`));return}}if(s.templateSrc){let e=u.resolve(u.dirname(i),s.templateSrc);this.addDependency(e);try{let t=l.readFileSync(e,`utf-8`);m=o(m,null,t)}catch{t(Error(`[vize] <template src="${s.templateSrc}"> not found (resolved: ${e}) in ${i}`));return}}let h=S(i,m,{sourceMap:r.sourceMap??this.sourceMap??!0,ssr:r.ssr??!1,vapor:r.vapor??!1,compilerOptions:r.compilerOptions,isCustomElement:a,rootContext:this.rootContext,isProduction:d,transformAssetUrls:r.transformAssetUrls});for(let e of h.warnings)this.emitWarning(Error(`[vize] ${e}`));if(h.errors.length>0){for(let e of h.errors)this.emitError(Error(`[vize] ${e}`));let e=h.errors.join(`\\n`);t(Error(`[vize] Compilation failed for ${i}:\n${e}`));return}t(null,_(h,{requestPath:c,hmr:f,filePath:i,isProduction:d,rootContext:this.rootContext,nativeCss:p}))}catch(e){t(e)}}function T(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function E(e,t){let n=e._compiler;return m(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function D(e,t){return t===!0?!0:t===!1||t===void 0?C.test(e):t.test(e)}function O(e,t){return`./${u.basename(t)}`}export{h as a,_ as i,x as n,f as o,S as r,m as s,w as t};
24
+ `+n),n}const{compileSfc:v}=c,y=new Map;function b(e){return d(`sha256`).update(e).digest(`hex`).slice(0,16)}function x(){y.clear()}function S(e,n,a={}){let o=a.compilerOptions?.isTs??/<script[^>]*\blang=["']ts["']/.test(n),c=a.ssr??a.compilerOptions?.ssr??!1,l=a.vapor??a.compilerOptions?.vapor??!1,u=a.sourceMap??a.compilerOptions?.sourceMap??!0,d=a.isCustomElement??!1,f=a.rootContext??``,p=a.isProduction??!1,m=a.transformAssetUrls??!0,h=`${e}:ssr=${c}:vapor=${l}:ts=${o}:map=${u}:ce=${d}:syntax=${a.compilerOptions?.templateSyntax??`standard`}:root=${f}:prod=${p}:${m===!1?`tau=false`:m===!0?`tau=true`:`tau=${JSON.stringify(m)}`}`,g=b(n),_=y.get(h);if(_&&_.contentHash===g)return _.result;let x=i(e,a.rootContext,a.isProduction,n),S=v(n,{...a.compilerOptions,filename:e,sourceMap:a.sourceMap??a.compilerOptions?.sourceMap??!0,ssr:c,vapor:l,isTs:o,scopeId:`data-v-${x}`}),C=r(n,m),w={code:S.code,css:S.css,errors:S.errors,warnings:S.warnings,scopeId:x,hasScoped:S.hasScoped,styles:S.styles.map(t),customBlocks:S.customBlocks.map(s),isCustomElement:d,templateAssetUrls:C,macroArtifacts:S.macroArtifacts??[]};return w.errors.length===0&&y.set(h,{contentHash:g,result:w}),w}const C=/\.ce\.vue$/;function w(e){let t=this.async(),r=this.getOptions(),i=this.resourcePath,s=this.resourceQuery,c=O(this,i),d=this.mode===`production`||process.env.NODE_ENV===`production`,f=!(r.ssr??!1)&&!d&&r.hotReload!==!1,p=E(this,r);if(this.addDependency(i),s?.includes(`type=style`)){t(Error(`[vize] Main loader received style sub-request: ${i}${s}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(s&&s.includes(`vue`)&&s.includes(`type=`)&&!s.includes(`type=style`)){let n=new URLSearchParams(s.slice(1)),r=n.get(`type`);if(r&&r!==`style`){let o=parseInt(n.get(`index`)||`0`,10),s=a(e)[o];if(s){if(s.src){let e=u.resolve(u.dirname(i),s.src);this.addDependency(e);try{t(null,l.readFileSync(e,`utf-8`))}catch{t(Error(`[vize] Custom block <${r} src="${s.src}"> not found (resolved: ${e}) in ${i}`))}return}t(null,s.content)}else t(null,``);return}}if(!T(i,r)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${i}. Passing through source unchanged.`)),t(null,e);return}try{let a=D(i,r.customElement),s=n(e),m=e;if(s.scriptSrc){let e=u.resolve(u.dirname(i),s.scriptSrc);this.addDependency(e);try{let t=l.readFileSync(e,`utf-8`);m=o(m,t,null)}catch{t(Error(`[vize] <script src="${s.scriptSrc}"> not found (resolved: ${e}) in ${i}`));return}}if(s.templateSrc){let e=u.resolve(u.dirname(i),s.templateSrc);this.addDependency(e);try{let t=l.readFileSync(e,`utf-8`);m=o(m,null,t)}catch{t(Error(`[vize] <template src="${s.templateSrc}"> not found (resolved: ${e}) in ${i}`));return}}let h=S(i,m,{sourceMap:r.sourceMap??this.sourceMap??!0,ssr:r.ssr??!1,vapor:r.vapor??!1,compilerOptions:r.compilerOptions,isCustomElement:a,rootContext:this.rootContext,isProduction:d,transformAssetUrls:r.transformAssetUrls});for(let e of h.warnings)this.emitWarning(Error(`[vize] ${e}`));if(h.errors.length>0){for(let e of h.errors)this.emitError(Error(`[vize] ${e}`));let e=h.errors.join(`\\n`);t(Error(`[vize] Compilation failed for ${i}:\n${e}`));return}t(null,_(h,{requestPath:c,hmr:f,filePath:i,isProduction:d,rootContext:this.rootContext,nativeCss:p}))}catch(e){t(e)}}function T(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function E(e,t){let n=e._compiler;return m(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function D(e,t){return t===!0?!0:t===!1||t===void 0?C.test(e):t.test(e)}function O(e,t){return`./${u.basename(t)}`}export{h as a,_ as i,x as n,f as o,S as r,m as s,w as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/rspack-plugin",
3
- "version": "0.178.0",
3
+ "version": "0.180.0",
4
4
  "description": "High-performance Rspack plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -54,7 +54,7 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@vizejs/native": "0.178.0"
57
+ "@vizejs/native": "0.180.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@rspack/core": "2.0.3",