Upgrade some dependencies (#871)
* Switch to NPM workspaces * Add bun types for testing * Remove some dependencies * Cleanup code * Upgrade esbuild * Hardcode externals They’re the same between the packages except for vscode but including an external that’s not ultimately required isn’t an error. * Reorganize package json * Replace TSDX with esbuild * wip * Simplify script * Move esbuild into individual packages * Bump vsce * Fix packaging * fixup * Swap mri for minimist It’s the same API but maintained * Update lockfiles * Add logs * Bump version * Update lockfile * Add test for `extractClassNames` * fixmaster
parent
3c0f17cadd
commit
19cb859b5d
|
@ -1,11 +1,8 @@
|
||||||
import latestSemver from 'latest-semver'
|
import PackageJson from '@npmcli/package-json'
|
||||||
import * as fs from 'fs/promises'
|
import assert from 'node:assert'
|
||||||
import assert from 'assert'
|
import semver from 'semver'
|
||||||
|
|
||||||
async function bumpVersion() {
|
let res = await fetch('https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery', {
|
||||||
let res = await fetch(
|
|
||||||
'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery',
|
|
||||||
{
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/json;api-version=7.2-preview.1;excludeUrls=true',
|
accept: 'application/json;api-version=7.2-preview.1;excludeUrls=true',
|
||||||
|
@ -26,19 +23,27 @@ async function bumpVersion() {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
}
|
})
|
||||||
)
|
|
||||||
let { results } = await res.json()
|
|
||||||
let versions = results[0].extensions[0].versions.map(({ version }) => version)
|
|
||||||
let latest = latestSemver(versions)
|
|
||||||
let parts = latest.split('.')
|
|
||||||
|
|
||||||
assert(Number(parts[1]) % 2 === 1)
|
let { results } = await res.json()
|
||||||
|
|
||||||
let nextVersion = `${parts[0]}.${parts[1]}.${Number(parts[2]) + 1}`
|
/** @type {string[]} */
|
||||||
let pkgFilename = 'packages/vscode-tailwindcss/package.json'
|
let versions = results[0].extensions[0].versions.map(({ version }) => version)
|
||||||
let pkg = JSON.parse(await fs.readFile(pkgFilename, 'utf8'))
|
|
||||||
await fs.writeFile(pkgFilename, JSON.stringify({ ...pkg, version: nextVersion }, null, 2), 'utf8')
|
|
||||||
}
|
|
||||||
|
|
||||||
bumpVersion()
|
// Determine the latest version of the extension
|
||||||
|
let latest = versions
|
||||||
|
.map((v) => semver.parse(v, { includePrerelease: true, loose: false }))
|
||||||
|
.filter((v) => v !== null)
|
||||||
|
.filter((v) => v.prerelease.length === 0)
|
||||||
|
.sort((a, b) => b.compare(a) || b.compareBuild(a))
|
||||||
|
.at(0)
|
||||||
|
|
||||||
|
// Require the minor version to be odd. This is done because
|
||||||
|
// the VSCode Marketplace suggests using odd numbers for
|
||||||
|
// pre-release builds and even ones for release builds
|
||||||
|
assert(latest && latest.minor % 2 === 1)
|
||||||
|
|
||||||
|
// Bump the patch version in `package.json`
|
||||||
|
let nextVersion = latest.inc('patch').format()
|
||||||
|
let pkg = await PackageJson.load('packages/vscode-tailwindcss/package.json')
|
||||||
|
await pkg.update({ version: nextVersion }).save()
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
const esbuild = require('esbuild')
|
import esbuild from 'esbuild'
|
||||||
const path = require('path')
|
import fs from 'fs'
|
||||||
const fs = require('fs')
|
import { createRequire } from 'module'
|
||||||
const mri = require('mri')
|
import minimist from 'minimist'
|
||||||
|
|
||||||
const resolve = (...args) => path.resolve(__dirname, ...args)
|
const require = createRequire(import.meta.url)
|
||||||
|
|
||||||
const args = mri(process.argv.slice(2), {
|
const args = minimist(process.argv.slice(2), {
|
||||||
boolean: ['watch', 'minify'],
|
boolean: ['watch', 'minify'],
|
||||||
string: ['outfile', 'outdir', 'external'],
|
string: ['outfile', 'outdir'],
|
||||||
})
|
})
|
||||||
|
|
||||||
esbuild.build({
|
console.log('- Preparing')
|
||||||
|
let ctx = await esbuild.context({
|
||||||
entryPoints: args._,
|
entryPoints: args._,
|
||||||
bundle: true,
|
bundle: true,
|
||||||
platform: 'node',
|
platform: 'node',
|
||||||
external: [].concat(args.external),
|
external: ['pnpapi', 'vscode', 'lightningcss', '@tailwindcss/oxide'],
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
outdir: args.outdir,
|
outdir: args.outdir,
|
||||||
outfile: args.outfile,
|
outfile: args.outfile,
|
||||||
watch: args.watch,
|
|
||||||
minify: args.minify,
|
minify: args.minify,
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
|
@ -74,3 +74,14 @@ esbuild.build({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('- Building')
|
||||||
|
await ctx.rebuild()
|
||||||
|
|
||||||
|
if (args.watch) {
|
||||||
|
console.log('- Watching')
|
||||||
|
await ctx.watch()
|
||||||
|
} else {
|
||||||
|
console.log('- Cleaning up')
|
||||||
|
await ctx.dispose()
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"version": "independent",
|
|
||||||
"packages": ["packages/*"]
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
|
@ -1,14 +1,16 @@
|
||||||
{
|
{
|
||||||
"name": "root",
|
"name": "tailwindcss-intellisense",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"workspaces": [
|
||||||
"bootstrap": "lerna bootstrap --hoist",
|
"packages/*"
|
||||||
"clean": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +"
|
],
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "0.14.11",
|
"@npmcli/package-json": "^5.0.0",
|
||||||
"latest-semver": "^4.0.0",
|
"semver": "^7.5.4"
|
||||||
"lerna": "^3.22.1",
|
},
|
||||||
"mri": "1.2.0"
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,7 @@
|
||||||
"homepage": "https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme",
|
"homepage": "https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run clean && npm run _esbuild && npm run hashbang",
|
"build": "npm run clean && npm run _esbuild && npm run hashbang",
|
||||||
"_esbuild": "node ../../esbuild.js src/server.ts --outfile=bin/tailwindcss-language-server --external=pnpapi --external=lightningcss --external=@tailwindcss/oxide --minify",
|
"_esbuild": "node ../../esbuild.mjs src/server.ts --outfile=bin/tailwindcss-language-server --minify",
|
||||||
"clean": "rimraf bin",
|
"clean": "rimraf bin",
|
||||||
"hashbang": "node scripts/hashbang.mjs",
|
"hashbang": "node scripts/hashbang.mjs",
|
||||||
"create-notices-file": "node scripts/createNoticesFile.mjs",
|
"create-notices-file": "node scripts/createNoticesFile.mjs",
|
||||||
|
@ -42,6 +42,8 @@
|
||||||
"@types/debounce": "1.2.0",
|
"@types/debounce": "1.2.0",
|
||||||
"@types/node": "14.14.34",
|
"@types/node": "14.14.34",
|
||||||
"@types/vscode": "1.65.0",
|
"@types/vscode": "1.65.0",
|
||||||
|
"browserslist": "^4.22.1",
|
||||||
|
"bun-types": "^1.0.6",
|
||||||
"chokidar": "3.5.1",
|
"chokidar": "3.5.1",
|
||||||
"color-name": "1.1.4",
|
"color-name": "1.1.4",
|
||||||
"culori": "0.20.1",
|
"culori": "0.20.1",
|
||||||
|
@ -50,12 +52,14 @@
|
||||||
"dlv": "1.1.3",
|
"dlv": "1.1.3",
|
||||||
"dset": "3.1.2",
|
"dset": "3.1.2",
|
||||||
"enhanced-resolve-301": "0.0.1",
|
"enhanced-resolve-301": "0.0.1",
|
||||||
|
"esbuild": "^0.19.5",
|
||||||
"fast-glob": "3.2.4",
|
"fast-glob": "3.2.4",
|
||||||
"find-up": "5.0.0",
|
"find-up": "5.0.0",
|
||||||
"is-builtin-module": "3.2.1",
|
"is-builtin-module": "3.2.1",
|
||||||
"klona": "2.0.4",
|
"klona": "2.0.4",
|
||||||
"license-checker": "25.0.1",
|
"license-checker": "25.0.1",
|
||||||
"minimatch": "5.1.4",
|
"minimatch": "5.1.4",
|
||||||
|
"minimist": "^1.2.8",
|
||||||
"normalize-path": "3.0.0",
|
"normalize-path": "3.0.0",
|
||||||
"pkg-up": "3.1.0",
|
"pkg-up": "3.1.0",
|
||||||
"postcss": "8.4.31",
|
"postcss": "8.4.31",
|
||||||
|
@ -66,6 +70,7 @@
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"stack-trace": "0.0.10",
|
"stack-trace": "0.0.10",
|
||||||
"tailwindcss": "3.3.0",
|
"tailwindcss": "3.3.0",
|
||||||
|
"tailwindcss-language-service": "*",
|
||||||
"typescript": "4.6.4",
|
"typescript": "4.6.4",
|
||||||
"vitest": "0.34.2",
|
"vitest": "0.34.2",
|
||||||
"vscode-css-languageservice": "6.2.9",
|
"vscode-css-languageservice": "6.2.9",
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/// <reference types="bun-types" />
|
||||||
|
import { parse } from 'postcss'
|
||||||
|
import extractClassNames from './extractClassNames'
|
||||||
|
|
||||||
|
test('ex: 1', async () => {
|
||||||
|
let result = await extractClassNames(parse('.foo {}'))
|
||||||
|
|
||||||
|
expect(result.classNames).toHaveProperty('foo')
|
||||||
|
expect(result.classNames['foo']).toEqual({
|
||||||
|
__info: {
|
||||||
|
__rule: true,
|
||||||
|
__source: undefined,
|
||||||
|
__pseudo: [],
|
||||||
|
__scope: null,
|
||||||
|
__context: [],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ex: 2', async () => {
|
||||||
|
let result = await extractClassNames(parse('.foo.bar {}'))
|
||||||
|
|
||||||
|
expect(result.classNames).toHaveProperty('foo')
|
||||||
|
expect(result.classNames).toHaveProperty('bar')
|
||||||
|
expect(result.classNames['foo']).toEqual({
|
||||||
|
__info: {
|
||||||
|
__rule: true,
|
||||||
|
__source: undefined,
|
||||||
|
__pseudo: [],
|
||||||
|
__scope: null,
|
||||||
|
__context: [],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(result.classNames['bar']).toEqual({
|
||||||
|
__info: {
|
||||||
|
__rule: true,
|
||||||
|
__source: undefined,
|
||||||
|
__pseudo: [],
|
||||||
|
__scope: '.foo',
|
||||||
|
__context: [],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ex: 3', async () => {
|
||||||
|
let result = await extractClassNames(parse('.foo:where(.bar:is(.baz:has(> .klass))) {}'))
|
||||||
|
|
||||||
|
expect(result.classNames).toHaveProperty('foo')
|
||||||
|
expect(result.classNames).not.toHaveProperty('bar')
|
||||||
|
expect(result.classNames).not.toHaveProperty('baz')
|
||||||
|
expect(result.classNames).not.toHaveProperty('klass')
|
||||||
|
expect(result.classNames['foo']).toEqual({
|
||||||
|
__info: {
|
||||||
|
__rule: true,
|
||||||
|
__source: undefined,
|
||||||
|
__pseudo: [':where(.bar:is(.baz:has(> .klass)))'],
|
||||||
|
__scope: null,
|
||||||
|
__context: [],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "v2",
|
"name": "v2-jit",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,16 +7,14 @@
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "tsdx watch",
|
"start": "node ./scripts/build.mjs --watch",
|
||||||
"build": "tsdx build",
|
"build": "node ./scripts/build.mjs",
|
||||||
"test": "tsdx test",
|
|
||||||
"lint": "tsdx lint",
|
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@csstools/media-query-list-parser": "2.0.4",
|
|
||||||
"@csstools/css-parser-algorithms": "2.1.1",
|
"@csstools/css-parser-algorithms": "2.1.1",
|
||||||
"@csstools/css-tokenizer": "2.1.1",
|
"@csstools/css-tokenizer": "2.1.1",
|
||||||
|
"@csstools/media-query-list-parser": "2.0.4",
|
||||||
"@types/culori": "^2.0.0",
|
"@types/culori": "^2.0.0",
|
||||||
"@types/moo": "0.5.3",
|
"@types/moo": "0.5.3",
|
||||||
"@types/semver": "7.3.10",
|
"@types/semver": "7.3.10",
|
||||||
|
@ -41,8 +39,8 @@
|
||||||
"vscode-languageserver-textdocument": "1.0.7"
|
"vscode-languageserver-textdocument": "1.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"esbuild": "^0.19.5",
|
||||||
"prettier": "2.3.0",
|
"prettier": "2.3.0",
|
||||||
"tsdx": "0.14.1",
|
|
||||||
"tslib": "2.2.0",
|
"tslib": "2.2.0",
|
||||||
"typescript": "4.6.4"
|
"typescript": "4.6.4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
import esbuild from 'esbuild'
|
||||||
|
import path from 'node:path'
|
||||||
|
import minimist from 'minimist'
|
||||||
|
|
||||||
|
const __dirname = new URL('.', import.meta.url).pathname
|
||||||
|
|
||||||
|
const args = minimist(process.argv.slice(2), {
|
||||||
|
boolean: ['watch', 'minify'],
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('- Preparing')
|
||||||
|
let builds = await Promise.all([
|
||||||
|
esbuild.context({
|
||||||
|
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
|
||||||
|
bundle: true,
|
||||||
|
platform: 'node',
|
||||||
|
external: [],
|
||||||
|
outdir: 'dist',
|
||||||
|
minify: args.minify,
|
||||||
|
|
||||||
|
format: 'cjs',
|
||||||
|
}),
|
||||||
|
|
||||||
|
esbuild.context({
|
||||||
|
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
|
||||||
|
bundle: true,
|
||||||
|
platform: 'node',
|
||||||
|
external: [],
|
||||||
|
outdir: 'dist',
|
||||||
|
minify: args.minify,
|
||||||
|
|
||||||
|
format: 'esm',
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
|
||||||
|
console.log('- Building')
|
||||||
|
await Promise.all(builds.map((build) => build.rebuild()))
|
||||||
|
|
||||||
|
if (args.watch) {
|
||||||
|
console.log('- Watching')
|
||||||
|
await Promise.all(builds.map((build) => build.watch()))
|
||||||
|
} else {
|
||||||
|
console.log('- Cleaning up')
|
||||||
|
await Promise.all(builds.map((build) => build.dispose()))
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
||||||
"description": "Intelligent Tailwind CSS tooling for VS Code",
|
"description": "Intelligent Tailwind CSS tooling for VS Code",
|
||||||
"author": "Brad Cornes <hello@bradley.dev>",
|
"author": "Brad Cornes <hello@bradley.dev>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.10.1",
|
"version": "0.10.2",
|
||||||
"homepage": "https://github.com/tailwindlabs/tailwindcss-intellisense",
|
"homepage": "https://github.com/tailwindlabs/tailwindcss-intellisense",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/tailwindlabs/tailwindcss-intellisense/issues",
|
"url": "https://github.com/tailwindlabs/tailwindcss-intellisense/issues",
|
||||||
|
@ -325,28 +325,31 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_esbuild": "node ../../esbuild.js src/extension.ts src/server.ts src/cssServer.ts --outdir=dist --external=pnpapi --external=vscode --external=lightningcss --external=@tailwindcss/oxide",
|
"_esbuild": "node ../../esbuild.mjs src/extension.ts src/server.ts src/cssServer.ts --outdir=dist",
|
||||||
"dev": "concurrently --raw --kill-others \"npm run watch\" \"npm run check -- --watch\"",
|
"dev": "concurrently --raw --kill-others \"npm run watch\" \"npm run check -- --watch\"",
|
||||||
"watch": "npm run clean && npm run _esbuild -- --watch",
|
"watch": "npm run clean && npm run _esbuild -- --watch",
|
||||||
"build": "npm run check && npm run clean && npm run _esbuild -- --minify && move-file dist/server.js dist/tailwindServer.js && move-file dist/cssServer.js dist/tailwindModeServer.js",
|
"build": "npm run check && npm run clean && npm run _esbuild -- --minify && move-file dist/server.js dist/tailwindServer.js && move-file dist/cssServer.js dist/tailwindModeServer.js",
|
||||||
"package": "vsce package",
|
"package": "vsce package --no-dependencies",
|
||||||
"publish": "vsce publish",
|
"publish": "vsce publish --no-dependencies",
|
||||||
"copy:notices": "cp ../tailwindcss-language-server/ThirdPartyNotices.txt ./dist/ThirdPartyNotices.txt",
|
"copy:notices": "cp ../tailwindcss-language-server/ThirdPartyNotices.txt ./dist/ThirdPartyNotices.txt",
|
||||||
"vscode:prepublish": "npm run build && npm run copy:notices",
|
"vscode:prepublish": "npm run build && npm run copy:notices",
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"check": "tsc --noEmit"
|
"check": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tailwindcss/language-server": "*",
|
||||||
"@types/braces": "3.0.1",
|
"@types/braces": "3.0.1",
|
||||||
"@types/vscode": "1.65.0",
|
"@types/vscode": "1.65.0",
|
||||||
|
"@vscode/vsce": "2.21.1",
|
||||||
"braces": "3.0.2",
|
"braces": "3.0.2",
|
||||||
"color-name": "1.1.4",
|
"color-name": "1.1.4",
|
||||||
"concurrently": "7.0.0",
|
"concurrently": "7.0.0",
|
||||||
|
"esbuild": "^0.19.5",
|
||||||
"minimatch": "5.1.4",
|
"minimatch": "5.1.4",
|
||||||
|
"minimist": "^1.2.8",
|
||||||
"move-file-cli": "3.0.0",
|
"move-file-cli": "3.0.0",
|
||||||
"normalize-path": "3.0.0",
|
"normalize-path": "3.0.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"vsce": "2.15.0",
|
|
||||||
"vscode-languageclient": "8.0.2"
|
"vscode-languageclient": "8.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue