You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lib/content/configuring-npm/package-json.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1046,6 +1046,7 @@ For changing the resolved version of a dependency that is already declared, use
1046
1046
1047
1047
Like `overrides`, `packageExtensions` is only honored in the root `package.json` of a project (the workspace root in a workspace).
1048
1048
The field in installed dependencies and in non-root workspace packages is ignored.
1049
+
Because it is root-only project policy, npm refuses to publish a non-private package that contains `packageExtensions`; it remains available to private packages and unpublished local projects.
1049
1050
1050
1051
Each key is a package selector: a package name with an optional semver range.
Copy file name to clipboardExpand all lines: lib/commands/publish.js
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,9 @@ class Publish extends BaseCommand {
96
96
constspec=npa(args[0])
97
97
letmanifest=awaitthis.#getManifest(spec,opts)
98
98
99
+
// packageExtensions is root-only project policy and must never be published; fail fast so dry-run reports it too
100
+
this.#assertNoPackageExtensions(manifest)
101
+
99
102
// only run scripts for directory type publishes
100
103
if(spec.type==='directory'&&!ignoreScripts){
101
104
awaitrunScript({
@@ -122,6 +125,8 @@ class Publish extends BaseCommand {
122
125
123
126
// The purpose of re-reading the manifest is in case it changed, so that we send the latest and greatest thing to the registry note that publishConfig might have changed as well!
124
127
manifest=awaitthis.#getManifest(spec,opts,true)
128
+
// re-check the authoritative manifest in case a lifecycle script introduced packageExtensions
0 commit comments