mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
This PR improves the debug logs for the `@tailwindcss/postcss` integration. It uses custom instrumentation to provide a nested but detailed overview of where time is spent during the build process. The updated logs look like this: ``` [0.15ms] [@tailwindcss/postcss] src/app/geistsans_9fc57718.module.css [0.14ms] ↳ Quick bail check [0.02ms] [@tailwindcss/postcss] src/app/geistsans_9fc57718.module.css [0.01ms] ↳ Quick bail check [0.03ms] [@tailwindcss/postcss] src/app/geistmono_b9f59162.module.css [0.02ms] ↳ Quick bail check [0.12ms] [@tailwindcss/postcss] src/app/geistmono_b9f59162.module.css [0.11ms] ↳ Quick bail check [42.09ms] [@tailwindcss/postcss] src/app/globals.css [ 0.01ms] ↳ Quick bail check [12.12ms] ↳ Setup compiler [ 0.11ms] ↳ PostCSS AST -> Tailwind CSS AST [11.99ms] ↳ Create compiler [ 0.07ms] ↳ Register full rebuild paths [ 0.06ms] ↳ Setup scanner [ 7.51ms] ↳ Scan for candidates [ 5.86ms] ↳ Register dependency messages [ 5.88ms] ↳ Build utilities [ 8.34ms] ↳ Optimization [ 0.23ms] ↳ AST -> CSS [ 4.20ms] ↳ Lightning CSS [ 3.89ms] ↳ CSS -> PostCSS AST [ 1.97ms] ↳ Update PostCSS AST ```
20 lines
788 B
TypeScript
20 lines
788 B
TypeScript
import * as Module from 'node:module'
|
|
import { pathToFileURL } from 'node:url'
|
|
import * as env from './env'
|
|
export { __unstable__loadDesignSystem, compile, compileAst, Features } from './compile'
|
|
export * from './instrumentation'
|
|
export * from './normalize-path'
|
|
export { env }
|
|
|
|
// In Bun, ESM modules will also populate `require.cache`, so the module hook is
|
|
// not necessary.
|
|
if (!process.versions.bun) {
|
|
let localRequire = Module.createRequire(import.meta.url)
|
|
|
|
// `Module#register` was added in Node v18.19.0 and v20.6.0
|
|
//
|
|
// Not calling it means that while ESM dependencies don't get reloaded, the
|
|
// actual included files will because they cache bust directly via `?id=…`
|
|
Module.register?.(pathToFileURL(localRequire.resolve('@tailwindcss/node/esm-cache-loader')))
|
|
}
|