Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: doctor PHANTOM_DEPS rule cannot works with node:* #765

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
registry-url: 'https://registry.npmjs.org/'

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v4
with:
run_install: false

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function isFilePath(path: string) {
}

export function getPkgNameFromPath(p: string) {
return p.match(/^(?:@[a-z\d][\w-.]*\/)?[a-z\d][\w-.]*/i)?.[0];
return p.match(/^(?:@[a-z\d][\w-.]*\/|node:)?[a-z\d][\w-.]*/i)?.[0];
}

export const getDepPkgName = (name: string, packageJson: { name: string }) => {
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/doctor/health/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// expect handle pkg name includes .
import 'hello.world';
import 'optional';

// expect pass for Node.js standard library
import 'node:fs';
Loading