@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/README.md
CHANGED
|
@@ -27,7 +27,9 @@ export default withCSSX(
|
|
|
27
27
|
);
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
CSSX defaults to serial `s…x` names and a persisted `.cssx/classnames.json` manifest in `withCSSX
|
|
30
|
+
CSSX defaults to serial `s…x` names and a persisted `.cssx/classnames.json` manifest in production `withCSSX` builds. Development uses source-addressed composite names based on module identity and CSSX call order, so changing literal text or its length leaves existing selectors stable. Development skips class-name compression, manifest writes, and reusable-fragment planning and caches project metadata so an existing source file is transformed again only when it changes. Next.js 16 projects can select either bundler with `next dev --webpack` / `next build --webpack`, or `next dev --turbopack` / `next build --turbopack`. MDX source files are compiled by the helper; install `@mdx-js/mdx` when a project contains `.md` or `.mdx` files. Configure serializable remark, rehype, or recma plugins with `mdx`. Use `sourceRoots` for linked workspace packages outside the project root.
|
|
31
|
+
|
|
32
|
+
`withCSSX` detects Next.js development versus production mode. Other adapters infer development from `NODE_ENV=development`, an active Vite server, a development compiler mode, or Rollup watch mode. esbuild has no standard mode signal, so set `mode: 'development'` explicitly. `mode: 'production'` disables development behavior.
|
|
31
33
|
|
|
32
34
|
`withCSSX` composes with a synchronous `webpack(config)` callback. It throws a clear error if an existing callback returns a Promise, since Next.js invokes that hook synchronously.
|
|
33
35
|
|
|
@@ -118,24 +120,26 @@ const stylesheet = await compileCssxStylesheet([
|
|
|
118
120
|
|
|
119
121
|
## Options
|
|
120
122
|
|
|
121
|
-
| Option
|
|
122
|
-
|
|
|
123
|
-
| `importSource`
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
123
|
+
| Option | Default | What it does |
|
|
124
|
+
| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| `importSource` | `@cssxio/cssx` | Module specifier that identifies source files to transform. A source file must contain this text and have a JavaScript or TypeScript extension. |
|
|
126
|
+
| `mode` | inferred | Selects `development` or `production` behavior. esbuild requires an explicit development mode. |
|
|
127
|
+
| `cssFileName` | `cssx.css` | Relative CSS output path. It must be non-empty, end in `.css`, and stay within the bundler output directory. `[hash]` is replaced with a stable hash of the generated CSS. |
|
|
128
|
+
| `naming` | `serial` | Selects generated composite naming: `serial`, `hash`, or source-addressed `source`. Independent of compiler coordination. |
|
|
129
|
+
| `coordination` | `memory` | Coordinates assignments within one adapter instance (`memory`) or through a persisted manifest (`manifest`). |
|
|
130
|
+
| `manifestPath` | — | JSON file used when `coordination: 'manifest'`. Independent compiler workers must share this path. |
|
|
131
|
+
| `className` | serial `s…x` | Controls atomic naming format, prefix, suffix, and hash length. Respected by compiler allocators used in every adapter. |
|
|
132
|
+
| `classNameAllocator` | — | Custom allocator for in-process integrations. Omit `className` when supplying one; manifest coordination uses CSSX's persisted allocator instead. |
|
|
133
|
+
| `stableClassNames` | `false` | Deprecated compatibility alias for `naming: 'source'`; emits source-addressed `d…` composites and overrides serial composite output. |
|
|
134
|
+
| `stableClassNameStrategy` | `source-location` | Chooses source location identities or module-order identities for source-addressed composites. Development adapters select `module-order`. |
|
|
135
|
+
| `debug` | `false` | Prints a concise output summary or writes a class/source/selector diagnostic JSON report. |
|
|
136
|
+
| `sourceRoots` | project root | Additional source directories included in project metadata scans, such as linked workspace packages. |
|
|
137
|
+
| `sourceMap` | `true` | Whether to generate a separate CSS source map. Development defaults to `false` to keep warm updates lighter; set `sourceMap: true` to include development CSS maps. |
|
|
138
|
+
| `layer` | — | CSS layer name that wraps generated CSS. It must be a single valid layer identifier, such as `cssx`. |
|
|
139
|
+
| `theme` | — | Inline CSSX `@theme` source used while transforming and compiling CSS. The theme is compiled into generated rules; it does not add a global stylesheet. |
|
|
140
|
+
| `themeFile` | — | Path, relative to the current working directory, to a CSSX `@theme` file. It is reread when CSS is generated; Rollup-compatible adapters register it as a watched dependency. Do not use it with `theme`. |
|
|
141
|
+
| `darkMode` | `media` | Activates `dark:` utilities with the system color-scheme media query (`media`), `[data-theme=dark]` (`selector`), or a `.dark` ancestor (`class`). Use the selector that matches your theme controller. |
|
|
142
|
+
| `preflight` | `true` | Adds Tailwind-compatible browser baseline rules before utilities. Set it to `false` only when the application deliberately owns a different global reset. |
|
|
139
143
|
|
|
140
144
|
The universal adapter validates options when it is created. `theme` and `themeFile` cannot be used together. Invalid CSS paths and layer names fail the build before CSS is emitted.
|
|
141
145
|
|
|
@@ -154,7 +158,15 @@ The Rollup-compatible adapters retain transformed module metadata until `generat
|
|
|
154
158
|
|
|
155
159
|
When `sourceMap` is enabled and source locations are available, generated CSS has a separate `.css.map` file and a source-map comment. Each mapping points to the source module location of the static utility string that created the rule. `transformCssxModule` can accept and return JavaScript source maps for build tools that provide a compatible input map.
|
|
156
160
|
|
|
157
|
-
During
|
|
161
|
+
During development, all adapters use a cached source coordinator and push stylesheet revisions over a development-only event stream independently of JavaScript bundle completion. Vite serves its event stream beneath the configured base path; Next.js, Webpack, Rspack, Rollup watch, and explicitly enabled esbuild development builds use a loopback transport. The injected browser bridge replaces the stylesheet automatically, preserving page state and avoiding a manual refresh. Keep the generated stylesheet in the initial document so CSS is present before the first update. Development watchers and browser transport are omitted from production builds.
|
|
162
|
+
|
|
163
|
+
CSS source maps are off by default during development to reduce stylesheet compilation time and memory use. Set `sourceMap: true` when you need to debug generated CSS mappings; production keeps the default source map behavior.
|
|
164
|
+
|
|
165
|
+
Resource use is bounded during development. The shared project scanner opens at most 16 directory watchers per process. Vite and esbuild use a native fast path capped at eight additional directory watchers; they watch directories rather than individual files and fall back to the bundler watcher if native watching fails or reaches the cap. Vite coalesces duplicate notifications and stylesheet compiles, transforms at most four changed modules concurrently, and caps distinct in-flight paths at 256. Rollup prepares CSS-only updates in its existing `watchChange` hook before scheduling the rebuild and serializes at most 256 pending changed modules through one queue. The scanner caps pending paths at 256, coalesces overflow into one reconciliation, and processes changed modules sequentially. Stopped coordinators release their metadata cache; at most eight inactive project snapshots are retained. Fixed-size digests avoid retaining full source text for edit checks. Vite keeps at most 64 prepared digests; Rollup and esbuild each cap prepared transforms at 64 entries and 16 MiB of estimated retained transform data. The Next.js stylesheet stream accepts at most 64 browser clients per app and keeps only the newest update queued for a slow client.
|
|
166
|
+
|
|
167
|
+
If a Vite-powered SSR framework skips Vite's HTML transform hook, CSSX injects its bridge in the rendered response. The fallback buffers at most 1 MiB and 4,096 chunks per response, with at most eight responses buffered at once; oversized or excess responses pass through without injection.
|
|
168
|
+
|
|
169
|
+
The 100 ms goal measures a warm existing-style save until the changed computed style is visible after the next animation frame. It does not include cold startup, newly introduced call sites, JavaScript edits, full-theme changes, or composition-structure changes. Run `pnpm benchmark:dev-hmr` for the cached compiler benchmark and `pnpm test:hmr` for browser save-to-visible benchmarks across esbuild, Rollup, Webpack, and Rspack. Vite and Next.js browser benchmarks run in the visual test matrix. Compiler timing alone is not a browser save-to-visible measurement.
|
|
158
170
|
|
|
159
171
|
With esbuild, `outdir` places CSS below that directory. `outfile` places it beside the output file. Without either option, it is placed below the working directory. With `write: false`, CSS and its map are appended to esbuild's in-memory `outputFiles`; otherwise they are written to disk. A later esbuild build removes CSS files that CSSX wrote when no utilities remain.
|
|
160
172
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFile as c,stat as m}from"fs/promises";import{resolve as u}from"path";var o=new Map;async function p(i,a=process.cwd()){if(i.themeFile===void 0)return i.theme;let t=u(a,i.themeFile),e=await m(t,{bigint:!0}),n=`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`,s=o.get(t);if(s?.signature===n)return s.source;let r=await c(t,"utf8");return o.set(t,{signature:n,source:r}),r}export{p as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as j}from"./chunk-6TMSHR6Z.js";var x='*,::before,::after,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-text-size-adjust:100%;tab-size:4;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}button,select{text-transform:none}button,input:where([type="button"],[type="reset"],[type="submit"]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit}textarea{resize:vertical}::placeholder{opacity:1}button,[role="button"]{cursor:pointer}:disabled{cursor:default}[hidden]:where(:not([hidden="until-found"])){display:none!important}';function S(e,s){let o=s.split(`
|
|
2
|
+
`);return{line:e.line+o.length-1,column:o.at(-1).length+e.column*+(o.length===1)}}var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function h(e){let s="",o=e<0?-e<<1|1:e<<1;do{let n=o&31;o>>>=5,o&&(n|=32),s+=A[n]}while(o);return s}function k(e){let s=Array.from({length:Math.max(0,...e.map(t=>t.line))+1},()=>[]),o=0,n=0,f=0,l=0,p=0;for(let t of e)p*=+(t.line===l),l=t.line,s[t.line]?.push(`${h(t.column-p)}${h(t.source-o)}${h(t.originalLine-n)}${h(t.originalColumn-f)}`),p=t.column,o=t.source,n=t.originalLine,f=t.originalColumn;return s.map(t=>t.join(",")).join(";")}function O(e,s,o){let n=[...new Set(s.map(t=>o.get(t.candidate)?.id).filter(t=>!!t))].sort();if(n.length===0)return;let f=new Map(n.map((t,a)=>[t,a])),l=[],p=S({line:0,column:0},e);for(let t of s){let a=o.get(t.candidate);a&&l.push({...p,source:f.get(a.id),originalLine:a.line,originalColumn:a.column}),p=S(p,t.css)}return{version:3,sources:n,names:[],mappings:k(l)}}async function oe(e,s,o,n=!0,f,l=!0){if(!n&&e.filter(G).length<=1&&e.every(I)){let r=[...new Set(e.map(R=>R.precompiledCss).filter(U))].sort().join(""),c=`${l?x:""}${r}`;if(!c)return{css:""};let u=o?`@layer ${o}{`:"";return{css:`${u}${c}${u?"}":""}`}}let t=Object.create(null),a=Object.create(null),M=new Set,w=!0,C=new Map;for(let r of[...e].sort((i,c)=>i.id.localeCompare(c.id))){for(let[i,c]of Object.entries(r.candidates))if(i in t||(t[i]=c),r.id&&!C.has(i)){let u=r.origins?.[i];C.set(i,{id:r.id,line:u?.line??0,column:u?.column??0})}for(let[i,c]of Object.entries(r.composites??{})){let u=a[i];if(u&&u.join(" ")!==c.join(" "))throw new Error(`CSSX composite class collision for "${i}".`);a[i]=c}r.atomicClasses===void 0&&(w=!1);for(let i of r.atomicClasses??[])M.add(i)}let v=Object.keys(t).sort(),g=l?x:"";if(v.length===0)return{css:g&&o?`@layer ${o}{${g}}`:g};let{compileUtilities:L,createSelectorAliases:z,serializeCss:E}=await import("@cssxio/compiler"),b=await L(v,r=>t[r],s,z(a),w?M:void 0,{darkMode:f}),P=!n&&j()?E([{className:"",css:b.css}]):b.css,y=o?`@layer ${o}{`:"",N=`${y}${g}${P}${y?"}":""}`,$=n?O(`${y}${g}${b.prefixCss}`,b.entries,C):void 0;return{css:N,...$?{map:$}:{}}}function I(e){return typeof e.precompiledCss=="string"||Object.keys(e.candidates).length===0&&Object.keys(e.composites??{}).length===0}function G(e){return Object.keys(e.candidates).length>0||Object.keys(e.composites??{}).length>0}function U(e){return e!==void 0}function ne(e,s){return JSON.stringify({...e,file:s})}import{basename as D}from"path";function le(e,s){return e.map?`${e.css}
|
|
3
|
+
/*# sourceMappingURL=${D(s)}.map */`:e.css}export{oe as a,ne as b,le as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as c}from"module";import{resolve as r}from"path";function m(s,a=process.dlopen,d){if(process.env.CSSX_DISABLE_NATIVE_COMPILER==="1")return n=null,i();if(n!==void 0)return n||i();let l=process.env.CSSX_NATIVE_COMPILER_PATH;if(l)try{let e={exports:{}};return a(e,l),n=e.exports,e.exports}catch{}let p=[s??c(r(process.cwd(),"package.json")),d??c(import.meta.url)];for(let e of p)try{let o=e("@cssxio/compiler-native");if(f(o))return n=o,o}catch{}let t=r(process.cwd(),"packages/compiler/native/target"),u=[r(t,"release/libcssx_compiler_node.dylib"),r(t,"debug/libcssx_compiler_node.dylib"),r(t,"release/libcssx_compiler_node.so"),r(t,"debug/libcssx_compiler_node.so"),r(t,"release/cssx_compiler_node.dll"),r(t,"debug/cssx_compiler_node.dll")].filter(e=>!!e);for(let e of u)try{let o={exports:{}};return a(o,e),n=o.exports,o.exports}catch{}return n=null,i()}function i(){if(process.env.CSSX_REQUIRE_NATIVE_COMPILER==="1")throw new Error("CSSX_REQUIRE_NATIVE_COMPILER=1, but no compatible native compiler addon could be loaded.")}function f(s){return typeof s=="object"&&s!==null&&"findCssxCalls"in s&&typeof s.findCssxCalls=="function"}var n;export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as o}from"path";function s(n,t){let e=o(n);return{port:r(e),token:i(`${e}:${t}`)}}function r(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return 4e4+(t>>>0)%2e4}function i(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-ZDJ2ZX5V.js";import{a as b}from"./chunk-6TMSHR6Z.js";import{a as x}from"./chunk-3C3MRH6A.js";import{compileStyleRecords as A,stableCompositeName as N}from"@cssxio/compiler";async function T(t,i,p,s,f,d,c){if(s.mode!=="development"||s.stableClassNames!==!0||s.stableClassNameStrategy!=="module-order"||!t.includes(s.importSource??"@cssxio/cssx"))return{handled:!1};let a=c===void 0?b():c??void 0;if(!a)return{handled:!1};let n;try{n=a.findCssxCalls(t,i,s.importSource??"@cssxio/cssx")}catch{return{handled:!1}}if(n.some(l=>l.entryPoint!=="sx"||!l.staticSx))return{handled:!1};if(n.length===0)return{handled:!0};let u=await x(s,p),o=R(n,d,u,f);if(!o)return{handled:!1};let m={handled:!0,module:{id:i,...o}},y=[],e=[];for(let l=0;l<n.length;l++){let r=n[l],C=r.utilities.filter(O=>O.trim().length>0).join(" ");if(r.startUtf16===void 0||r.endUtf16===void 0)return m;if(e.push({start:r.startUtf16,end:r.endUtf16}),!C)y.push({start:r.startUtf16,end:r.endUtf16,content:JSON.stringify("")});else{if(h(C))continue;y.push({start:r.startUtf16,end:r.endUtf16,content:JSON.stringify(N(d,void 0,`sx:${l}:segment:0`))})}}let g=S(t,i,y),{cssOnlySignature:v}=await import("@cssxio/babel-plugin");return{...m,transformedCode:g.code,map:g.map,cssOnlySignature:v(t,e)}}function R(t,i,p,s){let f=Object.create(null),d=Object.create(null),c=Object.create(null);for(let a=0;a<t.length;a++){let n=t[a],u=n.utilities.filter(e=>e.trim().length>0).join(" ");if(!u||h(u))continue;let o;try{o=A({inline:u},{theme:p,classNameAllocator:s,reusabilityBudget:0})}catch{return}for(let[e,g]of Object.entries(o.classes))f[e]??=g,c[e]??={line:n.line-1,column:n.column};let m=[...new Set(o.styles.inline._.map(e=>e[0]).filter(e=>!!e))];if(m.length===0)return;let y=N(i,void 0,`sx:${a}:segment:0`);d[y]=m}return{candidates:f,composites:d,atomicClasses:[],origins:c}}function h(t){return/^(?:s[0-9A-Za-z]+x|d[0-9a-z]+x)(?:\s+(?:s[0-9A-Za-z]+x|d[0-9a-z]+x))*$/.test(t)}export{T as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./chunk-ZCSG362J.js";import{realpathSync as x}from"fs";import{realpath as j}from"fs/promises";import{basename as C,dirname as S,join as N,resolve as d}from"path";async function _(t){return j(t).catch(()=>d(t))}function p(t){let n=d(t);try{return x.native(n)}catch{let e=S(n),o=C(n);for(;;)try{return d(x.native(e),o)}catch{let r=S(e);if(r===e)return n;o=N(C(e),o),e=r}}}import{relative as w,resolve as h,sep as I}from"path";function B(t,n,e){let o=e?p(t):h(t),r=e?p(n):h(n);return w(o,r).replaceAll(I,"/")}import{readdir as P}from"fs/promises";import{isAbsolute as M,join as T,relative as b,resolve as f,sep as R}from"path";var F=new Set([".js",".jsx",".ts",".tsx",".cjs",".cjsx",".cts",".ctsx",".mjs",".mjsx",".mts",".mtsx",".astro",".mdx",".md"]),v=new Set([".git",".next",".open-next",".output",".turbo",".vercel","build","coverage","dist","node_modules","out","storybook-static"]);function q(t,n=[]){let e=f(t),o=n.map(i=>f(i)).find(i=>{let s=b(i,e);return s===""||!s.startsWith(`..${R}`)&&s!==".."&&!M(s)});return(o?b(o,e):e).split(R).some(i=>v.has(i))}async function H(t,n=[]){let e=[],o=[t,...n],r=new Set;for(;o.length>0;){let i=o.pop(),s=f(i);if(!r.has(s)){r.add(s);for(let c of await P(i,{withFileTypes:!0})){let a=T(i,c.name);if(c.isDirectory()){v.has(c.name)||o.push(a);continue}c.isFile()&&F.has(a.slice(a.lastIndexOf(".")))&&e.push(a)}}}return e.sort()}var A=new Set([".js",".jsx",".ts",".tsx",".cjs",".cjsx",".cts",".ctsx",".mjs",".mjsx",".mts",".mtsx",".astro",".vue"]);async function y(t,n,e={},o,r={}){g(e);let i=e.importSource??"@cssxio/cssx",s=n.split("?",1).join("");if(!A.has(s.slice(s.lastIndexOf(".")))||!t.includes(i))return null;if(s.endsWith(".astro")){let{transformAstroSxModule:a}=await import("./transform-astro-sx-HBUDGJ5K.js");return a(t,n,e,y,r)}if(s.endsWith(".vue")){let{transformVueSfcModule:a}=await import("./transform-vue-sfc-ACOOMWIS.js");return a(t,n,e,y,r)}if(e.mode==="development"&&e.stableClassNames===!0&&e.stableClassNameStrategy==="module-order"&&r.compileCss===!1){let{tryTransformNativeStaticSxModule:a}=await import("./try-transform-native-static-sx-MGM7DLG4.js"),l=await a(t,n,s,e,o,r);if(l)return l}if(e.mode!=="development"&&r.compileCss!==!1){let{tryTransformNativeStaticCreateModule:a}=await import("./try-transform-native-static-create-345K2PAR.js"),l=await a(t,n,s,e,o,r);if(l)return l}let{transformBabelCssxModule:c}=await import("./transform-babel-cssx-module-U4DGJILK.js");return c(t,s,e,o,r)}function Z(t,n){if(!t||typeof t!="object")return;let e=t.getCombinedSourcemap;if(typeof e!="function")return;let o=e.call(t);if(!o||typeof o!="object")return;let r=o;if(!(r.version!==3||!Array.isArray(r.sources)||typeof r.mappings!="string"))return{version:r.version,sources:[...r.sources],names:[...r.names??[]],mappings:r.mappings,file:r.file??n.split("?",1).join(""),...r.sourceRoot?{sourceRoot:r.sourceRoot}:{},...r.sourcesContent?{sourcesContent:[...r.sourcesContent]}:{}}}export{_ as a,p as b,B as c,q as d,H as e,y as f,Z as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-KR26IZKN.js";import{g as l,h as r,i as n}from"./chunk-ZCSG362J.js";function i(o,e){return`${o}\0${JSON.stringify(e)}`}var m=new Map;function y(o,e){let s=i(o,e),t=m.get(s);return t||(t={classNameAllocator:e.classNameAllocator??a(r(e)),developmentClassNameAllocator:e.classNameAllocator??a(l(n(e))),transformedDataById:new Map},m.set(s,t)),t}export{y as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as t}from"./chunk-ZCSG362J.js";function o(r){return{className:`cssx-${t(r)}`,css:r}}function l(r,e){return r&&e?`@layer ${e}{${r}}`:r}export{o as a,l as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as g}from"./chunk-M2QORA5D.js";import{b as v,f as C,g as h,h as S}from"./chunk-YZ7P3BSQ.js";import{a as f,b as x,c as w}from"./chunk-62JIYM5O.js";import{a as p}from"./chunk-3C3MRH6A.js";import{randomUUID as j}from"crypto";import{mkdir as k,readFile as E,rename as $,unlink as O,writeFile as b}from"fs/promises";import{dirname as H,resolve as I}from"path";var i=new Map;function K(a,o,e,r,c){let t=I(a),n=i.get(t);if(n)return n;let m=(async()=>{C(t,e);let s;try{let l=await v(t,e),d=await T(t,o,e,l);await g(r,d),s=await S(t,e,async P=>{let D=await p(e,t),N=await f(P,D,e.layer,e.sourceMap,e.darkMode,e.preflight),u=w(N,"generated.css");u!==d&&(await g(r,u),d=u)},c);let y=!1;return()=>{y||(y=!0,s?.(),h(t,e),i.delete(t))}}catch(l){throw s?.(),h(t,e),l}})();return i.set(t,m),m.catch(s=>{console.warn(`CSSX: Next development coordinator could not start: ${s instanceof Error?s.message:String(s)}`),i.delete(t)}),m}async function T(a,o,e,r){let c=await p(e,a),t=await f(r,c,e.layer,e.sourceMap,e.darkMode,e.preflight);await k(H(o),{recursive:!0});let n=w(t,"generated.css");return await M(o,n),t.map&&await M(`${o}.map`,x(t.map,"generated.css")),n}async function M(a,o){try{if(await E(a,"utf8")===o)return!1}catch(r){if(r.code!=="ENOENT")throw r}let e=`${a}.${process.pid}.${j()}.tmp`;try{return await b(e,o),await $(e,a),!0}catch(r){throw await O(e).catch(()=>{}),r}}export{K as a,T as b};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{createClassNameAllocator as u,restoreClassNameAllocator as S,snapshotClassNameAllocator as E}from"@cssxio/compiler";import{mkdir as C,open as T,readFile as N,rename as A,rm as w,stat as h,writeFile as O}from"fs/promises";import{dirname as g,resolve as x}from"path";var d=20,y=5*6e4;async function _(a,o,t){let r=x(a),e=`${r}.lock`,c=Date.now(),l,m=0;for(;!l;){await C(g(r),{recursive:!0});let s;try{s=await T(e,"wx")}catch(i){let f=i.code;if(f!=="EEXIST"){if(f!=="EACCES"&&f!=="EPERM")throw i;try{await h(e)}catch(n){if(n.code==="ENOENT"){if(m+=1,m>1)throw i;await new Promise(p=>setTimeout(p,d));continue}throw n}}if(m=0,await J(e))continue;if(Date.now()-c>=y)throw new Error(`Timed out waiting for CSSX class-name manifest lock: ${e}`);await new Promise(n=>setTimeout(n,d));continue}try{await s.writeFile(`${process.pid}
|
|
2
|
+
${Date.now()}
|
|
3
|
+
`)}catch(i){throw await s.close().catch(()=>{}),await w(e,{force:!0}).catch(()=>{}),i}l=s}try{let s=await R(r,o),i=await t(s),f=E(s),n=`${r}.${process.pid}.${Date.now()}.tmp`;try{await O(n,`${JSON.stringify(f,null,2)}
|
|
4
|
+
`,"utf8"),await A(n,r)}catch(p){throw await w(n,{force:!0}).catch(()=>{}),p}return i}finally{await l.close(),await w(e,{force:!0})}}async function J(a){try{let o=await h(a),t;try{t=await N(a,"utf8")}catch(c){let l=c.code;if(l==="EACCES"||l==="EPERM")return!1;throw c}let[r]=t.split(`
|
|
5
|
+
`),e=Number(r);if(Number.isSafeInteger(e)&&e>0)try{return process.kill(e,0),!1}catch(c){return c.code!=="ESRCH"?!1:(await w(a,{force:!0}),!0)}return Date.now()-o.mtimeMs<y?!1:(await w(a,{force:!0}),!0)}catch(o){if(o.code==="ENOENT")return!1;throw o}}async function R(a,o){try{let t=JSON.parse(await N(a,"utf8")),r=E(u(o)).options;if(JSON.stringify(t.options)!==JSON.stringify(r))throw new Error("CSSX class-name manifest options do not match the active compiler options.");return S(t)}catch(t){if(t.code==="ENOENT")return u(o);throw t}}export{_ as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as K}from"./chunk-WIZLK3SX.js";import{a as O,b as I,c as R}from"./chunk-62JIYM5O.js";import{a as Y}from"./chunk-EWDPJYCI.js";import{a as j}from"./chunk-KR26IZKN.js";import{a as B,b as V}from"./chunk-YYF5QU33.js";import{a as W,b as C,d as F,g as G,h as q,i as b,j as H}from"./chunk-ZCSG362J.js";import{a as X}from"./chunk-3C3MRH6A.js";import{createUnplugin as le}from"unplugin";function z(e,a=()=>!1,l){return async function(o){let d=this.environment;if(!d)return;let y=o.modules,n=y.filter(r=>{let s=e.get(C(r.id??""));return!!(s&&s.cssOnlySignature)});if(n.length===0)return;let m=typeof o.read=="function"?await o.read():void 0,g=new Set(m===void 0?[]:n.filter(r=>a(C(r.id),m))),i=new Map(n.map(r=>[r,e.get(C(r.id)).cssOnlySignature]));if(l){for(let r of n)if(!(m===void 0?await l(r.id):await l(r.id,m)))if(r.url)await d.transformRequest(r.url);else continue}else for(let r of n)!g.has(r)&&r.url&&await d.transformRequest(r.url);if(n.every(r=>{let s=e.get(C(r.id));return!!(s&&s.cssOnlySignature===i.get(r))}))return y.filter(r=>!n.includes(r))}}import{resolve as ae}from"path";import{mkdir as re,writeFile as se}from"fs/promises";import{dirname as ne,resolve as ie}from"path";function J(e,a){let l=new Map,f=[];for(let o of a)o.id?l.set(o.id,o):f.push(o);for(let o of e)o.id?l.set(o.id,o):f.push(o);return[...l.values(),...f]}function Q(e,a){let l=e.buildInfo?.[a];if(!l||typeof l!="object")return;let{id:f,candidates:o,composites:d,atomicClasses:y,origins:n}=l;return{id:typeof f=="string"?f:"",candidates:o&&typeof o=="object"?o:{},composites:d&&typeof d=="object"?d:{},...Array.isArray(y)?{atomicClasses:y}:{},origins:n&&typeof n=="object"?n:{}}}function Z(e,a,l,f,o,d,y,n,m=!0,g,i,w){let r=e.name??e.options?.name;r==="server"||r==="edge-server"||e.hooks.thisCompilation.tap("@cssxio/unplugin",s=>{s.hooks.processAssets.tapPromise({name:"@cssxio/unplugin",stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},async()=>{let c=g?await g():J([...s.modules].map(v=>Q(v,d)).filter(v=>v!==void 0),y?.values()??[]),h=await O(c,await l(),f,o,n,m);if(i?.debug){let v=K(c,h.css,i);if(i.debug===!0)console.info(`CSSX: ${v.naming.mode} naming; ${v.classes.filter(k=>k.selectorFound).length}/${v.classes.length} generated classes have selectors; compiler mappings ${v.serverClientMappings.status}${v.serverClientMappings.conflicts.length?` (${v.serverClientMappings.conflicts.length} utility conflicts)`:""}.`);else{let k=ie(e.context,i.debug.reportFile);await re(ne(k),{recursive:!0}),await se(k,`${JSON.stringify(v,null,2)}
|
|
2
|
+
`,"utf8")}}if(!h.css){await w?.(R(h,a));return}let p=F(a,h.css),M=R(h,p);if(s.getAsset?.(p))throw new Error(`CSSX CSS asset collision at "${p}".`);if(await w?.(M),s.emitAsset(p,new e.webpack.sources.RawSource(M)),h.map){let v=`${p}.map`;if(s.getAsset?.(v))throw new Error(`CSSX CSS map asset collision at "${v}".`);s.emitAsset(v,new e.webpack.sources.RawSource(I(h.map,p)))}})})}function U({compiler:e,options:a,cssFileName:l,sourceMap:f,getTheme:o}){let d=Y(e.context,a),y=H(a,{watchMode:e.watchMode,bundlerMode:e.options?.mode}),n=y?b(a):a,m=n.sourceMap??f,g;if(y){let i=0;e.hooks?.watchRun?.tap("@cssxio/unplugin",w=>{i++;for(let p of w.removedFiles??[])d.transformedDataById.delete(C(p));if(process.env.NODE_ENV==="test"||g)return;let r=ae(e.context,".cssx/native.css"),s,c=0,h;g=Promise.all([import("./development-coordinator-6IH5C7KS.js"),import("./next-development-server-I7PSPICB.js")]).then(([p,M])=>(s=M.startNextDevelopmentServer(e.context,r),d.developmentHmr=s,p.startDevelopmentCoordinator(e.context,r,n,s))),d.notifyDevelopmentStylesheet=async()=>{if(await g?.catch(()=>{}),!(!s||i<=1||d.developmentHmr!==s))return c++,h||(h=new Promise(p=>setImmediate(p)).then(async()=>{let p=-1;do{p=c;let{getCachedProjectScanSourceModules:M}=await import("./project-scan-EIM7BVPC.js"),v=M(e.context,n),k=await O(v??[...d.transformedDataById.values()],await o(),n.layer,m,n.darkMode,n.preflight),P=R(k,"generated.css");if(s&&d.developmentHmr===s&&d.developmentStylesheet!==P){let{publishNextDevelopmentStylesheet:t}=await import("./next-development-server-I7PSPICB.js");await t(s,P),d.developmentStylesheet=P}}while(p!==c)}).catch(p=>{console.warn(`CSSX: native development stylesheet update failed: ${p instanceof Error?p.message:String(p)}`)}).finally(()=>{h=void 0})),h},g.catch(p=>{console.warn(`CSSX: native development coordinator failed: ${String(p)}`)})})}y&&e.hooks?.watchClose?.tap("@cssxio/unplugin",()=>{g?.then(async i=>{i();let{stopNextDevelopmentServer:w}=await import("./next-development-server-I7PSPICB.js");w(e.context),d.developmentHmr=void 0,d.developmentStylesheet=void 0},async()=>{let{stopNextDevelopmentServer:i}=await import("./next-development-server-I7PSPICB.js");i(e.context),d.developmentHmr=void 0,d.developmentStylesheet=void 0}),d.notifyDevelopmentStylesheet=void 0}),Z(e,l,o,n.layer,m,B,d.transformedDataById,n.darkMode,n.preflight,!y&&(a.stableClassNames||a.naming==="source"||a.coordination==="manifest")?()=>import("./project-scan-EIM7BVPC.js").then(({scanProjectCssxSourceModules:i})=>i(e.context,a)):void 0,n)}function ee(e){if(!e||typeof e!="object")return V();let{id:a,rules:l,candidates:f,composites:o,atomicClasses:d,origins:y,cssOnlySignature:n,precompiledCss:m}=e;return{id:typeof a=="string"?a:"",rules:Array.isArray(l)?l:[],candidates:f&&typeof f=="object"?f:{},composites:o&&typeof o=="object"?o:{},...Array.isArray(d)?{atomicClasses:d}:{},origins:y&&typeof y=="object"?y:{},cssOnlySignature:typeof n=="string"?n:"",...typeof m=="string"?{precompiledCss:m}:{}}}function te(e){return!e||typeof e!="object"?V():ee(e[B])}function oe(e){return async function(a,l){let{framework:f,options:o,cssFileName:d,sourceMap:y,rollupDataById:n,getTheme:m}=e,g=H(o,{watchMode:this.meta?.watchMode})?b(o):o,i=new Set(Object.values(l).flatMap(c=>c.type==="chunk"?Object.keys(c.modules??{}):[]).map(C));if(f!=="vite")for(let c of n.keys())i.has(c)||n.delete(c);let w=g.coordination==="manifest"?await import("./project-scan-EIM7BVPC.js").then(({scanProjectCssxSourceModules:c})=>c(process.cwd(),g)):f==="vite"?[...n.values()]:[...i].map(c=>{let h=te(this.getModuleInfo(c)?.meta);return Object.keys(h.candidates).length>0?h:n.get(c)??h}),r=await O(w,await m(),g.layer,y,g.darkMode,g.preflight);if(!r.css)return;let s=F(d,r.css);if(Object.hasOwn(l,s))throw new Error(`CSSX CSS asset collision at "${s}".`);if(this.emitFile({type:"asset",fileName:s,source:R(r,s)}),r.map){let c=`${s}.map`;if(Object.hasOwn(l,c))throw new Error(`CSSX CSS map asset collision at "${c}".`);this.emitFile({type:"asset",fileName:c,source:I(r.map,s)})}}}var _=/\.(?:[cm]?[jt]sx?|astro|vue|mdx?)(?=\?|$)/,de=(e={},a)=>{if(W(e),e.classNameAllocator&&e.className)throw new Error("CSSX classNameAllocator owns naming. Omit className when supplying a custom allocator.");let l=e.cssFileName??"cssx.css",f=e.sourceMap??!0,o=new Map,d=e.classNameAllocator??j(q(e)),y=e.classNameAllocator??j(G(b(e))),n=new Map,m,g,i,w=process.cwd(),r,s=()=>X(e,w),c,h,p=()=>(h??=import("./create-universal-esbuild-hooks-OCPLHVMY.js").then(({createUniversalEsbuildHooks:t})=>(c=t({options:e,cssFileName:l,sourceMap:f,dataById:n,getTheme:s}),c)),h),M=oe({framework:a.framework,options:e,cssFileName:l,sourceMap:f,rollupDataById:o,getTheme:s}),v=()=>m?.notifyStyles()??Promise.resolve(),k=()=>i?.then(t=>t.notifyStyles())??Promise.resolve(),P=()=>(g??=import("@cssxio/unplugin/internal/transform-runtime").then(({createTransformHandler:t})=>t({framework:a.framework,options:e,classNameAllocator:d,developmentClassNameAllocator:y,isViteDevServerActive:()=>m?.isActive()??!1,rollupDataById:o,esbuildDataById:n,cssFileName:l,getEsbuildWorkingDirectory:()=>c?.getWorkingDirectory()??process.cwd(),notifyViteStyles:v,notifyDevelopmentStyles:k,getDevelopmentHmrConnection:a.framework==="esbuild"?async()=>(await p()).getDevelopmentHmrConnection():()=>i?.then(u=>u.getConnection())})),g);return{name:"@cssxio/unplugin",enforce:"pre",transform:{filter:{id:_},handler:async function(t,u){let S=await P(),x=this.meta?.watchMode;if(a.framework==="rollup"&&x&&i){let $=await i,L=$.takePrepared(u,t);if(L.handled)return $.onTransformed(u),L.result}let A=m?.isPrepared(u,t)??!1,E=await S.call({...this,skipViteStylesheetPush:A},t,u);return a.framework==="vite"?m?.onTransformed(u,t):a.framework==="rollup"&&x&&i&&(await i).onTransformed(u),E}},async watchChange(t,u){let S=C(t);if(u.event==="delete"){o.delete(S),m?.delete(S),await i?.then(x=>x.delete(S)),a.framework==="vite"?await v():await k();return}if(a.framework==="rollup"&&i&&u.event==="update"&&_.test(t)){await i.then(x=>x.updateCssOnlySource(t));return}a.framework!=="vite"||!m?.isActive()||u.event!=="update"||!_.test(t)||await m.updateCssOnlySource(t)},rollup:{generateBundle:M,buildStart(){let t=this.meta.watchMode;if(H(e,{watchMode:t})&&t&&!i){let u=b(e);i=import("@cssxio/unplugin/internal/development-runtime").then(S=>S.createRollupDevelopmentRuntime({cssFileName:l,root:process.cwd(),dataById:o,getTheme:s,options:u,sourceMap:u.sourceMap,transformSource:(x,A)=>P().then(E=>E.call({meta:{watchMode:!0},skipRollupStylesheetPush:!0},x,A))}))}t&&i&&i.then(u=>u.buildStart()).catch(u=>{console.warn(`CSSX: Rollup development coordinator failed: ${String(u)}`)})},async buildEnd(){await i?.then(t=>t.buildEnd())},async closeWatcher(){await i?.then(t=>t.closeWatcher(),()=>{}),i=void 0}},vite:{generateBundle:M,configResolved(t){r=t.command,w=t.root??w},async configureServer(t){if(r==="build"||e.mode==="production"||process.env.NODE_ENV==="production")return;let u=b(e),{createViteDevelopmentRuntime:S}=await import("@cssxio/unplugin/internal/development-runtime");w=t.config.root??process.cwd(),m=S(t,{cssFileName:l,root:w,sourceMap:u.sourceMap,options:u,rollupDataById:o,getTheme:s},o,(x,A)=>P().then(E=>E.call({meta:{watchMode:!0},skipViteStylesheetPush:!0},x,A)))},transformIndexHtml:{order:"pre",async handler(t,u){if(!u.server||r==="build"||e.mode==="production"||process.env.NODE_ENV==="production")return;let{viteDevelopmentStylesheetHmr:S}=await import("@cssxio/unplugin/internal/development-runtime");return[{tag:"script",attrs:{type:"module","data-cssx-vite-hmr":!0},children:S(l),injectTo:"body"}]}},hotUpdate:{order:"pre",handler:z(o,void 0,(t,u)=>m?.updateCssOnlySource(t,u)??Promise.resolve(!1))}},...a.framework==="webpack"?{webpack(t){U({compiler:t,options:e,cssFileName:l,sourceMap:f,getTheme:s})}}:{},...a.framework==="rspack"?{rspack(t){U({compiler:t,options:e,cssFileName:l,sourceMap:f,getTheme:s})}}:{},...a.framework==="esbuild"?{esbuild:{config(t){t.metafile=!0},setup(t){return p().then(u=>u.setup(t))}}}:{}}},T=le(de),et=T.vite,tt=T.rollup,ot=T.webpack,rt=T.rspack,st=T;export{de as a,T as b,et as c,tt as d,ot as e,rt as f,st as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function x(n={}){let e=n.variant??"serial",r=n.prefix??"s",o=n.suffix??"x",a=n.length;if(e!=="random"&&e!=="serial")throw new Error('CSSX className.variant must be "random" or "serial".');if(r&&!/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(r))throw new Error("CSSX className.prefix must be a safe CSS identifier prefix.");if(!/^[A-Za-z0-9_-]*$/.test(o))throw new Error("CSSX className.suffix must contain only letters, digits, hyphens, or underscores.");if(a!==void 0&&(!Number.isSafeInteger(a)||a<1||a>64))throw new Error("CSSX className.length must be an integer from 1 through 64.");if(e==="serial"&&a!==void 0)throw new Error("CSSX className.length is only supported by the random naming variant.");let l=new Map,i=new Set,u=0;return{allocate(s){let f=!0;for(let t=1;t<s.length;t++)if(s[t-1]>=s[t]){f=!1;break}let h=f?s.filter(t=>!l.has(t)):[...new Set(s)].filter(t=>!l.has(t)).sort();if(e==="random"&&a!==void 0&&BigInt(h.length+i.size)>36n**BigInt(a))throw new Error(`CSSX className.length ${a} cannot name every generated class without a collision.`);for(let t of h){let d=0,c;do{let S=e==="serial"?r||o?C(u++):String(u++):w(t,a,d);c=`${r}${S}${o}`,d++}while(i.has(c));i.add(c),l.set(t,c)}return new Map(s.map(t=>[t,l.get(t)]))},reserve(s){for(let f of s)i.add(f)}}}function w(n,e,r){if(e===void 0)return r===0?m(n):`${m(n)}-${m(`${n}\0${r}`)}`;let o="";for(let a=0;o.length<e;a++)o+=m(`${n}\0${r}\0${a}`).padStart(13,"0");return o.slice(0,e)}function m(n){let e=0xcbf29ce484222325n;for(let r=0;r<n.length;r++)e^=BigInt(n.charCodeAt(r)),e=BigInt.asUintN(64,e*0x100000001b3n);return e.toString(36)}var g="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function C(n){let e=n,r="";do r=`${g[e%g.length]}${r}`,e=Math.floor(e/g.length);while(e>0);return r}export{x as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as w}from"./chunk-6WHEMH4N.js";import{Buffer as g}from"buffer";import{mkdirSync as D}from"fs";import{readFile as h}from"fs/promises";import{createServer as T}from"http";import{dirname as N,resolve as u}from"path";var S=new Map,C=new Map,$=64;function B(e,t){let r=u(e),i=S.get(r);if(i)return i.references++,i.connection;let a=w(r,t),c=new Set,d=u(t);D(N(d),{recursive:!0});let o={connection:a,stylesheetFile:d,revision:0,ready:!1,clients:c,blockedClients:new Set,references:1},p=T((s,n)=>{let v=new URL(s.url??"/","http://127.0.0.1").pathname,f=`/${a.token}`;if(s.method==="OPTIONS"){n.writeHead(204,l()),n.end();return}if(s.method==="POST"&&v===`${f}/publish`){k(s).then(m=>s.headers["x-cssx-inline"]==="1"?m:h(d,"utf8")).then(m=>{x(o,m),n.writeHead(204,l()),n.end()},()=>{n.writeHead(503,l()),n.end()});return}if(s.method==="GET"&&v===`${f}/ready`){n.writeHead(o.ready?200:503,l()),n.end();return}if(s.method==="GET"&&v===`${f}/events`){if(c.size>=$){n.writeHead(503,{...l(),"Retry-After":"1"}),n.end();return}n.writeHead(200,{...l(),"Content-Type":"text/event-stream; charset=utf-8","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"}),c.add(n),b(o,n),s.on("close",()=>{c.delete(n),o.blockedClients.delete(n)});return}if(s.method==="GET"&&v===`${f}/stylesheet`){(o.latestCss===void 0?h(d,"utf8"):Promise.resolve(o.latestCss)).then(m=>{n.writeHead(200,{...l(),"Content-Type":"text/css; charset=utf-8","Cache-Control":"no-store"}),n.end(m)},()=>{n.writeHead(503,{...l(),"Cache-Control":"no-store"}),n.end("CSSX development stylesheet is not ready.")});return}if(s.method==="GET"&&v===`${f}/generated.css.map`){h(`${d}.map`,"utf8").then(m=>{n.writeHead(200,{...l(),"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),n.end(m)},()=>{n.writeHead(404,l()),n.end()});return}n.writeHead(404,l()),n.end()});return p.on("error",s=>{console.warn(`CSSX: development stylesheet transport unavailable on port ${a.port}: ${s.message}`)}),o.server=p,p.listen(a.port,"127.0.0.1"),p.unref(),S.set(r,o),C.set(y(a),o),a}function G(e){let t=S.get(u(e));if(t){if(t.references>1){t.references--;return}for(let r of t.clients)r.end();t.blockedClients.clear(),t.server?.close(),S.delete(u(e)),C.delete(y(t.connection))}}async function F(e,t){let r=C.get(y(e));if(r){let d=t??await h(r.stylesheetFile,"utf8");x(r,d);return}let i=`http://127.0.0.1:${e.port}/${e.token}/publish`,a={method:"POST",...t===void 0?{}:{body:t,headers:{"X-CSSX-Inline":"1"}}},c;for(let d=0;d<20;d++){try{let o=await fetch(i,a);if(o.status===204)return;c=new Error(`Unexpected HTTP status ${o.status}.`)}catch(o){c=o}await new Promise(o=>setTimeout(o,25))}throw new Error(`CSSX development stylesheet transport did not become available: ${String(c)}`)}function k(e){return new Promise((t,r)=>{let i=[];e.on("data",a=>i.push(g.from(a))),e.on("end",()=>t(g.concat(i).toString("utf8"))),e.on("error",r)})}async function L(e){let t=`http://127.0.0.1:${e.port}/${e.token}/ready`;for(let r=0;r<300;r++){try{if((await fetch(t,{cache:"no-store"})).ok)return}catch{}await new Promise(i=>setTimeout(i,100))}throw new Error("CSSX Next.js development stylesheet did not become ready within 30 seconds.")}function x(e,t){if(e.ready&&e.latestCss===t)return;e.revision++,e.ready=!0,e.latestCss=t;let r=`data: ${JSON.stringify({revision:e.revision,css:t})}
|
|
2
|
+
|
|
3
|
+
`;for(let i of e.clients)H(e,i,r)}function b(e,t){H(e,t,`data: ${JSON.stringify({revision:e.revision,css:e.latestCss})}
|
|
4
|
+
|
|
5
|
+
`)}function H(e,t,r){e.blockedClients.has(t)||t.write(r)||(e.blockedClients.add(t),t.once("drain",()=>{e.blockedClients.delete(t),e.clients.has(t)&&b(e,t)}))}function y(e){return`${e.port}:${e.token}`}function l(){return{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, X-CSSX-Inline"}}export{B as a,G as b,F as c,L as d,H as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(s){let e=[],n=/\bsx\s*\(/g;for(let a of s.matchAll(n)){let o=a.index,m=s.indexOf("(",o),l=0,i="";for(let r=m;r<s.length;r+=1){let t=s[r];if(i){t==="\\"?r+=1:t===i&&(i="");continue}if(t==='"'||t==="'"||t==="`")i=t;else if(t==="(")l+=1;else if(t===")"&&--l===0){e.push({start:o,end:r+1,code:s.slice(o,r+1)}),n.lastIndex=r+1;break}}}return e}function g(s,e){return{code:s,rules:e.flatMap(n=>n.rules),candidates:Object.assign({},...e.map(n=>n.candidates)),composites:Object.assign({},...e.map(n=>n.composites)),atomicClasses:[...new Set(e.flatMap(n=>n.atomicClasses))],origins:Object.assign({},...e.map(n=>n.origins)),cssOnlySignature:s}}function h(s){let e="const style = ",n=s.indexOf(e)+e.length,a=s.indexOf(";",n);return s.slice(n,a)}export{d as a,g as b,h as c};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"path";import{fileURLToPath as e}from"url";var o=()=>e(import.meta.url),m=()=>t.dirname(o()),n=m();export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{watch as N}from"fs";import{dirname as I,resolve as g}from"path";var C=8,_=256,f=0;function H(a,v=N,S="Vite's watcher"){let s=new Map,i=new Map,c=new Map,u=!1,y=t=>{let e=c.get(t);e&&(clearTimeout(e),c.delete(t))},d=(t,e)=>{if(s.get(t)===e){s.delete(t),f--,e.watcher.close();for(let r of e.ids)i.delete(r),y(r);e.ids.clear()}},W=t=>{c.has(t)||c.size>=_||c.set(t,setTimeout(()=>{c.delete(t),a(t)},2))},m=t=>{u=!0;for(let[e,r]of s)d(e,r);console.warn(`CSSX: native source watcher failed; using ${S}: ${t.message}`)};return{close:()=>{for(let[t,e]of s)d(t,e);i.clear();for(let t of c.values())clearTimeout(t);c.clear()},unwatch:t=>{let e=g(t);y(e);let r=i.get(e);if(!r)return;i.delete(e);let n=s.get(r);n?.ids.delete(e),n&&n.ids.size===0&&d(r,n)},watch:t=>{let e=g(t);if(u||i.has(e))return;let r=I(e),n=s.get(r);if(!n){if(f>=C)return;try{let o=new Set,p=v(r,{persistent:!1},(w,l)=>{let T=l===null?[...o]:[g(r,l.toString())].filter(h=>o.has(h));for(let h of T)W(h)});n={watcher:p,ids:o},s.set(r,n),f++,p.on("error",w=>{s.get(r)===n&&m(w)})}catch(o){m(o instanceof Error?o:new Error(String(o)));return}}n.ids.add(e),i.set(e,r)}}}import{createHash as M}from"crypto";function B(a){return M("sha256").update(a).digest("hex")}export{B as a,H as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function x(c,g,t){let p=t.naming??(t.stableClassNames?"source":t.className?.variant==="random"?"hash":t.className?.variant??"serial"),f=t.stableClassNames?"stableClassNames compatibility option selects source-addressed composites":t.naming?"explicit naming option":t.className?.variant?"className.variant option":"default serial naming",i=new Map,m=new Map;for(let e of[...c].sort((n,s)=>n.id.localeCompare(s.id))){let n=new Map;for(let[s,o]of Object.entries(e.candidates)){let r=m.get(s)??new Set;r.add(o),m.set(s,r);let a=i.get(o)??{module:e.id,utilities:new Set,line:e.origins?.[s]?.line??0,column:e.origins?.[s]?.column??0};a.utilities.add(s),i.set(o,a);let l=n.get(o)??[];l.push(s),n.set(o,l)}for(let[s,o]of Object.entries(e.composites??{})){let r=o.flatMap(d=>n.get(d)??[]),a=r[0],l=i.get(s)??{module:e.id,utilities:new Set,line:a?e.origins?.[a]?.line??0:0,column:a?e.origins?.[a]?.column??0:0};for(let d of r)l.utilities.add(d);i.set(s,l)}for(let s of e.atomicClasses??[])i.has(s)||i.set(s,{module:e.id,utilities:new Set,line:0,column:0})}let y=[...i].sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>({className:e,module:n.module,utilities:[...n.utilities].sort(),line:n.line+1,column:n.column+1,selectorFound:new RegExp(`\\.${C(e)}(?:[^A-Za-z0-9_-]|$)`).test(g)})),u=[...m].filter(([,e])=>e.size>1).map(([e])=>e).sort();return{version:1,naming:{mode:p,reason:f},coordination:{mode:t.coordination??"memory",...t.coordination==="manifest"&&t.manifestPath?{manifestPath:t.manifestPath}:{}},classes:y,serverClientMappings:{status:u.length>0?"mismatch":t.coordination==="manifest"?"manifest-shared":"consistent-in-process",conflicts:u}}}function C(c){return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{x as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as A,b as se}from"./chunk-VSO4AWLZ.js";import{b as ee}from"./chunk-YZ7P3BSQ.js";import{a as K}from"./chunk-JFKLWSSR.js";import{a as b,c as q}from"./chunk-62JIYM5O.js";import{a as z,c as G,d as Q,f as Z}from"./chunk-ERSPVOTN.js";import{c as te}from"./chunk-YYF5QU33.js";import{a as V,d as U,e as Y,h as _,i as j}from"./chunk-ZCSG362J.js";import{a as M}from"./chunk-3C3MRH6A.js";import{createClassNameAllocator as ge}from"@cssxio/compiler";import{Buffer as ie}from"buffer";import{mkdir as ye,readFile as le,unlink as ce,writeFile as me}from"fs/promises";import{basename as ue,dirname as Se,resolve as F}from"path";async function ae(r,o){let i=await M(o);return b(r.map(([,u])=>u),i,o.layer,o.sourceMap??!0,o.darkMode,o.preflight)}function oe(r){return/\.tsx?$/.test(r)?"ts":"js"}var we=/\.[cm]?[jt]sx?$/,ve=64,de=16*1024*1024;function Ce(r={}){if(V(r),r.classNameAllocator&&r.className)throw new Error("CSSX classNameAllocator owns naming. Omit className when supplying a custom allocator.");let o=new Map,i=r.mode==="development",u=r.classNameAllocator??ge(i?{...r.className,variant:"random"}:_(r)),p,v;return{name:"@cssxio/unplugin",setup(d){let l=d.initialOptions.absWorkingDir??process.cwd(),B=r.sourceRoots?.map(e=>F(l,e)),h=j(r);d.initialOptions.metafile=!0;let f,g,k=0,N=0,R,H,D,E=-1,$,C,P=new Map,L=new WeakMap,S=new Map,T=0,x=e=>{let s=S.get(e);s&&(T-=s.size,S.delete(e))},pe=(e,s,t)=>{let n=(s.length+t.code.length)*2;if(n>de){x(e);return}for(x(e);S.size>=ve||T+n>de;){let a=S.keys().next().value;if(a===void 0)break;x(a)}S.set(e,{sourceSignature:A(s),result:t,size:n}),T+=n},X=(e,s)=>{if(!s){let m=o.delete(e);return P.delete(e),x(e),C?.unwatch(e),m}let t={id:e,candidates:s.candidates,composites:s.composites,atomicClasses:s.atomicClasses,origins:s.origins},n=JSON.stringify([t.candidates,t.composites,t.atomicClasses,t.origins]),a=o.get(e),y=a===void 0||L.get(a)!==n;return L.set(t,n),o.set(e,t),P.set(e,s.cssOnlySignature),te({...t,rules:[]})?C?.watch(e):C?.unwatch(e),y},J=async e=>{let s=await g;if(!s||!f)return;let t=q(e,"generated.css");t!==H&&(await s.publishNextDevelopmentStylesheet(f,t),H=t)},I=()=>!i||k===0||!g?Promise.resolve():(N++,R||(R=new Promise(e=>setImmediate(e)).then(async()=>{let e=-1;do{e=N;let s=await M(r,l),t=await b([...o.values()],s,h.layer,h.sourceMap,r.darkMode,r.preflight);D=t,E=e,$=s,await J(t)}while(e!==N)}).catch(e=>{console.warn(`CSSX: esbuild stylesheet update failed: ${e instanceof Error?e.message:String(e)}`)}).finally(()=>{R=void 0})),R),he=async e=>{if(!f)return;let s=P.get(e);if(s)try{let t=await le(e,"utf8");if(S.get(e)?.sourceSignature===A(t))return;let n=await fe(t,e,l,r,i,u);if(!n||n.cssOnlySignature!==s){x(e);return}let a=X(e,n);pe(e,t,n),a&&await I()}catch(t){t.code!=="ENOENT"&&console.warn(`CSSX: esbuild stylesheet update failed: ${t instanceof Error?t.message:String(t)}`)}};if(i){let e=F(l,".cssx/esbuild.css");C=se(he,void 0,"esbuild watcher"),g=import("@cssxio/unplugin/internal/development-runtime").then(s=>(f=s.startNextDevelopmentServer(l,e),s)),g=g.catch(s=>{console.warn(`CSSX: esbuild development runtime failed: ${String(s)}`)}),d.onDispose(()=>{g?.then(s=>s?.stopNextDevelopmentServer(l)),C?.close(),C=void 0,S.clear(),T=0,P.clear(),f=void 0})}d.onLoad({filter:we},async({path:e})=>{let s=await g;if(Q(e,B))return;let t=await le(e,"utf8"),n=await z(e),a=S.get(n),y=i&&a?.sourceSignature===A(t),m=y?a.result:await fe(t,e,l,r,i,u);if(y&&x(n),!m){let O=i?X(n,null):o.delete(n);i&&O&&await I();return}let w=i?X(n,m):!0;return i||o.set(n,{id:n,candidates:m.candidates,composites:m.composites,atomicClasses:m.atomicClasses,origins:m.origins}),i&&k>0&&w&&!y&&await I(),{contents:f?`${m.code}
|
|
2
|
+
${s?.nextDevelopmentStylesheetHmr(f,r.cssFileName??"cssx.css")}`:m.code,loader:oe(e),...r.themeFile?{watchFiles:[F(l,r.themeFile)]}:{}}}),d.onEnd(async e=>{if(k++,e.errors?.length||!e.metafile)return;let s=new Set(await Promise.all(Object.keys(e.metafile.inputs).map(c=>z(F(l,c))))),t=!1;for(let c of o.keys())s.has(c)||(o.delete(c),P.delete(c),x(c),C?.unwatch(c),t=!0);t&&(E=-1);let n;if(i){await R;let c=await M(r,l);n=!t&&D!==void 0&&E===N&&$===c?D:await b([...o.values()],c,h.layer,h.sourceMap,r.darkMode,r.preflight),D=n,E=N,$=c;try{await J(n)}catch(W){console.warn(`CSSX: esbuild stylesheet update failed: ${W instanceof Error?W.message:String(W)}`)}}else{let c=r.coordination==="manifest"?(await ee(l,r)).map(O=>[O.id,O]):[...o];n=await ae(c,r)}let a=Y(l,d.initialOptions,U(r.cssFileName??"cssx.css",n.css));if(!n.css){p&&await ce(p).catch(()=>{}),v&&await ce(v).catch(()=>{}),p=void 0,v=void 0;return}let y=n.map?`${n.css}
|
|
3
|
+
/*# sourceMappingURL=${ue(a)}.map */`:n.css,m=`${a}.map`,w=n.map?JSON.stringify({...n.map,file:ue(a)}):void 0;if(d.initialOptions.write===!1){if(!e.outputFiles)return;if(e.outputFiles.some(c=>c.path===a))throw new Error(`CSSX CSS asset collision at "${a}".`);e.outputFiles.push({path:a,contents:ie.from(y),hash:"",text:y}),w&&e.outputFiles.push({path:m,contents:ie.from(w),hash:"",text:w});return}await ye(Se(a),{recursive:!0}),await me(a,y),w&&await me(m,w),p=a,v=w?m:void 0})}}}async function fe(r,o,i,u,p,v){let d=p||u.stableClassNames||u.naming==="source",l=p?j(u):void 0,h={...{...l??u,stableClassNames:d,className:l?l.className:_(u),...d?{stableClassNameFileName:G(i,o,p)}:{},classNameAllocator:v}};delete h.coordination,delete h.manifestPath;let f=g=>Z(r,o,{...h,classNameAllocator:g},void 0,{compileCss:!1});return!p&&u.coordination==="manifest"?K(u.manifestPath,h.className,f):f(v)}export{Ce as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o="@cssxio/unplugin/rules";function n(){return{id:"",rules:[],candidates:{},composites:{},origins:{},cssOnlySignature:""}}function r(e){return e.rules.length>0||Object.keys(e.candidates).length>0||Object.keys(e.composites??{}).length>0}export{o as a,n as b,r as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as L}from"./chunk-JFKLWSSR.js";import{a as T}from"./chunk-CUKIYXQD.js";import{b as M,c as R,d as I,e as K,f as J}from"./chunk-ERSPVOTN.js";import{g as z}from"./chunk-ZCSG362J.js";import{createClassNameAllocator as ie}from"@cssxio/compiler";import{watch as ce}from"fs";import{readFile as _,readdir as le,stat as D}from"fs/promises";import{dirname as B,extname as Q,resolve as b}from"path";import{createRequire as re}from"module";import{resolve as ae}from"path";import{pathToFileURL as V}from"url";async function X(a,t,n={}){let s=re(ae(t,"package.json")),c;try{c=s.resolve("@mdx-js/mdx")}catch{throw new Error("CSSX Next MDX support requires @mdx-js/mdx to be installed in the Next.js project.")}let u=await import(V(c).href),g=async r=>Promise.all((r??[]).map(async d=>{let[i,l]=typeof d=="string"?[d,void 0]:d,e=s.resolve(i),o=await import(V(e).href),m=o.default??o;return l===void 0?m:[m,l]}));return String(await u.compile(a,{outputFormat:"program",development:n.development??!1,remarkPlugins:await g(n.remarkPlugins),rehypePlugins:await g(n.rehypePlugins),recmaPlugins:await g(n.recmaPlugins)}))}async function ee(a,t){let n=M(a),s=await K(n,t.sourceRoots?.map(l=>M(b(n,l)))),c={...t};delete c.coordination,delete c.manifestPath,delete c.classNameAllocator;let u=async l=>{let e=[];for(let o of s){let m=await _(o,"utf8"),f=/\.(?:md|mdx)$/i.test(o);if(f&&!m.includes(t.importSource??"@cssxio/cssx"))continue;let C=f?await X(m,n,t.mdx):m,v=t.stableClassNames||t.naming==="source",E=v?R(n,o,t.mode==="development"):void 0;if(!f&&!/\.(?:astro|vue)$/i.test(o)){let x=await T(C,o,n,t,l,E??o);if(x.handled){x.module&&e.push(x.module);continue}}let h=await J(C,f?`${o}.tsx`:o,{...c,classNameAllocator:l,stableClassNames:v,...v?{stableClassNameFileName:E}:{}},void 0,{compileCss:!1});h&&e.push({id:o,candidates:h.candidates,composites:h.composites,atomicClasses:h.atomicClasses,origins:h.origins})}return e};if(t.coordination==="manifest")return L(t.manifestPath,z(t),u);let g=O(n,t),r=te(a,t),d=F.get(g);if(d)return await d,ee(a,t);let i=(async()=>{let l=new Set;for(let e of s){let o;try{o=await D(e,{bigint:!0})}catch($){if($.code!=="ENOENT")throw $;r.signatures.delete(e),r.modules.delete(e);continue}let m=`${o.dev}:${o.ino}:${o.size}:${o.mtimeNs}:${o.ctimeNs}`;if(r.signatures.get(e)===m){l.add(e);continue}let f;try{f=await _(e,"utf8")}catch($){if($.code!=="ENOENT")throw $;r.signatures.delete(e),r.modules.delete(e);continue}l.add(e);let C=/\.(?:md|mdx)$/i.test(e),v=f.includes(t.importSource??"@cssxio/cssx");if(C&&!v){r.modules.delete(e),r.signatures.set(e,m);continue}let E=C?await X(f,n,t.mdx):f,h=t.stableClassNames||t.naming==="source",x=h?R(n,e,t.mode==="development"):void 0;if(!C&&!/\.(?:astro|vue)$/i.test(e)){let $=await T(E,e,n,t,r.allocator,x??e);if($.handled){$.module?r.modules.set(e,$.module):r.modules.delete(e),r.signatures.set(e,m);continue}}let N=await J(E,C?`${e}.tsx`:e,{...c,classNameAllocator:r.allocator,stableClassNames:h,...h?{stableClassNameFileName:x}:{}},void 0,{compileCss:!1});N?r.modules.set(e,{id:e,candidates:N.candidates,composites:N.composites,atomicClasses:N.atomicClasses,origins:N.origins}):r.modules.delete(e),r.signatures.set(e,m)}for(let e of r.signatures.keys())l.has(e)||(r.signatures.delete(e),r.modules.delete(e));return[...r.modules.values()].sort((e,o)=>e.id.localeCompare(o.id))})();F.set(g,i);try{return await i}finally{F.delete(g)}}function Re(a,t){return te(a,t).allocator}async function Te(a,t,n,s,c){if(n.coordination==="manifest")return!1;let u=O(a,n),g=F.get(u);g&&await g;let r=w.get(u);if(!r)return!1;let d=M(t),i;try{let e=await D(d,{bigint:!0});if(c!==void 0&&await _(d,"utf8")!==c)return!1;i=`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`}catch(e){if(e.code==="ENOENT"){let o=w.get(u);return o?.signatures.delete(d),o?.modules.delete(d)??!1}throw e}let l=r.modules.has(d);return s?r.modules.set(d,{id:d,candidates:s.candidates,composites:s.composites,atomicClasses:s.atomicClasses,origins:s.origins}):r.modules.delete(d),r.signatures.set(d,i),l||s!==null}function de(a,t){let n=w.get(O(a,t));return n?[...n.modules.values()].sort((s,c)=>s.id.localeCompare(c.id)):void 0}function Je(a,t){q.add(O(a,t))}function Xe(a,t){let n=O(a,t);q.delete(n),k.get(n)?.stop(),w.delete(n)}function O(a,t){let n={...t};return delete n.coordination,delete n.manifestPath,delete n.classNameAllocator,`${M(a)}\0${JSON.stringify(n)}`}function te(a,t){let n=O(a,t),s=w.get(n);return s||(s={allocator:t.classNameAllocator??ie(z(t)),modules:new Map,signatures:new Map},w.set(n,s),ue(n)),s}function ue(a){if(!(w.size<=Y))for(let t of w.keys()){if(w.size<=Y)return;t!==a&&!q.has(t)&&!k.has(t)&&w.delete(t)}}var w=new Map,F=new Map,q=new Set,Y=8,me=256,Z=16,A=0,fe=new Set([".js",".jsx",".ts",".tsx",".cjs",".cjsx",".cts",".ctsx",".mjs",".mjsx",".mts",".mtsx",".astro",".md",".mdx"]);async function _e(a,t,n,s=()=>!1){let c=M(a),u=O(c,t),g=k.get(u);if(g)return Promise.resolve(g.stop);let r=F.get(u);r&&await r;let d=t.sourceRoots?.map(S=>b(c,S))??[],i=new Map,l=new Set,e=!1,o=!1,m,f=!1,C=!1,v=!1,E=!1,h=S=>{if(!(o||l.has(S))){if(l.size>=me){l.clear(),o=!0;return}l.add(S),F.has(u)&&(e=!0)}},x=(S=0)=>{m&&clearTimeout(m),m=setTimeout(()=>{m=void 0,$()},S)},N=async()=>{let S=await pe(c,d,[...w.get(u)?.modules.values()??[]],t.themeFile?b(c,t.themeFile):void 0);if(f)return;let W=new Set(S);for(let[P,p]of i)W.has(P)||(p.close(),i.delete(P),A--);for(let P of S){if(i.has(P))continue;if(A>=Z){v||(v=!0,console.warn(`CSSX: development source watcher reached the ${Z}-directory limit.`));continue}let p;try{p=ce(P,(y,G)=>{if(f)return;if(G===null){o=!0,x(8);return}let j=b(P,G.toString());if(I(j,d)||s(j))return;if(Q(j)===".css"&&M(j)===M(b(c,t.themeFile??""))){h(j),x();return}let H=Q(j);if(y==="rename"&&H==="")o=!0;else if(xe(H))h(j);else return;let se=w.get(u)?.signatures.has(M(j))??!1;x(y==="rename"&&!se?8:0)})}catch(y){E||(E=!0,console.warn(`CSSX: development source watcher could not watch ${P}: ${y instanceof Error?y.message:String(y)}`));continue}p.on("error",y=>{i.get(P)===p&&(i.delete(P),A--,p.close(),console.warn(`CSSX: development source watcher stopped for ${P}: ${y.message}`))}),p.unref(),i.set(P,p),A++}},$=async()=>{if(f||C)return;C=!0;let S=[...l],W=o,P=e;l.clear(),o=!1,e=!1;try{if(W){let p=await ee(c,t);if(f){w.delete(u);return}await N(),f||await n(p)}else{let p=P;for(let y of S)t.themeFile&&M(y)===M(b(c,t.themeFile))?p=!0:p=await ge(c,y,t)||p;if(p&&!f){let y=de(c,t);await n(y)}}}catch(p){f||console.warn(`CSSX: development source update failed: ${p instanceof Error?p.message:String(p)}`)}finally{C=!1,(o||l.size>0)&&!m&&x()}},U=()=>{f=!0,m&&clearTimeout(m),l.clear(),o=!1,e=!1;for(let S of i.values())S.close(),A--;i.clear(),k.delete(u),w.delete(u)};return k.set(u,{stop:U}),await N().catch(S=>{console.warn(`CSSX: development source watcher could not start: ${S instanceof Error?S.message:String(S)}`)}),U}async function ge(a,t,n){let s=M(t),c=O(a,n),u=w.get(c),g=u?.signatures.get(s),r=u?.modules.has(s)??!1,d=F.get(c);d&&await d;let i=w.get(c);if(!i)return!1;let l=i.modules.has(s);try{let e=await D(s,{bigint:!0}),o=`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`;if(i.signatures.get(s)===o)return g!==o;let m=await _(s,"utf8"),f=/\.(?:md|mdx)$/i.test(s);if(f&&!m.includes(n.importSource??"@cssxio/cssx"))return i.modules.delete(s),i.signatures.set(s,o),l;let C=f?await X(m,a,n.mdx):m,v=n.stableClassNames||n.naming==="source",E=v?R(a,s,n.mode==="development"):void 0;if(!f&&!/\.(?:astro|vue)$/i.test(s)){let N=await T(C,s,a,n,i.allocator,E??s);if(N.handled)return N.module?i.modules.set(s,N.module):i.modules.delete(s),i.signatures.set(s,o),l||N.module!==void 0}let h={...n};delete h.coordination,delete h.manifestPath,delete h.classNameAllocator;let x=await J(C,f?`${s}.tsx`:s,{...h,classNameAllocator:i.allocator,stableClassNames:v,...v?{stableClassNameFileName:E}:{}},void 0,{compileCss:!1});return x?i.modules.set(s,{id:s,candidates:x.candidates,composites:x.composites,atomicClasses:x.atomicClasses,origins:x.origins}):i.modules.delete(s),i.signatures.set(s,o),l||x!==null}catch(e){if(e.code==="ENOENT")return i.signatures.delete(s),i.modules.delete(s),l||r;throw e}}async function pe(a,t,n,s){let c=new Set([a,...t,...n.map(g=>B(g.id)),...s?[B(s)]:[]]),u=[];for(let g of c){let r=b(g);if(!I(r,t))try{await le(r),u.push(r)}catch(d){if(d.code==="ENOENT")continue;throw d}}return u}function xe(a){return fe.has(a)}var k=new Map;export{X as a,ee as b,Re as c,Te as d,de as e,Je as f,Xe as g,_e as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(e){let r=2166136261;for(let a=0;a<e.length;a++)r^=e.charCodeAt(a),r=Math.imul(r,16777619);return(r>>>0).toString(36)}import{isAbsolute as l,normalize as m,sep as d}from"path";function s(e){if(!e||l(e))throw new Error("cssFileName must be a non-empty relative path.");let r=m(e);if(r===".."||r.startsWith(`..${d}`))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,r){return s(e).replaceAll("[hash]",i(r))}import{dirname as c,resolve as o}from"path";function f(e,r,a){return r.outdir?o(e,r.outdir,a):r.outfile?o(c(o(e,r.outfile)),a):o(e,a)}function g(e){if(e.mode!==void 0&&e.mode!=="development"&&e.mode!=="production")throw new Error('CSSX mode must be "development" or "production".');if(e.stableClassNameStrategy!==void 0&&e.stableClassNameStrategy!=="source-location"&&e.stableClassNameStrategy!=="module-order")throw new Error('CSSX stableClassNameStrategy must be "source-location" or "module-order".');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.');s(e.cssFileName??"cssx.css")}function h(e){return e.replaceAll("\\","/").split("?",1).join("")}import{sep as y}from"path";function C(e,r){return`${e&&e!=="/"?`/${b(e)}`:""}/${s(r).replaceAll(y,"/")}`}function b(e){let r=0,a=e.length;for(;e.charCodeAt(r)===47;)r++;for(;a>r&&e.charCodeAt(a-1)===47;)a--;return e.slice(r,a)}function w(e){let r=e.naming==="hash"?"random":e.naming==="serial"?"serial":void 0;if(r&&e.className?.variant&&e.className.variant!==r)throw new Error(`CSSX naming: "${e.naming}" conflicts with className.variant: "${e.className.variant}".`);return{...e.className,...r?{variant:r}:{}}}function W(e){let r=w(e);return e.className!==void 0||e.naming!==void 0||e.coordination==="manifest"||e.stableClassNames===!0?r:{...r,suffix:""}}function Z(e){return{...e,mode:"development",sourceMap:e.sourceMap??!1,naming:"source",stableClassNames:!0,stableClassNameStrategy:"module-order",reusabilityBudget:0,className:{...e.className,variant:"random"},classNameAllocator:void 0,coordination:"memory",manifestPath:void 0}}function T(e,r={}){return e.mode!==void 0?e.mode==="development":process.env.NODE_ENV==="development"||r.watchMode===!0||r.bundlerMode==="development"||r.viteDevServer===!0}export{g as a,h as b,i as c,u as d,f as e,C as f,w as g,W as h,Z as i,T as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"magic-string";function m(e,n,o){let r=new l(e);for(let t of[...o].sort((s,i)=>s.start-i.start))r.overwrite(t.start,t.end,t.content);let a=JSON.parse(r.generateMap({hires:!0,includeContent:!0,source:n}).toString());return{code:r.toString(),map:a}}export{m as a};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DarkMode } from '@cssxio/compiler';
|
|
2
|
+
import { b as CssxSourceModule, c as CssxStylesheet } from './stylesheet-types-DF-aQ6hZ.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds one stylesheet from source module data.
|
|
6
|
+
*
|
|
7
|
+
* @param data CSSX data from source modules.
|
|
8
|
+
* @param theme Optional CSS theme input.
|
|
9
|
+
* @param layer Optional CSS layer for the output.
|
|
10
|
+
* @param sourceMap Whether to generate a CSS source map.
|
|
11
|
+
* @param darkMode Controls how the `dark` variant is activated.
|
|
12
|
+
* @param preflight Whether to add the browser baseline before utility rules.
|
|
13
|
+
* @returns The generated CSS and its source map when source locations exist.
|
|
14
|
+
*/
|
|
15
|
+
declare function compileCssxStylesheet(data: readonly CssxSourceModule[], theme?: string, layer?: string, sourceMap?: boolean, darkMode?: DarkMode, preflight?: boolean): Promise<CssxStylesheet>;
|
|
16
|
+
|
|
17
|
+
export { compileCssxStylesheet as c };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DarkMode } from '@cssxio/compiler';
|
|
2
|
+
import { b as CssxSourceModule, c as CssxStylesheet } from './stylesheet-types-DF-aQ6hZ.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds one stylesheet from source module data.
|
|
6
|
+
*
|
|
7
|
+
* @param data CSSX data from source modules.
|
|
8
|
+
* @param theme Optional CSS theme input.
|
|
9
|
+
* @param layer Optional CSS layer for the output.
|
|
10
|
+
* @param sourceMap Whether to generate a CSS source map.
|
|
11
|
+
* @param darkMode Controls how the `dark` variant is activated.
|
|
12
|
+
* @param preflight Whether to add the browser baseline before utility rules.
|
|
13
|
+
* @returns The generated CSS and its source map when source locations exist.
|
|
14
|
+
*/
|
|
15
|
+
declare function compileCssxStylesheet(data: readonly CssxSourceModule[], theme?: string, layer?: string, sourceMap?: boolean, darkMode?: DarkMode, preflight?: boolean): Promise<CssxStylesheet>;
|
|
16
|
+
|
|
17
|
+
export { compileCssxStylesheet as c };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-P7NG4XOZ.js";import{a as C,c as x}from"./chunk-62JIYM5O.js";import"./chunk-6TMSHR6Z.js";import{d as g,e as h,i as w}from"./chunk-ZCSG362J.js";import"./chunk-3C3MRH6A.js";import"./chunk-SV3MUUMI.js";import{Buffer as E}from"buffer";import{mkdir as N,unlink as B,writeFile as F}from"fs/promises";import{basename as M,dirname as U,resolve as S}from"path";function q(D){let{options:r,cssFileName:k,sourceMap:b,dataById:c,getTheme:O}=D,l,e=process.cwd(),d,u,p,f=r.mode==="development",m=f?w(r):r;return{config(n){n.metafile=!0},setup(n){if(e=n.initialOptions.absWorkingDir??process.cwd(),f){let i=S(e,".cssx/esbuild.css");p=import("@cssxio/unplugin/internal/development-runtime").then(t=>{d=t.startNextDevelopmentServer(e,i),u=t.startDevelopmentCoordinator(e,i,m,d),u.catch(a=>{console.warn(`CSSX: esbuild development coordinator failed: ${String(a)}`)})}),p.catch(t=>{console.warn(`CSSX: esbuild development coordinator failed: ${String(t)}`)}),n.onDispose(()=>{p?.then(async()=>{await u?.then(a=>a(),()=>{});let{stopNextDevelopmentServer:t}=await import("@cssxio/unplugin/internal/development-runtime");t(e)},async()=>{let{stopNextDevelopmentServer:t}=await import("@cssxio/unplugin/internal/development-runtime");t(e)}),d=void 0})}n.onEnd(async i=>{if(i.errors?.length||!i.metafile)return;let t=new Set(Object.keys(i.metafile.inputs).map(o=>S(e,o)));for(let o of c.keys())t.has(o)||c.delete(o);let a=!f&&r.coordination==="manifest"?await import("./project-scan-EIM7BVPC.js").then(({scanProjectCssxSourceModules:o})=>o(e,r)):[...c.values()],v=await C(a,await O(),m.layer,b,m.darkMode,m.preflight),s=h(e,n.initialOptions,g(k,v.css));if(!v.css){l&&await B(l).catch(()=>{}),l=void 0;return}let y=x(v,M(s));if(n.initialOptions.write===!1){let o=i.outputFiles;if(!o)return;let P={path:s,contents:E.from(y),hash:"",text:y};if(o.some(H=>H.path===s))throw new Error(`CSSX CSS asset collision at "${s}".`);o.push(P);return}await N(U(s),{recursive:!0}),await F(s,y),l=s})},getWorkingDirectory:()=>e,getDevelopmentHmrConnection:async()=>(await p,d)}}export{q as createUniversalEsbuildHooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-FNYQGV2A.js";import"./chunk-M2QORA5D.js";import"./chunk-YZ7P3BSQ.js";import"./chunk-JFKLWSSR.js";import"./chunk-CUKIYXQD.js";import"./chunk-ZDJ2ZX5V.js";import"./chunk-6WHEMH4N.js";import"./chunk-62JIYM5O.js";import"./chunk-6TMSHR6Z.js";import"./chunk-ERSPVOTN.js";import"./chunk-ZCSG362J.js";import"./chunk-3C3MRH6A.js";import"./chunk-SV3MUUMI.js";export{a as startDevelopmentCoordinator,b as writeNextDevelopmentStylesheet};
|