@tailwindcss/node 4.0.0-alpha.24 → 4.0.0-alpha.26
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 +38 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,48 @@
|
|
|
1
|
+
import { Candidate, Variant } from './candidate';
|
|
2
|
+
import { compileAstNodes } from './compile';
|
|
3
|
+
import { ClassEntry, VariantEntry } from './intellisense';
|
|
4
|
+
import { Theme } from './theme';
|
|
5
|
+
import { Utilities } from './utilities';
|
|
6
|
+
import { Variants } from './variants';
|
|
7
|
+
|
|
8
|
+
declare const DEBUG: boolean;
|
|
9
|
+
|
|
10
|
+
declare const env_DEBUG: typeof DEBUG;
|
|
11
|
+
declare namespace env {
|
|
12
|
+
export { env_DEBUG as DEBUG };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type DesignSystem = {
|
|
16
|
+
theme: Theme;
|
|
17
|
+
utilities: Utilities;
|
|
18
|
+
variants: Variants;
|
|
19
|
+
invalidCandidates: Set<string>;
|
|
20
|
+
important: boolean;
|
|
21
|
+
getClassOrder(classes: string[]): [string, bigint | null][];
|
|
22
|
+
getClassList(): ClassEntry[];
|
|
23
|
+
getVariants(): VariantEntry[];
|
|
24
|
+
parseCandidate(candidate: string): Candidate[];
|
|
25
|
+
parseVariant(variant: string): Variant | null;
|
|
26
|
+
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
|
27
|
+
getVariantOrder(): Map<Variant, number>;
|
|
28
|
+
resolveThemeValue(path: string): string | undefined;
|
|
29
|
+
candidatesToCss(classes: string[]): (string | null)[];
|
|
30
|
+
};
|
|
31
|
+
|
|
1
32
|
declare function compile(css: string, { base, onDependency }: {
|
|
2
33
|
base: string;
|
|
3
34
|
onDependency: (path: string) => void;
|
|
4
35
|
}): Promise<{
|
|
5
36
|
globs: {
|
|
6
|
-
|
|
37
|
+
base: string;
|
|
7
38
|
pattern: string;
|
|
8
39
|
}[];
|
|
9
40
|
build(candidates: string[]): string;
|
|
10
41
|
}>;
|
|
42
|
+
declare function __unstable__loadDesignSystem(css: string, { base }: {
|
|
43
|
+
base: string;
|
|
44
|
+
}): Promise<DesignSystem>;
|
|
45
|
+
|
|
46
|
+
declare function normalizePath(originalPath: string): string;
|
|
11
47
|
|
|
12
|
-
export { compile };
|
|
48
|
+
export { __unstable__loadDesignSystem, compile, env, normalizePath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
|
+
import { Candidate, Variant } from './candidate';
|
|
2
|
+
import { compileAstNodes } from './compile';
|
|
3
|
+
import { ClassEntry, VariantEntry } from './intellisense';
|
|
4
|
+
import { Theme } from './theme';
|
|
5
|
+
import { Utilities } from './utilities';
|
|
6
|
+
import { Variants } from './variants';
|
|
7
|
+
|
|
8
|
+
declare const DEBUG: boolean;
|
|
9
|
+
|
|
10
|
+
declare const env_DEBUG: typeof DEBUG;
|
|
11
|
+
declare namespace env {
|
|
12
|
+
export { env_DEBUG as DEBUG };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type DesignSystem = {
|
|
16
|
+
theme: Theme;
|
|
17
|
+
utilities: Utilities;
|
|
18
|
+
variants: Variants;
|
|
19
|
+
invalidCandidates: Set<string>;
|
|
20
|
+
important: boolean;
|
|
21
|
+
getClassOrder(classes: string[]): [string, bigint | null][];
|
|
22
|
+
getClassList(): ClassEntry[];
|
|
23
|
+
getVariants(): VariantEntry[];
|
|
24
|
+
parseCandidate(candidate: string): Candidate[];
|
|
25
|
+
parseVariant(variant: string): Variant | null;
|
|
26
|
+
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
|
27
|
+
getVariantOrder(): Map<Variant, number>;
|
|
28
|
+
resolveThemeValue(path: string): string | undefined;
|
|
29
|
+
candidatesToCss(classes: string[]): (string | null)[];
|
|
30
|
+
};
|
|
31
|
+
|
|
1
32
|
declare function compile(css: string, { base, onDependency }: {
|
|
2
33
|
base: string;
|
|
3
34
|
onDependency: (path: string) => void;
|
|
4
35
|
}): Promise<{
|
|
5
36
|
globs: {
|
|
6
|
-
|
|
37
|
+
base: string;
|
|
7
38
|
pattern: string;
|
|
8
39
|
}[];
|
|
9
40
|
build(candidates: string[]): string;
|
|
10
41
|
}>;
|
|
42
|
+
declare function __unstable__loadDesignSystem(css: string, { base }: {
|
|
43
|
+
base: string;
|
|
44
|
+
}): Promise<DesignSystem>;
|
|
45
|
+
declare function loadModule(id: string, base: string, onDependency: (path: string) => void): Promise<{
|
|
46
|
+
base: string;
|
|
47
|
+
module: any;
|
|
48
|
+
}>;
|
|
49
|
+
|
|
50
|
+
declare function normalizePath(originalPath: string): string;
|
|
11
51
|
|
|
12
|
-
export { compile };
|
|
52
|
+
export { __unstable__loadDesignSystem, compile, env, loadModule, normalizePath };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var O=Object.create;var m=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var s in t)m(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of J(t))!k.call(e,n)&&n!==s&&m(e,n,{get:()=>t[n],enumerable:!(r=U(t,n))||r.enumerable});return e};var l=(e,t,s)=>(s=e!=null?O(W(e)):{},x(t||!e||!e.__esModule?m(s,"default",{value:e,enumerable:!0}):s,e)),B=e=>x(m({},"__esModule",{value:!0}),e);var te={};S(te,{__unstable__loadDesignSystem:()=>H,compile:()=>Y,env:()=>g,loadModule:()=>w,normalizePath:()=>ee});module.exports=B(te);var M=l(require("module")),N=require("url");var g={};S(g,{DEBUG:()=>L});var L=b(process.env.DEBUG);function b(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 c=l(require("enhanced-resolve")),F=require("jiti"),h=l(require("fs")),T=l(require("fs/promises")),a=l(require("path")),v=require("url"),p=require("tailwindcss");var d=l(require("fs/promises")),f=l(require("path")),z=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],A=[".js",".cjs",".mjs"],G=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],q=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function X(e,t){for(let s of t){let r=`${e}${s}`;if((await d.default.stat(r).catch(()=>null))?.isFile())return r}for(let s of t){let r=`${e}/index${s}`;if(await d.default.access(r).then(()=>!0,()=>!1))return r}return null}async function R(e,t,s,r){let n=A.includes(r)?G:q,i=await X(f.default.resolve(s,t),n);if(i===null||e.has(i))return;e.add(i),s=f.default.dirname(i),r=f.default.extname(i);let o=await d.default.readFile(i,"utf-8"),u=[];for(let I of z)for(let _ of o.matchAll(I))_[1].startsWith(".")&&u.push(R(e,_[1],s,r));await Promise.all(u)}async function E(e){let t=new Set;return await R(t,e,f.default.dirname(e),f.default.extname(e)),Array.from(t)}var V={};function Y(e,{base:t,onDependency:s}){return(0,p.compile)(e,{base:t,async loadModule(r,n){return w(r,n,s)},async loadStylesheet(r,n){return $(r,n,s)}})}async function H(e,{base:t}){return(0,p.__unstable__loadDesignSystem)(e,{base:t,async loadModule(s,r){return w(s,r,()=>{})},async loadStylesheet(s,r){return $(s,r,()=>{})}})}async function w(e,t,s){if(e[0]!=="."){let o=await C(e,t);if(!o)throw new Error(`Could not resolve '${e}' from '${t}'`);let u=await j((0,v.pathToFileURL)(o).href);return{base:(0,a.dirname)(o),module:u.default??u}}let r=await C(e,t);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[n,i]=await Promise.all([j((0,v.pathToFileURL)(r).href+"?id="+Date.now()),E(r)]);for(let o of i)s(o);return{base:(0,a.dirname)(r),module:n.default??n}}async function $(e,t,s){let r=await K(e,t);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(s(r),typeof globalThis.__tw_readFile=="function"){let i=await globalThis.__tw_readFile(r,"utf-8");if(i)return{base:a.default.dirname(r),content:i}}let n=await T.default.readFile(r,"utf-8");return{base:a.default.dirname(r),content:n}}var D=null;async function j(e){try{return await import(e)}catch(t){try{return D??=(0,F.createJiti)(V.url,{moduleCache:!1,fsCache:!1}),await D.import(e)}catch{}throw t}}var P=c.default.ResolverFactory.createResolver({fileSystem:new c.default.CachedInputFileSystem(h.default,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function K(e,t){if(typeof globalThis.__tw_resolve=="function"){let r=globalThis.__tw_resolve(e,t);if(r)return Promise.resolve(r)}if(!((0,a.extname)(e)===""||e.startsWith(".")))try{let r=await y(P,`./${e}`,t);if(!r)throw new Error;return r}catch{}return y(P,e,t)}var Q=c.default.ResolverFactory.createResolver({fileSystem:new c.default.CachedInputFileSystem(h.default,4e3),useSyncFileSystemCalls:!0});function C(e,t){return y(Q,e,t)}function y(e,t,s){return new Promise((r,n)=>e.resolve({},s,t,{},(i,o)=>{if(i)return n(i);r(o)}))}function Z(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 r="";if(s>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),r="//")}var i=e.split(/[/\\]+/);return t!==!1&&i[i.length-1]===""&&i.pop(),r+i.join("/")}function ee(e){let t=Z(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}process.versions.bun||M.register?.((0,N.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader")));0&&(module.exports={__unstable__loadDesignSystem,compile,env,loadModule,normalizePath});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
var C=Object.defineProperty;var F=(e,t)=>{for(var s in t)C(e,s,{get:t[s],enumerable:!0})};import*as u from"node:module";import{pathToFileURL as X}from"node:url";var p={};F(p,{DEBUG:()=>T});var T=$(process.env.DEBUG);function $(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 f from"enhanced-resolve";import{createJiti as J}from"jiti";import E from"node:fs";import W from"node:fs/promises";import y,{dirname as h,extname as b}from"node:path";import{pathToFileURL as w}from"node:url";import{__unstable__loadDesignSystem as k,compile as B}from"tailwindcss";import c from"node:fs/promises";import a from"node:path";var M=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],N=[".js",".cjs",".mjs"],I=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],O=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function U(e,t){for(let s of t){let r=`${e}${s}`;if((await c.stat(r).catch(()=>null))?.isFile())return r}for(let s of t){let r=`${e}/index${s}`;if(await c.access(r).then(()=>!0,()=>!1))return r}return null}async function g(e,t,s,r){let n=N.includes(r)?I:O,i=await U(a.resolve(s,t),n);if(i===null||e.has(i))return;e.add(i),s=a.dirname(i),r=a.extname(i);let o=await c.readFile(i,"utf-8"),l=[];for(let P of M)for(let d of o.matchAll(P))d[1].startsWith(".")&&l.push(g(e,d[1],s,r));await Promise.all(l)}async function v(e){let t=new Set;return await g(t,e,a.dirname(e),a.extname(e)),Array.from(t)}function L(e,{base:t,onDependency:s}){return B(e,{base:t,async loadModule(r,n){return D(r,n,s)},async loadStylesheet(r,n){return j(r,n,s)}})}async function q(e,{base:t}){return k(e,{base:t,async loadModule(s,r){return D(s,r,()=>{})},async loadStylesheet(s,r){return j(s,r,()=>{})}})}async function D(e,t,s){if(e[0]!=="."){let o=await R(e,t);if(!o)throw new Error(`Could not resolve '${e}' from '${t}'`);let l=await S(w(o).href);return{base:h(o),module:l.default??l}}let r=await R(e,t);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);let[n,i]=await Promise.all([S(w(r).href+"?id="+Date.now()),v(r)]);for(let o of i)s(o);return{base:h(r),module:n.default??n}}async function j(e,t,s){let r=await z(e,t);if(!r)throw new Error(`Could not resolve '${e}' from '${t}'`);if(s(r),typeof globalThis.__tw_readFile=="function"){let i=await globalThis.__tw_readFile(r,"utf-8");if(i)return{base:y.dirname(r),content:i}}let n=await W.readFile(r,"utf-8");return{base:y.dirname(r),content:n}}var _=null;async function S(e){try{return await import(e)}catch(t){try{return _??=J(import.meta.url,{moduleCache:!1,fsCache:!1}),await _.import(e)}catch{}throw t}}var x=f.ResolverFactory.createResolver({fileSystem:new f.CachedInputFileSystem(E,4e3),useSyncFileSystemCalls:!0,extensions:[".css"],mainFields:["style"],conditionNames:["style"]});async function z(e,t){if(typeof globalThis.__tw_resolve=="function"){let r=globalThis.__tw_resolve(e,t);if(r)return Promise.resolve(r)}if(!(b(e)===""||e.startsWith(".")))try{let r=await m(x,`./${e}`,t);if(!r)throw new Error;return r}catch{}return m(x,e,t)}var A=f.ResolverFactory.createResolver({fileSystem:new f.CachedInputFileSystem(E,4e3),useSyncFileSystemCalls:!0});function R(e,t){return m(A,e,t)}function m(e,t,s){return new Promise((r,n)=>e.resolve({},s,t,{},(i,o)=>{if(i)return n(i);r(o)}))}function G(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 r="";if(s>4&&e[3]==="\\"){var n=e[2];(n==="?"||n===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),r="//")}var i=e.split(/[/\\]+/);return t!==!1&&i[i.length-1]===""&&i.pop(),r+i.join("/")}function le(e){let t=G(e);return e.startsWith("\\\\")&&t.startsWith("/")&&!t.startsWith("//")?`/${t}`:t}if(!process.versions.bun){let e=u.createRequire(import.meta.url);u.register?.(X(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{q as __unstable__loadDesignSystem,L as compile,p as env,le as normalizePath};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/node",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.26",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/index.d.
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
23
|
"import": "./dist/index.mjs",
|
|
24
24
|
"require": "./dist/index.js"
|
|
25
25
|
},
|
|
@@ -33,9 +33,10 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"tailwindcss": "4.0.0-alpha.
|
|
36
|
+
"tailwindcss": "4.0.0-alpha.26"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"enhanced-resolve": "^5.17.1",
|
|
39
40
|
"jiti": "^2.0.0-beta.3"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|