-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Use package.json name as the script-module ID source of truth #78822
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
Open
retrofox
wants to merge
53
commits into
trunk
Choose a base branch
from
refactor/wp-build-name-as-module-id
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−9
Open
Changes from 41 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
ee05251
add version number graphic to welcome banner
retrofox 682417f
Merge branch 'update/add-welcome-widget-banner-bg' into trunk
retrofox b5d6eb9
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 3a3ff5f
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox a897825
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox f2917e0
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 4625fb1
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox c683724
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 853b9c8
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 0780c53
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 75810ab
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 9d8276a
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox b19ab13
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 1a142a3
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 59b8492
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 393837e
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 9c43e72
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 461a10d
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox e0fb835
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox b0b47e5
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 9eed995
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 84e31b1
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 28819df
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 5d29de8
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox c8260b6
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox ffa81fb
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox df47aeb
Build Tools: Use package.json name as the script-module ID
retrofox 265c239
Build Tools: Discover script-module packages outside ./packages/ via …
retrofox 25513d0
fix linting issue
retrofox 3300f36
fix dual packages externalization in IIFE builds
retrofox 6431dc5
use a single onResolve for internal package names
retrofox aca0b62
skip wpScript for convention-discovered packages
retrofox f99540e
update jsdoc for internalPackageNames
retrofox 51c1663
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 82bd130
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox cdf4af3
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox a5afaf0
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 43e6540
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 32606e6
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 225a365
Merge branch 'trunk' into refactor/wp-build-name-as-module-id
retrofox 64caef9
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 6087db1
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 66c67b0
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 25af734
Build Tools: Drop convention discovery
retrofox a9e9dca
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox da70022
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox d36316e
Merge branch 'trunk' of github.com:WordPress/gutenberg into trunk
retrofox 371a7e3
Merge branch 'trunk' into refactor/wp-build-name-as-module-id
retrofox 8a40c80
tweak jsdoc block
retrofox ddc46b0
Merge branch 'trunk' into refactor/wp-build-name-as-module-id
retrofox f7a4d7c
Merge remote-tracking branch 'origin/trunk' into refactor/wp-build-na…
Copilot 02de0fc
Merge branch 'trunk' into refactor/wp-build-name-as-module-id
retrofox 7560c0d
Merge branch 'trunk' into refactor/wp-build-name-as-module-id
retrofox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change, can you explain it please? Why do we need this and why it was not needed before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the companion to the "name-as-ID" change in this PR; the two are coupled.
Before, the script-module ID was derived from
packageNamespace(@<packageNamespace>/<dir>), so every internal package's specifier started with@<packageNamespace>/, and one namespace pattern (^@<packageNamespace>/) externalized all of them.With "name-as-ID", the ID is the package's own
package.json#name, under an owned scope (e.g.@org/feature, not@my-plugin/feature).The namespace pattern can't simply be pointed at that scope:
^@org/would match every@org/*import, not just this plugin's packages, so genuine third-party@org/*dependencies would be swept into the externalization rule too.Internal packages are therefore externalized by their exact names, a precise set that matches only the known packages, whatever their scope.
For Core, it is a no-op: every
namealready equals@wordpress/<dir>, so the exact-name set and the namespace pattern externalize those imports identically.The handler does overlap with the namespace one below it (same script-module/script handling and dependency tracking).
I kept this PR limited to identity; as a follow-up, I'd unify them into a single resolution path and add characterization tests that lock the behavior. Happy to open that separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For core, this is effectively a no-op; it doesn't change what gets externalized.
Before, the ID was
@<packageNamespace>/<dir>, so every internal package sat under the plugin's own namespace, and a single^@<packageNamespace>/pattern was, by construction, exactly the internal set.Core never leaves that shape: each
nameis@wordpress/<dir>and@wordpressis Core's own scope, so that one pattern stays exact.It only becomes necessary once a module's ID is its real
package.json#nameunder a scope you own that can also hold unrelated third-party packages. There,^@scope/would externalize those too, so the internal set has to be matched by exact name instead.