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

Plugin: Seek to eliminate or substitute packages for globals references #15125

Open
aduth opened this issue Apr 23, 2019 · 2 comments
Open

Plugin: Seek to eliminate or substitute packages for globals references #15125

aduth opened this issue Apr 23, 2019 · 2 comments
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Package] Block library /packages/block-library [Package] Edit Post /packages/edit-post [Type] Code Quality Issues or PRs that relate to code quality [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@aduth
Copy link
Member

aduth commented Apr 23, 2019

Related: #14837 (comment)
Meeting discussion (link requires registration): https://wordpress.slack.com/archives/C5UNMSU4R/p1556028118143500

There are multiple occurrences of window globals being referenced in code. These are incompatible for use in an npm context and should be eliminated or substituted with an equivalent package.

From https://wordpress.slack.com/archives/C5UNMSU4R/p1556030096195300 :

there are 4 packages only: postbox, media-views, editor and media-models

From https://wordpress.slack.com/archives/C5UNMSU4R/p1556030164197100 :

existing packages which depend on them are block-library and edit-post

@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts labels Apr 23, 2019
@gziolo
Copy link
Member

gziolo commented Apr 23, 2019

I identified those indirect dependencies manually by scanning packages-dependencies.php file:

wp-block-library:


window.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context

wp-edit-post:

'postbox',
'media-models',
'media-views',

@gziolo
Copy link
Member

gziolo commented Apr 30, 2019

This is how @sirreal implemented the handling of indirect dependencies in #15124:

// Add dependencies that cannot be detected and generated by build tools.
switch ( $handle ) {
case 'wp-block-library':
array_push( $dependencies, 'editor' );
break;
case 'wp-edit-post':
array_push( $dependencies, 'media-models', 'media-views', 'postbox' );
break;
}

@gziolo gziolo added the npm Packages Related to npm packages label Oct 10, 2019
@skorasaurus skorasaurus added the [Type] Code Quality Issues or PRs that relate to code quality label Jan 8, 2021
@gziolo gziolo added [Package] Block library /packages/block-library [Package] Edit Post /packages/edit-post and removed npm Packages Related to npm packages labels May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Package] Block library /packages/block-library [Package] Edit Post /packages/edit-post [Type] Code Quality Issues or PRs that relate to code quality [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

3 participants