-
Notifications
You must be signed in to change notification settings - Fork 3
build: Upgrade dependencies #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Enable importing the package's CSS files, which is promoted as an option in the Gutenberg Framework documentation: https://wordpress.org/gutenberg-framework/docs/intro#bootstrap-your-block-editor The package `exports` field was added in: WordPress/gutenberg@f13dcfa Without these exports, Vite's build fails with the following error: ``` (!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: Failed to scan for dependencies from entries: ./GutenbergKit/src/index.html ✘ [ERROR] Missing "./build-style/style.css" specifier in "@wordpress/format-library" package [plugin vite:dep-scan] src/utils/editor-styles.js:11:7: 11 │ import '@wordpress/format-library/build-style/style.css'; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This error came from the "onResolve" callback registered here: node_modules/esbuild/lib/main.js:1151:20: 1151 │ let promise = setup({ ╵ ^ at setup (file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:31620:12) at handlePlugins (./GutenbergKit/node_modules/esbuild/lib/main.js:1151:21) ```
This existing import resulted in the following Vite build error. This began occurring after upgrading the package. Presumably, this began occurring due to the addition of the `exports` field to the package in: WordPress/gutenberg@f13dcfa ``` (!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: The following dependencies are imported but could not be resolved: @wordpress/core-commands (imported by ./GutenbergKit/src/utils/wordpress-globals.js) Are they installed? at file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:31896:33 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:34104:15 ```
Disable externalization of `raw` imports as the global does not provide the required ability to inline the raw imported value.
This once private API is now a public export of the new `@wordpress/global-styles-engine` package. WordPress/gutenberg@fa08e73df3#diff-3203defa3f9fa7d0f14af961ece72d1a2dabc639b1d746b975ab0d98fcfb7ab1L9-L10
Load these styles in the editor block canvas `iframe` to minimize potential style collisions in the top-level editor. These styles are only intended for content within the editor, not the editor UI itself.
Rely upon the "toolbar" `variant` configuration to ensure each toolbar group renders a separating right border.
c8da5eb to
f0f168c
Compare
This `@wordpress/eslint-plugin@22.21.0` changed the import resolution behavior. This is incompatible with the GutenbergKit project for an unknown reason, possibly the lack of TypeScript setup. ``` Unable to resolve path to module '[module_name]' import/no-unresolved ``` See: https://github.com/WordPress/gutenberg/blob/2d2571507d8ea76f263089c98c46110403e3eba3/packages/eslint-plugin/CHANGELOG.md#22210-2025-11-12
With the previous mock, the entire `@wordpress/data` module was replaced. This led to emptying utilities like `createReduxStore`. This resulted in other `@wordpress` modules throwing errors when attempting to act upon stores. ``` FAIL src/utils/editor.test.jsx [ src/utils/editor.test.jsx ] Error: Cannot unlock an undefined object. ❯ unlock node_modules/@wordpress/private-apis/src/implementation.ts:186:9 ❯ node_modules/@wordpress/blocks/src/store/index.js:31:1 ❯ node_modules/@wordpress/blocks/src/index.js:11:1 ```
9d7c3e2 to
6dced9e
Compare
The latest version of `@vitejs/plugin-react` is ESM-only. This is incompatible with `@wordpress/eslint-plugin`'s usage of `eslint-import-resolver-node`. Once `eslint-import-resolver-node` is upgraded or replaced with a more capable alternative, we can remove the `eslint-disable-line` comments. Resulting error: ``` Unable to resolve path to module '@vitejs/plugin-react' import/no-unresolved ``` See: vitejs/vite-plugin-react#691 (comment)
`tsconfig.json` introduced as `@wordpress/eslint-plugin`'s replaced its usage of `eslint-import-resolver-node` with `eslint-import-resolver-typescript`. Those changes now require a `tsconfig.json` file to ensure the resolver works properly. The `tsconfig.json` does not add TypeScript support. See: WordPress/gutenberg@a4ba451#diff-691525462f8b4cac47c3c2e0e2668606f539ed0b3f62f8f6b79dffe7ef38bd9d `legacy-peer-deps=true` introduced to address a dependency version conflict. See Claude's explanation: > 1. eslint-import-resolver-typescript@4.4.4 has an optional peer dependency on eslint-plugin-import-x > 2. eslint-plugin-import-x requires @typescript-eslint/utils@^8.0.0 > 3. @wordpress/eslint-plugin@22.22.0 depends on @typescript-eslint/eslint-plugin@^6.4.1, which uses @typescript-eslint/utils@6.21.0 > > So we have: > - @typescript-eslint/utils@6.21.0 (from @wordpress/eslint-plugin chain) > - @typescript-eslint/utils@8.48.1 (wanted by eslint-plugin-import-x, optional peer of the resolver) > > Since eslint-plugin-import-x is marked as optional in the resolver, using --legacy-peer-deps should be safe. The resolver will work without it - it's > an alternative to eslint-plugin-import for those who want to use it. Once `@wordpress/eslint-plugin` updates its `@typescript-eslint` dependencies to v8.x, we can remove the `legacy-peer-deps` usage.
These styles overrode foundational styles causing unexpected layout bugs. E.g., the theme styles removed the top margin from image blocks.
This is no strictly necessary currently as we disable `shouldIframe`, but it further aligns GutenbergKit with Gutenberg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces patches/@wordpress+block-editor+14.17.0.patch one-for-one, aside from the inline comment below.
| + "./build-module/components/inserter/media-tab/*": "./build-module/components/inserter/media-tab/*", | ||
| + "./build-module/components/inserter/hooks/*": "./build-module/components/inserter/hooks/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given GutenbergKit accesses private modules paths, we must explicitly export these modules now that @wordpress/block-editor defines exports of its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes. This existing patch was recreated for the new @wordpress/block-library version.
| }, | ||
| - "./package.json": "./package.json" | ||
| + "./package.json": "./package.json", | ||
| + "./build-style/*": "./build-style/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wordpress/editor seemingly mistakenly overlooks exporting its styles. This needs to be contributed to the upstream WordPress/gutenberg repository.
| }, | ||
| - "./package.json": "./package.json" | ||
| + "./package.json": "./package.json", | ||
| + "./build-style/*": "./build-style/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wordpress/format-library seemingly mistakenly overlooks exporting its styles. This needs to be contributed to the upstream WordPress/gutenberg repository.
| store: { name: 'core/editor' }, | ||
| } ) ); | ||
| vi.mock( '@wordpress/data' ); | ||
| vi.mock( import( '@wordpress/data' ), { spy: true } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix test failures by using the original module rather than a partial mock that caused errors within other @wordpress modules.
| @@ -0,0 +1 @@ | |||
| legacy-peer-deps=true | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to fix a @typescript-eslint/utils dependency conflict. See e9f99f4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not add TypeScript support. Added to address a new (mistaken?) TypeScript configuration requirement by @wordpress/eslint-plugin. See e9f99f4.
| const imports = defaultImport || namedImports; | ||
|
|
||
| if ( module.match( /\.css\?inline$/ ) ) { | ||
| if ( module.match( /\.css\?(inline|raw)$/ ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added for robustness and avoid cryptic. There is no active use of Vite's raw query parameter at the present.
| window.wp.commands = commands; | ||
| window.wp.components = components; | ||
| window.wp.compose = compose; | ||
| window.wp.coreCommands = coreCommands; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module began throwing errors related to unresolved modules, likely due to the new exports usage in Gutenberg packages.
I opted to remove the module entirely, as the WP Admin commands library feels unrelated to (and presumably unused in) the mobile editor.
| componentStyles, | ||
| blockEditorContentStyles, | ||
| blocksStyles, | ||
| blocksEditorStyles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relocated from utils/editor-styles to scope their loading to the block canvas iframe, per the Gutenberg Framework guides.
The patch was removed in 6fc0ca5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch was removed as it is no longer necessary after WordPress/gutenberg@01d3959.
What?
Upgrade dependencies to the latest versions.
Why?
Integrate the latest bug fixes and features.
How?
@wordpresspackages.@wordpress/componentspatch.@wordpresspackages for new dependency versions.@wordpress/editorand@wordpress/format-librarystylesheets.getLayoutStylesAPI with new public export from the@wordpress/global-styles-enginepackage.eslint- [eslint-plugin] Update eslint to v9 and typescript-eslint to v8 WordPress/gutenberg#64782reactandreact-dom- Upgrading to React 19 WordPress/gutenberg#71336legacy-peer-deps=trueto address optional@typescript-eslint/utilsdependency version conflict. See e9f99f4.tsconfig.jsonto address new (mistaken?)tsconfig.jsonrequirement by@wordpress/eslint-plugin. See e9f99f4.Testing Instructions
Tip
Test using the prototype builds:
Broadly test various aspects of the editor to avoid regressions.
Accessibility Testing Instructions
No specific user-facing changes to test.
Screenshots or screencast
No user-facing changes.