Skip to content

Commit

Permalink
Merge branch 'trunk' into update/document-dynamic-actions-selectors-f…
Browse files Browse the repository at this point in the history
…or-core-data
  • Loading branch information
manzoorwanijk committed Jan 3, 2025
2 parents 1f5bd67 + 8dd99ed commit ca6550a
Show file tree
Hide file tree
Showing 401 changed files with 4,313 additions and 2,629 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Gutenberg

Copyright 2016-2024 by the contributors
Copyright 2016-2025 by the contributors

**License for Contributions (on and after April 15, 2021)**

Expand Down
30 changes: 30 additions & 0 deletions bin/api-docs/gen-components-docs/get-tags-from-storybook.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* External dependencies
*/
import fs from 'node:fs/promises';
import babel from '@babel/core';

/**
* Returns `meta.tags` from a Storybook file.
*
* @param {string} filePath
* @return {Promise<string[]>} Array of tags.
*/
export async function getTagsFromStorybook( filePath ) {
const fileContent = await fs.readFile( filePath, 'utf8' );
const parsedFile = babel.parse( fileContent, {
filename: filePath,
} );

const meta = parsedFile.program.body.find(
( node ) =>
node.type === 'VariableDeclaration' &&
node.declarations[ 0 ].id.name === 'meta'
);

return (
meta.declarations[ 0 ].init.properties
.find( ( node ) => node.key.name === 'tags' )
?.value.elements.map( ( node ) => node.value ) ?? []
);
}
9 changes: 9 additions & 0 deletions bin/api-docs/gen-components-docs/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import path from 'path';
*/
import { generateMarkdownDocs } from './markdown/index.mjs';
import { getDescriptionsForSubcomponents } from './get-subcomponent-descriptions.mjs';
import { getTagsFromStorybook } from './get-tags-from-storybook.mjs';

const MANIFEST_GLOB = 'packages/components/src/**/docs-manifest.json';

Expand Down Expand Up @@ -113,9 +114,17 @@ await Promise.all(
} ) ?? []
);

const tags = await getTagsFromStorybook(
path.resolve(
path.dirname( manifestPath ),
'stories/index.story.tsx'
)
);

const docs = generateMarkdownDocs( {
typeDocs,
subcomponentTypeDocs,
tags,
} );
const outputFile = path.resolve(
path.dirname( manifestPath ),
Expand Down
11 changes: 10 additions & 1 deletion bin/api-docs/gen-components-docs/markdown/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ json2md.converters.md = ( input ) => {
return input?.trim() || '';
};

export function generateMarkdownDocs( { typeDocs, subcomponentTypeDocs } ) {
export function generateMarkdownDocs( {
typeDocs,
subcomponentTypeDocs,
tags,
} ) {
const mainDocsJson = [
{ h1: typeDocs.displayName },
'<!-- This file is generated automatically and cannot be edited directly. Make edits via TypeScript types and TSDocs. -->',
tags.includes( 'status-private' ) && [
{
p: '🔒 This component is locked as a [private API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-private-apis/). We do not yet recommend using this outside of the Gutenberg project.',
},
],
{
p: `<p class="callout callout-info">See the <a href="https://wordpress.github.io/gutenberg/?path=/docs/components-${ typeDocs.displayName.toLowerCase() }--docs">WordPress Storybook</a> for more detailed, interactive documentation.</p>`,
},
Expand Down
4 changes: 2 additions & 2 deletions bin/test-create-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if [ "$expected" -ne "$actual" ]; then
exit 1
fi
expected=7
actual=$( find src -maxdepth 1 -type f | wc -l )
actual=$( find src -maxdepth 2 -type f | wc -l )
if [ "$expected" -ne "$actual" ]; then
error "Expected $expected files in the \`src\` directory, but found $actual."
exit 1
Expand All @@ -70,7 +70,7 @@ status "Building block..."

status "Verifying build..."
expected=9
actual=$( find build -maxdepth 1 -type f | wc -l )
actual=$( find build -maxdepth 2 -type f | wc -l )
if [ "$expected" -ne "$actual" ]; then
error "Expected $expected files in the \`build\` directory, but found $actual."
exit 1
Expand Down
1 change: 1 addition & 0 deletions bin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"noEmit": true,
"outDir": ".cache"
},
"include": [],
"files": [
"./api-docs/update-api-docs.js",
"./plugin/config.js",
Expand Down
35 changes: 27 additions & 8 deletions bin/validate-tsconfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,33 @@ for ( const packageName of packagesWithTypes ) {
hasErrors = true;
}

const packageJson = JSON.parse(
readFileSync( `packages/${ packageName }/package.json`, 'utf8' )
);
const tsconfigJson = JSON.parse(
stripJsonComments(
readFileSync( `packages/${ packageName }/tsconfig.json`, 'utf8' )
)
);
let packageJson;
try {
packageJson = JSON.parse(
readFileSync( `packages/${ packageName }/package.json`, 'utf8' )
);
} catch ( e ) {
console.error(
`Error parsing package.json for package ${ packageName }`
);
throw e;
}
let tsconfigJson;
try {
tsconfigJson = JSON.parse(
stripJsonComments(
readFileSync(
`packages/${ packageName }/tsconfig.json`,
'utf8'
)
)
);
} catch ( e ) {
console.error(
`Error parsing tsconfig.json for package ${ packageName }`
);
throw e;
}
if ( packageJson.dependencies ) {
for ( const dependency of Object.keys( packageJson.dependencies ) ) {
if ( dependency.startsWith( '@wordpress/' ) ) {
Expand Down
453 changes: 453 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/contributors/triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To keep the repository healthy, it needs to be triaged regularly. **Triage is th
The triage team is an open group of people with a particular role of making sure triage is done consistently across the Gutenberg repo. There are various types of triage which happen:

- Regular self triage sessions done by members on their own time.
- Organised triage sessions done as a group at a set time. You can [review the meetings page](https://make.wordpress.org/meetings/) to find these triage sessions and appropriate slack channels.
- Organized triage sessions done as a group at a set time. You can [review the meetings page](https://make.wordpress.org/meetings/) to find these triage sessions and appropriate slack channels.
- Focused triage sessions on a specific board, label or feature.

These are the expectations of being a triage team member:
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ What follows is a set of questions that have come up from the last few years of

“Gutenberg” is the name of the project to create a new editor experience for WordPress — contributors have been working on it since January 2017 and it’s one of the most significant changes to WordPress in years. It’s built on the idea of using “blocks” to write and design posts and pages. This will serve as the foundation for future improvements to WordPress, including blocks as a way not just to design posts and pages, but also entire sites. The overall goal is to simplify the first-time user experience of WordPress — for those who are writing, editing, publishing, and designing web pages. The editing experience is intended to give users a better visual representation of what their post or page will look like when they hit publish. Originally, this was the kickoff goal:

> The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.
> The editor will endeavor to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.
Key takeaways include the following points:

Expand Down
2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.6
* Requires PHP: 7.2
* Version: 19.9.0
* Version: 20.0.0-rc.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
15 changes: 0 additions & 15 deletions jsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/block-supports/block-style-variations.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function gutenberg_enqueue_block_style_variation_styles() {
}

// Add Gutenberg filters and action.
add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles', 10, 2 );
add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles' );
add_filter( 'render_block', 'gutenberg_render_block_style_variation_class_name', 10, 2 );
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_block_style_variation_styles', 1 );

Expand Down
2 changes: 1 addition & 1 deletion lib/experimental/kses-allowed-html.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ function gutenberg_kses_allowed_html( $allowedtags ) {
);
return $allowedtags;
}
add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html', 10, 2 );
add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html' );
2 changes: 2 additions & 0 deletions lib/experimental/media/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ function gutenberg_set_up_cross_origin_isolation() {
* Uses an output buffer to add crossorigin="anonymous" where needed.
*
* @link https://web.dev/coop-coep/
*
* @global bool $is_safari
*/
function gutenberg_start_cross_origin_isolation_output_buffer(): void {
global $is_safari;
Expand Down
2 changes: 1 addition & 1 deletion lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function gutenberg_override_global_styles_endpoint( array $args ): array {

return $args;
}
add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint', 10, 2 );
add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint' );

/**
* Registers the Edit Site Export REST API routes.
Expand Down
Loading

0 comments on commit ca6550a

Please sign in to comment.