Skip to content

fix(deps): correctly resolve root @types packages for dts deep imports#852

Merged
sxzz merged 4 commits intorolldown:mainfrom
brc-dd:fix/755-followup
Mar 25, 2026
Merged

fix(deps): correctly resolve root @types packages for dts deep imports#852
sxzz merged 4 commits intorolldown:mainfrom
brc-dd:fix/755-followup

Conversation

@brc-dd
Copy link
Contributor

@brc-dd brc-dd commented Mar 21, 2026

  • This PR contains AI-generated code, but I have carefully reviewed it myself. Otherwise, my PR may be closed.

Description

Follow up to 0be7c6d / PR #755 for issue #745.

PR #755 fixed externalizing type-only packages declared as @types/*, but it still derived the DefinitelyTyped package name from the full import specifier. That caused deep imports like markdown-it/lib/token.mjs to be checked as @types/markdown-it__lib__token.mjs instead of @types/markdown-it.

Linked Issues

Additional context

Resolve @types package names from the package root instead of the full import specifier.

This fixes d.ts deep imports like markdown-it/lib/token.mjs being checked as @types/markdown-it__lib__token.mjs instead of @types/markdown-it, and adds regression coverage for both helper logic and the end-to-end build output.
@netlify
Copy link

netlify bot commented Mar 21, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit e6cc6ae
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69c3bd7500db570008e69ec7
😎 Deploy Preview https://deploy-preview-852--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 21, 2026

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/tsdown@852 -D
npm i https://pkg.pr.new/tsdown@852 -D
yarn add https://pkg.pr.new/tsdown@852.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/create-tsdown@852 -D
npm i https://pkg.pr.new/create-tsdown@852 -D
yarn add https://pkg.pr.new/create-tsdown@852.tgz -D

@tsdown/css

pnpm add https://pkg.pr.new/@tsdown/css@852 -D
npm i https://pkg.pr.new/@tsdown/css@852 -D
yarn add https://pkg.pr.new/@tsdown/css@852.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/@tsdown/exe@852 -D
npm i https://pkg.pr.new/@tsdown/exe@852 -D
yarn add https://pkg.pr.new/@tsdown/exe@852.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/tsdown-migrate@852 -D
npm i https://pkg.pr.new/tsdown-migrate@852 -D
yarn add https://pkg.pr.new/tsdown-migrate@852.tgz -D

commit: 38259c7

@brc-dd brc-dd changed the title fix: externalize @types packages for deep imports fix(deps): correctly resolve root @types packages for dts deep imports Mar 22, 2026
@sxzz sxzz force-pushed the fix/755-followup branch from 05373b4 to 38259c7 Compare March 25, 2026 10:25
- Extract shared `parsePackageSpecifier` from `parseDepPath` and `getPackageName`
- Rename functions for clarity: `parseDepPath` → `parseNodeModulesPath`,
  `parseBundledDep` → `readBundledDepInfo`, `resolveDepPath` → `resolveDepSubpath`
- Replace magic number with `NODE_MODULES` constant
- Guard scoped package parsing against missing second segment
- Add unit tests for `parsePackageSpecifier` and `parseNodeModulesPath`
@sxzz sxzz merged commit 0b2767a into rolldown:main Mar 25, 2026
10 of 13 checks passed
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.

3 participants