@tailwindcss/node 4.0.0-beta.3 → 4.0.0-beta.4

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/index.d.mts CHANGED
@@ -4,6 +4,8 @@ import { ClassEntry, VariantEntry } from './intellisense';
4
4
  import { Theme } from './theme';
5
5
  import { Utilities } from './utilities';
6
6
  import { Variants } from './variants';
7
+ import { Features } from 'tailwindcss';
8
+ export { Features } from 'tailwindcss';
7
9
 
8
10
  declare const DEBUG: boolean;
9
11
 
@@ -41,10 +43,11 @@ declare function compile(css: string, { base, onDependency, shouldRewriteUrls, c
41
43
  base: string;
42
44
  pattern: string;
43
45
  }[];
44
- root: null | "none" | {
46
+ root: "none" | {
45
47
  base: string;
46
48
  pattern: string;
47
- };
49
+ } | null;
50
+ features: Features;
48
51
  build(candidates: string[]): string;
49
52
  }>;
50
53
  declare function __unstable__loadDesignSystem(css: string, { base }: {
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ import { ClassEntry, VariantEntry } from './intellisense';
4
4
  import { Theme } from './theme';
5
5
  import { Utilities } from './utilities';
6
6
  import { Variants } from './variants';
7
+ import { Features } from 'tailwindcss';
8
+ export { Features } from 'tailwindcss';
7
9
 
8
10
  declare const DEBUG: boolean;
9
11
 
@@ -41,10 +43,11 @@ declare function compile(css: string, { base, onDependency, shouldRewriteUrls, c
41
43
  base: string;
42
44
  pattern: string;
43
45
  }[];
44
- root: null | "none" | {
46
+ root: "none" | {
45
47
  base: string;
46
48
  pattern: string;
47
- };
49
+ } | null;
50
+ features: Features;
48
51
  build(candidates: string[]): string;
49
52
  }>;
50
53
  declare function __unstable__loadDesignSystem(css: string, { base }: {
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";var xe=Object.create;var _=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var s in t)_(e,s,{get:t[s],enumerable:!0})},H=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Re(t))!we.call(e,r)&&r!==s&&_(e,r,{get:()=>t[r],enumerable:!(i=ye(t,r))||i.enumerable});return e};var h=(e,t,s)=>(s=e!=null?xe(Ae(e)):{},H(t||!e||!e.__esModule?_(s,"default",{value:e,enumerable:!0}):s,e)),Ce=e=>H(_({},"__esModule",{value:!0}),e);var ot={};q(ot,{__unstable__loadDesignSystem:()=>et,compile:()=>Ze,env:()=>O,loadModule:()=>J,normalizePath:()=>b});module.exports=Ce(ot);var ge=h(require("module")),he=require("url");var O={};q(O,{DEBUG:()=>ve});var ve=Se(process.env.DEBUG);function Se(e){if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let t=e.split(",").map(s=>s.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}var y=h(require("enhanced-resolve")),de=require("jiti"),j=h(require("fs")),K=h(require("fs/promises")),R=h(require("path")),z=require("url"),I=require("tailwindcss");var N=h(require("fs/promises")),w=h(require("path")),Ee=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],_e=[".js",".cjs",".mjs"],Ne=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],ke=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function $e(e,t){for(let s of t){let i=`${e}${s}`;if((await N.default.stat(i).catch(()=>null))?.isFile())return i}for(let s of t){let i=`${e}/index${s}`;if(await N.default.access(i).then(()=>!0,()=>!1))return i}return null}async function Q(e,t,s,i){let r=_e.includes(i)?Ne:ke,o=await $e(w.default.resolve(s,t),r);if(o===null||e.has(o))return;e.add(o),s=w.default.dirname(o),i=w.default.extname(o);let n=await N.default.readFile(o,"utf-8"),c=[];for(let a of Ee)for(let l of n.matchAll(a))l[1].startsWith(".")&&c.push(Q(e,l[1],s,i));await Promise.all(c)}async function Y(e){let t=new Set;return await Q(t,e,w.default.dirname(e),w.default.extname(e)),Array.from(t)}var B=h(require("path"));var C=92,k=47,$=42,Pe=34,De=39,Ue=58,P=59,x=10,v=32,D=9,X=123,F=125,M=40,V=41,Te=91,be=93,Z=45,L=64,je=33;function te(e){e=e.replaceAll(`\r
1
+ "use strict";var xe=Object.create;var k=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ae(t))!we.call(e,r)&&r!==n&&k(e,r,{get:()=>t[r],enumerable:!(i=ye(t,r))||i.enumerable});return e};var h=(e,t,n)=>(n=e!=null?xe(Re(e)):{},H(t||!e||!e.__esModule?k(n,"default",{value:e,enumerable:!0}):n,e)),Ce=e=>H(k({},"__esModule",{value:!0}),e);var ot={};q(ot,{Features:()=>C.Features,__unstable__loadDesignSystem:()=>et,compile:()=>Ze,env:()=>O,loadModule:()=>J,normalizePath:()=>j});module.exports=Ce(ot);var ge=h(require("module")),he=require("url");var O={};q(O,{DEBUG:()=>Se});var Se=ve(process.env.DEBUG);function ve(e){if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let t=e.split(",").map(n=>n.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}var y=h(require("enhanced-resolve")),de=require("jiti"),I=h(require("fs")),K=h(require("fs/promises")),A=h(require("path")),z=require("url"),C=require("tailwindcss");var N=h(require("fs/promises")),w=h(require("path")),Ee=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],_e=[".js",".cjs",".mjs"],ke=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Ne=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function $e(e,t){for(let n of t){let i=`${e}${n}`;if((await N.default.stat(i).catch(()=>null))?.isFile())return i}for(let n of t){let i=`${e}/index${n}`;if(await N.default.access(i).then(()=>!0,()=>!1))return i}return null}async function Q(e,t,n,i){let r=_e.includes(i)?ke:Ne,o=await $e(w.default.resolve(n,t),r);if(o===null||e.has(o))return;e.add(o),n=w.default.dirname(o),i=w.default.extname(o);let s=await N.default.readFile(o,"utf-8"),c=[];for(let a of Ee)for(let l of s.matchAll(a))l[1].startsWith(".")&&c.push(Q(e,l[1],n,i));await Promise.all(c)}async function Y(e){let t=new Set;return await Q(t,e,w.default.dirname(e),w.default.extname(e)),Array.from(t)}var W=h(require("path"));var S=92,$=47,P=42,Pe=34,De=39,Ue=58,D=59,x=10,v=32,U=9,X=123,F=125,M=40,V=41,Te=91,be=93,Z=45,L=64,je=33;function te(e){e=e.replaceAll(`\r
2
2
  `,`
3
- `);let t=[],s=[],i=[],r=null,o=null,n="",c="",a;for(let l=0;l<e.length;l++){let f=e.charCodeAt(l);if(f===C)n+=e.slice(l,l+2),l+=1;else if(f===k&&e.charCodeAt(l+1)===$){let u=l;for(let d=l+2;d<e.length;d++)if(a=e.charCodeAt(d),a===C)d+=1;else if(a===$&&e.charCodeAt(d+1)===k){l=d+1;break}let m=e.slice(u,l+1);m.charCodeAt(2)===je&&s.push(re(m.slice(2,-2)))}else if(f===De||f===Pe){let u=l;for(let m=l+1;m<e.length;m++)if(a=e.charCodeAt(m),a===C)m+=1;else if(a===f){l=m;break}else{if(a===P&&e.charCodeAt(m+1)===x)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(f)}`);if(a===x)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(f)}`)}n+=e.slice(u,l+1)}else{if((f===v||f===x||f===D)&&(a=e.charCodeAt(l+1))&&(a===v||a===x||a===D))continue;if(f===x){if(n.length===0)continue;a=n.charCodeAt(n.length-1),a!==v&&a!==x&&a!==D&&(n+=" ")}else if(f===Z&&e.charCodeAt(l+1)===Z&&n.length===0){let u="",m=l,d=-1;for(let p=l+2;p<e.length;p++)if(a=e.charCodeAt(p),a===C)p+=1;else if(a===k&&e.charCodeAt(p+1)===$){for(let g=p+2;g<e.length;g++)if(a=e.charCodeAt(g),a===C)g+=1;else if(a===$&&e.charCodeAt(g+1)===k){p=g+1;break}}else if(d===-1&&a===Ue)d=n.length+p-m;else if(a===P&&u.length===0){n+=e.slice(m,p),l=p;break}else if(a===M)u+=")";else if(a===Te)u+="]";else if(a===X)u+="}";else if((a===F||e.length-1===p)&&u.length===0){l=p-1,n+=e.slice(m,p);break}else(a===V||a===be||a===F)&&u.length>0&&e[p]===u[u.length-1]&&(u=u.slice(0,-1));let A=ee(n,d);r?r.nodes.push(A):t.push(A),n=""}else if(f===P&&n.charCodeAt(0)===L)o=S(n),r?r.nodes.push(o):t.push(o),n="",o=null;else if(f===P&&c[c.length-1]!==")"){let u=ee(n);r?r.nodes.push(u):t.push(u),n=""}else if(f===X&&c[c.length-1]!==")")c+="}",o=U(n.trim()),r&&r.nodes.push(o),i.push(r),r=o,n="",o=null;else if(f===F&&c[c.length-1]!==")"){if(c==="")throw new Error("Missing opening {");if(c=c.slice(0,-1),n.length>0)if(n.charCodeAt(0)===L)o=S(n),r?r.nodes.push(o):t.push(o),n="",o=null;else{let m=n.indexOf(":");if(r){let d=n.indexOf("!important",m+1);r.nodes.push({kind:"declaration",property:n.slice(0,m).trim(),value:n.slice(m+1,d===-1?n.length:d).trim(),important:d!==-1})}}let u=i.pop()??null;u===null&&r&&t.push(r),r=u,n="",o=null}else if(f===M)c+=")",n+="(";else if(f===V){if(c[c.length-1]!==")")throw new Error("Missing opening (");c=c.slice(0,-1),n+=")"}else{if(n.length===0&&(f===v||f===x||f===D))continue;n+=String.fromCharCode(f)}}}if(n.charCodeAt(0)===L&&t.push(S(n)),c.length>0&&r){if(r.kind==="rule")throw new Error(`Missing closing } at ${r.selector}`);if(r.kind==="at-rule")throw new Error(`Missing closing } at ${r.name} ${r.params}`)}return s.length>0?s.concat(t):t}function S(e,t=[]){for(let s=5;s<e.length;s++){let i=e.charCodeAt(s);if(i===v||i===M){let r=e.slice(0,s).trim(),o=e.slice(s).trim();return E(r,o,t)}}return E(e.trim(),"",t)}function ee(e,t=e.indexOf(":")){let s=e.indexOf("!important",t+1);return{kind:"declaration",property:e.slice(0,t).trim(),value:e.slice(t+1,s===-1?e.length:s).trim(),important:s!==-1}}var Ie=64;function Oe(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function E(e,t="",s=[]){return{kind:"at-rule",name:e,params:t,nodes:s}}function U(e,t=[]){return e.charCodeAt(0)===Ie?S(e,t):Oe(e,t)}function se(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function re(e){return{kind:"comment",value:e}}function T(e,t,s=[],i={}){for(let r=0;r<e.length;r++){let o=e[r],n=[...s,o],c=s.at(-1)??null;if(o.kind==="context"){T(o.nodes,t,s,{...i,...o.context});continue}let a=t(o,{parent:c,context:i,path:n,replaceWith(l){e.splice(r,1,...Array.isArray(l)?l:[l]),r--}})??0;if(a===2)return;a!==1&&(o.kind==="rule"||o.kind==="at-rule")&&T(o.nodes,t,n,i)}}function ne(e){let t="",s=new Set,i=[],r=[];function o(l,f=0){let u="",m=" ".repeat(f);if(l.kind==="rule"){u+=`${m}${l.selector} {
3
+ `);let t=[],n=[],i=[],r=null,o=null,s="",c="",a;for(let l=0;l<e.length;l++){let f=e.charCodeAt(l);if(f===S)s+=e.slice(l,l+2),l+=1;else if(f===$&&e.charCodeAt(l+1)===P){let u=l;for(let d=l+2;d<e.length;d++)if(a=e.charCodeAt(d),a===S)d+=1;else if(a===P&&e.charCodeAt(d+1)===$){l=d+1;break}let m=e.slice(u,l+1);m.charCodeAt(2)===je&&n.push(re(m.slice(2,-2)))}else if(f===De||f===Pe){let u=l;for(let m=l+1;m<e.length;m++)if(a=e.charCodeAt(m),a===S)m+=1;else if(a===f){l=m;break}else{if(a===D&&e.charCodeAt(m+1)===x)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(f)}`);if(a===x)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(f)}`)}s+=e.slice(u,l+1)}else{if((f===v||f===x||f===U)&&(a=e.charCodeAt(l+1))&&(a===v||a===x||a===U))continue;if(f===x){if(s.length===0)continue;a=s.charCodeAt(s.length-1),a!==v&&a!==x&&a!==U&&(s+=" ")}else if(f===Z&&e.charCodeAt(l+1)===Z&&s.length===0){let u="",m=l,d=-1;for(let p=l+2;p<e.length;p++)if(a=e.charCodeAt(p),a===S)p+=1;else if(a===$&&e.charCodeAt(p+1)===P){for(let g=p+2;g<e.length;g++)if(a=e.charCodeAt(g),a===S)g+=1;else if(a===P&&e.charCodeAt(g+1)===$){p=g+1;break}}else if(d===-1&&a===Ue)d=s.length+p-m;else if(a===D&&u.length===0){s+=e.slice(m,p),l=p;break}else if(a===M)u+=")";else if(a===Te)u+="]";else if(a===X)u+="}";else if((a===F||e.length-1===p)&&u.length===0){l=p-1,s+=e.slice(m,p);break}else(a===V||a===be||a===F)&&u.length>0&&e[p]===u[u.length-1]&&(u=u.slice(0,-1));let R=ee(s,d);r?r.nodes.push(R):t.push(R),s=""}else if(f===D&&s.charCodeAt(0)===L)o=E(s),r?r.nodes.push(o):t.push(o),s="",o=null;else if(f===D&&c[c.length-1]!==")"){let u=ee(s);r?r.nodes.push(u):t.push(u),s=""}else if(f===X&&c[c.length-1]!==")")c+="}",o=T(s.trim()),r&&r.nodes.push(o),i.push(r),r=o,s="",o=null;else if(f===F&&c[c.length-1]!==")"){if(c==="")throw new Error("Missing opening {");if(c=c.slice(0,-1),s.length>0)if(s.charCodeAt(0)===L)o=E(s),r?r.nodes.push(o):t.push(o),s="",o=null;else{let m=s.indexOf(":");if(r){let d=s.indexOf("!important",m+1);r.nodes.push({kind:"declaration",property:s.slice(0,m).trim(),value:s.slice(m+1,d===-1?s.length:d).trim(),important:d!==-1})}}let u=i.pop()??null;u===null&&r&&t.push(r),r=u,s="",o=null}else if(f===M)c+=")",s+="(";else if(f===V){if(c[c.length-1]!==")")throw new Error("Missing opening (");c=c.slice(0,-1),s+=")"}else{if(s.length===0&&(f===v||f===x||f===U))continue;s+=String.fromCharCode(f)}}}if(s.charCodeAt(0)===L&&t.push(E(s)),c.length>0&&r){if(r.kind==="rule")throw new Error(`Missing closing } at ${r.selector}`);if(r.kind==="at-rule")throw new Error(`Missing closing } at ${r.name} ${r.params}`)}return n.length>0?n.concat(t):t}function E(e,t=[]){for(let n=5;n<e.length;n++){let i=e.charCodeAt(n);if(i===v||i===M){let r=e.slice(0,n).trim(),o=e.slice(n).trim();return _(r,o,t)}}return _(e.trim(),"",t)}function ee(e,t=e.indexOf(":")){let n=e.indexOf("!important",t+1);return{kind:"declaration",property:e.slice(0,t).trim(),value:e.slice(t+1,n===-1?e.length:n).trim(),important:n!==-1}}var Ie=64;function Oe(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function _(e,t="",n=[]){return{kind:"at-rule",name:e,params:t,nodes:n}}function T(e,t=[]){return e.charCodeAt(0)===Ie?E(e,t):Oe(e,t)}function ne(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function re(e){return{kind:"comment",value:e}}function b(e,t,n=[],i={}){for(let r=0;r<e.length;r++){let o=e[r],s=[...n,o],c=n.at(-1)??null;if(o.kind==="context"){if(b(o.nodes,t,n,{...i,...o.context})===2)return 2;continue}let a=t(o,{parent:c,context:i,path:s,replaceWith(l){e.splice(r,1,...Array.isArray(l)?l:[l]),r--}})??0;if(a===2)return 2;if(a!==1&&(o.kind==="rule"||o.kind==="at-rule")&&b(o.nodes,t,s,i)===2)return 2}}function se(e){let t="",n=new Set,i=[],r=[];function o(l,f=0){let u="",m=" ".repeat(f);if(l.kind==="rule"){u+=`${m}${l.selector} {
4
4
  `;for(let d of l.nodes)u+=o(d,f+1);u+=`${m}}
5
5
  `}else if(l.kind==="at-rule"){if(l.nodes.length===0)return`${m}${l.name} ${l.params};
6
- `;if(l.name==="@property"&&f===0){if(s.has(l.params))return"";let d=l.params,A=null,p=!1;for(let g of l.nodes)g.kind==="declaration"&&(g.property==="initial-value"?A=g.value:g.property==="inherits"&&(p=g.value==="true"));p?i.push(se(d,A??"initial")):r.push(se(d,A??"initial")),s.add(l.params)}u+=`${m}${l.name}${l.params?` ${l.params} `:" "}{
6
+ `;if(l.name==="@property"&&f===0){if(n.has(l.params))return"";let d=l.params,R=null,p=!1;for(let g of l.nodes)g.kind==="declaration"&&(g.property==="initial-value"?R=g.value:g.property==="inherits"&&(p=g.value==="true"));p?i.push(ne(d,R??"initial")):r.push(ne(d,R??"initial")),n.add(l.params)}u+=`${m}${l.name}${l.params?` ${l.params} `:" "}{
7
7
  `;for(let d of l.nodes)u+=o(d,f+1);u+=`${m}}
8
8
  `}else if(l.kind==="comment")u+=`${m}/*${l.value}*/
9
9
  `;else if(l.kind==="context")for(let d of l.nodes)u+=o(d,f);else if(l.kind==="at-root"){for(let d of l.nodes)t+=o(d,0);return u}else l.property!=="--tw-sort"&&l.value!==void 0&&l.value!==null&&(u+=`${m}${l.property}: ${l.value}${l.important?" !important":""};
10
- `);return u}let n="";for(let l of e){let f=o(l);f!==""&&(n+=f)}let c=[];i.length&&c.push(U(":root",i)),r.length&&c.push(U("*, ::before, ::after, ::backdrop",r));let a="";return c.length&&(a=o(E("@supports","(-moz-orient: inline)",[E("@layer","base",c)]))),`${n}${a}${t}`}function Fe(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var s=e.length;if(s<=1)return e;var i="";if(s>4&&e[3]==="\\"){var r=e[2];(r==="?"||r===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),i+o.join("/")}function b(e){let t=Fe(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var W=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,ie=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,Le=/(?:gradient|element|cross-fade|image)\(/,Me=/^\s*data:/i,Be=/^([a-z]+:)?\/\//,We=/^[A-Z_][.\w-]*\(/i,ze=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,Ge=/(?<!\\)"/g,Ke=/(?: |\\t|\\n|\\f|\\r)+/g,Je=e=>Me.test(e),qe=e=>Be.test(e);async function oe({css:e,base:t,root:s}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let i=te(e),r=[];function o(n){let c=B.posix.join(b(t),n),a=B.posix.relative(b(s),c);return a.startsWith(".")||(a="./"+a),a}return T(i,n=>{if(n.kind!=="declaration"||!n.value)return;let c=W.test(n.value),a=ie.test(n.value);if(c||a){let l=a?He:le;r.push(l(n.value,o).then(f=>{n.value=f}))}}),r.length&&await Promise.all(r),ne(i)}function le(e,t){return ce(e,W,async s=>{let[i,r]=s;return await ae(r.trim(),i,t)})}async function He(e,t){return await ce(e,ie,async s=>{let[,i]=s;return await Ye(i,async({url:o})=>W.test(o)?await le(o,t):Le.test(o)?o:await ae(o,o,t))})}async function ae(e,t,s,i="url"){let r="",o=e[0];if((o==='"'||o==="'")&&(r=o,e=e.slice(1,-1)),Qe(e))return t;let n=await s(e);return r===""&&n!==encodeURI(n)&&(r='"'),r==="'"&&n.includes("'")&&(r='"'),r==='"'&&n.includes('"')&&(n=n.replace(Ge,'\\"')),`${i}(${r}${n}${r})`}function Qe(e){return qe(e)||Je(e)||e[0]==="#"||We.test(e)}function Ye(e,t){return Promise.all(Xe(e).map(async({url:s,descriptor:i})=>({url:await t({url:s,descriptor:i}),descriptor:i}))).then(Ve)}function Xe(e){let t=e.trim().replace(Ke," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(ze);return Array.from(t,({groups:s})=>({url:s?.url?.trim()??"",descriptor:s?.descriptor?.trim()??""})).filter(({url:s})=>!!s)}function Ve(e){return e.map(({url:t,descriptor:s})=>t+(s?` ${s}`:"")).join(", ")}async function ce(e,t,s){let i,r=e,o="";for(;i=t.exec(r);)o+=r.slice(0,i.index),o+=await s(i),r=r.slice(i.index+i[0].length);return o+=r,o}var it={};async function Ze(e,{base:t,onDependency:s,shouldRewriteUrls:i,customCssResolver:r,customJsResolver:o}){let n=await(0,I.compile)(e,{base:t,async loadModule(c,a){return J(c,a,s,o)},async loadStylesheet(c,a){let l=await pe(c,a,s,r);return i&&(l.content=await oe({css:l.content,root:a,base:l.base})),l}});if(n.root&&n.root!=="none"){let c=/[*{]/,a=[];for(let f of n.root.pattern.split("/")){if(c.test(f))break;a.push(f)}if(!await K.default.stat(R.default.resolve(t,a.join("/"))).then(f=>f.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${n.root.pattern})\` does not exist`)}return n}async function et(e,{base:t}){return(0,I.__unstable__loadDesignSystem)(e,{base:t,async loadModule(s,i){return J(s,i,()=>{})},async loadStylesheet(s,i){return pe(s,i,()=>{})}})}async function J(e,t,s,i){if(e[0]!=="."){let c=await me(e,t,i);if(!c)throw new Error(`Could not resolve '${e}' from '${t}'`);let a=await ue((0,z.pathToFileURL)(c).href);return{base:(0,R.dirname)(c),module:a.default??a}}let r=await me(e,t,i);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[o,n]=await Promise.all([ue((0,z.pathToFileURL)(r).href+"?id="+Date.now()),Y(r)]);for(let c of n)s(c);return{base:(0,R.dirname)(r),module:o.default??o}}async function pe(e,t,s,i){let r=await rt(e,t,i);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(s(r),typeof globalThis.__tw_readFile=="function"){let n=await globalThis.__tw_readFile(r,"utf-8");if(n)return{base:R.default.dirname(r),content:n}}let o=await K.default.readFile(r,"utf-8");return{base:R.default.dirname(r),content:o}}var fe=null;async function ue(e){if(typeof globalThis.__tw_load=="function"){let t=await globalThis.__tw_load(e);if(t)return t}try{return await import(e)}catch{return fe??=(0,de.createJiti)(it.url,{moduleCache:!1,fsCache:!1}),await fe.import(e)}}var tt=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(j.default,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function rt(e,t,s){if(typeof globalThis.__tw_resolve=="function"){let i=globalThis.__tw_resolve(e,t);if(i)return Promise.resolve(i)}if(s){let i=await s(e,t);if(i)return i}return G(tt,e,t)}var st=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(j.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"]}),nt=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(j.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"]});async function me(e,t,s){if(typeof globalThis.__tw_resolve=="function"){let i=globalThis.__tw_resolve(e,t);if(i)return Promise.resolve(i)}if(s){let i=await s(e,t);if(i)return i}return G(st,e,t).catch(()=>G(nt,e,t))}function G(e,t,s){return new Promise((i,r)=>e.resolve({},s,t,{},(o,n)=>{if(o)return r(o);i(n)}))}process.versions.bun||ge.register?.((0,he.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader")));0&&(module.exports={__unstable__loadDesignSystem,compile,env,loadModule,normalizePath});
10
+ `);return u}let s="";for(let l of e){let f=o(l);f!==""&&(s+=f)}let c=[];i.length&&c.push(T(":root",i)),r.length&&c.push(T("*, ::before, ::after, ::backdrop",r));let a="";return c.length&&(a=o(_("@supports","(-moz-orient: inline)",[_("@layer","base",c)]))),`${s}${a}${t}`}function Fe(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var n=e.length;if(n<=1)return e;var i="";if(n>4&&e[3]==="\\"){var r=e[2];(r==="?"||r===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),i="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),i+o.join("/")}function j(e){let t=Fe(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var B=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,ie=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,Le=/(?:gradient|element|cross-fade|image)\(/,Me=/^\s*data:/i,We=/^([a-z]+:)?\/\//,Be=/^[A-Z_][.\w-]*\(/i,ze=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,Ge=/(?<!\\)"/g,Ke=/(?: |\\t|\\n|\\f|\\r)+/g,Je=e=>Me.test(e),qe=e=>We.test(e);async function oe({css:e,base:t,root:n}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let i=te(e),r=[];function o(s){let c=W.posix.join(j(t),s),a=W.posix.relative(j(n),c);return a.startsWith(".")||(a="./"+a),a}return b(i,s=>{if(s.kind!=="declaration"||!s.value)return;let c=B.test(s.value),a=ie.test(s.value);if(c||a){let l=a?He:le;r.push(l(s.value,o).then(f=>{s.value=f}))}}),r.length&&await Promise.all(r),se(i)}function le(e,t){return ce(e,B,async n=>{let[i,r]=n;return await ae(r.trim(),i,t)})}async function He(e,t){return await ce(e,ie,async n=>{let[,i]=n;return await Ye(i,async({url:o})=>B.test(o)?await le(o,t):Le.test(o)?o:await ae(o,o,t))})}async function ae(e,t,n,i="url"){let r="",o=e[0];if((o==='"'||o==="'")&&(r=o,e=e.slice(1,-1)),Qe(e))return t;let s=await n(e);return r===""&&s!==encodeURI(s)&&(r='"'),r==="'"&&s.includes("'")&&(r='"'),r==='"'&&s.includes('"')&&(s=s.replace(Ge,'\\"')),`${i}(${r}${s}${r})`}function Qe(e){return qe(e)||Je(e)||e[0]==="#"||Be.test(e)}function Ye(e,t){return Promise.all(Xe(e).map(async({url:n,descriptor:i})=>({url:await t({url:n,descriptor:i}),descriptor:i}))).then(Ve)}function Xe(e){let t=e.trim().replace(Ke," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(ze);return Array.from(t,({groups:n})=>({url:n?.url?.trim()??"",descriptor:n?.descriptor?.trim()??""})).filter(({url:n})=>!!n)}function Ve(e){return e.map(({url:t,descriptor:n})=>t+(n?` ${n}`:"")).join(", ")}async function ce(e,t,n){let i,r=e,o="";for(;i=t.exec(r);)o+=r.slice(0,i.index),o+=await n(i),r=r.slice(i.index+i[0].length);return o+=r,o}var it={};async function Ze(e,{base:t,onDependency:n,shouldRewriteUrls:i,customCssResolver:r,customJsResolver:o}){let s=await(0,C.compile)(e,{base:t,async loadModule(c,a){return J(c,a,n,o)},async loadStylesheet(c,a){let l=await pe(c,a,n,r);return i&&(l.content=await oe({css:l.content,root:a,base:l.base})),l}});if(s.root&&s.root!=="none"){let c=/[*{]/,a=[];for(let f of s.root.pattern.split("/")){if(c.test(f))break;a.push(f)}if(!await K.default.stat(A.default.resolve(t,a.join("/"))).then(f=>f.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${s.root.pattern})\` does not exist`)}return s}async function et(e,{base:t}){return(0,C.__unstable__loadDesignSystem)(e,{base:t,async loadModule(n,i){return J(n,i,()=>{})},async loadStylesheet(n,i){return pe(n,i,()=>{})}})}async function J(e,t,n,i){if(e[0]!=="."){let c=await me(e,t,i);if(!c)throw new Error(`Could not resolve '${e}' from '${t}'`);let a=await ue((0,z.pathToFileURL)(c).href);return{base:(0,A.dirname)(c),module:a.default??a}}let r=await me(e,t,i);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[o,s]=await Promise.all([ue((0,z.pathToFileURL)(r).href+"?id="+Date.now()),Y(r)]);for(let c of s)n(c);return{base:(0,A.dirname)(r),module:o.default??o}}async function pe(e,t,n,i){let r=await rt(e,t,i);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(n(r),typeof globalThis.__tw_readFile=="function"){let s=await globalThis.__tw_readFile(r,"utf-8");if(s)return{base:A.default.dirname(r),content:s}}let o=await K.default.readFile(r,"utf-8");return{base:A.default.dirname(r),content:o}}var fe=null;async function ue(e){if(typeof globalThis.__tw_load=="function"){let t=await globalThis.__tw_load(e);if(t)return t}try{return await import(e)}catch{return fe??=(0,de.createJiti)(it.url,{moduleCache:!1,fsCache:!1}),await fe.import(e)}}var tt=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(I.default,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function rt(e,t,n){if(typeof globalThis.__tw_resolve=="function"){let i=globalThis.__tw_resolve(e,t);if(i)return Promise.resolve(i)}if(n){let i=await n(e,t);if(i)return i}return G(tt,e,t)}var nt=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(I.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"]}),st=y.default.ResolverFactory.createResolver({fileSystem:new y.default.CachedInputFileSystem(I.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"]});async function me(e,t,n){if(typeof globalThis.__tw_resolve=="function"){let i=globalThis.__tw_resolve(e,t);if(i)return Promise.resolve(i)}if(n){let i=await n(e,t);if(i)return i}return G(nt,e,t).catch(()=>G(st,e,t))}function G(e,t,n){return new Promise((i,r)=>e.resolve({},n,t,{},(o,s)=>{if(o)return r(o);i(s)}))}process.versions.bun||ge.register?.((0,he.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader")));0&&(module.exports={Features,__unstable__loadDesignSystem,compile,env,loadModule,normalizePath});
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- var ue=Object.defineProperty;var me=(e,t)=>{for(var s in t)ue(e,s,{get:t[s],enumerable:!0})};import*as D from"node:module";import{pathToFileURL as Ve}from"node:url";var B={};me(B,{DEBUG:()=>de});var de=pe(process.env.DEBUG);function pe(e){if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let t=e.split(",").map(s=>s.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}import y from"enhanced-resolve";import{createJiti as ze}from"jiti";import M from"node:fs";import ae from"node:fs/promises";import F,{dirname as se}from"node:path";import{pathToFileURL as ne}from"node:url";import{__unstable__loadDesignSystem as Ge,compile as Ke}from"tailwindcss";import P from"node:fs/promises";import R from"node:path";var ge=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],he=[".js",".cjs",".mjs"],xe=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],ye=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function Re(e,t){for(let s of t){let o=`${e}${s}`;if((await P.stat(o).catch(()=>null))?.isFile())return o}for(let s of t){let o=`${e}/index${s}`;if(await P.access(o).then(()=>!0,()=>!1))return o}return null}async function W(e,t,s,o){let r=he.includes(o)?xe:ye,i=await Re(R.resolve(s,t),r);if(i===null||e.has(i))return;e.add(i),s=R.dirname(i),o=R.extname(i);let n=await P.readFile(i,"utf-8"),c=[];for(let a of ge)for(let l of n.matchAll(a))l[1].startsWith(".")&&c.push(W(e,l[1],s,o));await Promise.all(c)}async function z(e){let t=new Set;return await W(t,e,R.dirname(e),R.extname(e)),Array.from(t)}import*as I from"node:path";var A=92,v=47,E=42,Ae=34,we=39,Ce=58,_=59,h=10,w=32,N=9,G=123,U=125,b=40,K=41,Se=91,ve=93,J=45,T=64,Ee=33;function H(e){e=e.replaceAll(`\r
1
+ var ue=Object.defineProperty;var me=(e,t)=>{for(var n in t)ue(e,n,{get:t[n],enumerable:!0})};import*as D from"node:module";import{pathToFileURL as Ze}from"node:url";var W={};me(W,{DEBUG:()=>de});var de=pe(process.env.DEBUG);function pe(e){if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let t=e.split(",").map(n=>n.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}import y from"enhanced-resolve";import{createJiti as ze}from"jiti";import M from"node:fs";import ae from"node:fs/promises";import F,{dirname as ne}from"node:path";import{pathToFileURL as se}from"node:url";import{__unstable__loadDesignSystem as Ge,compile as Ke,Features as Je}from"tailwindcss";import P from"node:fs/promises";import A from"node:path";var ge=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],he=[".js",".cjs",".mjs"],xe=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],ye=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function Ae(e,t){for(let n of t){let o=`${e}${n}`;if((await P.stat(o).catch(()=>null))?.isFile())return o}for(let n of t){let o=`${e}/index${n}`;if(await P.access(o).then(()=>!0,()=>!1))return o}return null}async function B(e,t,n,o){let r=he.includes(o)?xe:ye,i=await Ae(A.resolve(n,t),r);if(i===null||e.has(i))return;e.add(i),n=A.dirname(i),o=A.extname(i);let s=await P.readFile(i,"utf-8"),c=[];for(let a of ge)for(let l of s.matchAll(a))l[1].startsWith(".")&&c.push(B(e,l[1],n,o));await Promise.all(c)}async function z(e){let t=new Set;return await B(t,e,A.dirname(e),A.extname(e)),Array.from(t)}import*as I from"node:path";var R=92,v=47,E=42,Re=34,we=39,Ce=58,_=59,h=10,w=32,k=9,G=123,U=125,b=40,K=41,Se=91,ve=93,J=45,T=64,Ee=33;function H(e){e=e.replaceAll(`\r
2
2
  `,`
3
- `);let t=[],s=[],o=[],r=null,i=null,n="",c="",a;for(let l=0;l<e.length;l++){let f=e.charCodeAt(l);if(f===A)n+=e.slice(l,l+2),l+=1;else if(f===v&&e.charCodeAt(l+1)===E){let u=l;for(let d=l+2;d<e.length;d++)if(a=e.charCodeAt(d),a===A)d+=1;else if(a===E&&e.charCodeAt(d+1)===v){l=d+1;break}let m=e.slice(u,l+1);m.charCodeAt(2)===Ee&&s.push(Q(m.slice(2,-2)))}else if(f===we||f===Ae){let u=l;for(let m=l+1;m<e.length;m++)if(a=e.charCodeAt(m),a===A)m+=1;else if(a===f){l=m;break}else{if(a===_&&e.charCodeAt(m+1)===h)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(f)}`);if(a===h)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(f)}`)}n+=e.slice(u,l+1)}else{if((f===w||f===h||f===N)&&(a=e.charCodeAt(l+1))&&(a===w||a===h||a===N))continue;if(f===h){if(n.length===0)continue;a=n.charCodeAt(n.length-1),a!==w&&a!==h&&a!==N&&(n+=" ")}else if(f===J&&e.charCodeAt(l+1)===J&&n.length===0){let u="",m=l,d=-1;for(let p=l+2;p<e.length;p++)if(a=e.charCodeAt(p),a===A)p+=1;else if(a===v&&e.charCodeAt(p+1)===E){for(let g=p+2;g<e.length;g++)if(a=e.charCodeAt(g),a===A)g+=1;else if(a===E&&e.charCodeAt(g+1)===v){p=g+1;break}}else if(d===-1&&a===Ce)d=n.length+p-m;else if(a===_&&u.length===0){n+=e.slice(m,p),l=p;break}else if(a===b)u+=")";else if(a===Se)u+="]";else if(a===G)u+="}";else if((a===U||e.length-1===p)&&u.length===0){l=p-1,n+=e.slice(m,p);break}else(a===K||a===ve||a===U)&&u.length>0&&e[p]===u[u.length-1]&&(u=u.slice(0,-1));let x=q(n,d);r?r.nodes.push(x):t.push(x),n=""}else if(f===_&&n.charCodeAt(0)===T)i=C(n),r?r.nodes.push(i):t.push(i),n="",i=null;else if(f===_&&c[c.length-1]!==")"){let u=q(n);r?r.nodes.push(u):t.push(u),n=""}else if(f===G&&c[c.length-1]!==")")c+="}",i=k(n.trim()),r&&r.nodes.push(i),o.push(r),r=i,n="",i=null;else if(f===U&&c[c.length-1]!==")"){if(c==="")throw new Error("Missing opening {");if(c=c.slice(0,-1),n.length>0)if(n.charCodeAt(0)===T)i=C(n),r?r.nodes.push(i):t.push(i),n="",i=null;else{let m=n.indexOf(":");if(r){let d=n.indexOf("!important",m+1);r.nodes.push({kind:"declaration",property:n.slice(0,m).trim(),value:n.slice(m+1,d===-1?n.length:d).trim(),important:d!==-1})}}let u=o.pop()??null;u===null&&r&&t.push(r),r=u,n="",i=null}else if(f===b)c+=")",n+="(";else if(f===K){if(c[c.length-1]!==")")throw new Error("Missing opening (");c=c.slice(0,-1),n+=")"}else{if(n.length===0&&(f===w||f===h||f===N))continue;n+=String.fromCharCode(f)}}}if(n.charCodeAt(0)===T&&t.push(C(n)),c.length>0&&r){if(r.kind==="rule")throw new Error(`Missing closing } at ${r.selector}`);if(r.kind==="at-rule")throw new Error(`Missing closing } at ${r.name} ${r.params}`)}return s.length>0?s.concat(t):t}function C(e,t=[]){for(let s=5;s<e.length;s++){let o=e.charCodeAt(s);if(o===w||o===b){let r=e.slice(0,s).trim(),i=e.slice(s).trim();return S(r,i,t)}}return S(e.trim(),"",t)}function q(e,t=e.indexOf(":")){let s=e.indexOf("!important",t+1);return{kind:"declaration",property:e.slice(0,t).trim(),value:e.slice(t+1,s===-1?e.length:s).trim(),important:s!==-1}}var _e=64;function Ne(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function S(e,t="",s=[]){return{kind:"at-rule",name:e,params:t,nodes:s}}function k(e,t=[]){return e.charCodeAt(0)===_e?C(e,t):Ne(e,t)}function Y(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function Q(e){return{kind:"comment",value:e}}function $(e,t,s=[],o={}){for(let r=0;r<e.length;r++){let i=e[r],n=[...s,i],c=s.at(-1)??null;if(i.kind==="context"){$(i.nodes,t,s,{...o,...i.context});continue}let a=t(i,{parent:c,context:o,path:n,replaceWith(l){e.splice(r,1,...Array.isArray(l)?l:[l]),r--}})??0;if(a===2)return;a!==1&&(i.kind==="rule"||i.kind==="at-rule")&&$(i.nodes,t,n,o)}}function X(e){let t="",s=new Set,o=[],r=[];function i(l,f=0){let u="",m=" ".repeat(f);if(l.kind==="rule"){u+=`${m}${l.selector} {
3
+ `);let t=[],n=[],o=[],r=null,i=null,s="",c="",a;for(let l=0;l<e.length;l++){let f=e.charCodeAt(l);if(f===R)s+=e.slice(l,l+2),l+=1;else if(f===v&&e.charCodeAt(l+1)===E){let u=l;for(let d=l+2;d<e.length;d++)if(a=e.charCodeAt(d),a===R)d+=1;else if(a===E&&e.charCodeAt(d+1)===v){l=d+1;break}let m=e.slice(u,l+1);m.charCodeAt(2)===Ee&&n.push(Q(m.slice(2,-2)))}else if(f===we||f===Re){let u=l;for(let m=l+1;m<e.length;m++)if(a=e.charCodeAt(m),a===R)m+=1;else if(a===f){l=m;break}else{if(a===_&&e.charCodeAt(m+1)===h)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(f)}`);if(a===h)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(f)}`)}s+=e.slice(u,l+1)}else{if((f===w||f===h||f===k)&&(a=e.charCodeAt(l+1))&&(a===w||a===h||a===k))continue;if(f===h){if(s.length===0)continue;a=s.charCodeAt(s.length-1),a!==w&&a!==h&&a!==k&&(s+=" ")}else if(f===J&&e.charCodeAt(l+1)===J&&s.length===0){let u="",m=l,d=-1;for(let p=l+2;p<e.length;p++)if(a=e.charCodeAt(p),a===R)p+=1;else if(a===v&&e.charCodeAt(p+1)===E){for(let g=p+2;g<e.length;g++)if(a=e.charCodeAt(g),a===R)g+=1;else if(a===E&&e.charCodeAt(g+1)===v){p=g+1;break}}else if(d===-1&&a===Ce)d=s.length+p-m;else if(a===_&&u.length===0){s+=e.slice(m,p),l=p;break}else if(a===b)u+=")";else if(a===Se)u+="]";else if(a===G)u+="}";else if((a===U||e.length-1===p)&&u.length===0){l=p-1,s+=e.slice(m,p);break}else(a===K||a===ve||a===U)&&u.length>0&&e[p]===u[u.length-1]&&(u=u.slice(0,-1));let x=q(s,d);r?r.nodes.push(x):t.push(x),s=""}else if(f===_&&s.charCodeAt(0)===T)i=C(s),r?r.nodes.push(i):t.push(i),s="",i=null;else if(f===_&&c[c.length-1]!==")"){let u=q(s);r?r.nodes.push(u):t.push(u),s=""}else if(f===G&&c[c.length-1]!==")")c+="}",i=N(s.trim()),r&&r.nodes.push(i),o.push(r),r=i,s="",i=null;else if(f===U&&c[c.length-1]!==")"){if(c==="")throw new Error("Missing opening {");if(c=c.slice(0,-1),s.length>0)if(s.charCodeAt(0)===T)i=C(s),r?r.nodes.push(i):t.push(i),s="",i=null;else{let m=s.indexOf(":");if(r){let d=s.indexOf("!important",m+1);r.nodes.push({kind:"declaration",property:s.slice(0,m).trim(),value:s.slice(m+1,d===-1?s.length:d).trim(),important:d!==-1})}}let u=o.pop()??null;u===null&&r&&t.push(r),r=u,s="",i=null}else if(f===b)c+=")",s+="(";else if(f===K){if(c[c.length-1]!==")")throw new Error("Missing opening (");c=c.slice(0,-1),s+=")"}else{if(s.length===0&&(f===w||f===h||f===k))continue;s+=String.fromCharCode(f)}}}if(s.charCodeAt(0)===T&&t.push(C(s)),c.length>0&&r){if(r.kind==="rule")throw new Error(`Missing closing } at ${r.selector}`);if(r.kind==="at-rule")throw new Error(`Missing closing } at ${r.name} ${r.params}`)}return n.length>0?n.concat(t):t}function C(e,t=[]){for(let n=5;n<e.length;n++){let o=e.charCodeAt(n);if(o===w||o===b){let r=e.slice(0,n).trim(),i=e.slice(n).trim();return S(r,i,t)}}return S(e.trim(),"",t)}function q(e,t=e.indexOf(":")){let n=e.indexOf("!important",t+1);return{kind:"declaration",property:e.slice(0,t).trim(),value:e.slice(t+1,n===-1?e.length:n).trim(),important:n!==-1}}var _e=64;function ke(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function S(e,t="",n=[]){return{kind:"at-rule",name:e,params:t,nodes:n}}function N(e,t=[]){return e.charCodeAt(0)===_e?C(e,t):ke(e,t)}function Y(e,t){return{kind:"declaration",property:e,value:t,important:!1}}function Q(e){return{kind:"comment",value:e}}function $(e,t,n=[],o={}){for(let r=0;r<e.length;r++){let i=e[r],s=[...n,i],c=n.at(-1)??null;if(i.kind==="context"){if($(i.nodes,t,n,{...o,...i.context})===2)return 2;continue}let a=t(i,{parent:c,context:o,path:s,replaceWith(l){e.splice(r,1,...Array.isArray(l)?l:[l]),r--}})??0;if(a===2)return 2;if(a!==1&&(i.kind==="rule"||i.kind==="at-rule")&&$(i.nodes,t,s,o)===2)return 2}}function X(e){let t="",n=new Set,o=[],r=[];function i(l,f=0){let u="",m=" ".repeat(f);if(l.kind==="rule"){u+=`${m}${l.selector} {
4
4
  `;for(let d of l.nodes)u+=i(d,f+1);u+=`${m}}
5
5
  `}else if(l.kind==="at-rule"){if(l.nodes.length===0)return`${m}${l.name} ${l.params};
6
- `;if(l.name==="@property"&&f===0){if(s.has(l.params))return"";let d=l.params,x=null,p=!1;for(let g of l.nodes)g.kind==="declaration"&&(g.property==="initial-value"?x=g.value:g.property==="inherits"&&(p=g.value==="true"));p?o.push(Y(d,x??"initial")):r.push(Y(d,x??"initial")),s.add(l.params)}u+=`${m}${l.name}${l.params?` ${l.params} `:" "}{
6
+ `;if(l.name==="@property"&&f===0){if(n.has(l.params))return"";let d=l.params,x=null,p=!1;for(let g of l.nodes)g.kind==="declaration"&&(g.property==="initial-value"?x=g.value:g.property==="inherits"&&(p=g.value==="true"));p?o.push(Y(d,x??"initial")):r.push(Y(d,x??"initial")),n.add(l.params)}u+=`${m}${l.name}${l.params?` ${l.params} `:" "}{
7
7
  `;for(let d of l.nodes)u+=i(d,f+1);u+=`${m}}
8
8
  `}else if(l.kind==="comment")u+=`${m}/*${l.value}*/
9
9
  `;else if(l.kind==="context")for(let d of l.nodes)u+=i(d,f);else if(l.kind==="at-root"){for(let d of l.nodes)t+=i(d,0);return u}else l.property!=="--tw-sort"&&l.value!==void 0&&l.value!==null&&(u+=`${m}${l.property}: ${l.value}${l.important?" !important":""};
10
- `);return u}let n="";for(let l of e){let f=i(l);f!==""&&(n+=f)}let c=[];o.length&&c.push(k(":root",o)),r.length&&c.push(k("*, ::before, ::after, ::backdrop",r));let a="";return c.length&&(a=i(S("@supports","(-moz-orient: inline)",[S("@layer","base",c)]))),`${n}${a}${t}`}function ke(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var s=e.length;if(s<=1)return e;var o="";if(s>4&&e[3]==="\\"){var r=e[2];(r==="?"||r===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),o="//")}var i=e.split(/[/\\]+/);return t!==!1&&i[i.length-1]===""&&i.pop(),o+i.join("/")}function j(e){let t=ke(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var O=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,V=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,$e=/(?:gradient|element|cross-fade|image)\(/,De=/^\s*data:/i,Pe=/^([a-z]+:)?\/\//,Ue=/^[A-Z_][.\w-]*\(/i,Te=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,be=/(?<!\\)"/g,je=/(?: |\\t|\\n|\\f|\\r)+/g,Ie=e=>De.test(e),Oe=e=>Pe.test(e);async function Z({css:e,base:t,root:s}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let o=H(e),r=[];function i(n){let c=I.posix.join(j(t),n),a=I.posix.relative(j(s),c);return a.startsWith(".")||(a="./"+a),a}return $(o,n=>{if(n.kind!=="declaration"||!n.value)return;let c=O.test(n.value),a=V.test(n.value);if(c||a){let l=a?Fe:ee;r.push(l(n.value,i).then(f=>{n.value=f}))}}),r.length&&await Promise.all(r),X(o)}function ee(e,t){return re(e,O,async s=>{let[o,r]=s;return await te(r.trim(),o,t)})}async function Fe(e,t){return await re(e,V,async s=>{let[,o]=s;return await Me(o,async({url:i})=>O.test(i)?await ee(i,t):$e.test(i)?i:await te(i,i,t))})}async function te(e,t,s,o="url"){let r="",i=e[0];if((i==='"'||i==="'")&&(r=i,e=e.slice(1,-1)),Le(e))return t;let n=await s(e);return r===""&&n!==encodeURI(n)&&(r='"'),r==="'"&&n.includes("'")&&(r='"'),r==='"'&&n.includes('"')&&(n=n.replace(be,'\\"')),`${o}(${r}${n}${r})`}function Le(e){return Oe(e)||Ie(e)||e[0]==="#"||Ue.test(e)}function Me(e,t){return Promise.all(Be(e).map(async({url:s,descriptor:o})=>({url:await t({url:s,descriptor:o}),descriptor:o}))).then(We)}function Be(e){let t=e.trim().replace(je," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Te);return Array.from(t,({groups:s})=>({url:s?.url?.trim()??"",descriptor:s?.descriptor?.trim()??""})).filter(({url:s})=>!!s)}function We(e){return e.map(({url:t,descriptor:s})=>t+(s?` ${s}`:"")).join(", ")}async function re(e,t,s){let o,r=e,i="";for(;o=t.exec(r);)i+=r.slice(0,o.index),i+=await s(o),r=r.slice(o.index+o[0].length);return i+=r,i}async function Je(e,{base:t,onDependency:s,shouldRewriteUrls:o,customCssResolver:r,customJsResolver:i}){let n=await Ke(e,{base:t,async loadModule(c,a){return ce(c,a,s,i)},async loadStylesheet(c,a){let l=await fe(c,a,s,r);return o&&(l.content=await Z({css:l.content,root:a,base:l.base})),l}});if(n.root&&n.root!=="none"){let c=/[*{]/,a=[];for(let f of n.root.pattern.split("/")){if(c.test(f))break;a.push(f)}if(!await ae.stat(F.resolve(t,a.join("/"))).then(f=>f.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${n.root.pattern})\` does not exist`)}return n}async function qe(e,{base:t}){return Ge(e,{base:t,async loadModule(s,o){return ce(s,o,()=>{})},async loadStylesheet(s,o){return fe(s,o,()=>{})}})}async function ce(e,t,s,o){if(e[0]!=="."){let c=await le(e,t,o);if(!c)throw new Error(`Could not resolve '${e}' from '${t}'`);let a=await oe(ne(c).href);return{base:se(c),module:a.default??a}}let r=await le(e,t,o);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[i,n]=await Promise.all([oe(ne(r).href+"?id="+Date.now()),z(r)]);for(let c of n)s(c);return{base:se(r),module:i.default??i}}async function fe(e,t,s,o){let r=await Qe(e,t,o);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(s(r),typeof globalThis.__tw_readFile=="function"){let n=await globalThis.__tw_readFile(r,"utf-8");if(n)return{base:F.dirname(r),content:n}}let i=await ae.readFile(r,"utf-8");return{base:F.dirname(r),content:i}}var ie=null;async function oe(e){if(typeof globalThis.__tw_load=="function"){let t=await globalThis.__tw_load(e);if(t)return t}try{return await import(e)}catch{return ie??=ze(import.meta.url,{moduleCache:!1,fsCache:!1}),await ie.import(e)}}var He=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function Qe(e,t,s){if(typeof globalThis.__tw_resolve=="function"){let o=globalThis.__tw_resolve(e,t);if(o)return Promise.resolve(o)}if(s){let o=await s(e,t);if(o)return o}return L(He,e,t)}var Ye=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"]}),Xe=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"]});async function le(e,t,s){if(typeof globalThis.__tw_resolve=="function"){let o=globalThis.__tw_resolve(e,t);if(o)return Promise.resolve(o)}if(s){let o=await s(e,t);if(o)return o}return L(Ye,e,t).catch(()=>L(Xe,e,t))}function L(e,t,s){return new Promise((o,r)=>e.resolve({},s,t,{},(i,n)=>{if(i)return r(i);o(n)}))}if(!process.versions.bun){let e=D.createRequire(import.meta.url);D.register?.(Ve(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{qe as __unstable__loadDesignSystem,Je as compile,B as env,j as normalizePath};
10
+ `);return u}let s="";for(let l of e){let f=i(l);f!==""&&(s+=f)}let c=[];o.length&&c.push(N(":root",o)),r.length&&c.push(N("*, ::before, ::after, ::backdrop",r));let a="";return c.length&&(a=i(S("@supports","(-moz-orient: inline)",[S("@layer","base",c)]))),`${s}${a}${t}`}function Ne(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var n=e.length;if(n<=1)return e;var o="";if(n>4&&e[3]==="\\"){var r=e[2];(r==="?"||r===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),o="//")}var i=e.split(/[/\\]+/);return t!==!1&&i[i.length-1]===""&&i.pop(),o+i.join("/")}function j(e){let t=Ne(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var O=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,V=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,$e=/(?:gradient|element|cross-fade|image)\(/,De=/^\s*data:/i,Pe=/^([a-z]+:)?\/\//,Ue=/^[A-Z_][.\w-]*\(/i,Te=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,be=/(?<!\\)"/g,je=/(?: |\\t|\\n|\\f|\\r)+/g,Ie=e=>De.test(e),Oe=e=>Pe.test(e);async function Z({css:e,base:t,root:n}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let o=H(e),r=[];function i(s){let c=I.posix.join(j(t),s),a=I.posix.relative(j(n),c);return a.startsWith(".")||(a="./"+a),a}return $(o,s=>{if(s.kind!=="declaration"||!s.value)return;let c=O.test(s.value),a=V.test(s.value);if(c||a){let l=a?Fe:ee;r.push(l(s.value,i).then(f=>{s.value=f}))}}),r.length&&await Promise.all(r),X(o)}function ee(e,t){return re(e,O,async n=>{let[o,r]=n;return await te(r.trim(),o,t)})}async function Fe(e,t){return await re(e,V,async n=>{let[,o]=n;return await Me(o,async({url:i})=>O.test(i)?await ee(i,t):$e.test(i)?i:await te(i,i,t))})}async function te(e,t,n,o="url"){let r="",i=e[0];if((i==='"'||i==="'")&&(r=i,e=e.slice(1,-1)),Le(e))return t;let s=await n(e);return r===""&&s!==encodeURI(s)&&(r='"'),r==="'"&&s.includes("'")&&(r='"'),r==='"'&&s.includes('"')&&(s=s.replace(be,'\\"')),`${o}(${r}${s}${r})`}function Le(e){return Oe(e)||Ie(e)||e[0]==="#"||Ue.test(e)}function Me(e,t){return Promise.all(We(e).map(async({url:n,descriptor:o})=>({url:await t({url:n,descriptor:o}),descriptor:o}))).then(Be)}function We(e){let t=e.trim().replace(je," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Te);return Array.from(t,({groups:n})=>({url:n?.url?.trim()??"",descriptor:n?.descriptor?.trim()??""})).filter(({url:n})=>!!n)}function Be(e){return e.map(({url:t,descriptor:n})=>t+(n?` ${n}`:"")).join(", ")}async function re(e,t,n){let o,r=e,i="";for(;o=t.exec(r);)i+=r.slice(0,o.index),i+=await n(o),r=r.slice(o.index+o[0].length);return i+=r,i}async function qe(e,{base:t,onDependency:n,shouldRewriteUrls:o,customCssResolver:r,customJsResolver:i}){let s=await Ke(e,{base:t,async loadModule(c,a){return ce(c,a,n,i)},async loadStylesheet(c,a){let l=await fe(c,a,n,r);return o&&(l.content=await Z({css:l.content,root:a,base:l.base})),l}});if(s.root&&s.root!=="none"){let c=/[*{]/,a=[];for(let f of s.root.pattern.split("/")){if(c.test(f))break;a.push(f)}if(!await ae.stat(F.resolve(t,a.join("/"))).then(f=>f.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${s.root.pattern})\` does not exist`)}return s}async function He(e,{base:t}){return Ge(e,{base:t,async loadModule(n,o){return ce(n,o,()=>{})},async loadStylesheet(n,o){return fe(n,o,()=>{})}})}async function ce(e,t,n,o){if(e[0]!=="."){let c=await le(e,t,o);if(!c)throw new Error(`Could not resolve '${e}' from '${t}'`);let a=await oe(se(c).href);return{base:ne(c),module:a.default??a}}let r=await le(e,t,o);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[i,s]=await Promise.all([oe(se(r).href+"?id="+Date.now()),z(r)]);for(let c of s)n(c);return{base:ne(r),module:i.default??i}}async function fe(e,t,n,o){let r=await Ye(e,t,o);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(n(r),typeof globalThis.__tw_readFile=="function"){let s=await globalThis.__tw_readFile(r,"utf-8");if(s)return{base:F.dirname(r),content:s}}let i=await ae.readFile(r,"utf-8");return{base:F.dirname(r),content:i}}var ie=null;async function oe(e){if(typeof globalThis.__tw_load=="function"){let t=await globalThis.__tw_load(e);if(t)return t}try{return await import(e)}catch{return ie??=ze(import.meta.url,{moduleCache:!1,fsCache:!1}),await ie.import(e)}}var Qe=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function Ye(e,t,n){if(typeof globalThis.__tw_resolve=="function"){let o=globalThis.__tw_resolve(e,t);if(o)return Promise.resolve(o)}if(n){let o=await n(e,t);if(o)return o}return L(Qe,e,t)}var Xe=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"]}),Ve=y.ResolverFactory.createResolver({fileSystem:new y.CachedInputFileSystem(M,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"]});async function le(e,t,n){if(typeof globalThis.__tw_resolve=="function"){let o=globalThis.__tw_resolve(e,t);if(o)return Promise.resolve(o)}if(n){let o=await n(e,t);if(o)return o}return L(Xe,e,t).catch(()=>L(Ve,e,t))}function L(e,t,n){return new Promise((o,r)=>e.resolve({},n,t,{},(i,s)=>{if(i)return r(i);o(s)}))}if(!process.versions.bun){let e=D.createRequire(import.meta.url);D.register?.(Ze(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{Je as Features,He as __unstable__loadDesignSystem,qe as compile,W as env,j as normalizePath};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailwindcss/node",
3
- "version": "4.0.0-beta.3",
3
+ "version": "4.0.0-beta.4",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "enhanced-resolve": "^5.17.1",
37
37
  "jiti": "^2.4.0",
38
- "tailwindcss": "4.0.0-beta.3"
38
+ "tailwindcss": "4.0.0-beta.4"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsup-node",