From 73db06f4f677f70e32b71d9956a9b743ecc13e97 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 15:45:58 +0200 Subject: [PATCH 01/18] ensure timings are correct, by waiting for the promise --- packages/@tailwindcss-postcss/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 7d818b3d1889..fb4fcad11965 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -72,7 +72,7 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { context.fullRebuildPaths = [] - let compiler = compile(root.toString(), { + let compiler = await compile(root.toString(), { base: inputBasePath, onDependency: (path) => { context.fullRebuildPaths.push(path) From bcf4b2c102f73d61c44377b0f0d682fb510767a2 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 16:06:24 +0200 Subject: [PATCH 02/18] add `Setup compiler` timing logs to `@tailwindcss/cli` and `@tailwindcss/vite` --- packages/@tailwindcss-cli/src/commands/build/index.ts | 7 +++++-- packages/@tailwindcss-vite/src/index.ts | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/@tailwindcss-cli/src/commands/build/index.ts b/packages/@tailwindcss-cli/src/commands/build/index.ts index d937caf64bed..c705c6a05836 100644 --- a/packages/@tailwindcss-cli/src/commands/build/index.ts +++ b/packages/@tailwindcss-cli/src/commands/build/index.ts @@ -128,13 +128,16 @@ export async function handle(args: Result>) { : process.cwd() let fullRebuildPaths: string[] = [] - function createCompiler(css: string) { - return compile(css, { + async function createCompiler(css: string) { + env.DEBUG && console.time('[@tailwindcss/cli] Setup compiler') + let compiler = await compile(css, { base: inputBasePath, onDependency(path) { fullRebuildPaths.push(path) }, }) + env.DEBUG && console.timeEnd('[@tailwindcss/cli] Setup compiler') + return compiler } // Compile the input diff --git a/packages/@tailwindcss-vite/src/index.ts b/packages/@tailwindcss-vite/src/index.ts index d64dca6ff336..abb13a613f26 100644 --- a/packages/@tailwindcss-vite/src/index.ts +++ b/packages/@tailwindcss-vite/src/index.ts @@ -364,6 +364,7 @@ class Root { clearRequireCache(Array.from(this.dependencies)) this.dependencies = new Set([idToPath(inputPath)]) + env.DEBUG && console.time('[@tailwindcss/vite] Setup compiler') this.compiler = await compile(content, { base: inputBase, onDependency: (path) => { @@ -371,6 +372,7 @@ class Root { this.dependencies.add(path) }, }) + env.DEBUG && console.timeEnd('[@tailwindcss/vite] Setup compiler') this.scanner = new Scanner({ sources: this.compiler.globs, From c26397a1e8076f492b0024cec6b94b77e575f979 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 16:06:50 +0200 Subject: [PATCH 03/18] remove unnecessary `async/await` I am not 100% sure, but I believe this gets rid of at least 1 macroTask. --- packages/@tailwindcss-node/src/compile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@tailwindcss-node/src/compile.ts b/packages/@tailwindcss-node/src/compile.ts index b829cd3ddadb..ee6b2ca041cd 100644 --- a/packages/@tailwindcss-node/src/compile.ts +++ b/packages/@tailwindcss-node/src/compile.ts @@ -10,11 +10,11 @@ import { } from 'tailwindcss' import { getModuleDependencies } from './get-module-dependencies' -export async function compile( +export function compile( css: string, { base, onDependency }: { base: string; onDependency: (path: string) => void }, ) { - return await _compile(css, { + return _compile(css, { base, async loadModule(id, base) { return loadModule(id, base, onDependency) From 5db16ab979806b0f0791da0241bdc17bd732f0bf Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 16:02:31 +0200 Subject: [PATCH 04/18] only setup a new compiler if we need to Otherwise it means that we: 1. Setup 2 compilers for an initial build 2. The second time we clear require caches which means that _everything_ will be loaded from scratch. --- packages/@tailwindcss-postcss/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index fb4fcad11965..bb0968a976f1 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -83,6 +83,10 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { return compiler } + // Whether this is the first build or not, if it is, then we can + // optimize the build by not creating the compiler until we need it. + let isInitialBuild = context.compiler === null + // Setup the compiler if it doesn't exist yet. This way we can // guarantee a `build()` function is available. context.compiler ??= await createCompiler() @@ -158,7 +162,12 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { }) } - if (rebuildStrategy === 'full') { + if ( + rebuildStrategy === 'full' && + // We can re-use the compiler if it was created during the + // initial build. If it wasn't, we need to create a new one. + !isInitialBuild + ) { context.compiler = await createCompiler() } From af755a88648b8988b449ef1301ceec736a949955 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 16:32:18 +0200 Subject: [PATCH 05/18] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d36f63638c4..485c47b66275 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use the right import base path when using the CLI to reading files from stdin ([#14522](https://github.com/tailwindlabs/tailwindcss/pull/14522)) - Ensure that `@utility` is top-level and cannot be nested ([#14525](https://github.com/tailwindlabs/tailwindcss/pull/14525)) - Editing imported CSS files should trigger a rebuild ([#14561](https://github.com/tailwindlabs/tailwindcss/pull/14561)) +- Only setup a single compiler in `@tailwindcss/postcss` for initial builds ([#14565](https://github.com/tailwindlabs/tailwindcss/pull/14565)) - _Experimental_: Improve codemod output, keep CSS after last Tailwind directive unlayered ([#14512](https://github.com/tailwindlabs/tailwindcss/pull/14512)) - _Experimental_: Fix incorrect empty `layer()` at the end of `@import` at-rules when running codemods ([#14513](https://github.com/tailwindlabs/tailwindcss/pull/14513)) - _Experimental_: Do not wrap comment nodes in `@layer` when running codemods ([#14517](https://github.com/tailwindlabs/tailwindcss/pull/14517)) From b68f6437cfec4db9b1ca8fb8c59f0ddc13758a32 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 17:52:04 +0200 Subject: [PATCH 06/18] use a Set to make files unique During debugging I noticed that some of the files were in the list multiple times, using a Set solves that issues. While this is a little band-aid it helps for now. Following commits will include a more proper fix. --- packages/@tailwindcss-postcss/src/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index bb0968a976f1..be8ed8f89428 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -104,11 +104,13 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { }) } - let files = result.messages.flatMap((message) => { - if (message.type !== 'dependency') return [] - return message.file - }) - files.push(inputFile) + let files = new Set( + result.messages.flatMap((message) => { + if (message.type !== 'dependency') return [] + return message.file + }), + ) + files.add(inputFile) for (let file of files) { let changedTime = fs.statSync(file, { throwIfNoEntry: false })?.mtimeMs ?? null From dd6b52d379b36b84c39413d7a7a96988c9d8a220 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 17:53:14 +0200 Subject: [PATCH 07/18] hoist the cache to the module level During debugging, I noticed that every time the PostCSS code runs, the full plugin re-runs. This means that caches are thrown away. I'm currently not sure if this is a test specific issue or an actual issue. That said, the integration tests do run postcss-cli for example directly so I think this is a real issue. This change should be safe since the cache is unique per input file (which it was before as well). Worst case is that we use a bit more memory. --- packages/@tailwindcss-postcss/src/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index be8ed8f89428..12f90f1e6d6b 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -36,20 +36,20 @@ export type PluginOptions = { optimize?: boolean | { minify?: boolean } } +let cache = new DefaultMap(() => { + return { + mtimes: new Map(), + compiler: null as null | Awaited>, + css: '', + optimizedCss: '', + fullRebuildPaths: [] as string[], + } +}) + function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { let base = opts.base ?? process.cwd() let optimize = opts.optimize ?? process.env.NODE_ENV === 'production' - let cache = new DefaultMap(() => { - return { - mtimes: new Map(), - compiler: null as null | Awaited>, - css: '', - optimizedCss: '', - fullRebuildPaths: [] as string[], - } - }) - return { postcssPlugin: '@tailwindcss/postcss', plugins: [ From 75388470298cf5c37c076db6375ee3c776264d09 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 17:59:52 +0200 Subject: [PATCH 08/18] the `resolvedPath` is already part of the `moduleDependencies` Removing this means that the main file (e.g.: `tailwind.config.js`) is only in the list once. This also means that we only have to register it as a PostCSS dependency and it also means that we will `fs.stat` the file once. --- packages/@tailwindcss-node/src/compile.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/@tailwindcss-node/src/compile.ts b/packages/@tailwindcss-node/src/compile.ts index ee6b2ca041cd..c31868ce5ec6 100644 --- a/packages/@tailwindcss-node/src/compile.ts +++ b/packages/@tailwindcss-node/src/compile.ts @@ -60,7 +60,6 @@ export async function loadModule(id: string, base: string, onDependency: (path: getModuleDependencies(resolvedPath), ]) - onDependency(resolvedPath) for (let file of moduleDependencies) { onDependency(file) } From 0c1a8732e0232f70549c64afff055bdd3881eb8e Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 1 Oct 2024 18:01:58 +0200 Subject: [PATCH 09/18] revert the Set to an array again --- packages/@tailwindcss-postcss/src/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 12f90f1e6d6b..7d18ddc36a98 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -104,13 +104,11 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { }) } - let files = new Set( - result.messages.flatMap((message) => { - if (message.type !== 'dependency') return [] - return message.file - }), - ) - files.add(inputFile) + let files = result.messages.flatMap((message) => { + if (message.type !== 'dependency') return [] + return message.file + }) + files.push(inputFile) for (let file of files) { let changedTime = fs.statSync(file, { throwIfNoEntry: false })?.mtimeMs ?? null From 687ef2a737f29f4f0f8df844cf557e506ed3d7fd Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Wed, 2 Oct 2024 15:22:54 +0200 Subject: [PATCH 10/18] Use an LRU for the shared postcss cache --- packages/@tailwindcss-postcss/package.json | 7 +-- packages/@tailwindcss-postcss/src/index.ts | 55 ++++++++++------------ 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/packages/@tailwindcss-postcss/package.json b/packages/@tailwindcss-postcss/package.json index a2f6da74a502..9792e3119a70 100644 --- a/packages/@tailwindcss-postcss/package.json +++ b/packages/@tailwindcss-postcss/package.json @@ -33,13 +33,14 @@ "@tailwindcss/node": "workspace:^", "@tailwindcss/oxide": "workspace:^", "lightningcss": "catalog:", + "quick-lru": "^7.0.0", "tailwindcss": "workspace:^" }, "devDependencies": { "@types/node": "catalog:", - "postcss": "^8.4.41", - "postcss-import": "^16.1.0", "@types/postcss-import": "14.0.3", - "internal-example-plugin": "workspace:*" + "internal-example-plugin": "workspace:*", + "postcss": "^8.4.41", + "postcss-import": "^16.1.0" } } diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 7d18ddc36a98..3ba363056db6 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -5,27 +5,30 @@ import fs from 'fs' import { Features, transform } from 'lightningcss' import path from 'path' import postcss, { type AcceptedPlugin, type PluginCreator } from 'postcss' +import QuickLRU from 'quick-lru' import fixRelativePathsPlugin from './postcss-fix-relative-paths' -/** - * A Map that can generate default values for keys that don't exist. - * Generated default values are added to the map to avoid recomputation. - */ -class DefaultMap extends Map { - constructor(private factory: (key: T, self: DefaultMap) => V) { - super() - } - - get(key: T): V { - let value = super.get(key) - - if (value === undefined) { - value = this.factory(key, this) - this.set(key, value) - } +interface CacheEntry { + mtimes: Map + compiler: null | Awaited> + css: string + optimizedCss: string + fullRebuildPaths: string[] +} +let cache = new QuickLRU({ maxSize: 1000 }) - return value +function getContextFromCache(inputFile: string, opts: PluginOptions): CacheEntry { + let key = `${inputFile}:${opts.base ?? ''}:${opts.optimize ?? ''}` + if (cache.has(key)) return cache.get(key)! + let entry = { + mtimes: new Map(), + compiler: null as null | Awaited>, + css: '', + optimizedCss: '', + fullRebuildPaths: [] as string[], } + cache.set(key, entry) + return entry } export type PluginOptions = { @@ -36,16 +39,6 @@ export type PluginOptions = { optimize?: boolean | { minify?: boolean } } -let cache = new DefaultMap(() => { - return { - mtimes: new Map(), - compiler: null as null | Awaited>, - css: '', - optimizedCss: '', - fullRebuildPaths: [] as string[], - } -}) - function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { let base = opts.base ?? process.cwd() let optimize = opts.optimize ?? process.env.NODE_ENV === 'production' @@ -53,9 +46,9 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { return { postcssPlugin: '@tailwindcss/postcss', plugins: [ - // We need to handle the case where `postcss-import` might have run before the Tailwind CSS - // plugin is run. In this case, we need to manually fix relative paths before processing it - // in core. + // We need to handle the case where `postcss-import` might have run before + // the Tailwind CSS plugin is run. In this case, we need to manually fix + // relative paths before processing it in core. fixRelativePathsPlugin(), { @@ -63,7 +56,7 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { async OnceExit(root, { result }) { env.DEBUG && console.time('[@tailwindcss/postcss] Total time in @tailwindcss/postcss') let inputFile = result.opts.from ?? '' - let context = cache.get(inputFile) + let context = getContextFromCache(inputFile, opts) let inputBasePath = path.dirname(path.resolve(inputFile)) async function createCompiler() { From b8b1e92e04e4bfcf12c51ab3222a46f695985533 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Wed, 2 Oct 2024 16:38:18 +0200 Subject: [PATCH 11/18] wip use quick lru --- packages/@tailwindcss-postcss/package.json | 2 +- packages/@tailwindcss-postcss/src/index.ts | 5 +++-- pnpm-lock.yaml | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/@tailwindcss-postcss/package.json b/packages/@tailwindcss-postcss/package.json index 9792e3119a70..0ee1fd5f55b7 100644 --- a/packages/@tailwindcss-postcss/package.json +++ b/packages/@tailwindcss-postcss/package.json @@ -30,10 +30,10 @@ } }, "dependencies": { + "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "workspace:^", "@tailwindcss/oxide": "workspace:^", "lightningcss": "catalog:", - "quick-lru": "^7.0.0", "tailwindcss": "workspace:^" }, "devDependencies": { diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 3ba363056db6..90d481a9008f 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -1,3 +1,4 @@ +import QuickLRU from '@alloc/quick-lru' import { compile, env } from '@tailwindcss/node' import { clearRequireCache } from '@tailwindcss/node/require-cache' import { Scanner } from '@tailwindcss/oxide' @@ -5,7 +6,6 @@ import fs from 'fs' import { Features, transform } from 'lightningcss' import path from 'path' import postcss, { type AcceptedPlugin, type PluginCreator } from 'postcss' -import QuickLRU from 'quick-lru' import fixRelativePathsPlugin from './postcss-fix-relative-paths' interface CacheEntry { @@ -15,10 +15,11 @@ interface CacheEntry { optimizedCss: string fullRebuildPaths: string[] } -let cache = new QuickLRU({ maxSize: 1000 }) +let cache = new QuickLRU({ maxSize: 50 }) function getContextFromCache(inputFile: string, opts: PluginOptions): CacheEntry { let key = `${inputFile}:${opts.base ?? ''}:${opts.optimize ?? ''}` + console.log('key:', key) if (cache.has(key)) return cache.get(key)! let entry = { mtimes: new Map(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b1afa36e39b5..d2715c7b7576 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -175,6 +175,9 @@ importers: packages/@tailwindcss-postcss: dependencies: + '@alloc/quick-lru': + specifier: ^5.2.0 + version: 5.2.0 '@tailwindcss/node': specifier: workspace:^ version: link:../@tailwindcss-node @@ -435,6 +438,10 @@ importers: packages: + '@alloc/quick-lru@5.2.0': + resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} + engines: {node: '>=10'} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -3203,6 +3210,8 @@ packages: snapshots: + '@alloc/quick-lru@5.2.0': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 From 60ad1d643834febb72b2856689ba3d1512293abb Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Wed, 2 Oct 2024 18:22:08 +0200 Subject: [PATCH 12/18] Upgrade ignore crate --- Cargo.lock | 78 ++++++++++++++++++++--------------------- crates/node/Cargo.toml | 5 ++- crates/oxide/Cargo.toml | 3 +- rust-toolchain.toml | 3 -- 4 files changed, 42 insertions(+), 47 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/Cargo.lock b/Cargo.lock index ac4a1363c270..cfb51f81395c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "aho-corasick" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -40,13 +31,12 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bstr" -version = "1.5.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "once_cell", - "regex-automata", + "regex-automata 0.4.8", "serde", ] @@ -190,12 +180,6 @@ dependencies = [ "instant", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "glob-match" version = "0.2.1" @@ -204,15 +188,15 @@ checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -243,17 +227,16 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "ignore" -version = "0.4.20" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ + "crossbeam-deque", "globset", - "lazy_static", "log", "memchr", - "regex", + "regex-automata 0.4.8", "same-file", - "thread_local", "walkdir", "winapi-util", ] @@ -308,9 +291,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "log" -version = "0.4.18" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matchers" @@ -318,14 +301,14 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -486,7 +469,7 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick", "memchr", "regex-syntax 0.7.2", ] @@ -500,6 +483,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -512,6 +506,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "rustc-hash" version = "2.0.0" @@ -731,9 +731,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 5c7940ace42e..fa8ceef30a7f 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -8,11 +8,10 @@ crate-type = ["cdylib"] [dependencies] # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = { version = "2.13.1", default-features = false, features = ["napi4"] } -napi-derive = "2.13.0" +napi = { version = "2.12.2", default-features = false, features = ["napi4"] } +napi-derive = "2.12.2" tailwindcss-oxide = { path = "../oxide" } rayon = "1.5.3" [build-dependencies] napi-build = "2.0.1" - diff --git a/crates/oxide/Cargo.toml b/crates/oxide/Cargo.toml index 6177f8963b42..483c477caa08 100644 --- a/crates/oxide/Cargo.toml +++ b/crates/oxide/Cargo.toml @@ -13,10 +13,9 @@ crossbeam = "0.8.2" tracing = { version = "0.1.37", features = [] } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } walkdir = "2.3.3" -ignore = "0.4.20" +ignore = "0.4.23" glob-match = "0.2.1" dunce = "1.0.5" [dev-dependencies] tempfile = "3.5.0" - diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 7f466bd2dfc5..000000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "1.80.1" -profile = "default" From 7d5b5e6cbfe302c2d5c24f2734bb9ffe7a23be49 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 2 Oct 2024 13:56:17 -0400 Subject: [PATCH 13/18] Bump napi to latest --- Cargo.lock | 41 +++++++++++++++-------------------------- crates/node/Cargo.toml | 4 ++-- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cfb51f81395c..3ad9b03d4a60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,7 +135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "990a40740adf249724a6000c0fc4bd574712f50bb17c2d6f6cec837ae2f0ee75" dependencies = [ "quote", - "syn 2.0.18", + "syn", ] [[package]] @@ -275,12 +275,12 @@ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "winapi", + "windows-targets 0.48.0", ] [[package]] @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "napi" -version = "2.13.1" +version = "2.16.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f0a2e93526dd9c8c522d72a4d0c88678be8966fabe9fb8f2947fde6339b682" +checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd" dependencies = [ "bitflags 2.6.0", "ctor", @@ -340,23 +340,23 @@ checksum = "882a73d9ef23e8dc2ebbffb6a6ae2ef467c0f18ac10711e4cc59c5485d41df0e" [[package]] name = "napi-derive" -version = "2.13.0" +version = "2.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c6a8fa84d549aa8708fcd062372bf8ec6e849de39016ab921067d21bde367" +checksum = "17435f7a00bfdab20b0c27d9c56f58f6499e418252253081bfff448099da31d1" dependencies = [ "cfg-if", "convert_case", "napi-derive-backend", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "napi-derive-backend" -version = "1.0.52" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20bbc7c69168d06a848f925ec5f0e0997f98e8c8d4f2cc30157f0da51c009e17" +checksum = "967c485e00f0bf3b1bdbe510a38a4606919cf1d34d9a37ad41f25a81aa077abe" dependencies = [ "convert_case", "once_cell", @@ -364,14 +364,14 @@ dependencies = [ "quote", "regex", "semver", - "syn 1.0.109", + "syn", ] [[package]] name = "napi-sys" -version = "2.2.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "166b5ef52a3ab5575047a9fe8d4a030cdd0f63c96f071cd6907674453b07bae3" +checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" dependencies = [ "libloading", ] @@ -574,17 +574,6 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.18" @@ -669,7 +658,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn", ] [[package]] diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index fa8ceef30a7f..0009076936ab 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -8,8 +8,8 @@ crate-type = ["cdylib"] [dependencies] # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix -napi = { version = "2.12.2", default-features = false, features = ["napi4"] } -napi-derive = "2.12.2" +napi = { version = "2.16.11", default-features = false, features = ["napi4"] } +napi-derive = "2.16.12" tailwindcss-oxide = { path = "../oxide" } rayon = "1.5.3" From e738f8a77641a288f02834f8962c56f1254a2b33 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 2 Oct 2024 14:15:14 -0400 Subject: [PATCH 14/18] Bump rust deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There’ve been some improvements in compatibility and perf in a few of them --- Cargo.lock | 303 +++++++++++++--------------------------- crates/oxide/Cargo.toml | 18 +-- 2 files changed, 106 insertions(+), 215 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ad9b03d4a60..f3ecb7a58e2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,18 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bitflags" version = "2.6.0" @@ -40,12 +28,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - [[package]] name = "cfg-if" version = "1.0.0" @@ -63,11 +45,10 @@ dependencies = [ [[package]] name = "crossbeam" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" dependencies = [ - "cfg-if", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", @@ -77,56 +58,46 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "ctor" @@ -152,33 +123,19 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "fastrand" -version = "1.9.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "glob-match" @@ -201,30 +158,15 @@ dependencies = [ [[package]] name = "globwalk" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" dependencies = [ - "bitflags 1.3.2", + "bitflags", "ignore", "walkdir", ] -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - [[package]] name = "ignore" version = "0.4.23" @@ -241,26 +183,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -269,9 +191,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libloading" @@ -285,9 +207,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" @@ -310,22 +232,13 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - [[package]] name = "napi" version = "2.16.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd" dependencies = [ - "bitflags 2.6.0", + "bitflags", "ctor", "napi-derive", "napi-sys", @@ -386,16 +299,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -434,9 +337,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -444,23 +347,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", ] [[package]] @@ -520,16 +412,15 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustix" -version = "0.37.19" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -541,12 +432,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "semver" version = "1.0.17" @@ -617,15 +502,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "once_cell", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.59.0", ] [[package]] @@ -640,11 +525,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -652,9 +536,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -663,9 +547,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -673,20 +557,20 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -761,35 +645,20 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.42.2", + "windows-targets 0.52.6", ] [[package]] name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.52.6", ] [[package]] @@ -808,10 +677,20 @@ dependencies = [ ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] [[package]] name = "windows_aarch64_gnullvm" @@ -820,10 +699,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -832,10 +711,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] -name = "windows_i686_gnu" -version = "0.42.2" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -844,10 +723,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] -name = "windows_i686_msvc" -version = "0.42.2" +name = "windows_i686_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -856,10 +741,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -868,10 +753,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" +name = "windows_x86_64_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -880,13 +765,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/crates/oxide/Cargo.toml b/crates/oxide/Cargo.toml index 483c477caa08..315fcf4f5375 100644 --- a/crates/oxide/Cargo.toml +++ b/crates/oxide/Cargo.toml @@ -4,18 +4,18 @@ version = "0.1.0" edition = "2021" [dependencies] -bstr = "1.0.1" -globwalk = "0.8.1" -log = "0.4" -rayon = "1.5.3" +bstr = "1.10.0" +globwalk = "0.9.1" +log = "0.4.22" +rayon = "1.10.0" fxhash = { package = "rustc-hash", version = "2.0.0" } -crossbeam = "0.8.2" -tracing = { version = "0.1.37", features = [] } -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -walkdir = "2.3.3" +crossbeam = "0.8.4" +tracing = { version = "0.1.40", features = [] } +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +walkdir = "2.5.0" ignore = "0.4.23" glob-match = "0.2.1" dunce = "1.0.5" [dev-dependencies] -tempfile = "3.5.0" +tempfile = "3.13.0" From 15bf21bda8e1c2f76ee1e63b2841b60aca8b4b16 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Thu, 3 Oct 2024 14:36:38 +0200 Subject: [PATCH 15/18] Only create one Scanner --- packages/@tailwindcss-postcss/src/index.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index 90d481a9008f..d9dbf73cd3c5 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -11,6 +11,7 @@ import fixRelativePathsPlugin from './postcss-fix-relative-paths' interface CacheEntry { mtimes: Map compiler: null | Awaited> + scanner: null | Scanner css: string optimizedCss: string fullRebuildPaths: string[] @@ -23,7 +24,8 @@ function getContextFromCache(inputFile: string, opts: PluginOptions): CacheEntry if (cache.has(key)) return cache.get(key)! let entry = { mtimes: new Map(), - compiler: null as null | Awaited>, + compiler: null, + scanner: null, css: '', optimizedCss: '', fullRebuildPaths: [] as string[], @@ -123,18 +125,20 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { let css = '' - // Look for candidates used to generate the CSS - let scanner = new Scanner({ - detectSources: { base }, - sources: context.compiler.globs, - }) + if (context.scanner === null) { + // Look for candidates used to generate the CSS + context.scanner = new Scanner({ + detectSources: { base }, + sources: context.compiler.globs, + }) + } env.DEBUG && console.time('[@tailwindcss/postcss] Scan for candidates') - let candidates = scanner.scan() + let candidates = context.scanner.scan() env.DEBUG && console.timeEnd('[@tailwindcss/postcss] Scan for candidates') // Add all found files as direct dependencies - for (let file of scanner.files) { + for (let file of context.scanner.files) { result.messages.push({ type: 'dependency', plugin: '@tailwindcss/postcss', @@ -146,7 +150,7 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { // Register dependencies so changes in `base` cause a rebuild while // giving tools like Vite or Parcel a glob that can be used to limit // the files that cause a rebuild to only those that match it. - for (let { base, pattern } of scanner.globs) { + for (let { base, pattern } of context.scanner.globs) { result.messages.push({ type: 'dir-dependency', plugin: '@tailwindcss/postcss', From dfb0d7bc148114b284e40574ebf1715d016d280e Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Thu, 3 Oct 2024 15:25:42 +0200 Subject: [PATCH 16/18] Ensure scanner is recreated when the compiler is too --- packages/@tailwindcss-postcss/src/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index d9dbf73cd3c5..a4031a3f4753 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -125,7 +125,16 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { let css = '' - if (context.scanner === null) { + if ( + rebuildStrategy === 'full' && + // We can re-use the compiler if it was created during the + // initial build. If it wasn't, we need to create a new one. + !isInitialBuild + ) { + context.compiler = await createCompiler() + } + + if (context.scanner === null || rebuildStrategy === 'full') { // Look for candidates used to generate the CSS context.scanner = new Scanner({ detectSources: { base }, @@ -160,15 +169,6 @@ function tailwindcss(opts: PluginOptions = {}): AcceptedPlugin { }) } - if ( - rebuildStrategy === 'full' && - // We can re-use the compiler if it was created during the - // initial build. If it wasn't, we need to create a new one. - !isInitialBuild - ) { - context.compiler = await createCompiler() - } - env.DEBUG && console.time('[@tailwindcss/postcss] Build CSS') css = context.compiler.build(candidates) env.DEBUG && console.timeEnd('[@tailwindcss/postcss] Build CSS') From 6ea41a61217ea7ff2e2391abf335806159c78f12 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Thu, 3 Oct 2024 15:48:31 +0200 Subject: [PATCH 17/18] Add test for dynamically adding `@source` --- integrations/postcss/index.test.ts | 18 ++++++++++++++++++ packages/@tailwindcss-postcss/src/index.ts | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/integrations/postcss/index.test.ts b/integrations/postcss/index.test.ts index 5c35f3e31d3b..8b236a2ef92c 100644 --- a/integrations/postcss/index.test.ts +++ b/integrations/postcss/index.test.ts @@ -380,6 +380,10 @@ test( const className = "content-['b/src/index.js']" module.exports = { className } `, + 'project-c/src/index.js': js` + const className = "content-['c/src/index.js']" + module.exports = { className } + `, }, }, async ({ root, fs, spawn }) => { @@ -444,5 +448,19 @@ test( } `, ]) + + // Adding a new @source directive will scan for new candidates + await fs.write( + 'project-a/src/index.css', + css` + @import 'tailwindcss/utilities'; + @import './custom-theme.css'; + @config '../tailwind.config.js'; + @source '../../project-b/src/**/*.html'; + @plugin '../plugin.js'; + @source '../../project-c/src/**/*.js'; + `, + ) + await fs.expectFileToContain('project-a/dist/out.css', [candidate`content-['c/src/index.js']`]) }, ) diff --git a/packages/@tailwindcss-postcss/src/index.ts b/packages/@tailwindcss-postcss/src/index.ts index a4031a3f4753..69a693971607 100644 --- a/packages/@tailwindcss-postcss/src/index.ts +++ b/packages/@tailwindcss-postcss/src/index.ts @@ -20,7 +20,6 @@ let cache = new QuickLRU({ maxSize: 50 }) function getContextFromCache(inputFile: string, opts: PluginOptions): CacheEntry { let key = `${inputFile}:${opts.base ?? ''}:${opts.optimize ?? ''}` - console.log('key:', key) if (cache.has(key)) return cache.get(key)! let entry = { mtimes: new Map(), From 93f5c9f5134bbbbb7ac8de5ac1c411e5468e6190 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 3 Oct 2024 16:21:09 +0200 Subject: [PATCH 18/18] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f594599cfb94..86dec0c18c08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use the right import base path when using the CLI to reading files from stdin ([#14522](https://github.com/tailwindlabs/tailwindcss/pull/14522)) - Ensure that `@utility` is top-level and cannot be nested ([#14525](https://github.com/tailwindlabs/tailwindcss/pull/14525)) -- Editing imported CSS files should trigger a rebuild ([#14561](https://github.com/tailwindlabs/tailwindcss/pull/14561)) - Only setup a single compiler in `@tailwindcss/postcss` for initial builds ([#14565](https://github.com/tailwindlabs/tailwindcss/pull/14565)) - Ensure editing imported CSS files triggers a rebuild ([#14561](https://github.com/tailwindlabs/tailwindcss/pull/14561)) - Ensure `@apply` and CSS functions work inside imported stylesheets ([#14576](https://github.com/tailwindlabs/tailwindcss/pull/14576))