diff --git a/package-lock.json b/package-lock.json index 1ab7f476fd8c4d..a7e5c81713af63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39759,16 +39759,16 @@ } }, "node_modules/vite": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.1.tgz", - "integrity": "sha512-/bvH9E9tmCXRGp2uXY3WbOldqpTwFkbha/8ANaEQ6VkxhH60KyqLwgZq6lG2y+4uT55x9+9eUHMpQ7uGnOCKjA==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.2.tgz", + "integrity": "sha512-SQr1x6W5vVSbROg7vsyXIaxK9b0G7zsT68acdWWRmnBUsgDieLCRG+Rep9WdZgcposvv/GSnr4GUUBqB3vXq6w==", "devOptional": true, "license": "MIT", "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.28", - "rolldown": "~1.2.9", + "rolldown": "~1.2.11", "tinyglobby": "^0.2.17" }, "bin": { @@ -46083,7 +46083,7 @@ "source-map": "^0.6.1", "storybook": "^10.5.3", "stylelint": "^17.14.1", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0", "vitest-browser-react": "^2.3.0" }, @@ -47228,7 +47228,7 @@ "storybook-addon-tag-badges": "^3.0.4", "terser": "^5.37.0", "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0" } }, @@ -47329,7 +47329,7 @@ "resize-observer-polyfill": "^1.5.1", "timezone-mock": "^1.3.6", "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0", "yargs": "^17.3.0" } diff --git a/packages/theme/CHANGELOG.md b/packages/theme/CHANGELOG.md index 9c381bddb3be3f..f3d3ca7d45c622 100644 --- a/packages/theme/CHANGELOG.md +++ b/packages/theme/CHANGELOG.md @@ -11,6 +11,7 @@ ### Internal +- Update the Vite development dependency to 8.3.2 ([#83992](https://github.com/WordPress/gutenberg/pull/83992)). - Update the Vite development dependency to 8.3.1. ([#83569](https://github.com/WordPress/gutenberg/pull/83569)) - Restore color-scale Storybook accessibility checks with labeled color samples, readable seed labels, and keyboard scrolling ([#83358](https://github.com/WordPress/gutenberg/pull/83358)). diff --git a/packages/theme/package.json b/packages/theme/package.json index 3f50144264aafa..2278a7f7412f5f 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -113,7 +113,7 @@ "source-map": "^0.6.1", "storybook": "^10.5.3", "stylelint": "^17.14.1", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0", "vitest-browser-react": "^2.3.0" }, diff --git a/storybook/main.ts b/storybook/main.ts index 722e556e842657..f7dc6882b12ed3 100644 --- a/storybook/main.ts +++ b/storybook/main.ts @@ -6,7 +6,6 @@ import emotion from '@rolldown/plugin-emotion'; import type { StorybookConfig } from '@storybook/react-vite'; import dsTokenFallbacks from '@wordpress/theme/postcss-plugins/postcss-ds-token-fallbacks'; import dsTokenFallbacksJs from '@wordpress/theme/vite-plugins/vite-ds-token-fallbacks'; -import { createPostcssBrowserPlugin } from './postcss-browser-plugin.mjs'; import { statusIndexer } from './status-indexer.js'; /** @@ -156,15 +155,6 @@ const config: StorybookConfig = { }, ], }, - optimizeDeps: { - rolldownOptions: { - plugins: [ - createPostcssBrowserPlugin( - path.resolve( import.meta.dirname, '..' ) - ), - ], - }, - }, plugins: [ dsTokenFallbacksJs(), react() as PluginOption, diff --git a/storybook/package.json b/storybook/package.json index b27213ec559f7d..785b872131e1b9 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -74,7 +74,7 @@ "storybook-addon-tag-badges": "^3.0.4", "terser": "^5.37.0", "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0" }, "publishConfig": { diff --git a/storybook/postcss-browser-plugin.mjs b/storybook/postcss-browser-plugin.mjs deleted file mode 100644 index 9aeec3f95eed3a..00000000000000 --- a/storybook/postcss-browser-plugin.mjs +++ /dev/null @@ -1,53 +0,0 @@ -import { createRequire } from 'node:module'; -import path from 'node:path'; -import { normalizePath } from 'vite'; - -const EMPTY_MODULE_ID = '\0postcss-browser-empty'; - -// Temporary workaround for https://github.com/vitejs/vite/issues/23512. -// Remove this plugin and its optimizer registration once the installed Vite -// version handles browser:false imports without warnings. Keep the Browser -// regression test and Storybook smoke check to verify removal. -// -// The separate CSS Modules missing-`from` warning is tracked in: -// https://github.com/madyankin/postcss-modules/pull/173 -// https://github.com/vitejs/vite/issues/15410 -/** - * @param {string} rootDir - * @return {import('vite').Plugin} The PostCSS browser import resolver. - */ -export function createPostcssBrowserPlugin( rootDir ) { - const require = createRequire( - path.join( rootDir, 'packages/block-editor/package.json' ) - ); - const packagePath = require.resolve( 'postcss/package.json' ); - const packageDirectory = normalizePath( path.dirname( packagePath ) ) + '/'; - const { browser } = require( packagePath ); - const disabledImports = new Set( - Object.keys( browser ).filter( - ( id ) => ! id.startsWith( '.' ) && browser[ id ] === false - ) - ); - - return { - name: 'postcss-browser-imports', - resolveId( id, importer ) { - if ( - disabledImports.has( id ) && - importer && - normalizePath( importer ).startsWith( packageDirectory ) - ) { - return EMPTY_MODULE_ID; - } - return null; - }, - load( id ) { - if ( id === EMPTY_MODULE_ID ) { - // PostCSS probes these optional APIs. Honor its browser:false - // mappings without Vite's warning-producing external proxies. - return 'module.exports = {};'; - } - return null; - }, - }; -} diff --git a/test/unit/package.json b/test/unit/package.json index 163d5d7cbed0ef..d785a1d90ecb4b 100644 --- a/test/unit/package.json +++ b/test/unit/package.json @@ -43,7 +43,7 @@ "resize-observer-polyfill": "^1.5.1", "timezone-mock": "^1.3.6", "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.3.1", + "vite": "^8.3.2", "vitest": "^5.0.0", "yargs": "^17.3.0" }, diff --git a/test/unit/vitest.config.mjs b/test/unit/vitest.config.mjs index a8f7f99111f0b2..4e1ea899ed6d2c 100644 --- a/test/unit/vitest.config.mjs +++ b/test/unit/vitest.config.mjs @@ -6,7 +6,6 @@ import { defineConfig } from 'vitest/config'; import { createVitePlugins } from './config/vite-plugins.mjs'; import { createPlaywrightProvider } from './config/playwright-provider.mjs'; import { createBrowserTraceArtifacts } from './config/browser-traces.mjs'; -import { createPostcssBrowserPlugin } from '../../storybook/postcss-browser-plugin.mjs'; import { discoverTestFiles, getVitestTestsByProject, @@ -210,9 +209,6 @@ export default defineConfig( { */ root: CONFIG_DIR, optimizeDeps: { - rolldownOptions: { - plugins: [ createPostcssBrowserPlugin( ROOT_DIR ) ], - }, entries: vitestTests.browser.map( ( testPath ) => path.join( ROOT_DIR, testPath ) ),