Skip to content

Commit a1c0b5d

Browse files
Upgrade to latest stable release of V4
1 parent cd6c1d4 commit a1c0b5d

File tree

13 files changed

+233
-218
lines changed

13 files changed

+233
-218
lines changed

packages/tailwindcss-language-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@tailwindcss/forms": "0.5.3",
3737
"@tailwindcss/language-service": "workspace:*",
3838
"@tailwindcss/line-clamp": "0.4.2",
39-
"@tailwindcss/oxide": "file:/Users/philipp/dev/tailwindcss/dist/tailwindcss-oxide.tgz",
39+
"@tailwindcss/oxide": "^4.0.0-alpha.19",
4040
"@tailwindcss/typography": "0.5.7",
4141
"@types/color-name": "^1.1.3",
4242
"@types/culori": "^2.1.0",

packages/tailwindcss-language-server/src/project-locator.test.ts

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -54,93 +54,93 @@ function testFixture(fixture: string, details: any[]) {
5454
})
5555
}
5656

57-
// testFixture('basic', [
58-
// //
59-
// { config: 'tailwind.config.js' },
60-
// ])
61-
62-
// testFixture('dependencies', [
63-
// //
64-
// { config: 'tailwind.config.js' },
65-
// ])
66-
67-
// testFixture('multi-config', [
68-
// //
69-
// { config: 'one/tailwind.config.js' },
70-
// { config: 'two/tailwind.config.js' },
71-
// ])
72-
73-
// testFixture('multi-config-content', [
74-
// //
75-
// { config: 'tailwind.config.one.js' },
76-
// { config: 'tailwind.config.two.js' },
77-
// ])
78-
79-
// testFixture('v3/esm-config', [
80-
// //
81-
// { config: 'tailwind.config.mjs' },
82-
// ])
83-
84-
// testFixture('v3/ts-config', [
85-
// //
86-
// { config: 'tailwind.config.ts' },
87-
// ])
88-
89-
// testFixture('v4/basic', [
90-
// //
91-
// { config: 'app.css' },
92-
// ])
93-
94-
// testFixture('v4/multi-config', [
95-
// //
96-
// { config: 'admin/app.css' },
97-
// { config: 'web/app.css' },
98-
// ])
99-
100-
// testFixture('v4/workspaces', [
101-
// {
102-
// config: 'packages/admin/app.css',
103-
// selectors: [
104-
// '{URL}/node_modules/tailwindcss/**',
105-
// '{URL}/node_modules/tailwindcss/index.css',
106-
// '{URL}/node_modules/tailwindcss/theme.css',
107-
// '{URL}/node_modules/tailwindcss/utilities.css',
108-
// '{URL}/packages/admin/**',
109-
// '{URL}/packages/admin/app.css',
110-
// '{URL}/packages/admin/package.json',
111-
// ],
112-
// },
113-
// {
114-
// config: 'packages/web/app.css',
115-
// selectors: [
116-
// '{URL}/node_modules/tailwindcss/**',
117-
// '{URL}/node_modules/tailwindcss/index.css',
118-
// '{URL}/node_modules/tailwindcss/theme.css',
119-
// '{URL}/node_modules/tailwindcss/utilities.css',
120-
// '{URL}/packages/style-export/**',
121-
// '{URL}/packages/style-export/lib.css',
122-
// '{URL}/packages/style-export/theme.css',
123-
// '{URL}/packages/style-main-field/**',
124-
// '{URL}/packages/style-main-field/lib.css',
125-
// '{URL}/packages/web/**',
126-
// '{URL}/packages/web/app.css',
127-
// '{URL}/packages/web/package.json',
128-
// ],
129-
// },
130-
// ])
131-
132-
// testFixture('v4/auto-content', [
133-
// //
134-
// {
135-
// config: 'src/app.css',
136-
// content: [
137-
// '{URL}/package.json',
138-
// '{URL}/src/index.html',
139-
// '{URL}/src/components/example.html',
140-
// '{URL}/src/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
141-
// ],
142-
// },
143-
// ])
57+
testFixture('basic', [
58+
//
59+
{ config: 'tailwind.config.js' },
60+
])
61+
62+
testFixture('dependencies', [
63+
//
64+
{ config: 'tailwind.config.js' },
65+
])
66+
67+
testFixture('multi-config', [
68+
//
69+
{ config: 'one/tailwind.config.js' },
70+
{ config: 'two/tailwind.config.js' },
71+
])
72+
73+
testFixture('multi-config-content', [
74+
//
75+
{ config: 'tailwind.config.one.js' },
76+
{ config: 'tailwind.config.two.js' },
77+
])
78+
79+
testFixture('v3/esm-config', [
80+
//
81+
{ config: 'tailwind.config.mjs' },
82+
])
83+
84+
testFixture('v3/ts-config', [
85+
//
86+
{ config: 'tailwind.config.ts' },
87+
])
88+
89+
testFixture('v4/basic', [
90+
//
91+
{ config: 'app.css' },
92+
])
93+
94+
testFixture('v4/multi-config', [
95+
//
96+
{ config: 'admin/app.css' },
97+
{ config: 'web/app.css' },
98+
])
99+
100+
testFixture('v4/workspaces', [
101+
{
102+
config: 'packages/admin/app.css',
103+
selectors: [
104+
'{URL}/node_modules/tailwindcss/**',
105+
'{URL}/node_modules/tailwindcss/index.css',
106+
'{URL}/node_modules/tailwindcss/theme.css',
107+
'{URL}/node_modules/tailwindcss/utilities.css',
108+
'{URL}/packages/admin/**',
109+
'{URL}/packages/admin/app.css',
110+
'{URL}/packages/admin/package.json',
111+
],
112+
},
113+
{
114+
config: 'packages/web/app.css',
115+
selectors: [
116+
'{URL}/node_modules/tailwindcss/**',
117+
'{URL}/node_modules/tailwindcss/index.css',
118+
'{URL}/node_modules/tailwindcss/theme.css',
119+
'{URL}/node_modules/tailwindcss/utilities.css',
120+
'{URL}/packages/style-export/**',
121+
'{URL}/packages/style-export/lib.css',
122+
'{URL}/packages/style-export/theme.css',
123+
'{URL}/packages/style-main-field/**',
124+
'{URL}/packages/style-main-field/lib.css',
125+
'{URL}/packages/web/**',
126+
'{URL}/packages/web/app.css',
127+
'{URL}/packages/web/package.json',
128+
],
129+
},
130+
])
131+
132+
testFixture('v4/auto-content', [
133+
//
134+
{
135+
config: 'src/app.css',
136+
content: [
137+
'{URL}/package.json',
138+
'{URL}/src/index.html',
139+
'{URL}/src/components/example.html',
140+
'{URL}/src/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
141+
],
142+
},
143+
])
144144

145145
testFixture('v4/custom-content', [
146146
//
@@ -158,12 +158,12 @@ testFixture('v4/custom-content', [
158158
{
159159
config: 'web/app.css',
160160
content: [
161-
'{URL}/web/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
161+
'{URL}/admin/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
162162
'{URL}/web/*.bin',
163163
'{URL}/web/bar.bin',
164164
'{URL}/package.json',
165165
'{URL}/shared.html',
166-
'{URL}/admin/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
166+
'{URL}/web/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
167167
],
168168
},
169169
])

packages/tailwindcss-language-server/src/project-locator.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ export class ProjectLocator {
382382
if (indexPath && themePath) graph.connect(indexPath, themePath)
383383
if (indexPath && utilitiesPath) graph.connect(indexPath, utilitiesPath)
384384

385-
// QUESTION: Is this code path only for v4? I don't understand the gating
386-
// here but adding a content kind auto indicates that this is the case.
387385
for (let root of graph.roots()) {
388386
let globs = await loadConfig(root.path, root.content)
389387

@@ -527,7 +525,6 @@ async function* detectContentFiles(
527525
try {
528526
let oxidePath = resolveFrom(path.dirname(base), '@tailwindcss/oxide')
529527
oxidePath = pathToFileURL(oxidePath).href
530-
console.log({ oxidePath })
531528

532529
const oxide: typeof import('@tailwindcss/oxide') = await import(oxidePath).then(
533530
(o) => o.default,
@@ -536,26 +533,31 @@ async function* detectContentFiles(
536533
// This isn't a v4 project
537534
if (!oxide.scanDir) return
538535

539-
console.log(oxide.scanDir.toString())
540-
541-
console.log({
542-
inputFile,
543-
s: inputGlobs.map((pattern) => ({ base: path.dirname(inputFile), pattern })),
544-
})
545-
546-
let { files, globs } = oxide.scanDir({
536+
let { files, globs, candidates } = oxide.scanDir({
547537
base,
548-
sources: inputGlobs.map((pattern) => ({ base, pattern })),
538+
sources: inputGlobs.map((pattern) => ({
539+
base: path.dirname(inputFile),
540+
pattern,
541+
})),
549542
})
550-
console.log({ files, globs })
543+
console.log(
544+
{
545+
base,
546+
sources: inputGlobs.map((pattern) => ({
547+
base: path.dirname(inputFile),
548+
pattern,
549+
})),
550+
},
551+
{ files, globs, candidates },
552+
)
551553

552554
for (let file of files) {
553555
yield normalizePath(file)
554556
}
555557

556-
for (let { base, glob } of globs) {
558+
for (let { base, pattern } of globs) {
557559
// Do not normalize the glob itself as it may contain escape sequences
558-
yield normalizePath(base) + '/' + glob
560+
yield normalizePath(base) + '/' + pattern
559561
}
560562
} catch {
561563
//

packages/tailwindcss-language-server/src/util/v4/design-system.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export async function loadDesignSystem(
7474
}
7575

7676
export async function loadConfig(filepath: string, css: string): Promise<string[]> {
77-
let resolved = await resolveCssImports().process(css, { from: filepath })
78-
7977
let contentRules: string[] = []
8078
await postcss([
8179
{
@@ -89,7 +87,7 @@ export async function loadConfig(filepath: string, css: string): Promise<string[
8987
},
9088
},
9189
},
92-
]).process(resolved, { from: filepath })
90+
]).process(css, { from: filepath })
9391

9492
return contentRules
9593
}

0 commit comments

Comments
 (0)