Skip to content

Support insiders versions of tailwindcss #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,572 changes: 1,296 additions & 1,276 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/tailwindcss-language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"prettier": "2.3.0",
"resolve": "1.20.0",
"rimraf": "3.0.2",
"semver": "7.3.2",
"stack-trace": "0.0.10",
"tailwindcss": "3.0.11",
"terser": "4.6.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss-language-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import resolveFrom, { setPnpApi } from './util/resolveFrom'
import { AtRule, Container, Node, Result } from 'postcss'
import Module from 'module'
import Hook from './lib/hook'
import semver from 'semver'
import * as semver from 'tailwindcss-language-service/src/util/semver'
import dlv from 'dlv'
import dset from 'dset'
import pkgUp from 'pkg-up'
Expand Down
3 changes: 2 additions & 1 deletion packages/tailwindcss-language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@types/moo": "0.5.3",
"@types/semver": "7.3.10",
"color-name": "1.1.4",
"css.escape": "1.5.1",
"culori": "0.20.1",
Expand All @@ -26,7 +27,7 @@
"multi-regexp2": "1.0.3",
"postcss": "8.3.9",
"postcss-selector-parser": "6.0.2",
"semver": "7.3.2",
"semver": "7.3.7",
"sift-string": "0.0.2",
"stringify-object": "3.3.0",
"tmp-cache": "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as emmetHelper from 'vscode-emmet-helper-bundled'
import { isValidLocationForEmmetAbbreviation } from './util/isValidLocationForEmmetAbbreviation'
import { isJsDoc, isJsxContext } from './util/js'
import { naturalExpand } from './util/naturalExpand'
import semver from 'semver'
import * as semver from './util/semver'
import { docsUrl } from './util/docsUrl'
import { ensureArray } from './util/array'
import { getClassAttributeLexer, getComputedClassAttributeLexer } from './util/lexers'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { InvalidTailwindDirectiveDiagnostic, DiagnosticKind } from './types'
import { isCssDoc } from '../util/css'
import { getLanguageBoundaries } from '../util/getLanguageBoundaries'
import { findAll, indexToPosition } from '../util/find'
import semver from 'semver'
import * as semver from '../util/semver'
import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getLanguageBoundaries } from '../util/getLanguageBoundaries'
import { findAll, indexToPosition } from '../util/find'
import { closest } from '../util/closest'
import { absoluteRange } from '../util/absoluteRange'
import semver from 'semver'
import * as semver from '../util/semver'

export function getInvalidVariantDiagnostics(
state: State,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { findClassListsInDocument, getClassNamesInClassList } from '../util/find
import * as jit from '../util/jit'
import { getVariantsFromClassName } from '../util/getVariantsFromClassName'
import { equalExact } from '../util/array'
import semver from 'semver'
import * as semver from '../util/semver'

export async function getRecommendedVariantOrderDiagnostics(
state: State,
Expand Down
6 changes: 2 additions & 4 deletions packages/tailwindcss-language-service/src/util/docsUrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import semver from 'semver'
import * as semver from './semver'

export function docsUrl(version: string, paths: string | string[]): string {
let major = 0
Expand All @@ -11,8 +11,6 @@ export function docsUrl(version: string, paths: string | string[]): string {
major = 2
url = 'https://tailwindcss.com/docs/'
}
const path = Array.isArray(paths)
? paths[major] || paths[paths.length - 1]
: paths
const path = Array.isArray(paths) ? paths[major] || paths[paths.length - 1] : paths
return `${url}${path}`
}
16 changes: 16 additions & 0 deletions packages/tailwindcss-language-service/src/util/semver.ts
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { State } from './state'
import { getClassNameMeta } from './getClassNameMeta'
import { flagEnabled } from './flagEnabled'
import semver from 'semver'
import * as semver from './semver'

export function validateApply(
state: State,
Expand Down