@cssxio/unplugin 0.12.7 → 0.12.8
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/chunk-HUA4NDO4.js +2 -0
- package/dist/{chunk-62JIYM5O.js → chunk-IWTTGY7E.js} +2 -2
- package/dist/chunk-NLWD3KKU.js +1 -0
- package/dist/{chunk-S3ANSM4Z.js → chunk-ZA7ACSZ6.js} +1 -1
- package/dist/{create-universal-esbuild-hooks-S3KKZNCC.js → create-universal-esbuild-hooks-XELN6CKO.js} +1 -1
- package/dist/development-runtime.cjs +24 -24
- package/dist/development-runtime.d.cts +7 -4
- package/dist/development-runtime.d.ts +7 -4
- package/dist/development-runtime.js +16 -12
- package/dist/esbuild.js +1 -1
- package/dist/index.cjs +14 -18
- package/dist/index.js +1 -1
- package/dist/{next-development-server-CBPFB9EC.d.cts → next-development-server-BTTBlTzX.d.cts} +3 -1
- package/dist/{next-development-server-CBPFB9EC.d.ts → next-development-server-BTTBlTzX.d.ts} +3 -1
- package/dist/next-loader.cjs +8 -8
- package/dist/next-loader.d.cts +1 -1
- package/dist/next-loader.d.ts +1 -1
- package/dist/next-loader.js +4 -4
- package/dist/next.cjs +1 -1
- package/dist/next.js +1 -1
- package/dist/{project-scan-YVEBTZYG.js → project-scan-MKP323VI.js} +1 -1
- package/dist/rollup.cjs +12 -16
- package/dist/rollup.js +1 -1
- package/dist/rspack.cjs +12 -16
- package/dist/rspack.js +1 -1
- package/dist/transform-runtime.cjs +10 -10
- package/dist/transform-runtime.d.cts +1 -1
- package/dist/transform-runtime.d.ts +1 -1
- package/dist/transform-runtime.js +1 -1
- package/dist/unplugin-factory-runtime.cjs +12 -16
- package/dist/unplugin-factory-runtime.js +1 -1
- package/dist/vite.cjs +12 -16
- package/dist/vite.js +1 -1
- package/dist/webpack.cjs +12 -16
- package/dist/webpack.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CWWI6WAO.js +0 -2
- package/dist/chunk-DA6QPYFU.js +0 -5
- package/dist/chunk-JMBY6AVS.js +0 -1
- package/dist/chunk-RKOCEKYB.js +0 -1
- package/dist/development-coordinator-L7OXVERC.js +0 -1
- package/dist/next-development-server-4N4MIHLY.js +0 -1
|
@@ -2,8 +2,8 @@ import { C as CssxPluginOptions } from './options-BbhZj-Sb.cjs';
|
|
|
2
2
|
import { c as compileCssxStylesheet } from './compile-cssx-stylesheet-BC4-zPLW.cjs';
|
|
3
3
|
import { M as ModuleCssxData } from './module-cssx-data-C58vi376.cjs';
|
|
4
4
|
import { c as CssxStylesheet } from './stylesheet-types-DF-aQ6hZ.cjs';
|
|
5
|
-
import { N as NextDevelopmentHmrConnection } from './next-development-server-
|
|
6
|
-
export { p as publishNextDevelopmentStylesheet, s as startNextDevelopmentServer, a as stopNextDevelopmentServer, w as waitForNextDevelopmentStylesheet } from './next-development-server-
|
|
5
|
+
import { N as NextDevelopmentHmrConnection } from './next-development-server-BTTBlTzX.cjs';
|
|
6
|
+
export { p as publishNextDevelopmentStylesheet, s as startNextDevelopmentServer, a as stopNextDevelopmentServer, w as waitForNextDevelopmentServerBinding, b as waitForNextDevelopmentStylesheet } from './next-development-server-BTTBlTzX.cjs';
|
|
7
7
|
import { FSWatcher } from 'node:fs';
|
|
8
8
|
import '@cssxio/compiler';
|
|
9
9
|
|
|
@@ -88,7 +88,10 @@ declare function configureViteDevelopmentServer(server: ViteServerLike, configur
|
|
|
88
88
|
declare function compileViteDevelopmentStylesheet(configuration: ViteDevelopmentServerOptions): Promise<Awaited<ReturnType<typeof compileCssxStylesheet>>>;
|
|
89
89
|
|
|
90
90
|
/** Initializes the cached dev stylesheet and watches only directories with CSSX sources. */
|
|
91
|
-
declare function startDevelopmentCoordinator(root: string, styleSheetFile: string, options: CssxPluginOptions, connection: NextDevelopmentHmrConnection, isHandledByBundler?: (path: string) => boolean): Promise<() => void>;
|
|
91
|
+
declare function startDevelopmentCoordinator(root: string, styleSheetFile: string, options: CssxPluginOptions, connection: NextDevelopmentHmrConnection, isHandledByBundler?: (path: string) => boolean, recoverStartupFailure?: boolean): Promise<() => void>;
|
|
92
|
+
|
|
93
|
+
/** Starts or joins the single stylesheet coordinator for a Next.js app root. */
|
|
94
|
+
declare function ensureNextDevelopmentStylesheet(root: string, styleSheetFile: string, options: CssxPluginOptions): Promise<void>;
|
|
92
95
|
|
|
93
96
|
/** Settings needed to publish cached Rollup stylesheet metadata during watch mode. */
|
|
94
97
|
interface RollupDevelopmentNotifierOptions {
|
|
@@ -178,4 +181,4 @@ declare function createViteNativeSourceWatcher(onChange: (id: string) => void |
|
|
|
178
181
|
/** Creates the browser bridge that atomically replaces the Vite development stylesheet. */
|
|
179
182
|
declare function viteDevelopmentStylesheetHmr(cssFileName: string, baseUrl?: string): string;
|
|
180
183
|
|
|
181
|
-
export { compileCssxStylesheet, compileViteDevelopmentStylesheet, configureViteDevelopmentServer, connectViteStylesheetClient, createRollupDevelopmentNotifier, createRollupDevelopmentRuntime, createViteDevelopmentRuntime, createViteNativeSourceWatcher, cssWithSourceMapComment, nativeStylesheetHmr, nextDevelopmentStylesheetHmr, sendViteStyles, startDevelopmentCoordinator, viteDevelopmentStylesheetHmr };
|
|
184
|
+
export { compileCssxStylesheet, compileViteDevelopmentStylesheet, configureViteDevelopmentServer, connectViteStylesheetClient, createRollupDevelopmentNotifier, createRollupDevelopmentRuntime, createViteDevelopmentRuntime, createViteNativeSourceWatcher, cssWithSourceMapComment, ensureNextDevelopmentStylesheet, nativeStylesheetHmr, nextDevelopmentStylesheetHmr, sendViteStyles, startDevelopmentCoordinator, viteDevelopmentStylesheetHmr };
|
|
@@ -2,8 +2,8 @@ import { C as CssxPluginOptions } from './options-BbhZj-Sb.js';
|
|
|
2
2
|
import { c as compileCssxStylesheet } from './compile-cssx-stylesheet-CyrCVIOq.js';
|
|
3
3
|
import { M as ModuleCssxData } from './module-cssx-data-CeyCcQqm.js';
|
|
4
4
|
import { c as CssxStylesheet } from './stylesheet-types-DF-aQ6hZ.js';
|
|
5
|
-
import { N as NextDevelopmentHmrConnection } from './next-development-server-
|
|
6
|
-
export { p as publishNextDevelopmentStylesheet, s as startNextDevelopmentServer, a as stopNextDevelopmentServer, w as waitForNextDevelopmentStylesheet } from './next-development-server-
|
|
5
|
+
import { N as NextDevelopmentHmrConnection } from './next-development-server-BTTBlTzX.js';
|
|
6
|
+
export { p as publishNextDevelopmentStylesheet, s as startNextDevelopmentServer, a as stopNextDevelopmentServer, w as waitForNextDevelopmentServerBinding, b as waitForNextDevelopmentStylesheet } from './next-development-server-BTTBlTzX.js';
|
|
7
7
|
import { FSWatcher } from 'node:fs';
|
|
8
8
|
import '@cssxio/compiler';
|
|
9
9
|
|
|
@@ -88,7 +88,10 @@ declare function configureViteDevelopmentServer(server: ViteServerLike, configur
|
|
|
88
88
|
declare function compileViteDevelopmentStylesheet(configuration: ViteDevelopmentServerOptions): Promise<Awaited<ReturnType<typeof compileCssxStylesheet>>>;
|
|
89
89
|
|
|
90
90
|
/** Initializes the cached dev stylesheet and watches only directories with CSSX sources. */
|
|
91
|
-
declare function startDevelopmentCoordinator(root: string, styleSheetFile: string, options: CssxPluginOptions, connection: NextDevelopmentHmrConnection, isHandledByBundler?: (path: string) => boolean): Promise<() => void>;
|
|
91
|
+
declare function startDevelopmentCoordinator(root: string, styleSheetFile: string, options: CssxPluginOptions, connection: NextDevelopmentHmrConnection, isHandledByBundler?: (path: string) => boolean, recoverStartupFailure?: boolean): Promise<() => void>;
|
|
92
|
+
|
|
93
|
+
/** Starts or joins the single stylesheet coordinator for a Next.js app root. */
|
|
94
|
+
declare function ensureNextDevelopmentStylesheet(root: string, styleSheetFile: string, options: CssxPluginOptions): Promise<void>;
|
|
92
95
|
|
|
93
96
|
/** Settings needed to publish cached Rollup stylesheet metadata during watch mode. */
|
|
94
97
|
interface RollupDevelopmentNotifierOptions {
|
|
@@ -178,4 +181,4 @@ declare function createViteNativeSourceWatcher(onChange: (id: string) => void |
|
|
|
178
181
|
/** Creates the browser bridge that atomically replaces the Vite development stylesheet. */
|
|
179
182
|
declare function viteDevelopmentStylesheetHmr(cssFileName: string, baseUrl?: string): string;
|
|
180
183
|
|
|
181
|
-
export { compileCssxStylesheet, compileViteDevelopmentStylesheet, configureViteDevelopmentServer, connectViteStylesheetClient, createRollupDevelopmentNotifier, createRollupDevelopmentRuntime, createViteDevelopmentRuntime, createViteNativeSourceWatcher, cssWithSourceMapComment, nativeStylesheetHmr, nextDevelopmentStylesheetHmr, sendViteStyles, startDevelopmentCoordinator, viteDevelopmentStylesheetHmr };
|
|
184
|
+
export { compileCssxStylesheet, compileViteDevelopmentStylesheet, configureViteDevelopmentServer, connectViteStylesheetClient, createRollupDevelopmentNotifier, createRollupDevelopmentRuntime, createViteDevelopmentRuntime, createViteNativeSourceWatcher, cssWithSourceMapComment, ensureNextDevelopmentStylesheet, nativeStylesheetHmr, nextDevelopmentStylesheetHmr, sendViteStyles, startDevelopmentCoordinator, viteDevelopmentStylesheetHmr };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as O,b as le}from"./chunk-VSO4AWLZ.js";import{b as I,d as we,f as xe,g as q,h as Ce}from"./chunk-NLWD3KKU.js";import"./chunk-JFKLWSSR.js";import"./chunk-CUKIYXQD.js";import"./chunk-ZDJ2ZX5V.js";import{a as be}from"./chunk-6WHEMH4N.js";import"./chunk-P7NG4XOZ.js";import{a as L,b as Z,c as N}from"./chunk-IWTTGY7E.js";import"./chunk-6TMSHR6Z.js";import"./chunk-ERSPVOTN.js";import{c as He}from"./chunk-YYF5QU33.js";import{b as E,f as Se,i as Q}from"./chunk-ZCSG362J.js";import{a as ae}from"./chunk-3C3MRH6A.js";import"./chunk-SV3MUUMI.js";var De=new WeakMap;function ke(e){let t=De.get(e);return t||(t={revision:0,clients:new Set},De.set(e,t)),t}function Ee(e,t){e.write(`data: ${JSON.stringify(t)}
|
|
2
2
|
|
|
3
|
-
`)}function
|
|
3
|
+
`)}function de(e,t){let n=ke(e);t.setHeader("Content-Type","text/event-stream; charset=utf-8"),t.setHeader("Cache-Control","no-cache, no-transform"),t.setHeader("Connection","keep-alive"),n.clients.add(t),t.write(`: connected
|
|
4
4
|
|
|
5
|
-
`),
|
|
5
|
+
`),n.latest&&Ee(t,n.latest),t.on("close",()=>n.clients.delete(t))}function B(e,t){let n=ke(e),o={css:t,revision:Math.max(Date.now(),n.revision+1)};n.revision=o.revision,n.latest=o;for(let r of n.clients)Ee(r,o)}import{Buffer as ee}from"buffer";function ce(e,t){let n=JSON.stringify(`/${e.replaceAll("\\","/")}`),o=JSON.stringify(`${e.replaceAll("\\","/")}.events`);return`if (typeof document !== "undefined" && typeof EventSource !== "undefined") {
|
|
6
6
|
const key = "__cssxViteStylesheetHmr";
|
|
7
7
|
const state = globalThis[key] || (globalThis[key] = { installed: false, revision: 0, style: undefined, source: undefined, stylesheetLink: undefined });
|
|
8
8
|
if (!state.installed) {
|
|
9
9
|
state.installed = true;
|
|
10
|
-
const source = new EventSource(${
|
|
10
|
+
const source = new EventSource(${t===void 0?"import.meta.env.BASE_URL":JSON.stringify(t)} + ${o});
|
|
11
11
|
state.source = source;
|
|
12
12
|
source.onmessage = (event) => {
|
|
13
13
|
const payload = JSON.parse(event.data);
|
|
@@ -20,7 +20,7 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
20
20
|
style.textContent = payload.css;
|
|
21
21
|
const cachedLink = state.stylesheetLink;
|
|
22
22
|
const stylesheetLink = cachedLink?.isConnected ? cachedLink : [...document.querySelectorAll('link[rel="stylesheet"]')].find((link) =>
|
|
23
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${
|
|
23
|
+
new URL(link.href, document.baseURI).pathname.endsWith(${n}),
|
|
24
24
|
);
|
|
25
25
|
if (stylesheetLink) {
|
|
26
26
|
state.stylesheetLink = stylesheetLink;
|
|
@@ -33,7 +33,11 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
33
33
|
state.revision = payload.revision;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
}`}var pe=1024*1024,ye=4096,he=8,le="data-cssx-vite-hmr";function B(e,n){if(!e)return;if(Array.isArray(e)){for(let a=0;a+1<e.length;a+=2)if(String(e[a]).toLowerCase()===n)return e[a+1];return}return Object.entries(e).find(([a])=>a.toLowerCase()===n)?.[1]}function ge(e){if(!e)return e;if(Array.isArray(e)){let n=[];for(let s=0;s+1<e.length;s+=2){let a=String(e[s]);a.toLowerCase()!=="content-length"&&a.toLowerCase()!=="etag"&&n.push(e[s],e[s+1])}return n}return Object.fromEntries(Object.entries(e).filter(([n])=>n.toLowerCase()!=="content-length"&&n.toLowerCase()!=="etag"))}function ve(e,n,s="/"){if(e.includes(le))return e;let a=`<script ${le}>${G(n,s)}</script>`,t=/<\/body\s*>/i,f=/<\/html\s*>/i;return t.test(e)?e.replace(t,y=>`${a}${y}`):f.test(e)?e.replace(f,y=>`${a}${y}`):`${e}${a}`}function de(e,n="/"){let s=0;return(a,t,f)=>{let y=a.headers?.accept,p=Array.isArray(y)?y.join(","):y;if(a.method!=="GET"||!p?.includes("text/html")||s>=he){f();return}s++;let v=!1,c=()=>{v||(v=!0,s--)},w=t.write.bind(t),h=t.end.bind(t),C=t.writeHead?.bind(t),T=t.flushHeaders?.bind(t),H=[],b=0,R=!1,l=t.getHeader("content-type"),u=t.getHeader("content-encoding"),m=t.getHeader("content-length"),r=t.getHeader("etag"),o=()=>{t.headersSent!==!0&&(t.removeHeader("content-length"),t.removeHeader("etag"),m=void 0,r=void 0)};C&&(t.writeHead=((d,i,S)=>{let x=typeof i=="string"?S:i;l=B(x,"content-type")??t.getHeader("content-type"),u=B(x,"content-encoding")??t.getHeader("content-encoding"),m=B(x,"content-length")??t.getHeader("content-length"),r=B(x,"etag")??t.getHeader("etag");let O=String(l??"").toLowerCase().startsWith("text/html")&&u===void 0,_=O?ge(x):x;return O&&(o(),m=void 0,r=void 0),typeof i=="string"?C(d,i,_):C(d,_)})),T&&(t.flushHeaders=(()=>{l=t.getHeader("content-type"),u=t.getHeader("content-encoding"),m=t.getHeader("content-length"),r=t.getHeader("etag"),String(l??"").toLowerCase().startsWith("text/html")&&u===void 0&&o(),T()}));let g=()=>{for(let d of H)w(d);H.length=0,b=0},L=(d,i,S)=>{let x=typeof i=="string"?i:void 0,N=typeof d=="string"?I.from(d,x):I.from(d);return b+N.byteLength>pe||H.length>=ye?(R=!0,g(),c(),!1):(H.push(N),b+=N.byteLength,(typeof i=="function"?i:S)?.(),!0)};t.once("close",()=>{H.length=0,b=0,c()}),t.once("finish",c),t.write=((d,i,S)=>R?typeof i=="function"?w(d,i):w(d,i,S):L(d,i,S)?!0:typeof i=="function"?w(d,i):w(d,i,S)),t.end=((d,i,S)=>{let x=typeof i=="function"?i:S;if(R||d!==void 0&&!L(d,typeof i=="string"?i:void 0))return typeof i=="function"?h(d,i):h(d,i,S);let N=String(l??t.getHeader("content-type")??"").toLowerCase(),O=u??t.getHeader("content-encoding"),_=N.startsWith("text/html")&&O===void 0,$=I.concat(H,b);if(_){let Q=$.toString("utf8"),Z=ve(Q,e,n);Z!==Q&&!(t.headersSent===!0&&(m!==void 0||r!==void 0))&&($=I.from(Z),o())}return H.length=0,b=0,x?h($,x):h($)}),f()}}function K(e,n){let{cssFileName:s,sourceMap:a,rollupDataById:t}=n,f=ee(e.config.base,s),y=`${f}.events`,p=de(s,e.config.base??"/");e.watcher?.on("unlink",v=>{t.delete(k(v)),A({...n,root:e.config.root??process.cwd()}).then(c=>U(e,D(c,s))).catch(c=>{console.warn(`CSSX: Vite stylesheet update failed: ${c instanceof Error?c.message:String(c)}`)})}),e.middlewares.use((v,c,w)=>{let h=v.url?.split("?",1)[0];if(h===y){z(e,c);return}if(h!==f&&(h!==`${f}.map`||!a))return p(v,c,w);A({...n,root:e.config.root??process.cwd()}).then(C=>{if(h===`${f}.map`){c.setHeader("Content-Type","application/json; charset=utf-8"),c.setHeader("Cache-Control","no-store"),c.end(C.map?te(C.map,s):"");return}c.setHeader("Content-Type","text/css; charset=utf-8"),c.setHeader("Cache-Control","no-store"),c.end(D(C,s))}).catch(C=>{c.setHeader("Content-Type","text/plain; charset=utf-8"),c.end(C instanceof Error?C.message:"Unable to compile CSSX development stylesheet.")})})}async function A(e){let{options:n,rollupDataById:s,getTheme:a}=e,t=await a(),f=n.coordination==="manifest"?await ne(e.root??process.cwd(),n):[...s.values()];return M(f,t,n.layer,e.sourceMap,n.darkMode,n.preflight)}import{readFile as Se}from"fs/promises";import{resolve as xe}from"path";var we=64,ce=16*1024*1024,Ce=256;function ue(e){let n=0,s,a;return()=>e.isReady()?(n++,s||(s=new Promise(t=>setImmediate(t)).then(async()=>{let t=-1;do{t=n;let f=await e.getConnection();if(!f)return;let y=W(e.options),p=await M([...e.dataById.values()],await e.getTheme(),y.layer,e.sourceMap,y.darkMode,y.preflight),v=D(p,e.cssFileName);v!==a&&(await j(f,v),a=v)}while(t!==n)}).catch(t=>{console.warn(`CSSX: Rollup stylesheet update failed: ${t instanceof Error?t.message:String(t)}`)}).finally(()=>{s=void 0})),s):Promise.resolve()}function He(e){let n=xe(e.root,".cssx/rollup.css"),s=!1,a=!1,t,f,y=!0,p=new Map,v=0,c=new Map,w,h=l=>{let u=p.get(l);u&&(v-=u.size,p.delete(l))},C=l=>{if(typeof l=="string")return l.length*2;if(!l||typeof l!="object")return 0;let u=l,m=typeof u.code=="string"?u.code.length*2:0,r=u.map===void 0?0:(JSON.stringify(u.map)?.length??0)*2;return m+r},T=(l,u,m)=>{let r=C(m);if(r>ce){h(l);return}for(h(l);p.size>=we||v+r>ce;){let o=p.keys().next().value;if(o===void 0)break;h(o)}p.set(l,{sourceSignature:V(u),result:m,size:r}),v+=r},H=ue({...e,getConnection:()=>t,isReady:()=>a}),b=async l=>{let u=k(l),m=e.dataById.get(u);if(!(!y||!m?.cssOnlySignature))try{let r=await Se(u,"utf8");if(p.get(u)?.sourceSignature===V(r))return;let o=await e.transformSource(r,l),g=e.dataById.get(u);if(!g||g.cssOnlySignature!==m.cssOnlySignature){h(u);return}T(u,r,o),await H()}catch(r){r.code!=="ENOENT"&&console.warn(`CSSX: Rollup stylesheet update failed: ${r instanceof Error?r.message:String(r)}`)}},R=l=>{if(!y)return Promise.resolve();let u=k(l);return!c.has(u)&&c.size>=Ce?Promise.resolve():(c.set(u,l),w||(w=(async()=>{for(;y&&c.size>0;){let m=c.entries().next().value;if(!m)break;c.delete(m[0]),await b(m[1])}})().finally(()=>{w=void 0;let m=c.values().next().value;y&&m!==void 0&&R(m)})),w)};return{buildStart(){s||(s=!0,t=F(e.root,n),f=J(e.root,n,W(e.options),t),f.catch(l=>{console.warn(`CSSX: Rollup development coordinator failed: ${String(l)}`)}))},buildEnd(){a=!0},closeWatcher:async()=>{await f?.then(l=>l(),()=>{}),y=!1,c.clear(),p.clear(),v=0,t&&X(e.root),t=void 0,f=void 0,s=!1,a=!1},getConnection:()=>t,takePrepared(l,u){let m=k(l),r=p.get(m);return!r||r.sourceSignature!==V(u)?{handled:!1}:(h(m),{handled:!0,result:r.result})},onTransformed(l){h(k(l))},async delete(l){let u=k(l);h(u),await se(e.root,u,W(e.options),null)},updateCssOnlySource:R,notifyStyles:()=>H()}}import{readFile as ke}from"fs/promises";var be=64,fe=256,Re=4;function Le(e,n,s,a){let t=new Map,f=new Map,y=[],p=!0,v=0,c=0,w,h,C=!1,T=(r,o)=>{if(t.size>=be&&!t.has(r)){let g=t.keys().next().value;g!==void 0&&t.delete(g)}t.set(r,o)},H=e.watcher?q(r=>{u(r)}):void 0,b=async r=>{v>=Re?await new Promise(o=>y.push(o)):v++;try{return await r()}finally{let o=y.shift();o?o():v--}},R=()=>p?(c++,w||(w=(async()=>{let r=-1;do{r=c;try{let o=await A(n),g=D(o,n.cssFileName);g!==h&&(U(e,g),h=g)}catch(o){console.warn(`CSSX: Vite stylesheet update failed: ${o instanceof Error?o.message:String(o)}`)}}while(p&&r!==c)})().finally(()=>{w=void 0})),w):Promise.resolve(),l=async(r,o,g,L)=>{let d=s.get(o)?.cssOnlySignature;if(!(!p||!d))try{let i=L??await ke(o,"utf8"),S=V(i);if(!p)return;if(g===S||t.get(o)===S)return{sourceId:S,handled:!0};let x=s.get(o);return await a(i,r),s.get(o)?.cssOnlySignature!==d?(t.delete(o),x&&s.set(o,x),{sourceId:S,handled:!1}):(T(o,S),await R(),{sourceId:S,handled:!0})}catch(i){t.delete(o),console.warn(`CSSX: Vite stylesheet update failed: ${i instanceof Error?i.message:String(i)}`);return}},u=(r,o)=>{let g=k(r),L=f.get(g);if(L)return L.rerun=!0,o!==void 0&&(L.source=o),L.promise;if(f.size>=fe)return C||(C=!0,console.warn(`CSSX: Vite stylesheet update queue reached the ${fe}-path limit.`)),Promise.resolve(!1);let d={promise:Promise.resolve(!1),rerun:!1,source:o};return d.promise=(async()=>{let i=!1;do{if(d.rerun=!1,!p)return i;let S=d.source;d.source=void 0;let x=await b(()=>l(r,g,d.sourceId,S));x!==void 0?(d.sourceId=x.sourceId,i=x.handled):i=!1}while(p&&d.rerun);return i})().finally(()=>{f.delete(g)}),f.set(g,d),d.promise},m=()=>{p=!1,H?.close(),t.clear(),f.clear()};return e.watcher?.on("close",m),K(e,n),{close:m,delete(r){let o=k(r);t.delete(o),H?.unwatch(o)},isActive:()=>p,isPrepared:(r,o)=>t.get(k(r))===V(o),notifyStyles:R,onTransformed(r,o){let g=s.get(k(r));g&&re(g)?(T(k(r),V(o)),H?.watch(r)):(t.delete(k(r)),H?.unwatch(r))},updateCssOnlySource:u}}import{basename as De}from"path";function Y(e,n){let s=JSON.stringify(`http://127.0.0.1:${e.port}/${e.token}`),a=JSON.stringify(n?`/${De(n)}`:"");return`if (typeof document !== "undefined") {
|
|
36
|
+
}`}var Je=1024*1024,Ge=4096,ze=8,Pe="data-cssx-vite-hmr";function te(e,t){if(!e)return;if(Array.isArray(e)){for(let o=0;o+1<e.length;o+=2)if(String(e[o]).toLowerCase()===t)return e[o+1];return}return Object.entries(e).find(([o])=>o.toLowerCase()===t)?.[1]}function Ke(e){if(!e)return e;if(Array.isArray(e)){let t=[];for(let n=0;n+1<e.length;n+=2){let o=String(e[n]);o.toLowerCase()!=="content-length"&&o.toLowerCase()!=="etag"&&t.push(e[n],e[n+1])}return t}return Object.fromEntries(Object.entries(e).filter(([t])=>t.toLowerCase()!=="content-length"&&t.toLowerCase()!=="etag"))}function Ye(e,t,n="/"){if(e.includes(Pe))return e;let o=`<script ${Pe}>${ce(t,n)}</script>`,r=/<\/body\s*>/i,s=/<\/html\s*>/i;return r.test(e)?e.replace(r,i=>`${o}${i}`):s.test(e)?e.replace(s,i=>`${o}${i}`):`${e}${o}`}function Ne(e,t="/"){let n=0;return(o,r,s)=>{let i=o.headers?.accept,f=Array.isArray(i)?i.join(","):i;if(o.method!=="GET"||!f?.includes("text/html")||n>=ze){s();return}n++;let d=!1,p=()=>{d||(d=!0,n--)},c=r.write.bind(r),S=r.end.bind(r),y=r.writeHead?.bind(r),a=r.flushHeaders?.bind(r),w=[],D=0,x=!1,u=r.getHeader("content-type"),g=r.getHeader("content-encoding"),C=r.getHeader("content-length"),l=r.getHeader("etag"),m=()=>{r.headersSent!==!0&&(r.removeHeader("content-length"),r.removeHeader("etag"),C=void 0,l=void 0)};y&&(r.writeHead=((v,h,H)=>{let k=typeof h=="string"?H:h;u=te(k,"content-type")??r.getHeader("content-type"),g=te(k,"content-encoding")??r.getHeader("content-encoding"),C=te(k,"content-length")??r.getHeader("content-length"),l=te(k,"etag")??r.getHeader("etag");let X=String(u??"").toLowerCase().startsWith("text/html")&&g===void 0,K=X?Ke(k):k;return X&&(m(),C=void 0,l=void 0),typeof h=="string"?y(v,h,K):y(v,K)})),a&&(r.flushHeaders=(()=>{u=r.getHeader("content-type"),g=r.getHeader("content-encoding"),C=r.getHeader("content-length"),l=r.getHeader("etag"),String(u??"").toLowerCase().startsWith("text/html")&&g===void 0&&m(),a()}));let b=()=>{for(let v of w)c(v);w.length=0,D=0},$=(v,h,H)=>{let k=typeof h=="string"?h:void 0,V=typeof v=="string"?ee.from(v,k):ee.from(v);return D+V.byteLength>Je||w.length>=Ge?(x=!0,b(),p(),!1):(w.push(V),D+=V.byteLength,(typeof h=="function"?h:H)?.(),!0)};r.once("close",()=>{w.length=0,D=0,p()}),r.once("finish",p),r.write=((v,h,H)=>x?typeof h=="function"?c(v,h):c(v,h,H):$(v,h,H)?!0:typeof h=="function"?c(v,h):c(v,h,H)),r.end=((v,h,H)=>{let k=typeof h=="function"?h:H;if(x||v!==void 0&&!$(v,typeof h=="string"?h:void 0))return typeof h=="function"?S(v,h):S(v,h,H);let V=String(u??r.getHeader("content-type")??"").toLowerCase(),X=g??r.getHeader("content-encoding"),K=V.startsWith("text/html")&&X===void 0,Y=ee.concat(w,D);if(K){let ge=Y.toString("utf8"),ve=Ye(ge,e,t);ve!==ge&&!(r.headersSent===!0&&(C!==void 0||l!==void 0))&&(Y=ee.from(ve),m())}return w.length=0,D=0,k?S(Y,k):S(Y)}),s()}}function ue(e,t){let{cssFileName:n,sourceMap:o,rollupDataById:r}=t,s=Se(e.config.base,n),i=`${s}.events`,f=Ne(n,e.config.base??"/");e.watcher?.on("unlink",d=>{r.delete(E(d)),W({...t,root:e.config.root??process.cwd()}).then(p=>B(e,N(p,n))).catch(p=>{console.warn(`CSSX: Vite stylesheet update failed: ${p instanceof Error?p.message:String(p)}`)})}),e.middlewares.use((d,p,c)=>{let S=d.url?.split("?",1)[0];if(S===i){de(e,p);return}if(S!==s&&(S!==`${s}.map`||!o))return f(d,p,c);W({...t,root:e.config.root??process.cwd()}).then(y=>{if(S===`${s}.map`){p.setHeader("Content-Type","application/json; charset=utf-8"),p.setHeader("Cache-Control","no-store"),p.end(y.map?Z(y.map,n):"");return}p.setHeader("Content-Type","text/css; charset=utf-8"),p.setHeader("Cache-Control","no-store"),p.end(N(y,n))}).catch(y=>{p.setHeader("Content-Type","text/plain; charset=utf-8"),p.end(y instanceof Error?y.message:"Unable to compile CSSX development stylesheet.")})})}async function W(e){let{options:t,rollupDataById:n,getTheme:o}=e,r=await o(),s=t.coordination==="manifest"?await I(e.root??process.cwd(),t):[...n.values()];return L(s,r,t.layer,e.sourceMap,t.darkMode,t.preflight)}import{randomUUID as ot}from"crypto";import{mkdir as st,readFile as it,rename as at,unlink as lt,writeFile as dt}from"fs/promises";import{dirname as ct,resolve as ut}from"path";import{Buffer as Re}from"buffer";import{mkdirSync as Qe}from"fs";import{readFile as ne}from"fs/promises";import{createServer as Ze}from"http";import{dirname as qe,resolve as M}from"path";var A=new Map,F=new Map,et=64;function _(e,t){let n=M(e),o=A.get(n);if(o)return o.references++,o.connection;let r=be(n,t),s=new Set,i=M(t);Qe(qe(i),{recursive:!0});let f,d,p=new Promise((y,a)=>{f=y,d=a});p.catch(()=>{});let c={connection:r,projectRoot:n,stylesheetFile:i,revision:0,ready:!1,binding:"pending",bindingPromise:p,resolveBinding:f,rejectBinding:d,startupPhase:"transport binding",clients:s,blockedClients:new Map,references:1},S=Ze((y,a)=>{let w=new URL(y.url??"/","http://127.0.0.1").pathname,D=`/${r.token}`;if(y.method==="OPTIONS"){a.writeHead(204,P()),a.end();return}if(y.method==="POST"&&w===`${D}/publish`){$e(y).then(x=>y.headers["x-cssx-inline"]==="1"?x:ne(i,"utf8")).then(x=>{Oe(c,x),a.writeHead(204,P()),a.end()},()=>{a.writeHead(503,P()),a.end()});return}if(y.method==="POST"&&w===`${D}/status`){$e(y).then(x=>{try{let u=JSON.parse(x);c.startupPhase=typeof u.phase=="string"?u.phase:c.startupPhase,c.startupError=typeof u.error=="string"?u.error:void 0,a.writeHead(204,P()),a.end()}catch{a.writeHead(400,P()),a.end()}},()=>{a.writeHead(400,P()),a.end()});return}if(y.method==="GET"&&w===`${D}/ready`){let x=nt(c),u=x.state==="ready"?200:x.state==="failed"?500:503;a.writeHead(u,{...P(),"Content-Type":"application/json; charset=utf-8"}),a.end(JSON.stringify(x));return}if(y.method==="GET"&&w===`${D}/events`){if(s.size>=et){a.writeHead(503,{...P(),"Retry-After":"1"}),a.end();return}a.writeHead(200,{...P(),"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"}),s.add(a),Ae(c,a),y.on("close",()=>{s.delete(a),c.blockedClients.delete(a)});return}if(y.method==="GET"&&w===`${D}/stylesheet`){(c.latestCss===void 0?ne(i,"utf8"):Promise.resolve(c.latestCss)).then(x=>{a.writeHead(200,{...P(),"Content-Type":"text/css; charset=utf-8","Cache-Control":"no-store"}),a.end(x)},()=>{a.writeHead(503,{...P(),"Cache-Control":"no-store"}),a.end("CSSX development stylesheet is not ready.")});return}if(y.method==="GET"&&w===`${D}/generated.css.map`){ne(`${i}.map`,"utf8").then(x=>{a.writeHead(200,{...P(),"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),a.end(x)},()=>{a.writeHead(404,P()),a.end()});return}a.writeHead(404,P()),a.end()});return S.on("error",y=>{if(c.binding==="pending"){if(y.code==="EADDRINUSE"){rt(c);return}fe(c,new Error(Ve(c,y)))}}),c.server=S,S.once("listening",()=>{if(c.binding!=="pending"){J(S);return}c.binding="owner",c.resolveBinding("owner")}),S.listen(r.port,"127.0.0.1"),S.unref(),A.set(n,c),F.set(G(r),c),r}function pe(e){let t=A.get(M(e));if(t){if(t.references>1){t.references--;return}for(let n of t.clients)n.end();t.blockedClients.clear(),t.binding==="pending"?fe(t,new Error(`CSSX development stylesheet transport for ${t.projectRoot} was stopped.`)):J(t.server),A.delete(M(e)),F.delete(G(t.connection))}}async function oe(e){let t=A.get(M(e));if(!t)throw new Error(`CSSX development stylesheet transport was not started for ${M(e)}.`);return t.bindingPromise}function Le(e,t){let n=M(e),o=A.get(n);return o&&o.binding!=="remote"&&o.binding!=="failed"?o.connection:(o&&(J(o.server),A.delete(n),F.delete(G(o.connection))),_(n,t))}async function j(e,t,n){let o=F.get(G(e));if(o?.binding==="owner"){o.startupPhase=t,o.startupError=n===void 0?void 0:re(n);return}let r=await fetch(`http://127.0.0.1:${e.port}/${e.token}/status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phase:t,...n===void 0?{}:{error:re(n)}}),signal:AbortSignal.timeout(1e3)});if(r.status!==204)throw new Error(`CSSX could not report development startup status (HTTP ${r.status}).`)}async function me(e){let n=await(await fetch(`http://127.0.0.1:${e.port}/${e.token}/ready`,{cache:"no-store",signal:AbortSignal.timeout(1e3)})).json();if(!Me(n))throw new Error(`CSSX development stylesheet endpoint on port ${e.port} returned an invalid status.`);return n}async function U(e,t){let n=F.get(G(e));if(n){if(await n.bindingPromise==="remote")return Te(e,t);let r=t??await ne(n.stylesheetFile,"utf8");Oe(n,r);return}return Te(e,t)}async function Te(e,t){let n=`http://127.0.0.1:${e.port}/${e.token}/publish`,o={method:"POST",...t===void 0?{}:{body:t,headers:{"X-CSSX-Inline":"1"}},signal:AbortSignal.timeout(1e3)},r;for(let s=0;s<20;s++){try{let i=await fetch(n,o);if(i.status===204)return;r=new Error(`Unexpected HTTP status ${i.status}.`)}catch(i){r=i}await new Promise(i=>setTimeout(i,25))}throw new Error(`CSSX development stylesheet transport did not become available: ${String(r)}`)}function $e(e){return new Promise((t,n)=>{let o=[];e.on("data",r=>o.push(Re.from(r))),e.on("end",()=>t(Re.concat(o).toString("utf8"))),e.on("aborted",()=>n(new Error("CSSX development request body was aborted."))),e.on("error",n)})}async function tt(e){let t=`http://127.0.0.1:${e.port}/${e.token}/ready`,n=Date.now()+3e4,o="the transport did not return a status";for(let r=0;r<300&&Date.now()<n;r++){try{let s=await fetch(t,{cache:"no-store",signal:AbortSignal.timeout(1e3)});if(s.ok)return;if(s.status===500){let i=await s.json();throw new Error(`CSSX stylesheet startup failed during ${i.phase??"startup"}: ${i.error??"unknown error"}`)}o=`HTTP ${s.status}`}catch(s){if(s instanceof Error&&s.message.startsWith("CSSX stylesheet startup failed"))throw s;o=re(s)}await new Promise(s=>setTimeout(s,100))}throw new Error(`CSSX Next.js development stylesheet did not become ready within 30 seconds (last error: ${o}).`)}function Oe(e,t){if(e.ready&&e.latestCss===t)return;e.revision++,e.ready=!0,e.startupPhase="ready",e.startupError=void 0,e.latestCss=t;let n=`data: ${JSON.stringify({revision:e.revision,css:t})}
|
|
37
|
+
|
|
38
|
+
`;for(let o of e.clients)Ue(e,o,n)}function nt(e){return{protocol:1,root:e.projectRoot,stylesheetFile:e.stylesheetFile,state:e.ready?"ready":e.startupError?"failed":"starting",phase:e.startupPhase,...e.startupError?{error:e.startupError}:{}}}async function rt(e){let t;for(let n=0;n<3;n++)try{let r=await(await fetch(`http://127.0.0.1:${e.connection.port}/${e.connection.token}/ready`,{cache:"no-store",signal:AbortSignal.timeout(500)})).json();if(!Me(r))throw new Error("the endpoint did not identify itself as a CSSX stylesheet transport");if(r.root!==e.projectRoot||r.stylesheetFile!==e.stylesheetFile)throw new Error(`the endpoint belongs to ${r.root} and ${r.stylesheetFile}`);J(e.server),e.server=void 0,e.binding="remote",e.resolveBinding("remote");return}catch(o){t=o,n<2&&await new Promise(r=>setTimeout(r,25))}fe(e,new Error(Ve(e,t)))}function fe(e,t){e.binding="failed",e.bindingError=t,J(e.server),e.server=void 0,e.rejectBinding(t),console.warn(t.message)}function Ve(e,t){return`CSSX development stylesheet transport for ${e.projectRoot} could not own port ${e.connection.port}: ${re(t)}`}function J(e){if(e)try{e.close()}catch{}}function re(e){return e instanceof Error?e.message:String(e)}function Me(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.protocol===1&&typeof t.root=="string"&&typeof t.stylesheetFile=="string"&&(t.state==="starting"||t.state==="ready"||t.state==="failed")&&typeof t.phase=="string"&&(t.error===void 0||typeof t.error=="string")}function Ae(e,t){Ue(e,t,`data: ${JSON.stringify({revision:e.revision,css:e.latestCss})}
|
|
39
|
+
|
|
40
|
+
`)}function Ue(e,t,n){if(e.blockedClients.has(t)||t.write(n))return;let o=e.revision;e.blockedClients.set(t,o),t.once("drain",()=>{e.blockedClients.delete(t),e.clients.has(t)&&e.revision>o&&Ae(e,t)})}function G(e){return`${e.port}:${e.token}`}function P(){return{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, X-CSSX-Inline"}}var se=new Map;function z(e,t,n,o,r,s=!1){let i=ut(e),f=se.get(i);if(f)return f;let d=(async()=>{xe(i,n);let p,c,S=async a=>{try{if(c===void 0){let u=await I(i,n),g=await _e(i,t,n,u);await U(o,g),c=g;return}let w=await ae(n,i),D=await L(a,w,n.layer,n.sourceMap,n.darkMode,n.preflight),x=N(D,"generated.css");x!==c&&(await U(o,x),c=x)}catch(w){throw s&&c===void 0&&await j(o,"initial stylesheet compilation",w).catch(()=>{}),w}},y="initial source scan";try{s&&await j(o,y).catch(()=>{});let a=await I(i,n);y="initial stylesheet compilation";let w=await _e(i,t,n,a);await U(o,w),c=w}catch(a){if(s&&await j(o,y,a).catch(()=>{}),!s)throw q(i,n),a}try{p=await Ce(i,n,S,r,s&&c===void 0);let a=!1;return()=>{a||(a=!0,p?.(),q(i,n),se.delete(i))}}catch(a){throw p?.(),q(i,n),a}})();return se.set(i,d),d.catch(p=>{console.warn(`CSSX: Next development coordinator could not start: ${p instanceof Error?p.message:String(p)}`),se.delete(i)}),d}async function _e(e,t,n,o){let r=await ae(n,e),s=await L(o,r,n.layer,n.sourceMap,n.darkMode,n.preflight);await st(ct(t),{recursive:!0});let i=N(s,"generated.css");return await je(t,i),s.map&&await je(`${t}.map`,Z(s.map,"generated.css")),i}async function je(e,t){try{if(await it(e,"utf8")===t)return!1}catch(o){if(o.code!=="ENOENT")throw o}let n=`${e}.${process.pid}.${ot()}.tmp`;try{return await dt(n,t),await at(n,e),!0}catch(o){throw await lt(n).catch(()=>{}),o}}import{resolve as Xe}from"path";var ie=new Map,he=new Map;function pt(e,t,n){let o=Xe(e),r=ie.get(o);if(r)return r;let s=mt(o,Xe(t),n);return ie.set(o,s),s.then(()=>ie.delete(o),()=>ie.delete(o)),s}async function mt(e,t,n){let o=Date.now()+3e4,r="transport ownership",s="the transport did not return a status",i=he.get(e);for(i||(i=_(e,t),he.set(e,i));Date.now()<o;){try{let f=await oe(e);r="stylesheet readiness";let d=await me(i);if(d.root!==e||d.stylesheetFile!==t)throw new Error(`CSSX endpoint identity mismatch: expected ${e} and ${t}, received ${d.root} and ${d.stylesheetFile}.`);if(d.state==="ready")return;if(d.state==="failed")throw new Error(`CSSX Next.js stylesheet startup failed during ${d.phase}: ${d.error??"unknown error"}`);if(f==="owner"){if(r="initial source scan",await Ie(e,t,n,i),d=await me(i),d.state==="ready")return;if(d.state==="failed")throw new Error(`CSSX Next.js stylesheet startup failed during ${d.phase}: ${d.error??"unknown error"}`)}s=`startup remains in phase ${d.phase}`}catch(f){if(f instanceof Error&&f.message.startsWith("CSSX Next.js stylesheet startup failed"))throw f;s=f instanceof Error?f.message:String(f),r="transport reconnection",i=Le(e,t),he.set(e,i);try{await oe(e)==="owner"&&(r="initial source scan",await Ie(e,t,n,i))}catch(d){if(s=d instanceof Error?d.message:String(d),s.includes("could not own port"))throw d}}await new Promise(f=>setTimeout(f,100))}throw new Error(`CSSX Next.js development stylesheet did not become ready within 30 seconds (last phase: ${r}; last error: ${s}).`)}async function Ie(e,t,n,o){try{await z(e,t,n,o,void 0,!0)}catch(r){await j(o,"watcher setup",r).catch(()=>{});let s=r instanceof Error?r.message:String(r);throw new Error(`CSSX Next.js stylesheet startup failed during watcher setup: ${s}`,{cause:r})}}import{readFile as ft}from"fs/promises";import{resolve as ht}from"path";var yt=64,Be=16*1024*1024,gt=256;function We(e){let t=0,n,o;return()=>e.isReady()?(t++,n||(n=new Promise(r=>setImmediate(r)).then(async()=>{let r=-1;do{r=t;let s=await e.getConnection();if(!s)return;let i=Q(e.options),f=await L([...e.dataById.values()],await e.getTheme(),i.layer,e.sourceMap,i.darkMode,i.preflight),d=N(f,e.cssFileName);d!==o&&(await U(s,d),o=d)}while(r!==t)}).catch(r=>{console.warn(`CSSX: Rollup stylesheet update failed: ${r instanceof Error?r.message:String(r)}`)}).finally(()=>{n=void 0})),n):Promise.resolve()}function vt(e){let t=ht(e.root,".cssx/rollup.css"),n=!1,o=!1,r,s,i=!0,f=new Map,d=0,p=new Map,c,S=u=>{let g=f.get(u);g&&(d-=g.size,f.delete(u))},y=u=>{if(typeof u=="string")return u.length*2;if(!u||typeof u!="object")return 0;let g=u,C=typeof g.code=="string"?g.code.length*2:0,l=g.map===void 0?0:(JSON.stringify(g.map)?.length??0)*2;return C+l},a=(u,g,C)=>{let l=y(C);if(l>Be){S(u);return}for(S(u);f.size>=yt||d+l>Be;){let m=f.keys().next().value;if(m===void 0)break;S(m)}f.set(u,{sourceSignature:O(g),result:C,size:l}),d+=l},w=We({...e,getConnection:()=>r,isReady:()=>o}),D=async u=>{let g=E(u),C=e.dataById.get(g);if(!(!i||!C?.cssOnlySignature))try{let l=await ft(g,"utf8");if(f.get(g)?.sourceSignature===O(l))return;let m=await e.transformSource(l,u),b=e.dataById.get(g);if(!b||b.cssOnlySignature!==C.cssOnlySignature){S(g);return}a(g,l,m),await w()}catch(l){l.code!=="ENOENT"&&console.warn(`CSSX: Rollup stylesheet update failed: ${l instanceof Error?l.message:String(l)}`)}},x=u=>{if(!i)return Promise.resolve();let g=E(u);return!p.has(g)&&p.size>=gt?Promise.resolve():(p.set(g,u),c||(c=(async()=>{for(;i&&p.size>0;){let C=p.entries().next().value;if(!C)break;p.delete(C[0]),await D(C[1])}})().finally(()=>{c=void 0;let C=p.values().next().value;i&&C!==void 0&&x(C)})),c)};return{buildStart(){n||(n=!0,r=_(e.root,t),s=z(e.root,t,Q(e.options),r),s.catch(u=>{console.warn(`CSSX: Rollup development coordinator failed: ${String(u)}`)}))},buildEnd(){o=!0},closeWatcher:async()=>{await s?.then(u=>u(),()=>{}),i=!1,p.clear(),f.clear(),d=0,r&&pe(e.root),r=void 0,s=void 0,n=!1,o=!1},getConnection:()=>r,takePrepared(u,g){let C=E(u),l=f.get(C);return!l||l.sourceSignature!==O(g)?{handled:!1}:(S(C),{handled:!0,result:l.result})},onTransformed(u){S(E(u))},async delete(u){let g=E(u);S(g),await we(e.root,g,Q(e.options),null)},updateCssOnlySource:x,notifyStyles:()=>w()}}import{readFile as St}from"fs/promises";var wt=64,Fe=256,xt=4;function Ct(e,t,n,o){let r=new Map,s=new Map,i=[],f=!0,d=0,p=0,c,S,y=!1,a=(l,m)=>{if(r.size>=wt&&!r.has(l)){let b=r.keys().next().value;b!==void 0&&r.delete(b)}r.set(l,m)},w=e.watcher?le(l=>{g(l)}):void 0,D=async l=>{d>=xt?await new Promise(m=>i.push(m)):d++;try{return await l()}finally{let m=i.shift();m?m():d--}},x=()=>f?(p++,c||(c=(async()=>{let l=-1;do{l=p;try{let m=await W(t),b=N(m,t.cssFileName);b!==S&&(B(e,b),S=b)}catch(m){console.warn(`CSSX: Vite stylesheet update failed: ${m instanceof Error?m.message:String(m)}`)}}while(f&&l!==p)})().finally(()=>{c=void 0})),c):Promise.resolve(),u=async(l,m,b,$)=>{let v=n.get(m)?.cssOnlySignature;if(!(!f||!v))try{let h=$??await St(m,"utf8"),H=O(h);if(!f)return;if(b===H||r.get(m)===H)return{sourceId:H,handled:!0};let k=n.get(m);return await o(h,l),n.get(m)?.cssOnlySignature!==v?(r.delete(m),k&&n.set(m,k),{sourceId:H,handled:!1}):(a(m,H),await x(),{sourceId:H,handled:!0})}catch(h){r.delete(m),console.warn(`CSSX: Vite stylesheet update failed: ${h instanceof Error?h.message:String(h)}`);return}},g=(l,m)=>{let b=E(l),$=s.get(b);if($)return $.rerun=!0,m!==void 0&&($.source=m),$.promise;if(s.size>=Fe)return y||(y=!0,console.warn(`CSSX: Vite stylesheet update queue reached the ${Fe}-path limit.`)),Promise.resolve(!1);let v={promise:Promise.resolve(!1),rerun:!1,source:m};return v.promise=(async()=>{let h=!1;do{if(v.rerun=!1,!f)return h;let H=v.source;v.source=void 0;let k=await D(()=>u(l,b,v.sourceId,H));k!==void 0?(v.sourceId=k.sourceId,h=k.handled):h=!1}while(f&&v.rerun);return h})().finally(()=>{s.delete(b)}),s.set(b,v),v.promise},C=()=>{f=!1,w?.close(),r.clear(),s.clear()};return e.watcher?.on("close",C),ue(e,t),{close:C,delete(l){let m=E(l);r.delete(m),w?.unwatch(m)},isActive:()=>f,isPrepared:(l,m)=>r.get(E(l))===O(m),notifyStyles:x,onTransformed(l,m){let b=n.get(E(l));b&&He(b)?(a(E(l),O(m)),w?.watch(l)):(r.delete(E(l)),w?.unwatch(l))},updateCssOnlySource:g}}import{basename as bt}from"path";function ye(e,t){let n=JSON.stringify(`http://127.0.0.1:${e.port}/${e.token}`),o=JSON.stringify(t?`/${bt(t)}`:"");return`if (typeof document !== "undefined") {
|
|
37
41
|
const key = "__cssxDevelopmentStylesheetHmr";
|
|
38
42
|
const state = globalThis[key] || (globalThis[key] = { installed: false, revision: -1, style: undefined });
|
|
39
43
|
if (!state.installed) {
|
|
@@ -49,7 +53,7 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
49
53
|
try {
|
|
50
54
|
let css = pushedCss;
|
|
51
55
|
if (css === undefined) {
|
|
52
|
-
const response = await fetch(${
|
|
56
|
+
const response = await fetch(${n} + "/stylesheet?revision=" + revision, { cache: "no-store" });
|
|
53
57
|
if (!response.ok) return;
|
|
54
58
|
css = await response.text();
|
|
55
59
|
}
|
|
@@ -89,8 +93,8 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
89
93
|
style.dataset.cssxDevelopmentStylesheet = "";
|
|
90
94
|
style.textContent = css;
|
|
91
95
|
const cachedLink = state.stylesheetLink;
|
|
92
|
-
const stylesheetLink = ${
|
|
93
|
-
new URL(link.href, document.baseURI).pathname.endsWith(${
|
|
96
|
+
const stylesheetLink = ${o} ? (cachedLink?.isConnected ? cachedLink : [...document.querySelectorAll('link[rel="stylesheet"]')].find((link) =>
|
|
97
|
+
new URL(link.href, document.baseURI).pathname.endsWith(${o}),
|
|
94
98
|
)) : undefined;
|
|
95
99
|
if (stylesheetLink) {
|
|
96
100
|
state.stylesheetLink = stylesheetLink;
|
|
@@ -109,7 +113,7 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
109
113
|
if (pending !== undefined && pending.revision > state.revision) void state.refresh(pending.revision, pending.css);
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
|
-
state.events = new EventSource(${
|
|
116
|
+
state.events = new EventSource(${n} + "/events");
|
|
113
117
|
state.events.onmessage = (event) => {
|
|
114
118
|
try {
|
|
115
119
|
const message = JSON.parse(event.data);
|
|
@@ -119,7 +123,7 @@ import{a as J}from"./chunk-JMBY6AVS.js";import{a as F,b as X,c as j,d as me}from
|
|
|
119
123
|
} catch {}
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
|
-
}`}function
|
|
126
|
+
}`}function Ht(e,t,n){return n?ye(n,e):`/* CSSX development stylesheet revision: ${t} */
|
|
123
127
|
if (typeof document !== "undefined" && typeof module !== "undefined" && module.hot) {
|
|
124
128
|
const key = "__cssxStylesheetHmr";
|
|
125
129
|
const state = globalThis[key] || (globalThis[key] = { revision: 0, staged: [], replacements: [] });
|
|
@@ -193,4 +197,4 @@ if (typeof document !== "undefined" && typeof module !== "undefined" && module.h
|
|
|
193
197
|
}
|
|
194
198
|
if (stylesheetLink) state.removeOnLoad = Boolean(nextLink);
|
|
195
199
|
}
|
|
196
|
-
}`}export{
|
|
200
|
+
}`}export{L as compileCssxStylesheet,W as compileViteDevelopmentStylesheet,ue as configureViteDevelopmentServer,de as connectViteStylesheetClient,We as createRollupDevelopmentNotifier,vt as createRollupDevelopmentRuntime,Ct as createViteDevelopmentRuntime,le as createViteNativeSourceWatcher,N as cssWithSourceMapComment,pt as ensureNextDevelopmentStylesheet,Ht as nativeStylesheetHmr,ye as nextDevelopmentStylesheetHmr,U as publishNextDevelopmentStylesheet,B as sendViteStyles,z as startDevelopmentCoordinator,_ as startNextDevelopmentServer,pe as stopNextDevelopmentServer,ce as viteDevelopmentStylesheetHmr,oe as waitForNextDevelopmentServerBinding,tt as waitForNextDevelopmentStylesheet};
|
package/dist/esbuild.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-ZA7ACSZ6.js";import"./chunk-VSO4AWLZ.js";import"./chunk-NLWD3KKU.js";import"./chunk-JFKLWSSR.js";import"./chunk-CUKIYXQD.js";import"./chunk-ZDJ2ZX5V.js";import"./chunk-P7NG4XOZ.js";import"./chunk-IWTTGY7E.js";import"./chunk-6TMSHR6Z.js";import"./chunk-ERSPVOTN.js";import"./chunk-YYF5QU33.js";import"./chunk-ZCSG362J.js";import"./chunk-3C3MRH6A.js";import"./chunk-SV3MUUMI.js";export{e as default};
|