Skip to content

Allow package subpath plugin entries in serverless.yml - #455

Merged
GrahamCampbell merged 2 commits into
4.xfrom
plugin-subpath-entries
Sep 7, 2026
Merged

Allow package subpath plugin entries in serverless.yml#455
GrahamCampbell merged 2 commits into
4.xfrom
plugin-subpath-entries

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Contributor

This supersedes #454 by @jimmyn, whose commit is carried over unchanged so they keep authorship.

Plugin entries such as @scope/package/lib/plugin are valid require specifiers, typically package exports subpaths, and loaded fine before the 4.0 validation, which now rejects them with INVALID_PLUGIN_NAME because the configured-entry check reuses the bare npm package name pattern. That leaves a shared library that ships its plugin as a subpath export unusable on 4.x without a per-service ./ shim.

The package name and the subpath are now validated separately for configured entries. The package name goes through the unchanged validatePluginName, while subpath segments must be non-empty and must not be . or .., otherwise the entry fails with INVALID_PLUGIN_REFERENCE. Versioned specs are still rejected, absolute paths and traversal still fail, and plugin install and plugin uninstall remain package-name only. On top of the original change, the not-found error now suggests installing the package name rather than the full subpath entry, since the install command would reject the latter, and the upgrade guide wording is tidied.

jimmyn and others added 2 commits September 7, 2026 17:53
Plugin entries such as '@scope/package/lib/plugin' are valid require
specifiers (package exports subpaths) and loaded fine before the 4.0
validation, which now rejects them with INVALID_PLUGIN_NAME.

Validate the package name and the subpath separately for configured
entries. Subpath segments must be non-empty and must not be '.' or '..'.
'plugin install' and 'plugin uninstall' stay package-name only.
@GrahamCampbell
GrahamCampbell merged commit 1eed826 into 4.x Sep 7, 2026
8 checks passed
@GrahamCampbell
GrahamCampbell deleted the plugin-subpath-entries branch September 7, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants