From fcce09dc40223d1ceee55fdf60f2325c88563611 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 16:57:53 -0400 Subject: [PATCH 01/15] Update prettier version --- package-lock.json | 31 ++++++------------- package.json | 1 + .../tailwindcss-language-server/package.json | 6 ---- .../tailwindcss-language-service/package.json | 1 - 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9b693cc..9834fd29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ ], "devDependencies": { "@npmcli/package-json": "^5.0.0", + "prettier": "^3.2.5", "semver": "^7.5.4" } }, @@ -5032,15 +5033,18 @@ } }, "node_modules/prettier": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.0.tgz", - "integrity": "sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, "node_modules/pretty-format": { @@ -7367,7 +7371,6 @@ "postcss": "8.4.31", "postcss-load-config": "3.0.1", "postcss-selector-parser": "6.0.2", - "prettier": "^2.8.8", "resolve": "1.20.0", "rimraf": "3.0.2", "stack-trace": "0.0.10", @@ -7389,21 +7392,6 @@ "integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==", "dev": true }, - "packages/tailwindcss-language-server/node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, "packages/tailwindcss-language-server/node_modules/vscode-languageclient": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", @@ -7469,7 +7457,6 @@ "devDependencies": { "esbuild": "^0.19.5", "esbuild-node-externals": "^1.9.0", - "prettier": "2.3.0", "tslib": "2.2.0", "typescript": "^5.3.3", "vitest": "^1.1.2" diff --git a/package.json b/package.json index 45a6e1aa..aa5fab41 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ ], "devDependencies": { "@npmcli/package-json": "^5.0.0", + "prettier": "^3.2.5", "semver": "^7.5.4" }, "prettier": { diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json index c1c0faa7..45459272 100644 --- a/packages/tailwindcss-language-server/package.json +++ b/packages/tailwindcss-language-server/package.json @@ -66,7 +66,6 @@ "postcss": "8.4.31", "postcss-load-config": "3.0.1", "postcss-selector-parser": "6.0.2", - "prettier": "^2.8.8", "resolve": "1.20.0", "rimraf": "3.0.2", "stack-trace": "0.0.10", @@ -80,10 +79,5 @@ "vscode-languageserver": "8.1.0", "vscode-languageserver-textdocument": "1.0.11", "vscode-uri": "3.0.2" - }, - "prettier": { - "semi": false, - "singleQuote": true, - "printWidth": 100 } } diff --git a/packages/tailwindcss-language-service/package.json b/packages/tailwindcss-language-service/package.json index ee3cef58..14d8fcbc 100644 --- a/packages/tailwindcss-language-service/package.json +++ b/packages/tailwindcss-language-service/package.json @@ -41,7 +41,6 @@ "devDependencies": { "esbuild": "^0.19.5", "esbuild-node-externals": "^1.9.0", - "prettier": "2.3.0", "tslib": "2.2.0", "typescript": "^5.3.3", "vitest": "^1.1.2" From b46d7a3d1c7ac4ae35fca9ff4849c1910b302f79 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 17:02:26 -0400 Subject: [PATCH 02/15] Add Prettier ignore file --- .prettierignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..08b5c316 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +packages/*/dist +packages/*/bin From a89adfaf799d50edd496963798430a1c7a4f9f54 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 17:04:44 -0400 Subject: [PATCH 03/15] Optimize code --- .../src/util/braceLevel.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/tailwindcss-language-service/src/util/braceLevel.ts b/packages/tailwindcss-language-service/src/util/braceLevel.ts index fe7b6293..5b0e871d 100644 --- a/packages/tailwindcss-language-service/src/util/braceLevel.ts +++ b/packages/tailwindcss-language-service/src/util/braceLevel.ts @@ -1,14 +1,11 @@ export default function braceLevel(text: string) { let count = 0 + for (let i = text.length - 1; i >= 0; i--) { - switch (text[i]) { - case '{': - count += 1 - break - case '}': - count -= 1 - break - } + let char = text.charCodeAt(i) + + count += Number(char === 0x7b /* { */) - Number(char === 0x7d /* } */) } + return count } From 323f43752b5fa17777b8003080fa81f008210061 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 17:04:52 -0400 Subject: [PATCH 04/15] Cleanup imports --- .../tailwindcss-language-service/src/documentColorProvider.ts | 2 +- .../tailwindcss-language-service/src/documentLinksProvider.ts | 2 +- packages/tailwindcss-language-service/src/hoverProvider.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/tailwindcss-language-service/src/documentColorProvider.ts b/packages/tailwindcss-language-service/src/documentColorProvider.ts index 4af8e42a..da8c90cb 100644 --- a/packages/tailwindcss-language-service/src/documentColorProvider.ts +++ b/packages/tailwindcss-language-service/src/documentColorProvider.ts @@ -1,4 +1,4 @@ -import { State } from './util/state' +import type { State } from './util/state' import { findClassListsInDocument, getClassNamesInClassList, diff --git a/packages/tailwindcss-language-service/src/documentLinksProvider.ts b/packages/tailwindcss-language-service/src/documentLinksProvider.ts index b2dedd59..cec23435 100644 --- a/packages/tailwindcss-language-service/src/documentLinksProvider.ts +++ b/packages/tailwindcss-language-service/src/documentLinksProvider.ts @@ -1,5 +1,5 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from './util/state' +import type { State } from './util/state' import type { DocumentLink, Range } from 'vscode-languageserver' import { isCssDoc } from './util/css' import { getLanguageBoundaries } from './util/getLanguageBoundaries' diff --git a/packages/tailwindcss-language-service/src/hoverProvider.ts b/packages/tailwindcss-language-service/src/hoverProvider.ts index f61b718e..d751e64b 100644 --- a/packages/tailwindcss-language-service/src/hoverProvider.ts +++ b/packages/tailwindcss-language-service/src/hoverProvider.ts @@ -10,7 +10,6 @@ import * as jit from './util/jit' import { validateConfigPath } from './diagnostics/getInvalidConfigPathDiagnostics' import { isWithinRange } from './util/isWithinRange' import type { TextDocument } from 'vscode-languageserver-textdocument' -import postcss from 'postcss' export async function doHover( state: State, From c24f29f8046ff4ddf079ccc66db2a1a61365d710 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 16:51:51 -0400 Subject: [PATCH 05/15] Move file --- .../src/features.ts | 91 +------------------ .../src/features.ts | 90 ++++++++++++++++++ 2 files changed, 91 insertions(+), 90 deletions(-) create mode 100644 packages/tailwindcss-language-service/src/features.ts diff --git a/packages/tailwindcss-language-server/src/features.ts b/packages/tailwindcss-language-server/src/features.ts index 46b5876d..50019071 100644 --- a/packages/tailwindcss-language-server/src/features.ts +++ b/packages/tailwindcss-language-server/src/features.ts @@ -1,90 +1 @@ -import * as semver from '@tailwindcss/language-service/src/util/semver' - -export type Feature = - | 'layer:preflight' - | 'layer:base' - | 'css-at-theme' - | 'css-at-config' - | 'transpiled-configs' - | 'relative-content-paths' - | 'browserslist-in-plugins' - | 'apply-complex-classes' - | 'apply-complex-classes:flagged' - | 'content-list' - | 'purge-list' - | 'jit' - | 'separator:root' - | 'separator:options' - -/** - * Determine a list of features that are supported by the given Tailwind CSS version - */ -export function supportedFeatures(version: string): Feature[] { - let features: Feature[] = [] - - if (semver.gte(version, '4.0.0-alpha.1')) { - return ['css-at-theme', 'layer:base', 'content-list'] - } - - if (version.startsWith('0.0.0-oxide')) { - return ['css-at-theme', 'layer:base', 'content-list'] - } - - if (semver.gte(version, '0.99.0')) { - // `@tailwind base`` (and `@layer base`) - features.push('layer:base') - - // `separator` key at the root of the config - features.push('separator:root') - } else { - // `@tailwind preflight`` - features.push('layer:preflight') - - // `separator` key is located at `options.separator`` - features.push('separator:options') - } - - // Plugins have browserslist targets passed to them - if (semver.gte(version, '1.4.0') && semver.lte(version, '1.99.0')) { - features.push('browserslist-in-plugins') - } - - if (semver.gte(version, '3.0.0')) { - // Complex class support is built-in to `@apply` itself - } else if (semver.gte(version, '1.99.0')) { - // `applyComplexClasses` is located in `./lib/lib/substituteClassApplyAtRules` - features.push('apply-complex-classes') - } else if (semver.gte(version, '1.7.0')) { - // `applyComplexClasses` is located in './lib/flagged/applyComplexClasses' and must be enabled via a feature flag - features.push('apply-complex-classes:flagged') - } - - if (semver.gte(version, '3.0.0')) { - // A `content` key is used to define the list of files to scan for classes - features.push('content-list') - } else { - // A `purge` key is used to define the list of files to scan for classes - features.push('purge-list') - } - - if (semver.gte(version, '3.0.0')) { - features.push('jit') - } else if (semver.gte(version, '2.1.0')) { - // TODO: v2.1 Check for JIT based on config file? - } - - if (semver.gte(version, '3.2.0')) { - // Support for the `@config` directive in CSS to customize the located config file - features.push('css-at-config') - - // Support for relative content paths - features.push('relative-content-paths') - } - - if (semver.gte(version, '3.3.0')) { - // Supports ESM and TS configs via `loadConfig` by transpiling them to CJS on the fly - features.push('transpiled-configs') - } - - return features -} +export * from '@tailwindcss/language-service/src/features' diff --git a/packages/tailwindcss-language-service/src/features.ts b/packages/tailwindcss-language-service/src/features.ts new file mode 100644 index 00000000..63199813 --- /dev/null +++ b/packages/tailwindcss-language-service/src/features.ts @@ -0,0 +1,90 @@ +import * as semver from './util/semver' + +export type Feature = + | 'layer:preflight' + | 'layer:base' + | 'css-at-theme' + | 'css-at-config' + | 'transpiled-configs' + | 'relative-content-paths' + | 'browserslist-in-plugins' + | 'apply-complex-classes' + | 'apply-complex-classes:flagged' + | 'content-list' + | 'purge-list' + | 'jit' + | 'separator:root' + | 'separator:options' + +/** + * Determine a list of features that are supported by the given Tailwind CSS version + */ +export function supportedFeatures(version: string): Feature[] { + let features: Feature[] = [] + + if (semver.gte(version, '4.0.0-alpha.1')) { + return ['css-at-theme', 'layer:base', 'content-list'] + } + + if (version.startsWith('0.0.0-oxide')) { + return ['css-at-theme', 'layer:base', 'content-list'] + } + + if (semver.gte(version, '0.99.0')) { + // `@tailwind base`` (and `@layer base`) + features.push('layer:base') + + // `separator` key at the root of the config + features.push('separator:root') + } else { + // `@tailwind preflight`` + features.push('layer:preflight') + + // `separator` key is located at `options.separator`` + features.push('separator:options') + } + + // Plugins have browserslist targets passed to them + if (semver.gte(version, '1.4.0') && semver.lte(version, '1.99.0')) { + features.push('browserslist-in-plugins') + } + + if (semver.gte(version, '3.0.0')) { + // Complex class support is built-in to `@apply` itself + } else if (semver.gte(version, '1.99.0')) { + // `applyComplexClasses` is located in `./lib/lib/substituteClassApplyAtRules` + features.push('apply-complex-classes') + } else if (semver.gte(version, '1.7.0')) { + // `applyComplexClasses` is located in './lib/flagged/applyComplexClasses' and must be enabled via a feature flag + features.push('apply-complex-classes:flagged') + } + + if (semver.gte(version, '3.0.0')) { + // A `content` key is used to define the list of files to scan for classes + features.push('content-list') + } else { + // A `purge` key is used to define the list of files to scan for classes + features.push('purge-list') + } + + if (semver.gte(version, '3.0.0')) { + features.push('jit') + } else if (semver.gte(version, '2.1.0')) { + // TODO: v2.1 Check for JIT based on config file? + } + + if (semver.gte(version, '3.2.0')) { + // Support for the `@config` directive in CSS to customize the located config file + features.push('css-at-config') + + // Support for relative content paths + features.push('relative-content-paths') + } + + if (semver.gte(version, '3.3.0')) { + // Supports ESM and TS configs via `loadConfig` by transpiling them to CJS on the fly + features.push('transpiled-configs') + } + + return features +} From 6cc2207dc7eea3888417ea2be1dc46025a1d6642 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 18:12:50 -0400 Subject: [PATCH 06/15] Run Prettier on entire codebase --- .vscode/launch.json | 74 ++++---- .vscode/tasks.json | 58 +++--- .../scripts/createNoticesFile.mjs | 4 +- .../tailwindcss-language-server/src/config.ts | 2 +- .../src/language/cssServer.ts | 68 +++---- .../src/language/languageModelCache.ts | 2 +- .../src/lib/hook.ts | 2 +- .../src/lib/preflight.ts | 2 +- .../src/project-locator.test.ts | 2 - .../tailwindcss-language-server/src/server.ts | 2 +- .../tailwindcss-language-server/src/tw.ts | 56 +++--- .../src/util/error.ts | 2 +- .../src/util/getModuleDependencies.ts | 6 +- .../src/util/isExcluded.ts | 2 +- .../src/util/resolveFrom.ts | 7 +- .../src/util/v4/design-system.ts | 2 +- .../src/watcher/index.js | 4 +- .../tests/completions/completions.test.js | 2 +- .../fixtures/v3/ts-config/tailwind.config.ts | 4 +- .../tests/hover/hover.test.js | 4 +- .../tailwindcss-language-server/tsconfig.json | 36 ++-- .../scripts/build.mjs | 2 +- .../src/codeActions/codeActionProvider.ts | 12 +- .../provideCssConflictCodeActions.ts | 15 +- .../provideInvalidApplyCodeActions.ts | 8 +- .../provideSuggestionCodeActions.ts | 2 +- .../src/completionProvider.ts | 179 +++++++++--------- .../src/diagnostics/diagnosticsProvider.ts | 2 +- .../diagnostics/getCssConflictDiagnostics.ts | 22 ++- .../diagnostics/getInvalidApplyDiagnostics.ts | 2 +- .../getInvalidConfigPathDiagnostics.ts | 12 +- .../getInvalidScreenDiagnostics.ts | 6 +- .../getInvalidTailwindDirectiveDiagnostics.ts | 6 +- .../getInvalidVariantDiagnostics.ts | 6 +- .../getRecommendedVariantOrderDiagnostics.ts | 2 +- .../src/diagnostics/types.ts | 14 +- .../src/documentColorProvider.ts | 2 +- .../src/documentLinksProvider.ts | 6 +- .../src/hoverProvider.ts | 8 +- .../src/util/absoluteRange.ts | 7 +- .../src/util/array.ts | 2 +- .../src/util/classes.test.ts | 38 ++-- .../src/util/classes.ts | 28 ++- .../src/util/color.ts | 20 +- .../src/util/css.ts | 2 +- .../src/util/doc.ts | 6 +- .../src/util/equivalents.ts | 13 +- .../src/util/find.ts | 48 ++--- .../src/util/flagEnabled.ts | 10 +- .../src/util/getClassNameAtPosition.ts | 5 +- .../src/util/getClassNameDecls.ts | 2 +- .../src/util/getClassNameMeta.ts | 2 +- .../src/util/getLanguageBoundaries.ts | 10 +- .../src/util/getVariantsFromClassName.ts | 4 +- .../src/util/html.ts | 2 +- .../isValidLocationForEmmetAbbreviation.ts | 4 +- .../src/util/isWithinRange.ts | 20 +- .../src/util/jit.ts | 4 +- .../src/util/js.ts | 2 +- .../src/util/languages.ts | 2 +- .../src/util/pixelEquivalents.ts | 4 +- .../src/util/removeRangesFromString.ts | 5 +- .../src/util/resolveRange.ts | 6 +- .../src/util/state.ts | 2 +- .../src/util/stringToPath.ts | 3 +- .../src/util/v4/ast.ts | 2 +- .../src/util/validateApply.ts | 2 +- packages/vscode-tailwindcss/src/extension.ts | 38 ++-- packages/vscode-tailwindcss/tsconfig.json | 48 ++--- 69 files changed, 489 insertions(+), 499 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 041402b1..e3bec214 100755 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,37 +1,37 @@ -{ - "version": "0.2.0", - // List of configurations. Add new configurations or edit existing ones. - "configurations": [ - { - "type": "extensionHost", - "request": "launch", - "name": "Launch Client", - "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}/packages/vscode-tailwindcss"], - "stopOnEntry": false, - "sourceMaps": true, - "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] - // "preLaunchTask": "npm: dev" - }, - { - "type": "node", - "request": "attach", - "name": "Attach to Server 6011", - "address": "localhost", - "protocol": "inspector", - "port": 6011, - "sourceMaps": true, - "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] - }, - { - "type": "node", - "request": "attach", - "name": "Attach to Server 6012", - "address": "localhost", - "protocol": "inspector", - "port": 6012, - "sourceMaps": true, - "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] - } - ] -} +{ + "version": "0.2.0", + // List of configurations. Add new configurations or edit existing ones. + "configurations": [ + { + "type": "extensionHost", + "request": "launch", + "name": "Launch Client", + "runtimeExecutable": "${execPath}", + "args": ["--extensionDevelopmentPath=${workspaceRoot}/packages/vscode-tailwindcss"], + "stopOnEntry": false, + "sourceMaps": true, + "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] + // "preLaunchTask": "npm: dev" + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Server 6011", + "address": "localhost", + "protocol": "inspector", + "port": 6011, + "sourceMaps": true, + "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Server 6012", + "address": "localhost", + "protocol": "inspector", + "port": 6012, + "sourceMaps": true, + "outFiles": ["${workspaceRoot}/packages/vscode-tailwindcss/dist/**/*.js"] + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4b2d95fe..1abde264 100755 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,29 +1,29 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "build", - "group": "build", - "presentation": { - "panel": "dedicated", - "reveal": "never" - }, - "problemMatcher": ["$tsc"] - }, - { - "type": "npm", - "script": "dev", - "isBackground": true, - "group": { - "kind": "build", - "isDefault": true - }, - "presentation": { - "panel": "dedicated", - "reveal": "never" - }, - "problemMatcher": ["$tsc-watch"] - } - ] -} +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "build", + "group": "build", + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": ["$tsc"] + }, + { + "type": "npm", + "script": "dev", + "isBackground": true, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "panel": "dedicated", + "reveal": "never" + }, + "problemMatcher": ["$tsc-watch"] + } + ] +} diff --git a/packages/tailwindcss-language-server/scripts/createNoticesFile.mjs b/packages/tailwindcss-language-server/scripts/createNoticesFile.mjs index ebb13542..e42d701a 100644 --- a/packages/tailwindcss-language-server/scripts/createNoticesFile.mjs +++ b/packages/tailwindcss-language-server/scripts/createNoticesFile.mjs @@ -23,7 +23,7 @@ function getDeps(dir, dev = false) { return Object.entries( JSON.parse(readFileSync(resolve(dir, 'package.json'), 'utf-8'))[ dev ? 'devDependencies' : 'dependencies' - ] + ], ).map(([name, version]) => `${name}@${version}`) } @@ -67,6 +67,6 @@ function getLicenses(dir) { writeFileSync( resolve(__dirname, '../ThirdPartyNotices.txt'), contents.join(`\n\n${'='.repeat(80)}\n\n`), - 'utf-8' + 'utf-8', ) })() diff --git a/packages/tailwindcss-language-server/src/config.ts b/packages/tailwindcss-language-server/src/config.ts index 778b9363..1723e6ae 100644 --- a/packages/tailwindcss-language-server/src/config.ts +++ b/packages/tailwindcss-language-server/src/config.ts @@ -73,7 +73,7 @@ export function createSettingsCache(connection: Connection): SettingsCache { return merge( getDefaultSettings(), { editor, tailwindCSS }, - { arrayMerge: (_destinationArray, sourceArray, _options) => sourceArray } + { arrayMerge: (_destinationArray, sourceArray, _options) => sourceArray }, ) } diff --git a/packages/tailwindcss-language-server/src/language/cssServer.ts b/packages/tailwindcss-language-server/src/language/cssServer.ts index c7c0f632..07adccda 100644 --- a/packages/tailwindcss-language-server/src/language/cssServer.ts +++ b/packages/tailwindcss-language-server/src/language/cssServer.ts @@ -51,7 +51,7 @@ let foldingRangeLimit = Number.MAX_VALUE const MEDIA_MARKER = '℘' const stylesheets = getLanguageModelCache(10, 60, (document) => - cssLanguageService.parseStylesheet(document) + cssLanguageService.parseStylesheet(document), ) documents.onDidClose(({ document }) => { stylesheets.onDocumentRemoved(document) @@ -72,7 +72,7 @@ connection.onInitialize((params: InitializeParams) => { foldingRangeLimit = dlv( params.capabilities, 'textDocument.foldingRange.rangeLimit', - Number.MAX_VALUE + Number.MAX_VALUE, ) return { @@ -96,7 +96,7 @@ connection.onInitialize((params: InitializeParams) => { function getDocumentContext( documentUri: string, - workspaceFolders: WorkspaceFolder[] + workspaceFolders: WorkspaceFolder[], ): DocumentContext { function getRootFolder(): string | undefined { for (let folder of workspaceFolders) { @@ -131,7 +131,7 @@ async function withDocumentAndSettings( callback: (result: { document: TextDocument settings: LanguageSettings | undefined - }) => T | Promise + }) => T | Promise, ): Promise { let document = documents.get(uri) if (!document) { @@ -150,7 +150,7 @@ connection.onCompletion(async ({ textDocument, position }, _token) => position, stylesheets.get(document), getDocumentContext(document.uri, workspaceFolders), - settings?.completion + settings?.completion, ) return { isIncomplete: result.isIncomplete, @@ -182,43 +182,43 @@ connection.onCompletion(async ({ textDocument, position }, _token) => return item }), } - }) + }), ) connection.onHover(({ textDocument, position }, _token) => withDocumentAndSettings(textDocument.uri, ({ document, settings }) => - cssLanguageService.doHover(document, position, stylesheets.get(document), settings?.hover) - ) + cssLanguageService.doHover(document, position, stylesheets.get(document), settings?.hover), + ), ) connection.onFoldingRanges(({ textDocument }, _token) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.getFoldingRanges(document, { rangeLimit: foldingRangeLimit }) - ) + cssLanguageService.getFoldingRanges(document, { rangeLimit: foldingRangeLimit }), + ), ) connection.onDocumentColor(({ textDocument }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.findDocumentColors(document, stylesheets.get(document)) - ) + cssLanguageService.findDocumentColors(document, stylesheets.get(document)), + ), ) connection.onColorPresentation(({ textDocument, color, range }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.getColorPresentations(document, stylesheets.get(document), color, range) - ) + cssLanguageService.getColorPresentations(document, stylesheets.get(document), color, range), + ), ) connection.onDefinition(({ textDocument, position }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.findDefinition(document, position, stylesheets.get(document)) - ) + cssLanguageService.findDefinition(document, position, stylesheets.get(document)), + ), ) connection.onDocumentHighlight(({ textDocument, position }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.findDocumentHighlights(document, position, stylesheets.get(document)) - ) + cssLanguageService.findDocumentHighlights(document, position, stylesheets.get(document)), + ), ) connection.onDocumentSymbol(({ textDocument }) => @@ -233,26 +233,26 @@ connection.onDocumentSymbol(({ textDocument }) => } } return symbol - }) - ) + }), + ), ) connection.onSelectionRanges(({ textDocument, positions }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.getSelectionRanges(document, positions, stylesheets.get(document)) - ) + cssLanguageService.getSelectionRanges(document, positions, stylesheets.get(document)), + ), ) connection.onReferences(({ textDocument, position }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.findReferences(document, position, stylesheets.get(document)) - ) + cssLanguageService.findReferences(document, position, stylesheets.get(document)), + ), ) connection.onCodeAction(({ textDocument, range, context }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.doCodeActions2(document, range, context, stylesheets.get(document)) - ) + cssLanguageService.doCodeActions2(document, range, context, stylesheets.get(document)), + ), ) connection.onDocumentLinks(({ textDocument }) => @@ -260,15 +260,15 @@ connection.onDocumentLinks(({ textDocument }) => cssLanguageService.findDocumentLinks2( document, stylesheets.get(document), - getDocumentContext(document.uri, workspaceFolders) - ) - ) + getDocumentContext(document.uri, workspaceFolders), + ), + ), ) connection.onRenameRequest(({ textDocument, position, newName }) => withDocumentAndSettings(textDocument.uri, ({ document }) => - cssLanguageService.doRename(document, position, newName, stylesheets.get(document)) - ) + cssLanguageService.doRename(document, position, newName, stylesheets.get(document)), + ), ) let documentSettings: { [key: string]: Thenable } = {} @@ -340,7 +340,7 @@ function replace(delta = 0) { let lines = p1.split('\n') if (lines.length > 1) { return `@media(${MEDIA_MARKER})${'\n'.repeat(lines.length - 1)}${' '.repeat( - lines[lines.length - 1].length + lines[lines.length - 1].length, )}{` } return `@media(${MEDIA_MARKER})${' '.repeat(p1.length + delta)}{` @@ -360,9 +360,9 @@ function createVirtualCssDocument(textDocument: TextDocument): TextDocument { .replace(/@layer(\s+[^{]{2,}){/g, replace(-3)) .replace( /@media(\s+screen\s*\([^)]+\))/g, - (_match, screen) => `@media (${MEDIA_MARKER})${' '.repeat(screen.length - 4)}` + (_match, screen) => `@media (${MEDIA_MARKER})${' '.repeat(screen.length - 4)}`, ) - .replace(/(?<=\b(?:theme|config)\([^)]*)[.[\]]/g, '_') + .replace(/(?<=\b(?:theme|config)\([^)]*)[.[\]]/g, '_'), ) } diff --git a/packages/tailwindcss-language-server/src/language/languageModelCache.ts b/packages/tailwindcss-language-server/src/language/languageModelCache.ts index 6e910136..ba6456c4 100644 --- a/packages/tailwindcss-language-server/src/language/languageModelCache.ts +++ b/packages/tailwindcss-language-server/src/language/languageModelCache.ts @@ -14,7 +14,7 @@ export interface LanguageModelCache { export function getLanguageModelCache( maxEntries: number, cleanupIntervalTimeInSec: number, - parse: (document: TextDocument) => T + parse: (document: TextDocument) => T, ): LanguageModelCache { let languageModels: { [uri: string]: { version: number; languageId: string; cTime: number; languageModel: T } diff --git a/packages/tailwindcss-language-server/src/lib/hook.ts b/packages/tailwindcss-language-server/src/lib/hook.ts index 3b1bcf05..9f7a3f96 100644 --- a/packages/tailwindcss-language-server/src/lib/hook.ts +++ b/packages/tailwindcss-language-server/src/lib/hook.ts @@ -25,7 +25,7 @@ export default class Hook { if (typeof Module._resolveFilename !== 'function') { throw new Error( // @ts-ignore - `Error: Expected Module._resolveFilename to be a function (was: ${typeof Module._resolveFilename}) - aborting!` + `Error: Expected Module._resolveFilename to be a function (was: ${typeof Module._resolveFilename}) - aborting!`, ) } diff --git a/packages/tailwindcss-language-server/src/lib/preflight.ts b/packages/tailwindcss-language-server/src/lib/preflight.ts index 8320550a..142ccca2 100644 --- a/packages/tailwindcss-language-server/src/lib/preflight.ts +++ b/packages/tailwindcss-language-server/src/lib/preflight.ts @@ -364,4 +364,4 @@ Ensure the default browser behavior of the \`hidden\` attribute. [hidden] { display: none; -}` \ No newline at end of file +}` diff --git a/packages/tailwindcss-language-server/src/project-locator.test.ts b/packages/tailwindcss-language-server/src/project-locator.test.ts index 40761b18..5819f086 100644 --- a/packages/tailwindcss-language-server/src/project-locator.test.ts +++ b/packages/tailwindcss-language-server/src/project-locator.test.ts @@ -57,7 +57,6 @@ testFixture('multi-config-content', [ { config: 'tailwind.config.two.js' }, ]) - testFixture('v3/esm-config', [ // { config: 'tailwind.config.mjs' }, @@ -68,7 +67,6 @@ testFixture('v3/ts-config', [ { config: 'tailwind.config.ts' }, ]) - testFixture('v4/basic', [ // { config: 'app.css' }, diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index b576a248..fcd091d0 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -18,7 +18,7 @@ new Function( } return oldReadFileSync(filename, ...args) } - ` + `, )(require, __dirname) const connection = diff --git a/packages/tailwindcss-language-server/src/tw.ts b/packages/tailwindcss-language-server/src/tw.ts index 74f4bb22..27bb3f41 100644 --- a/packages/tailwindcss-language-server/src/tw.ts +++ b/packages/tailwindcss-language-server/src/tw.ts @@ -177,7 +177,7 @@ export class TW { isDefaultVersion: false, }, } - } + }, ) } else { console.log("Searching for Tailwind CSS projects in the workspace's folders.") @@ -224,7 +224,7 @@ export class TW { console.log(`[Global] Creating projects: ${JSON.stringify(workspaceDescription)}`) const onDidChangeWatchedFiles = async ( - changes: Array<{ file: string; type: FileChangeType }> + changes: Array<{ file: string; type: FileChangeType }>, ): Promise => { let needsRestart = false let needsSoftRestart = false @@ -243,10 +243,12 @@ export class TW { for (let [, project] of this.projects) { let twVersion = require('tailwindcss/package.json').version try { - let v = require(resolveFrom( - path.dirname(project.projectConfig.configPath), - 'tailwindcss/package.json' - )).version + let v = require( + resolveFrom( + path.dirname(project.projectConfig.configPath), + 'tailwindcss/package.json', + ), + ).version if (typeof v === 'string') { twVersion = v } @@ -338,11 +340,11 @@ export class TW { .filter( (change, changeIndex, changes) => changes.findIndex((c) => c.file === change.file && c.type === change.type) === - changeIndex + changeIndex, ) await onDidChangeWatchedFiles(normalizedChanges) - }) + }), ) let disposable = await this.connection.client.register( @@ -353,7 +355,7 @@ export class TW { { globPattern: `**/${PACKAGE_LOCK_GLOB}` }, { globPattern: `**/${CSS_GLOB}` }, ], - } + }, ) this.disposables.push(disposable) @@ -382,14 +384,14 @@ export class TW { base, (err, events) => { onDidChangeWatchedFiles( - events.map((event) => ({ file: event.path, type: typeMap[event.type] })) + events.map((event) => ({ file: event.path, type: typeMap[event.type] })), ) }, { ignore: ignore.map((ignorePattern) => - path.resolve(base, ignorePattern.replace(/^[*/]+/, '').replace(/[*/]+$/, '')) + path.resolve(base, ignorePattern.replace(/^[*/]+/, '').replace(/[*/]+$/, '')), ), - } + }, ) this.disposables.push({ @@ -410,7 +412,7 @@ export class TW { stabilityThreshold: 100, pollInterval: 20, }, - } + }, ) await new Promise((resolve) => { @@ -421,17 +423,17 @@ export class TW { .on('add', (file) => onDidChangeWatchedFiles([ { file: path.resolve(base, file), type: FileChangeType.Created }, - ]) + ]), ) .on('change', (file) => onDidChangeWatchedFiles([ { file: path.resolve(base, file), type: FileChangeType.Changed }, - ]) + ]), ) .on('unlink', (file) => onDidChangeWatchedFiles([ { file: path.resolve(base, file), type: FileChangeType.Deleted }, - ]) + ]), ) this.disposables.push({ @@ -455,9 +457,9 @@ export class TW { projectConfig, this.initializeParams, this.watchPatterns, - configTailwindVersionMap.get(projectConfig.configPath) - ) - ) + configTailwindVersionMap.get(projectConfig.configPath), + ), + ), ) // init projects for documents that are _already_ open @@ -487,19 +489,19 @@ export class TW { for (let [, project] of this.projects) { project.onUpdateSettings(settings) } - }) + }), ) this.disposables.push( this.connection.onShutdown(() => { this.dispose() - }) + }), ) this.disposables.push( this.documentService.onDidChangeContent((change) => { this.getProject(change.document)?.provideDiagnostics(change.document) - }) + }), ) this.disposables.push( @@ -509,7 +511,7 @@ export class TW { project.enable() project.tryInit() } - }) + }), ) } @@ -523,7 +525,7 @@ export class TW { projectConfig: ProjectConfig, params: InitializeParams, watchPatterns: (patterns: string[]) => void, - tailwindVersion: string + tailwindVersion: string, ): Promise { let key = String(this.projectCounter++) const project = await createProjectService( @@ -546,7 +548,7 @@ export class TW { () => this.refreshDiagnostics(), (patterns: string[]) => watchPatterns(patterns), tailwindVersion, - this.settingsCache.get + this.settingsCache.get, ) this.projects.set(key, project) @@ -593,11 +595,11 @@ export class TW { private onRequest( method: '@/tailwindCSS/sortSelection', - params: { uri: string; classLists: string[] } + params: { uri: string; classLists: string[] }, ): { error: string } | { classLists: string[] } private onRequest( method: '@/tailwindCSS/getProject', - params: { uri: string } + params: { uri: string }, ): { version: string } | null private onRequest(method: string, params: any): any { if (method === '@/tailwindCSS/sortSelection') { diff --git a/packages/tailwindcss-language-server/src/util/error.ts b/packages/tailwindcss-language-server/src/util/error.ts index 00fdac25..664422e4 100644 --- a/packages/tailwindcss-language-server/src/util/error.ts +++ b/packages/tailwindcss-language-server/src/util/error.ts @@ -22,7 +22,7 @@ export function formatError(message: string, err: any, includeStack: boolean = t export function showError( connection: Connection, err: any, - message: string = 'Tailwind CSS' + message: string = 'Tailwind CSS', ): void { console.error(formatError(message, err)) // if (!(err instanceof SilentError)) { diff --git a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts index 103a9937..fe14c2b7 100644 --- a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts +++ b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts @@ -43,12 +43,12 @@ function* _getModuleDependencies( filename: string, base: string, seen: Set, - ext = path.extname(filename) + ext = path.extname(filename), ): Generator { // Try to find the file let absoluteFile = resolveWithExtension( path.resolve(base, filename), - jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder + jsExtensions.includes(ext) ? jsResolutionOrder : tsResolutionOrder, ) if (absoluteFile === null) return // File doesn't exist @@ -80,7 +80,7 @@ function* _getModuleDependencies( export function getModuleDependencies(absoluteFilePath: string): string[] { return Array.from( - _getModuleDependencies(absoluteFilePath, path.dirname(absoluteFilePath), new Set()) + _getModuleDependencies(absoluteFilePath, path.dirname(absoluteFilePath), new Set()), ) .filter((file) => file !== absoluteFilePath) .map((file) => normalizePath(file)) diff --git a/packages/tailwindcss-language-server/src/util/isExcluded.ts b/packages/tailwindcss-language-server/src/util/isExcluded.ts index 7ae954df..f0ec9f49 100644 --- a/packages/tailwindcss-language-server/src/util/isExcluded.ts +++ b/packages/tailwindcss-language-server/src/util/isExcluded.ts @@ -7,7 +7,7 @@ import { getFileFsPath } from './uri' export default async function isExcluded( state: State, document: TextDocument, - file: string = getFileFsPath(document.uri) + file: string = getFileFsPath(document.uri), ): Promise { let settings = await state.editor.getConfiguration(document.uri) diff --git a/packages/tailwindcss-language-server/src/util/resolveFrom.ts b/packages/tailwindcss-language-server/src/util/resolveFrom.ts index 37565df9..50c2cfd0 100644 --- a/packages/tailwindcss-language-server/src/util/resolveFrom.ts +++ b/packages/tailwindcss-language-server/src/util/resolveFrom.ts @@ -1,5 +1,10 @@ import * as fs from 'fs' -import { CachedInputFileSystem, ResolverFactory, Resolver, ResolveOptions } from 'enhanced-resolve-301' +import { + CachedInputFileSystem, + ResolverFactory, + Resolver, + ResolveOptions, +} from 'enhanced-resolve-301' import { equal } from 'tailwindcss-language-service/src/util/array' let pnpApi: any diff --git a/packages/tailwindcss-language-server/src/util/v4/design-system.ts b/packages/tailwindcss-language-server/src/util/v4/design-system.ts index f901b644..a2df627c 100644 --- a/packages/tailwindcss-language-server/src/util/v4/design-system.ts +++ b/packages/tailwindcss-language-server/src/util/v4/design-system.ts @@ -47,7 +47,7 @@ export async function loadDesignSystem( return tailwindcss.optimizeCss(css) }, - compile(classes: string[]): postcss.Root[] { + compile(classes: string[]): (postcss.Root | null)[] { let css = design.candidatesToCss(classes) // Downlevel syntax diff --git a/packages/tailwindcss-language-server/src/watcher/index.js b/packages/tailwindcss-language-server/src/watcher/index.js index 4e356b7f..ecf582e6 100644 --- a/packages/tailwindcss-language-server/src/watcher/index.js +++ b/packages/tailwindcss-language-server/src/watcher/index.js @@ -43,7 +43,7 @@ exports.writeSnapshot = (dir, snapshot, opts) => { return getBinding().writeSnapshot( path.resolve(dir), path.resolve(snapshot), - normalizeOptions(dir, opts) + normalizeOptions(dir, opts), ) } @@ -51,7 +51,7 @@ exports.getEventsSince = (dir, snapshot, opts) => { return getBinding().getEventsSince( path.resolve(dir), path.resolve(snapshot), - normalizeOptions(dir, opts) + normalizeOptions(dir, opts), ) } diff --git a/packages/tailwindcss-language-server/tests/completions/completions.test.js b/packages/tailwindcss-language-server/tests/completions/completions.test.js index 0429d396..d31b0af5 100644 --- a/packages/tailwindcss-language-server/tests/completions/completions.test.js +++ b/packages/tailwindcss-language-server/tests/completions/completions.test.js @@ -298,7 +298,7 @@ withFixture('overrides-variants', (c) => { }) expect(result.items.filter((item) => item.label.endsWith('custom-hover:')).length).toBe(1) - } + }, ) }) diff --git a/packages/tailwindcss-language-server/tests/fixtures/v3/ts-config/tailwind.config.ts b/packages/tailwindcss-language-server/tests/fixtures/v3/ts-config/tailwind.config.ts index 21a1d550..12077ba3 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v3/ts-config/tailwind.config.ts +++ b/packages/tailwindcss-language-server/tests/fixtures/v3/ts-config/tailwind.config.ts @@ -1,7 +1,7 @@ export default { theme: { - colors: { cool: 'blue' } - } + colors: { cool: 'blue' }, + }, } satisfies { theme: Record } diff --git a/packages/tailwindcss-language-server/tests/hover/hover.test.js b/packages/tailwindcss-language-server/tests/hover/hover.test.js index 7775b9de..544ea1e3 100644 --- a/packages/tailwindcss-language-server/tests/hover/hover.test.js +++ b/packages/tailwindcss-language-server/tests/hover/hover.test.js @@ -19,7 +19,7 @@ withFixture('basic', (c) => { }, range: expectedRange, } - : expected + : expected, ) }) } @@ -95,7 +95,7 @@ withFixture('v4/basic', (c) => { }, range: expectedRange, } - : expected + : expected, ) }) } diff --git a/packages/tailwindcss-language-server/tsconfig.json b/packages/tailwindcss-language-server/tsconfig.json index 5bdc89a7..5e2a7c8c 100755 --- a/packages/tailwindcss-language-server/tsconfig.json +++ b/packages/tailwindcss-language-server/tsconfig.json @@ -1,18 +1,18 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": ["ES2022"], - "rootDir": "..", - "sourceMap": true, - "moduleResolution": "node", - "esModuleInterop": true, - "allowJs": true, - "resolveJsonModule": true, - "baseUrl": "..", - "paths": { - "@tailwindcss/language-service/*": ["../packages/tailwindcss-language-service/*"] - } - }, - "include": ["src", "../packages/tailwindcss-language-service", "../../types"] -} +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["ES2022"], + "rootDir": "..", + "sourceMap": true, + "moduleResolution": "node", + "esModuleInterop": true, + "allowJs": true, + "resolveJsonModule": true, + "baseUrl": "..", + "paths": { + "@tailwindcss/language-service/*": ["../packages/tailwindcss-language-service/*"] + } + }, + "include": ["src", "../packages/tailwindcss-language-service", "../../types"] +} diff --git a/packages/tailwindcss-language-service/scripts/build.mjs b/packages/tailwindcss-language-service/scripts/build.mjs index 74c9f3af..913debc3 100644 --- a/packages/tailwindcss-language-service/scripts/build.mjs +++ b/packages/tailwindcss-language-service/scripts/build.mjs @@ -33,7 +33,7 @@ let build = await esbuild.context({ ['--emitDeclarationOnly', '--outDir', path.resolve(__dirname, '../dist')], { stdio: 'inherit', - } + }, ) }) }, diff --git a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts index e59e21de..31b5dc5c 100644 --- a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts +++ b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts @@ -23,7 +23,7 @@ async function getDiagnosticsFromCodeActionParams( state: State, params: CodeActionParams, document: TextDocument, - only?: DiagnosticKind[] + only?: DiagnosticKind[], ): Promise { if (!document) return [] let diagnostics = await doValidate(state, document, only) @@ -41,7 +41,11 @@ async function getDiagnosticsFromCodeActionParams( .filter(Boolean) } -export async function doCodeActions(state: State, params: CodeActionParams, document: TextDocument): Promise { +export async function doCodeActions( + state: State, + params: CodeActionParams, + document: TextDocument, +): Promise { if (!state.enabled) { return [] } @@ -52,7 +56,7 @@ export async function doCodeActions(state: State, params: CodeActionParams, docu document, params.context.diagnostics .map((diagnostic) => diagnostic.code) - .filter(Boolean) as DiagnosticKind[] + .filter(Boolean) as DiagnosticKind[], ) return Promise.all( @@ -76,7 +80,7 @@ export async function doCodeActions(state: State, params: CodeActionParams, docu } return [] - }) + }), ) .then(flatten) .then((x) => dedupeBy(x, (item) => JSON.stringify(item.edit))) diff --git a/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts index 41f5f7eb..7a17a4fc 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts @@ -1,8 +1,5 @@ import { State } from '../util/state' -import type { - CodeActionParams, - CodeAction, -} from 'vscode-languageserver' +import type { CodeActionParams, CodeAction } from 'vscode-languageserver' import { CssConflictDiagnostic } from '../diagnostics/types' import { joinWithAnd } from '../util/joinWithAnd' import { removeRangesFromString } from '../util/removeRangesFromString' @@ -10,14 +7,12 @@ import { removeRangesFromString } from '../util/removeRangesFromString' export async function provideCssConflictCodeActions( _state: State, params: CodeActionParams, - diagnostic: CssConflictDiagnostic + diagnostic: CssConflictDiagnostic, ): Promise { return [ { title: `Delete ${joinWithAnd( - diagnostic.otherClassNames.map( - (otherClassName) => `'${otherClassName.className}'` - ) + diagnostic.otherClassNames.map((otherClassName) => `'${otherClassName.className}'`), )}`, kind: 'quickfix', // CodeActionKind.QuickFix, diagnostics: [diagnostic], @@ -28,9 +23,7 @@ export async function provideCssConflictCodeActions( range: diagnostic.className.classList.range, newText: removeRangesFromString( diagnostic.className.classList.classList, - diagnostic.otherClassNames.map( - (otherClassName) => otherClassName.relativeRange - ) + diagnostic.otherClassNames.map((otherClassName) => otherClassName.relativeRange), ), }, ], diff --git a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts index d4da3c1b..57e660f5 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts @@ -23,7 +23,7 @@ import { TextDocument } from 'vscode-languageserver-textdocument' export async function provideInvalidApplyCodeActions( state: State, document: TextDocument, - diagnostic: InvalidApplyDiagnostic + diagnostic: InvalidApplyDiagnostic, ): Promise { if (!document) return [] let documentText = getTextWithoutComments(document, 'css') @@ -74,7 +74,7 @@ export async function provideInvalidApplyCodeActions( state, classNameParts, rule.selector, - diagnostic.className.classList.important + diagnostic.className.classList.important, ) if (!ast) return false @@ -90,7 +90,7 @@ export async function provideInvalidApplyCodeActions( range: diagnostic.className.classList.range, newText: removeRangesFromString( diagnostic.className.classList.classList, - diagnostic.className.relativeRange + diagnostic.className.relativeRange, ), }) } @@ -168,7 +168,7 @@ function classNameToAst( state: State, classNameParts: string[], selector: string, - important: boolean = false + important: boolean = false, ) { const baseClassName = classNameParts[classNameParts.length - 1] const validatedBaseClassName = validateApply(state, [baseClassName]) diff --git a/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts index e65e4ee6..09e56ef7 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts @@ -16,7 +16,7 @@ export function provideSuggestionCodeActions( | InvalidTailwindDirectiveDiagnostic | InvalidScreenDiagnostic | InvalidVariantDiagnostic - | RecommendedVariantOrderDiagnostic + | RecommendedVariantOrderDiagnostic, ): CodeAction[] { return diagnostic.suggestions.map((suggestion) => ({ title: `Replace with '${suggestion}'`, diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index be70686e..ecf01deb 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -53,7 +53,7 @@ export function completionsFromClassList( classListRange: Range, rootFontSize: number, filter?: (item: CompletionItem) => boolean, - context?: CompletionContext + context?: CompletionContext, ): CompletionList { let classNames = classList.split(/[\s+]/) const partialClassName = classNames[classNames.length - 1] @@ -94,7 +94,7 @@ export function completionsFromClassList( isIncomplete: false, items: modifiers.map((modifier, index) => { let className = `${beforeSlash}/${modifier}` - let kind:CompletionItemKind = CompletionItemKind.Constant + let kind: CompletionItemKind = CompletionItemKind.Constant let documentation: string | undefined const color = getColor(state, className) @@ -117,7 +117,7 @@ export function completionsFromClassList( range: replacementRange, data: state.completionItemData, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } } @@ -135,7 +135,7 @@ export function completionsFromClassList( let variantOrder = 0 function variantItem( - item: Omit + item: Omit, ): CompletionItem { return { kind: 9, @@ -177,7 +177,7 @@ export function completionsFromClassList( // command: 'tailwindCSS.onInsertArbitraryVariantSnippet', // arguments: [variant.name, replacementRange], // }, - }) + }), ) } else { let shouldSortVariants = !semver.gte(state.version, '2.99.0') @@ -186,7 +186,7 @@ export function completionsFromClassList( if (shouldSortVariants) { let allVariants = state.variants.map(({ name }) => name) resultingVariants = resultingVariants.sort( - (a, b) => allVariants.indexOf(b) - allVariants.indexOf(a) + (a, b) => allVariants.indexOf(b) - allVariants.indexOf(a), ) } @@ -196,14 +196,12 @@ export function completionsFromClassList( selectors = variant.selectors() } catch (err) { // If the selectors function fails we don't want to crash the whole completion process - console.log( - "Error while trying to get selectors for variant", - ) + console.log('Error while trying to get selectors for variant') console.log( util.format({ variant, err, - }) + }), ) } @@ -237,7 +235,7 @@ export function completionsFromClassList( }, ] : [], - }) + }), ) } @@ -258,14 +256,12 @@ export function completionsFromClassList( selectors = variant.selectors({ value }) } catch (err) { // If the selectors function fails we don't want to crash the whole completion process - console.log( - "Error while trying to get selectors for variant", - ) + console.log('Error while trying to get selectors for variant') console.log( util.format({ variant, err, - }) + }), ) } @@ -280,7 +276,7 @@ export function completionsFromClassList( ? `${variant.name}${sep}` : `${variant.name}${variant.hasDash ? '-' : ''}${value}${sep}`, detail: selectors.join(', '), - }) + }), ) } } @@ -309,7 +305,7 @@ export function completionsFromClassList( }) return items - }, [] as CompletionItem[]) + }, [] as CompletionItem[]), ), }, { @@ -320,7 +316,7 @@ export function completionsFromClassList( }, range: replacementRange, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } @@ -340,7 +336,7 @@ export function completionsFromClassList( if (state.classListContainsMetadata) { let baseClassName = beforeSlash.slice(offset) modifiers = state.classList.find( - (cls) => Array.isArray(cls) && cls[0] === baseClassName + (cls) => Array.isArray(cls) && cls[0] === baseClassName, )?.[1]?.modifiers } else { let testClass = beforeSlash + '/[0]' @@ -360,7 +356,7 @@ export function completionsFromClassList( isIncomplete: false, items: modifiers.map((modifier, index) => { let className = `${beforeSlash}/${modifier}` - let kind:CompletionItemKind = CompletionItemKind.Constant + let kind: CompletionItemKind = CompletionItemKind.Constant let documentation: string | undefined const color = getColor(state, className) @@ -383,7 +379,7 @@ export function completionsFromClassList( range: replacementRange, data: state.completionItemData, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } } @@ -402,7 +398,7 @@ export function completionsFromClassList( let variantOrder = 0 function variantItem( - item: Omit + item: Omit, ): CompletionItem { return { kind: 9, @@ -444,7 +440,7 @@ export function completionsFromClassList( // command: 'tailwindCSS.onInsertArbitraryVariantSnippet', // arguments: [variant.name, replacementRange], // }, - }) + }), ) } else { let shouldSortVariants = !semver.gte(state.version, '2.99.0') @@ -453,7 +449,7 @@ export function completionsFromClassList( if (shouldSortVariants) { let allVariants = state.variants.map(({ name }) => name) resultingVariants = resultingVariants.sort( - (a, b) => allVariants.indexOf(b) - allVariants.indexOf(a) + (a, b) => allVariants.indexOf(b) - allVariants.indexOf(a), ) } @@ -484,7 +480,7 @@ export function completionsFromClassList( }, ] : [], - }) + }), ) } @@ -506,7 +502,7 @@ export function completionsFromClassList( ? `${variant.name}${sep}` : `${variant.name}${variant.hasDash ? '-' : ''}${value}${sep}`, detail: variant.selectors({ value }).join(', '), - }) + }), ) } } @@ -524,7 +520,7 @@ export function completionsFromClassList( return items } - let kind = color ? CompletionItemKind.Color : CompletionItemKind.Constant + let kind = color ? CompletionItemKind.Color : CompletionItemKind.Constant let documentation: string | undefined if (color && typeof color !== 'string') { @@ -539,7 +535,7 @@ export function completionsFromClassList( }) return items - }, [] as CompletionItem[]) + }, [] as CompletionItem[]), ), }, { @@ -550,7 +546,7 @@ export function completionsFromClassList( }, range: replacementRange, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } @@ -568,7 +564,7 @@ export function completionsFromClassList( return item.__info && isUtil(item) }) .map((className, index, classNames) => { - let kind: CompletionItemKind =CompletionItemKind.Constant + let kind: CompletionItemKind = CompletionItemKind.Constant let documentation: string | undefined const color = getColor(state, className) @@ -585,7 +581,7 @@ export function completionsFromClassList( ...(documentation ? { documentation } : {}), sortText: naturalExpand(index, classNames.length), } as CompletionItem - }) + }), ) .filter((item) => { if (item === null) { @@ -605,7 +601,7 @@ export function completionsFromClassList( ...(important ? { important } : {}), }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } @@ -651,15 +647,15 @@ export function completionsFromClassList( .concat( Object.keys(isSubset ? subset : state.classNames.classNames) .filter((className) => - dlv(state.classNames.classNames, [...subsetKey, className, '__info']) + dlv(state.classNames.classNames, [...subsetKey, className, '__info']), ) .map((className, index, classNames) => { - let kind: CompletionItemKind =CompletionItemKind.Constant + let kind: CompletionItemKind = CompletionItemKind.Constant let documentation: string | undefined const color = getColor(state, className) if (color !== null) { - kind = CompletionItemKind.Color + kind = CompletionItemKind.Color if (typeof color !== 'string' && (color.alpha ?? 1) !== 0) { documentation = formatColor(color) } @@ -671,7 +667,7 @@ export function completionsFromClassList( ...(documentation ? { documentation } : {}), sortText: naturalExpand(index, classNames.length), } - }) + }), ) .filter((item) => { if (item === null) { @@ -690,7 +686,7 @@ export function completionsFromClassList( variants: subsetKey, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } @@ -698,7 +694,7 @@ async function provideClassAttributeCompletions( state: State, document: TextDocument, position: Position, - context?: CompletionContext + context?: CompletionContext, ): Promise { let str = document.getText({ start: document.positionAt(Math.max(0, document.offsetAt(position) - 2000)), @@ -746,7 +742,7 @@ async function provideClassAttributeCompletions( }, settings.rootFontSize, undefined, - context + context, ) } } catch (_) {} @@ -758,7 +754,7 @@ async function provideCustomClassNameCompletions( state: State, document: TextDocument, position: Position, - context?: CompletionContext + context?: CompletionContext, ): Promise { const settings = await state.editor.getConfiguration(document.uri) const filters = settings.tailwindCSS.experimental.classRegex @@ -785,7 +781,7 @@ async function provideCustomClassNameCompletions( }, settings.tailwindCSS.rootFontSize, undefined, - context + context, ) } @@ -796,7 +792,7 @@ function provideThemeVariableCompletions( state: State, document: TextDocument, position: Position, - _context?: CompletionContext + _context?: CompletionContext, ): CompletionList { // Make sure we're in a CSS "context' if (!isCssContext(state, document, position)) return null @@ -865,7 +861,7 @@ function provideThemeVariableCompletions( ...(state.completionItemData ?? {}), }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } @@ -873,7 +869,7 @@ async function provideAtApplyCompletions( state: State, document: TextDocument, position: Position, - context?: CompletionContext + context?: CompletionContext, ): Promise { let settings = (await state.editor.getConfiguration(document.uri)).tailwindCSS let str = document.getText({ @@ -911,7 +907,7 @@ async function provideAtApplyCompletions( let validated = validateApply(state, [...variants, className]) return validated !== null && validated.isApplyable === true }, - context + context, ) } @@ -924,7 +920,7 @@ async function provideClassNameCompletions( state: State, document: TextDocument, position: Position, - context?: CompletionContext + context?: CompletionContext, ): Promise { if (isCssContext(state, document, position)) { return provideAtApplyCompletions(state, document, position, context) @@ -940,7 +936,7 @@ async function provideClassNameCompletions( function provideCssHelperCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1044,7 +1040,7 @@ function provideCssHelperCompletions( label: item, sortText: naturalExpand(index, items.length), commitCharacters: [!item.includes('.') && '.', !item.includes('[') && '['].filter( - Boolean + Boolean, ), kind: color ? 16 : isObject(obj[item]) ? 9 : 10, // VS Code bug causes some values to not display in some cases @@ -1077,14 +1073,14 @@ function provideCssHelperCompletions( _type: 'helper', }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } function provideTailwindDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1107,7 +1103,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `This injects Tailwind’s base styles and any base styles registered by plugins.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, } @@ -1117,7 +1113,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `This injects Tailwind’s base styles, which is a combination of Normalize.css and some additional base styles.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, }, @@ -1127,7 +1123,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `This injects Tailwind’s component classes and any component classes registered by plugins.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, }, @@ -1137,7 +1133,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `This injects Tailwind’s utility classes and any utility classes registered by plugins.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, }, @@ -1148,7 +1144,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use this directive to control where Tailwind injects the utility variants.\n\nThis directive is considered an advanced escape hatch and it is recommended to omit it whenever possible. If omitted, Tailwind will append these classes to the very end of your stylesheet by default.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'just-in-time-mode#variants-are-inserted-at-tailwind-variants' + 'just-in-time-mode#variants-are-inserted-at-tailwind-variants', )})`, }, } @@ -1158,7 +1154,7 @@ function provideTailwindDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use this directive to control where Tailwind injects the responsive variations of each utility.\n\nIf omitted, Tailwind will append these classes to the very end of your stylesheet by default.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, }, @@ -1185,14 +1181,14 @@ function provideTailwindDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } function provideVariantsDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1218,7 +1214,7 @@ function provideVariantsDirectiveCompletions( let possibleVariants = state.variants.flatMap((variant) => { if (variant.values.length) { return variant.values.map((value) => - value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}` + value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}`, ) } return [variant.name] @@ -1255,14 +1251,14 @@ function provideVariantsDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } function provideLayerDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1299,14 +1295,14 @@ function provideLayerDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } function withDefaults( completionList: CompletionList, defaults: Partial<{ data: any; range: Range }>, - supportedDefaults: string[] + supportedDefaults: string[], ): CompletionList { let defaultData = supportedDefaults.includes('data') let defaultRange = supportedDefaults.includes('editRange') @@ -1344,7 +1340,7 @@ function withDefaults( function provideScreenDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1385,14 +1381,14 @@ function provideScreenDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } function provideCssDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): CompletionList { if (!isCssContext(state, document, position)) { return null @@ -1416,7 +1412,7 @@ function provideCssDirectiveCompletions( state.jit && semver.gte(state.version, '2.1.99') ? 'variants' : 'screens' }\` styles into your CSS.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#tailwind' + 'functions-and-directives/#tailwind', )})`, }, }, @@ -1426,7 +1422,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `The \`@screen\` directive allows you to create media queries that reference your breakpoints by name instead of duplicating their values in your own CSS.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#screen' + 'functions-and-directives/#screen', )})`, }, }, @@ -1436,7 +1432,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use \`@apply\` to inline any existing utility classes into your own custom CSS.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#apply' + 'functions-and-directives/#apply', )})`, }, }, @@ -1448,7 +1444,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use the \`@layer\` directive to tell Tailwind which "bucket" a set of custom styles belong to. Valid layers are \`base\`, \`components\`, and \`utilities\`.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#layer' + 'functions-and-directives/#layer', )})`, }, }, @@ -1463,7 +1459,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `You can generate \`responsive\`, \`hover\`, \`focus\`, \`active\`, and other variants of your own utilities by wrapping their definitions in the \`@variants\` directive.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#variants' + 'functions-and-directives/#variants', )})`, }, }, @@ -1473,7 +1469,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `You can generate responsive variants of your own classes by wrapping their definitions in the \`@responsive\` directive.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#responsive' + 'functions-and-directives/#responsive', )})`, }, }, @@ -1486,7 +1482,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use the \`@config\` directive to specify which config file Tailwind should use when compiling that CSS file.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#config' + 'functions-and-directives/#config', )})`, }, }, @@ -1500,7 +1496,7 @@ function provideCssDirectiveCompletions( kind: 'markdown' as typeof MarkupKind.Markdown, value: `Use the \`@theme\` directive to specify which config file Tailwind should use when compiling that CSS file.\n\n[Tailwind CSS Documentation](${docsUrl( state.version, - 'functions-and-directives/#config' + 'functions-and-directives/#config', )})`, }, }, @@ -1529,14 +1525,14 @@ function provideCssDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } async function provideConfigDirectiveCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): Promise { if (!isCssContext(state, document, position)) { return null @@ -1581,14 +1577,14 @@ async function provideConfigDirectiveCompletions( end: position, }, }, - state.editor.capabilities.itemDefaults + state.editor.capabilities.itemDefaults, ) } async function provideEmmetCompletions( state: State, document: TextDocument, - position: Position + position: Position, ): Promise { let settings = await state.editor.getConfiguration(document.uri) if (settings.tailwindCSS.emmetCompletions !== true) return null @@ -1627,7 +1623,7 @@ async function provideEmmetCompletions( symbols.find( (symbol) => abbreviation === symbol.name || - (abbreviation.startsWith(symbol.name + '.') && !/>|\*|\+/.test(abbreviation)) + (abbreviation.startsWith(symbol.name + '.') && !/>|\*|\+/.test(abbreviation)), ) ) { return null @@ -1658,7 +1654,7 @@ async function provideEmmetCompletions( }, end: position, }, - settings.tailwindCSS.rootFontSize + settings.tailwindCSS.rootFontSize, ) } @@ -1666,7 +1662,7 @@ export async function doComplete( state: State, document: TextDocument, position: Position, - context?: CompletionContext + context?: CompletionContext, ) { if (state === null) return { items: [], isIncomplete: false } @@ -1689,11 +1685,11 @@ export async function doComplete( export async function resolveCompletionItem( state: State, - item: CompletionItem + item: CompletionItem, ): Promise { if ( ['helper', 'directive', 'variant', 'layer', '@tailwind', 'filesystem'].includes( - item.data?._type + item.data?._type, ) ) { return item @@ -1727,9 +1723,12 @@ export async function resolveCompletionItem( decls.push(node) }) - item.detail = await jit.stringifyDecls(state, postcss.rule({ - nodes: decls, - })) + item.detail = await jit.stringifyDecls( + state, + postcss.rule({ + nodes: decls, + }), + ) } else { item.detail = `${rules.length} rules` } @@ -1738,7 +1737,11 @@ export async function resolveCompletionItem( if (!item.documentation) { item.documentation = { kind: 'markdown' as typeof MarkupKind.Markdown, - value: ['```css', await jit.stringifyRoot(state, postcss.root({ nodes: rules })), '```'].join('\n'), + value: [ + '```css', + await jit.stringifyRoot(state, postcss.root({ nodes: rules })), + '```', + ].join('\n'), } } @@ -1818,7 +1821,7 @@ function stringifyDecls(obj: any, settings: Settings): string { } return `${prop}: ${value};` }) - .join(' ') + .join(' '), ) .join(' ') } diff --git a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts index c8f993ec..ef53cc5e 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts @@ -20,7 +20,7 @@ export async function doValidate( DiagnosticKind.InvalidConfigPath, DiagnosticKind.InvalidTailwindDirective, DiagnosticKind.RecommendedVariantOrder, - ] + ], ): Promise { const settings = await state.editor.getConfiguration(document.uri) diff --git a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts index d653c9ee..91599e8a 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts @@ -44,7 +44,7 @@ function getRuleProperties(rule: Rule): string[] { export async function getCssConflictDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): Promise { let severity = settings.tailwindCSS.lint.cssConflict if (severity === 'ignore') return [] @@ -70,8 +70,8 @@ export async function getCssConflictDiagnostics( : 2 /* DiagnosticSeverity.Warning */, message: `'${className.className}' applies the same CSS properties as ${joinWithAnd( conflictingClassNames.map( - (conflictingClassName) => `'${conflictingClassName.className}'` - ) + (conflictingClassName) => `'${conflictingClassName.className}'`, + ), )}.`, relatedInformation: conflictingClassNames.map((conflictingClassName) => { return { @@ -93,7 +93,7 @@ export async function getCssConflictDiagnostics( let { rules } = jit.generateRules( state, [className.className], - (rule) => !isKeyframes(rule) + (rule) => !isKeyframes(rule), ) if (rules.length === 0) { return @@ -111,7 +111,7 @@ export async function getCssConflictDiagnostics( let { rules: otherRules } = jit.generateRules( state, [otherClassName.className], - (rule) => !isKeyframes(rule) + (rule) => !isKeyframes(rule), ) if (otherRules.length !== rules.length) { return false @@ -154,8 +154,8 @@ export async function getCssConflictDiagnostics( : 2 /* DiagnosticSeverity.Warning */, message: `'${className.className}' applies the same CSS properties as ${joinWithAnd( conflictingClassNames.map( - (conflictingClassName) => `'${conflictingClassName.className}'` - ) + (conflictingClassName) => `'${conflictingClassName.className}'`, + ), )}.`, relatedInformation: conflictingClassNames.map((conflictingClassName) => { return { @@ -209,7 +209,9 @@ export async function getCssConflictDiagnostics( message: `'${className.className}' applies the same CSS ${ properties.length === 1 ? 'property' : 'properties' } as ${joinWithAnd( - conflictingClassNames.map((conflictingClassName) => `'${conflictingClassName.className}'`) + conflictingClassNames.map( + (conflictingClassName) => `'${conflictingClassName.className}'`, + ), )}.`, relatedInformation: conflictingClassNames.map((conflictingClassName) => { return { @@ -237,7 +239,7 @@ type ClassDetails = Record export function visit( nodes: postcss.AnyNode[], cb: (node: postcss.AnyNode, path: postcss.AnyNode[]) => void, - path: postcss.AnyNode[] = [] + path: postcss.AnyNode[] = [], ) { for (let child of nodes) { path = [...path, child] @@ -293,7 +295,7 @@ function recordClassDetails(state: State, classes: DocumentClassName[]): ClassDe function* findConflicts( classes: DocumentClassName[], - groups: ClassDetails + groups: ClassDetails, ): Iterable<[DocumentClassName, DocumentClassName[]]> { // Compare each class to each other // If they have the same properties and context, they are conflicting and we should report it diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts index 75821cd5..e14a2097 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts @@ -8,7 +8,7 @@ import { validateApply } from '../util/validateApply' export async function getInvalidApplyDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): Promise { let severity = settings.tailwindCSS.lint.invalidApply if (severity === 'ignore') return [] diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts index 27fc4ca1..bc716d3d 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts @@ -20,7 +20,7 @@ function pathToString(path: string | string[]): string { export function validateConfigPath( state: State, path: string | string[], - base: string[] = [] + base: string[] = [], ): { isValid: true; value: any } | { isValid: false; reason: string; suggestions: string[] } { let keys = Array.isArray(path) ? path : stringToPath(path) let value = dlv(state.config, [...base, ...keys]) @@ -28,7 +28,7 @@ export function validateConfigPath( function findAlternativePath(): string[] { let points = combinations('123456789'.substr(0, keys.length - 1)).map((x) => - x.split('').map((x) => parseInt(x, 10)) + x.split('').map((x) => parseInt(x, 10)), ) let possibilities: string[][] = points @@ -56,8 +56,8 @@ export function validateConfigPath( let closestValidKey = closest( keys[keys.length - 1], Object.keys(parentValue).filter( - (key) => validateConfigPath(state, [...parentPath, key]).isValid - ) + (key) => validateConfigPath(state, [...parentPath, key]).isValid, + ), ) if (closestValidKey) { suggestions.push(pathToString([...keys.slice(0, keys.length - 1), closestValidKey])) @@ -95,7 +95,7 @@ export function validateConfigPath( if (isObject(value)) { let validKeys = Object.keys(value).filter( - (key) => validateConfigPath(state, [...keys, key], base).isValid + (key) => validateConfigPath(state, [...keys, key], base).isValid, ) if (validKeys.length) { suggestions.push(...validKeys.map((validKey) => pathToString([...keys, validKey]))) @@ -157,7 +157,7 @@ export function validateConfigPath( export function getInvalidConfigPathDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): InvalidConfigPathDiagnostic[] { let severity = settings.tailwindCSS.lint.invalidConfigPath if (severity === 'ignore') return [] diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts index cb9717ce..e7195419 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts @@ -13,7 +13,7 @@ import { getTextWithoutComments } from '../util/doc' export function getInvalidScreenDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): InvalidScreenDiagnostic[] { let severity = settings.tailwindCSS.lint.invalidScreen if (severity === 'ignore') return [] @@ -53,11 +53,11 @@ export function getInvalidScreenDiagnostics( { start: indexToPosition( text, - match.index + match[0].length - match.groups.screen.length + match.index + match[0].length - match.groups.screen.length, ), end: indexToPosition(text, match.index + match[0].length), }, - range + range, ), severity: severity === 'error' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts index 635d451a..c98f6117 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts @@ -1,5 +1,5 @@ import { State, Settings } from '../util/state' -import type { Range, DiagnosticSeverity } from 'vscode-languageserver' +import type { Range, DiagnosticSeverity } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import { InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types' import { isCssDoc } from '../util/css' @@ -14,7 +14,7 @@ import { isSemicolonlessCssLanguage } from '../util/languages' export function getInvalidTailwindDirectiveDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): InvalidTailwindDirectiveDiagnostic[] { let severity = settings.tailwindCSS.lint.invalidTailwindDirective if (severity === 'ignore') return [] @@ -84,7 +84,7 @@ export function getInvalidTailwindDirectiveDiagnostics( start: indexToPosition(text, match.index + match[0].length - match.groups.value.length), end: indexToPosition(text, match.index + match[0].length), }, - range + range, ), severity: severity === 'error' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts index f4be5183..2291bb44 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts @@ -13,7 +13,7 @@ import { getTextWithoutComments } from '../util/doc' export function getInvalidVariantDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): InvalidVariantDiagnostic[] { let severity = settings.tailwindCSS.lint.invalidVariant if (severity === 'ignore') return [] @@ -36,7 +36,7 @@ export function getInvalidVariantDiagnostics( let possibleVariants = state.variants.flatMap((variant) => { if (variant.values.length) { return variant.values.map((value) => - value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}` + value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}`, ) } return [variant.name] @@ -78,7 +78,7 @@ export function getInvalidVariantDiagnostics( start: indexToPosition(text, variantStartIndex), end: indexToPosition(text, variantStartIndex + variant.length), }, - range + range, ), severity: severity === 'error' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts index 1bde0478..9a547ead 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts @@ -10,7 +10,7 @@ import * as semver from '../util/semver' export async function getRecommendedVariantOrderDiagnostics( state: State, document: TextDocument, - settings: Settings + settings: Settings, ): Promise { if (state.v4) return [] if (!state.jit) return [] diff --git a/packages/tailwindcss-language-service/src/diagnostics/types.ts b/packages/tailwindcss-language-service/src/diagnostics/types.ts index 6f1bc858..45a4aee8 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/types.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/types.ts @@ -18,7 +18,7 @@ export type CssConflictDiagnostic = Diagnostic & { } export function isCssConflictDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is CssConflictDiagnostic { return diagnostic.code === DiagnosticKind.CssConflict } @@ -29,7 +29,7 @@ export type InvalidApplyDiagnostic = Diagnostic & { } export function isInvalidApplyDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is InvalidApplyDiagnostic { return diagnostic.code === DiagnosticKind.InvalidApply } @@ -40,7 +40,7 @@ export type InvalidScreenDiagnostic = Diagnostic & { } export function isInvalidScreenDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is InvalidScreenDiagnostic { return diagnostic.code === DiagnosticKind.InvalidScreen } @@ -51,7 +51,7 @@ export type InvalidVariantDiagnostic = Diagnostic & { } export function isInvalidVariantDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is InvalidVariantDiagnostic { return diagnostic.code === DiagnosticKind.InvalidVariant } @@ -62,7 +62,7 @@ export type InvalidConfigPathDiagnostic = Diagnostic & { } export function isInvalidConfigPathDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is InvalidConfigPathDiagnostic { return diagnostic.code === DiagnosticKind.InvalidConfigPath } @@ -73,7 +73,7 @@ export type InvalidTailwindDirectiveDiagnostic = Diagnostic & { } export function isInvalidTailwindDirectiveDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is InvalidTailwindDirectiveDiagnostic { return diagnostic.code === DiagnosticKind.InvalidTailwindDirective } @@ -84,7 +84,7 @@ export type RecommendedVariantOrderDiagnostic = Diagnostic & { } export function isRecommendedVariantOrderDiagnostic( - diagnostic: AugmentedDiagnostic + diagnostic: AugmentedDiagnostic, ): diagnostic is RecommendedVariantOrderDiagnostic { return diagnostic.code === DiagnosticKind.RecommendedVariantOrder } diff --git a/packages/tailwindcss-language-service/src/documentColorProvider.ts b/packages/tailwindcss-language-service/src/documentColorProvider.ts index da8c90cb..cef0729f 100644 --- a/packages/tailwindcss-language-service/src/documentColorProvider.ts +++ b/packages/tailwindcss-language-service/src/documentColorProvider.ts @@ -13,7 +13,7 @@ import { dedupeByRange } from './util/array' export async function getDocumentColors( state: State, - document: TextDocument + document: TextDocument, ): Promise { let colors: ColorInformation[] = [] if (!state.enabled) return colors diff --git a/packages/tailwindcss-language-service/src/documentLinksProvider.ts b/packages/tailwindcss-language-service/src/documentLinksProvider.ts index cec23435..92b964f9 100644 --- a/packages/tailwindcss-language-service/src/documentLinksProvider.ts +++ b/packages/tailwindcss-language-service/src/documentLinksProvider.ts @@ -11,7 +11,7 @@ import * as semver from './util/semver' export function getDocumentLinks( state: State, document: TextDocument, - resolveTarget: (linkPath: string) => string + resolveTarget: (linkPath: string) => string, ): DocumentLink[] { return getConfigDirectiveLinks(state, document, resolveTarget) } @@ -19,7 +19,7 @@ export function getDocumentLinks( function getConfigDirectiveLinks( state: State, document: TextDocument, - resolveTarget: (linkPath: string) => string + resolveTarget: (linkPath: string) => string, ): DocumentLink[] { if (!semver.gte(state.version, '3.2.0')) { return [] @@ -48,7 +48,7 @@ function getConfigDirectiveLinks( start: indexToPosition(text, match.index + match[0].length - match.groups.path.length), end: indexToPosition(text, match.index + match[0].length), }, - range + range, ), }) } diff --git a/packages/tailwindcss-language-service/src/hoverProvider.ts b/packages/tailwindcss-language-service/src/hoverProvider.ts index d751e64b..786393cc 100644 --- a/packages/tailwindcss-language-service/src/hoverProvider.ts +++ b/packages/tailwindcss-language-service/src/hoverProvider.ts @@ -14,7 +14,7 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' export async function doHover( state: State, document: TextDocument, - position: Position + position: Position, ): Promise { return ( (await provideClassNameHover(state, document, position)) || @@ -37,7 +37,7 @@ function provideCssHelperHover(state: State, document: TextDocument, position: P let validated = validateConfigPath( state, helperFn.path, - helperFn.helper === 'theme' ? ['theme'] : [] + helperFn.helper === 'theme' ? ['theme'] : [], ) let value = validated.isValid ? stringifyConfigValue(validated.value) : null if (value === null) { @@ -56,7 +56,7 @@ function provideCssHelperHover(state: State, document: TextDocument, position: P async function provideClassNameHover( state: State, document: TextDocument, - position: Position + position: Position, ): Promise { let className = await findClassNameAtPosition(state, document, position) if (className === null) return null @@ -108,7 +108,7 @@ async function provideClassNameHover( const css = stringifyCss( className.className, dlv(state.classNames.classNames, [...parts, '__info']), - settings + settings, ) if (!css) return null diff --git a/packages/tailwindcss-language-service/src/util/absoluteRange.ts b/packages/tailwindcss-language-service/src/util/absoluteRange.ts index 0ce385bb..643de4ed 100644 --- a/packages/tailwindcss-language-service/src/util/absoluteRange.ts +++ b/packages/tailwindcss-language-service/src/util/absoluteRange.ts @@ -5,14 +5,11 @@ export function absoluteRange(range: Range, reference?: Range) { start: { line: (reference?.start.line || 0) + range.start.line, character: - (range.end.line === 0 ? reference?.start.character || 0 : 0) + - range.start.character, + (range.end.line === 0 ? reference?.start.character || 0 : 0) + range.start.character, }, end: { line: (reference?.start.line || 0) + range.end.line, - character: - (range.end.line === 0 ? reference?.start.character || 0 : 0) + - range.end.character, + character: (range.end.line === 0 ? reference?.start.character || 0 : 0) + range.end.character, }, } } diff --git a/packages/tailwindcss-language-service/src/util/array.ts b/packages/tailwindcss-language-service/src/util/array.ts index 0c5b5f2e..9c982640 100644 --- a/packages/tailwindcss-language-service/src/util/array.ts +++ b/packages/tailwindcss-language-service/src/util/array.ts @@ -12,7 +12,7 @@ export function dedupeBy(arr: Array, transform: (item: T) => any): Array(arr: Array): Array { return arr.filter( (classList, classListIndex) => - classListIndex === arr.findIndex((c) => rangesEqual(c.range, classList.range)) + classListIndex === arr.findIndex((c) => rangesEqual(c.range, classList.range)), ) } diff --git a/packages/tailwindcss-language-service/src/util/classes.test.ts b/packages/tailwindcss-language-service/src/util/classes.test.ts index 2c7f117c..54962869 100644 --- a/packages/tailwindcss-language-service/src/util/classes.test.ts +++ b/packages/tailwindcss-language-service/src/util/classes.test.ts @@ -2,10 +2,10 @@ import { expect, test } from 'vitest' import { ClassMatch, ClassRegexFilter, customClassesIn } from './classes' interface TestRecord { - name: string, - text: string, - cursor: number | null, - filters: ClassRegexFilter[], + name: string + text: string + cursor: number | null + filters: ClassRegexFilter[] expected: ClassMatch[] } @@ -32,7 +32,7 @@ let table: TestRecord[] = [ text: 'tron ""', cursor: 5, filters: [['test (\\S*)']], - expected: [] + expected: [], }, { @@ -48,7 +48,7 @@ let table: TestRecord[] = [ text: 'nope ""', cursor: 5, filters: [['test (\\S*)'], ['tron (\\S*)']], - expected: [] + expected: [], }, // Container + class regex @@ -65,14 +65,17 @@ let table: TestRecord[] = [ text: 'tron ""', cursor: 6, filters: [['test (\\S*)', '"([^"]*)"']], - expected: [] + expected: [], }, { name: 'nested (multiple, matches: yes)', text: 'tron ""', cursor: 6, - filters: [['test (\\S*)', '"([^"]*)"'], ['tron (\\S*)', '"([^"]*)"']], + filters: [ + ['test (\\S*)', '"([^"]*)"'], + ['tron (\\S*)', '"([^"]*)"'], + ], expected: [{ classList: '', range: [6, 6] }], }, @@ -80,8 +83,11 @@ let table: TestRecord[] = [ name: 'nested (multiple, matches: no)', text: 'nope ""', cursor: 6, - filters: [['test (\\S*)', '"([^"]*)"'], ['tron (\\S*)', '"([^"]*)"']], - expected: [] + filters: [ + ['test (\\S*)', '"([^"]*)"'], + ['tron (\\S*)', '"([^"]*)"'], + ], + expected: [], }, // Cursor position validation @@ -106,7 +112,7 @@ let table: TestRecord[] = [ text: `
`, cursor: 11, filters: [['class="([^"]*)"']], - expected: [] + expected: [], }, { @@ -155,7 +161,10 @@ let table: TestRecord[] = [ text: `
`, cursor: null, filters: [['class="([^"]*)"']], - expected: [{ classList: 'text-', range: [12, 17] }, { classList: 'bg-', range: [34, 37] }], + expected: [ + { classList: 'text-', range: [12, 17] }, + { classList: 'bg-', range: [34, 37] }, + ], }, // Edge cases @@ -188,7 +197,10 @@ let table: TestRecord[] = [ text: `let _ = clsx("")`, cursor: null, filters: [['clsx\\(([^)]*)\\)', '(?<=")([^"]*)(?<=")']], - expected: [{ classList: '', range: [14, 14] }, { classList: '', range: [15, 15] }], + expected: [ + { classList: '', range: [14, 14] }, + { classList: '', range: [15, 15] }, + ], }, { diff --git a/packages/tailwindcss-language-service/src/util/classes.ts b/packages/tailwindcss-language-service/src/util/classes.ts index 0bdbd397..514206b4 100644 --- a/packages/tailwindcss-language-service/src/util/classes.ts +++ b/packages/tailwindcss-language-service/src/util/classes.ts @@ -4,19 +4,17 @@ export interface ClassMatch { range: [start: number, end: number] } -export function *customClassesIn({ +export function* customClassesIn({ text, filters, cursor = null, -} : { - text: string, - filters: ClassRegexFilter[], - cursor?: number | null, +}: { + text: string + filters: ClassRegexFilter[] + cursor?: number | null }): Iterable { for (let filter of filters) { - let [containerPattern, classPattern] = Array.isArray(filter) - ? filter - : [filter] + let [containerPattern, classPattern] = Array.isArray(filter) ? filter : [filter] let containerRegex = new RegExp(containerPattern, 'gd') let classRegex = classPattern ? new RegExp(classPattern, 'gd') : undefined @@ -27,7 +25,7 @@ export function *customClassesIn({ } } -function *matchesIn( +function* matchesIn( text: string, containerRegex: RegExp, classRegex: RegExp | undefined, @@ -48,11 +46,10 @@ function *matchesIn( continue } - if (! classRegex) { + if (!classRegex) { yield { - classList: cursor !== null - ? containerMatch[1].slice(0, cursor - matchStart) - : containerMatch[1], + classList: + cursor !== null ? containerMatch[1].slice(0, cursor - matchStart) : containerMatch[1], range: [matchStart, matchEnd], } continue @@ -75,9 +72,8 @@ function *matchesIn( } yield { - classList: cursor !== null - ? classMatch[1].slice(0, cursor - classMatchStart) - : classMatch[1], + classList: + cursor !== null ? classMatch[1].slice(0, cursor - classMatchStart) : classMatch[1], range: [classMatchStart, classMatchEnd], } } diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts index 87f9183b..d5c1849a 100644 --- a/packages/tailwindcss-language-service/src/util/color.ts +++ b/packages/tailwindcss-language-service/src/util/color.ts @@ -45,9 +45,9 @@ function getKeywordColor(value: unknown): KeywordColor | null { // https://github.com/khalilgharbaoui/coloregex const colorRegex = new RegExp( `(?:^|\\s|\\(|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\(\\s*(-?[\\d.]+%?(\\s*[,/]\\s*|\\s+)+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys( - namedColors + namedColors, ).join('|')})(?:$|\\s|\\)|,)`, - 'gi' + 'gi', ) function replaceColorVarsWithTheirDefaults(str: string): string { @@ -66,7 +66,7 @@ function getColorsInString(str: string): (culori.Color | KeywordColor)[] { } function getColorFromDecls( - decls: Record + decls: Record, ): culori.Color | KeywordColor | null { let props = Object.keys(decls).filter((prop) => { // ignore content: ""; @@ -102,8 +102,8 @@ function getColorFromDecls( // check that all of the values are the same color, ignoring alpha const colorStrings = dedupe( colors.map((color) => - typeof color === 'string' ? color : culori.formatRgb({ ...color, alpha: undefined }) - ) + typeof color === 'string' ? color : culori.formatRgb({ ...color, alpha: undefined }), + ), ) if (colorStrings.length !== 1) { return null @@ -115,7 +115,7 @@ function getColorFromDecls( } const nonKeywordColors = colors.filter( - (color): color is culori.Color => typeof color !== 'string' + (color): color is culori.Color => typeof color !== 'string', ) const alphas = dedupe(nonKeywordColors.map((color) => color.alpha ?? 1)) @@ -231,9 +231,9 @@ export function culoriColorToVscodeColor(color: culori.Color): Color { } export function formatColor(color: culori.Color): string { - if (color.alpha === undefined || color.alpha === 1) { - return culori.formatHex(color) - } + if (color.alpha === undefined || color.alpha === 1) { + return culori.formatHex(color) + } - return culori.formatHex8(color) + return culori.formatHex8(color) } diff --git a/packages/tailwindcss-language-service/src/util/css.ts b/packages/tailwindcss-language-service/src/util/css.ts index c4e76cb3..408fb04b 100644 --- a/packages/tailwindcss-language-service/src/util/css.ts +++ b/packages/tailwindcss-language-service/src/util/css.ts @@ -8,7 +8,7 @@ import { getLanguageBoundaries } from './getLanguageBoundaries' export function isCssDoc(state: State, doc: TextDocument): boolean { const userCssLanguages = Object.keys(state.editor.userLanguages).filter((lang) => - cssLanguages.includes(state.editor.userLanguages[lang]) + cssLanguages.includes(state.editor.userLanguages[lang]), ) return [...cssLanguages, ...userCssLanguages].indexOf(doc.languageId) !== -1 diff --git a/packages/tailwindcss-language-service/src/util/doc.ts b/packages/tailwindcss-language-service/src/util/doc.ts index 1036a653..4975ec46 100644 --- a/packages/tailwindcss-language-service/src/util/doc.ts +++ b/packages/tailwindcss-language-service/src/util/doc.ts @@ -1,17 +1,17 @@ -import type { Range } from 'vscode-languageserver' +import type { Range } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import moo from 'moo' export function getTextWithoutComments( doc: TextDocument, type: 'html' | 'js' | 'jsx' | 'css', - range?: Range + range?: Range, ): string export function getTextWithoutComments(text: string, type: 'html' | 'js' | 'jsx' | 'css'): string export function getTextWithoutComments( docOrText: TextDocument | string, type: 'html' | 'js' | 'jsx' | 'css', - range?: Range + range?: Range, ): string { let text = typeof docOrText === 'string' ? docOrText : docOrText.getText(range) diff --git a/packages/tailwindcss-language-service/src/util/equivalents.ts b/packages/tailwindcss-language-service/src/util/equivalents.ts index d8fb3165..727e77bc 100644 --- a/packages/tailwindcss-language-service/src/util/equivalents.ts +++ b/packages/tailwindcss-language-service/src/util/equivalents.ts @@ -10,17 +10,18 @@ export function addEquivalents(css: string, settings: TailwindCssSettings): stri let plugins: AcceptedPlugin[] = [] if (settings.showPixelEquivalents) { - plugins.push(equivalentPixelValues({ - comments, - rootFontSize: settings.rootFontSize, - })) + plugins.push( + equivalentPixelValues({ + comments, + rootFontSize: settings.rootFontSize, + }), + ) } plugins.push(equivalentColorValues({ comments })) try { - postcss(plugins).process(css, { from: undefined }) - .css + postcss(plugins).process(css, { from: undefined }).css } catch { return css } diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts index 692c6106..ee993940 100644 --- a/packages/tailwindcss-language-service/src/util/find.ts +++ b/packages/tailwindcss-language-service/src/util/find.ts @@ -33,7 +33,7 @@ export function findLast(re: RegExp, str: string): RegExpMatchArray { export function getClassNamesInClassList( { classList, range, important }: DocumentClassList, - blocklist: State['blocklist'] + blocklist: State['blocklist'], ): DocumentClassName[] { const parts = classList.split(/(\s+)/) const names: DocumentClassName[] = [] @@ -75,28 +75,28 @@ export async function findClassNamesInRange( doc: TextDocument, range?: Range, mode?: 'html' | 'css' | 'jsx', - includeCustom: boolean = true + includeCustom: boolean = true, ): Promise { const classLists = await findClassListsInRange(state, doc, range, mode, includeCustom) return flatten( - classLists.map((classList) => getClassNamesInClassList(classList, state.blocklist)) + classLists.map((classList) => getClassNamesInClassList(classList, state.blocklist)), ) } export async function findClassNamesInDocument( state: State, - doc: TextDocument + doc: TextDocument, ): Promise { const classLists = await findClassListsInDocument(state, doc) return flatten( - classLists.map((classList) => getClassNamesInClassList(classList, state.blocklist)) + classLists.map((classList) => getClassNamesInClassList(classList, state.blocklist)), ) } export function findClassListsInCssRange( state: State, doc: TextDocument, - range?: Range + range?: Range, ): DocumentClassList[] { const text = getTextWithoutComments(doc, 'css', range) let regex = isSemicolonlessCssLanguage(doc.languageId, state.editor?.userLanguages) @@ -128,7 +128,7 @@ export function findClassListsInCssRange( async function findCustomClassLists( state: State, doc: TextDocument, - range?: Range + range?: Range, ): Promise { const settings = await state.editor.getConfiguration(doc.uri) const regexes = settings.tailwindCSS.experimental.classRegex @@ -165,13 +165,13 @@ export async function findClassListsInHtmlRange( state: State, doc: TextDocument, type: 'html' | 'js' | 'jsx', - range?: Range + range?: Range, ): Promise { const text = getTextWithoutComments(doc, type, range) const matches = matchClassAttributes( text, - (await state.editor.getConfiguration(doc.uri)).tailwindCSS.classAttributes + (await state.editor.getConfiguration(doc.uri)).tailwindCSS.classAttributes, ) const result: DocumentClassList[] = [] @@ -233,11 +233,11 @@ export async function findClassListsInHtmlRange( const start = indexToPosition( text, - match.index + match[0].length - 1 + offset + beforeOffset + match.index + match[0].length - 1 + offset + beforeOffset, ) const end = indexToPosition( text, - match.index + match[0].length - 1 + offset + value.length + afterOffset + match.index + match[0].length - 1 + offset + value.length + afterOffset, ) return { @@ -254,7 +254,7 @@ export async function findClassListsInHtmlRange( }, } }) - .filter((x) => x !== null) + .filter((x) => x !== null), ) }) @@ -266,7 +266,7 @@ export async function findClassListsInRange( doc: TextDocument, range?: Range, mode?: 'html' | 'css' | 'jsx', - includeCustom: boolean = true + includeCustom: boolean = true, ): Promise { let classLists: DocumentClassList[] = [] if (mode === 'css') { @@ -282,7 +282,7 @@ export async function findClassListsInRange( export async function findClassListsInDocument( state: State, - doc: TextDocument + doc: TextDocument, ): Promise { if (isCssDoc(state, doc)) { return findClassListsInCssRange(state, doc) @@ -297,20 +297,20 @@ export async function findClassListsInDocument( boundaries .filter((b) => b.type === 'html' || b.type === 'jsx') .map(({ type, range }) => - findClassListsInHtmlRange(state, doc, type === 'html' ? 'html' : 'jsx', range) - ) + findClassListsInHtmlRange(state, doc, type === 'html' ? 'html' : 'jsx', range), + ), )), ...boundaries .filter((b) => b.type === 'css') .map(({ range }) => findClassListsInCssRange(state, doc, range)), await findCustomClassLists(state, doc), - ]) + ]), ) } export function findHelperFunctionsInDocument( state: State, - doc: TextDocument + doc: TextDocument, ): DocumentHelperFunction[] { if (isCssDoc(state, doc)) { return findHelperFunctionsInRange(doc) @@ -322,7 +322,7 @@ export function findHelperFunctionsInDocument( return flatten( boundaries .filter((b) => b.type === 'css') - .map(({ range }) => findHelperFunctionsInRange(doc, range)) + .map(({ range }) => findHelperFunctionsInRange(doc, range)), ) } @@ -344,12 +344,12 @@ function getFirstCommaIndex(str: string): number | null { export function findHelperFunctionsInRange( doc: TextDocument, - range?: Range + range?: Range, ): DocumentHelperFunction[] { const text = getTextWithoutComments(doc, 'css', range) let matches = findAll( /(?[\s:;/*(){}])(?config|theme)(?\(\s*)(?[^)]*?)\s*\)/g, - text + text, ) return matches.map((match) => { @@ -384,14 +384,14 @@ export function findHelperFunctionsInRange( start: indexToPosition(text, startIndex), end: indexToPosition(text, startIndex + match.groups.path.length), }, - range + range, ), path: resolveRange( { start: indexToPosition(text, startIndex + quotesBefore.length), end: indexToPosition(text, startIndex + quotesBefore.length + path.length), }, - range + range, ), }, } @@ -406,7 +406,7 @@ export function indexToPosition(str: string, index: number): Position { export async function findClassNameAtPosition( state: State, doc: TextDocument, - position: Position + position: Position, ): Promise { let classNames = [] const positionOffset = doc.offsetAt(position) diff --git a/packages/tailwindcss-language-service/src/util/flagEnabled.ts b/packages/tailwindcss-language-service/src/util/flagEnabled.ts index f7962847..a6747078 100644 --- a/packages/tailwindcss-language-service/src/util/flagEnabled.ts +++ b/packages/tailwindcss-language-service/src/util/flagEnabled.ts @@ -3,17 +3,11 @@ import dlv from 'dlv' export function flagEnabled(state: State, flag: string) { if (state.featureFlags.future.includes(flag)) { - return ( - state.config.future === 'all' || - dlv(state.config, ['future', flag], false) - ) + return state.config.future === 'all' || dlv(state.config, ['future', flag], false) } if (state.featureFlags.experimental.includes(flag)) { - return ( - state.config.experimental === 'all' || - dlv(state.config, ['experimental', flag], false) - ) + return state.config.experimental === 'all' || dlv(state.config, ['experimental', flag], false) } return false diff --git a/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts b/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts index 0bd35860..d0ac9ac1 100644 --- a/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts +++ b/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts @@ -8,15 +8,14 @@ export function getClassNameParts(state: State, className: string): string[] { let parts: string[] = className.split(separator) if (parts.length === 1) { - return dlv(state.classNames.classNames, [className, '__info', '__rule']) === - true || + return dlv(state.classNames.classNames, [className, '__info', '__rule']) === true || Array.isArray(dlv(state.classNames.classNames, [className, '__info'])) ? [className] : null } let points = combinations('123456789'.substr(0, parts.length - 1)).map((x) => - x.split('').map((x) => parseInt(x, 10)) + x.split('').map((x) => parseInt(x, 10)), ) let possibilities: string[][] = [ diff --git a/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts b/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts index 7314f6ef..542ae568 100644 --- a/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts +++ b/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts @@ -5,7 +5,7 @@ import dlv from 'dlv' export function getClassNameDecls( state: State, - className: string + className: string, ): Record | Record[] | null { const parts = getClassNameParts(state, className) if (!parts) return null diff --git a/packages/tailwindcss-language-service/src/util/getClassNameMeta.ts b/packages/tailwindcss-language-service/src/util/getClassNameMeta.ts index 7d4c0581..d862916a 100644 --- a/packages/tailwindcss-language-service/src/util/getClassNameMeta.ts +++ b/packages/tailwindcss-language-service/src/util/getClassNameMeta.ts @@ -4,7 +4,7 @@ import dlv from 'dlv' export function getClassNameMeta( state: State, - classNameOrParts: string | string[] + classNameOrParts: string | string[], ): ClassNameMeta | ClassNameMeta[] { const parts = Array.isArray(classNameOrParts) ? classNameOrParts diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts index 87a4c4b5..1103be45 100644 --- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts +++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts @@ -125,7 +125,7 @@ let cache = new Cache({ max: 25, maxAge: 1000 export function getLanguageBoundaries( state: State, doc: TextDocument, - text: string = doc.getText() + text: string = doc.getText(), ): LanguageBoundary[] | null { let cacheKey = `${doc.languageId}:${text}` @@ -139,10 +139,10 @@ export function getLanguageBoundaries( let defaultType = isVueDoc(doc) ? 'none' : isHtmlDoc(state, doc) || isSvelteDoc(doc) - ? 'html' - : isJs - ? 'jsx' - : null + ? 'html' + : isJs + ? 'jsx' + : null if (defaultType === null) { cache.set(cacheKey, null) diff --git a/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts b/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts index e83e65ab..ab774fba 100644 --- a/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts +++ b/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts @@ -3,12 +3,12 @@ import * as jit from './jit' export function getVariantsFromClassName( state: State, - className: string + className: string, ): { variants: string[]; offset: number } { let allVariants = state.variants.flatMap((variant) => { if (variant.values.length) { return variant.values.map((value) => - value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}` + value === 'DEFAULT' ? variant.name : `${variant.name}${variant.hasDash ? '-' : ''}${value}`, ) } return [variant.name] diff --git a/packages/tailwindcss-language-service/src/util/html.ts b/packages/tailwindcss-language-service/src/util/html.ts index a992f08d..73e92368 100644 --- a/packages/tailwindcss-language-service/src/util/html.ts +++ b/packages/tailwindcss-language-service/src/util/html.ts @@ -6,7 +6,7 @@ import { getLanguageBoundaries } from './getLanguageBoundaries' export function isHtmlDoc(state: State, doc: TextDocument): boolean { const userHtmlLanguages = Object.keys(state.editor.userLanguages).filter((lang) => - htmlLanguages.includes(state.editor.userLanguages[lang]) + htmlLanguages.includes(state.editor.userLanguages[lang]), ) return [...htmlLanguages, ...userHtmlLanguages].indexOf(doc.languageId) !== -1 diff --git a/packages/tailwindcss-language-service/src/util/isValidLocationForEmmetAbbreviation.ts b/packages/tailwindcss-language-service/src/util/isValidLocationForEmmetAbbreviation.ts index 11f17a7c..027f8e6d 100644 --- a/packages/tailwindcss-language-service/src/util/isValidLocationForEmmetAbbreviation.ts +++ b/packages/tailwindcss-language-service/src/util/isValidLocationForEmmetAbbreviation.ts @@ -1,9 +1,9 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' -import type { Range, Position } from 'vscode-languageserver' +import type { Range, Position } from 'vscode-languageserver' export function isValidLocationForEmmetAbbreviation( document: TextDocument, - abbreviationRange: Range + abbreviationRange: Range, ): boolean { const startAngle = '<' const endAngle = '>' diff --git a/packages/tailwindcss-language-service/src/util/isWithinRange.ts b/packages/tailwindcss-language-service/src/util/isWithinRange.ts index fb7f2ff4..eed82216 100644 --- a/packages/tailwindcss-language-service/src/util/isWithinRange.ts +++ b/packages/tailwindcss-language-service/src/util/isWithinRange.ts @@ -1,27 +1,15 @@ import type { Position, Range } from 'vscode-languageserver' export function isWithinRange(position: Position, range: Range): boolean { - if ( - position.line === range.start.line && - position.character >= range.start.character - ) { - if ( - position.line === range.end.line && - position.character > range.end.character - ) { + if (position.line === range.start.line && position.character >= range.start.character) { + if (position.line === range.end.line && position.character > range.end.character) { return false } else { return true } } - if ( - position.line === range.end.line && - position.character <= range.end.character - ) { - if ( - position.line === range.start.line && - position.character < range.end.character - ) { + if (position.line === range.end.line && position.character <= range.end.character) { + if (position.line === range.start.line && position.character < range.end.character) { return false } else { return true diff --git a/packages/tailwindcss-language-service/src/util/jit.ts b/packages/tailwindcss-language-service/src/util/jit.ts index a2134807..0a8dfd69 100644 --- a/packages/tailwindcss-language-service/src/util/jit.ts +++ b/packages/tailwindcss-language-service/src/util/jit.ts @@ -11,7 +11,7 @@ export function bigSign(bigIntValue) { export function generateRules( state: State, classNames: string[], - filter: (rule: Rule) => boolean = () => true + filter: (rule: Rule) => boolean = () => true, ): { root: Root; rules: Rule[] } { let rules: [bigint, Rule][] = state.modules.jit.generateRules .module(new Set(classNames), state.jitContext) @@ -52,7 +52,7 @@ export async function stringifyRoot(state: State, root: Root, uri?: string): Pro return css .replace(/([^;{}\s])(\n\s*})/g, (_match, before, after) => `${before};${after}`) .replace(identPattern, (indent: string) => - ' '.repeat((indent.length / identSize) * settings.editor.tabSize) + ' '.repeat((indent.length / identSize) * settings.editor.tabSize), ) } diff --git a/packages/tailwindcss-language-service/src/util/js.ts b/packages/tailwindcss-language-service/src/util/js.ts index bee7693b..db6c8a0c 100644 --- a/packages/tailwindcss-language-service/src/util/js.ts +++ b/packages/tailwindcss-language-service/src/util/js.ts @@ -6,7 +6,7 @@ import { getLanguageBoundaries } from './getLanguageBoundaries' export function isJsDoc(state: State, doc: TextDocument): boolean { const userJsLanguages = Object.keys(state.editor.userLanguages).filter((lang) => - jsLanguages.includes(state.editor.userLanguages[lang]) + jsLanguages.includes(state.editor.userLanguages[lang]), ) return [...jsLanguages, ...userJsLanguages].indexOf(doc.languageId) !== -1 diff --git a/packages/tailwindcss-language-service/src/util/languages.ts b/packages/tailwindcss-language-service/src/util/languages.ts index 0558bbc6..7a00d1f7 100644 --- a/packages/tailwindcss-language-service/src/util/languages.ts +++ b/packages/tailwindcss-language-service/src/util/languages.ts @@ -66,7 +66,7 @@ const semicolonlessLanguages = ['sass', 'sugarss', 'stylus'] export function isSemicolonlessCssLanguage( languageId: string, - userLanguages: EditorState['userLanguages'] = {} + userLanguages: EditorState['userLanguages'] = {}, ) { return ( semicolonlessLanguages.includes(languageId) || diff --git a/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts b/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts index 1fd86e56..cd45c694 100644 --- a/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts +++ b/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts @@ -82,8 +82,8 @@ export function equivalentPixelValues({ ({ index, value }) => ({ index: index + atRule.source.start.offset + `@media${atRule.raws.afterName}`.length, value, - }) - ) + }), + ), ) }, }, diff --git a/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts b/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts index 928d6886..d5579cb6 100644 --- a/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts +++ b/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts @@ -2,10 +2,7 @@ import { Range } from 'vscode-languageserver' import lineColumn from 'line-column' import { ensureArray } from './array' -export function removeRangesFromString( - str: string, - rangeOrRanges: Range | Range[] -): string { +export function removeRangesFromString(str: string, rangeOrRanges: Range | Range[]): string { let ranges = ensureArray(rangeOrRanges) let finder = lineColumn(str + '\n', { origin: 0 }) let indexRanges: { start: number; end: number }[] = [] diff --git a/packages/tailwindcss-language-service/src/util/resolveRange.ts b/packages/tailwindcss-language-service/src/util/resolveRange.ts index 4f336027..d90fa5b9 100644 --- a/packages/tailwindcss-language-service/src/util/resolveRange.ts +++ b/packages/tailwindcss-language-service/src/util/resolveRange.ts @@ -5,14 +5,12 @@ export function resolveRange(range: Range, relativeTo?: Range) { start: { line: (relativeTo?.start.line || 0) + range.start.line, character: - (range.end.line === 0 ? relativeTo?.start.character || 0 : 0) + - range.start.character, + (range.end.line === 0 ? relativeTo?.start.character || 0 : 0) + range.start.character, }, end: { line: (relativeTo?.start.line || 0) + range.end.line, character: - (range.end.line === 0 ? relativeTo?.start.character || 0 : 0) + - range.end.character, + (range.end.line === 0 ? relativeTo?.start.character || 0 : 0) + range.end.character, }, } } diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 1e793553..5e590972 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -31,7 +31,7 @@ export type EditorState = { getDocumentSymbols: (uri: string) => Promise readDirectory: ( document: TextDocument, - directory: string + directory: string, ) => Promise> } diff --git a/packages/tailwindcss-language-service/src/util/stringToPath.ts b/packages/tailwindcss-language-service/src/util/stringToPath.ts index b06e1532..cfb9e8a2 100644 --- a/packages/tailwindcss-language-service/src/util/stringToPath.ts +++ b/packages/tailwindcss-language-service/src/util/stringToPath.ts @@ -1,5 +1,6 @@ // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L6735-L6744 -let rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g +let rePropName = + /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g let reEscapeChar = /\\(\\)?/g export function stringToPath(string: string): string[] { diff --git a/packages/tailwindcss-language-service/src/util/v4/ast.ts b/packages/tailwindcss-language-service/src/util/v4/ast.ts index 7cf1fb41..452f35ff 100644 --- a/packages/tailwindcss-language-service/src/util/v4/ast.ts +++ b/packages/tailwindcss-language-service/src/util/v4/ast.ts @@ -21,7 +21,7 @@ export type AstNode = Rule | Declaration | Comment export function visit( nodes: AstNode[], cb: (node: AstNode, path: AstNode[]) => void, - path: AstNode[] = [] + path: AstNode[] = [], ) { for (let child of nodes) { path = [...path, child] diff --git a/packages/tailwindcss-language-service/src/util/validateApply.ts b/packages/tailwindcss-language-service/src/util/validateApply.ts index 5e2c1e5c..76e9d99b 100644 --- a/packages/tailwindcss-language-service/src/util/validateApply.ts +++ b/packages/tailwindcss-language-service/src/util/validateApply.ts @@ -5,7 +5,7 @@ import * as semver from './semver' export function validateApply( state: State, - classNameOrParts: string | string[] + classNameOrParts: string | string[], ): { isApplyable: true } | { isApplyable: false; reason: string } | null { if (state.jit) { return { isApplyable: true } diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index a9d2a0df..0f4bd9f2 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -72,7 +72,7 @@ function getExcludePatterns(scope: ConfigurationScope): string[] { return [ ...getGlobalExcludePatterns(scope), ...(Workspace.getConfiguration('tailwindCSS', scope).get('files.exclude')).filter( - Boolean + Boolean, ), ] } @@ -117,7 +117,7 @@ async function fileMayBeTailwindRelated(uri: Uri) { function selectionsAreEqual( aSelections: readonly Selection[], - bSelections: readonly Selection[] + bSelections: readonly Selection[], ): boolean { if (aSelections.length !== bSelections.length) { return false @@ -172,7 +172,7 @@ async function updateActiveTextEditorContext(): Promise { commands.executeCommand( 'setContext', 'tailwindCSS.activeTextEditorSupportsClassSorting', - await activeTextEditorSupportsClassSorting() + await activeTextEditorSupportsClassSorting(), ) } @@ -188,7 +188,7 @@ export async function activate(context: ExtensionContext) { if (outputChannel) { outputChannel.show() } - }) + }), ) await commands.executeCommand('setContext', 'tailwindCSS.hasOutputChannel', true) @@ -227,7 +227,7 @@ export async function activate(context: ExtensionContext) { { uri: document.uri.toString(), classLists: selections.map((selection) => document.getText(selection)), - } + }, ) if ( @@ -241,7 +241,7 @@ export async function activate(context: ExtensionContext) { throw Error( { 'no-project': `No active Tailwind project found for file ${document.uri.fsPath}`, - }[result.error] ?? 'An unknown error occurred.' + }[result.error] ?? 'An unknown error occurred.', ) } @@ -260,13 +260,13 @@ export async function activate(context: ExtensionContext) { } catch (error) { Window.showWarningMessage(`Couldn’t sort Tailwind classes: ${error.message}`) } - }) + }), ) context.subscriptions.push( Window.onDidChangeActiveTextEditor(async () => { await updateActiveTextEditorContext() - }) + }), ) let configWatcher = Workspace.createFileSystemWatcher(`**/${CONFIG_GLOB}`, false, true, true) @@ -342,7 +342,7 @@ export async function activate(context: ExtensionContext) { clients.delete(folder.uri.toString()) bootClientForFolderIfNeeded(folder) } - }) + }), ) let cssServerBooted = false @@ -399,7 +399,7 @@ export async function activate(context: ExtensionContext) { } } function updateProposals( - r: CompletionItem[] | CompletionList | null | undefined + r: CompletionItem[] | CompletionList | null | undefined, ): CompletionItem[] | CompletionList | null | undefined { if (r) { ;(Array.isArray(r) ? r : r.items).forEach(updateRanges) @@ -417,7 +417,7 @@ export async function activate(context: ExtensionContext) { return updateProposals(r) }, }, - } + }, ) await client.start() @@ -481,7 +481,7 @@ export async function activate(context: ExtensionContext) { if (!languages.has(folder.uri.toString())) { languages.set( folder.uri.toString(), - dedupe([...defaultLanguages, ...Object.keys(getUserLanguages(folder))]) + dedupe([...defaultLanguages, ...Object.keys(getUserLanguages(folder))]), ) } @@ -565,8 +565,8 @@ export async function activate(context: ExtensionContext) { new Position(selection.start.line, selection.start.character - length), new Position( selection.start.line, - selection.start.character - length + prefixLength - ) + selection.start.character - length + prefixLength, + ), ) }) if ( @@ -597,7 +597,7 @@ export async function activate(context: ExtensionContext) { let text = Workspace.textDocuments.find((doc) => doc === document)?.getText(color.range) ?? '' return new RegExp( - `-\\[(${colorNames.join('|')}|((?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$` + `-\\[(${colorNames.join('|')}|((?:#|rgba?\\(|hsla?\\())[^\\]]+)\\]$`, ).test(text) }) let nonEditableColors = colors.filter((color) => !editableColors.includes(color)) @@ -640,7 +640,7 @@ export async function activate(context: ExtensionContext) { }, ${color.alpha})`, }, }, - })) + })), ) }) @@ -704,7 +704,7 @@ export async function activate(context: ExtensionContext) { client.onRequest('@/tailwindCSS/getDocumentSymbols', async ({ uri }) => { return commands.executeCommand( 'vscode.executeDocumentSymbolProvider', - Uri.parse(uri) + Uri.parse(uri), ) }) @@ -734,7 +734,7 @@ export async function activate(context: ExtensionContext) { let [configFile] = await Workspace.findFiles( new RelativePattern(folder, `**/${CONFIG_GLOB}`), exclude, - 1 + 1, ) if (configFile) { @@ -793,7 +793,7 @@ export async function activate(context: ExtensionContext) { client.stop() } } - }) + }), ) } diff --git a/packages/vscode-tailwindcss/tsconfig.json b/packages/vscode-tailwindcss/tsconfig.json index 0fcbc55c..f5b8a0b7 100755 --- a/packages/vscode-tailwindcss/tsconfig.json +++ b/packages/vscode-tailwindcss/tsconfig.json @@ -1,24 +1,24 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": ["ES2022"], - "rootDir": "..", - "sourceMap": true, - "moduleResolution": "node", - "esModuleInterop": true, - "allowJs": true, - "resolveJsonModule": true, - "baseUrl": "..", - "paths": { - "tailwindcss-language-service/*": ["../packages/tailwindcss-language-service/*"], - "tailwindcss-language-server/*": ["../packages/tailwindcss-language-server/*"] - } - }, - "include": [ - "src", - "../packages/tailwindcss-language-service", - "../packages/tailwindcss-language-server", - "../../types" - ] -} +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["ES2022"], + "rootDir": "..", + "sourceMap": true, + "moduleResolution": "node", + "esModuleInterop": true, + "allowJs": true, + "resolveJsonModule": true, + "baseUrl": "..", + "paths": { + "tailwindcss-language-service/*": ["../packages/tailwindcss-language-service/*"], + "tailwindcss-language-server/*": ["../packages/tailwindcss-language-server/*"] + } + }, + "include": [ + "src", + "../packages/tailwindcss-language-service", + "../packages/tailwindcss-language-server", + "../../types" + ] +} From 4a238f87969af09134f4f27c05009c15f844fe7f Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 17:59:53 -0400 Subject: [PATCH 07/15] Cleanup imports --- .../tailwindcss-language-server/src/config.ts | 4 +-- .../src/documents.ts | 2 +- .../src/lsp/diagnosticsProvider.ts | 4 +-- .../src/project-locator.test.ts | 2 +- .../src/project-locator.ts | 9 ++--- .../src/projects.ts | 18 +++++----- .../tailwindcss-language-server/src/tw.ts | 23 ++++++------ .../src/util/css.ts | 2 +- .../src/util/error.ts | 2 +- .../src/util/isExcluded.ts | 2 +- .../src/util/resolveFrom.ts | 2 +- .../src/util/v4/design-system.ts | 2 +- .../src/codeActions/codeActionProvider.ts | 6 ++-- .../provideCssConflictCodeActions.ts | 4 +-- .../provideInvalidApplyCodeActions.ts | 9 +++-- .../provideSuggestionCodeActions.ts | 4 +-- .../src/completionProvider.ts | 2 -- .../src/diagnostics/diagnosticsProvider.ts | 4 +-- .../diagnostics/getCssConflictDiagnostics.ts | 5 ++- .../diagnostics/getInvalidApplyDiagnostics.ts | 5 ++- .../getInvalidConfigPathDiagnostics.ts | 4 +-- .../getInvalidScreenDiagnostics.ts | 7 ++-- .../getInvalidTailwindDirectiveDiagnostics.ts | 6 ++-- .../getInvalidVariantDiagnostics.ts | 6 ++-- .../getRecommendedVariantOrderDiagnostics.ts | 4 +-- .../src/diagnostics/types.ts | 2 +- .../src/hoverProvider.ts | 2 +- .../src/util/classes.test.ts | 2 +- .../src/util/color.ts | 3 +- .../src/util/css.ts | 2 +- .../src/util/equivalents.ts | 2 +- .../src/util/find.ts | 2 +- .../src/util/flagEnabled.ts | 2 +- .../src/util/getClassNameAtPosition.ts | 2 +- .../src/util/getClassNameDecls.ts | 2 +- .../src/util/getLanguageBoundaries.ts | 2 +- .../src/util/getVariantsFromClassName.ts | 2 +- .../src/util/html.ts | 2 +- .../src/util/jit.ts | 2 +- .../src/util/js.ts | 2 +- .../src/util/pixelEquivalents.ts | 1 - .../src/util/removeRangesFromString.ts | 2 +- .../src/util/state.ts | 6 ++-- .../src/util/stringify.ts | 2 +- .../src/util/v4/design-system.ts | 2 +- .../src/util/validateApply.ts | 2 +- packages/vscode-tailwindcss/src/cssServer.ts | 2 +- packages/vscode-tailwindcss/src/extension.ts | 35 +++++++++---------- packages/vscode-tailwindcss/src/server.ts | 2 +- 49 files changed, 107 insertions(+), 116 deletions(-) diff --git a/packages/tailwindcss-language-server/src/config.ts b/packages/tailwindcss-language-server/src/config.ts index 1723e6ae..e798b37a 100644 --- a/packages/tailwindcss-language-server/src/config.ts +++ b/packages/tailwindcss-language-server/src/config.ts @@ -1,7 +1,7 @@ import merge from 'deepmerge' import { isObject } from './utils' -import { Settings } from '@tailwindcss/language-service/src/util/state' -import { Connection } from 'vscode-languageserver' +import type { Settings } from '@tailwindcss/language-service/src/util/state' +import type { Connection } from 'vscode-languageserver' export interface SettingsCache { get(uri?: string): Promise diff --git a/packages/tailwindcss-language-server/src/documents.ts b/packages/tailwindcss-language-server/src/documents.ts index bbb54421..a406e7f4 100644 --- a/packages/tailwindcss-language-server/src/documents.ts +++ b/packages/tailwindcss-language-server/src/documents.ts @@ -1,4 +1,4 @@ -import { Connection, TextDocuments } from 'vscode-languageserver/node' +import { type Connection, TextDocuments } from 'vscode-languageserver/node' import { TextDocument } from 'vscode-languageserver-textdocument' export class DocumentService { diff --git a/packages/tailwindcss-language-server/src/lsp/diagnosticsProvider.ts b/packages/tailwindcss-language-server/src/lsp/diagnosticsProvider.ts index 164a3c9e..75fb8733 100644 --- a/packages/tailwindcss-language-server/src/lsp/diagnosticsProvider.ts +++ b/packages/tailwindcss-language-server/src/lsp/diagnosticsProvider.ts @@ -1,6 +1,6 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from 'tailwindcss-language-service/src/util/state' -import { doValidate } from 'tailwindcss-language-service/src/diagnostics/diagnosticsProvider' +import type { State } from '@tailwindcss/language-service/src/util/state' +import { doValidate } from '@tailwindcss/language-service/src/diagnostics/diagnosticsProvider' import isExcluded from '../util/isExcluded' export async function provideDiagnostics(state: State, document: TextDocument) { diff --git a/packages/tailwindcss-language-server/src/project-locator.test.ts b/packages/tailwindcss-language-server/src/project-locator.test.ts index 5819f086..1b6aa0e9 100644 --- a/packages/tailwindcss-language-server/src/project-locator.test.ts +++ b/packages/tailwindcss-language-server/src/project-locator.test.ts @@ -2,7 +2,7 @@ import { test } from 'vitest' import * as path from 'node:path' import { ProjectLocator } from './project-locator' import { URL, fileURLToPath } from 'url' -import { Settings } from 'tailwindcss-language-service/src/util/state' +import { Settings } from '@tailwindcss/language-service/src/util/state' let settings: Settings = { tailwindCSS: { diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 4299968c..60eaa14e 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -4,17 +4,18 @@ import * as fs from 'node:fs/promises' import glob from 'fast-glob' import minimatch from 'minimatch' import normalizePath from 'normalize-path' -import type { Settings } from 'tailwindcss-language-service/src/util/state' +import type { Settings } from '@tailwindcss/language-service/src/util/state' import { CONFIG_GLOB, CSS_GLOB } from './lib/constants' import { readCssFile } from './util/css' import { Graph } from './graph' -import postcss, { Message } from 'postcss' +import type { Message } from 'postcss' +import postcss from 'postcss' import postcssImport from 'postcss-import' -import { DocumentSelector, DocumentSelectorPriority } from './projects' +import { type DocumentSelector, DocumentSelectorPriority } from './projects' import { CacheMap } from './cache-map' import { getPackageRoot } from './util/get-package-root' import resolveFrom from './util/resolveFrom' -import { Feature, supportedFeatures } from './features' +import { type Feature, supportedFeatures } from './features' import { pathToFileURL } from 'node:url' export interface ProjectConfig { diff --git a/packages/tailwindcss-language-server/src/projects.ts b/packages/tailwindcss-language-server/src/projects.ts index b874a5d3..7ddf8492 100644 --- a/packages/tailwindcss-language-server/src/projects.ts +++ b/packages/tailwindcss-language-server/src/projects.ts @@ -1,4 +1,4 @@ -import { +import type { CompletionItem, CompletionList, CompletionParams, @@ -12,21 +12,21 @@ import { ColorPresentationParams, CodeActionParams, CodeAction, - FileChangeType, Disposable, DocumentLinkParams, DocumentLink, } from 'vscode-languageserver/node' -import { TextDocument } from 'vscode-languageserver-textdocument' +import { FileChangeType } from 'vscode-languageserver/node' +import type { TextDocument } from 'vscode-languageserver-textdocument' import { URI } from 'vscode-uri' -import { showError, SilentError } from './util/error' +import { showError, type SilentError } from './util/error' import normalizePath from 'normalize-path' import * as path from 'path' import * as fs from 'fs' import findUp from 'find-up' import minimatch from 'minimatch' import resolveFrom, { setPnpApi } from './util/resolveFrom' -import { AtRule, Container, Node, Result } from 'postcss' +import type { AtRule, Container, Node, Result } from 'postcss' import Hook from './lib/hook' import * as semver from '@tailwindcss/language-service/src/util/semver' import dlv from 'dlv' @@ -40,7 +40,7 @@ import { doComplete, resolveCompletionItem, } from '@tailwindcss/language-service/src/completionProvider' -import { +import type { State, FeatureFlags, Settings, @@ -72,13 +72,11 @@ import { isObject, changeAffectsFile, } from './utils' -import { DocumentService } from './documents' -import { ProjectConfig } from './project-locator' +import type { DocumentService } from './documents' +import type { ProjectConfig } from './project-locator' import { supportedFeatures } from './features' import { loadDesignSystem } from './util/v4' import { readCssFile } from './util/css' -import type { AstNode } from 'tailwindcss-language-service/src/util/v4' -import * as postcss8 from 'postcss' import { pathToFileURL } from 'url' const colorNames = Object.keys(namedColors) diff --git a/packages/tailwindcss-language-server/src/tw.ts b/packages/tailwindcss-language-server/src/tw.ts index 27bb3f41..f507f840 100644 --- a/packages/tailwindcss-language-server/src/tw.ts +++ b/packages/tailwindcss-language-server/src/tw.ts @@ -1,4 +1,4 @@ -import { +import type { CompletionItem, CompletionList, CompletionParams, @@ -12,27 +12,28 @@ import { ColorPresentationParams, CodeActionParams, CodeAction, + BulkUnregistration, + Disposable, + TextDocumentIdentifier, + DocumentLinkParams, + DocumentLink, + InitializeResult, +} from 'vscode-languageserver/node' +import { CompletionRequest, DocumentColorRequest, BulkRegistration, CodeActionRequest, - BulkUnregistration, HoverRequest, DidChangeWatchedFilesNotification, FileChangeType, - Disposable, - TextDocumentIdentifier, DocumentLinkRequest, - DocumentLinkParams, - DocumentLink, - InitializeResult, TextDocumentSyncKind, } from 'vscode-languageserver/node' import { URI } from 'vscode-uri' import normalizePath from 'normalize-path' import * as path from 'path' import type * as chokidar from 'chokidar' -import findUp from 'find-up' import minimatch from 'minimatch' import resolveFrom from './util/resolveFrom' import * as parcel from './watcher/index.js' @@ -41,10 +42,10 @@ import { equal } from '@tailwindcss/language-service/src/util/array' import { CONFIG_GLOB, CSS_GLOB, PACKAGE_LOCK_GLOB } from './lib/constants' import { clearRequireCache, isObject, changeAffectsFile } from './utils' import { DocumentService } from './documents' -import { createProjectService, ProjectService, DocumentSelectorPriority } from './projects' -import { SettingsCache, createSettingsCache } from './config' +import { createProjectService, type ProjectService, DocumentSelectorPriority } from './projects' +import { type SettingsCache, createSettingsCache } from './config' import { readCssFile } from './util/css' -import { ProjectLocator, ProjectConfig } from './project-locator' +import { ProjectLocator, type ProjectConfig } from './project-locator' const TRIGGER_CHARACTERS = [ // class attributes diff --git a/packages/tailwindcss-language-server/src/util/css.ts b/packages/tailwindcss-language-server/src/util/css.ts index 52390908..b85f5856 100644 --- a/packages/tailwindcss-language-server/src/util/css.ts +++ b/packages/tailwindcss-language-server/src/util/css.ts @@ -1,5 +1,5 @@ import { readFile } from 'node:fs/promises' -import { getTextWithoutComments } from 'tailwindcss-language-service/src/util/doc' +import { getTextWithoutComments } from '@tailwindcss/language-service/src/util/doc' export async function readCssFile(filepath: string): Promise { try { diff --git a/packages/tailwindcss-language-server/src/util/error.ts b/packages/tailwindcss-language-server/src/util/error.ts index 664422e4..53222fcf 100644 --- a/packages/tailwindcss-language-server/src/util/error.ts +++ b/packages/tailwindcss-language-server/src/util/error.ts @@ -1,4 +1,4 @@ -import { Connection } from 'vscode-languageserver/node' +import type { Connection } from 'vscode-languageserver/node' function toString(err: any, includeStack: boolean = true): string { if (err instanceof Error) { diff --git a/packages/tailwindcss-language-server/src/util/isExcluded.ts b/packages/tailwindcss-language-server/src/util/isExcluded.ts index f0ec9f49..ba3c13aa 100644 --- a/packages/tailwindcss-language-server/src/util/isExcluded.ts +++ b/packages/tailwindcss-language-server/src/util/isExcluded.ts @@ -1,7 +1,7 @@ import minimatch from 'minimatch' import * as path from 'path' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from 'tailwindcss-language-service/src/util/state' +import type { State } from '@tailwindcss/language-service/src/util/state' import { getFileFsPath } from './uri' export default async function isExcluded( diff --git a/packages/tailwindcss-language-server/src/util/resolveFrom.ts b/packages/tailwindcss-language-server/src/util/resolveFrom.ts index 50c2cfd0..2d679ee4 100644 --- a/packages/tailwindcss-language-server/src/util/resolveFrom.ts +++ b/packages/tailwindcss-language-server/src/util/resolveFrom.ts @@ -5,7 +5,7 @@ import { Resolver, ResolveOptions, } from 'enhanced-resolve-301' -import { equal } from 'tailwindcss-language-service/src/util/array' +import { equal } from '@tailwindcss/language-service/src/util/array' let pnpApi: any let extensions = Object.keys(require.extensions) diff --git a/packages/tailwindcss-language-server/src/util/v4/design-system.ts b/packages/tailwindcss-language-server/src/util/v4/design-system.ts index a2df627c..325f0f0a 100644 --- a/packages/tailwindcss-language-server/src/util/v4/design-system.ts +++ b/packages/tailwindcss-language-server/src/util/v4/design-system.ts @@ -1,4 +1,4 @@ -import type { DesignSystem } from 'tailwindcss-language-service/src/util/v4' +import type { DesignSystem } from '@tailwindcss/language-service/src/util/v4' import postcss from 'postcss' import postcssImport from 'postcss-import' diff --git a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts index 31b5dc5c..7ebf79cb 100644 --- a/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts +++ b/packages/tailwindcss-language-service/src/codeActions/codeActionProvider.ts @@ -1,12 +1,12 @@ import type { CodeAction, CodeActionParams } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from '../util/state' +import type { State } from '../util/state' import { doValidate } from '../diagnostics/diagnosticsProvider' import { rangesEqual } from '../util/rangesEqual' import { - DiagnosticKind, + type DiagnosticKind, isInvalidApplyDiagnostic, - AugmentedDiagnostic, + type AugmentedDiagnostic, isCssConflictDiagnostic, isInvalidConfigPathDiagnostic, isInvalidTailwindDirectiveDiagnostic, diff --git a/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts index 7a17a4fc..b01a5c9c 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideCssConflictCodeActions.ts @@ -1,6 +1,6 @@ -import { State } from '../util/state' +import type { State } from '../util/state' import type { CodeActionParams, CodeAction } from 'vscode-languageserver' -import { CssConflictDiagnostic } from '../diagnostics/types' +import type { CssConflictDiagnostic } from '../diagnostics/types' import { joinWithAnd } from '../util/joinWithAnd' import { removeRangesFromString } from '../util/removeRangesFromString' diff --git a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts index 57e660f5..dcbda0e0 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideInvalidApplyCodeActions.ts @@ -1,6 +1,6 @@ -import type { CodeAction, CodeActionParams, TextEdit, Range } from 'vscode-languageserver' -import { State } from '../util/state' -import { InvalidApplyDiagnostic } from '../diagnostics/types' +import type { CodeAction, TextEdit, Range } from 'vscode-languageserver' +import type { State } from '../util/state' +import type { InvalidApplyDiagnostic } from '../diagnostics/types' import { isCssDoc } from '../util/css' import { getLanguageBoundaries } from '../util/getLanguageBoundaries' import { getClassNameMeta } from '../util/getClassNameMeta' @@ -12,13 +12,12 @@ import type { Root, Source } from 'postcss' import { absoluteRange } from '../util/absoluteRange' import { removeRangesFromString } from '../util/removeRangesFromString' import detectIndent from 'detect-indent' -import isObject from '../util/isObject' import { cssObjToAst } from '../util/cssObjToAst' import { dset } from 'dset' import selectorParser from 'postcss-selector-parser' import { flatten } from '../util/array' import { getTextWithoutComments } from '../util/doc' -import { TextDocument } from 'vscode-languageserver-textdocument' +import type { TextDocument } from 'vscode-languageserver-textdocument' export async function provideInvalidApplyCodeActions( state: State, diff --git a/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts b/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts index 09e56ef7..a0201699 100644 --- a/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts +++ b/packages/tailwindcss-language-service/src/codeActions/provideSuggestionCodeActions.ts @@ -1,6 +1,6 @@ -import { State } from '../util/state' +import type { State } from '../util/state' import type { CodeActionParams, CodeAction } from 'vscode-languageserver' -import { +import type { InvalidConfigPathDiagnostic, InvalidTailwindDirectiveDiagnostic, InvalidScreenDiagnostic, diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index ecf01deb..fb08c6a0 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -7,7 +7,6 @@ import { type CompletionList, type Position, type CompletionContext, - InsertTextFormat, } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import dlv from 'dlv' @@ -38,7 +37,6 @@ import { addPixelEquivalentsToValue, } from './util/pixelEquivalents' import { customClassesIn } from './util/classes' -import { Declaration, visit } from './util/v4' import * as util from 'node:util' import * as postcss from 'postcss' diff --git a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts index ef53cc5e..34c03b22 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/diagnosticsProvider.ts @@ -1,6 +1,6 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from '../util/state' -import { DiagnosticKind, AugmentedDiagnostic } from './types' +import type { State } from '../util/state' +import { DiagnosticKind, type AugmentedDiagnostic } from './types' import { getCssConflictDiagnostics } from './getCssConflictDiagnostics' import { getInvalidApplyDiagnostics } from './getInvalidApplyDiagnostics' import { getInvalidScreenDiagnostics } from './getInvalidScreenDiagnostics' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts index 91599e8a..a3be599e 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getCssConflictDiagnostics.ts @@ -1,12 +1,11 @@ import { joinWithAnd } from '../util/joinWithAnd' -import { State, Settings, DocumentClassName } from '../util/state' -import { CssConflictDiagnostic, DiagnosticKind } from './types' +import type { State, Settings, DocumentClassName } from '../util/state' +import { type CssConflictDiagnostic, DiagnosticKind } from './types' import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' import { getClassNameDecls } from '../util/getClassNameDecls' import { getClassNameMeta } from '../util/getClassNameMeta' import { equal } from '../util/array' import * as jit from '../util/jit' -import * as v4 from '../util/v4' import * as postcss from 'postcss' import type { AtRule, Node, Rule } from 'postcss' import type { TextDocument } from 'vscode-languageserver-textdocument' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts index e14a2097..bb1cca60 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidApplyDiagnostics.ts @@ -1,8 +1,7 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' import { findClassNamesInRange } from '../util/find' -import { InvalidApplyDiagnostic, DiagnosticKind } from './types' -import { Settings, State } from '../util/state' -import type { DiagnosticSeverity } from 'vscode-languageserver' +import { type InvalidApplyDiagnostic, DiagnosticKind } from './types' +import type { Settings, State } from '../util/state' import { validateApply } from '../util/validateApply' export async function getInvalidApplyDiagnostics( diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts index bc716d3d..1f8941ae 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidConfigPathDiagnostics.ts @@ -1,5 +1,5 @@ -import { State, Settings } from '../util/state' -import { InvalidConfigPathDiagnostic, DiagnosticKind } from './types' +import type { State, Settings } from '../util/state' +import { type InvalidConfigPathDiagnostic, DiagnosticKind } from './types' import { findHelperFunctionsInDocument } from '../util/find' import { stringToPath } from '../util/stringToPath' import isObject from '../util/isObject' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts index e7195419..f03c672c 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidScreenDiagnostics.ts @@ -1,13 +1,12 @@ -import { State, Settings } from '../util/state' -import type { Range, DiagnosticSeverity } from 'vscode-languageserver' +import type { State, Settings } from '../util/state' +import type { Range } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { InvalidScreenDiagnostic, DiagnosticKind } from './types' +import { type InvalidScreenDiagnostic, DiagnosticKind } from './types' import { isCssDoc } from '../util/css' import { getLanguageBoundaries } from '../util/getLanguageBoundaries' import { findAll, indexToPosition } from '../util/find' import { closest } from '../util/closest' import { absoluteRange } from '../util/absoluteRange' -import dlv from 'dlv' import { getTextWithoutComments } from '../util/doc' export function getInvalidScreenDiagnostics( diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts index c98f6117..7325d49e 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidTailwindDirectiveDiagnostics.ts @@ -1,7 +1,7 @@ -import { State, Settings } from '../util/state' -import type { Range, DiagnosticSeverity } from 'vscode-languageserver' +import type { State, Settings } from '../util/state' +import type { Range } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types' +import { type InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types' import { isCssDoc } from '../util/css' import { getLanguageBoundaries } from '../util/getLanguageBoundaries' import { findAll, indexToPosition } from '../util/find' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts index 2291bb44..1401e2ee 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getInvalidVariantDiagnostics.ts @@ -1,7 +1,7 @@ -import { State, Settings } from '../util/state' -import type { Range, DiagnosticSeverity } from 'vscode-languageserver' +import type { State, Settings } from '../util/state' +import type { Range } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { InvalidVariantDiagnostic, DiagnosticKind } from './types' +import { type InvalidVariantDiagnostic, DiagnosticKind } from './types' import { isCssDoc } from '../util/css' import { getLanguageBoundaries } from '../util/getLanguageBoundaries' import { findAll, indexToPosition } from '../util/find' diff --git a/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts b/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts index 9a547ead..11ce2fcd 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/getRecommendedVariantOrderDiagnostics.ts @@ -1,6 +1,6 @@ import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State, Settings } from '../util/state' -import { RecommendedVariantOrderDiagnostic, DiagnosticKind } from './types' +import type { State, Settings } from '../util/state' +import { type RecommendedVariantOrderDiagnostic, DiagnosticKind } from './types' import { findClassListsInDocument, getClassNamesInClassList } from '../util/find' import * as jit from '../util/jit' import { getVariantsFromClassName } from '../util/getVariantsFromClassName' diff --git a/packages/tailwindcss-language-service/src/diagnostics/types.ts b/packages/tailwindcss-language-service/src/diagnostics/types.ts index 45a4aee8..115079a2 100644 --- a/packages/tailwindcss-language-service/src/diagnostics/types.ts +++ b/packages/tailwindcss-language-service/src/diagnostics/types.ts @@ -1,5 +1,5 @@ import type { Diagnostic } from 'vscode-languageserver' -import { DocumentClassName, DocumentClassList } from '../util/state' +import type { DocumentClassName } from '../util/state' export enum DiagnosticKind { CssConflict = 'cssConflict', diff --git a/packages/tailwindcss-language-service/src/hoverProvider.ts b/packages/tailwindcss-language-service/src/hoverProvider.ts index 786393cc..d3869337 100644 --- a/packages/tailwindcss-language-service/src/hoverProvider.ts +++ b/packages/tailwindcss-language-service/src/hoverProvider.ts @@ -1,4 +1,4 @@ -import { State } from './util/state' +import type { State } from './util/state' import type { Hover, Position } from 'vscode-languageserver' import { stringifyCss, stringifyConfigValue } from './util/stringify' import dlv from 'dlv' diff --git a/packages/tailwindcss-language-service/src/util/classes.test.ts b/packages/tailwindcss-language-service/src/util/classes.test.ts index 54962869..f1c11d98 100644 --- a/packages/tailwindcss-language-service/src/util/classes.test.ts +++ b/packages/tailwindcss-language-service/src/util/classes.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import { ClassMatch, ClassRegexFilter, customClassesIn } from './classes' +import { type ClassMatch, type ClassRegexFilter, customClassesIn } from './classes' interface TestRecord { name: string diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts index d5c1849a..a7db29f1 100644 --- a/packages/tailwindcss-language-service/src/util/color.ts +++ b/packages/tailwindcss-language-service/src/util/color.ts @@ -1,5 +1,5 @@ import dlv from 'dlv' -import { State } from './state' +import type { State } from './state' import removeMeta from './removeMeta' import { ensureArray, dedupe } from './array' import type { Color } from 'vscode-languageserver' @@ -7,7 +7,6 @@ import { getClassNameParts } from './getClassNameAtPosition' import * as jit from './jit' import * as culori from 'culori' import namedColors from 'color-name' -import * as v4 from './v4' import postcss from 'postcss' const COLOR_PROPS = [ diff --git a/packages/tailwindcss-language-service/src/util/css.ts b/packages/tailwindcss-language-service/src/util/css.ts index 408fb04b..14950397 100644 --- a/packages/tailwindcss-language-service/src/util/css.ts +++ b/packages/tailwindcss-language-service/src/util/css.ts @@ -2,7 +2,7 @@ import type { Position } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import { isVueDoc, isSvelteDoc, isHtmlDoc } from './html' import { isJsDoc } from './js' -import { State } from './state' +import type { State } from './state' import { cssLanguages } from './languages' import { getLanguageBoundaries } from './getLanguageBoundaries' diff --git a/packages/tailwindcss-language-service/src/util/equivalents.ts b/packages/tailwindcss-language-service/src/util/equivalents.ts index 727e77bc..f462225c 100644 --- a/packages/tailwindcss-language-service/src/util/equivalents.ts +++ b/packages/tailwindcss-language-service/src/util/equivalents.ts @@ -1,7 +1,7 @@ import type { TailwindCssSettings } from './state' import { equivalentPixelValues } from './pixelEquivalents' import { equivalentColorValues } from './colorEquivalents' -import postcss, { AcceptedPlugin } from 'postcss' +import postcss, { type AcceptedPlugin } from 'postcss' import { applyComments, type Comment } from './comments' export function addEquivalents(css: string, settings: TailwindCssSettings): string { diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts index ee993940..b8cceccd 100644 --- a/packages/tailwindcss-language-service/src/util/find.ts +++ b/packages/tailwindcss-language-service/src/util/find.ts @@ -1,6 +1,6 @@ import type { Range, Position } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state' +import type { DocumentClassName, DocumentClassList, State, DocumentHelperFunction } from './state' import lineColumn from 'line-column' import { isCssContext, isCssDoc } from './css' import { isHtmlContext } from './html' diff --git a/packages/tailwindcss-language-service/src/util/flagEnabled.ts b/packages/tailwindcss-language-service/src/util/flagEnabled.ts index a6747078..f6f4dd02 100644 --- a/packages/tailwindcss-language-service/src/util/flagEnabled.ts +++ b/packages/tailwindcss-language-service/src/util/flagEnabled.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import dlv from 'dlv' export function flagEnabled(state: State, flag: string) { diff --git a/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts b/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts index d0ac9ac1..654998de 100644 --- a/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts +++ b/packages/tailwindcss-language-service/src/util/getClassNameAtPosition.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import { combinations } from './combinations' import dlv from 'dlv' diff --git a/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts b/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts index 542ae568..ed017dfa 100644 --- a/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts +++ b/packages/tailwindcss-language-service/src/util/getClassNameDecls.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import { getClassNameParts } from './getClassNameAtPosition' import removeMeta from './removeMeta' import dlv from 'dlv' diff --git a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts index 1103be45..83f59309 100644 --- a/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts +++ b/packages/tailwindcss-language-service/src/util/getLanguageBoundaries.ts @@ -1,7 +1,7 @@ import type { Range } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import { isVueDoc, isHtmlDoc, isSvelteDoc } from './html' -import { State } from './state' +import type { State } from './state' import { indexToPosition } from './find' import { isJsDoc } from './js' import moo from 'moo' diff --git a/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts b/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts index ab774fba..b58bb29f 100644 --- a/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts +++ b/packages/tailwindcss-language-service/src/util/getVariantsFromClassName.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import * as jit from './jit' export function getVariantsFromClassName( diff --git a/packages/tailwindcss-language-service/src/util/html.ts b/packages/tailwindcss-language-service/src/util/html.ts index 73e92368..666869bc 100644 --- a/packages/tailwindcss-language-service/src/util/html.ts +++ b/packages/tailwindcss-language-service/src/util/html.ts @@ -1,6 +1,6 @@ import type { Position } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from './state' +import type { State } from './state' import { htmlLanguages } from './languages' import { getLanguageBoundaries } from './getLanguageBoundaries' diff --git a/packages/tailwindcss-language-service/src/util/jit.ts b/packages/tailwindcss-language-service/src/util/jit.ts index 0a8dfd69..450cc01a 100644 --- a/packages/tailwindcss-language-service/src/util/jit.ts +++ b/packages/tailwindcss-language-service/src/util/jit.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import type { Container, Document, Root, Rule, Node, AtRule } from 'postcss' import { addPixelEquivalentsToValue } from './pixelEquivalents' import { addEquivalents } from './equivalents' diff --git a/packages/tailwindcss-language-service/src/util/js.ts b/packages/tailwindcss-language-service/src/util/js.ts index db6c8a0c..1197d1e6 100644 --- a/packages/tailwindcss-language-service/src/util/js.ts +++ b/packages/tailwindcss-language-service/src/util/js.ts @@ -1,6 +1,6 @@ import type { Position } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' -import { State } from './state' +import type { State } from './state' import { jsLanguages } from './languages' import { getLanguageBoundaries } from './getLanguageBoundaries' diff --git a/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts b/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts index cd45c694..b562c33d 100644 --- a/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts +++ b/packages/tailwindcss-language-service/src/util/pixelEquivalents.ts @@ -1,7 +1,6 @@ import type { Plugin } from 'postcss' import parseValue from 'postcss-value-parser' import { parse as parseMediaQueryList } from '@csstools/media-query-list-parser' -import postcss from 'postcss' import { isTokenNode } from '@csstools/css-parser-algorithms' import type { Comment } from './comments' import { applyComments } from './comments' diff --git a/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts b/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts index d5579cb6..d1c671f0 100644 --- a/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts +++ b/packages/tailwindcss-language-service/src/util/removeRangesFromString.ts @@ -1,4 +1,4 @@ -import { Range } from 'vscode-languageserver' +import type { Range } from 'vscode-languageserver' import lineColumn from 'line-column' import { ensureArray } from './array' diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 5e590972..3f94f259 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -1,8 +1,8 @@ -import type { TextDocuments, Connection, Range, SymbolInformation } from 'vscode-languageserver' +import type { Connection, Range, SymbolInformation } from 'vscode-languageserver' import type { TextDocument } from 'vscode-languageserver-textdocument' import type { Postcss } from 'postcss' -import { KeywordColor } from './color' -import * as culori from 'culori' +import type { KeywordColor } from './color' +import type * as culori from 'culori' import type { DesignSystem } from './v4' export type ClassNamesTree = { diff --git a/packages/tailwindcss-language-service/src/util/stringify.ts b/packages/tailwindcss-language-service/src/util/stringify.ts index c598731e..ec5603aa 100644 --- a/packages/tailwindcss-language-service/src/util/stringify.ts +++ b/packages/tailwindcss-language-service/src/util/stringify.ts @@ -4,7 +4,7 @@ import escapeClassName from 'css.escape' import { ensureArray } from './array' import stringifyObject from 'stringify-object' import isObject from './isObject' -import { Settings } from './state' +import type { Settings } from './state' import { addEquivalents } from './equivalents' export function stringifyConfigValue(x: any): string { diff --git a/packages/tailwindcss-language-service/src/util/v4/design-system.ts b/packages/tailwindcss-language-service/src/util/v4/design-system.ts index dcd13884..36cae143 100644 --- a/packages/tailwindcss-language-service/src/util/v4/design-system.ts +++ b/packages/tailwindcss-language-service/src/util/v4/design-system.ts @@ -1,5 +1,5 @@ import postcss from 'postcss' -import type { AstNode, Rule } from './ast' +import type { Rule } from './ast' import type { NamedVariant } from './candidate' export interface Theme {} diff --git a/packages/tailwindcss-language-service/src/util/validateApply.ts b/packages/tailwindcss-language-service/src/util/validateApply.ts index 76e9d99b..4e3d8f42 100644 --- a/packages/tailwindcss-language-service/src/util/validateApply.ts +++ b/packages/tailwindcss-language-service/src/util/validateApply.ts @@ -1,4 +1,4 @@ -import { State } from './state' +import type { State } from './state' import { getClassNameMeta } from './getClassNameMeta' import { flagEnabled } from './flagEnabled' import * as semver from './semver' diff --git a/packages/vscode-tailwindcss/src/cssServer.ts b/packages/vscode-tailwindcss/src/cssServer.ts index c1d1fa17..ff5a7591 100644 --- a/packages/vscode-tailwindcss/src/cssServer.ts +++ b/packages/vscode-tailwindcss/src/cssServer.ts @@ -1 +1 @@ -import 'tailwindcss-language-server/src/language/cssServer' +import '@tailwindcss/language-server/src/language/cssServer' diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index 0f4bd9f2..ad067b61 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -3,47 +3,46 @@ * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ import * as path from 'path' +import type { + ExtensionContext, + TextDocument, + WorkspaceFolder, + TextEditorDecorationType, + ConfigurationScope, + WorkspaceConfiguration, + CompletionList, + ProviderResult, + Selection, +} from 'vscode' import { workspace as Workspace, window as Window, languages as Languages, - ExtensionContext, - TextDocument, - OutputChannel, - WorkspaceFolder, Uri, commands, SymbolInformation, Position, Range, - TextEditorDecorationType, RelativePattern, - ConfigurationScope, - WorkspaceConfiguration, CompletionItem, CompletionItemKind, - CompletionList, - ProviderResult, SnippetString, TextEdit, - Selection, } from 'vscode' +import type { LanguageClientOptions, ServerOptions, Disposable } from 'vscode-languageclient/node' import { LanguageClient, - LanguageClientOptions, - ServerOptions, TransportKind, State as LanguageClientState, RevealOutputChannelOn, - Disposable, } from 'vscode-languageclient/node' -import { languages as defaultLanguages } from 'tailwindcss-language-service/src/util/languages' -import * as semver from 'tailwindcss-language-service/src/util/semver' -import isObject from 'tailwindcss-language-service/src/util/isObject' -import { dedupe, equal } from 'tailwindcss-language-service/src/util/array' +import { languages as defaultLanguages } from '@tailwindcss/language-service/src/util/languages' +import * as semver from '@tailwindcss/language-service/src/util/semver' +import isObject from '@tailwindcss/language-service/src/util/isObject' +import { dedupe, equal } from '@tailwindcss/language-service/src/util/array' import namedColors from 'color-name' import minimatch from 'minimatch' -import { CONFIG_GLOB, CSS_GLOB } from 'tailwindcss-language-server/src/lib/constants' +import { CONFIG_GLOB, CSS_GLOB } from '@tailwindcss/language-server/src/lib/constants' import braces from 'braces' import normalizePath from 'normalize-path' diff --git a/packages/vscode-tailwindcss/src/server.ts b/packages/vscode-tailwindcss/src/server.ts index d23bd659..b6cf8686 100644 --- a/packages/vscode-tailwindcss/src/server.ts +++ b/packages/vscode-tailwindcss/src/server.ts @@ -1 +1 @@ -import 'tailwindcss-language-server/src/server' +import '@tailwindcss/language-server/src/server' From 8783de1a3e0d0858483cf5de3ef69bbb04206ff6 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 17:58:38 -0400 Subject: [PATCH 08/15] Fix some type errors --- package-lock.json | 96 ++++++++++++++++++- .../tailwindcss-language-server/package.json | 11 ++- .../src/projects.ts | 3 +- .../tailwindcss-language-server/src/server.ts | 1 + .../tailwindcss-language-service/package.json | 3 + .../src/completionProvider.ts | 2 +- .../src/util/find.ts | 2 +- 7 files changed, 113 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9834fd29..f1fb3acb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -770,6 +770,18 @@ "integrity": "sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==", "dev": true }, + "node_modules/@types/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-87W6MJCKZYDhLAx/J1ikW8niMvmGRyY+rpUxWpL1cO7F8Uu5CHuQoFv+R0/L5pgNdW4jTyda42kv60uwVIPjLw==", + "dev": true + }, + "node_modules/@types/css.escape": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@types/css.escape/-/css.escape-1.5.2.tgz", + "integrity": "sha512-sq0h0y8i83T20MB434AZWgK3byezbBG48jllitFpVXlPOjHc5RNs3bg6rUen/EtMUjM4ZJjD4x+0aik9AXqLdQ==", + "dev": true + }, "node_modules/@types/culori": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/culori/-/culori-2.0.1.tgz", @@ -781,12 +793,55 @@ "integrity": "sha512-bWG5wapaWgbss9E238T0R6bfo5Fh3OkeoSt245CM7JJwVwpw6MEBCbIxLq5z8KzsE3uJhzcIuQkyiZmzV3M/Dw==", "dev": true }, + "node_modules/@types/dlv": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@types/dlv/-/dlv-1.1.4.tgz", + "integrity": "sha512-m8KmImw4Jt+4rIgupwfivrWEOnj1LzkmKkqbh075uG13eTQ1ZxHWT6T0vIdSQhLIjQCiR0n0lZdtyDOPO1x2Mw==", + "dev": true + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/find-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/find-up/-/find-up-4.0.0.tgz", + "integrity": "sha512-QlRNKeOPFWKisbNtKVOOGXw3AeLbkw8UmT/EyEGM6brfqpYffKBcch7f1y40NYN9O90aK2+K0xBMDJfOAsg2qg==", + "deprecated": "This is a stub types definition. find-up provides its own type definitions, so you do not need this installed.", + "dev": true, + "dependencies": { + "find-up": "*" + } + }, + "node_modules/@types/license-checker": { + "version": "25.0.6", + "resolved": "https://registry.npmjs.org/@types/license-checker/-/license-checker-25.0.6.tgz", + "integrity": "sha512-ju/75+YPkNE5vX1iPer+qtI1eI/LqJVYZgOsmSHI1iiEM1bQL5Gh1lEvyjR9T7ZXVE1FwJa2doWJEEmPNwbZkw==", + "dev": true + }, + "node_modules/@types/line-column": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/line-column/-/line-column-1.0.2.tgz", + "integrity": "sha512-099oFQmp/Tlf20xW5XI5R4F69N6lF/zQ09XDzc3R5BOLFlqIotgKoNIyj0HD4fQLWcGDreDJv8k/BkLJscrDrw==", + "dev": true + }, + "node_modules/@types/micromatch": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.6.tgz", + "integrity": "sha512-2eulCHWqjEpk9/vyic4tBhI8a9qQEl6DaK2n/sF7TweX9YESlypgKyhXMDGt4DAOy/jhLPvVrZc8pTDAMsplJA==", + "dev": true, + "dependencies": { + "@types/braces": "*" + } + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, "node_modules/@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", @@ -815,17 +870,44 @@ "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", "dev": true }, + "node_modules/@types/normalize-path": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/normalize-path/-/normalize-path-3.0.2.tgz", + "integrity": "sha512-DO++toKYPaFn0Z8hQ7Tx+3iT9t77IJo/nDiqTXilgEP+kPNIYdpS9kh3fXuc53ugqwp9pxC1PVjCpV1tQDyqMA==", + "dev": true + }, "node_modules/@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, + "node_modules/@types/postcss-import": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/@types/postcss-import/-/postcss-import-14.0.3.tgz", + "integrity": "sha512-raZhRVTf6Vw5+QbmQ7LOHSDML71A5rj4+EqDzAbrZPfxfoGzFxMHRCq16VlddGIZpHELw0BG4G0YE2ANkdZiIQ==", + "dev": true, + "dependencies": { + "postcss": "^8.0.0" + } + }, "node_modules/@types/semver": { "version": "7.3.10", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.10.tgz", "integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==" }, + "node_modules/@types/stack-trace": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/@types/stack-trace/-/stack-trace-0.0.33.tgz", + "integrity": "sha512-O7in6531Bbvlb2KEsJ0dq0CHZvc3iWSR5ZYMtvGgnHA56VgriAN/AU2LorfmcvAl2xc9N5fbCTRyMRRl8nd74g==", + "dev": true + }, + "node_modules/@types/stringify-object": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/stringify-object/-/stringify-object-4.0.5.tgz", + "integrity": "sha512-TzX5V+njkbJ8iJ0mrj+Vqveep/1JBH4SSA3J2wYrE1eUrOhdsjTBCb0kao4EquSQ8KgPpqY4zSVP2vCPWKBElg==", + "dev": true + }, "node_modules/@types/vscode": { "version": "1.65.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.65.0.tgz", @@ -7345,8 +7427,17 @@ "@tailwindcss/language-service": "*", "@tailwindcss/line-clamp": "0.4.2", "@tailwindcss/typography": "0.5.7", + "@types/color-name": "^1.1.3", "@types/debounce": "1.2.0", + "@types/dlv": "^1.1.4", + "@types/find-up": "^4.0.0", + "@types/license-checker": "^25.0.6", + "@types/micromatch": "^4.0.6", + "@types/minimatch": "^5.1.2", "@types/node": "14.14.34", + "@types/normalize-path": "^3.0.2", + "@types/postcss-import": "^14.0.3", + "@types/stack-trace": "^0.0.33", "@types/vscode": "1.65.0", "browserslist": "^4.22.1", "bun-types": "^1.0.6", @@ -7364,7 +7455,7 @@ "is-builtin-module": "3.2.1", "klona": "2.0.4", "license-checker": "25.0.1", - "minimatch": "5.1.4", + "micromatch": "^4.0.5", "minimist": "^1.2.8", "normalize-path": "3.0.0", "pkg-up": "3.1.0", @@ -7455,6 +7546,9 @@ "vscode-languageserver-textdocument": "1.0.11" }, "devDependencies": { + "@types/css.escape": "^1.5.2", + "@types/line-column": "^1.0.2", + "@types/stringify-object": "^4.0.5", "esbuild": "^0.19.5", "esbuild-node-externals": "^1.9.0", "tslib": "2.2.0", diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json index 45459272..66e57f2c 100644 --- a/packages/tailwindcss-language-server/package.json +++ b/packages/tailwindcss-language-server/package.json @@ -40,8 +40,17 @@ "@tailwindcss/language-service": "*", "@tailwindcss/line-clamp": "0.4.2", "@tailwindcss/typography": "0.5.7", + "@types/color-name": "^1.1.3", "@types/debounce": "1.2.0", + "@types/dlv": "^1.1.4", + "@types/find-up": "^4.0.0", + "@types/license-checker": "^25.0.6", + "@types/micromatch": "^4.0.6", + "@types/minimatch": "^5.1.2", "@types/node": "14.14.34", + "@types/normalize-path": "^3.0.2", + "@types/postcss-import": "^14.0.3", + "@types/stack-trace": "^0.0.33", "@types/vscode": "1.65.0", "browserslist": "^4.22.1", "bun-types": "^1.0.6", @@ -59,7 +68,7 @@ "is-builtin-module": "3.2.1", "klona": "2.0.4", "license-checker": "25.0.1", - "minimatch": "5.1.4", + "micromatch": "^4.0.5", "minimist": "^1.2.8", "normalize-path": "3.0.0", "pkg-up": "3.1.0", diff --git a/packages/tailwindcss-language-server/src/projects.ts b/packages/tailwindcss-language-server/src/projects.ts index 7ddf8492..ba797782 100644 --- a/packages/tailwindcss-language-server/src/projects.ts +++ b/packages/tailwindcss-language-server/src/projects.ts @@ -19,7 +19,7 @@ import type { import { FileChangeType } from 'vscode-languageserver/node' import type { TextDocument } from 'vscode-languageserver-textdocument' import { URI } from 'vscode-uri' -import { showError, type SilentError } from './util/error' +import { showError, SilentError } from './util/error' import normalizePath from 'normalize-path' import * as path from 'path' import * as fs from 'fs' @@ -1462,6 +1462,7 @@ async function getPlugins(config: any) { name: fnName, } } + // @ts-ignore const file = trace[0].fileName const dir = path.dirname(file) let pkgPath = pkgUp.sync({ cwd: dir }) diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index fcd091d0..86553395 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -1,6 +1,7 @@ import './lib/env' import { createConnection } from 'vscode-languageserver/node' import { formatError } from './util/error' +// @ts-ignore import preflight from 'tailwindcss/lib/css/preflight.css' import { TW } from './tw' diff --git a/packages/tailwindcss-language-service/package.json b/packages/tailwindcss-language-service/package.json index 14d8fcbc..f0b280ef 100644 --- a/packages/tailwindcss-language-service/package.json +++ b/packages/tailwindcss-language-service/package.json @@ -39,6 +39,9 @@ "vscode-languageserver-textdocument": "1.0.11" }, "devDependencies": { + "@types/css.escape": "^1.5.2", + "@types/line-column": "^1.0.2", + "@types/stringify-object": "^4.0.5", "esbuild": "^0.19.5", "esbuild-node-externals": "^1.9.0", "tslib": "2.2.0", diff --git a/packages/tailwindcss-language-service/src/completionProvider.ts b/packages/tailwindcss-language-service/src/completionProvider.ts index fb08c6a0..b9ff0981 100644 --- a/packages/tailwindcss-language-service/src/completionProvider.ts +++ b/packages/tailwindcss-language-service/src/completionProvider.ts @@ -1787,7 +1787,7 @@ export async function resolveCompletionItem( } function isContextItem(state: State, keys: string[]): boolean { - const item = dlv(state.classNames.classNames, [keys]) + const item = dlv(state.classNames.classNames, keys) if (!isObject(item)) { return false diff --git a/packages/tailwindcss-language-service/src/util/find.ts b/packages/tailwindcss-language-service/src/util/find.ts index b8cceccd..94fae47d 100644 --- a/packages/tailwindcss-language-service/src/util/find.ts +++ b/packages/tailwindcss-language-service/src/util/find.ts @@ -399,7 +399,7 @@ export function findHelperFunctionsInRange( } export function indexToPosition(str: string, index: number): Position { - const { line, col } = lineColumn(str + '\n', index) + const { line, col } = lineColumn(str + '\n').fromIndex(index) ?? { line: 1, col: 1 } return { line: line - 1, character: col - 1 } } From 4d890ad3947713b0c226b1551d8fd3c4b085ad01 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 18:53:57 -0400 Subject: [PATCH 09/15] Replace minimatch with picomatch --- package-lock.json | 53 ++++++++++++------- .../tailwindcss-language-server/package.json | 5 +- .../src/project-locator.ts | 6 ++- .../src/projects.ts | 6 ++- .../tailwindcss-language-server/src/tw.ts | 24 +++++---- .../src/util/isExcluded.ts | 4 +- packages/vscode-tailwindcss/package.json | 5 +- packages/vscode-tailwindcss/src/extension.ts | 8 +-- 8 files changed, 66 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1fb3acb..56aefc7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -827,21 +827,6 @@ "integrity": "sha512-099oFQmp/Tlf20xW5XI5R4F69N6lF/zQ09XDzc3R5BOLFlqIotgKoNIyj0HD4fQLWcGDreDJv8k/BkLJscrDrw==", "dev": true }, - "node_modules/@types/micromatch": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.6.tgz", - "integrity": "sha512-2eulCHWqjEpk9/vyic4tBhI8a9qQEl6DaK2n/sF7TweX9YESlypgKyhXMDGt4DAOy/jhLPvVrZc8pTDAMsplJA==", - "dev": true, - "dependencies": { - "@types/braces": "*" - } - }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, "node_modules/@types/minimist": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", @@ -882,6 +867,12 @@ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, + "node_modules/@types/picomatch": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-2.3.3.tgz", + "integrity": "sha512-Yll76ZHikRFCyz/pffKGjrCwe/le2CDwOP5F210KQo27kpRE46U2rDnzikNlVn6/ezH3Mhn46bJMTfeVTtcYMg==", + "dev": true + }, "node_modules/@types/postcss-import": { "version": "14.0.3", "resolved": "https://registry.npmjs.org/@types/postcss-import/-/postcss-import-14.0.3.tgz", @@ -7432,10 +7423,9 @@ "@types/dlv": "^1.1.4", "@types/find-up": "^4.0.0", "@types/license-checker": "^25.0.6", - "@types/micromatch": "^4.0.6", - "@types/minimatch": "^5.1.2", "@types/node": "14.14.34", "@types/normalize-path": "^3.0.2", + "@types/picomatch": "^2.3.3", "@types/postcss-import": "^14.0.3", "@types/stack-trace": "^0.0.33", "@types/vscode": "1.65.0", @@ -7455,9 +7445,9 @@ "is-builtin-module": "3.2.1", "klona": "2.0.4", "license-checker": "25.0.1", - "micromatch": "^4.0.5", "minimist": "^1.2.8", "normalize-path": "3.0.0", + "picomatch": "^4.0.1", "pkg-up": "3.1.0", "postcss": "8.4.31", "postcss-load-config": "3.0.1", @@ -7483,6 +7473,18 @@ "integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==", "dev": true }, + "packages/tailwindcss-language-server/node_modules/picomatch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.1.tgz", + "integrity": "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "packages/tailwindcss-language-server/node_modules/vscode-languageclient": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-8.1.0.tgz", @@ -7587,16 +7589,17 @@ "devDependencies": { "@tailwindcss/language-server": "*", "@types/braces": "3.0.1", + "@types/picomatch": "^2.3.3", "@types/vscode": "1.65.0", "@vscode/vsce": "2.21.1", "braces": "3.0.2", "color-name": "1.1.4", "concurrently": "7.0.0", "esbuild": "^0.19.5", - "minimatch": "5.1.4", "minimist": "^1.2.8", "move-file-cli": "3.0.0", "normalize-path": "3.0.0", + "picomatch": "^4.0.1", "rimraf": "3.0.2", "typescript": "5.3.3", "vscode-languageclient": "8.0.2" @@ -7604,6 +7607,18 @@ "engines": { "vscode": "^1.67.0" } + }, + "packages/vscode-tailwindcss/node_modules/picomatch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.1.tgz", + "integrity": "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } } } } diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json index 66e57f2c..99b896e2 100644 --- a/packages/tailwindcss-language-server/package.json +++ b/packages/tailwindcss-language-server/package.json @@ -45,10 +45,9 @@ "@types/dlv": "^1.1.4", "@types/find-up": "^4.0.0", "@types/license-checker": "^25.0.6", - "@types/micromatch": "^4.0.6", - "@types/minimatch": "^5.1.2", "@types/node": "14.14.34", "@types/normalize-path": "^3.0.2", + "@types/picomatch": "^2.3.3", "@types/postcss-import": "^14.0.3", "@types/stack-trace": "^0.0.33", "@types/vscode": "1.65.0", @@ -68,9 +67,9 @@ "is-builtin-module": "3.2.1", "klona": "2.0.4", "license-checker": "25.0.1", - "micromatch": "^4.0.5", "minimist": "^1.2.8", "normalize-path": "3.0.0", + "picomatch": "^4.0.1", "pkg-up": "3.1.0", "postcss": "8.4.31", "postcss-load-config": "3.0.1", diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 60eaa14e..8ac48a3a 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -2,7 +2,7 @@ import * as os from 'node:os' import * as path from 'node:path' import * as fs from 'node:fs/promises' import glob from 'fast-glob' -import minimatch from 'minimatch' +import picomatch from 'picomatch' import normalizePath from 'normalize-path' import type { Settings } from '@tailwindcss/language-service/src/util/state' import { CONFIG_GLOB, CSS_GLOB } from './lib/constants' @@ -194,9 +194,11 @@ export class ProjectLocator { // Create a map of config paths to metadata let configs = new CacheMap() + let isCssMatcher = picomatch(`**/${CSS_GLOB}`, { dot: true }) + // Create a list of entries for each file let entries = files.map((filepath: string): FileEntry => { - let isCss = minimatch(filepath, `**/${CSS_GLOB}`, { dot: true }) + let isCss = isCssMatcher(filepath) if (isCss) { return new FileEntry('css', filepath) diff --git a/packages/tailwindcss-language-server/src/projects.ts b/packages/tailwindcss-language-server/src/projects.ts index ba797782..4b2ab272 100644 --- a/packages/tailwindcss-language-server/src/projects.ts +++ b/packages/tailwindcss-language-server/src/projects.ts @@ -24,7 +24,7 @@ import normalizePath from 'normalize-path' import * as path from 'path' import * as fs from 'fs' import findUp from 'find-up' -import minimatch from 'minimatch' +import picomatch from 'picomatch' import resolveFrom, { setPnpApi } from './util/resolveFrom' import type { AtRule, Container, Node, Result } from 'postcss' import Hook from './lib/hook' @@ -264,12 +264,14 @@ export async function createProjectService( let needsInit = false let needsRebuild = false + let isPackageMatcher = picomatch(`**/${PACKAGE_LOCK_GLOB}`, { dot: true }) + for (let change of changes) { let file = normalizePath(change.file) let isConfigFile = changeAffectsFile(file, [projectConfig.configPath]) let isDependency = changeAffectsFile(file, state.dependencies ?? []) - let isPackageFile = minimatch(file, `**/${PACKAGE_LOCK_GLOB}`, { dot: true }) + let isPackageFile = isPackageMatcher(file) if (!isConfigFile && !isDependency && !isPackageFile) continue diff --git a/packages/tailwindcss-language-server/src/tw.ts b/packages/tailwindcss-language-server/src/tw.ts index f507f840..9ca3398a 100644 --- a/packages/tailwindcss-language-server/src/tw.ts +++ b/packages/tailwindcss-language-server/src/tw.ts @@ -34,7 +34,7 @@ import { URI } from 'vscode-uri' import normalizePath from 'normalize-path' import * as path from 'path' import type * as chokidar from 'chokidar' -import minimatch from 'minimatch' +import picomatch from 'picomatch' import resolveFrom from './util/resolveFrom' import * as parcel from './watcher/index.js' import { normalizeFileNameToFsPath } from './util/uri' @@ -230,16 +230,22 @@ export class TW { let needsRestart = false let needsSoftRestart = false + let isPackageMatcher = picomatch(`**/${PACKAGE_LOCK_GLOB}`, { dot: true }) + let isCssMatcher = picomatch(`**/${CSS_GLOB}`, { dot: true }) + let isConfigMatcher = picomatch(`**/${CONFIG_GLOB}`, { dot: true }) + changeLoop: for (let change of changes) { let normalizedFilename = normalizePath(change.file) for (let ignorePattern of ignore) { - if (minimatch(normalizedFilename, ignorePattern, { dot: true })) { + let isIgnored = picomatch(ignorePattern, { dot: true }) + + if (isIgnored(normalizedFilename)) { continue changeLoop } } - let isPackageFile = minimatch(normalizedFilename, `**/${PACKAGE_LOCK_GLOB}`, { dot: true }) + let isPackageFile = isPackageMatcher(normalizedFilename) if (isPackageFile) { for (let [, project] of this.projects) { let twVersion = require('tailwindcss/package.json').version @@ -275,9 +281,7 @@ export class TW { break changeLoop } - let isCssFile = minimatch(normalizedFilename, `**/${CSS_GLOB}`, { - dot: true, - }) + let isCssFile = isCssMatcher(`**/${CSS_GLOB}`) if (isCssFile && change.type !== FileChangeType.Deleted) { let configPath = await getConfigFileFromCssFile(change.file) if ( @@ -292,9 +296,7 @@ export class TW { } } - let isConfigFile = minimatch(normalizedFilename, `**/${CONFIG_GLOB}`, { - dot: true, - }) + let isConfigFile = isConfigMatcher(normalizedFilename) if (isConfigFile && change.type === FileChangeType.Created) { needsRestart = true break @@ -682,10 +684,10 @@ export class TW { for (let selector of documentSelector) { let fsPath = URI.parse(document.uri).fsPath let pattern = selector.pattern.replace(/[\[\]{}]/g, (m) => `\\${m}`) - if (pattern.startsWith('!') && minimatch(fsPath, pattern.slice(1), { dot: true })) { + if (pattern.startsWith('!') && picomatch(pattern.slice(1), { dot: true })(fsPath)) { break } - if (minimatch(fsPath, pattern, { dot: true }) && selector.priority < matchedPriority) { + if (picomatch(pattern, { dot: true })(fsPath) && selector.priority < matchedPriority) { matchedProject = project matchedPriority = selector.priority } diff --git a/packages/tailwindcss-language-server/src/util/isExcluded.ts b/packages/tailwindcss-language-server/src/util/isExcluded.ts index ba3c13aa..bbb6ca58 100644 --- a/packages/tailwindcss-language-server/src/util/isExcluded.ts +++ b/packages/tailwindcss-language-server/src/util/isExcluded.ts @@ -1,4 +1,4 @@ -import minimatch from 'minimatch' +import picomatch from 'picomatch' import * as path from 'path' import type { TextDocument } from 'vscode-languageserver-textdocument' import type { State } from '@tailwindcss/language-service/src/util/state' @@ -12,7 +12,7 @@ export default async function isExcluded( let settings = await state.editor.getConfiguration(document.uri) for (let pattern of settings.tailwindCSS.files.exclude) { - if (minimatch(file, path.join(state.editor.folder, pattern))) { + if (picomatch(path.join(state.editor.folder, pattern))(file)) { return true } } diff --git a/packages/vscode-tailwindcss/package.json b/packages/vscode-tailwindcss/package.json index 2a8efe4e..92756c69 100755 --- a/packages/vscode-tailwindcss/package.json +++ b/packages/vscode-tailwindcss/package.json @@ -339,18 +339,19 @@ "devDependencies": { "@tailwindcss/language-server": "*", "@types/braces": "3.0.1", + "@types/picomatch": "^2.3.3", "@types/vscode": "1.65.0", "@vscode/vsce": "2.21.1", - "typescript": "5.3.3", "braces": "3.0.2", "color-name": "1.1.4", "concurrently": "7.0.0", "esbuild": "^0.19.5", - "minimatch": "5.1.4", "minimist": "^1.2.8", "move-file-cli": "3.0.0", "normalize-path": "3.0.0", + "picomatch": "^4.0.1", "rimraf": "3.0.2", + "typescript": "5.3.3", "vscode-languageclient": "8.0.2" } } diff --git a/packages/vscode-tailwindcss/src/extension.ts b/packages/vscode-tailwindcss/src/extension.ts index ad067b61..bf00387a 100755 --- a/packages/vscode-tailwindcss/src/extension.ts +++ b/packages/vscode-tailwindcss/src/extension.ts @@ -41,7 +41,7 @@ import * as semver from '@tailwindcss/language-service/src/util/semver' import isObject from '@tailwindcss/language-service/src/util/isObject' import { dedupe, equal } from '@tailwindcss/language-service/src/util/array' import namedColors from 'color-name' -import minimatch from 'minimatch' +import picomatch from 'picomatch' import { CONFIG_GLOB, CSS_GLOB } from '@tailwindcss/language-server/src/lib/constants' import braces from 'braces' import normalizePath from 'normalize-path' @@ -77,10 +77,10 @@ function getExcludePatterns(scope: ConfigurationScope): string[] { } function isExcluded(file: string, folder: WorkspaceFolder): boolean { - let exclude = getExcludePatterns(folder) + for (let pattern of getExcludePatterns(folder)) { + let matcher = picomatch(path.join(folder.uri.fsPath, pattern)) - for (let pattern of exclude) { - if (minimatch(file, path.join(folder.uri.fsPath, pattern))) { + if (matcher(file)) { return true } } From 0924d911db5f9f503d5fbf47127f344a3213d099 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 19:46:58 -0400 Subject: [PATCH 10/15] Simplify --- packages/tailwindcss-language-server/src/project-locator.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 8ac48a3a..7cd5503a 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -194,13 +194,11 @@ export class ProjectLocator { // Create a map of config paths to metadata let configs = new CacheMap() - let isCssMatcher = picomatch(`**/${CSS_GLOB}`, { dot: true }) + let isCss = picomatch(`**/${CSS_GLOB}`, { dot: true }) // Create a list of entries for each file let entries = files.map((filepath: string): FileEntry => { - let isCss = isCssMatcher(filepath) - - if (isCss) { + if (isCss(filepath)) { return new FileEntry('css', filepath) } From 1d2218de02ae0b6464ac04bb50a7da12f77ca2a9 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 19:29:17 -0400 Subject: [PATCH 11/15] Refactor --- .../src/project-locator.ts | 44 +++++++ .../tailwindcss-language-server/src/tw.ts | 121 +++++++++--------- 2 files changed, 101 insertions(+), 64 deletions(-) diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 7cd5503a..7ff0507b 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -64,9 +64,53 @@ export class ProjectLocator { } } + if (projects.length === 1) { + projects[0].documentSelector.push({ + pattern: normalizePath(path.join(this.base, '**')), + priority: DocumentSelectorPriority.ROOT_DIRECTORY, + }) + } + return projects } + async loadAllFromWorkspace( + configs: [config: string, selectors: string[]][], + ): Promise { + return Promise.all(configs.map((config) => this.loadFromWorkspace(config[0], config[1]))) + } + + private async loadFromWorkspace( + configPath: string, + selectors: string[], + ): Promise { + let config: ConfigEntry = { + type: 'js', + path: configPath, + source: 'js', + entries: [], + content: [], + packageRoot: '', + } + + let tailwind = await this.detectTailwindVersion(config) + + // Look for the package root for the config + config.packageRoot = await getPackageRoot(path.dirname(config.path), this.base) + + return { + config, + folder: this.base, + isUserConfigured: true, + configPath: config.path, + documentSelector: selectors.map((selector) => ({ + priority: DocumentSelectorPriority.USER_CONFIGURED, + pattern: selector, + })), + tailwind, + } + } + private async createProject(config: ConfigEntry): Promise { let tailwind = await this.detectTailwindVersion(config) diff --git a/packages/tailwindcss-language-server/src/tw.ts b/packages/tailwindcss-language-server/src/tw.ts index 9ca3398a..aa79a2bb 100644 --- a/packages/tailwindcss-language-server/src/tw.ts +++ b/packages/tailwindcss-language-server/src/tw.ts @@ -46,6 +46,7 @@ import { createProjectService, type ProjectService, DocumentSelectorPriority } f import { type SettingsCache, createSettingsCache } from './config' import { readCssFile } from './util/css' import { ProjectLocator, type ProjectConfig } from './project-locator' +import type { TailwindCssSettings } from 'tailwindcss-language-service/src/util/state' const TRIGGER_CHARACTERS = [ // class attributes @@ -126,7 +127,6 @@ export class TW { let workspaceFolders: Array = [] let globalSettings = await this.settingsCache.get() let ignore = globalSettings.tailwindCSS.files.exclude - let configFileOrFiles = globalSettings.tailwindCSS.experimental.configFile let cssFileConfigMap: Map = new Map() let configTailwindVersionMap: Map = new Map() @@ -136,79 +136,72 @@ export class TW { ? path.dirname(this.initializeParams.initializationOptions.workspaceFile) : base - if (configFileOrFiles) { - if ( - typeof configFileOrFiles !== 'string' && - (!isObject(configFileOrFiles) || - !Object.entries(configFileOrFiles).every(([key, value]) => { - if (typeof key !== 'string') return false - if (Array.isArray(value)) { - return value.every((item) => typeof item === 'string') - } - return typeof value === 'string' - })) - ) { - console.error('Invalid `experimental.configFile` configuration, not initializing.') - return + function getExplicitConfigFiles(settings: TailwindCssSettings) { + function resolvePathForConfig(filepath: string) { + return normalizePath(path.resolve(userDefinedConfigBase, filepath)) } - let configFiles = - typeof configFileOrFiles === 'string' - ? { [configFileOrFiles]: path.resolve(base, '**') } - : configFileOrFiles - - workspaceFolders = Object.entries(configFiles).map( - ([relativeConfigPath, relativeDocumentSelectorOrSelectors]) => { - let configPath = normalizePath(path.resolve(userDefinedConfigBase, relativeConfigPath)) - - return { - folder: base, - configPath, - config: { - path: configPath, - } as any, - documentSelector: [].concat(relativeDocumentSelectorOrSelectors).map((selector) => ({ - priority: DocumentSelectorPriority.USER_CONFIGURED, - pattern: normalizePath(path.resolve(userDefinedConfigBase, selector)), - })), - isUserConfigured: true, - tailwind: { - version: null, - features: [], - isDefaultVersion: false, - }, - } - }, - ) - } else { - console.log("Searching for Tailwind CSS projects in the workspace's folders.") + let configFileOrFiles = settings.experimental.configFile + let configs: Record = {} - let locator = new ProjectLocator(base, globalSettings) + if (typeof configFileOrFiles === 'string') { + let configFile = resolvePathForConfig(configFileOrFiles) + let docSelectors = [resolvePathForConfig(path.resolve(base, '**'))] - let projects = await locator.search() + configs[configFile] = docSelectors + } else if (isObject(configFileOrFiles)) { + for (let [configFile, selectors] of Object.entries(configFileOrFiles)) { + if (typeof configFile !== 'string') return null + configFile = resolvePathForConfig(configFile) - if (projects.length === 1) { - projects[0].documentSelector.push({ - pattern: normalizePath(path.join(base, '**')), - priority: DocumentSelectorPriority.ROOT_DIRECTORY, - }) - } - - for (let project of projects) { - // Track the Tailwind version for a given config - configTailwindVersionMap.set(project.config.path, project.tailwind.version) + let docSelectors: string[] - if (project.config.source !== 'css') continue + if (typeof selectors === 'string') { + docSelectors = [resolvePathForConfig(selectors)] + } else if (Array.isArray(selectors)) { + docSelectors = selectors.map(resolvePathForConfig) + } else { + return null + } - // Track the config file for a given CSS file - for (let file of project.config.entries) { - if (file.type !== 'css') continue - cssFileConfigMap.set(file.path, project.config.path) + configs[configFile] = docSelectors } + } else if (configFileOrFiles) { + return null } - if (projects.length > 0) { - workspaceFolders = projects + return Object.entries(configs) + } + + let configs = getExplicitConfigFiles(globalSettings.tailwindCSS) + + if (configs === null) { + console.error('Invalid `experimental.configFile` configuration, not initializing.') + return + } + + let locator = new ProjectLocator(base, globalSettings) + + if (configs.length > 0) { + console.log('Loading Tailwind CSS projects from the workspace settings.') + + workspaceFolders = await locator.loadAllFromWorkspace(configs) + } else { + console.log("Searching for Tailwind CSS projects in the workspace's folders.") + + workspaceFolders = await locator.search() + } + + for (let project of workspaceFolders) { + // Track the Tailwind version for a given config + configTailwindVersionMap.set(project.config.path, project.tailwind.version) + + if (project.config.source !== 'css') continue + + // Track the config file for a given CSS file + for (let file of project.config.entries) { + if (file.type !== 'css') continue + cssFileConfigMap.set(file.path, project.config.path) } } From 612ad38c963e4feb478b452c7fa405a2a3c252a2 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Mon, 11 Mar 2024 19:47:45 -0400 Subject: [PATCH 12/15] Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was assigning JS files to a CSS file list. This didn’t have any adverse affects aside from reading more file content to memory than necessary --- packages/tailwindcss-language-server/src/project-locator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index 7ff0507b..b45ecd77 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -246,7 +246,7 @@ export class ProjectLocator { return new FileEntry('css', filepath) } - return new FileEntry('css', filepath, [ + return new FileEntry('js', filepath, [ configs.remember(filepath, () => ({ source: 'js', type: 'js', From 3cd9ce8778ee2a88ee479db9b94e800244224aae Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 13 Mar 2024 14:19:28 -0400 Subject: [PATCH 13/15] Cleanup --- packages/tailwindcss-language-server/src/features.ts | 1 - packages/tailwindcss-language-server/src/project-locator.ts | 2 +- packages/tailwindcss-language-server/src/projects.ts | 2 +- packages/tailwindcss-language-server/tests/common.ts | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 packages/tailwindcss-language-server/src/features.ts diff --git a/packages/tailwindcss-language-server/src/features.ts b/packages/tailwindcss-language-server/src/features.ts deleted file mode 100644 index 50019071..00000000 --- a/packages/tailwindcss-language-server/src/features.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@tailwindcss/language-service/src/features' diff --git a/packages/tailwindcss-language-server/src/project-locator.ts b/packages/tailwindcss-language-server/src/project-locator.ts index b45ecd77..2af52862 100644 --- a/packages/tailwindcss-language-server/src/project-locator.ts +++ b/packages/tailwindcss-language-server/src/project-locator.ts @@ -15,7 +15,7 @@ import { type DocumentSelector, DocumentSelectorPriority } from './projects' import { CacheMap } from './cache-map' import { getPackageRoot } from './util/get-package-root' import resolveFrom from './util/resolveFrom' -import { type Feature, supportedFeatures } from './features' +import { type Feature, supportedFeatures } from '@tailwindcss/language-service/src/features' import { pathToFileURL } from 'node:url' export interface ProjectConfig { diff --git a/packages/tailwindcss-language-server/src/projects.ts b/packages/tailwindcss-language-server/src/projects.ts index 4b2ab272..fc15964f 100644 --- a/packages/tailwindcss-language-server/src/projects.ts +++ b/packages/tailwindcss-language-server/src/projects.ts @@ -74,7 +74,7 @@ import { } from './utils' import type { DocumentService } from './documents' import type { ProjectConfig } from './project-locator' -import { supportedFeatures } from './features' +import { supportedFeatures } from '@tailwindcss/language-service/src/features' import { loadDesignSystem } from './util/v4' import { readCssFile } from './util/css' import { pathToFileURL } from 'url' diff --git a/packages/tailwindcss-language-server/tests/common.ts b/packages/tailwindcss-language-server/tests/common.ts index 28d798c0..16df7b2a 100644 --- a/packages/tailwindcss-language-server/tests/common.ts +++ b/packages/tailwindcss-language-server/tests/common.ts @@ -14,7 +14,7 @@ import { DidOpenTextDocumentParams, } from 'vscode-languageserver-protocol' import type { ClientCapabilities, ProtocolConnection } from 'vscode-languageclient' -import { Feature } from '../src/features' +import type { Feature } from '@tailwindcss/language-service/src/features' type Settings = any From cf42066f8c39394806196d149e5686f9b1d5d7a2 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 13 Mar 2024 14:22:04 -0400 Subject: [PATCH 14/15] Update to latest alpha in fixtures --- .../tests/completions/completions.test.js | 2 +- .../tests/fixtures/v4/basic/package-lock.json | 742 +----------------- .../tests/fixtures/v4/basic/package.json | 2 +- .../v4/multi-config/package-lock.json | 742 +----------------- .../fixtures/v4/multi-config/package.json | 2 +- .../fixtures/v4/workspaces/package-lock.json | 742 +----------------- .../tests/fixtures/v4/workspaces/package.json | 2 +- 7 files changed, 16 insertions(+), 2218 deletions(-) diff --git a/packages/tailwindcss-language-server/tests/completions/completions.test.js b/packages/tailwindcss-language-server/tests/completions/completions.test.js index d31b0af5..2e3de946 100644 --- a/packages/tailwindcss-language-server/tests/completions/completions.test.js +++ b/packages/tailwindcss-language-server/tests/completions/completions.test.js @@ -309,7 +309,7 @@ withFixture('v4/basic', (c) => { let result = await completion({ lang, text, position, settings }) let textEdit = expect.objectContaining({ range: { start: position, end: position } }) - expect(result.items.length).toBe(12089) + expect(result.items.length).toBe(12106) expect(result.items.filter((item) => item.label.endsWith(':')).length).toBe(215) expect(result).toEqual({ isIncomplete: false, diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package-lock.json b/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package-lock.json index b078a488..278a3f89 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package-lock.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package-lock.json @@ -5,747 +5,13 @@ "packages": { "": { "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" - } - }, - "node_modules/@parcel/watcher": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.1.tgz", - "integrity": "sha512-HNjmfLQEVRZmHRET336f20H/8kOozUGwk7yajvsonjNxbj2wBTK1WsQuHkD5yYh9RxFGL2EyDHryOihOwUoKDA==", - "dependencies": { - "detect-libc": "^1.0.3", - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "node-addon-api": "^7.0.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "@parcel/watcher-android-arm64": "2.4.1", - "@parcel/watcher-darwin-arm64": "2.4.1", - "@parcel/watcher-darwin-x64": "2.4.1", - "@parcel/watcher-freebsd-x64": "2.4.1", - "@parcel/watcher-linux-arm-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-musl": "2.4.1", - "@parcel/watcher-linux-x64-glibc": "2.4.1", - "@parcel/watcher-linux-x64-musl": "2.4.1", - "@parcel/watcher-win32-arm64": "2.4.1", - "@parcel/watcher-win32-ia32": "2.4.1", - "@parcel/watcher-win32-x64": "2.4.1" - } - }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", - "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", - "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", - "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", - "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", - "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", - "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", - "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", - "integrity": "sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.4.1.tgz", - "integrity": "sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", - "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", - "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", - "integrity": "sha512-+DvS92F9ezicfswqrvIRM2njcYJbd5mb9CUgtrHCHmvn7pPPa+nMDRu1o1bYYz/l5IB2NVGNJWiH7h1E58IF2A==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/lightningcss": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.0.tgz", - "integrity": "sha512-y36QEEDVx4IM7/yIZNsZJMRREIu26WzTsauIysf5s76YeCmlSbRZS7aC97IGPuoFRnyZ5Wx43OBsQBFB5Ne7ng==", - "dependencies": { - "detect-libc": "^1.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-darwin-arm64": "1.24.0", - "lightningcss-darwin-x64": "1.24.0", - "lightningcss-freebsd-x64": "1.24.0", - "lightningcss-linux-arm-gnueabihf": "1.24.0", - "lightningcss-linux-arm64-gnu": "1.24.0", - "lightningcss-linux-arm64-musl": "1.24.0", - "lightningcss-linux-x64-gnu": "1.24.0", - "lightningcss-linux-x64-musl": "1.24.0", - "lightningcss-win32-x64-msvc": "1.24.0" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.0.tgz", - "integrity": "sha512-rTNPkEiynOu4CfGdd5ZfVOQe2gd2idfQd4EfX1l2ZUUwd+2SwSdbb7cG4rlwfnZckbzCAygm85xkpekRE5/wFw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.0.tgz", - "integrity": "sha512-4KCeF2RJjzp9xdGY8zIH68CUtptEg8uz8PfkHvsIdrP4t9t5CIgfDBhiB8AmuO75N6SofdmZexDZIKdy9vA7Ww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.0.tgz", - "integrity": "sha512-FJAYlek1wXuVTsncNU0C6YD41q126dXcIUm97KAccMn9C4s/JfLSqGWT2gIzAblavPFkyGG2gIADTWp3uWfN1g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.24.0.tgz", - "integrity": "sha512-N55K6JqzMx7C0hYUu1YmWqhkHwzEJlkQRMA6phY65noO0I1LOAvP4wBIoFWrzRE+O6zL0RmXJ2xppqyTbk3sYw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.24.0.tgz", - "integrity": "sha512-MqqUB2TpYtFWeBvvf5KExDdClU3YGLW5bHKs50uKKootcvG9KoS7wYwd5UichS+W3mYLc5yXUPGD1DNWbLiYKw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.24.0.tgz", - "integrity": "sha512-5wn4d9tFwa5bS1ao9mLexYVJdh3nn09HNIipsII6ZF7z9ZA5J4dOEhMgKoeCl891axTGTUYd8Kxn+Hn3XUSYRQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.24.0.tgz", - "integrity": "sha512-3j5MdTh+LSDF3o6uDwRjRUgw4J+IfDCVtdkUrJvKxL79qBLUujXY7CTe5X3IQDDLKEe/3wu49r8JKgxr0MfjbQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.24.0.tgz", - "integrity": "sha512-HI+rNnvaLz0o36z6Ki0gyG5igVGrJmzczxA5fznr6eFTj3cHORoR/j2q8ivMzNFR4UKJDkTWUH5LMhacwOHWBA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.24.0.tgz", - "integrity": "sha512-oeije/t7OZ5N9vSs6amyW/34wIYoBCpE6HUlsSKcP2SR1CVgx9oKEM00GtQmtqNnYiMIfsSm7+ppMb4NLtD5vg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-addon-api": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz", - "integrity": "sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==", - "engines": { - "node": "^16 || ^18 || >= 20" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postcss": { - "version": "8.4.24", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", - "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.6", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-import": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-16.0.1.tgz", - "integrity": "sha512-i2Pci0310NaLHr/5JUFSw1j/8hf1CzwMY13g6ZDxgOavmRHQi2ba3PmUHoihO+sjaum+KmCNzskNsw7JDrg03g==", - "dependencies": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "postcss": "^8.0.0" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" - }, - "node_modules/read-cache": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", - "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dependencies": { - "pify": "^2.3.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "tailwindcss": "^4.0.0-alpha.9" } }, "node_modules/tailwindcss": { - "version": "4.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.1.tgz", - "integrity": "sha512-XUlZ6QgqSXAbLaJXfuCJLfRa8z2Smc+GnlMAnYqbBThIVbg3755compWzK+XuZsDN3pz1ipLCa7VHY6ZPfeRGg==", - "dependencies": { - "@parcel/watcher": "^2.4.1", - "lightningcss": "^1.24.0", - "mri": "^1.2.0", - "picocolors": "^1.0.0", - "postcss": "8.4.24", - "postcss-import": "^16.0.0" - }, - "bin": { - "tailwindcss": "dist/cli.js" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } + "version": "4.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.9.tgz", + "integrity": "sha512-y0fM8FgMWyc/gbzd3Ag3TmNtXSwIC9gLIe7J1g8/KzkApL0UFPYt/T/Z29CbvTYVlPEf/QOSNsGM63qeip9jzw==" } } } diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package.json b/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package.json index 963f733b..4022c163 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/basic/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" + "tailwindcss": "^4.0.0-alpha.9" } } diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package-lock.json b/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package-lock.json index 5aef381a..bcac560c 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package-lock.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package-lock.json @@ -5,747 +5,13 @@ "packages": { "": { "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" - } - }, - "node_modules/@parcel/watcher": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.1.tgz", - "integrity": "sha512-HNjmfLQEVRZmHRET336f20H/8kOozUGwk7yajvsonjNxbj2wBTK1WsQuHkD5yYh9RxFGL2EyDHryOihOwUoKDA==", - "dependencies": { - "detect-libc": "^1.0.3", - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "node-addon-api": "^7.0.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "@parcel/watcher-android-arm64": "2.4.1", - "@parcel/watcher-darwin-arm64": "2.4.1", - "@parcel/watcher-darwin-x64": "2.4.1", - "@parcel/watcher-freebsd-x64": "2.4.1", - "@parcel/watcher-linux-arm-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-musl": "2.4.1", - "@parcel/watcher-linux-x64-glibc": "2.4.1", - "@parcel/watcher-linux-x64-musl": "2.4.1", - "@parcel/watcher-win32-arm64": "2.4.1", - "@parcel/watcher-win32-ia32": "2.4.1", - "@parcel/watcher-win32-x64": "2.4.1" - } - }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", - "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", - "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", - "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", - "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", - "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", - "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", - "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", - "integrity": "sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.4.1.tgz", - "integrity": "sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", - "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", - "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", - "integrity": "sha512-+DvS92F9ezicfswqrvIRM2njcYJbd5mb9CUgtrHCHmvn7pPPa+nMDRu1o1bYYz/l5IB2NVGNJWiH7h1E58IF2A==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/lightningcss": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.0.tgz", - "integrity": "sha512-y36QEEDVx4IM7/yIZNsZJMRREIu26WzTsauIysf5s76YeCmlSbRZS7aC97IGPuoFRnyZ5Wx43OBsQBFB5Ne7ng==", - "dependencies": { - "detect-libc": "^1.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-darwin-arm64": "1.24.0", - "lightningcss-darwin-x64": "1.24.0", - "lightningcss-freebsd-x64": "1.24.0", - "lightningcss-linux-arm-gnueabihf": "1.24.0", - "lightningcss-linux-arm64-gnu": "1.24.0", - "lightningcss-linux-arm64-musl": "1.24.0", - "lightningcss-linux-x64-gnu": "1.24.0", - "lightningcss-linux-x64-musl": "1.24.0", - "lightningcss-win32-x64-msvc": "1.24.0" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.0.tgz", - "integrity": "sha512-rTNPkEiynOu4CfGdd5ZfVOQe2gd2idfQd4EfX1l2ZUUwd+2SwSdbb7cG4rlwfnZckbzCAygm85xkpekRE5/wFw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.0.tgz", - "integrity": "sha512-4KCeF2RJjzp9xdGY8zIH68CUtptEg8uz8PfkHvsIdrP4t9t5CIgfDBhiB8AmuO75N6SofdmZexDZIKdy9vA7Ww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.0.tgz", - "integrity": "sha512-FJAYlek1wXuVTsncNU0C6YD41q126dXcIUm97KAccMn9C4s/JfLSqGWT2gIzAblavPFkyGG2gIADTWp3uWfN1g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.24.0.tgz", - "integrity": "sha512-N55K6JqzMx7C0hYUu1YmWqhkHwzEJlkQRMA6phY65noO0I1LOAvP4wBIoFWrzRE+O6zL0RmXJ2xppqyTbk3sYw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.24.0.tgz", - "integrity": "sha512-MqqUB2TpYtFWeBvvf5KExDdClU3YGLW5bHKs50uKKootcvG9KoS7wYwd5UichS+W3mYLc5yXUPGD1DNWbLiYKw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.24.0.tgz", - "integrity": "sha512-5wn4d9tFwa5bS1ao9mLexYVJdh3nn09HNIipsII6ZF7z9ZA5J4dOEhMgKoeCl891axTGTUYd8Kxn+Hn3XUSYRQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.24.0.tgz", - "integrity": "sha512-3j5MdTh+LSDF3o6uDwRjRUgw4J+IfDCVtdkUrJvKxL79qBLUujXY7CTe5X3IQDDLKEe/3wu49r8JKgxr0MfjbQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.24.0.tgz", - "integrity": "sha512-HI+rNnvaLz0o36z6Ki0gyG5igVGrJmzczxA5fznr6eFTj3cHORoR/j2q8ivMzNFR4UKJDkTWUH5LMhacwOHWBA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.24.0.tgz", - "integrity": "sha512-oeije/t7OZ5N9vSs6amyW/34wIYoBCpE6HUlsSKcP2SR1CVgx9oKEM00GtQmtqNnYiMIfsSm7+ppMb4NLtD5vg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-addon-api": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz", - "integrity": "sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==", - "engines": { - "node": "^16 || ^18 || >= 20" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postcss": { - "version": "8.4.24", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", - "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.6", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-import": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-16.0.1.tgz", - "integrity": "sha512-i2Pci0310NaLHr/5JUFSw1j/8hf1CzwMY13g6ZDxgOavmRHQi2ba3PmUHoihO+sjaum+KmCNzskNsw7JDrg03g==", - "dependencies": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "postcss": "^8.0.0" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" - }, - "node_modules/read-cache": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", - "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dependencies": { - "pify": "^2.3.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "tailwindcss": "^4.0.0-alpha.9" } }, "node_modules/tailwindcss": { - "version": "4.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.1.tgz", - "integrity": "sha512-XUlZ6QgqSXAbLaJXfuCJLfRa8z2Smc+GnlMAnYqbBThIVbg3755compWzK+XuZsDN3pz1ipLCa7VHY6ZPfeRGg==", - "dependencies": { - "@parcel/watcher": "^2.4.1", - "lightningcss": "^1.24.0", - "mri": "^1.2.0", - "picocolors": "^1.0.0", - "postcss": "8.4.24", - "postcss-import": "^16.0.0" - }, - "bin": { - "tailwindcss": "dist/cli.js" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } + "version": "4.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.9.tgz", + "integrity": "sha512-y0fM8FgMWyc/gbzd3Ag3TmNtXSwIC9gLIe7J1g8/KzkApL0UFPYt/T/Z29CbvTYVlPEf/QOSNsGM63qeip9jzw==" } } } diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package.json b/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package.json index 963f733b..4022c163 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/multi-config/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" + "tailwindcss": "^4.0.0-alpha.9" } } diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package-lock.json b/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package-lock.json index 005d08b0..b99a222f 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package-lock.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package-lock.json @@ -8,267 +8,7 @@ "packages/*" ], "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" - } - }, - "node_modules/@parcel/watcher": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.1.tgz", - "integrity": "sha512-HNjmfLQEVRZmHRET336f20H/8kOozUGwk7yajvsonjNxbj2wBTK1WsQuHkD5yYh9RxFGL2EyDHryOihOwUoKDA==", - "dependencies": { - "detect-libc": "^1.0.3", - "is-glob": "^4.0.3", - "micromatch": "^4.0.5", - "node-addon-api": "^7.0.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "@parcel/watcher-android-arm64": "2.4.1", - "@parcel/watcher-darwin-arm64": "2.4.1", - "@parcel/watcher-darwin-x64": "2.4.1", - "@parcel/watcher-freebsd-x64": "2.4.1", - "@parcel/watcher-linux-arm-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-glibc": "2.4.1", - "@parcel/watcher-linux-arm64-musl": "2.4.1", - "@parcel/watcher-linux-x64-glibc": "2.4.1", - "@parcel/watcher-linux-x64-musl": "2.4.1", - "@parcel/watcher-win32-arm64": "2.4.1", - "@parcel/watcher-win32-ia32": "2.4.1", - "@parcel/watcher-win32-x64": "2.4.1" - } - }, - "node_modules/@parcel/watcher-android-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz", - "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.4.1.tgz", - "integrity": "sha512-ln41eihm5YXIY043vBrrHfn94SIBlqOWmoROhsMVTSXGh0QahKGy77tfEywQ7v3NywyxBBkGIfrWRHm0hsKtzA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.4.1.tgz", - "integrity": "sha512-yrw81BRLjjtHyDu7J61oPuSoeYWR3lDElcPGJyOvIXmor6DEo7/G2u1o7I38cwlcoBHQFULqF6nesIX3tsEXMg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.4.1.tgz", - "integrity": "sha512-TJa3Pex/gX3CWIx/Co8k+ykNdDCLx+TuZj3f3h7eOjgpdKM+Mnix37RYsYU4LHhiYJz3DK5nFCCra81p6g050w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.4.1.tgz", - "integrity": "sha512-4rVYDlsMEYfa537BRXxJ5UF4ddNwnr2/1O4MHM5PjI9cvV2qymvhwZSFgXqbS8YoTk5i/JR0L0JDs69BUn45YA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.4.1.tgz", - "integrity": "sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.4.1.tgz", - "integrity": "sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.4.1.tgz", - "integrity": "sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.4.1.tgz", - "integrity": "sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.4.1.tgz", - "integrity": "sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.4.1.tgz", - "integrity": "sha512-maNRit5QQV2kgHFSYwftmPBxiuK5u4DXjbXx7q6eKjq5dsLXZ4FJiVvlcw35QXzk0KrUecJmuVFbj4uV9oYrcw==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/watcher-win32-x64": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.4.1.tgz", - "integrity": "sha512-+DvS92F9ezicfswqrvIRM2njcYJbd5mb9CUgtrHCHmvn7pPPa+nMDRu1o1bYYz/l5IB2NVGNJWiH7h1E58IF2A==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "tailwindcss": "^4.0.0-alpha.9" } }, "node_modules/@private/admin": { @@ -283,484 +23,10 @@ "resolved": "packages/web", "link": true }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/lightningcss": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.24.0.tgz", - "integrity": "sha512-y36QEEDVx4IM7/yIZNsZJMRREIu26WzTsauIysf5s76YeCmlSbRZS7aC97IGPuoFRnyZ5Wx43OBsQBFB5Ne7ng==", - "dependencies": { - "detect-libc": "^1.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-darwin-arm64": "1.24.0", - "lightningcss-darwin-x64": "1.24.0", - "lightningcss-freebsd-x64": "1.24.0", - "lightningcss-linux-arm-gnueabihf": "1.24.0", - "lightningcss-linux-arm64-gnu": "1.24.0", - "lightningcss-linux-arm64-musl": "1.24.0", - "lightningcss-linux-x64-gnu": "1.24.0", - "lightningcss-linux-x64-musl": "1.24.0", - "lightningcss-win32-x64-msvc": "1.24.0" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.24.0.tgz", - "integrity": "sha512-rTNPkEiynOu4CfGdd5ZfVOQe2gd2idfQd4EfX1l2ZUUwd+2SwSdbb7cG4rlwfnZckbzCAygm85xkpekRE5/wFw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.24.0.tgz", - "integrity": "sha512-4KCeF2RJjzp9xdGY8zIH68CUtptEg8uz8PfkHvsIdrP4t9t5CIgfDBhiB8AmuO75N6SofdmZexDZIKdy9vA7Ww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.24.0.tgz", - "integrity": "sha512-FJAYlek1wXuVTsncNU0C6YD41q126dXcIUm97KAccMn9C4s/JfLSqGWT2gIzAblavPFkyGG2gIADTWp3uWfN1g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.24.0.tgz", - "integrity": "sha512-N55K6JqzMx7C0hYUu1YmWqhkHwzEJlkQRMA6phY65noO0I1LOAvP4wBIoFWrzRE+O6zL0RmXJ2xppqyTbk3sYw==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.24.0.tgz", - "integrity": "sha512-MqqUB2TpYtFWeBvvf5KExDdClU3YGLW5bHKs50uKKootcvG9KoS7wYwd5UichS+W3mYLc5yXUPGD1DNWbLiYKw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.24.0.tgz", - "integrity": "sha512-5wn4d9tFwa5bS1ao9mLexYVJdh3nn09HNIipsII6ZF7z9ZA5J4dOEhMgKoeCl891axTGTUYd8Kxn+Hn3XUSYRQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.24.0.tgz", - "integrity": "sha512-3j5MdTh+LSDF3o6uDwRjRUgw4J+IfDCVtdkUrJvKxL79qBLUujXY7CTe5X3IQDDLKEe/3wu49r8JKgxr0MfjbQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.24.0.tgz", - "integrity": "sha512-HI+rNnvaLz0o36z6Ki0gyG5igVGrJmzczxA5fznr6eFTj3cHORoR/j2q8ivMzNFR4UKJDkTWUH5LMhacwOHWBA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.24.0.tgz", - "integrity": "sha512-oeije/t7OZ5N9vSs6amyW/34wIYoBCpE6HUlsSKcP2SR1CVgx9oKEM00GtQmtqNnYiMIfsSm7+ppMb4NLtD5vg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-addon-api": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz", - "integrity": "sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==", - "engines": { - "node": "^16 || ^18 || >= 20" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postcss": { - "version": "8.4.24", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", - "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.6", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/postcss-import": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-16.0.1.tgz", - "integrity": "sha512-i2Pci0310NaLHr/5JUFSw1j/8hf1CzwMY13g6ZDxgOavmRHQi2ba3PmUHoihO+sjaum+KmCNzskNsw7JDrg03g==", - "dependencies": { - "postcss-value-parser": "^4.0.0", - "read-cache": "^1.0.0", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "postcss": "^8.0.0" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" - }, - "node_modules/read-cache": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", - "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", - "dependencies": { - "pify": "^2.3.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/tailwindcss": { - "version": "4.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.1.tgz", - "integrity": "sha512-XUlZ6QgqSXAbLaJXfuCJLfRa8z2Smc+GnlMAnYqbBThIVbg3755compWzK+XuZsDN3pz1ipLCa7VHY6ZPfeRGg==", - "dependencies": { - "@parcel/watcher": "^2.4.1", - "lightningcss": "^1.24.0", - "mri": "^1.2.0", - "picocolors": "^1.0.0", - "postcss": "8.4.24", - "postcss-import": "^16.0.0" - }, - "bin": { - "tailwindcss": "dist/cli.js" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } + "version": "4.0.0-alpha.9", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.0.0-alpha.9.tgz", + "integrity": "sha512-y0fM8FgMWyc/gbzd3Ag3TmNtXSwIC9gLIe7J1g8/KzkApL0UFPYt/T/Z29CbvTYVlPEf/QOSNsGM63qeip9jzw==" }, "packages/admin": { "name": "@private/admin" diff --git a/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package.json b/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package.json index 3307c055..0d52e191 100644 --- a/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package.json +++ b/packages/tailwindcss-language-server/tests/fixtures/v4/workspaces/package.json @@ -3,6 +3,6 @@ "packages/*" ], "dependencies": { - "tailwindcss": "^4.0.0-alpha.1" + "tailwindcss": "^4.0.0-alpha.9" } } From 1a9202b24ae401d81576bfa753404ae67a34e2a2 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 13 Mar 2024 14:24:14 -0400 Subject: [PATCH 15/15] Cleanup code --- .../src/util/v4/design-system.ts | 14 -------------- .../tailwindcss-language-service/src/util/color.ts | 7 ------- .../src/util/v4/design-system.ts | 1 - 3 files changed, 22 deletions(-) diff --git a/packages/tailwindcss-language-server/src/util/v4/design-system.ts b/packages/tailwindcss-language-server/src/util/v4/design-system.ts index 325f0f0a..d3d27ecb 100644 --- a/packages/tailwindcss-language-server/src/util/v4/design-system.ts +++ b/packages/tailwindcss-language-server/src/util/v4/design-system.ts @@ -43,23 +43,9 @@ export async function loadDesignSystem( // Step 4: Augment the design system with some additional APIs that the LSP needs Object.assign(design, { - optimizeCss(css: string) { - return tailwindcss.optimizeCss(css) - }, - compile(classes: string[]): (postcss.Root | null)[] { let css = design.candidatesToCss(classes) - // Downlevel syntax - // TODO: Either don't downlevel nesting or make `recordClassDetails` more robust - // css = css.map((str) => { - // if (!str) return null - // try { - // return tailwindcss.optimizeCss(str) - // } catch {} - // return str - // }) - let roots = css.map((str) => { if (str === null) return postcss.root() diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts index a7db29f1..6cb81ad0 100644 --- a/packages/tailwindcss-language-service/src/util/color.ts +++ b/packages/tailwindcss-language-service/src/util/color.ts @@ -142,13 +142,6 @@ function getColorFromRoot(state: State, css: postcss.Root): culori.Color | Keywo rule.append(decl.clone()) }) - // Optimize the CSS if possible - // try { - // let str = state.designSystem.toCss(css) - // str = state.designSystem.optimizeCss(str) - // css = postcss.parse(str) - // } catch {} - css.walkDecls((decl) => { decls[decl.prop] ??= [] decls[decl.prop].push(decl.value) diff --git a/packages/tailwindcss-language-service/src/util/v4/design-system.ts b/packages/tailwindcss-language-service/src/util/v4/design-system.ts index 36cae143..0f47d30c 100644 --- a/packages/tailwindcss-language-service/src/util/v4/design-system.ts +++ b/packages/tailwindcss-language-service/src/util/v4/design-system.ts @@ -33,5 +33,4 @@ export interface DesignSystem { export interface DesignSystem { compile(classes: string[]): postcss.Root[] toCss(nodes: postcss.Root | postcss.Node[]): string - optimizeCss(css: string): string }