fix(deps): skip node: protocol imports in --install#1464
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I have signed the Google CLA. |
4991ffb to
6d4f5b8
Compare
|
|
||
| // Skip protocol specifiers (node:, npm:, jsr:, file: etc.) | ||
| // npm package names cannot contain colons, so this is a safe check | ||
| if (path.includes(':')) return |
There was a problem hiding this comment.
Nice fix. I think this might be a little too broad though, since it’d skip any import with a : in it, not just protocol imports like node:. Maybe worth checking for an actual protocol prefix instead?
There was a problem hiding this comment.
Thanks for reviewing. On it now.
6d4f5b8 to
981bee9
Compare
|
Good catch — updated to use |
|
|
||
| // Skip protocol specifiers (node:, npm:, jsr:, file: etc.) | ||
| // A protocol is a word followed by a colon at the start of the specifier | ||
| if (/^[a-z]+:/i.test(path)) return |
There was a problem hiding this comment.
I'd suggest even shorter: if (!path || path.includes(':')) return
981bee9 to
f73a5cc
Compare
|
Thanks for the suggestion. Applied. Is there anything else I can do to improve my contribution? |
f73a5cc to
84b65ea
Compare
|
84b65ea to
97d40a4
Compare
|
Thanks for your patience @antongolub. Applied the change. Please review. |
97d40a4 to
b6a565b
Compare
|
Apologies for being dim. Thank you for handholding 👍 @antongolub |
Fixes #1462
parsePackageName()now returns early when the import specifier contains:, since npm package names cannot contain colons. This skips all protocol imports (node:,npm:,jsr:,file:) without being affected by the build pipeline'sreplaceAll("node:", "")post-processing step.npm buildbefore committing and verified the bundle updates correctly.testand confirmed all tests succeed. Added tests to cover my changes if needed.