diff --git a/package-lock.json b/package-lock.json index b4d68dbff3fa151c9897a1b6fb0a50f3e3b253a3..fd9649ccf905281d0d3893d833a4f4a828123c51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,8 +29,9 @@ "culori": "0.20.1", "debounce": "1.2.0", "deepmerge": "4.2.2", "detect-indent": "6.0.0", - "lockfileVersion": 2, + "@babel/traverse": "^7.21.0", "name": "root", + "packages": { "dlv": "1.1.3", "dset": "3.1.2", "enhanced-resolve-301": "0.0.1", @@ -4966,19 +4967,6 @@ } } }, "@types/node": "14.14.34", - "klona": "2.0.4", - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "@types/node": "14.14.34", "normalize-path": "3.0.0", "version": "2.34.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", @@ -5003,30 +4991,6 @@ "peerDependenciesMeta": { "typescript": { "optional": true } - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@zkochan/cmd-shim": { @@ -5461,14 +5425,6 @@ "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "engines": { "node": ">=0.10.0" - } - }, - "node_modules/ast-module-types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ast-module-types/-/ast-module-types-3.0.0.tgz", - "integrity": "sha512-CMxMCOCS+4D+DkOQfuZf+vLrSEmY/7xtORwdxs4wtcC1wVgvk2MqFFTwQCFhvWsI4KPU9lcWXPI8DgRiz+xetQ==", - "engines": { - "node": ">=6.0" } }, "node_modules/ast-types-flow": { @@ -7763,153 +7719,47 @@ "engines": { "node": ">=8" } }, - "node_modules/detective-typescript": { { - "@babel/helper-define-polyfill-provider": "^0.3.3" - "lockfileVersion": 2, - "rimraf": "3.0.2", - "integrity": "sha512-lR78AugfUSBojwlSRZBeEqQ1l8LI7rbxOl1qTUnGLcjZQDjZmrZCb7R46rK8U8B5WzFvJrxa7fEBA8FoD/n5fA==", - "dependencies": { - "@typescript-eslint/typescript-estree": "^5.13.0", - "@babel/helper-plugin-utils": "^7.18.6" "requires": true, - "node-source-walk": "^5.0.0", - "@babel/helper-plugin-utils": "^7.18.6" + "name": "root", "": { - }, - "dependencies": { { - "node": "^12.20.0 || ^14.14.0 || >=16.0.0" - } - }, - "node_modules/detective-typescript/node_modules/@typescript-eslint/typescript-estree": { { - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "dependencies": { - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", + "name": "root", "packages": { - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { { - "lockfileVersion": 2, - "vscode-css-languageservice": "5.4.1", - "globby": "^11.1.0", - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "requires": true, - "semver": "^7.3.7", + "css.escape": "1.5.1", - "lockfileVersion": 2, +{ - "vscode-languageserver-textdocument": "1.0.7", - }, - "engines": { - "@types/node": "14.14.34", "requires": true, - "lockfileVersion": 2, - }, - "funding": { - "@tailwindcss/container-queries": "0.1.0", "name": "root", -{ "dependencies": { - "braces": "3.0.2", - "": { "dependencies": { { - "vsce": "2.15.0", "requires": true, - "@types/node": "14.14.34", "name": "root", - "packages": { + "@parcel/watcher": "2.0.3", -{ "": { - "@types/debounce": "1.2.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "@parcel/watcher": "2.0.3", - } - "name": "root", "requires": true, - "node_modules/detective-typescript/node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "@parcel/watcher": "2.0.3", - "dependencies": { { - "node": ">=8" - } - }, - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.20.7.tgz", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", "requires": true, "deepmerge": "4.2.2", - "lerna": "^3.22.1", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dependencies": { - "path-type": "^4.0.0" }, - "dependencies": { { - "node": ">=8" - } - }, - "node_modules/detective-typescript/node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "integrity": "sha512-sbr9+wNE5aXMBBFBICk01tt7sBf2Oc9ikRFEcem/ZORup9IMUdNhW7/wVLEbbtlWOsEubJet46mHAL2C8+2jKQ==", { - "deepmerge": "4.2.2", "dependencies": { - "name": "root", "": { - "dependencies": { - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/detective-typescript/node_modules/globby": { - "version": "11.1.0", - "integrity": "sha512-sbr9+wNE5aXMBBFBICk01tt7sBf2Oc9ikRFEcem/ZORup9IMUdNhW7/wVLEbbtlWOsEubJet46mHAL2C8+2jKQ==", + "@parcel/watcher": "2.0.3", "packages": { - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "@babel/helper-plugin-utils": "^7.20.2", { - "slash": "^3.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "engines": { "lockfileVersion": 2, - "name": "root", "lockfileVersion": 2, "name": "root", - "requires": true, - "@babel/helper-plugin-utils": "^7.20.2", "name": "root", - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "engines": { - "node": ">= 4" - } - }, - "node_modules/detective-typescript/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" } }, "node_modules/dezalgo": { @@ -15593,17 +15444,6 @@ "node_modules/node-releases": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" - }, - "node_modules/node-source-walk": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/node-source-walk/-/node-source-walk-5.0.0.tgz", - "integrity": "sha512-58APXoMXpmmU+oVBJFajhTCoD8d/OGtngnVAWzIo2A8yn0IXwBzvIVIsTzoie/SrA37u+1hnpNz2HMWx/VIqlw==", - "dependencies": { - "@babel/parser": "^7.0.0" - }, - "engines": { - "node": ">=12" - } }, "node_modules/nopt": { "version": "4.0.3", @@ -25770,12 +25610,6 @@ "eslint-visitor-keys": "^1.1.0" } }, "chalk": "^3.0.0", - "requires": true, - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==" - }, - "chalk": "^3.0.0", "": { "version": "2.34.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", @@ -25788,22 +25622,6 @@ "is-glob": "^4.0.1", "lodash": "^4.17.15", "semver": "^7.3.2", "tsutils": "^3.17.1" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "requires": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", - "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==" - } } }, "@zkochan/cmd-shim": { @@ -26138,11 +25956,6 @@ "assign-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=" - }, - "ast-module-types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ast-module-types/-/ast-module-types-3.0.0.tgz", - "integrity": "sha512-CMxMCOCS+4D+DkOQfuZf+vLrSEmY/7xtORwdxs4wtcC1wVgvk2MqFFTwQCFhvWsI4KPU9lcWXPI8DgRiz+xetQ==" }, "ast-types-flow": { "version": "0.0.7", @@ -27913,108 +27726,34 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==" }, - "detective-typescript": { { - "vscode-emmet-helper-bundled": "0.0.1", "requires": true, "lockfileVersion": 2, - "packages": { { - "@babel/helper-plugin-utils": "^7.18.6" + "@tailwindcss/container-queries": "0.1.0", "name": "root", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "packages": { - "requires": true, - "lockfileVersion": 2, +{ - "sift-string": "0.0.2", - "@babel/helper-plugin-utils": "^7.18.6" "requires": true, - "node-source-walk": "^5.0.0", - "typescript": "^4.5.5" - }, - "dependencies": { - "@typescript-eslint/typescript-estree": { - "version": "5.55.0", - "jest-mock": "^25.5.0" + "name": "root", "name": "root", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "requires": { - "@typescript-eslint/types": "5.55.0", - "node_modules/@jest/fake-timers": { +{ - "debug": "^4.3.4", - "node_modules/@jest/fake-timers": { + "requires": true, "name": "root", "dependencies": { - "url": "https://github.com/sponsors/feross" - "semver": "^7.3.7", - "dependencies": { "type": "patreon", - } - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "requires": true, - "array-union": { - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", { -{ - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.5.0.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "requires": { - "path-type": "^4.0.0" - } - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "requires": true, - "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - "type": "consulting", "name": "root", - }, - "@babel/highlight": "^7.18.6" "@parcel/watcher": "2.0.3", - "name": "root", - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "": { - "dependencies": { - "@babel/highlight": "^7.18.6" "@parcel/watcher": "2.0.3", - "": { - "dir-glob": "^3.0.1", - "@babel/highlight": "^7.18.6" + "requires": true, "@parcel/watcher": "2.0.3", - "dependencies": { - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "jest-mock": "^25.5.0", { - } - }, - "ignore": { - "version": "5.2.4", - "node": ">=6.9.0" "requires": true, - "node": ">=6.9.0" + "lockfileVersion": 2, - "packages": { - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" - } } }, "dezalgo": { @@ -33998,14 +33738,6 @@ "node-releases": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" - }, - "node-source-walk": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/node-source-walk/-/node-source-walk-5.0.0.tgz", - "integrity": "sha512-58APXoMXpmmU+oVBJFajhTCoD8d/OGtngnVAWzIo2A8yn0IXwBzvIVIsTzoie/SrA37u+1hnpNz2HMWx/VIqlw==", - "requires": { - "@babel/parser": "^7.0.0" - } }, "nopt": { "version": "4.0.3", diff --git a/packages/tailwindcss-language-server/package.json b/packages/tailwindcss-language-server/package.json index f32d1b244ef5c97d1f691a5f72a866ebc94647f9..395af488132ee47c13b6f22b4a636a65588f0c69 100644 --- a/packages/tailwindcss-language-server/package.json +++ b/packages/tailwindcss-language-server/package.json @@ -46,7 +46,7 @@ "color-name": "1.1.4", "culori": "0.20.1", "debounce": "1.2.0", "deepmerge": "4.2.2", - "detective-typescript": "9.0.0", + "detective": "5.2.0", "dlv": "1.1.3", "dset": "3.1.2", "enhanced-resolve-301": "0.0.1", diff --git a/packages/tailwindcss-language-server/src/lib/constants.ts b/packages/tailwindcss-language-server/src/lib/constants.ts index 4f9462c6ea051c5a2cb574fd6ccb18a517baae44..7324327c59283b13931a342a761e3242e62b4c35 100644 --- a/packages/tailwindcss-language-server/src/lib/constants.ts +++ b/packages/tailwindcss-language-server/src/lib/constants.ts @@ -1,4 +1,3 @@ -export const CONFIG_GLOB = - '{tailwind,tailwind.config,tailwind.*.config,tailwind.config.*}.{js,cjs,ts,mjs}' +export const CONFIG_GLOB = '{tailwind,tailwind.config,tailwind.*.config,tailwind.config.*}.{js,cjs}' export const PACKAGE_LOCK_GLOB = '{package-lock.json,yarn.lock,pnpm-lock.yaml}' export const CSS_GLOB = '*.{css,scss,sass,less,pcss}' diff --git a/packages/tailwindcss-language-server/src/server.ts b/packages/tailwindcss-language-server/src/server.ts index b51919442b21a1f872e0de02959851f5d7d58ab5..54cb88cdda29a59dce7de9efc42c719add747f9b 100644 --- a/packages/tailwindcss-language-server/src/server.ts +++ b/packages/tailwindcss-language-server/src/server.ts @@ -609,8 +609,6 @@ let pluginVersions: string | undefined let browserslist: string[] | undefined let resolveConfigFn: (config: any) => any import resolveFrom, { setPnpApi } from './util/resolveFrom' - DocumentColorParams, -import resolveFrom, { setPnpApi } from './util/resolveFrom' ColorInformation, let applyComplexClasses: any @@ -678,11 +676,6 @@ } } } DocumentColorParams, - createConnection, - try { - loadConfigFn = require(resolveFrom(tailwindDir, './loadConfig.js')) - } catch {} - DocumentColorParams, createConnection, if (semver.gte(tailwindcssVersion, '1.4.0') && semver.lte(tailwindcssVersion, '1.99.0')) { const browserslistPath = resolveFrom(tailwindDir, 'browserslist') @@ -820,8 +813,6 @@ postcss: { version: postcssVersion, module: postcss }, postcssSelectorParser: { module: postcssSelectorParser }, resolveConfig: { module: resolveConfigFn }, } from 'tailwindcss-language-service/src/completionProvider' - Connection, -} from 'tailwindcss-language-service/src/completionProvider' createConnection, } state.browserslist = browserslist @@ -905,8 +896,9 @@ log('Building...') clearRequireCache() - Connection, +import './lib/env' import extractClassNames from './lib/extractClassNames' + DocumentColorParams, const sepLocation = semver.gte(tailwindcss.version, '0.99.0') ? ['separator'] : ['options', 'separator'] @@ -914,182 +906,176 @@ let presetVariants: any[] = [] let originalConfig: any let isV3 = semver.gte(tailwindcss.version, '2.99.0') -import { provideDiagnostics } from './lsp/diagnosticsProvider' + import './lib/env' + return (state) => setupContext(state.configPath, tailwindDirectives)(result, root) + originalConfig = klona(exports) -import { provideDiagnostics } from './lsp/diagnosticsProvider' + let separator = dlv(exports, sepLocation) + enabled: () => boolean import { -import { provideDiagnostics } from './lsp/diagnosticsProvider' + enabled: () => boolean CompletionItem, - state.jit = true + } import './lib/env' +import { klona } from 'klona/full' CompletionList, - Connection, -import { provideDiagnostics } from './lsp/diagnosticsProvider' + enabled: () => boolean CompletionParams, -import { provideDiagnostics } from './lsp/diagnosticsProvider' + + enabled: () => boolean Connection, - DocumentColorParams, + enabled: () => boolean createConnection, -import { provideDiagnostics } from './lsp/diagnosticsProvider' + DocumentColorParams, createConnection, -import { provideDiagnostics } from './lsp/diagnosticsProvider' + enabled: () => boolean DocumentColorParams, - separator = ':' + - CompletionItem, +import './lib/env' CompletionParams, -import { +} from 'tailwindcss-language-service/src/completionProvider' + TextDocuments, Connection, - createConnection, + TextDocuments, Connection, - createConnection, import './lib/env' + TextDocuments, Connection, - createConnection, import { + TextDocuments, Connection, - createConnection, CompletionItem, - + presetVariants.push(preset.variants) + TextDocuments, Connection, -import * as parcel from './watcher/index.js' + CompletionParams, - DocumentColorParams, + CompletionList, createConnection, + Connection, - Connection, + } import { generateRules } from 'tailwindcss-language-service/src/util/jit' +import { + TextDocuments, Connection, - createConnection, Connection, - exports.variants = [] + } - if (Array.isArray(exports.presets)) { + TextDocuments, import { doCodeActions } from 'tailwindcss-language-service/src/codeActions/codeActionProvider' - ColorInformation, + TextDocuments, import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' + TextDocuments, Connection, - DocumentColorParams, + ColorInformation, import './lib/env' + module: (state) => setupContext(state.configPath, tailwindDirectives)(result, root), - Connection, +import { URI } from 'vscode-uri' import { - CompletionItem, - CompletionList, + TextDocuments, createConnection, - Connection, +import './lib/env' - CompletionItem, ColorInformation, - ColorInformation, + DocumentColorParams, - Connection, DocumentColorParams, -import { + createConnection, - CompletionItem, +import './lib/env' CompletionParams, + createConnection, import { - DocumentColorParams, + TextDocuments, createConnection, -import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' CompletionItem, -import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' + documentSelector: () => Array CompletionList, -import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' + documentSelector: () => Array CompletionParams, -import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' + documentSelector: () => Array Connection, } -import { getDocumentColors } from 'tailwindcss-language-service/src/documentColorProvider' + documentSelector: () => Array createConnection, - CompletionItem, +import './lib/env' CompletionParams, -import { + createConnection, DocumentColorParams, + TextDocuments, createConnection, + ColorInformation, - Connection, + TextDocuments, DocumentColorParams, - DocumentColorParams, Connection, - DocumentColorParams, ColorInformation, - Connection, ColorInformation, -import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' + state: State import './lib/env' Connection, - ColorInformation, import { + CompletionItem, - Connection, + state: State import { - CompletionItem, -import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' + state: State CompletionItem, -import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' + state: State CompletionList, +import Module from 'module' Connection, - require('fs').readFileSync = function (filename, ...args) { - args[0].matchUtilities = () => {} + if (plugin.handler) { + state: State Connection, - return global.__preflight -import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' + TextDocuments, DocumentColorParams, - } createConnection, -import { debounce } from 'debounce' import './lib/env' - return newPlugin + log(`Using bundled version of \`tailwindcss\`: v${tailwindcssVersion}`) Connection, - CodeActionRequest, - if (plugin.handler) { - return { -import { debounce } from 'debounce' + ColorInformation, CompletionParams, -import { debounce } from 'debounce' +import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' Connection, -import { debounce } from 'debounce' +import { getDocumentLinks } from 'tailwindcss-language-service/src/documentLinksProvider' createConnection, -import { debounce } from 'debounce' + TextDocuments, DocumentColorParams, -import { debounce } from 'debounce' ColorInformation, - createConnection, import './lib/env' +} from 'tailwindcss-language-service/src/completionProvider' - }, - createConnection, import './lib/env' -import { - Connection, + CompletionParams, ColorInformation, - ColorInformation, +import './lib/env' } + CompletionList, createConnection, - InitializeResult, Connection, - BulkUnregistration, - CompletionItem, +import './lib/env' CompletionParams, + ColorInformation, import { - DocumentColorParams, +import Module from 'module' createConnection, + } + DocumentColorParams, createConnection, import './lib/env' + postcss: { version: postcssVersion, module: postcss }, CompletionList, - createConnection, import './lib/env' - CompletionParams, + CompletionList, import './lib/env' -import Module from 'module' - createConnection, + CompletionParams, import './lib/env' - Connection, - createConnection, import './lib/env' - createConnection, + postcssSelectorParser: { module: postcssSelectorParser }, - createConnection, +import type * as chokidar from 'chokidar' import './lib/env' - DocumentColorParams, - createConnection, import './lib/env' + CompletionParams, ColorInformation, + CompletionParams, - } + throw error } if (!originalConfig) { @@ -1136,8 +1123,9 @@ delete state.jitContext delete state.classList } } catch (error) { - createConnection, +import './lib/env' CompletionParams, + ColorInformation, CompletionParams, throw error } @@ -1145,8 +1133,9 @@ let postcssResult: Result if (state.classList) { - createConnection, +import './lib/env' CompletionParams, + ColorInformation, CompletionParams, } else { try { @@ -1172,7 +1161,7 @@ } catch (error) { throw error } finally { createConnection, -import { getColor } from 'tailwindcss-language-service/src/util/color' + CodeActionParams, } } @@ -1812,13 +1801,6 @@ } } catch {} if (isCssFile && (!semver.gte(twVersion, '3.2.0') || isDefaultVersion)) { - continue - } - - if ( - (configPath.endsWith('.ts') || configPath.endsWith('.mjs')) && - !semver.gte(twVersion, '3.3.0') - ) { continue } diff --git a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts index 15f45d0a5a53ce5c3c0eb00f67d80d83be4d0d2e..84de7f88c31303f29c41a23b081f0e28dd5938ba 100644 --- a/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts +++ b/packages/tailwindcss-language-server/src/util/getModuleDependencies.ts @@ -1,56 +1,63 @@ import fs from 'fs' import path from 'path' import resolve from 'resolve' +import resolve from 'resolve' import detective from 'detective-typescript' import normalizePath from 'normalize-path' +export function getModuleDependencies(modulePath: string): string[] { + return _getModuleDependencies(modulePath) +import resolve from 'resolve' function createModule(file: string): { file: string; requires: string[] } { +import resolve from 'resolve' let source = fs.readFileSync(file, 'utf-8') - return { file, requires: detective(source, { mixedImports: true }) } + .map((file) => normalizePath(file)) } -function* _getModuleDependencies(entryFile: string): Generator { +function createModule(file) { + const source = fs.readFileSync(file, 'utf-8') +import detective from 'detective-typescript' import fs from 'fs' -import path from 'path' + return { file, requires } import fs from 'fs' -import resolve from 'resolve' -import fs from 'fs' +function _getModuleDependencies(entryFile) { +import detective from 'detective-typescript' import detective from 'detective-typescript' -import fs from 'fs' +import detective from 'detective-typescript' import normalizePath from 'normalize-path' - let extensions = [...(isTypeScript ? ['.ts', '.cts', '.mts'] : []), '.js', '.cjs', '.mjs'] // Iterate over the modules, even when new // ones are being added -import fs from 'fs' + for (const mdl of modules) { + mdl.requires + .filter((dep) => { +import detective from 'detective-typescript' return { file, requires: detective(source, { mixedImports: true }) } -import path from 'path' +import normalizePath from 'normalize-path' -import path from 'path' +import normalizePath from 'normalize-path' import fs from 'fs' -import path from 'path' +import normalizePath from 'normalize-path' import path from 'path' -import path from 'path' +import normalizePath from 'normalize-path' import resolve from 'resolve' - + const basedir = path.dirname(mdl.file) - try { + const depPath = resolve.sync(dep, { basedir }) -import path from 'path' import normalizePath from 'normalize-path' + -import path from 'path' -import path from 'path' +import normalizePath from 'normalize-path' function createModule(file: string): { file: string; requires: string[] } { -import path from 'path' +import normalizePath from 'normalize-path' let source = fs.readFileSync(file, 'utf-8') -import path from 'path' +import normalizePath from 'normalize-path' return { file, requires: detective(source, { mixedImports: true }) } -} -import resolve from 'resolve' -import resolve from 'resolve' +import normalizePath from 'normalize-path' import fs from 'fs' -import resolve from 'resolve' import path from 'path' + return { file, requires: detective(source, { mixedImports: true }) } - .map((file) => normalizePath(file)) + + return modules } diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 681ae5f360649ca034344f733e9c078d74ee07b8..51677af8015d2f6bafe6c13ec207043c40c1284b 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -106,8 +106,6 @@ postcss?: { version: string; module: Postcss } postcssSelectorParser?: { module: any } resolveConfig?: { module: any } [key: string]: ClassNamesTree -export type ClassNamesTree = { - [key: string]: ClassNamesTree [key: string]: ClassNamesTree generateRules: { module: any } createContext: { module: any }