@vizejs/rspack-plugin 0.315.1 → 0.321.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.
@@ -37,6 +37,6 @@ const __vize_css_id__ = ${JSON.stringify(`vize-style-${n}`)};
37
37
  }
38
38
  }
39
39
  })();
40
- ${e}`}function k(e,t,n={}){let r=E(t,{filename:e,lang:e.endsWith(`.tsx`)?`tsx`:`jsx`,jsxMode:n.jsxMode,vapor:n.vapor??!1,sourceMap:n.sourceMap??!1});if(r.errors.length>0)throw Error(`[vize] Compilation failed for ${e}:\n${r.errors.join(`
40
+ ${e}`}function k(e,t,n={}){let r=E(t,{filename:e,lang:e.endsWith(`.tsx`)?`tsx`:`jsx`,jsxMode:n.jsxMode,jsxCompat:n.jsxCompat,vapor:n.vapor??!1,sourceMap:n.sourceMap??!1});if(r.errors.length>0)throw Error(`[vize] Compilation failed for ${e}:\n${r.errors.join(`
41
41
  `)}`);let i=(r.scopedStyles??[]).map(e=>e.css).join(`
42
42
  `),a=r.code,o=r.map??null;if(i){let e=r.scopedStyles[0].scopeId.replace(/^data-v-/,``);a=O(a,i,e),o=null}return{code:a,map:o,warnings:r.warnings}}const A=new Map;function j(e){return s(`sha256`).update(e).digest(`hex`).slice(0,16)}function M(){A.clear()}function N(i,a,o={}){let s=o.compilerOptions?.isTs??/<script[^>]*\blang=["']ts["']/.test(a),c=o.ssr??o.compilerOptions?.ssr??!1,l=o.vapor??o.compilerOptions?.vapor??!1,u=o.sourceMap??o.compilerOptions?.sourceMap??!0,d=o.isCustomElement??!1,f=o.rootContext??``,p=o.isProduction??!1,m=o.transformAssetUrls??!0,h=`${i}:ssr=${c}:vapor=${l}:ts=${s}:map=${u}:ce=${d}:syntax=${o.compilerOptions?.templateSyntax??`standard`}:xic=${o.compilerOptions?.experimentalInTagComments??!1}:xpt=${o.compilerOptions?.experimentalPatternedTemplate??!1}:xss=${o.compilerOptions?.experimentalServerScript??!1}:root=${f}:prod=${p}:${m===!1?`tau=false`:m===!0?`tau=true`:`tau=${JSON.stringify(m)}`}`,g=j(a),_=A.get(h);if(_&&_.contentHash===g)return _.result;let v=n(i,o.rootContext,o.isProduction,a),y=T(a,{...o.compilerOptions,filename:i,sourceMap:o.sourceMap??o.compilerOptions?.sourceMap??!0,ssr:c,vapor:l,isTs:s,scopeId:`data-v-${v}`}),b=t(a,m),x={code:y.code,css:y.css,errors:y.errors,warnings:y.warnings,scopeId:v,hasScoped:y.hasScoped,styles:y.styles.map(e),customBlocks:y.customBlocks.map(r),isCustomElement:d,templateAssetUrls:b,macroArtifacts:y.macroArtifacts??[]};return x.errors.length===0&&A.set(h,{contentHash:g,result:x}),x}export{w as a,D as i,N as n,l as o,k as r,M as t};
@@ -68,6 +68,8 @@ interface JsxCompileOptionsNapi {
68
68
  * wins over `vapor`. Per-component `"use vue:*"` directives still override it.
69
69
  */
70
70
  jsxMode?: "vdom" | "vapor";
71
+ /** JSX semantics; `"babel"` opts into @vue/babel-plugin-jsx compatibility. */
72
+ jsxCompat?: "native" | "babel";
71
73
  /** Legacy default-mode toggle: `true` → Vapor, `false` (default) → VDOM. */
72
74
  vapor?: boolean;
73
75
  /** Emit a v3 source map for the generated render code (#1533). */
@@ -181,6 +183,8 @@ interface VizeLoaderOptions {
181
183
  vapor?: boolean;
182
184
  /** Default JSX output mode for `.jsx`/`.tsx` without a `"use vue:*"` directive. @default "vdom" */
183
185
  jsxMode?: "vdom" | "vapor";
186
+ /** JSX semantics; `"babel"` opts into @vue/babel-plugin-jsx compatibility. */
187
+ jsxCompat?: "native" | "babel";
184
188
  /** HMR. false to disable in dev. @default true (dev), false (prod/SSR) */
185
189
  hotReload?: boolean;
186
190
  /** CSS handling config */
@@ -212,6 +216,8 @@ interface VizeRspackPluginOptions {
212
216
  vapor?: boolean;
213
217
  /** Default JSX output mode for `.jsx`/`.tsx` without a `"use vue:*"` directive. @default "vdom" */
214
218
  jsxMode?: "vdom" | "vapor";
219
+ /** JSX semantics; `"babel"` opts into @vue/babel-plugin-jsx compatibility. */
220
+ jsxCompat?: "native" | "babel";
215
221
  /** Root directory @default Rspack's root */
216
222
  root?: string;
217
223
  /** CSS config */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as LoaderEntry, c as SfcCompileResultNapi, d as VizeLoaderOptions, f as VizeRspackPluginOptions, i as JsxCompileResultNapi, l as SfcSrcInfo, n as CustomBlockInfo, o as MacroArtifact, p as VizeStyleLoaderOptions, r as JsxCompileOptionsNapi, s as SfcCompileOptionsNapi, t as CompiledModule, u as StyleBlockInfo } from "./index-sdINSvBH.mjs";
1
+ import { a as LoaderEntry, c as SfcCompileResultNapi, d as VizeLoaderOptions, f as VizeRspackPluginOptions, i as JsxCompileResultNapi, l as SfcSrcInfo, n as CustomBlockInfo, o as MacroArtifact, p as VizeStyleLoaderOptions, r as JsxCompileOptionsNapi, s as SfcCompileOptionsNapi, t as CompiledModule, u as StyleBlockInfo } from "./index-isuGyiMB.mjs";
2
2
  import vizeLoader from "./loader/index.mjs";
3
3
  import vizeJsxLoader from "./loader/jsx-loader.mjs";
4
4
  import vizeStyleLoader from "./loader/style-loader.mjs";
@@ -72,6 +72,7 @@ declare function isJsxFile(filePath: string): boolean;
72
72
  */
73
73
  declare function compileJsxModule(filePath: string, source: string, options?: {
74
74
  jsxMode?: "vdom" | "vapor";
75
+ jsxCompat?: "native" | "babel";
75
76
  vapor?: boolean;
76
77
  sourceMap?: boolean;
77
78
  }): {
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{n as s,r as c,t as l}from"./loader-CHpYOm39.mjs";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./compiler-C710IOIZ.mjs";import g from"./loader/jsx-loader.mjs";import _ from"./loader/style-loader.mjs";import v from"./loader/scope-loader.mjs";const y=`@vizejs/rspack-plugin/style-loader`,b=`@vizejs/rspack-plugin/scope-loader`,x={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function S(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&C(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=E(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...D(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...O(t));let s={use:k(M(i),t)},c=[...o,s];e[r]={test:i.test,oneOf:c};for(let e of a)A(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function C(e){return T(e.test)?M(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?w(t):!1}):!1}function w(e){let t=e.replaceAll(`\\`,`/`);return e===`@vizejs/rspack-plugin/loader`||(t.includes(`@vizejs/rspack-plugin`)||t.includes(`rspack-vize-plugin`))&&/\/dist\/loader\/index\.[cm]?js$/.test(t)}function T(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function E(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(x))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 D(e,t,n){let r=M(e);if(r.length===0)return[];let i=[{loader:b},...N(r),{loader:y}],a=(t,n)=>{let r={resourceQuery:t,use:N(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 O(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:b},{loader:y}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:b},{loader:y}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:b},{loader:y}]}]}function k(e,t){return N(e).map(e=>{if(typeof e==`string`)return w(e)?{loader:e,options:{css:{native:t}}}:e;if(typeof e!=`object`||!e)return e;let n=e.loader;if(!n||!w(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 A(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 j(e){return e?Array.isArray(e)?e:[e]:[]}function M(e){let t=j(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 N(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 P=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=s(t.options),a=t.webpack?.rspackVersion,o=c(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=S(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:l}=t.webpack,u=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))u.add(e)}let d={};u.has(`__VUE_OPTIONS_API__`)||(d.__VUE_OPTIONS_API__=JSON.stringify(!0)),u.has(`__VUE_PROD_DEVTOOLS__`)||(d.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),u.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(d.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(d).length>0&&new l(d).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{P as VizePlugin,o as addScopeToCssFallback,S as applyRuleCloning,h as clearCompilationCache,f as compileFile,m as compileJsxModule,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,p as genHotReloadCode,u as generateOutput,r as generateScopeId,a as inlineSrcBlocks,d as isJsxFile,t as matchesPattern,g as vizeJsxLoader,l as vizeLoader,v as vizeScopeLoader,_ 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{n as s,r as c,t as l}from"./loader-rRk-_Mm5.mjs";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./compiler-CPszz8pX.mjs";import g from"./loader/jsx-loader.mjs";import _ from"./loader/style-loader.mjs";import v from"./loader/scope-loader.mjs";const y=`@vizejs/rspack-plugin/style-loader`,b=`@vizejs/rspack-plugin/scope-loader`,x={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function S(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&C(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=E(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...D(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...O(t));let s={use:k(M(i),t)},c=[...o,s];e[r]={test:i.test,oneOf:c};for(let e of a)A(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function C(e){return T(e.test)?M(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?w(t):!1}):!1}function w(e){let t=e.replaceAll(`\\`,`/`);return e===`@vizejs/rspack-plugin/loader`||(t.includes(`@vizejs/rspack-plugin`)||t.includes(`rspack-vize-plugin`))&&/\/dist\/loader\/index\.[cm]?js$/.test(t)}function T(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function E(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(x))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 D(e,t,n){let r=M(e);if(r.length===0)return[];let i=[{loader:b},...N(r),{loader:y}],a=(t,n)=>{let r={resourceQuery:t,use:N(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 O(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:b},{loader:y}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:b},{loader:y}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:b},{loader:y}]}]}function k(e,t){return N(e).map(e=>{if(typeof e==`string`)return w(e)?{loader:e,options:{css:{native:t}}}:e;if(typeof e!=`object`||!e)return e;let n=e.loader;if(!n||!w(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 A(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 j(e){return e?Array.isArray(e)?e:[e]:[]}function M(e){let t=j(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 N(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 P=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=s(t.options),a=t.webpack?.rspackVersion,o=c(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=S(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:l}=t.webpack,u=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))u.add(e)}let d={};u.has(`__VUE_OPTIONS_API__`)||(d.__VUE_OPTIONS_API__=JSON.stringify(!0)),u.has(`__VUE_PROD_DEVTOOLS__`)||(d.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),u.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(d.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(d).length>0&&new l(d).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{P as VizePlugin,o as addScopeToCssFallback,S as applyRuleCloning,h as clearCompilationCache,f as compileFile,m as compileJsxModule,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,p as genHotReloadCode,u as generateOutput,r as generateScopeId,a as inlineSrcBlocks,d as isJsxFile,t as matchesPattern,g as vizeJsxLoader,l as vizeLoader,v as vizeScopeLoader,_ as vizeStyleLoader};
@@ -1,4 +1,4 @@
1
- import { d as VizeLoaderOptions } from "../index-sdINSvBH.mjs";
1
+ import { d as VizeLoaderOptions } from "../index-isuGyiMB.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-CHpYOm39.mjs";export{e as default};
1
+ import{t as e}from"../loader-rRk-_Mm5.mjs";export{e as default};
@@ -1,4 +1,4 @@
1
- import { d as VizeLoaderOptions } from "../index-sdINSvBH.mjs";
1
+ import { d as VizeLoaderOptions } from "../index-isuGyiMB.mjs";
2
2
  import { LoaderContext } from "@rspack/core";
3
3
 
4
4
  //#region src/loader/jsx-loader.d.ts
@@ -1 +1 @@
1
- import{c as e}from"../utils-CFK8mca_.mjs";import{r as t}from"../compiler-C710IOIZ.mjs";function n(e){let n=this.async(),i=this.getOptions(),a=this.resourcePath;if(this.addDependency(a),!r(a,i)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${a}. Passing through source unchanged.`)),n(null,e);return}try{let r=i.sourceMap??this.sourceMap??!0,{code:o,map:s,warnings:c}=t(a,e,{jsxMode:i.jsxMode,vapor:i.vapor??!1,sourceMap:r});for(let e of c)this.emitWarning(Error(`[vize] ${e}`));n(null,o,s?JSON.parse(s):void 0)}catch(e){n(e)}}function r(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}export{n as default};
1
+ import{c as e}from"../utils-CFK8mca_.mjs";import{r as t}from"../compiler-CPszz8pX.mjs";function n(e){let n=this.async(),i=this.getOptions(),a=this.resourcePath;if(this.addDependency(a),!r(a,i)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${a}. Passing through source unchanged.`)),n(null,e);return}try{let r=i.sourceMap??this.sourceMap??!0,{code:o,map:s,warnings:c}=t(a,e,{jsxMode:i.jsxMode,jsxCompat:i.jsxCompat,vapor:i.vapor??!1,sourceMap:r});for(let e of c)this.emitWarning(Error(`[vize] ${e}`));n(null,o,s?JSON.parse(s):void 0)}catch(e){n(e)}}function r(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}export{n as default};
@@ -1,4 +1,4 @@
1
- import { p as VizeStyleLoaderOptions } from "../index-sdINSvBH.mjs";
1
+ import { p as VizeStyleLoaderOptions } from "../index-isuGyiMB.mjs";
2
2
  import { LoaderContext } from "@rspack/core";
3
3
 
4
4
  //#region src/loader/style-loader.d.ts
@@ -1 +1 @@
1
- import{c as e,i as t,r as n,s as r}from"./utils-CFK8mca_.mjs";import{a as i,n as a}from"./compiler-C710IOIZ.mjs";import o from"node:fs";import s from"node:path";function c(e){let t=e?.experiments;return!t||typeof t!=`object`||!Object.prototype.hasOwnProperty.call(t,`css`)?`unavailable`:t.css?`enabled`:`disabled`}function l(e){if(typeof e!=`string`)return null;let t=Number.parseInt(e,10);return Number.isNaN(t)?null:t}function u(e,t,n){if(e!=null)return e;let r=c(t);if(r!==`unavailable`)return r===`enabled`;let i=l(n);return i!=null&&i>=2}const d=/\.ce\.vue$/;function f(e){let c=this.async(),l=this.getOptions(),u=this.resourcePath,d=this.resourceQuery,f=g(this,u),_=this.mode===`production`||process.env.NODE_ENV===`production`,v=!(l.ssr??!1)&&!_&&l.hotReload!==!1,y=m(this,l);if(this.addDependency(u),d?.includes(`type=style`)){c(Error(`[vize] Main loader received style sub-request: ${u}${d}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(d&&d.includes(`vue`)&&d.includes(`type=`)&&!d.includes(`type=style`)){let t=new URLSearchParams(d.slice(1)),r=t.get(`type`);if(r&&r!==`style`){let i=parseInt(t.get(`index`)||`0`,10),a=n(e)[i];if(a){if(a.src){let e=s.resolve(s.dirname(u),a.src);this.addDependency(e);try{c(null,o.readFileSync(e,`utf-8`))}catch{c(Error(`[vize] Custom block <${r} src="${a.src}"> not found (resolved: ${e}) in ${u}`))}return}c(null,a.content)}else c(null,``);return}}if(!p(u,l)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${u}. Passing through source unchanged.`)),c(null,e);return}try{let n=h(u,l.customElement),d=t(e),p=e;if(d.scriptSrc){let e=s.resolve(s.dirname(u),d.scriptSrc);this.addDependency(e);try{let t=o.readFileSync(e,`utf-8`);p=r(p,t,null)}catch{c(Error(`[vize] <script src="${d.scriptSrc}"> not found (resolved: ${e}) in ${u}`));return}}if(d.templateSrc){let e=s.resolve(s.dirname(u),d.templateSrc);this.addDependency(e);try{let t=o.readFileSync(e,`utf-8`);p=r(p,null,t)}catch{c(Error(`[vize] <template src="${d.templateSrc}"> not found (resolved: ${e}) in ${u}`));return}}let m=a(u,p,{sourceMap:l.sourceMap??this.sourceMap??!0,ssr:l.ssr??!1,vapor:l.vapor??!1,compilerOptions:l.compilerOptions,isCustomElement:n,rootContext:this.rootContext,isProduction:_,transformAssetUrls:l.transformAssetUrls});for(let e of m.warnings)this.emitWarning(Error(`[vize] ${e}`));if(m.errors.length>0){for(let e of m.errors)this.emitError(Error(`[vize] ${e}`));let e=m.errors.join(`\\n`);c(Error(`[vize] Compilation failed for ${u}:\n${e}`));return}c(null,i(m,{requestPath:f,hmr:v,filePath:u,isProduction:_,rootContext:this.rootContext,nativeCss:y}))}catch(e){c(e)}}function p(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function m(e,t){let n=e._compiler;return u(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function h(e,t){return t===!0?!0:t===!1||t===void 0?d.test(e):t.test(e)}function g(e,t){return`./${s.basename(t)}`}export{c as n,u as r,f as t};
1
+ import{c as e,i as t,r as n,s as r}from"./utils-CFK8mca_.mjs";import{a as i,n as a}from"./compiler-CPszz8pX.mjs";import o from"node:fs";import s from"node:path";function c(e){let t=e?.experiments;return!t||typeof t!=`object`||!Object.prototype.hasOwnProperty.call(t,`css`)?`unavailable`:t.css?`enabled`:`disabled`}function l(e){if(typeof e!=`string`)return null;let t=Number.parseInt(e,10);return Number.isNaN(t)?null:t}function u(e,t,n){if(e!=null)return e;let r=c(t);if(r!==`unavailable`)return r===`enabled`;let i=l(n);return i!=null&&i>=2}const d=/\.ce\.vue$/;function f(e){let c=this.async(),l=this.getOptions(),u=this.resourcePath,d=this.resourceQuery,f=g(this,u),_=this.mode===`production`||process.env.NODE_ENV===`production`,v=!(l.ssr??!1)&&!_&&l.hotReload!==!1,y=m(this,l);if(this.addDependency(u),d?.includes(`type=style`)){c(Error(`[vize] Main loader received style sub-request: ${u}${d}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(d&&d.includes(`vue`)&&d.includes(`type=`)&&!d.includes(`type=style`)){let t=new URLSearchParams(d.slice(1)),r=t.get(`type`);if(r&&r!==`style`){let i=parseInt(t.get(`index`)||`0`,10),a=n(e)[i];if(a){if(a.src){let e=s.resolve(s.dirname(u),a.src);this.addDependency(e);try{c(null,o.readFileSync(e,`utf-8`))}catch{c(Error(`[vize] Custom block <${r} src="${a.src}"> not found (resolved: ${e}) in ${u}`))}return}c(null,a.content)}else c(null,``);return}}if(!p(u,l)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${u}. Passing through source unchanged.`)),c(null,e);return}try{let n=h(u,l.customElement),d=t(e),p=e;if(d.scriptSrc){let e=s.resolve(s.dirname(u),d.scriptSrc);this.addDependency(e);try{let t=o.readFileSync(e,`utf-8`);p=r(p,t,null)}catch{c(Error(`[vize] <script src="${d.scriptSrc}"> not found (resolved: ${e}) in ${u}`));return}}if(d.templateSrc){let e=s.resolve(s.dirname(u),d.templateSrc);this.addDependency(e);try{let t=o.readFileSync(e,`utf-8`);p=r(p,null,t)}catch{c(Error(`[vize] <template src="${d.templateSrc}"> not found (resolved: ${e}) in ${u}`));return}}let m=a(u,p,{sourceMap:l.sourceMap??this.sourceMap??!0,ssr:l.ssr??!1,vapor:l.vapor??!1,compilerOptions:l.compilerOptions,isCustomElement:n,rootContext:this.rootContext,isProduction:_,transformAssetUrls:l.transformAssetUrls});for(let e of m.warnings)this.emitWarning(Error(`[vize] ${e}`));if(m.errors.length>0){for(let e of m.errors)this.emitError(Error(`[vize] ${e}`));let e=m.errors.join(`\\n`);c(Error(`[vize] Compilation failed for ${u}:\n${e}`));return}c(null,i(m,{requestPath:f,hmr:v,filePath:u,isProduction:_,rootContext:this.rootContext,nativeCss:y}))}catch(e){c(e)}}function p(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function m(e,t){let n=e._compiler;return u(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function h(e,t){return t===!0?!0:t===!1||t===void 0?d.test(e):t.test(e)}function g(e,t){return`./${s.basename(t)}`}export{c as n,u as r,f as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/rspack-plugin",
3
- "version": "0.315.1",
3
+ "version": "0.321.0",
4
4
  "description": "High-performance Rspack plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -59,7 +59,7 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@vizejs/native": "0.315.1",
62
+ "@vizejs/native": "0.321.0",
63
63
  "oxc-parser": "0.133.0"
64
64
  },
65
65
  "devDependencies": {