@tailwindcss/node 4.0.2 → 4.0.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.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ee=Object.create;var $=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var r in t)$(e,r,{get:t[r],enumerable:!0})},Z=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _e(t))!ke.call(e,n)&&n!==r&&$(e,n,{get:()=>t[n],enumerable:!(s=$e(t,n))||s.enumerable});return e};var g=(e,t,r)=>(r=e!=null?Ee(Ne(e)):{},Z(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),be=e=>Z($({},"__esModule",{value:!0}),e);var pt={};X(pt,{Features:()=>h.Features,Instrumentation:()=>Y,__unstable__loadDesignSystem:()=>at,compile:()=>lt,compileAst:()=>ot,env:()=>_,loadModule:()=>q,normalizePath:()=>O});module.exports=be(pt);var Se=g(require("module")),Ce=require("url");var _={};X(_,{DEBUG:()=>F});var F=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(r=>r.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}var x=g(require("enhanced-resolve")),xe=require("jiti"),U=g(require("fs")),V=g(require("fs/promises")),y=g(require("path")),K=require("url"),h=require("tailwindcss");var N=g(require("fs/promises")),v=g(require("path")),De=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Te=[".js",".cjs",".mjs"],Oe=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Ue=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function je(e,t){for(let r of t){let s=`${e}${r}`;if((await N.default.stat(s).catch(()=>null))?.isFile())return s}for(let r of t){let s=`${e}/index${r}`;if(await N.default.access(s).then(()=>!0,()=>!1))return s}return null}async function ee(e,t,r,s){let n=Te.includes(s)?Oe:Ue,o=await je(v.default.resolve(r,t),n);if(o===null||e.has(o))return;e.add(o),r=v.default.dirname(o),s=v.default.extname(o);let i=await N.default.readFile(o,"utf-8"),a=[];for(let l of De)for(let f of i.matchAll(l))f[1].startsWith(".")&&a.push(ee(e,f[1],r,s));await Promise.all(a)}async function te(e){let t=new Set;return await ee(t,e,v.default.dirname(e),v.default.extname(e)),Array.from(t)}var G=g(require("path"));var R=92,k=47,b=42,Ie=34,Fe=39,Me=58,P=59,A=10,S=32,D=9,re=123,M=125,B=40,se=41,Le=91,We=93,ne=45,L=64,Be=33;function ie(e){e=e.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
|
-
`);let t=[],r=[],s=[],
|
|
4
|
-
`;else if(s.kind==="rule"){o+=`${
|
|
5
|
-
`;for(let a of s.nodes)o+=t(a,
|
|
6
|
-
`}else if(s.kind==="at-rule"){if(s.nodes.length===0)return`${
|
|
7
|
-
`;o+=`${
|
|
8
|
-
`;for(let a of s.nodes)o+=t(a,
|
|
9
|
-
`}else if(s.kind==="comment")o+=`${
|
|
10
|
-
`;else if(s.kind==="context"||s.kind==="at-root")return"";return o}let r="";for(let s of e){let
|
|
11
|
-
`)){this.defaultFlush=t}#r=new E(()=>({value:0}));#t=new E(()=>({value:0n}));#e=[];hit(t){this.#r.get(t).value++}start(t){let r=this.#e.map(
|
|
12
|
-
Timers:`);let
|
|
3
|
+
`);let t=[],r=[],s=[],n=null,o=null,i="",a="",l;for(let f=0;f<e.length;f++){let c=e.charCodeAt(f);if(c===R)i+=e.slice(f,f+2),f+=1;else if(c===k&&e.charCodeAt(f+1)===b){let u=f;for(let p=f+2;p<e.length;p++)if(l=e.charCodeAt(p),l===R)p+=1;else if(l===b&&e.charCodeAt(p+1)===k){f=p+1;break}let m=e.slice(u,f+1);m.charCodeAt(2)===Be&&r.push(ae(m.slice(2,-2)))}else if(c===Fe||c===Ie){let u=f;for(let m=f+1;m<e.length;m++)if(l=e.charCodeAt(m),l===R)m+=1;else if(l===c){f=m;break}else{if(l===P&&e.charCodeAt(m+1)===A)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(c)}`);if(l===A)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(c)}`)}i+=e.slice(u,f+1)}else{if((c===S||c===A||c===D)&&(l=e.charCodeAt(f+1))&&(l===S||l===A||l===D))continue;if(c===A){if(i.length===0)continue;l=i.charCodeAt(i.length-1),l!==S&&l!==A&&l!==D&&(i+=" ")}else if(c===ne&&e.charCodeAt(f+1)===ne&&i.length===0){let u="",m=f,p=-1;for(let d=f+2;d<e.length;d++)if(l=e.charCodeAt(d),l===R)d+=1;else if(l===k&&e.charCodeAt(d+1)===b){for(let w=d+2;w<e.length;w++)if(l=e.charCodeAt(w),l===R)w+=1;else if(l===b&&e.charCodeAt(w+1)===k){d=w+1;break}}else if(p===-1&&l===Me)p=i.length+d-m;else if(l===P&&u.length===0){i+=e.slice(m,d),f=d;break}else if(l===B)u+=")";else if(l===Le)u+="]";else if(l===re)u+="}";else if((l===M||e.length-1===d)&&u.length===0){f=d-1,i+=e.slice(m,d);break}else(l===se||l===We||l===M)&&u.length>0&&e[d]===u[u.length-1]&&(u=u.slice(0,-1));let I=W(i,p);if(!I)throw new Error("Invalid custom property, expected a value");n?n.nodes.push(I):t.push(I),i=""}else if(c===P&&i.charCodeAt(0)===L)o=C(i),n?n.nodes.push(o):t.push(o),i="",o=null;else if(c===P&&a[a.length-1]!==")"){let u=W(i);if(!u)throw i.length===0?new Error("Unexpected semicolon"):new Error(`Invalid declaration: \`${i.trim()}\``);n?n.nodes.push(u):t.push(u),i=""}else if(c===re&&a[a.length-1]!==")")a+="}",o=oe(i.trim()),n&&n.nodes.push(o),s.push(n),n=o,i="",o=null;else if(c===M&&a[a.length-1]!==")"){if(a==="")throw new Error("Missing opening {");if(a=a.slice(0,-1),i.length>0)if(i.charCodeAt(0)===L)o=C(i),n?n.nodes.push(o):t.push(o),i="",o=null;else{let m=i.indexOf(":");if(n){let p=W(i,m);if(!p)throw new Error(`Invalid declaration: \`${i.trim()}\``);n.nodes.push(p)}}let u=s.pop()??null;u===null&&n&&t.push(n),n=u,i="",o=null}else if(c===B)a+=")",i+="(";else if(c===se){if(a[a.length-1]!==")")throw new Error("Missing opening (");a=a.slice(0,-1),i+=")"}else{if(i.length===0&&(c===S||c===A||c===D))continue;i+=String.fromCharCode(c)}}}if(i.charCodeAt(0)===L&&t.push(C(i)),a.length>0&&n){if(n.kind==="rule")throw new Error(`Missing closing } at ${n.selector}`);if(n.kind==="at-rule")throw new Error(`Missing closing } at ${n.name} ${n.params}`)}return r.length>0?r.concat(t):t}function C(e,t=[]){for(let r=5;r<e.length;r++){let s=e.charCodeAt(r);if(s===S||s===B){let n=e.slice(0,r).trim(),o=e.slice(r).trim();return z(n,o,t)}}return z(e.trim(),"",t)}function W(e,t=e.indexOf(":")){if(t===-1)return null;let r=e.indexOf("!important",t+1);return le(e.slice(0,t).trim(),e.slice(t+1,r===-1?e.length:r).trim(),r!==-1)}var ze=64;function Ge(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function z(e,t="",r=[]){return{kind:"at-rule",name:e,params:t,nodes:r}}function oe(e,t=[]){return e.charCodeAt(0)===ze?C(e,t):Ge(e,t)}function le(e,t,r=!1){return{kind:"declaration",property:e,value:t,important:r}}function ae(e){return{kind:"comment",value:e}}function T(e,t,r=[],s={}){for(let n=0;n<e.length;n++){let o=e[n],i=r[r.length-1]??null;if(o.kind==="context"){if(T(o.nodes,t,r,{...s,...o.context})===2)return 2;continue}r.push(o);let a=!1,l=0,f=t(o,{parent:i,context:s,path:r,replaceWith(c){a=!0,Array.isArray(c)?c.length===0?(e.splice(n,1),l=0):c.length===1?(e[n]=c[0],l=1):(e.splice(n,1,...c),l=c.length):(e[n]=c,l=1)}})??0;if(r.pop(),a){f===0?n--:n+=l-1;continue}if(f===2)return 2;if(f!==1&&"nodes"in o){r.push(o);let c=T(o.nodes,t,r,s);if(r.pop(),c===2)return 2}}}function ce(e){function t(s,n=0){let o="",i=" ".repeat(n);if(s.kind==="declaration")o+=`${i}${s.property}: ${s.value}${s.important?" !important":""};
|
|
4
|
+
`;else if(s.kind==="rule"){o+=`${i}${s.selector} {
|
|
5
|
+
`;for(let a of s.nodes)o+=t(a,n+1);o+=`${i}}
|
|
6
|
+
`}else if(s.kind==="at-rule"){if(s.nodes.length===0)return`${i}${s.name} ${s.params};
|
|
7
|
+
`;o+=`${i}${s.name}${s.params?` ${s.params} `:" "}{
|
|
8
|
+
`;for(let a of s.nodes)o+=t(a,n+1);o+=`${i}}
|
|
9
|
+
`}else if(s.kind==="comment")o+=`${i}/*${s.value}*/
|
|
10
|
+
`;else if(s.kind==="context"||s.kind==="at-root")return"";return o}let r="";for(let s of e){let n=t(s);n!==""&&(r+=n)}return r}function He(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var r=e.length;if(r<=1)return e;var s="";if(r>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),s="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),s+o.join("/")}function O(e){let t=He(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var H=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,fe=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,Ke=/(?:gradient|element|cross-fade|image)\(/,Je=/^\s*data:/i,Ve=/^([a-z]+:)?\/\//,qe=/^[A-Z_][.\w-]*\(/i,Qe=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,Ye=/(?<!\\)"/g,Xe=/(?: |\\t|\\n|\\f|\\r)+/g,Ze=e=>Je.test(e),et=e=>Ve.test(e);async function ue({css:e,base:t,root:r}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let s=ie(e),n=[];function o(i){if(i[0]==="/")return i;let a=G.posix.join(O(t),i),l=G.posix.relative(O(r),a);return l.startsWith(".")||(l="./"+l),l}return T(s,i=>{if(i.kind!=="declaration"||!i.value)return;let a=H.test(i.value),l=fe.test(i.value);if(a||l){let f=l?tt:me;n.push(f(i.value,o).then(c=>{i.value=c}))}}),n.length&&await Promise.all(n),ce(s)}function me(e,t){return pe(e,H,async r=>{let[s,n]=r;return await de(n.trim(),s,t)})}async function tt(e,t){return await pe(e,fe,async r=>{let[,s]=r;return await st(s,async({url:o})=>H.test(o)?await me(o,t):Ke.test(o)?o:await de(o,o,t))})}async function de(e,t,r,s="url"){let n="",o=e[0];if((o==='"'||o==="'")&&(n=o,e=e.slice(1,-1)),rt(e))return t;let i=await r(e);return n===""&&i!==encodeURI(i)&&(n='"'),n==="'"&&i.includes("'")&&(n='"'),n==='"'&&i.includes('"')&&(i=i.replace(Ye,'\\"')),`${s}(${n}${i}${n})`}function rt(e,t){return et(e)||Ze(e)||!e[0].match(/[\.a-zA-Z0-9_]/)||qe.test(e)}function st(e,t){return Promise.all(nt(e).map(async({url:r,descriptor:s})=>({url:await t({url:r,descriptor:s}),descriptor:s}))).then(it)}function nt(e){let t=e.trim().replace(Xe," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Qe);return Array.from(t,({groups:r})=>({url:r?.url?.trim()??"",descriptor:r?.descriptor?.trim()??""})).filter(({url:r})=>!!r)}function it(e){return e.map(({url:t,descriptor:r})=>t+(r?` ${r}`:"")).join(", ")}async function pe(e,t,r){let s,n=e,o="";for(;s=t.exec(n);)o+=n.slice(0,s.index),o+=await r(s),n=n.slice(s.index+s[0].length);return o+=n,o}var dt={};function ye({base:e,onDependency:t,shouldRewriteUrls:r,customCssResolver:s,customJsResolver:n}){return{base:e,async loadModule(o,i){return q(o,i,t,n)},async loadStylesheet(o,i){let a=await ve(o,i,t,s);return r&&(a.content=await ue({css:a.content,root:i,base:a.base})),a}}}async function we(e,t){if(e.root&&e.root!=="none"){let r=/[*{]/,s=[];for(let o of e.root.pattern.split("/")){if(r.test(o))break;s.push(o)}if(!await V.default.stat(y.default.resolve(t,s.join("/"))).then(o=>o.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist`)}}async function ot(e,t){let r=await(0,h.compileAst)(e,ye(t));return await we(r,t.base),r}async function lt(e,t){let r=await(0,h.compile)(e,ye(t));return await we(r,t.base),r}async function at(e,{base:t}){return(0,h.__unstable__loadDesignSystem)(e,{base:t,async loadModule(r,s){return q(r,s,()=>{})},async loadStylesheet(r,s){return ve(r,s,()=>{})}})}async function q(e,t,r,s){if(e[0]!=="."){let a=await Ae(e,t,s);if(!a)throw new Error(`Could not resolve '${e}' from '${t}'`);let l=await he((0,K.pathToFileURL)(a).href);return{base:(0,y.dirname)(a),module:l.default??l}}let n=await Ae(e,t,s);if(!n)throw new Error(`Could not resolve '${e}' from '${t}'`);let[o,i]=await Promise.all([he((0,K.pathToFileURL)(n).href+"?id="+Date.now()),te(n)]);for(let a of i)r(a);return{base:(0,y.dirname)(n),module:o.default??o}}async function ve(e,t,r,s){let n=await ft(e,t,s);if(!n)throw new Error(`Could not resolve '${e}' from '${t}'`);if(r(n),typeof globalThis.__tw_readFile=="function"){let i=await globalThis.__tw_readFile(n,"utf-8");if(i)return{base:y.default.dirname(n),content:i}}let o=await V.default.readFile(n,"utf-8");return{base:y.default.dirname(n),content:o}}var ge=null;async function he(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 ge??=(0,xe.createJiti)(dt.url,{moduleCache:!1,fsCache:!1}),await ge.import(e)}}var Q=["node_modules",...process.env.NODE_PATH?[process.env.NODE_PATH]:[]],ct=x.default.ResolverFactory.createResolver({fileSystem:new x.default.CachedInputFileSystem(U.default,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"],modules:Q});async function ft(e,t,r){if(typeof globalThis.__tw_resolve=="function"){let s=globalThis.__tw_resolve(e,t);if(s)return Promise.resolve(s)}if(r){let s=await r(e,t);if(s)return s}return J(ct,e,t)}var ut=x.default.ResolverFactory.createResolver({fileSystem:new x.default.CachedInputFileSystem(U.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"],modules:Q}),mt=x.default.ResolverFactory.createResolver({fileSystem:new x.default.CachedInputFileSystem(U.default,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"],modules:Q});async function Ae(e,t,r){if(typeof globalThis.__tw_resolve=="function"){let s=globalThis.__tw_resolve(e,t);if(s)return Promise.resolve(s)}if(r){let s=await r(e,t);if(s)return s}return J(ut,e,t).catch(()=>J(mt,e,t))}function J(e,t,r){return new Promise((s,n)=>e.resolve({},r,t,{},(o,i)=>{if(o)return n(o);s(i)}))}var E=class extends Map{constructor(r){super();this.factory=r}get(r){let s=super.get(r);return s===void 0&&(s=this.factory(r,this),this.set(r,s)),s}};Symbol.dispose??=Symbol("Symbol.dispose");Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");var Y=class{constructor(t=r=>void process.stderr.write(`${r}
|
|
11
|
+
`)){this.defaultFlush=t}#r=new E(()=>({value:0}));#t=new E(()=>({value:0n}));#e=[];hit(t){this.#r.get(t).value++}start(t){let r=this.#e.map(n=>n.label).join("//"),s=`${r}${r.length===0?"":"//"}${t}`;this.#r.get(s).value++,this.#t.get(s),this.#e.push({id:s,label:t,namespace:r,value:process.hrtime.bigint()})}end(t){let r=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==t)throw new Error(`Mismatched timer label: \`${t}\`, expected \`${this.#e[this.#e.length-1].label}\``);let s=this.#e.pop(),n=r-s.value;this.#t.get(s.id).value+=n}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(t=this.defaultFlush){let r=[],s=!1;for(let i=this.#e.length-1;i>=0;i--)this.end(this.#e[i].label);for(let[i,{value:a}]of this.#r.entries()){if(this.#t.has(i))continue;r.length===0&&(s=!0,r.push("Hits:"));let l=i.split("//").length;r.push(`${" ".repeat(l)}${i} ${j(Re(`\xD7 ${a}`))}`)}this.#t.size>0&&s&&r.push(`
|
|
12
|
+
Timers:`);let n=-1/0,o=new Map;for(let[i,{value:a}]of this.#t){let l=`${(Number(a)/1e6).toFixed(2)}ms`;o.set(i,l),n=Math.max(n,l.length)}for(let i of this.#t.keys()){let a=i.split("//").length;r.push(`${j(`[${o.get(i).padStart(n," ")}]`)}${" ".repeat(a-1)}${a===1?" ":j(" \u21B3 ")}${i.split("//").pop()} ${this.#r.get(i).value===1?"":j(Re(`\xD7 ${this.#r.get(i).value}`))}`.trimEnd())}t(`
|
|
13
13
|
${r.join(`
|
|
14
14
|
`)}
|
|
15
|
-
`),this.reset()}[Symbol.dispose](){F&&this.report()}};function j(e){return`\x1B[2m${e}\x1B[22m`}function Re(e){return`\x1B[34m${e}\x1B[39m`}process.versions.bun||
|
|
15
|
+
`),this.reset()}[Symbol.dispose](){F&&this.report()}};function j(e){return`\x1B[2m${e}\x1B[22m`}function Re(e){return`\x1B[34m${e}\x1B[39m`}process.versions.bun||Se.register?.((0,Ce.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader")));0&&(module.exports={Features,Instrumentation,__unstable__loadDesignSystem,compile,compileAst,env,loadModule,normalizePath});
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var xe=Object.defineProperty;var
|
|
1
|
+
var xe=Object.defineProperty;var we=(e,t)=>{for(var r in t)xe(e,r,{get:t[r],enumerable:!0})};import*as k from"node:module";import{pathToFileURL as at}from"node:url";var D={};we(D,{DEBUG:()=>P});var P=Re(process.env.DEBUG);function Re(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(r=>r.split(":")[0]);return t.includes("-tailwindcss")?!1:!!t.includes("tailwindcss")}import A from"enhanced-resolve";import{createJiti as Qe}from"jiti";import G from"node:fs";import me from"node:fs/promises";import B,{dirname as le}from"node:path";import{pathToFileURL as ae}from"node:url";import{__unstable__loadDesignSystem as Ye,compile as Xe,compileAst as Ze,Features as et}from"tailwindcss";import T from"node:fs/promises";import y from"node:path";var ve=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Se=[".js",".cjs",".mjs"],Ce=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Ee=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function _e(e,t){for(let r of t){let s=`${e}${r}`;if((await T.stat(s).catch(()=>null))?.isFile())return s}for(let r of t){let s=`${e}/index${r}`;if(await T.access(s).then(()=>!0,()=>!1))return s}return null}async function K(e,t,r,s){let n=Se.includes(s)?Ce:Ee,o=await _e(y.resolve(r,t),n);if(o===null||e.has(o))return;e.add(o),r=y.dirname(o),s=y.extname(o);let i=await T.readFile(o,"utf-8"),a=[];for(let l of ve)for(let f of i.matchAll(l))f[1].startsWith(".")&&a.push(K(e,f[1],r,s));await Promise.all(a)}async function J(e){let t=new Set;return await K(t,e,y.dirname(e),y.extname(e)),Array.from(t)}import*as L from"node:path";var x=92,S=47,C=42,$e=34,Ne=39,ke=58,E=59,g=10,w=32,_=9,V=123,O=125,I=40,q=41,be=91,Pe=93,Q=45,U=64,De=33;function Y(e){e=e.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
|
-
`);let t=[],r=[],s=[],
|
|
4
|
-
`;else if(s.kind==="rule"){o+=`${
|
|
5
|
-
`;for(let a of s.nodes)o+=t(a,
|
|
6
|
-
`}else if(s.kind==="at-rule"){if(s.nodes.length===0)return`${
|
|
7
|
-
`;o+=`${
|
|
8
|
-
`;for(let a of s.nodes)o+=t(a,
|
|
9
|
-
`}else if(s.kind==="comment")o+=`${
|
|
10
|
-
`;else if(s.kind==="context"||s.kind==="at-root")return"";return o}let r="";for(let s of e){let
|
|
11
|
-
`)){this.defaultFlush=t}#r=new v(()=>({value:0}));#t=new v(()=>({value:0n}));#e=[];hit(t){this.#r.get(t).value++}start(t){let r=this.#e.map(
|
|
12
|
-
Timers:`);let
|
|
3
|
+
`);let t=[],r=[],s=[],n=null,o=null,i="",a="",l;for(let f=0;f<e.length;f++){let c=e.charCodeAt(f);if(c===x)i+=e.slice(f,f+2),f+=1;else if(c===S&&e.charCodeAt(f+1)===C){let u=f;for(let p=f+2;p<e.length;p++)if(l=e.charCodeAt(p),l===x)p+=1;else if(l===C&&e.charCodeAt(p+1)===S){f=p+1;break}let m=e.slice(u,f+1);m.charCodeAt(2)===De&&r.push(ee(m.slice(2,-2)))}else if(c===Ne||c===$e){let u=f;for(let m=f+1;m<e.length;m++)if(l=e.charCodeAt(m),l===x)m+=1;else if(l===c){f=m;break}else{if(l===E&&e.charCodeAt(m+1)===g)throw new Error(`Unterminated string: ${e.slice(u,m+1)+String.fromCharCode(c)}`);if(l===g)throw new Error(`Unterminated string: ${e.slice(u,m)+String.fromCharCode(c)}`)}i+=e.slice(u,f+1)}else{if((c===w||c===g||c===_)&&(l=e.charCodeAt(f+1))&&(l===w||l===g||l===_))continue;if(c===g){if(i.length===0)continue;l=i.charCodeAt(i.length-1),l!==w&&l!==g&&l!==_&&(i+=" ")}else if(c===Q&&e.charCodeAt(f+1)===Q&&i.length===0){let u="",m=f,p=-1;for(let d=f+2;d<e.length;d++)if(l=e.charCodeAt(d),l===x)d+=1;else if(l===S&&e.charCodeAt(d+1)===C){for(let h=d+2;h<e.length;h++)if(l=e.charCodeAt(h),l===x)h+=1;else if(l===C&&e.charCodeAt(h+1)===S){d=h+1;break}}else if(p===-1&&l===ke)p=i.length+d-m;else if(l===E&&u.length===0){i+=e.slice(m,d),f=d;break}else if(l===I)u+=")";else if(l===be)u+="]";else if(l===V)u+="}";else if((l===O||e.length-1===d)&&u.length===0){f=d-1,i+=e.slice(m,d);break}else(l===q||l===Pe||l===O)&&u.length>0&&e[d]===u[u.length-1]&&(u=u.slice(0,-1));let b=j(i,p);if(!b)throw new Error("Invalid custom property, expected a value");n?n.nodes.push(b):t.push(b),i=""}else if(c===E&&i.charCodeAt(0)===U)o=R(i),n?n.nodes.push(o):t.push(o),i="",o=null;else if(c===E&&a[a.length-1]!==")"){let u=j(i);if(!u)throw i.length===0?new Error("Unexpected semicolon"):new Error(`Invalid declaration: \`${i.trim()}\``);n?n.nodes.push(u):t.push(u),i=""}else if(c===V&&a[a.length-1]!==")")a+="}",o=X(i.trim()),n&&n.nodes.push(o),s.push(n),n=o,i="",o=null;else if(c===O&&a[a.length-1]!==")"){if(a==="")throw new Error("Missing opening {");if(a=a.slice(0,-1),i.length>0)if(i.charCodeAt(0)===U)o=R(i),n?n.nodes.push(o):t.push(o),i="",o=null;else{let m=i.indexOf(":");if(n){let p=j(i,m);if(!p)throw new Error(`Invalid declaration: \`${i.trim()}\``);n.nodes.push(p)}}let u=s.pop()??null;u===null&&n&&t.push(n),n=u,i="",o=null}else if(c===I)a+=")",i+="(";else if(c===q){if(a[a.length-1]!==")")throw new Error("Missing opening (");a=a.slice(0,-1),i+=")"}else{if(i.length===0&&(c===w||c===g||c===_))continue;i+=String.fromCharCode(c)}}}if(i.charCodeAt(0)===U&&t.push(R(i)),a.length>0&&n){if(n.kind==="rule")throw new Error(`Missing closing } at ${n.selector}`);if(n.kind==="at-rule")throw new Error(`Missing closing } at ${n.name} ${n.params}`)}return r.length>0?r.concat(t):t}function R(e,t=[]){for(let r=5;r<e.length;r++){let s=e.charCodeAt(r);if(s===w||s===I){let n=e.slice(0,r).trim(),o=e.slice(r).trim();return F(n,o,t)}}return F(e.trim(),"",t)}function j(e,t=e.indexOf(":")){if(t===-1)return null;let r=e.indexOf("!important",t+1);return Z(e.slice(0,t).trim(),e.slice(t+1,r===-1?e.length:r).trim(),r!==-1)}var Te=64;function Oe(e,t=[]){return{kind:"rule",selector:e,nodes:t}}function F(e,t="",r=[]){return{kind:"at-rule",name:e,params:t,nodes:r}}function X(e,t=[]){return e.charCodeAt(0)===Te?R(e,t):Oe(e,t)}function Z(e,t,r=!1){return{kind:"declaration",property:e,value:t,important:r}}function ee(e){return{kind:"comment",value:e}}function $(e,t,r=[],s={}){for(let n=0;n<e.length;n++){let o=e[n],i=r[r.length-1]??null;if(o.kind==="context"){if($(o.nodes,t,r,{...s,...o.context})===2)return 2;continue}r.push(o);let a=!1,l=0,f=t(o,{parent:i,context:s,path:r,replaceWith(c){a=!0,Array.isArray(c)?c.length===0?(e.splice(n,1),l=0):c.length===1?(e[n]=c[0],l=1):(e.splice(n,1,...c),l=c.length):(e[n]=c,l=1)}})??0;if(r.pop(),a){f===0?n--:n+=l-1;continue}if(f===2)return 2;if(f!==1&&"nodes"in o){r.push(o);let c=$(o.nodes,t,r,s);if(r.pop(),c===2)return 2}}}function te(e){function t(s,n=0){let o="",i=" ".repeat(n);if(s.kind==="declaration")o+=`${i}${s.property}: ${s.value}${s.important?" !important":""};
|
|
4
|
+
`;else if(s.kind==="rule"){o+=`${i}${s.selector} {
|
|
5
|
+
`;for(let a of s.nodes)o+=t(a,n+1);o+=`${i}}
|
|
6
|
+
`}else if(s.kind==="at-rule"){if(s.nodes.length===0)return`${i}${s.name} ${s.params};
|
|
7
|
+
`;o+=`${i}${s.name}${s.params?` ${s.params} `:" "}{
|
|
8
|
+
`;for(let a of s.nodes)o+=t(a,n+1);o+=`${i}}
|
|
9
|
+
`}else if(s.kind==="comment")o+=`${i}/*${s.value}*/
|
|
10
|
+
`;else if(s.kind==="context"||s.kind==="at-root")return"";return o}let r="";for(let s of e){let n=t(s);n!==""&&(r+=n)}return r}function Ue(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var r=e.length;if(r<=1)return e;var s="";if(r>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),s="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),s+o.join("/")}function M(e){let t=Ue(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}var W=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,re=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,je=/(?:gradient|element|cross-fade|image)\(/,Ie=/^\s*data:/i,Fe=/^([a-z]+:)?\/\//,Me=/^[A-Z_][.\w-]*\(/i,Le=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,We=/(?<!\\)"/g,Be=/(?: |\\t|\\n|\\f|\\r)+/g,ze=e=>Ie.test(e),Ge=e=>Fe.test(e);async function se({css:e,base:t,root:r}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let s=Y(e),n=[];function o(i){if(i[0]==="/")return i;let a=L.posix.join(M(t),i),l=L.posix.relative(M(r),a);return l.startsWith(".")||(l="./"+l),l}return $(s,i=>{if(i.kind!=="declaration"||!i.value)return;let a=W.test(i.value),l=re.test(i.value);if(a||l){let f=l?He:ne;n.push(f(i.value,o).then(c=>{i.value=c}))}}),n.length&&await Promise.all(n),te(s)}function ne(e,t){return oe(e,W,async r=>{let[s,n]=r;return await ie(n.trim(),s,t)})}async function He(e,t){return await oe(e,re,async r=>{let[,s]=r;return await Je(s,async({url:o})=>W.test(o)?await ne(o,t):je.test(o)?o:await ie(o,o,t))})}async function ie(e,t,r,s="url"){let n="",o=e[0];if((o==='"'||o==="'")&&(n=o,e=e.slice(1,-1)),Ke(e))return t;let i=await r(e);return n===""&&i!==encodeURI(i)&&(n='"'),n==="'"&&i.includes("'")&&(n='"'),n==='"'&&i.includes('"')&&(i=i.replace(We,'\\"')),`${s}(${n}${i}${n})`}function Ke(e,t){return Ge(e)||ze(e)||!e[0].match(/[\.a-zA-Z0-9_]/)||Me.test(e)}function Je(e,t){return Promise.all(Ve(e).map(async({url:r,descriptor:s})=>({url:await t({url:r,descriptor:s}),descriptor:s}))).then(qe)}function Ve(e){let t=e.trim().replace(Be," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(Le);return Array.from(t,({groups:r})=>({url:r?.url?.trim()??"",descriptor:r?.descriptor?.trim()??""})).filter(({url:r})=>!!r)}function qe(e){return e.map(({url:t,descriptor:r})=>t+(r?` ${r}`:"")).join(", ")}async function oe(e,t,r){let s,n=e,o="";for(;s=t.exec(n);)o+=n.slice(0,s.index),o+=await r(s),n=n.slice(s.index+s[0].length);return o+=n,o}function de({base:e,onDependency:t,shouldRewriteUrls:r,customCssResolver:s,customJsResolver:n}){return{base:e,async loadModule(o,i){return ge(o,i,t,n)},async loadStylesheet(o,i){let a=await he(o,i,t,s);return r&&(a.content=await se({css:a.content,root:i,base:a.base})),a}}}async function pe(e,t){if(e.root&&e.root!=="none"){let r=/[*{]/,s=[];for(let o of e.root.pattern.split("/")){if(r.test(o))break;s.push(o)}if(!await me.stat(B.resolve(t,s.join("/"))).then(o=>o.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist`)}}async function tt(e,t){let r=await Ze(e,de(t));return await pe(r,t.base),r}async function rt(e,t){let r=await Xe(e,de(t));return await pe(r,t.base),r}async function st(e,{base:t}){return Ye(e,{base:t,async loadModule(r,s){return ge(r,s,()=>{})},async loadStylesheet(r,s){return he(r,s,()=>{})}})}async function ge(e,t,r,s){if(e[0]!=="."){let a=await ue(e,t,s);if(!a)throw new Error(`Could not resolve '${e}' from '${t}'`);let l=await fe(ae(a).href);return{base:le(a),module:l.default??l}}let n=await ue(e,t,s);if(!n)throw new Error(`Could not resolve '${e}' from '${t}'`);let[o,i]=await Promise.all([fe(ae(n).href+"?id="+Date.now()),J(n)]);for(let a of i)r(a);return{base:le(n),module:o.default??o}}async function he(e,t,r,s){let n=await it(e,t,s);if(!n)throw new Error(`Could not resolve '${e}' from '${t}'`);if(r(n),typeof globalThis.__tw_readFile=="function"){let i=await globalThis.__tw_readFile(n,"utf-8");if(i)return{base:B.dirname(n),content:i}}let o=await me.readFile(n,"utf-8");return{base:B.dirname(n),content:o}}var ce=null;async function fe(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 ce??=Qe(import.meta.url,{moduleCache:!1,fsCache:!1}),await ce.import(e)}}var H=["node_modules",...process.env.NODE_PATH?[process.env.NODE_PATH]:[]],nt=A.ResolverFactory.createResolver({fileSystem:new A.CachedInputFileSystem(G,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"],modules:H});async function it(e,t,r){if(typeof globalThis.__tw_resolve=="function"){let s=globalThis.__tw_resolve(e,t);if(s)return Promise.resolve(s)}if(r){let s=await r(e,t);if(s)return s}return z(nt,e,t)}var ot=A.ResolverFactory.createResolver({fileSystem:new A.CachedInputFileSystem(G,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","import"],modules:H}),lt=A.ResolverFactory.createResolver({fileSystem:new A.CachedInputFileSystem(G,4e3),useSyncFileSystemCalls:!0,extensions:[".js",".json",".node",".ts"],conditionNames:["node","require"],modules:H});async function ue(e,t,r){if(typeof globalThis.__tw_resolve=="function"){let s=globalThis.__tw_resolve(e,t);if(s)return Promise.resolve(s)}if(r){let s=await r(e,t);if(s)return s}return z(ot,e,t).catch(()=>z(lt,e,t))}function z(e,t,r){return new Promise((s,n)=>e.resolve({},r,t,{},(o,i)=>{if(o)return n(o);s(i)}))}var v=class extends Map{constructor(r){super();this.factory=r}get(r){let s=super.get(r);return s===void 0&&(s=this.factory(r,this),this.set(r,s)),s}};Symbol.dispose??=Symbol("Symbol.dispose");Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");var Ae=class{constructor(t=r=>void process.stderr.write(`${r}
|
|
11
|
+
`)){this.defaultFlush=t}#r=new v(()=>({value:0}));#t=new v(()=>({value:0n}));#e=[];hit(t){this.#r.get(t).value++}start(t){let r=this.#e.map(n=>n.label).join("//"),s=`${r}${r.length===0?"":"//"}${t}`;this.#r.get(s).value++,this.#t.get(s),this.#e.push({id:s,label:t,namespace:r,value:process.hrtime.bigint()})}end(t){let r=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==t)throw new Error(`Mismatched timer label: \`${t}\`, expected \`${this.#e[this.#e.length-1].label}\``);let s=this.#e.pop(),n=r-s.value;this.#t.get(s.id).value+=n}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(t=this.defaultFlush){let r=[],s=!1;for(let i=this.#e.length-1;i>=0;i--)this.end(this.#e[i].label);for(let[i,{value:a}]of this.#r.entries()){if(this.#t.has(i))continue;r.length===0&&(s=!0,r.push("Hits:"));let l=i.split("//").length;r.push(`${" ".repeat(l)}${i} ${N(ye(`\xD7 ${a}`))}`)}this.#t.size>0&&s&&r.push(`
|
|
12
|
+
Timers:`);let n=-1/0,o=new Map;for(let[i,{value:a}]of this.#t){let l=`${(Number(a)/1e6).toFixed(2)}ms`;o.set(i,l),n=Math.max(n,l.length)}for(let i of this.#t.keys()){let a=i.split("//").length;r.push(`${N(`[${o.get(i).padStart(n," ")}]`)}${" ".repeat(a-1)}${a===1?" ":N(" \u21B3 ")}${i.split("//").pop()} ${this.#r.get(i).value===1?"":N(ye(`\xD7 ${this.#r.get(i).value}`))}`.trimEnd())}t(`
|
|
13
13
|
${r.join(`
|
|
14
14
|
`)}
|
|
15
|
-
`),this.reset()}[Symbol.dispose](){P&&this.report()}};function
|
|
15
|
+
`),this.reset()}[Symbol.dispose](){P&&this.report()}};function N(e){return`\x1B[2m${e}\x1B[22m`}function ye(e){return`\x1B[34m${e}\x1B[39m`}if(!process.versions.bun){let e=k.createRequire(import.meta.url);k.register?.(at(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{et as Features,Ae as Instrumentation,st as __unstable__loadDesignSystem,rt as compile,tt as compileAst,D as env,M as normalizePath};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/node",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.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.18.0",
|
|
37
37
|
"jiti": "^2.4.2",
|
|
38
|
-
"tailwindcss": "4.0.
|
|
38
|
+
"tailwindcss": "4.0.4"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup-node",
|