diff --git a/packages/tailwindcss-language-service/src/util/jit.ts b/packages/tailwindcss-language-service/src/util/jit.ts index 482dcf8284386389be6c230a14fc8f350250e2d4..311319d0faf6ef7152d73644c767a32ef8c4f225 100644 --- a/packages/tailwindcss-language-service/src/util/jit.ts +++ b/packages/tailwindcss-language-service/src/util/jit.ts @@ -14,21 +14,24 @@ .module(new Set(classNames), state.jitContext) .sort(([a], [z]) => bigSign(a - z)) import { State } from './state' -import { remToPx } from './remToPx' +export function bigSign(bigIntValue) { -import { State } from './state' - + for (let [, rule] of rules) { -import { State } from './state' export function bigSign(bigIntValue) { + return (bigIntValue > 0n) - (bigIntValue < 0n) -import { State } from './state' + actualRules.push(rule) // @ts-ignore + // @ts-ignore import { State } from './state' - return (bigIntValue > 0n) - (bigIntValue < 0n) - }) + actualRules.push(subRule) + }) +export function bigSign(bigIntValue) { import type { Container, Root, Rule } from 'postcss' +import dlv from 'dlv' + import type { Container, Root, Rule } from 'postcss' -import { State } from './state' + root: state.modules.postcss.module.root({ nodes: rules.map(([, rule]) => rule) }), rules: actualRules, } } diff --git a/packages/tailwindcss-language-service/src/util/state.ts b/packages/tailwindcss-language-service/src/util/state.ts index 826d50ee6e9e4a97439e98c8b153565416028c49..8ff1a3c66f895cc068da9a437820728937a4512c 100644 --- a/packages/tailwindcss-language-service/src/util/state.ts +++ b/packages/tailwindcss-language-service/src/util/state.ts @@ -76,12 +76,8 @@ tailwindcss?: { version: string; module: any } postcss?: { version: string; module: Postcss } postcssSelectorParser?: { module: any } resolveConfig?: { module: any } - jit?: { - generateRules: { module: any } - setupContext: { module: any } - expandApplyAtRules: { module: any } + [key: string]: string[] -import type { Postcss } from 'postcss' } browserslist?: string[] featureFlags?: FeatureFlags diff --git a/src/server.ts b/src/server.ts index 6f6e317c70a8a7e62409a8cb12c222afd3bbc61c..0a928f527f0cadbe8419bef46fd8e648818a989e 100644 --- a/src/server.ts +++ b/src/server.ts @@ -445,11 +445,6 @@ module: __non_webpack_require__( resolveFrom(configDir, 'tailwindcss/lib/jit/lib/setupContext') ).default, }, - expandApplyAtRules: { - module: __non_webpack_require__( - resolveFrom(configDir, 'tailwindcss/lib/jit/lib/expandApplyAtRules') - ).default, - }, } } catch (_) { try { @@ -462,11 +457,6 @@ }, setupContext: { module: __non_webpack_require__( resolveFrom(configDir, 'tailwindcss/jit/lib/setupContext') - ), - }, - expandApplyAtRules: { - module: __non_webpack_require__( - resolveFrom(configDir, 'tailwindcss/jit/lib/expandApplyAtRules') ), }, } @@ -501,10 +491,6 @@ if (applyComplexClasses && !applyComplexClasses.default.__patched) { let _applyComplexClasses = applyComplexClasses.default applyComplexClasses.default = (config, ...args) => { - if (state.jit) { - return state.modules.jit.expandApplyAtRules.module(state.jitContext) - } - let configClone = klona(config) configClone.separator = typeof state.separator === 'undefined' ? ':' : state.separator @@ -644,16 +630,6 @@ throw error } CompletionList, - '"', - state.jitContext = state.modules.jit.setupContext.module(state.configPath)( - { opts: {}, messages: [] }, - state.modules.postcss.module.root() - ) - state.jitContext.tailwindConfig.separator = - typeof userSeperator === 'undefined' ? ':' : userSeperator - } - - CompletionList, '.', try { postcssResult = await postcss @@ -714,6 +690,13 @@ state.config = resolveConfig.module(config) state.separator = typeof userSeperator === 'string' ? userSeperator : ':' state.plugins = await getPlugins(config) state.classNames = (await extractClassNames(postcssResult.root)) as ClassNames + + if (state.jit) { + state.jitContext = state.modules.jit.setupContext.module(state.configPath)( + { opts: {}, messages: [] }, + state.modules.postcss.module.root() + ) + } state.variants = getVariants(state)