@vizejs/rspack-plugin 0.669.0 → 0.670.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{compiler-D82EwDeR.mjs → compiler-sFiJ3Glz.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/loader/index.mjs +1 -1
- package/dist/loader/jsx-loader.mjs +1 -1
- package/dist/loader/style-loader.mjs +1 -1
- package/dist/{loader-BMbfY0xo.mjs → loader-CG3Vu2l3.mjs} +1 -1
- package/package.json +2 -2
|
@@ -65,7 +65,7 @@ if (${i}) {
|
|
|
65
65
|
__VUE_HMR_RUNTIME__.rerender("${e}", ${a}.render)
|
|
66
66
|
})
|
|
67
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=S(e.declaration)?e.declaration:null,n=[];if(t?.type===`FunctionDeclaration`||t?.type===`ClassDeclaration`){let e=S(t.id)?w(t.id):null;e&&n.push(e)}t?.type===`VariableDeclaration`&&n.push(...O(t));let r=Array.isArray(e.specifiers)?e.specifiers:[];for(let e of r.filter(S)){let t=w(S(e.exported)?e.exported:null)??w(S(e.local)?e.local:null);t&&n.push(t)}return n}function M(e){let t=T(e),n=E(t),r=k(t),i=n.filter(e=>e.type===`ExportNamedDeclaration`).flatMap(j);return{hasDefaultExport:r!=null,hasSfcMainDefined:n.some(e=>e.type===`VariableDeclaration`&&O(e).includes(x)),hasNamedRenderExport:i.includes(`render`),hasNamedSsrRenderExport:i.includes(`ssrRender`)}}function N(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 P(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 F(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 I(e,t){return L(e,t).code}function L(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=M(i.code),u=o.hasDefaultExport,d=o.hasSfcMainDefined;if(u&&!d)P(i),e.hasScoped&&e.scopeId&&i.append(`\n_sfc_main.__scopeId = "data-v-${e.scopeId}";`),i.append(`
|
|
68
|
-
export default _sfc_main;`);else if(u&&d&&e.hasScoped&&e.scopeId)F(i,`_sfc_main.__scopeId = "data-v-${e.scopeId}";`);else if(!u&&!d){let t=o.hasNamedRenderExport?`render`:o.hasNamedSsrRenderExport?`ssrRender`:null;if(t){let n=e.hasScoped&&e.scopeId?`, __scopeId: "data-v-${e.scopeId}"`:``;i.append(`\nconst _sfc_main = { ${t}${n} };\nexport default _sfc_main;`)}}if(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(`
|
|
68
|
+
export default _sfc_main;`);else if(u&&d&&e.hasScoped&&e.scopeId)F(i,`_sfc_main.__scopeId = "data-v-${e.scopeId}";`);else if(!u&&!d){let t=o.hasNamedRenderExport?`render`:o.hasNamedSsrRenderExport?`ssrRender`:null;if(t){let n=e.hasScoped&&e.scopeId?`, __scopeId: "data-v-${e.scopeId}"`:``;i.append(`\nconst _sfc_main = { ${t}${n} };\nexport default _sfc_main;`)}}if(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`]:[],...t.src?[`src`]:[]],i=`${t.src??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
69
|
`);i.prepend(`${s}\n`),a&&F(i,`_sfc_main.styles = [${n.map(e=>`_style_${e.index}`).join(`,`)}];`,{normalizeSemicolon:!0}),!a&&o.length>0&&F(i,`${[r.nativeCss?``:`const __vize_resolve_css_module__ = (value) => value.default?.locals ?? (value.default && typeof value.default === "object" && !Array.isArray(value.default) ? 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
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
71
|
`):``}`,{normalizeSemicolon:!0})}if(r.filePath&&!r.isProduction){let e=r.rootContext?c.relative(r.rootContext,r.filePath).replace(/\\/g,`/`):c.basename(r.filePath);F(i,`_sfc_main.__file = ${JSON.stringify(e)};`,{normalizeSemicolon:!0})}if(e.customBlocks.length>0&&F(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(`
|
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-D_f3YvFb.mjs";import{n as s,r as c,t as l}from"./loader-
|
|
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-D_f3YvFb.mjs";import{n as s,r as c,t as l}from"./loader-CG3Vu2l3.mjs";import{a as u,i as d,n as f,r as p,s as m,t as h}from"./compiler-sFiJ3Glz.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]},e.splice(r+1,0,{resourceQuery:/(?=.*\bvue\b)(?=.*type=style)(?=.*&src(?:&|$))/,oneOf:o.map(e=>({...e,use:z(L(e.use))}))});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 n===`css/module`&&(!e.type||e.type===`css/auto`)?r.type=n: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};
|
package/dist/loader/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../loader-
|
|
1
|
+
import{t as e}from"../loader-CG3Vu2l3.mjs";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,m as t}from"../utils-D_f3YvFb.mjs";import{r as n}from"../compiler-
|
|
1
|
+
import{c as e,m as t}from"../utils-D_f3YvFb.mjs";import{r as n}from"../compiler-sFiJ3Glz.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{a as e}from"../utils-D_f3YvFb.mjs";import t from"node:path";import n from"node:fs/promises";function r(r){let i=this.async(),{resourceQuery:a,resourcePath:o}=this;if(!a){i(null,r);return}let s=new URLSearchParams(a.slice(1));if(s.get(`type`)!==`style`){i(null,r);return}let c=parseInt(s.get(`index`)||`0`,10);this.addDependency(o);let l=e(r)[c];if(!l){this.hot||this.emitError(Error(`[vize] Style block at index ${c} not found in ${o}`)),i(null,``);return}if(l.src){let e=t.resolve(t.dirname(o),l.src);this.addDependency(e),n.readFile(e,`utf-8`).then(e=>{i(null,e)}).catch(()=>{this.emitWarning(Error(`[vize] <style src> target not found: ${l.src} (resolved: ${e}) in ${o}`)),i(null,``)});return}i(null,l.content)}export{r as default};
|
|
1
|
+
import{a as e}from"../utils-D_f3YvFb.mjs";import t from"node:path";import n from"node:fs/promises";function r(r){let i=this.async(),{resourceQuery:a,resourcePath:o}=this;if(!a){i(null,r);return}let s=new URLSearchParams(a.slice(1));if(s.get(`type`)!==`style`){i(null,r);return}if(s.has(`src`)){i(null,r);return}let c=parseInt(s.get(`index`)||`0`,10);this.addDependency(o);let l=e(r)[c];if(!l){this.hot||this.emitError(Error(`[vize] Style block at index ${c} not found in ${o}`)),i(null,``);return}if(l.src){let e=t.resolve(t.dirname(o),l.src);this.addDependency(e),n.readFile(e,`utf-8`).then(e=>{i(null,e)}).catch(()=>{this.emitWarning(Error(`[vize] <style src> target not found: ${l.src} (resolved: ${e}) in ${o}`)),i(null,``)});return}i(null,l.content)}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-D_f3YvFb.mjs";import{n as a,o}from"./compiler-
|
|
1
|
+
import{c as e,f as t,i as n,p as r,r as i}from"./utils-D_f3YvFb.mjs";import{n as a,o}from"./compiler-sFiJ3Glz.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.
|
|
3
|
+
"version": "0.670.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.
|
|
62
|
+
"@vizejs/native": "0.670.0",
|
|
63
63
|
"diff": "8.0.4",
|
|
64
64
|
"oxc-parser": "0.144.0",
|
|
65
65
|
"oxc-transform": "0.144.0",
|