@cssxio/unplugin 0.10.0 → 0.12.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/README.md +32 -20
- package/dist/chunk-3C3MRH6A.js +1 -0
- package/dist/chunk-62JIYM5O.js +3 -0
- package/dist/chunk-6TMSHR6Z.js +1 -0
- package/dist/chunk-6WHEMH4N.js +1 -0
- package/dist/chunk-CUKIYXQD.js +1 -0
- package/dist/chunk-ERSPVOTN.js +1 -0
- package/dist/chunk-EWDPJYCI.js +1 -0
- package/dist/chunk-FBSYCQYI.js +1 -0
- package/dist/chunk-FNYQGV2A.js +1 -0
- package/dist/chunk-JFKLWSSR.js +5 -0
- package/dist/chunk-KLVVGFBR.js +2 -0
- package/dist/chunk-KR26IZKN.js +1 -0
- package/dist/chunk-M2QORA5D.js +5 -0
- package/dist/chunk-N3X67A2E.js +1 -0
- package/dist/chunk-P7NG4XOZ.js +0 -0
- package/dist/chunk-RMB4J65B.js +0 -0
- package/dist/chunk-SV3MUUMI.js +1 -0
- package/dist/chunk-VSO4AWLZ.js +1 -0
- package/dist/chunk-WIZLK3SX.js +1 -0
- package/dist/chunk-XCE7ZTGW.js +3 -0
- package/dist/chunk-YYF5QU33.js +1 -0
- package/dist/chunk-YZ7P3BSQ.js +1 -0
- package/dist/chunk-ZCSG362J.js +1 -0
- package/dist/chunk-ZDJ2ZX5V.js +1 -0
- package/dist/compile-cssx-stylesheet-BC4-zPLW.d.cts +17 -0
- package/dist/compile-cssx-stylesheet-CyrCVIOq.d.ts +17 -0
- package/dist/create-universal-esbuild-hooks-OCPLHVMY.js +1 -0
- package/dist/development-coordinator-6IH5C7KS.js +1 -0
- package/dist/development-runtime.cjs +212 -0
- package/dist/development-runtime.d.cts +181 -0
- package/dist/development-runtime.d.ts +181 -0
- package/dist/development-runtime.js +196 -0
- package/dist/esbuild.cjs +14 -102
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +19 -102
- package/dist/index.d.cts +8 -134
- package/dist/index.d.ts +8 -134
- package/dist/index.js +1 -1
- package/dist/module-cssx-data-C58vi376.d.cts +12 -0
- package/dist/module-cssx-data-CeyCcQqm.d.ts +12 -0
- package/dist/next-development-server-CBPFB9EC.d.cts +17 -0
- package/dist/next-development-server-CBPFB9EC.d.ts +17 -0
- package/dist/next-development-server-I7PSPICB.js +1 -0
- package/dist/next-loader.cjs +16 -15
- package/dist/next-loader.d.cts +3 -1
- package/dist/next-loader.d.ts +3 -1
- package/dist/next-loader.js +5 -4
- package/dist/next.cjs +1 -1
- package/dist/next.d.cts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +1 -1
- package/dist/{options-DkqShf7w.d.ts → options-BbhZj-Sb.d.cts} +4 -0
- package/dist/{options-DkqShf7w.d.cts → options-BbhZj-Sb.d.ts} +4 -0
- package/dist/project-scan-EIM7BVPC.js +1 -0
- package/dist/rollup.cjs +17 -101
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +17 -101
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +1 -1
- package/dist/stylesheet-types-DF-aQ6hZ.d.cts +42 -0
- package/dist/stylesheet-types-DF-aQ6hZ.d.ts +42 -0
- package/dist/transform-astro-sx-HBUDGJ5K.js +2 -0
- package/dist/transform-babel-cssx-module-U4DGJILK.js +1 -0
- package/dist/transform-runtime.cjs +12 -0
- package/dist/transform-runtime.d.cts +114 -0
- package/dist/transform-runtime.d.ts +114 -0
- package/dist/transform-runtime.js +2 -0
- package/dist/transform-vue-sfc-ACOOMWIS.js +6 -0
- package/dist/try-transform-native-static-create-345K2PAR.js +1 -0
- package/dist/try-transform-native-static-sx-MGM7DLG4.js +1 -0
- package/dist/unplugin-factory-runtime.cjs +18 -0
- package/dist/unplugin-factory-runtime.d.cts +48 -0
- package/dist/unplugin-factory-runtime.d.ts +48 -0
- package/dist/unplugin-factory-runtime.js +1 -0
- package/dist/vite.cjs +17 -101
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +17 -101
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +1 -1
- package/dist/with-class-name-manifest-455KRGHY.js +1 -0
- package/package.json +18 -4
- package/dist/chunk-5R7RC6XB.js +0 -13
- package/dist/chunk-KEHM5MVZ.js +0 -91
- package/dist/chunk-OHZUHF4D.js +0 -1
package/dist/chunk-KEHM5MVZ.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import{a as B,b as x,c as w,d as F,e as O,f as M,g as C,h as k,i as S,k as I,m as N,n as H,o as v,p as V}from"./chunk-5R7RC6XB.js";import{b as A}from"./chunk-OHZUHF4D.js";import{createClassNameAllocator as Le}from"@cssxio/compiler";import{createUnplugin as He}from"unplugin";function E(e,s,o=Date.now()){e.ws.send({type:"update",updates:[{type:"css-update",path:s,acceptedPath:s,timestamp:o}]})}function $(e,s){let{cssFileName:o,sourceMap:r,options:t,rollupDataById:l,getTheme:y}=s,a=O(e.config.base,o),d=O("/",o);e.watcher?.on("unlink",p=>{l.delete(x(p)),E(e,d)}),e.middlewares.use((p,u,n)=>{let c=p.url?.split("?",1)[0];if(c!==a&&(c!==`${a}.map`||!r))return n();y().then(async i=>{let f=t.coordination==="manifest"?await v(e.config.root??process.cwd(),t):[...l.values()];return C(f,i,t.layer,r,t.darkMode,t.preflight)}).then(i=>{if(c===`${a}.map`){u.setHeader("Content-Type","application/json; charset=utf-8"),u.setHeader("Cache-Control","no-store"),u.end(i.map?k(i.map,o):"");return}u.setHeader("Content-Type","text/css; charset=utf-8"),u.setHeader("Cache-Control","no-store"),u.end(S(i,o))}).catch(i=>{u.setHeader("Content-Type","text/plain; charset=utf-8"),u.end(i instanceof Error?i.message:"Unable to compile CSSX development stylesheet.")})})}import{Buffer as ue}from"buffer";import{mkdir as pe,unlink as fe,writeFile as ye}from"fs/promises";import{basename as ge,dirname as xe,resolve as Ce}from"path";function j(e){let{options:s,cssFileName:o,sourceMap:r,dataById:t,getTheme:l}=e,y,a=process.cwd();return{config(d){d.metafile=!0},setup(d){a=d.initialOptions.absWorkingDir??process.cwd(),d.onEnd(async p=>{if(!p.metafile)return;let u=new Set(Object.keys(p.metafile.inputs).map(m=>Ce(a,m)));for(let m of t.keys())u.has(m)||t.delete(m);let n=s.coordination==="manifest"?await v(a,s):[...t.values()],c=await C(n,await l(),s.layer,r,s.darkMode,s.preflight),i=F(a,d.initialOptions,w(o,c.css));if(!c.css){y&&await fe(y).catch(()=>{}),y=void 0;return}let f=S(c,ge(i));if(d.initialOptions.write===!1){let m=p.outputFiles;if(!m)return;let g={path:i,contents:ue.from(f),hash:"",text:f};if(m.findIndex(P=>P.path===i)!==-1)throw new Error(`CSSX CSS asset collision at "${i}".`);m.push(g);return}await pe(xe(i),{recursive:!0}),await ye(i,f),y=i})},getWorkingDirectory:()=>a}}function W(e,s,o){let r=new Set;for(let t of s)e.moduleGraph?.invalidateModule(t,r,o,!0);for(let t of r){if(!t.id)continue;let l=e.runner?.evaluatedModules?.getModuleById(t.id);l&&e.runner?.evaluatedModules?.invalidateModule(l)}}function _(e){return async function(o){let r=this.environment;if(!r||r.name==="client")return;let t=o.modules,l=t.filter(d=>{let p=e.get(x(d.id??""));return!!(p&&p.cssOnlySignature&&p.atomicClasses?.length===0)});if(l.length===0)return;let y=new Map(l.map(d=>[d,e.get(x(d.id)).cssOnlySignature]));for(let d of l)d.url&&await r.transformRequest(d.url);if(l.every(d=>{let p=e.get(x(d.id));return!!(p&&p.atomicClasses.length===0&&p.cssOnlySignature===y.get(d))}))return W(r,l,o.timestamp),t.filter(d=>!l.includes(d))}}import{mkdir as he,writeFile as ve}from"fs/promises";import{dirname as Se,resolve as we}from"path";function X(e,s){let o=new Map,r=[];for(let t of s)t.id?o.set(t.id,t):r.push(t);for(let t of e)t.id?o.set(t.id,t):r.push(t);return[...o.values(),...r]}function K(e,s){let o=e.buildInfo?.[s];if(!o||typeof o!="object")return;let{id:r,candidates:t,composites:l,atomicClasses:y,origins:a}=o;return{id:typeof r=="string"?r:"",candidates:t&&typeof t=="object"?t:{},composites:l&&typeof l=="object"?l:{},...Array.isArray(y)?{atomicClasses:y}:{},origins:a&&typeof a=="object"?a:{}}}function G(e,s,o,r,t,l,y,a,d=!0,p,u){let n=e.name??e.options?.name;n==="server"||n==="edge-server"||e.hooks.thisCompilation.tap("@cssxio/unplugin",c=>{c.hooks.processAssets.tapPromise({name:"@cssxio/unplugin",stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},async()=>{let i=p?await p():X([...c.modules].map(g=>K(g,l)).filter(g=>g!==void 0),y?.values()??[]),f=await C(i,await o(),r,t,a,d);if(u?.debug){let g=V(i,f.css,u);if(u.debug===!0)console.info(`CSSX: ${g.naming.mode} naming; ${g.classes.filter(h=>h.selectorFound).length}/${g.classes.length} generated classes have selectors; compiler mappings ${g.serverClientMappings.status}${g.serverClientMappings.conflicts.length?` (${g.serverClientMappings.conflicts.length} utility conflicts)`:""}.`);else{let h=we(e.context,u.debug.reportFile);await he(Se(h),{recursive:!0}),await ve(h,`${JSON.stringify(g,null,2)}
|
|
2
|
-
`,"utf8")}}if(!f.css)return;let m=w(s,f.css);if(c.getAsset?.(m))throw new Error(`CSSX CSS asset collision at "${m}".`);if(c.emitAsset(m,new e.webpack.sources.RawSource(S(f,m))),f.map){let g=`${m}.map`;if(c.getAsset?.(g))throw new Error(`CSSX CSS map asset collision at "${g}".`);c.emitAsset(g,new e.webpack.sources.RawSource(k(f.map,m)))}})})}var b="@cssxio/unplugin/rules";function R(){return{id:"",rules:[],candidates:{},composites:{},origins:{},cssOnlySignature:""}}import{createClassNameAllocator as Me}from"@cssxio/compiler";function J(e,s){return`${e}\0${JSON.stringify(s)}`}var q=new Map;function L(e,s){let o=J(e,s),r=q.get(o);return r||(r={classNameAllocator:s.classNameAllocator??Me(M(s)),transformedDataById:new Map},q.set(o,r)),r}function T({compiler:e,options:s,cssFileName:o,sourceMap:r,getTheme:t}){let l=L(e.context,s);G(e,o,t,s.layer,r,b,l.transformedDataById,s.darkMode,s.preflight,s.stableClassNames||s.naming==="source"||s.coordination==="manifest"?()=>v(e.context,s):void 0,s)}function Y(e){if(!e||typeof e!="object")return R();let{id:s,rules:o,candidates:r,composites:t,atomicClasses:l,origins:y,cssOnlySignature:a}=e;return{id:typeof s=="string"?s:"",rules:Array.isArray(o)?o:[],candidates:r&&typeof r=="object"?r:{},composites:t&&typeof t=="object"?t:{},...Array.isArray(l)?{atomicClasses:l}:{},origins:y&&typeof y=="object"?y:{},cssOnlySignature:typeof a=="string"?a:""}}function z(e){return!e||typeof e!="object"?R():Y(e[b])}function Q(e){return async function(s,o){let{framework:r,options:t,cssFileName:l,sourceMap:y,rollupDataById:a,getTheme:d}=e,p=new Set(Object.values(o).flatMap(i=>i.type==="chunk"?Object.keys(i.modules??{}):[]).map(x));if(r!=="vite")for(let i of a.keys())p.has(i)||a.delete(i);let u=t.coordination==="manifest"?await v(process.cwd(),t):r==="vite"?[...a.values()]:[...p].map(i=>{let f=z(this.getModuleInfo(i)?.meta);return Object.keys(f.candidates).length>0?f:a.get(i)??f}),n=await C(u,await d(),t.layer,y,t.darkMode,t.preflight);if(!n.css)return;let c=w(l,n.css);if(Object.hasOwn(o,c))throw new Error(`CSSX CSS asset collision at "${c}".`);if(this.emitFile({type:"asset",fileName:c,source:S(n,c)}),n.map){let i=`${c}.map`;if(Object.hasOwn(o,i))throw new Error(`CSSX CSS map asset collision at "${i}".`);this.emitFile({type:"asset",fileName:i,source:k(n.map,c)})}}}import{relative as ke,resolve as se,sep as Ne}from"path";function Z(e){let s=e.getNativeBuildContext?.();return s&&(s.framework==="webpack"||s.framework==="rspack")?s.loaderContext?.rootContext??process.cwd():void 0}function ee(e){return`if (typeof document !== "undefined" && typeof module !== "undefined" && module.hot) {
|
|
3
|
-
const key = "__cssxStylesheetHmr";
|
|
4
|
-
const state = globalThis[key] || (globalThis[key] = { revision: 0, staged: [], replacements: [] });
|
|
5
|
-
const stylesheetLink = [...document.querySelectorAll('link[rel="stylesheet"]')].find((link) =>
|
|
6
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${JSON.stringify(`/${e}`)}),
|
|
7
|
-
);
|
|
8
|
-
const nextLink = stylesheetLink && (() => {
|
|
9
|
-
const path = new URL(stylesheetLink.href, document.baseURI).pathname;
|
|
10
|
-
return path.includes("/_next/");
|
|
11
|
-
})();
|
|
12
|
-
if (!state.installed) {
|
|
13
|
-
state.installed = true;
|
|
14
|
-
state.stage = () => {
|
|
15
|
-
const revision = ++state.revision;
|
|
16
|
-
state.staged = [];
|
|
17
|
-
state.replacements = [];
|
|
18
|
-
const links = [...document.querySelectorAll('link[rel="stylesheet"]')].filter((link) =>
|
|
19
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${JSON.stringify(`/${e}`)}),
|
|
20
|
-
);
|
|
21
|
-
return Promise.all(
|
|
22
|
-
links.map(
|
|
23
|
-
(link) =>
|
|
24
|
-
new Promise((resolve) => {
|
|
25
|
-
const replacement = link.cloneNode();
|
|
26
|
-
const url = new URL(link.href, document.baseURI);
|
|
27
|
-
url.searchParams.set("cssx", String(revision));
|
|
28
|
-
replacement.href = url.href;
|
|
29
|
-
const finish = (loaded) => {
|
|
30
|
-
replacement.removeEventListener("load", onLoad);
|
|
31
|
-
replacement.removeEventListener("error", onError);
|
|
32
|
-
if (loaded) {
|
|
33
|
-
state.staged.push(link);
|
|
34
|
-
if (state.removeOnLoad) link.remove();
|
|
35
|
-
}
|
|
36
|
-
else replacement.remove();
|
|
37
|
-
resolve();
|
|
38
|
-
};
|
|
39
|
-
const onLoad = () => finish(true);
|
|
40
|
-
const onError = () => finish(false);
|
|
41
|
-
replacement.addEventListener("load", onLoad);
|
|
42
|
-
replacement.addEventListener("error", onError);
|
|
43
|
-
state.replacements.push(replacement);
|
|
44
|
-
link.after(replacement);
|
|
45
|
-
}),
|
|
46
|
-
),
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
module.hot.addStatusHandler((status) => {
|
|
50
|
-
if (status === "prepare" || status === "dispose") {
|
|
51
|
-
return state.stage();
|
|
52
|
-
}
|
|
53
|
-
if (status === "idle") {
|
|
54
|
-
for (const link of state.staged) link.remove();
|
|
55
|
-
state.staged = [];
|
|
56
|
-
state.replacements = [];
|
|
57
|
-
}
|
|
58
|
-
if (status === "abort" || status === "fail") {
|
|
59
|
-
for (const replacement of state.replacements) replacement.remove();
|
|
60
|
-
state.staged = [];
|
|
61
|
-
state.replacements = [];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
if (nextLink) module.hot.accept(() => void state.stage());
|
|
65
|
-
for (const updateKey of Object.getOwnPropertyNames(globalThis).filter((name) => name.startsWith("webpackHotUpdate"))) {
|
|
66
|
-
const update = globalThis[updateKey];
|
|
67
|
-
if (typeof update !== "function") continue;
|
|
68
|
-
globalThis[updateKey] = function (...args) {
|
|
69
|
-
void state.stage();
|
|
70
|
-
return update.apply(this, args);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (stylesheetLink) {
|
|
74
|
-
state.removeOnLoad = Boolean(nextLink);
|
|
75
|
-
const refresh = async () => {
|
|
76
|
-
try {
|
|
77
|
-
const url = new URL(stylesheetLink.href, document.baseURI);
|
|
78
|
-
url.searchParams.set("cssx-probe", String(Date.now()));
|
|
79
|
-
const css = await fetch(url.href, { cache: "no-store" }).then((response) => response.text());
|
|
80
|
-
if (state.css && state.css !== css) void state.stage();
|
|
81
|
-
state.css = css;
|
|
82
|
-
} catch {
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
void refresh();
|
|
86
|
-
state.poll = setInterval(() => void refresh(), 500);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}`}function te(e,s,o){let r=e.getNativeBuildContext?.();if(!r||r.framework!=="webpack"&&r.framework!=="rspack")return;let t=r.loaderContext?._module;if(!t)return;let l=t.buildInfo??(t.buildInfo={});l[o]=s}function oe(e){return async function(s,o){let{framework:r,options:t,classNameAllocator:l,rollupDataById:y,esbuildDataById:a,cssFileName:d,getEsbuildWorkingDirectory:p,notifyViteStyles:u}=e;t.themeFile&&this.addWatchFile?.(se(t.themeFile));let n=Z(this),c=n?L(n,t):void 0,i={...t,className:{...t.className,...t.naming==="hash"?{variant:"random"}:{},...t.naming==="serial"?{variant:"serial"}:{}},stableClassNames:t.stableClassNames||t.naming==="source",classNameAllocator:c?.classNameAllocator??l,...t.stableClassNames||t.naming==="source"?{stableClassNameFileName:ke(n??process.cwd(),x(o)).replaceAll(Ne,"/")}:{}},f={...i};delete f.coordination,delete f.manifestPath;let m=t.coordination==="manifest"?await I(t.manifestPath,f.className,me=>N(s,o,{...f,classNameAllocator:me},H(this,o))):await N(s,o,i,H(this,o)),g={id:x(o),rules:m?.rules??[],candidates:m?.candidates??{},composites:m?.composites??{},atomicClasses:m?.atomicClasses??[],origins:m?.origins??{},cssOnlySignature:m?.cssOnlySignature??""};te(this,g,b);let h=x(o);(m||h===o)&&(y.set(h,g),a.set(se(p(),h),g),c?.transformedDataById.set(h,g)),r==="vite"&&u(O("/",d));let P=m?.code??s;return{code:(r==="webpack"||r==="rspack")&&m?`${P}
|
|
90
|
-
${ee(d)}`:P,meta:{[b]:g},...m?.map?{map:m.map}:{}}}}import{createClassNameAllocator as De}from"@cssxio/compiler";import{Buffer as ne}from"buffer";import{mkdir as Pe,readFile as Ae,unlink as ie,writeFile as le}from"fs/promises";import{basename as de,dirname as Be,relative as Fe,resolve as Ie,sep as Ee}from"path";import{realpath as be}from"fs/promises";import{resolve as Oe}from"path";async function U(e){return be(e).catch(()=>Oe(e))}async function re(e,s){let o=await B(s);return C(e.map(([,r])=>r),o,s.layer,s.sourceMap??!0,s.darkMode,s.preflight)}function ae(e){return/\.tsx?$/.test(e)?"ts":"js"}var Re=/\.[cm]?[jt]sx?$/;function ce(e={}){if(A(e),e.classNameAllocator&&e.className)throw new Error("CSSX classNameAllocator owns naming. Omit className when supplying a custom allocator.");let s=new Map,o=e.classNameAllocator??De(M(e)),r,t;return{name:"@cssxio/unplugin",setup(l){let y=l.initialOptions.absWorkingDir??process.cwd();l.initialOptions.metafile=!0,l.onLoad({filter:Re},async({path:a})=>{let d=await Ae(a,"utf8"),p=e.stableClassNames||e.naming==="source",u={...e,className:M(e),stableClassNames:p,...p?{stableClassNameFileName:Fe(y,a).replaceAll(Ee,"/")}:{},classNameAllocator:o},n={...u};delete n.coordination,delete n.manifestPath;let c=e.coordination==="manifest"?await I(e.manifestPath,n.className,f=>N(d,a,{...n,classNameAllocator:f})):await N(d,a,u);if(!c)return;let i=await U(a);return s.set(i,{id:i,candidates:c.candidates,composites:c.composites,atomicClasses:c.atomicClasses,origins:c.origins}),{contents:c.code,loader:ae(a)}}),l.onEnd(async a=>{if(!a.metafile)return;let d=new Set(await Promise.all(Object.keys(a.metafile.inputs).map(m=>U(Ie(y,m)))));for(let m of s.keys())d.has(m)||s.delete(m);let p=e.coordination==="manifest"?(await v(y,e)).map(m=>[m.id,m]):[...s],u=await re(p,e),n=F(y,l.initialOptions,w(e.cssFileName??"cssx.css",u.css));if(!u.css){r&&await ie(r).catch(()=>{}),t&&await ie(t).catch(()=>{}),r=void 0,t=void 0;return}let c=u.map?`${u.css}
|
|
91
|
-
/*# sourceMappingURL=${de(n)}.map */`:u.css,i=`${n}.map`,f=u.map?JSON.stringify({...u.map,file:de(n)}):void 0;if(l.initialOptions.write===!1){if(!a.outputFiles)return;if(a.outputFiles.some(m=>m.path===n))throw new Error(`CSSX CSS asset collision at "${n}".`);a.outputFiles.push({path:n,contents:ne.from(c),hash:"",text:c}),f&&a.outputFiles.push({path:i,contents:ne.from(f),hash:"",text:f});return}await Pe(Be(n),{recursive:!0}),await le(n,c),f&&await le(i,f),r=n,t=f?i:void 0})}}}var Te=/\.(?:[cm]?[jt]sx?|astro|vue|md|mdx)(?:\?.*)?$/,Ue=(e={},s)=>{if(A(e),e.classNameAllocator&&e.className)throw new Error("CSSX classNameAllocator owns naming. Omit className when supplying a custom allocator.");let o=e.cssFileName??"cssx.css",r=e.sourceMap??!0,t=new Map,l=e.classNameAllocator??Le(M(e)),y=new Map,a,d=()=>B(e),p=j({options:e,cssFileName:o,sourceMap:r,dataById:y,getTheme:d}),u=Q({framework:s.framework,options:e,cssFileName:o,sourceMap:r,rollupDataById:t,getTheme:d});return{name:"@cssxio/unplugin",enforce:"pre",transform:{filter:{id:Te},handler:oe({framework:s.framework,options:e,classNameAllocator:l,rollupDataById:t,esbuildDataById:y,cssFileName:o,getEsbuildWorkingDirectory:p.getWorkingDirectory,notifyViteStyles:n=>{a&&E(a,n)}})},watchChange(n,c){c.event==="delete"&&t.delete(x(n))},rollup:{generateBundle:u},vite:{generateBundle:u,configureServer(n){a=n,$(n,{cssFileName:o,sourceMap:r,options:e,rollupDataById:t,getTheme:d})},hotUpdate:{order:"pre",handler:_(t)}},...s.framework==="webpack"?{webpack(n){T({compiler:n,options:e,cssFileName:o,sourceMap:r,getTheme:d})}}:{},...s.framework==="rspack"?{rspack(n){T({compiler:n,options:e,cssFileName:o,sourceMap:r,getTheme:d})}}:{},...s.framework==="esbuild"?{esbuild:{config:p.config,setup:p.setup}}:{}}},D=He(Ue),As=D.vite,Bs=D.rollup,Fs=D.webpack,Is=D.rspack,Ve=D;export{Ue as a,D as b,As as c,Bs as d,Fs as e,Is as f,Ve as g,ce as h};
|
package/dist/chunk-OHZUHF4D.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isAbsolute as i,normalize as n,sep as s}from"path";function t(e){if(!e||i(e))throw new Error("cssFileName must be a non-empty relative path.");let r=n(e);if(r===".."||r.startsWith(`..${s}`))throw new Error("cssFileName must not escape the bundler output directory.");if(!r.endsWith(".css"))throw new Error("cssFileName must end in .css.");return r}function u(e){if(e.sourceRoots&&e.sourceRoots.some(a=>typeof a!="string"||!a.trim()))throw new Error("CSSX sourceRoots must contain non-empty file-system paths.");let r=e.debug;if(r===null||r!==void 0&&typeof r!="boolean"&&(typeof r!="object"||typeof r.reportFile!="string"||!r.reportFile))throw new Error("CSSX debug must be a boolean or an object with a reportFile path.");if(e.naming!==void 0&&!["serial","hash","source"].includes(e.naming))throw new Error('CSSX naming must be "serial", "hash", or "source".');if(e.coordination!==void 0&&!["memory","manifest"].includes(e.coordination))throw new Error('CSSX coordination must be "memory" or "manifest".');if(e.stableClassNames&&e.naming&&e.naming!=="source")throw new Error('CSSX stableClassNames selects source naming and conflicts with naming. Use naming: "source".');if(e.stableClassNames&&e.coordination==="manifest")throw new Error("CSSX stableClassNames already selects source naming; remove it to use manifest coordination.");if(e.naming==="hash"&&e.className?.variant==="serial")throw new Error('CSSX naming: "hash" conflicts with className.variant: "serial".');if(e.naming==="serial"&&e.className?.variant==="random")throw new Error('CSSX naming: "serial" conflicts with className.variant: "random".');if(e.coordination==="manifest"&&!e.manifestPath)throw new Error('CSSX coordination: "manifest" requires manifestPath.');if(e.manifestPath&&e.coordination!=="manifest")throw new Error('CSSX manifestPath requires coordination: "manifest".');if(e.coordination==="manifest"&&e.classNameAllocator)throw new Error("CSSX manifest coordination cannot use a custom classNameAllocator.");if(e.theme!==void 0&&e.themeFile!==void 0)throw new Error("CSSX accepts either theme or themeFile, not both.");if(e.layer!==void 0&&!/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(e.layer))throw new Error("CSSX layer must be a valid CSS layer identifier.");if(e.sourceMap!==void 0&&typeof e.sourceMap!="boolean")throw new Error("CSSX sourceMap must be a boolean.");if(e.darkMode!==void 0&&e.darkMode!=="media"&&e.darkMode!=="selector"&&e.darkMode!=="class")throw new Error('CSSX darkMode must be "media", "selector", or "class".');if(e.preflight!==void 0&&typeof e.preflight!="boolean")throw new Error("CSSX preflight must be a boolean.");if(e.reusabilityBudget!==void 0&&e.reusabilityBudget!=="auto"&&(!Number.isFinite(e.reusabilityBudget)||e.reusabilityBudget<0||e.reusabilityBudget>100))throw new Error('CSSX reusabilityBudget must be "auto" or a number from 0 through 100.');t(e.cssFileName??"cssx.css")}export{t as a,u as b};
|