Skip to content
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

Scripts: Add viewScriptModule block.json support #58203

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 4 additions & 4 deletions packages/scripts/README.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/scripts/utils/block-json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const moduleFields = new Set( [ 'viewModule' ] );
const moduleFields = new Set( [ 'viewScriptModule', 'viewModule' ] );
const scriptFields = new Set( [ 'viewScript', 'script', 'editorScript' ] );

/**

Unchanged files with check annotations Beta

( node, propName ) => ( node as any )[ propName ],
name
);
expect( [ type, hydratedAttr ] ).toEqual( [

Check failure on line 218 in test/e2e/specs/interactivity/directive-bind.spec.ts

GitHub Actions / Playwright - 6

[chromium] › interactivity/directive-bind.spec.ts:203:8 › data-wp-bind › attribute hydration › name is correctly hydrated for different values

1) [chromium] › interactivity/directive-bind.spec.ts:203:8 › data-wp-bind › attribute hydration › name is correctly hydrated for different values Error: expect(received).toEqual(expected) // deep equality - Expected - 1 + Received + 1 Array [ "false", - "false", + null, ] 216 | name 217 | ); > 218 | expect( [ type, hydratedAttr ] ).toEqual( [ | ^ 219 | type, 220 | attrValue, 221 | ] ); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/directive-bind.spec.ts:218:39

Check failure on line 218 in test/e2e/specs/interactivity/directive-bind.spec.ts

GitHub Actions / Playwright - 6

[chromium] › interactivity/directive-bind.spec.ts:203:8 › data-wp-bind › attribute hydration › aria-disabled is correctly hydrated for different values

2) [chromium] › interactivity/directive-bind.spec.ts:203:8 › data-wp-bind › attribute hydration › aria-disabled is correctly hydrated for different values Error: expect(received).toEqual(expected) // deep equality - Expected - 1 + Received + 1 Array [ "false", - "false", + null, ] 216 | name 217 | ); > 218 | expect( [ type, hydratedAttr ] ).toEqual( [ | ^ 219 | type, 220 | attrValue, 221 | ] ); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/directive-bind.spec.ts:218:39
type,
attrValue,
] );