@vizejs/rspack-plugin 0.287.0 → 0.288.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-CC1Pk6sT.mjs → compiler-C710IOIZ.mjs} +1 -1
- package/dist/{index-D-xYzHWQ.d.mts → index-sdINSvBH.d.mts} +3 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/loader/index.d.mts +1 -1
- package/dist/loader/index.mjs +1 -1
- package/dist/loader/jsx-loader.d.mts +1 -1
- package/dist/loader/jsx-loader.mjs +1 -1
- package/dist/loader/style-loader.d.mts +1 -1
- package/dist/{loader-Lgg-oaBX.mjs → loader-CHpYOm39.mjs} +1 -1
- package/package.json +2 -2
|
@@ -39,4 +39,4 @@ const __vize_css_id__ = ${JSON.stringify(`vize-style-${n}`)};
|
|
|
39
39
|
})();
|
|
40
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(`
|
|
41
41
|
`)}`);let i=(r.scopedStyles??[]).map(e=>e.css).join(`
|
|
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`}: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};
|
|
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};
|
|
@@ -8,6 +8,9 @@ interface SfcCompileOptionsNapi {
|
|
|
8
8
|
vapor?: boolean;
|
|
9
9
|
/** Template syntax compatibility mode */
|
|
10
10
|
templateSyntax?: "standard" | "strict" | "quirks";
|
|
11
|
+
experimentalInTagComments?: boolean;
|
|
12
|
+
experimentalPatternedTemplate?: boolean;
|
|
13
|
+
experimentalServerScript?: boolean;
|
|
11
14
|
/** Preserve TypeScript in output when true */
|
|
12
15
|
isTs?: boolean;
|
|
13
16
|
/** Scope ID for scoped CSS (e.g., "data-v-abc123") */
|
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-
|
|
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";
|
|
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";
|
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-
|
|
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};
|
package/dist/loader/index.d.mts
CHANGED
package/dist/loader/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../loader-
|
|
1
|
+
import{t as e}from"../loader-CHpYOm39.mjs";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"../utils-CFK8mca_.mjs";import{r as t}from"../compiler-
|
|
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 +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-
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/rspack-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.288.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.288.0",
|
|
63
63
|
"oxc-parser": "0.133.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|