From cc8ad312e63132925366f28555eeabcd96e9e9b5 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 24 Jan 2024 16:23:47 +0100 Subject: [PATCH 1/2] Add viewScriptModule support --- packages/scripts/README.md | 8 ++++---- packages/scripts/utils/block-json.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/scripts/README.md b/packages/scripts/README.md index e4a2be8d9a3fa..4a3c037ce78f9 100644 --- a/packages/scripts/README.md +++ b/packages/scripts/README.md @@ -108,9 +108,9 @@ This script automatically use the optimized config but sometimes you may want to - `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`. - `--output-path` – Allows customization of the output directory. Default is `build`. -Experimental support for the block.json `viewModule` field is available via the +Experimental support for the block.json `viewScriptModule` field is available via the `--experimental-modules` option. With this option enabled, script and module fields will all be -compiled. The `viewModule` field is analogous to the `viewScript` field, but will compile a module +compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module and should be registered in WordPress using the Modules API. #### Advanced information @@ -396,9 +396,9 @@ This script automatically use the optimized config but sometimes you may want to - `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`. - `--output-path` – Allows customization of the output directory. Default is `build`. -Experimental support for the block.json `viewModule` field is available via the +Experimental support for the block.json `viewScriptModule` field is available via the `--experimental-modules` option. With this option enabled, script and module fields will all be -compiled. The `viewModule` field is analogous to the `viewScript` field, but will compile a module +compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module and should be registered in WordPress using the Modules API. #### Advanced information diff --git a/packages/scripts/utils/block-json.js b/packages/scripts/utils/block-json.js index 892cc63c889e5..e086405dd7455 100644 --- a/packages/scripts/utils/block-json.js +++ b/packages/scripts/utils/block-json.js @@ -1,4 +1,4 @@ -const moduleFields = new Set( [ 'viewModule' ] ); +const moduleFields = new Set( [ 'viewScriptModule', 'viewModule' ] ); const scriptFields = new Set( [ 'viewScript', 'script', 'editorScript' ] ); /** From 0d5f4d17ff4a489132589bbe4f885598a13a3337 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 24 Jan 2024 16:37:29 +0100 Subject: [PATCH 2/2] Add changelog --- packages/scripts/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 1983234e31ba9..20948b9963794 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +### New Features + +- Add experimental support for `viewScriptModule` field in block.json for `build` and `start` scripts ([#57437](https://github.com/WordPress/gutenberg/pull/57437)). + +### Deprecations + +- Experimental support for `viewModule` field in block.json is deprecated in favor of `viewScriptModule` ([#57437](https://github.com/WordPress/gutenberg/pull/57437)). + ## 27.1.0 (2024-01-24) ## 27.0.0 (2024-01-10)