Support `insiders` versions of `tailwindcss` (#571)

* Support `insiders` versions of `tailwindcss`

* Revert import reorder
master
Brad Cornes 2022-07-06 16:07:13 +01:00 committed by GitHub
parent 407af8d135
commit a39da43e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1314 additions and 1280 deletions

2556
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -61,7 +61,6 @@
"prettier": "2.3.0", "prettier": "2.3.0",
"resolve": "1.20.0", "resolve": "1.20.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"semver": "7.3.2",
"stack-trace": "0.0.10", "stack-trace": "0.0.10",
"tailwindcss": "3.0.11", "tailwindcss": "3.0.11",
"terser": "4.6.12", "terser": "4.6.12",

View File

@ -43,7 +43,7 @@ import resolveFrom, { setPnpApi } from './util/resolveFrom'
import { AtRule, Container, Node, Result } from 'postcss' import { AtRule, Container, Node, Result } from 'postcss'
import Module from 'module' import Module from 'module'
import Hook from './lib/hook' import Hook from './lib/hook'
import semver from 'semver' import * as semver from 'tailwindcss-language-service/src/util/semver'
import dlv from 'dlv' import dlv from 'dlv'
import dset from 'dset' import dset from 'dset'
import pkgUp from 'pkg-up' import pkgUp from 'pkg-up'

View File

@ -15,6 +15,7 @@
}, },
"dependencies": { "dependencies": {
"@types/moo": "0.5.3", "@types/moo": "0.5.3",
"@types/semver": "7.3.10",
"color-name": "1.1.4", "color-name": "1.1.4",
"css.escape": "1.5.1", "css.escape": "1.5.1",
"culori": "0.20.1", "culori": "0.20.1",
@ -26,7 +27,7 @@
"multi-regexp2": "1.0.3", "multi-regexp2": "1.0.3",
"postcss": "8.3.9", "postcss": "8.3.9",
"postcss-selector-parser": "6.0.2", "postcss-selector-parser": "6.0.2",
"semver": "7.3.2", "semver": "7.3.7",
"sift-string": "0.0.2", "sift-string": "0.0.2",
"stringify-object": "3.3.0", "stringify-object": "3.3.0",
"tmp-cache": "1.1.0", "tmp-cache": "1.1.0",

View File

@ -22,7 +22,7 @@ import * as emmetHelper from 'vscode-emmet-helper-bundled'
import { isValidLocationForEmmetAbbreviation } from './util/isValidLocationForEmmetAbbreviation' import { isValidLocationForEmmetAbbreviation } from './util/isValidLocationForEmmetAbbreviation'
import { isJsDoc, isJsxContext } from './util/js' import { isJsDoc, isJsxContext } from './util/js'
import { naturalExpand } from './util/naturalExpand' import { naturalExpand } from './util/naturalExpand'
import semver from 'semver' import * as semver from './util/semver'
import { docsUrl } from './util/docsUrl' import { docsUrl } from './util/docsUrl'
import { ensureArray } from './util/array' import { ensureArray } from './util/array'
import { getClassAttributeLexer, getComputedClassAttributeLexer } from './util/lexers' import { getClassAttributeLexer, getComputedClassAttributeLexer } from './util/lexers'

View File

@ -4,7 +4,7 @@ import { InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types'
import { isCssDoc } from '../util/css' import { isCssDoc } from '../util/css'
import { getLanguageBoundaries } from '../util/getLanguageBoundaries' import { getLanguageBoundaries } from '../util/getLanguageBoundaries'
import { findAll, indexToPosition } from '../util/find' import { findAll, indexToPosition } from '../util/find'
import semver from 'semver' import * as semver from '../util/semver'
import { closest } from '../util/closest' import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange' import { absoluteRange } from '../util/absoluteRange'

View File

@ -6,7 +6,7 @@ import { getLanguageBoundaries } from '../util/getLanguageBoundaries'
import { findAll, indexToPosition } from '../util/find' import { findAll, indexToPosition } from '../util/find'
import { closest } from '../util/closest' import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange' import { absoluteRange } from '../util/absoluteRange'
import semver from 'semver' import * as semver from '../util/semver'
export function getInvalidVariantDiagnostics( export function getInvalidVariantDiagnostics(
state: State, state: State,

View File

@ -5,7 +5,7 @@ import { findClassListsInDocument, getClassNamesInClassList } from '../util/find
import * as jit from '../util/jit' import * as jit from '../util/jit'
import { getVariantsFromClassName } from '../util/getVariantsFromClassName' import { getVariantsFromClassName } from '../util/getVariantsFromClassName'
import { equalExact } from '../util/array' import { equalExact } from '../util/array'
import semver from 'semver' import * as semver from '../util/semver'
export async function getRecommendedVariantOrderDiagnostics( export async function getRecommendedVariantOrderDiagnostics(
state: State, state: State,

View File

@ -1,4 +1,4 @@
import semver from 'semver' import * as semver from './semver'
export function docsUrl(version: string, paths: string | string[]): string { export function docsUrl(version: string, paths: string | string[]): string {
let major = 0 let major = 0
@ -11,8 +11,6 @@ export function docsUrl(version: string, paths: string | string[]): string {
major = 2 major = 2
url = 'https://tailwindcss.com/docs/' url = 'https://tailwindcss.com/docs/'
} }
const path = Array.isArray(paths) const path = Array.isArray(paths) ? paths[major] || paths[paths.length - 1] : paths
? paths[major] || paths[paths.length - 1]
: paths
return `${url}${path}` return `${url}${path}`
} }

View File

@ -0,0 +1,16 @@
import semverGte from 'semver/functions/gte'
import semverLte from 'semver/functions/lte'
export function gte(v1: string, v2: string): boolean {
if (v1.startsWith('0.0.0-insiders')) {
return true
}
return semverGte(v1, v2)
}
export function lte(v1: string, v2: string): boolean {
if (v1.startsWith('0.0.0-insiders')) {
return false
}
return semverLte(v1, v2)
}

View File

@ -1,7 +1,7 @@
import { State } from './state' import { State } from './state'
import { getClassNameMeta } from './getClassNameMeta' import { getClassNameMeta } from './getClassNameMeta'
import { flagEnabled } from './flagEnabled' import { flagEnabled } from './flagEnabled'
import semver from 'semver' import * as semver from './semver'
export function validateApply( export function validateApply(
state: State, state: State,