-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into fix/issue-65339-task1
- Loading branch information
Showing
40 changed files
with
608 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/7661 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/66468 | ||
* https://github.com/WordPress/gutenberg/pull/66543 |
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
bin/api-docs/gen-components-docs/get-subcomponent-descriptions.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import fs from 'node:fs/promises'; | ||
import babel from '@babel/core'; | ||
import { parse as commentParser } from 'comment-parser'; | ||
|
||
/** | ||
* Try to get subcomponent descriptions from the main component Object.assign() call. | ||
*/ | ||
export async function getDescriptionsForSubcomponents( | ||
filePath, | ||
mainComponentName | ||
) { | ||
const fileContent = await fs.readFile( filePath, 'utf8' ); | ||
const parsedFile = babel.parse( fileContent, { | ||
filename: filePath, | ||
} ); | ||
const mainComponent = parsedFile.program.body | ||
.filter( ( node ) => node.type === 'ExportNamedDeclaration' ) | ||
.flatMap( ( node ) => node.declaration?.declarations ) | ||
.find( ( node ) => node?.id.name === mainComponentName ); | ||
|
||
if ( | ||
! ( | ||
// If the main component export has `Object.assign( ... )` | ||
( | ||
mainComponent?.init?.type === 'CallExpression' && | ||
mainComponent?.init?.callee?.object?.name === 'Object' && | ||
mainComponent?.init?.callee?.property?.name === 'assign' | ||
) | ||
) | ||
) { | ||
return; | ||
} | ||
|
||
const properties = mainComponent?.init?.arguments[ 1 ]?.properties.map( | ||
( node ) => [ | ||
node.key.name, | ||
commentParser( `/*${ node.leadingComments?.[ 0 ].value }*/`, { | ||
spacing: 'preserve', | ||
} )?.[ 0 ]?.description, | ||
] | ||
); | ||
return Object.fromEntries( properties ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.