@vizejs/rspack-plugin 0.428.1 → 0.429.1

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.
@@ -1,11 +1,14 @@
1
- import{d as e,f as t,m as n,n as r,o as i,u as a}from"./utils-ByWFOFCe.mjs";import*as o from"@vizejs/native";import{rewriteSfcTemplateAssetReferences as s}from"@vizejs/native";import c from"node:path";import{createHash as l}from"node:crypto";import{parseSync as u}from"oxc-parser";import{transformSync as d}from"oxc-transform";function f(e,t){return`{
1
+ import{d as e,f as t,m as n,n as r,o as i,u as a}from"./utils-ByWFOFCe.mjs";import*as o from"@vizejs/native";import{rewriteSfcTemplateAssetReferences as s}from"@vizejs/native";import c from"node:path";import{createHash as l}from"node:crypto";import{parseSync as u}from"oxc-parser";import{transformSync as d}from"oxc-transform";function f(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===3&&Array.isArray(t.sources)&&Array.isArray(t.names)&&typeof t.mappings==`string`}function p(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return f(t)?t:null}function m(e){let t=0;for(let n=e.indexOf(`
2
+ `);n!==-1;n=e.indexOf(`
3
+ `,n+1))t++;return t}function h(e,t,n){if(n<=0)return e;let r=e.mappings.split(`;`);if(t>=r.length)return e;let i=[...r.slice(0,t),...Array(n).fill(``),...r.slice(t)];return{...e,mappings:i.join(`;`)}}function g(e,t,n){let r=n+e;if(!n)return{code:r,map:t??null};let i=p(t);return!i||!n.endsWith(`
4
+ `)?{code:r,map:null}:{code:r,map:JSON.stringify(h(i,0,m(n)))}}function _(e,t){return`{
2
5
  const current = ${e}
3
6
  const next = ${t}
4
7
  Object.keys(current).forEach(key => {
5
8
  if (!Object.prototype.hasOwnProperty.call(next, key)) delete current[key]
6
9
  })
7
10
  Object.assign(current, next)
8
- }`}function p(e,t,n=`null`){return`
11
+ }`}function v(e,t,n=`null`){return`
9
12
  /* hot reload */
10
13
  if (module.hot) {
11
14
  _sfc_main.__hmrId = "${e}"
@@ -45,7 +48,7 @@ if (module.hot) {
45
48
  before.template !== after.template && typeof _sfc_main.render === 'function'))) {
46
49
  // Retain both the module table and each mapping captured by setup.
47
50
  if (previous.component.__cssModules && _sfc_main.__cssModules) {
48
- Object.keys(_sfc_main.__cssModules).forEach(name => ${f(`previous.component.__cssModules[name]`,`_sfc_main.__cssModules[name]`)})
51
+ Object.keys(_sfc_main.__cssModules).forEach(name => ${_(`previous.component.__cssModules[name]`,`_sfc_main.__cssModules[name]`)})
49
52
  _sfc_main.__cssModules = previous.component.__cssModules
50
53
  }
51
54
  if (before.module !== after.module || _sfc_main.__cssModules) {
@@ -55,19 +58,19 @@ if (module.hot) {
55
58
  api.reload('${e}', _sfc_main)
56
59
  }
57
60
  }
58
- }`}function m(e,t,n,r){return`
61
+ }`}function y(e,t,n,r){return`
59
62
  if (module.hot) {
60
63
  module.hot.accept(${t}, () => {
61
- ${f(`_sfc_main.__cssModules[${JSON.stringify(r)}]`,n)}
64
+ ${_(`_sfc_main.__cssModules[${JSON.stringify(r)}]`,n)}
62
65
  __VUE_HMR_RUNTIME__.rerender("${e}", _sfc_main.render)
63
66
  })
64
- }`}const h=`vize-rspack-output.tsx`,g=`_sfc_main`;function _(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function v(e){return typeof e?.start==`number`?e.start:null}function y(e){return _(e)&&typeof e.name==`string`?e.name:null}function b(e){try{let t=u(h,e);if(typeof t==`object`&&t){let e=t.errors;if(Array.isArray(e)&&e.length>0)return null;let n=t.program;if(_(n))return n}return _(t)?t:null}catch{return null}}function x(e){return!e||!Array.isArray(e.body)?[]:e.body.filter(_)}function S(e,t){return y(e)===t}function C(e){return(Array.isArray(e.declarations)?e.declarations:[]).filter(_).map(e=>_(e.id)?y(e.id):null).filter(e=>e!=null)}function w(e){return x(e).find(e=>e.type===`ExportDefaultDeclaration`)??null}function T(e,t){let n=v(t);if(n==null)return null;let r=/^export\s+default\b/.exec(e.slice(n));return r?n+r[0].length:null}function E(e){let t=b(e),n=x(t);return{hasDefaultExport:w(t)!=null,hasSfcMainDefined:n.some(e=>e.type===`VariableDeclaration`&&C(e).includes(g))}}function D(e){let t=d(h,e,{target:`esnext`,jsx:`preserve`});if(t.errors.length)return null;let n=b(t.code);if(!n)return null;let r=[];for(let e of x(n)){if(e.type!==`ImportDeclaration`)continue;let t=_(e.source)?e.source.value:null;if(typeof t!=`string`)return null;if(t===`vue`||t.includes(`?vue&type=style&`))continue;let n=Array.isArray(e.specifiers)?e.specifiers.filter(_):[];if(n.length===0)return null;for(let e of n){let n=_(e.local)?y(e.local):null;if(!n)return null;let i=JSON.stringify(`${t}:${n}`);r.push(e.type===`ImportNamespaceSpecifier`?`...Object.keys(${n}).sort().map(key => [${i} + ':' + key, ${n}[key]])`:`[${i}, ${n}]`)}}return`[${r.join(`, `)}]`}function O(e){let t=e.code,n=w(b(t)),r=v(n),i=n?T(t,n):null;r==null||i==null||e.replace(r,i,`const ${g} =`)}function k(e,t,n={}){let r=e.code,i=w(b(r)),a=_(i?.declaration)?i.declaration:null,o=v(i),s=typeof i?.end==`number`?i.end:null;!S(a,g)||o==null||(n.normalizeSemicolon&&s!=null&&r[s-1]!==`;`&&r[s]!==`;`&&e.replace(s,s,`;`),e.replace(o,o,`${t}\n`))}function A(e,t){return j(e,t).code}function j(e,r){let i=new t(e.code,n(e.map)),a=e.isCustomElement;e.templateAssetUrls.length>0&&i.edit(s(i.code,e.templateAssetUrls));let o=E(i.code),u=o.hasDefaultExport,d=o.hasSfcMainDefined;if(u&&!d?(O(i),e.hasScoped&&e.scopeId&&i.append(`\n_sfc_main.__scopeId = "data-v-${e.scopeId}";`),i.append(`
65
- export default _sfc_main;`)):u&&d&&e.hasScoped&&e.scopeId&&k(i,`_sfc_main.__scopeId = "data-v-${e.scopeId}";`),e.styles.length>0){if(a&&e.styles.some(e=>e.module))throw Error(`[vize] <style module> is not supported in custom elements mode.`);let t=e.styles.filter(e=>e.module===!0).length;if(t>1)throw Error(`[vize] Found ${t} unnamed <style module> blocks. Only one unnamed <style module> is allowed per SFC. Use named modules instead: <style module="name">`);let n=e.styles.filter(e=>e.src||/\S/.test(e.content)),o=[],s=n.map(t=>{let n=[`vue`,`type=style`,`index=${t.index}`,`lang=${t.lang||`css`}`,...t.scoped?[`scoped=${e.scopeId}`]:[],...t.module?[`module=${typeof t.module==`string`?t.module:`true`}`]:[],...a?[`inline`]:[]],i=`${r.requestPath}?${n.join(`&`)}`;if(a)return`import _style_${t.index} from ${JSON.stringify(i)};`;if(t.module){let e=typeof t.module==`string`?t.module:`$style`,n=`_cssModule_${t.index}`;return o.push({request:i,varName:n,bindingName:e}),`import * as ${n} from ${JSON.stringify(i)};`}return`import ${JSON.stringify(i)};`}).join(`
66
- `);i.prepend(`${s}\n`),a&&k(i,`_sfc_main.styles = [${n.map(e=>`_style_${e.index}`).join(`,`)}];`,{normalizeSemicolon:!0}),!a&&o.length>0&&k(i,`${[r.nativeCss?``:`const __vize_resolve_css_module__ = (value) => value.default && typeof value.default === "object" ? value.default : value;`,...o.map(e=>`_sfc_main.__cssModules = _sfc_main.__cssModules || {};\n_sfc_main.__cssModules[${JSON.stringify(e.bindingName)}] = ${r.nativeCss?e.varName:`__vize_resolve_css_module__(${e.varName})`};`)].filter(Boolean).join(`
67
- `)}\n${r.hmr&&e.scopeId?o.map(t=>m(e.scopeId,JSON.stringify(t.request),r.nativeCss?t.varName:`__vize_resolve_css_module__(${t.varName})`,t.bindingName)).join(`
68
- `):``}`,{normalizeSemicolon:!0})}if(r.filePath&&!r.isProduction){let e=r.rootContext?c.relative(r.rootContext,r.filePath).replace(/\\/g,`/`):c.basename(r.filePath);k(i,`_sfc_main.__file = ${JSON.stringify(e)};`,{normalizeSemicolon:!0})}if(e.customBlocks.length>0&&k(i,e.customBlocks.map((e,t)=>{let n=[`vue`,`type=${e.type}`,`index=${t}`,...e.src?[`src=true`]:[]];for(let[t,r]of Object.entries(e.attrs))t!==`src`&&(r===!0?n.push(t):n.push(`${t}=${r}`));let i=`${r.requestPath}?${n.join(`&`)}`;return`import block${t} from ${JSON.stringify(i)};\nif (typeof block${t} === 'function') block${t}(_sfc_main);`}).join(`
67
+ }`}const b=`vize-rspack-output.tsx`,x=`_sfc_main`;function S(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function C(e){return typeof e?.start==`number`?e.start:null}function w(e){return S(e)&&typeof e.name==`string`?e.name:null}function T(e){try{let t=u(b,e);if(typeof t==`object`&&t){let e=t.errors;if(Array.isArray(e)&&e.length>0)return null;let n=t.program;if(S(n))return n}return S(t)?t:null}catch{return null}}function E(e){return!e||!Array.isArray(e.body)?[]:e.body.filter(S)}function D(e,t){return w(e)===t}function O(e){return(Array.isArray(e.declarations)?e.declarations:[]).filter(S).map(e=>S(e.id)?w(e.id):null).filter(e=>e!=null)}function k(e){return E(e).find(e=>e.type===`ExportDefaultDeclaration`)??null}function A(e,t){let n=C(t);if(n==null)return null;let r=/^export\s+default\b/.exec(e.slice(n));return r?n+r[0].length:null}function j(e){let t=T(e),n=E(t);return{hasDefaultExport:k(t)!=null,hasSfcMainDefined:n.some(e=>e.type===`VariableDeclaration`&&O(e).includes(x))}}function M(e){let t=d(b,e,{target:`esnext`,jsx:`preserve`});if(t.errors.length)return null;let n=T(t.code);if(!n)return null;let r=[];for(let e of E(n)){if(e.type!==`ImportDeclaration`)continue;let t=S(e.source)?e.source.value:null;if(typeof t!=`string`)return null;if(t===`vue`||t.includes(`?vue&type=style&`))continue;let n=Array.isArray(e.specifiers)?e.specifiers.filter(S):[];if(n.length===0)return null;for(let e of n){let n=S(e.local)?w(e.local):null;if(!n)return null;let i=JSON.stringify(`${t}:${n}`);r.push(e.type===`ImportNamespaceSpecifier`?`...Object.keys(${n}).sort().map(key => [${i} + ':' + key, ${n}[key]])`:`[${i}, ${n}]`)}}return`[${r.join(`, `)}]`}function N(e){let t=e.code,n=k(T(t)),r=C(n),i=n?A(t,n):null;r==null||i==null||e.replace(r,i,`const ${x} =`)}function P(e,t,n={}){let r=e.code,i=k(T(r)),a=S(i?.declaration)?i.declaration:null,o=C(i),s=typeof i?.end==`number`?i.end:null;!D(a,x)||o==null||(n.normalizeSemicolon&&s!=null&&r[s-1]!==`;`&&r[s]!==`;`&&e.replace(s,s,`;`),e.replace(o,o,`${t}\n`))}function F(e,t){return I(e,t).code}function I(e,r){let i=new t(e.code,n(e.map)),a=e.isCustomElement;e.templateAssetUrls.length>0&&i.edit(s(i.code,e.templateAssetUrls));let o=j(i.code),u=o.hasDefaultExport,d=o.hasSfcMainDefined;if(u&&!d?(N(i),e.hasScoped&&e.scopeId&&i.append(`\n_sfc_main.__scopeId = "data-v-${e.scopeId}";`),i.append(`
68
+ export default _sfc_main;`)):u&&d&&e.hasScoped&&e.scopeId&&P(i,`_sfc_main.__scopeId = "data-v-${e.scopeId}";`),e.styles.length>0){if(a&&e.styles.some(e=>e.module))throw Error(`[vize] <style module> is not supported in custom elements mode.`);let t=e.styles.filter(e=>e.module===!0).length;if(t>1)throw Error(`[vize] Found ${t} unnamed <style module> blocks. Only one unnamed <style module> is allowed per SFC. Use named modules instead: <style module="name">`);let n=e.styles.filter(e=>e.src||/\S/.test(e.content)),o=[],s=n.map(t=>{let n=[`vue`,`type=style`,`index=${t.index}`,`lang=${t.lang||`css`}`,...t.scoped?[`scoped=${e.scopeId}`]:[],...t.module?[`module=${typeof t.module==`string`?t.module:`true`}`]:[],...a?[`inline`]:[]],i=`${r.requestPath}?${n.join(`&`)}`;if(a)return`import _style_${t.index} from ${JSON.stringify(i)};`;if(t.module){let e=typeof t.module==`string`?t.module:`$style`,n=`_cssModule_${t.index}`;return o.push({request:i,varName:n,bindingName:e}),`import * as ${n} from ${JSON.stringify(i)};`}return`import ${JSON.stringify(i)};`}).join(`
69
+ `);i.prepend(`${s}\n`),a&&P(i,`_sfc_main.styles = [${n.map(e=>`_style_${e.index}`).join(`,`)}];`,{normalizeSemicolon:!0}),!a&&o.length>0&&P(i,`${[r.nativeCss?``:`const __vize_resolve_css_module__ = (value) => value.default && typeof value.default === "object" ? value.default : value;`,...o.map(e=>`_sfc_main.__cssModules = _sfc_main.__cssModules || {};\n_sfc_main.__cssModules[${JSON.stringify(e.bindingName)}] = ${r.nativeCss?e.varName:`__vize_resolve_css_module__(${e.varName})`};`)].filter(Boolean).join(`
70
+ `)}\n${r.hmr&&e.scopeId?o.map(t=>y(e.scopeId,JSON.stringify(t.request),r.nativeCss?t.varName:`__vize_resolve_css_module__(${t.varName})`,t.bindingName)).join(`
71
+ `):``}`,{normalizeSemicolon:!0})}if(r.filePath&&!r.isProduction){let e=r.rootContext?c.relative(r.rootContext,r.filePath).replace(/\\/g,`/`):c.basename(r.filePath);P(i,`_sfc_main.__file = ${JSON.stringify(e)};`,{normalizeSemicolon:!0})}if(e.customBlocks.length>0&&P(i,e.customBlocks.map((e,t)=>{let n=[`vue`,`type=${e.type}`,`index=${t}`,...e.src?[`src=true`]:[]];for(let[t,r]of Object.entries(e.attrs))t!==`src`&&(r===!0?n.push(t):n.push(`${t}=${r}`));let i=`${r.requestPath}?${n.join(`&`)}`;return`import block${t} from ${JSON.stringify(i)};\nif (typeof block${t} === 'function') block${t}(_sfc_main);`}).join(`
69
72
  `),{normalizeSemicolon:!0}),e.templateAssetUrls.length>0){let t=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(`
70
- `);i.prepend(`${t}\n`)}if(r.hmr&&e.scopeId){let t=e.hmr&&{...e.hmr,module:l(`sha256`).update(i.code).digest(`hex`).slice(0,16),styles:JSON.stringify({scoped:e.hasScoped,blocks:e.styles.map(({content:e,...t})=>({...t,active:!!(t.src||/\S/.test(e))}))})};k(i,p(e.scopeId,t,D(i.code)??`null`),{normalizeSemicolon:!0})}return{code:i.code,map:i.map}}const{compileSfc:M}=o,{compileJsx:N}=o;function P(e){return e.endsWith(`.jsx`)||e.endsWith(`.tsx`)}function F(e,t,n){return`
73
+ `);i.prepend(`${t}\n`)}if(r.hmr&&e.scopeId){let t=e.hmr&&{...e.hmr,module:l(`sha256`).update(i.code).digest(`hex`).slice(0,16),styles:JSON.stringify({scoped:e.hasScoped,blocks:e.styles.map(({content:e,...t})=>({...t,active:!!(t.src||/\S/.test(e))}))})};P(i,v(e.scopeId,t,M(i.code)??`null`),{normalizeSemicolon:!0})}return{code:i.code,map:i.map}}const{compileSfc:L}=o,{compileJsx:R}=o;function z(e){return e.endsWith(`.jsx`)||e.endsWith(`.tsx`)}function B(e,t,n){return`
71
74
  export const __vize_css__ = ${JSON.stringify(t)};
72
75
  const __vize_css_id__ = ${JSON.stringify(`vize-style-${n}`)};
73
76
  (function() {
@@ -83,6 +86,6 @@ const __vize_css_id__ = ${JSON.stringify(`vize-style-${n}`)};
83
86
  }
84
87
  }
85
88
  })();
86
- ${e}`}function I(e,t,n={}){let r=N(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(`
89
+ ${e}`}function V(e,t,n={}){let r=R(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(`
87
90
  `)}`);let i=(r.scopedStyles??[]).map(e=>e.css).join(`
88
- `),a=r.code,o=r.map??null;if(i){let e=r.scopedStyles[0].scopeId.replace(/^data-v-/,``);a=F(a,i,e),o=null}return{code:a,map:o,warnings:r.warnings}}const L=new Map;function R(e){return l(`sha256`).update(e).digest(`hex`).slice(0,16)}function z(){L.clear()}function B(t,n,o={}){let s=o.compilerOptions?.isTs??/<script[^>]*\blang=["']ts["']/.test(n),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=`${t}: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}:xsc=${o.compilerOptions?.experimentalSelfComponent??!1}:xslot=${o.compilerOptions?.experimentalStrictSlotChildren??!1}:xss=${o.compilerOptions?.experimentalServerScript??!1}:root=${f}:prod=${p}:${m===!1?`tau=false`:m===!0?`tau=true`:`tau=${JSON.stringify(m)}`}`,g=R(n),_=L.get(h);if(_&&_.contentHash===g)return _.result;let v=i(t,o.rootContext,o.isProduction,n),y={...o.compilerOptions,filename:t,sourceMap:o.sourceMap??o.compilerOptions?.sourceMap??!0,ssr:c,vapor:l,isTs:s,scopeId:`data-v-${v}`},b=M(n,y),x=r(n,m),S={code:b.code,hmr:{source:g,script:b.scriptHash,template:b.templateHash,options:R(JSON.stringify(y)),canRerender:!l&&!c&&!d&&b.customBlocks.length===0},...b.map?{map:b.map}:{},css:b.css,errors:b.errors,warnings:b.warnings,scopeId:v,hasScoped:b.hasScoped,styles:b.styles.map(e),customBlocks:b.customBlocks.map(a),isCustomElement:d,templateAssetUrls:x,macroArtifacts:b.macroArtifacts??[]};return S.errors.length===0&&L.set(h,{contentHash:g,result:S}),S}export{A as a,P as i,B as n,j as o,I as r,p as s,z as t};
91
+ `),a=r.code,o=r.map??null;if(i){let e=r.scopedStyles[0].scopeId.replace(/^data-v-/,``);({code:a,map:o}=g(a,o,B(``,i,e)))}return{code:a,map:o,warnings:r.warnings}}const H=new Map;function U(e){return l(`sha256`).update(e).digest(`hex`).slice(0,16)}function W(){H.clear()}function G(t,n,o={}){let s=o.compilerOptions?.isTs??/<script[^>]*\blang=["']ts["']/.test(n),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=`${t}: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}:xsc=${o.compilerOptions?.experimentalSelfComponent??!1}:xslot=${o.compilerOptions?.experimentalStrictSlotChildren??!1}:xss=${o.compilerOptions?.experimentalServerScript??!1}:root=${f}:prod=${p}:${m===!1?`tau=false`:m===!0?`tau=true`:`tau=${JSON.stringify(m)}`}`,g=U(n),_=H.get(h);if(_&&_.contentHash===g)return _.result;let v=i(t,o.rootContext,o.isProduction,n),y={...o.compilerOptions,filename:t,sourceMap:o.sourceMap??o.compilerOptions?.sourceMap??!0,ssr:c,vapor:l,isTs:s,scopeId:`data-v-${v}`},b=L(n,y),x=r(n,m),S={code:b.code,hmr:{source:g,script:b.scriptHash,template:b.templateHash,options:U(JSON.stringify(y)),canRerender:!l&&!c&&!d&&b.customBlocks.length===0},...b.map?{map:b.map}:{},css:b.css,errors:b.errors,warnings:b.warnings,scopeId:v,hasScoped:b.hasScoped,styles:b.styles.map(e),customBlocks:b.customBlocks.map(a),isCustomElement:d,templateAssetUrls:x,macroArtifacts:b.macroArtifacts??[]};return S.errors.length===0&&H.set(h,{contentHash:g,result:S}),S}export{F as a,z as i,G as n,I as o,V as r,v as s,W as t};
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-ByWFOFCe.mjs";import{n as s,r as c,t as l}from"./loader-Cw4_LSPf.mjs";import{a as u,i as d,n as f,r as p,s as m,t as h}from"./compiler-Bvvgv3Cz.mjs";import g from"./loader/jsx-loader.mjs";import _ from"./loader/style-loader.mjs";import v from"./loader/scope-loader.mjs";import{createRequire as y}from"node:module";import{parse as b}from"node:querystring";const x=`@vizejs/rspack-plugin/loader`;let S;try{S=y(import.meta.url).resolve(x).replaceAll(`\\`,`/`)}catch{}function C(e){let t=e.replaceAll(`\\`,`/`);return e===x||t===S||(t.includes(`@vizejs/rspack-plugin/`)||t.includes(`rspack-vize-plugin/`))&&/\/dist\/loader\/index\.[cm]?js$/.test(t)}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e){return typeof e==`string`?e.startsWith(`{`)&&e.endsWith(`}`)?JSON.parse(e):b(e):w(e)?e:{}}function E(e,t,n=!0){function r(e){if(typeof e.loader!=`string`||!C(e.loader))return;let r=T(e.options),i=w(r.css)?r.css:{};if(i.native!==void 0){if(!n)return;if(i.native!==t)throw Error(`[vize] Loader css.native conflicts with VizePlugin's automatic CSS mode. Configure a matching mode on VizePlugin, or set autoRules: false and provide matching style sub-request rules. See MIGRATION.md.`)}e.options={...r,css:{...i,native:t}}}function i(e){if(typeof e==`string`&&C(e)){let t={loader:e};return r(t),t}return w(e)&&r(e),e}function a(e){for(let t of e)w(t)&&(r(t),Array.isArray(t.use)?t.use=t.use.map(i):t.use!==void 0&&typeof t.use!=`function`&&(t.use=i(t.use)),Array.isArray(t.oneOf)&&a(t.oneOf),Array.isArray(t.rules)&&a(t.rules))}a(e)}const D=`@vizejs/rspack-plugin/style-loader`,O=`@vizejs/rspack-plugin/scope-loader`,k={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function A(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&j(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=N(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...P(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...F(t));let{test:s,include:c,exclude:l,resource:u,descriptionData:d,...f}=i,p={...f,loader:void 0,options:void 0,use:z(R(i))};E([p],t);for(let e of o)e.sideEffects=!0;e[r]={test:s,include:c,exclude:l,resource:u,descriptionData:d,oneOf:[...o,p]};for(let e of a)I(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function j(e){return M(e.test)?R(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?C(t):!1}):!1}function M(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function N(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(k))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 P(e,t,n){let r=R(e);if(r.length===0)return[];let i=z(r),a=n?-1:i.findIndex(e=>{let t=typeof e==`string`?e:e.loader;return/(?:^|[/\\])css-loader(?:[/\\?]|$)/.test(t??``)});i.splice(a+1,0,{loader:O}),i.push({loader:D});let o=(t,n)=>{let r={resourceQuery:t,use:z(i)};return e.type?r.type=e.type:n&&(r.type=n),r};return n?[o(RegExp(`(?=.*type=style)(?=.*lang=${t})(?=.*module=)`),`css/module`),o(RegExp(`(?=.*type=style)(?=.*lang=${t})`),`css/auto`)]:[o(RegExp(`(?=.*type=style)(?=.*lang=${t})`))]}function F(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:O},{loader:D}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:O},{loader:D}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:O},{loader:D}]}]}function I(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 L(e){return e?Array.isArray(e)?e:[e]:[]}function R(e){let t=L(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 z(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 B=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`,i=[`include`,`exclude`,`isProduction`,`ssr`,`sourceMap`,`vapor`,`jsxMode`,`jsxCompat`,`root`,`compilerOptions`].filter(e=>this.options[e]!==void 0);i.length>0&&n.warn(`Deprecated VizePlugin options: ${i.join(`, `)}. Compilation options belong in loader options; file filters belong in module.rules. Legacy plugin behavior is unchanged: compilation options are not forwarded. See MIGRATION.md.`),this.options.debug&&this.options.vapor&&!r&&n.debug(`Legacy plugin vapor is set; configure vapor on the loader to select compilation mode.`);let a=s(t.options),o=t.webpack?.rspackVersion,l=c(this.options.css?.native,t.options,o);this.options.css?.native&&a===`disabled`&&n.warn("`css.native: true` is set but `experiments.css` is not enabled in rspack config.");let u=t.options.module?.rules,d=this.options.autoRules??!0;if(u&&E(u,l,d),d){let e=t.options.module?.rules;if(e){let t=A(e,l);t.applied&&this.options.debug&&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`}),this.options.debug&&n.debug(`Auto-injected TypeScript post-processing rule for .vue files.`)))}let{DefinePlugin:f}=t.webpack,p=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))p.add(e)}let m={};p.has(`__VUE_OPTIONS_API__`)||(m.__VUE_OPTIONS_API__=JSON.stringify(!0)),p.has(`__VUE_PROD_DEVTOOLS__`)||(m.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),p.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(m.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(m).length>0&&new f(m).apply(t),this.options.debug&&!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{B as VizePlugin,o as addScopeToCssFallback,A as applyRuleCloning,h as clearCompilationCache,f as compileFile,p as compileJsxModule,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,m 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-ByWFOFCe.mjs";import{n as s,r as c,t as l}from"./loader-C3awZY8W.mjs";import{a as u,i as d,n as f,r as p,s as m,t as h}from"./compiler-DCvb-DL0.mjs";import g from"./loader/jsx-loader.mjs";import _ from"./loader/style-loader.mjs";import v from"./loader/scope-loader.mjs";import{createRequire as y}from"node:module";import{parse as b}from"node:querystring";const x=`@vizejs/rspack-plugin/loader`;let S;try{S=y(import.meta.url).resolve(x).replaceAll(`\\`,`/`)}catch{}function C(e){let t=e.replaceAll(`\\`,`/`);return e===x||t===S||(t.includes(`@vizejs/rspack-plugin/`)||t.includes(`rspack-vize-plugin/`))&&/\/dist\/loader\/index\.[cm]?js$/.test(t)}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e){return typeof e==`string`?e.startsWith(`{`)&&e.endsWith(`}`)?JSON.parse(e):b(e):w(e)?e:{}}function E(e,t,n=!0){function r(e){if(typeof e.loader!=`string`||!C(e.loader))return;let r=T(e.options),i=w(r.css)?r.css:{};if(i.native!==void 0){if(!n)return;if(i.native!==t)throw Error(`[vize] Loader css.native conflicts with VizePlugin's automatic CSS mode. Configure a matching mode on VizePlugin, or set autoRules: false and provide matching style sub-request rules. See MIGRATION.md.`)}e.options={...r,css:{...i,native:t}}}function i(e){if(typeof e==`string`&&C(e)){let t={loader:e};return r(t),t}return w(e)&&r(e),e}function a(e){for(let t of e)w(t)&&(r(t),Array.isArray(t.use)?t.use=t.use.map(i):t.use!==void 0&&typeof t.use!=`function`&&(t.use=i(t.use)),Array.isArray(t.oneOf)&&a(t.oneOf),Array.isArray(t.rules)&&a(t.rules))}a(e)}const D=`@vizejs/rspack-plugin/style-loader`,O=`@vizejs/rspack-plugin/scope-loader`,k={"\\.css$":`css`,"\\.scss$":`scss`,"\\.sass$":`sass`,"\\.less$":`less`,"\\.styl(us)?$":`styl`};function A(e,t){let n=[],r=e.findIndex(e=>e!==`...`&&j(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=N(n);i&&a.push({index:t,rule:n,lang:i})}let o=[];for(let e of a)o.push(...P(e.rule,e.lang,t));o.some(e=>e.resourceQuery instanceof RegExp&&e.resourceQuery.test(`vue&type=style&index=0&lang=css`))||o.push(...F(t));let{test:s,include:c,exclude:l,resource:u,descriptionData:d,...f}=i,p={...f,loader:void 0,options:void 0,use:z(R(i))};E([p],t);for(let e of o)e.sideEffects=!0;e[r]={test:s,include:c,exclude:l,resource:u,descriptionData:d,oneOf:[...o,p]};for(let e of a)I(e.rule);return{applied:!0,clonedCount:o.length,warnings:n}}function j(e){return M(e.test)?R(e).some(e=>{let t=typeof e==`string`?e:e.loader;return t?C(t):!1}):!1}function M(e){return e?e instanceof RegExp?e.test(`App.vue`)||e.test(`foo.vue`):typeof e==`string`?e.includes(`.vue`):!1:!1}function N(e){let t=e.test;if(!t||!(t instanceof RegExp))return null;let n=t.source;for(let[e,t]of Object.entries(k))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 P(e,t,n){let r=R(e);if(r.length===0)return[];let i=z(r),a=n?-1:i.findIndex(e=>{let t=typeof e==`string`?e:e.loader;return/(?:^|[/\\])css-loader(?:[/\\?]|$)/.test(t??``)});i.splice(a+1,0,{loader:O}),i.push({loader:D});let o=(t,n)=>{let r={resourceQuery:t,use:z(i)};return e.type?r.type=e.type:n&&(r.type=n),r};return n?[o(RegExp(`(?=.*type=style)(?=.*lang=${t})(?=.*module=)`),`css/module`),o(RegExp(`(?=.*type=style)(?=.*lang=${t})`),`css/auto`)]:[o(RegExp(`(?=.*type=style)(?=.*lang=${t})`))]}function F(e){return e?[{resourceQuery:/(?=.*type=style)(?=.*lang=css)(?=.*module=)/,type:`css/module`,use:[{loader:O},{loader:D}]},{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`css/auto`,use:[{loader:O},{loader:D}]}]:[{resourceQuery:/(?=.*type=style)(?=.*lang=css)/,type:`javascript/auto`,use:[{loader:O},{loader:D}]}]}function I(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 L(e){return e?Array.isArray(e)?e:[e]:[]}function R(e){let t=L(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 z(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 B=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`,i=[`include`,`exclude`,`isProduction`,`ssr`,`sourceMap`,`vapor`,`jsxMode`,`jsxCompat`,`root`,`compilerOptions`].filter(e=>this.options[e]!==void 0);i.length>0&&n.warn(`Deprecated VizePlugin options: ${i.join(`, `)}. Compilation options belong in loader options; file filters belong in module.rules. Legacy plugin behavior is unchanged: compilation options are not forwarded. See MIGRATION.md.`),this.options.debug&&this.options.vapor&&!r&&n.debug(`Legacy plugin vapor is set; configure vapor on the loader to select compilation mode.`);let a=s(t.options),o=t.webpack?.rspackVersion,l=c(this.options.css?.native,t.options,o);this.options.css?.native&&a===`disabled`&&n.warn("`css.native: true` is set but `experiments.css` is not enabled in rspack config.");let u=t.options.module?.rules,d=this.options.autoRules??!0;if(u&&E(u,l,d),d){let e=t.options.module?.rules;if(e){let t=A(e,l);t.applied&&this.options.debug&&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`}),this.options.debug&&n.debug(`Auto-injected TypeScript post-processing rule for .vue files.`)))}let{DefinePlugin:f}=t.webpack,p=new Set;for(let e of t.options.plugins??[]){let t=e?.definitions;if(t)for(let e of Object.keys(t))p.add(e)}let m={};p.has(`__VUE_OPTIONS_API__`)||(m.__VUE_OPTIONS_API__=JSON.stringify(!0)),p.has(`__VUE_PROD_DEVTOOLS__`)||(m.__VUE_PROD_DEVTOOLS__=JSON.stringify(!r)),p.has(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`)||(m.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__=JSON.stringify(!r)),Object.keys(m).length>0&&new f(m).apply(t),this.options.debug&&!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{B as VizePlugin,o as addScopeToCssFallback,A as applyRuleCloning,h as clearCompilationCache,f as compileFile,p as compileJsxModule,i as extractCustomBlocks,n as extractSrcInfo,e as extractStyleBlocks,m 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 +1 @@
1
- import{t as e}from"../loader-Cw4_LSPf.mjs";export{e as default};
1
+ import{t as e}from"../loader-C3awZY8W.mjs";export{e as default};
@@ -1 +1 @@
1
- import{c as e,m as t}from"../utils-ByWFOFCe.mjs";import{r as n}from"../compiler-Bvvgv3Cz.mjs";function r(e){let r=this.async(),a=this.getOptions(),o=this.resourcePath;if(this.addDependency(o),!i(o,a)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${o}. Passing through source unchanged.`)),r(null,e);return}try{let i=this.mode===`production`||process.env.NODE_ENV===`production`,s=a.sourceMap??this.sourceMap??!i,{code:c,map:l,warnings:u}=n(o,e,{jsxMode:a.jsxMode,jsxCompat:a.jsxCompat,vapor:a.vapor??!1,sourceMap:s});for(let e of u)this.emitWarning(Error(`[vize] ${e}`));r(null,c,t(l)?l:void 0)}catch(e){r(e)}}function i(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}export{r as default};
1
+ import{c as e,m as t}from"../utils-ByWFOFCe.mjs";import{r as n}from"../compiler-DCvb-DL0.mjs";function r(e){let r=this.async(),a=this.getOptions(),o=this.resourcePath;if(this.addDependency(o),!i(o,a)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${o}. Passing through source unchanged.`)),r(null,e);return}try{let i=this.mode===`production`||process.env.NODE_ENV===`production`,s=a.sourceMap??this.sourceMap??!i,{code:c,map:l,warnings:u}=n(o,e,{jsxMode:a.jsxMode,jsxCompat:a.jsxCompat,vapor:a.vapor??!1,sourceMap:s});for(let e of u)this.emitWarning(Error(`[vize] ${e}`));r(null,c,t(l)?l:void 0)}catch(e){r(e)}}function i(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}export{r as default};
@@ -1 +1 @@
1
- import{c as e,f as t,i as n,p as r,r as i}from"./utils-ByWFOFCe.mjs";import{n as a,o}from"./compiler-Bvvgv3Cz.mjs";import{sources as s}from"@rspack/core";import c from"node:fs";import l from"node:path";function u(e){let t=e?.experiments;return!t||typeof t!=`object`||!Object.prototype.hasOwnProperty.call(t,`css`)?`unavailable`:t.css?`enabled`:`disabled`}function d(e){if(typeof e!=`string`)return null;let t=Number.parseInt(e,10);return Number.isNaN(t)?null:t}function f(e,t,n){if(e!=null)return e;let r=u(t);if(r!==`unavailable`)return r===`enabled`;let i=d(n);return i!=null&&i>=2}const p=/\.ce\.vue$/;function m(e){let u=this.async(),d=this.getOptions(),f=this.resourcePath,p=this.resourceQuery,m=v(this,f),y=d.isProduction??(this.mode===`production`||process.env.NODE_ENV===`production`),b=d.ssr??d.compilerOptions?.ssr??!1,x=!b&&!y&&d.hotReload!==!1,S=g(this,d),C=d.sourceMap??d.compilerOptions?.sourceMap??this.sourceMap??!y;if(this.addDependency(f),p?.includes(`type=style`)){u(Error(`[vize] Main loader received style sub-request: ${f}${p}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(p&&p.includes(`vue`)&&p.includes(`type=`)&&!p.includes(`type=style`)){let t=new URLSearchParams(p.slice(1)),n=t.get(`type`);if(n&&n!==`style`){let r=parseInt(t.get(`index`)||`0`,10),a=i(e)[r];if(a){if(a.src){let e=l.resolve(l.dirname(f),a.src);this.addDependency(e);try{u(null,c.readFileSync(e,`utf-8`))}catch{u(Error(`[vize] Custom block <${n} src="${a.src}"> not found (resolved: ${e}) in ${f}`))}return}u(null,a.content)}else u(null,``);return}}if(!h(f,d)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${f}. Passing through source unchanged.`)),u(null,e);return}try{let i=_(f,d.customElement),p=n(e),h=new t(e,C&&(p.scriptSrc||p.templateSrc)?new s.OriginalSource(e,f).map({columns:!0}):null);if(p.scriptSrc){let e=l.resolve(l.dirname(f),p.scriptSrc);this.addDependency(e);try{r(h,`script`,c.readFileSync(e,`utf-8`),e)}catch{u(Error(`[vize] <script src="${p.scriptSrc}"> not found (resolved: ${e}) in ${f}`));return}}if(p.templateSrc){let e=l.resolve(l.dirname(f),p.templateSrc);this.addDependency(e);try{r(h,`template`,c.readFileSync(e,`utf-8`),e)}catch{u(Error(`[vize] <template src="${p.templateSrc}"> not found (resolved: ${e}) in ${f}`));return}}let g=d.root?l.resolve(this.rootContext,d.root):this.rootContext,v=a(f,h.code,{sourceMap:C,ssr:b,vapor:d.vapor??d.compilerOptions?.vapor??!1,compilerOptions:d.compilerOptions,isCustomElement:i,rootContext:g,isProduction:y,transformAssetUrls:d.transformAssetUrls});for(let e of v.warnings)this.emitWarning(Error(`[vize] ${e}`));if(v.errors.length>0){for(let e of v.errors)this.emitError(Error(`[vize] ${e}`));let e=v.errors.join(`\\n`);u(Error(`[vize] Compilation failed for ${f}:\n${e}`));return}let w=o(v,{requestPath:m,hmr:x,filePath:f,isProduction:y,rootContext:g,nativeCss:S}),T=w.map&&h.map?new s.SourceMapSource(w.code,f,JSON.stringify(w.map),h.code,JSON.stringify(h.map),!0).map({columns:!0}):w.map;u(null,w.code,T?JSON.stringify(T):void 0)}catch(e){u(e)}}function h(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function g(e,t){let n=e._compiler;return f(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function _(e,t){return t===!0?!0:t===!1||t===void 0?p.test(e):t.test(e)}function v(e,t){return`./${l.basename(t)}`}export{u as n,f as r,m as t};
1
+ import{c as e,f as t,i as n,p as r,r as i}from"./utils-ByWFOFCe.mjs";import{n as a,o}from"./compiler-DCvb-DL0.mjs";import{sources as s}from"@rspack/core";import c from"node:fs";import l from"node:path";function u(e){let t=e?.experiments;return!t||typeof t!=`object`||!Object.prototype.hasOwnProperty.call(t,`css`)?`unavailable`:t.css?`enabled`:`disabled`}function d(e){if(typeof e!=`string`)return null;let t=Number.parseInt(e,10);return Number.isNaN(t)?null:t}function f(e,t,n){if(e!=null)return e;let r=u(t);if(r!==`unavailable`)return r===`enabled`;let i=d(n);return i!=null&&i>=2}const p=/\.ce\.vue$/;function m(e){let u=this.async(),d=this.getOptions(),f=this.resourcePath,p=this.resourceQuery,m=v(this,f),y=d.isProduction??(this.mode===`production`||process.env.NODE_ENV===`production`),b=d.ssr??d.compilerOptions?.ssr??!1,x=!b&&!y&&d.hotReload!==!1,S=g(this,d),C=d.sourceMap??d.compilerOptions?.sourceMap??this.sourceMap??!y;if(this.addDependency(f),p?.includes(`type=style`)){u(Error(`[vize] Main loader received style sub-request: ${f}${p}. Use module.rules[].oneOf with resourceQuery branches so style requests are handled by @vizejs/rspack-plugin/style-loader.`));return}if(p&&p.includes(`vue`)&&p.includes(`type=`)&&!p.includes(`type=style`)){let t=new URLSearchParams(p.slice(1)),n=t.get(`type`);if(n&&n!==`style`){let r=parseInt(t.get(`index`)||`0`,10),a=i(e)[r];if(a){if(a.src){let e=l.resolve(l.dirname(f),a.src);this.addDependency(e);try{u(null,c.readFileSync(e,`utf-8`))}catch{u(Error(`[vize] Custom block <${n} src="${a.src}"> not found (resolved: ${e}) in ${f}`))}return}u(null,a.content)}else u(null,``);return}}if(!h(f,d)){this.emitWarning(Error(`[vize] File is filtered out by loader options include/exclude: ${f}. Passing through source unchanged.`)),u(null,e);return}try{let i=_(f,d.customElement),p=n(e),h=new t(e,C&&(p.scriptSrc||p.templateSrc)?new s.OriginalSource(e,f).map({columns:!0}):null);if(p.scriptSrc){let e=l.resolve(l.dirname(f),p.scriptSrc);this.addDependency(e);try{r(h,`script`,c.readFileSync(e,`utf-8`),e)}catch{u(Error(`[vize] <script src="${p.scriptSrc}"> not found (resolved: ${e}) in ${f}`));return}}if(p.templateSrc){let e=l.resolve(l.dirname(f),p.templateSrc);this.addDependency(e);try{r(h,`template`,c.readFileSync(e,`utf-8`),e)}catch{u(Error(`[vize] <template src="${p.templateSrc}"> not found (resolved: ${e}) in ${f}`));return}}let g=d.root?l.resolve(this.rootContext,d.root):this.rootContext,v=a(f,h.code,{sourceMap:C,ssr:b,vapor:d.vapor??d.compilerOptions?.vapor??!1,compilerOptions:d.compilerOptions,isCustomElement:i,rootContext:g,isProduction:y,transformAssetUrls:d.transformAssetUrls});for(let e of v.warnings)this.emitWarning(Error(`[vize] ${e}`));if(v.errors.length>0){for(let e of v.errors)this.emitError(Error(`[vize] ${e}`));let e=v.errors.join(`\\n`);u(Error(`[vize] Compilation failed for ${f}:\n${e}`));return}let w=o(v,{requestPath:m,hmr:x,filePath:f,isProduction:y,rootContext:g,nativeCss:S}),T=w.map&&h.map?new s.SourceMapSource(w.code,f,JSON.stringify(w.map),h.code,JSON.stringify(h.map),!0).map({columns:!0}):w.map;u(null,w.code,T?JSON.stringify(T):void 0)}catch(e){u(e)}}function h(t,n){return!(!e(t,n.include,!0)||e(t,n.exclude,!1))}function g(e,t){let n=e._compiler;return f(t.css?.native,n?.options,n?.webpack?.rspackVersion)}function _(e,t){return t===!0?!0:t===!1||t===void 0?p.test(e):t.test(e)}function v(e,t){return`./${l.basename(t)}`}export{u as n,f as r,m as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/rspack-plugin",
3
- "version": "0.428.1",
3
+ "version": "0.429.1",
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.428.1",
62
+ "@vizejs/native": "0.429.1",
63
63
  "diff": "8.0.4",
64
64
  "oxc-parser": "0.144.0",
65
65
  "oxc-transform": "0.144.0"