Skip to content

Commit ec32e78

Browse files
committed
chore: lazy load @tailwindcss/node and @tailwindcss/oxide
1 parent 64b70f7 commit ec32e78

File tree

6 files changed

+303
-283
lines changed

6 files changed

+303
-283
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@commitlint/prompt-cli": "^19.7.1",
4040
"@commitlint/types": "^19.5.0",
4141
"@icebreakers/eslint-config": "^1.0.0",
42-
"@icebreakers/monorepo": "^0.7.2",
42+
"@icebreakers/monorepo": "^0.7.4",
4343
"@icebreakers/stylelint-config": "^1.0.0",
4444
"@rollup/pluginutils": "^5.1.4",
4545
"@tailwindcss-mangle/core": "workspace:*",
@@ -70,7 +70,7 @@
7070
"dedent": "^1.5.3",
7171
"defu": "^6.1.4",
7272
"del": "^8.0.0",
73-
"eslint": "^9.20.0",
73+
"eslint": "^9.20.1",
7474
"execa": "^9.5.2",
7575
"fast-glob": "^3.3.3",
7676
"fs-extra": "^11.3.0",
@@ -87,7 +87,7 @@
8787
"mini-css-extract-plugin": "^2.9.2",
8888
"normalize-newline": "^4.1.0",
8989
"only-allow": "^1.2.1",
90-
"pathe": "^2.0.2",
90+
"pathe": "^2.0.3",
9191
"pkg-types": "^1.3.1",
9292
"postcss": "^8.5.2",
9393
"postcss-loader": "^8.1.1",

packages/config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@
6969
"c12": "^2.0.2",
7070
"fs-extra": "^11.3.0",
7171
"is-css-request": "^1.0.1",
72-
"pathe": "^2.0.2"
72+
"pathe": "^2.0.3"
7373
}
7474
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"fs-extra": "^11.3.0",
7474
"htmlparser2": "10.0.0",
7575
"magic-string": "^0.30.17",
76-
"pathe": "^2.0.2",
76+
"pathe": "^2.0.3",
7777
"postcss": "^8.5.2",
7878
"postcss-selector-parser": "^7.1.0"
7979
}

packages/tailwindcss-patch/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@
7676
"@babel/traverse": "^7.26.8",
7777
"@babel/types": "^7.26.8",
7878
"@tailwindcss-mangle/config": "workspace:^",
79-
"@tailwindcss/node": "^4.0.6",
80-
"@tailwindcss/oxide": "^4.0.6",
8179
"cac": "^6.7.14",
8280
"consola": "^3.4.0",
8381
"fs-extra": "^11.3.0",
8482
"jiti": "^2.4.2",
8583
"lilconfig": "^3.1.3",
86-
"pathe": "^2.0.2",
84+
"pathe": "^2.0.3",
8785
"postcss": "^8.5.2",
88-
"semver": "^7.7.1"
86+
"semver": "^7.7.1",
87+
"tailwindcss-config": "^0.0.0"
8988
},
9089
"devDependencies": {
90+
"@tailwindcss/node": "^4.0.6",
91+
"@tailwindcss/oxide": "^4.0.6",
9192
"@tailwindcss/postcss": "^4.0.6",
9293
"@tailwindcss/vite": "^4.0.6",
9394
"tailwindcss": "^4",

packages/tailwindcss-patch/src/core/candidates.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import process from 'node:process'
22
import { defu } from '@tailwindcss-mangle/shared'
3-
import { __unstable__loadDesignSystem } from '@tailwindcss/node'
4-
import { Scanner } from '@tailwindcss/oxide'
3+
4+
function importNode() {
5+
return import('@tailwindcss/node')
6+
}
7+
8+
function importOxide() {
9+
return import('@tailwindcss/oxide')
10+
}
511

612
export async function extractRawCandidates(
713
content: string,
814
extension: string = 'html',
915
): Promise<{ rawCandidate: string, start: number, end: number }[]> {
16+
const { Scanner } = await importOxide()
1017
const scanner = new Scanner({})
1118

1219
const result = scanner.getCandidatesWithPositions({ content, extension })
@@ -32,6 +39,7 @@ export async function extractValidCandidates(options: ExtractValidCandidatesOpti
3239
css: '@import "tailwindcss";',
3340
base: process.cwd(),
3441
})
42+
const { __unstable__loadDesignSystem } = await importNode()
3543
const designSystem = await __unstable__loadDesignSystem(css, { base })
3644

3745
const candidates = await extractRawCandidates(content)

0 commit comments

Comments
 (0)