From fa0711bdd7069a65fd3f60fdfdebc3f74d91d577 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 6 May 2026 10:51:27 +0200 Subject: [PATCH 1/2] hide `console.warn` from test output --- packages/@tailwindcss-postcss/src/index.test.ts | 2 ++ packages/tailwindcss/src/utilities.test.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/@tailwindcss-postcss/src/index.test.ts b/packages/@tailwindcss-postcss/src/index.test.ts index 3ded1f81082a..14acdec500f1 100644 --- a/packages/@tailwindcss-postcss/src/index.test.ts +++ b/packages/@tailwindcss-postcss/src/index.test.ts @@ -146,6 +146,8 @@ describe('processing without specifying a base path', () => { }) test('fallback to `base` directory when `result.opts.from` is not provided', async () => { + using _ = vi.spyOn(console, 'warn').mockImplementation(() => {}) + let processor = postcss([ tailwindcss({ base: `${__dirname}/fixtures/example-project`, optimize: { minify: false } }), ]) diff --git a/packages/tailwindcss/src/utilities.test.ts b/packages/tailwindcss/src/utilities.test.ts index f4b235bb140a..443ef1c9f019 100644 --- a/packages/tailwindcss/src/utilities.test.ts +++ b/packages/tailwindcss/src/utilities.test.ts @@ -30148,6 +30148,7 @@ describe('custom utilities', () => { }) test('resolving unsupported bare values', async () => { + using spy = vi.spyOn(console, 'warn').mockImplementation(() => {}) let input = css` @utility tab-* { tab-size: --value(color); @@ -30157,6 +30158,22 @@ describe('custom utilities', () => { ` expect(await compileCss(input, ['tab-#0088cc', 'tab-foo'])).toEqual('') + expect( + `\n${spy.mock.calls + .map((c) => c.join(' ')) + .join('\n') + .trim()}\n`, + ).toMatchInlineSnapshot(` + " + Unsupported bare value data type: "color". + Only valid data types are: "number", "integer", "ratio", "percentage". + + \`\`\`css + --value(color) + ^^^^^ + \`\`\` + " + `) }) test('resolving arbitrary values', async () => { From 1cb7254b94332057a5d107cd3683691c44d6ada6 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 6 May 2026 10:52:56 +0200 Subject: [PATCH 2/2] use source files instead of dist files in `@tailwindcss/node` In other packages we use the src files as well and only use the dist/ files when we actually publish. This solves an issue where we _have_ to build `@tailwindcss/node` first, and gets rid of some of the warnings you get when running tests. --- packages/@tailwindcss-node/package.json | 32 ++++++++++++++----- .../@tailwindcss-node/src/require-cache.ts | 5 +++ 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 packages/@tailwindcss-node/src/require-cache.ts diff --git a/packages/@tailwindcss-node/package.json b/packages/@tailwindcss-node/package.json index 560bd17efeb4..80335b8943ba 100644 --- a/packages/@tailwindcss-node/package.json +++ b/packages/@tailwindcss-node/package.json @@ -19,21 +19,37 @@ ], "publishConfig": { "provenance": true, - "access": "public" + "access": "public", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./require-cache": { + "types": "./dist/require-cache.d.ts", + "default": "./dist/require-cache.js" + }, + "./esm-cache-loader": { + "types": "./dist/esm-cache.loader.d.mts", + "default": "./dist/esm-cache.loader.mjs" + } + } }, "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.mjs", - "require": "./dist/index.js" + "types": "./src/index.ts", + "import": "./src/index.ts", + "require": "./src/index.cts" }, "./require-cache": { - "types": "./dist/require-cache.d.ts", - "default": "./dist/require-cache.js" + "types": "./src/require-cache.ts", + "import": "./src/require-cache.ts", + "require": "./src/require-cache.cts" }, "./esm-cache-loader": { - "types": "./dist/esm-cache.loader.d.mts", - "default": "./dist/esm-cache.loader.mjs" + "types": "./src/esm-cache.loader.mts", + "default": "./src/esm-cache.loader.mts" } }, "dependencies": { diff --git a/packages/@tailwindcss-node/src/require-cache.ts b/packages/@tailwindcss-node/src/require-cache.ts new file mode 100644 index 000000000000..ea0562019468 --- /dev/null +++ b/packages/@tailwindcss-node/src/require-cache.ts @@ -0,0 +1,5 @@ +export function clearRequireCache(files: string[]) { + for (let key of files) { + delete require.cache[key] + } +}