Fix npm scoped package handling in libs command#593
Merged
tengstrand merged 3 commits intopolyfy:masterfrom Dec 4, 2025
Merged
Fix npm scoped package handling in libs command#593tengstrand merged 3 commits intopolyfy:masterfrom
tengstrand merged 3 commits intopolyfy:masterfrom
Conversation
Fixes polyfy#592 Scoped npm packages (e.g., @mantine/core) were incorrectly parsed because Clojure's `name` function only returns the local part of namespaced keywords, stripping the scope prefix. Added keyword->full-name helper to preserve the full package name in both npm.clj (registry queries) and size_npm.clj (size lookups).
Check both nested (node_modules/@poly/pkg/node_modules/@lib/name) and hoisted (node_modules/@lib/name) paths when calculating npm package sizes, since workspace dependencies may be installed in either location.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
@mantine/core) showing incorrect latest versions inpoly libs :outdatedProblem
When using
poly libs :outdated, npm packages with scoped names showed incorrect "latest" versions. For example:The scope prefix was being stripped before querying the npm registry, causing lookups for unrelated packages (
coreinstead of@mantine/core).Additionally, package size lookups failed for workspaces where dependencies are nested under the workspace package directory.
Root Cause
In Clojure, keywords containing
/are interpreted as namespaced keywords. When@mantine/corefrompackage.jsonbecomes:@mantine/core:(namespace :@mantine/core)→"@mantine"(name :@mantine/core)→"core"Using
clojure.core/nameonly returned the local name, dropping the scope.Solution
keyword->full-namehelper that preserves the namespace for scoped packagesnode_modules/@poly/mantine/node_modules/@mantine/corenode_modules/@mantine/coreFiles Changed
components/antq/src/polylith/clj/core/antq/npm.cljcomponents/lib/src/polylith/clj/core/lib/size_npm.cljcomponents/lib/src/polylith/clj/core/lib/core.clj