Closed bmcbarron closed 1 year ago
It wouldn't be difficult to fix this but I don't remember ever having seen dots being used in Node.js package names. Could you point me to some documentation which describes this as being supported?
Here's the docs on name
.
Here's an excerpt about URL-safe characters.
Bottom line: dot, dash, underscore, tilde, and alphanumeric characters are all legal. Additional characters may work or they may not, depending on the particular tool and context.
I'm personally a fan of the Robustness principle which suggests that tools should be as relaxed as possible in what they accept.
Fair enough! The NPM name rules are clearly less strict than I had assumed from experience. I have published v1.3.1 which contains this fix.
In create-packages-registry.ts, the registry is constructed which indexes package manifests by their name. However, the registry object is built using lodash.set, which parses the key as a recursive path when it includes periods, so that package name "@mylib/a.b" results in
{ "@mylib/a": { "b": { ... }}}
. Later, when "@mylib/a.b" is looked up in the registry, it's not found resulting in the errorerror TypeError: Cannot read properties of undefined (reading 'rootRelativeDir')
It appears that the extra behavior of lodash.set is not needed. If so, the following change fixes this issue: