{
onChange( blocks, { selection: undefined } );
onChoosePattern();
diff --git a/packages/editor/src/components/visual-editor/style.scss b/packages/editor/src/components/visual-editor/style.scss
index fae61eda6b8013..63df28f0f1ba5a 100644
--- a/packages/editor/src/components/visual-editor/style.scss
+++ b/packages/editor/src/components/visual-editor/style.scss
@@ -1,8 +1,19 @@
.editor-visual-editor {
position: relative;
display: flex;
+
+ // This duplicates the iframe background but it's necessary in some situations
+ // when the iframe doesn't cover the whole canvas
+ // like the "focused entities".
background-color: $gray-300;
+ // This overrides the iframe background since it's applied again here
+ // It also prevents some style glitches if `editor-visual-editor`
+ // like when hovering the preview in the site editor.
+ iframe[name="editor-canvas"] {
+ background-color: transparent;
+ }
+
// Centralize the editor horizontally (flex-direction is column).
align-items: center;
diff --git a/packages/editor/src/store/constants.ts b/packages/editor/src/store/constants.ts
index 78708f00cc9eb7..73d6a104370c37 100644
--- a/packages/editor/src/store/constants.ts
+++ b/packages/editor/src/store/constants.ts
@@ -8,8 +8,6 @@ export const EDIT_MERGE_PROPERTIES = new Set( [ 'meta' ] );
/**
* Constant for the store module (or reducer) key.
- *
- * @type {string}
*/
export const STORE_NAME = 'core/editor';
diff --git a/packages/editor/src/store/index.js b/packages/editor/src/store/index.js
index 392f5f42cbd55b..a3241a2fc7e184 100644
--- a/packages/editor/src/store/index.js
+++ b/packages/editor/src/store/index.js
@@ -18,8 +18,6 @@ import { unlock } from '../lock-unlock';
* Post editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
- *
- * @type {Object}
*/
export const storeConfig = {
reducer,
@@ -31,8 +29,6 @@ export const storeConfig = {
* Store definition for the editor namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
- *
- * @type {Object}
*/
export const store = createReduxStore( STORE_NAME, {
...storeConfig,
diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js
index 2396cb67c73e69..db452be5c17abb 100644
--- a/packages/editor/src/store/selectors.js
+++ b/packages/editor/src/store/selectors.js
@@ -442,8 +442,8 @@ export function isCurrentPostPending( state ) {
/**
* Return true if the current post has already been published.
*
- * @param {Object} state Global application state.
- * @param {Object?} currentPost Explicit current post for bypassing registry selector.
+ * @param {Object} state Global application state.
+ * @param {Object} [currentPost] Explicit current post for bypassing registry selector.
*
* @return {boolean} Whether the post has been published.
*/
diff --git a/packages/element/package.json b/packages/element/package.json
index 3004dadb7ea605..4a196255971cfb 100644
--- a/packages/element/package.json
+++ b/packages/element/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -40,6 +41,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json
index 72863ce15fd8b8..135876460bd05e 100644
--- a/packages/escape-html/package.json
+++ b/packages/escape-html/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -32,6 +33,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/fields/package.json b/packages/fields/package.json
index e0b7125cf3e4eb..34ef8992f93adf 100644
--- a/packages/fields/package.json
+++ b/packages/fields/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": [
"build-style/**",
@@ -62,6 +63,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/format-library/package.json b/packages/format-library/package.json
index f07ba0f4b61b35..41852910ff5389 100644
--- a/packages/format-library/package.json
+++ b/packages/format-library/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/a11y": "*",
@@ -46,6 +47,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/hooks/package.json b/packages/hooks/package.json
index d0f2fd381b83ca..857cb24a877468 100644
--- a/packages/hooks/package.json
+++ b/packages/hooks/package.json
@@ -25,12 +25,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json
index d717a89bf049b8..4ecab2056c9c3a 100644
--- a/packages/html-entities/package.json
+++ b/packages/html-entities/package.json
@@ -26,12 +26,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/i18n/package.json b/packages/i18n/package.json
index 33de2873f75a6a..53e81b64a65349 100644
--- a/packages/i18n/package.json
+++ b/packages/i18n/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"bin": {
"pot-to-php": "./tools/pot-to-php.js"
@@ -39,6 +40,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/icons/package.json b/packages/icons/package.json
index 125b6f19beaa02..895f2e184b4e48 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -16,7 +16,6 @@
"url": "git+https://github.com/WordPress/gutenberg.git",
"directory": "packages/icons"
},
- "sideEffects": false,
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
@@ -27,7 +26,9 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
+ "sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/element": "*",
@@ -35,6 +36,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/interactivity-router/package.json b/packages/interactivity-router/package.json
index ce9b268af556ac..378ddda56ee76b 100644
--- a/packages/interactivity-router/package.json
+++ b/packages/interactivity-router/package.json
@@ -25,8 +25,8 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
- "types": "build-types",
"wpScriptModuleExports": "./build-module/index.js",
+ "types": "build-types",
"dependencies": {
"@wordpress/a11y": "*",
"@wordpress/interactivity": "*"
diff --git a/packages/interactivity/package.json b/packages/interactivity/package.json
index 106ed44bf44d39..c9edd586bc9959 100644
--- a/packages/interactivity/package.json
+++ b/packages/interactivity/package.json
@@ -25,11 +25,11 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
- "types": "build-types",
"wpScriptModuleExports": {
".": "./build-module/index.js",
"./debug": "./build-module/debug.js"
},
+ "types": "build-types",
"dependencies": {
"@preact/signals": "^1.3.0",
"preact": "^10.24.2"
diff --git a/packages/interface/package.json b/packages/interface/package.json
index 807135ae0160a6..f6a7952cb0d051 100644
--- a/packages/interface/package.json
+++ b/packages/interface/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": [
"build-style/**",
"src/**/*.scss",
@@ -52,6 +53,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json
index 8da2643a58b840..7dafdea88e7a4f 100644
--- a/packages/is-shallow-equal/package.json
+++ b/packages/is-shallow-equal/package.json
@@ -34,6 +34,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -41,6 +42,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json
index 50ee79d554a89f..ce029907c0dbf4 100644
--- a/packages/keyboard-shortcuts/package.json
+++ b/packages/keyboard-shortcuts/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/data": "*",
@@ -36,6 +37,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json
index 3e820ef68cf97e..2038db1984760f 100644
--- a/packages/keycodes/package.json
+++ b/packages/keycodes/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -33,6 +34,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json
index 129909a948ef1d..328695f31925ee 100644
--- a/packages/list-reusable-blocks/package.json
+++ b/packages/list-reusable-blocks/package.json
@@ -25,6 +25,7 @@
},
"main": "build/index.js",
"module": "build-module/index.js",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/api-fetch": "*",
@@ -41,6 +42,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json
index 20eef4dd83c6b4..e57b0f51844504 100644
--- a/packages/media-utils/package.json
+++ b/packages/media-utils/package.json
@@ -25,6 +25,7 @@
},
"main": "build/index.js",
"module": "build-module/index.js",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -36,6 +37,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/notices/package.json b/packages/notices/package.json
index 34d2253870128b..f150616445b060 100644
--- a/packages/notices/package.json
+++ b/packages/notices/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -36,6 +37,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/npm-package-json-lint-config/CHANGELOG.md b/packages/npm-package-json-lint-config/CHANGELOG.md
index 9c0aafedcead1a..9dee828f63fea0 100644
--- a/packages/npm-package-json-lint-config/CHANGELOG.md
+++ b/packages/npm-package-json-lint-config/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Enhancement
+
+- Include `exports`, `wpScript`, `wpScriptModuleExports` and `sideEffects` in the `prefer-property-order` rule ([#66239](https://github.com/WordPress/gutenberg/pull/66239)).
+
## 5.11.0 (2024-10-30)
## 5.10.0 (2024-10-16)
diff --git a/packages/npm-package-json-lint-config/index.js b/packages/npm-package-json-lint-config/index.js
index 831970c59bf3a6..e1abd5e34f99c5 100644
--- a/packages/npm-package-json-lint-config/index.js
+++ b/packages/npm-package-json-lint-config/index.js
@@ -56,8 +56,12 @@ const defaultConfig = {
'type',
'main',
'module',
+ 'exports',
'react-native',
+ 'wpScript',
+ 'wpScriptModuleExports',
'types',
+ 'sideEffects',
'bin',
'dependencies',
'devDependencies',
diff --git a/packages/nux/package.json b/packages/nux/package.json
index ccf1cb774c2424..50a4d5acf6d028 100644
--- a/packages/nux/package.json
+++ b/packages/nux/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": [
"build-style/**",
"src/**/*.scss",
@@ -46,6 +47,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/patterns/package.json b/packages/patterns/package.json
index 92ef655dc3c9c7..d29fc9bcf49bca 100644
--- a/packages/patterns/package.json
+++ b/packages/patterns/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": [
"build-style/**",
"src/**/*.scss",
@@ -53,6 +54,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/plugins/package.json b/packages/plugins/package.json
index b741c0359b32b1..a926c2fd9a4e17 100644
--- a/packages/plugins/package.json
+++ b/packages/plugins/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -43,6 +44,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json
index e2623eac1a021c..05d2cf7031929d 100644
--- a/packages/preferences-persistence/package.json
+++ b/packages/preferences-persistence/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -33,6 +34,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/preferences/package.json b/packages/preferences/package.json
index ef231f359ba143..205f9b5d4966b1 100644
--- a/packages/preferences/package.json
+++ b/packages/preferences/package.json
@@ -27,6 +27,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -47,6 +48,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/primitives/package.json b/packages/primitives/package.json
index 04c3cc86dddec3..d24bc1acf25e2d 100644
--- a/packages/primitives/package.json
+++ b/packages/primitives/package.json
@@ -26,10 +26,11 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
+ "types": "build-types",
"sideEffects": [
"src/**/*.scss"
],
- "types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/element": "*",
@@ -40,6 +41,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json
index 91020c0f81db24..8c98b0b3552198 100644
--- a/packages/priority-queue/package.json
+++ b/packages/priority-queue/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -34,6 +35,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/private-apis/package.json b/packages/private-apis/package.json
index 9364a596c39af0..84436470521332 100644
--- a/packages/private-apis/package.json
+++ b/packages/private-apis/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -33,6 +34,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json
index d98a4d7711f89c..31c4d98fa475e0 100644
--- a/packages/react-i18n/package.json
+++ b/packages/react-i18n/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -35,6 +36,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json
index 489bc14632ded2..b3aa6fa79474a8 100644
--- a/packages/redux-routine/package.json
+++ b/packages/redux-routine/package.json
@@ -27,6 +27,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -40,6 +41,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json
index 82a812163a0ccc..e2649609016642 100644
--- a/packages/reusable-blocks/package.json
+++ b/packages/reusable-blocks/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": [
"{src,build,build-module}/{index.js,store/index.js}"
],
@@ -48,6 +49,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json
index 4a5fe0f8e9d5ca..f038e097668984 100644
--- a/packages/rich-text/package.json
+++ b/packages/rich-text/package.json
@@ -25,11 +25,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
+ "types": "build-types",
"sideEffects": [
"src/**/*.scss",
"{src,build,build-module}/{index.js,store/index.js}"
],
- "types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/a11y": "*",
@@ -47,6 +48,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/router/package.json b/packages/router/package.json
index 1822e79a317102..3d80481c9b6baa 100644
--- a/packages/router/package.json
+++ b/packages/router/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7",
@@ -38,6 +39,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md
index ca5a44bca62b52..c09cfd1ac9aaaa 100644
--- a/packages/scripts/CHANGELOG.md
+++ b/packages/scripts/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Bug Fix
+
+- Make `start` script more resilient for developer errors ([#66752](https://github.com/WordPress/gutenberg/pull/66752)).
+
## 30.4.0 (2024-10-30)
### Enhancements
diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js
index dfb44730438c4a..3d99f3784859df 100644
--- a/packages/scripts/utils/config.js
+++ b/packages/scripts/utils/config.js
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
-const chalk = require( 'chalk' );
const { readFileSync } = require( 'fs' );
const { basename, dirname, extname, join, sep } = require( 'path' );
const { sync: glob } = require( 'fast-glob' );
@@ -21,7 +20,8 @@ const {
getBlockJsonModuleFields,
getBlockJsonScriptFields,
} = require( './block-json' );
-const { log } = console;
+
+const { warn } = console;
// See https://babeljs.io/docs/en/config-files#configuration-file-types.
const hasBabelConfig = () =>
@@ -209,10 +209,8 @@ function getWebpackEntryPoints( buildType ) {
// Continue only if the source directory exists.
if ( ! hasProjectFile( getWordPressSrcDirectory() ) ) {
- log(
- chalk.yellow(
- `Source directory "${ getWordPressSrcDirectory() }" was not found. Please confirm there is a "src" directory in the root or the value passed to --webpack-src-dir is correct.`
- )
+ warn(
+ `Source directory "${ getWordPressSrcDirectory() }" was not found. Please confirm there is a "src" directory in the root or the value passed to --webpack-src-dir is correct.`
);
return {};
}
@@ -240,12 +238,13 @@ function getWebpackEntryPoints( buildType ) {
try {
parsedBlockJson = JSON.parse( fileContents );
} catch ( error ) {
- chalk.yellow(
- `Skipping "${ blockMetadataFile.replace(
+ warn(
+ `Not scanning "${ blockMetadataFile.replace(
fromProjectRoot( sep ),
''
- ) }" due to malformed JSON.`
+ ) }" due to collect entry points due to malformed JSON.`
);
+ continue;
}
const fields =
@@ -270,18 +269,16 @@ function getWebpackEntryPoints( buildType ) {
// Takes the path without the file extension, and relative to the defined source directory.
if ( ! filepath.startsWith( srcDirectory ) ) {
- log(
- chalk.yellow(
- `Skipping "${ value.replace(
- 'file:',
- ''
- ) }" listed in "${ blockMetadataFile.replace(
- fromProjectRoot( sep ),
- ''
- ) }". File is located outside of the "${ getWordPressSrcDirectory() }" directory.`
- )
+ warn(
+ `Skipping "${ value.replace(
+ 'file:',
+ ''
+ ) }" listed in "${ blockMetadataFile.replace(
+ fromProjectRoot( sep ),
+ ''
+ ) }". File is located outside of the "${ getWordPressSrcDirectory() }" directory.`
);
- return;
+ continue;
}
const entryName = filepath
.replace( extname( filepath ), '' )
@@ -298,18 +295,16 @@ function getWebpackEntryPoints( buildType ) {
);
if ( ! entryFilepath ) {
- log(
- chalk.yellow(
- `Skipping "${ value.replace(
- 'file:',
- ''
- ) }" listed in "${ blockMetadataFile.replace(
- fromProjectRoot( sep ),
- ''
- ) }". File does not exist in the "${ getWordPressSrcDirectory() }" directory.`
- )
+ warn(
+ `Skipping "${ value.replace(
+ 'file:',
+ ''
+ ) }" listed in "${ blockMetadataFile.replace(
+ fromProjectRoot( sep ),
+ ''
+ ) }". File does not exist in the "${ getWordPressSrcDirectory() }" directory.`
);
- return;
+ continue;
}
entryPoints[ entryName ] = entryFilepath;
}
@@ -334,10 +329,8 @@ function getWebpackEntryPoints( buildType ) {
} );
if ( ! entryFile ) {
- log(
- chalk.yellow(
- `No entry file discovered in the "${ getWordPressSrcDirectory() }" directory.`
- )
+ warn(
+ `No entry file discovered in the "${ getWordPressSrcDirectory() }" directory.`
);
return {};
}
@@ -370,13 +363,24 @@ function getPhpFilePaths( context, props ) {
const srcDirectory = fromProjectRoot( context + sep );
return blockMetadataFiles.flatMap( ( blockMetadataFile ) => {
- const blockJson = JSON.parse( readFileSync( blockMetadataFile ) );
-
const paths = [];
+ let parsedBlockJson;
+ try {
+ parsedBlockJson = JSON.parse( readFileSync( blockMetadataFile ) );
+ } catch ( error ) {
+ warn(
+ `Not scanning "${ blockMetadataFile.replace(
+ fromProjectRoot( sep ),
+ ''
+ ) }" due to detect render files due to malformed JSON.`
+ );
+ return paths;
+ }
+
for ( const prop of props ) {
if (
- typeof blockJson?.[ prop ] !== 'string' ||
- ! blockJson[ prop ]?.startsWith( 'file:' )
+ typeof parsedBlockJson?.[ prop ] !== 'string' ||
+ ! parsedBlockJson[ prop ]?.startsWith( 'file:' )
) {
continue;
}
@@ -384,21 +388,19 @@ function getPhpFilePaths( context, props ) {
// Removes the `file:` prefix.
const filepath = join(
dirname( blockMetadataFile ),
- blockJson[ prop ].replace( 'file:', '' )
+ parsedBlockJson[ prop ].replace( 'file:', '' )
);
// Takes the path without the file extension, and relative to the defined source directory.
if ( ! filepath.startsWith( srcDirectory ) ) {
- log(
- chalk.yellow(
- `Skipping "${ blockJson[ prop ].replace(
- 'file:',
- ''
- ) }" listed in "${ blockMetadataFile.replace(
- fromProjectRoot( sep ),
- ''
- ) }". File is located outside of the "${ context }" directory.`
- )
+ warn(
+ `Skipping "${ parsedBlockJson[ prop ].replace(
+ 'file:',
+ ''
+ ) }" listed in "${ blockMetadataFile.replace(
+ fromProjectRoot( sep ),
+ ''
+ ) }". File is located outside of the "${ context }" directory.`
);
continue;
}
diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json
index 0bb27f17ad62d0..cdfe9679c5049d 100644
--- a/packages/server-side-render/package.json
+++ b/packages/server-side-render/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/api-fetch": "*",
@@ -45,6 +46,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json
index f85efeb91e1803..c476788e3cfaf8 100644
--- a/packages/shortcode/package.json
+++ b/packages/shortcode/package.json
@@ -25,12 +25,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"memize": "^2.0.1"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json
index 76ce2ccbb1445d..378f4dce91dad9 100644
--- a/packages/style-engine/package.json
+++ b/packages/style-engine/package.json
@@ -27,6 +27,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -35,6 +36,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/sync/package.json b/packages/sync/package.json
index 95be09803a75f1..d7181479327d3a 100644
--- a/packages/sync/package.json
+++ b/packages/sync/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -41,6 +42,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/token-list/package.json b/packages/token-list/package.json
index 0d966edeb9ee7d..370d50e5b4700a 100644
--- a/packages/token-list/package.json
+++ b/packages/token-list/package.json
@@ -25,12 +25,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/undo-manager/package.json b/packages/undo-manager/package.json
index f0464d7fd2f9e2..66f895f8da887d 100644
--- a/packages/undo-manager/package.json
+++ b/packages/undo-manager/package.json
@@ -26,6 +26,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -34,6 +35,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/url/package.json b/packages/url/package.json
index 885efe28f8e8b4..2ecdb8eae18113 100644
--- a/packages/url/package.json
+++ b/packages/url/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"dependencies": {
@@ -33,6 +34,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/viewport/package.json b/packages/viewport/package.json
index 05e098f65e1aeb..224da8a871addf 100644
--- a/packages/viewport/package.json
+++ b/packages/viewport/package.json
@@ -25,6 +25,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/compose": "*",
@@ -36,6 +37,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/vips/package.json b/packages/vips/package.json
index 810b8d2b5c9fc4..69912b2eaed71e 100644
--- a/packages/vips/package.json
+++ b/packages/vips/package.json
@@ -25,12 +25,12 @@
},
"main": "build/index.js",
"module": "build-module/index.js",
+ "wpScript": true,
"types": "build-types",
"dependencies": {
"wasm-vips": "^0.0.10"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/warning/package.json b/packages/warning/package.json
index cae2aefa421ffe..d9c5a4dd83dc10 100644
--- a/packages/warning/package.json
+++ b/packages/warning/package.json
@@ -25,10 +25,10 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"types": "build-types",
"sideEffects": false,
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/widgets/package.json b/packages/widgets/package.json
index b7fa362d615856..a755890c48ed92 100644
--- a/packages/widgets/package.json
+++ b/packages/widgets/package.json
@@ -23,6 +23,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"dependencies": {
"@babel/runtime": "7.25.7",
"@wordpress/api-fetch": "*",
@@ -44,6 +45,5 @@
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json
index a9f8304f79d8ff..117e2227a926c8 100644
--- a/packages/wordcount/package.json
+++ b/packages/wordcount/package.json
@@ -25,12 +25,12 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
+ "wpScript": true,
"sideEffects": false,
"dependencies": {
"@babel/runtime": "7.25.7"
},
"publishConfig": {
"access": "public"
- },
- "wpScript": true
+ }
}
diff --git a/storybook/stories/playground/zoom-out/index.js b/storybook/stories/playground/zoom-out/index.js
index 4f2efcf48523e8..8b72a831d710e8 100644
--- a/storybook/stories/playground/zoom-out/index.js
+++ b/storybook/stories/playground/zoom-out/index.js
@@ -50,7 +50,7 @@ export default function EditorZoomOut( { zoomLevel } ) {
event.stopPropagation() }
- style={ { background: '#ddd', border: '1px solid gray' } }
+ style={ { border: '1px solid gray' } }
>
{
- test.beforeEach( async ( { admin, editor } ) => {
- await admin.createNewPost();
- await expect(
- editor.canvas.getByRole( 'textbox', { name: 'Add title' } )
- ).toBeFocused();
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'emptytheme' );
+ } );
+
+ test.beforeEach( async ( { admin } ) => {
+ await admin.visitSiteEditor( {
+ postId: 'emptytheme//index',
+ postType: 'wp_template',
+ canvas: 'edit',
+ } );
} );
test.afterAll( async ( { requestUtils } ) => {
- await requestUtils.deleteAllPosts();
+ await requestUtils.activateTheme( 'twentytwentyone' );
} );
test( 'Should prevent selecting intermediary blocks', async ( {
editor,
page,
} ) => {
+ // Clear all content
+ await editor.setContent( '' );
+
// Insert a section with a nested block and an editable block.
await editor.insertBlock( {
name: 'core/group',
diff --git a/test/e2e/specs/site-editor/template-hierarchy.spec.js b/test/e2e/specs/site-editor/template-hierarchy.spec.js
new file mode 100644
index 00000000000000..5fcc77da9942ce
--- /dev/null
+++ b/test/e2e/specs/site-editor/template-hierarchy.spec.js
@@ -0,0 +1,35 @@
+/**
+ * WordPress dependencies
+ */
+const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
+
+test.describe( 'Template hierarchy', () => {
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyfour' );
+ } );
+
+ test.afterEach( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ } );
+
+ test( 'shows correct template with page on front option', async ( {
+ admin,
+ page,
+ editor,
+ } ) => {
+ await admin.visitAdminPage( 'options-reading.php' );
+ await page.click( 'input[name="show_on_front"][value="page"]' );
+ await page.selectOption( 'select[name="page_on_front"]', '2' );
+ await page.click( 'input[type="submit"]' );
+ await admin.visitSiteEditor();
+
+ // Title block should contain "Sample Page"
+ await expect(
+ editor.canvas.locator( 'role=document[name="Block: Title"]' )
+ ).toContainText( 'Sample Page' );
+
+ await admin.visitAdminPage( 'options-reading.php' );
+ await page.click( 'input[name="show_on_front"][value="posts"]' );
+ await page.click( 'input[type="submit"]' );
+ } );
+} );
diff --git a/test/performance/fixtures/perf-utils.ts b/test/performance/fixtures/perf-utils.ts
index 83213a59520dd5..592e8194852e3b 100644
--- a/test/performance/fixtures/perf-utils.ts
+++ b/test/performance/fixtures/perf-utils.ts
@@ -150,7 +150,7 @@ export class PerfUtils {
}
/**
- * Generates and loads a 1000 empty paragraphs into the editor canvas.
+ * Generates and loads a 1000 paragraphs into the editor canvas.
*/
async load1000Paragraphs() {
await this.page.waitForFunction(
@@ -161,7 +161,7 @@ export class PerfUtils {
const { createBlock } = window.wp.blocks;
const { dispatch } = window.wp.data;
const blocks = Array.from( { length: 1000 } ).map( () =>
- createBlock( 'core/paragraph' )
+ createBlock( 'core/paragraph', { content: 'paragraph' } )
);
dispatch( 'core/block-editor' ).resetBlocks( blocks );
} );
diff --git a/test/performance/specs/post-editor.spec.js b/test/performance/specs/post-editor.spec.js
index becbf375eff2ac..85d334749f6f51 100644
--- a/test/performance/specs/post-editor.spec.js
+++ b/test/performance/specs/post-editor.spec.js
@@ -270,7 +270,7 @@ test.describe( 'Post Editor Performance', () => {
const canvas = await perfUtils.getCanvas();
const paragraphs = canvas.getByRole( 'document', {
- name: /Empty block/i,
+ name: /Block: Paragraph/i,
} );
const samples = 10;