Skip to content

feat: add inlinedDependencies field to package.json#785

Merged
sxzz merged 5 commits intomainfrom
sxzz/inlined-deps-field
Mar 3, 2026
Merged

feat: add inlinedDependencies field to package.json#785
sxzz merged 5 commits intomainfrom
sxzz/inlined-deps-field

Conversation

@sxzz
Copy link
Member

@sxzz sxzz commented Mar 3, 2026

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

Description

Automatically populate the inlinedDependencies field in package.json when the exports option is enabled. This field lists dependencies that are physically inlined into the bundle along with their exact versions, following Option B from the ecosystem proposal.

Format: Record<string, string | string[]> — maps package name to version(s).

Key changes:

  • Track inlined deps during generateBundle via parseBundledDep in DepPlugin
  • Store results on TsdownBundle.inlinedDeps as Map<string, Set<string>>
  • Merge inlined deps across multi-format builds (ESM + CJS) with version deduplication
  • Write inlinedDependencies to package.json in writeExports
  • Add exports.inlinedDependencies option to disable the field (default: true)

Linked Issues

Ref: e18e/ecosystem-issues#237

Additional context

Example output in package.json:

{
  "inlinedDependencies": {
    "my-lib": "1.2.3",
    "another-lib": ["1.0.0", "2.0.0"]
  }
}

Automatically populate the `inlinedDependencies` field in package.json
when the `exports` option is enabled, listing dependencies that are
physically inlined into the bundle with their exact versions.

- Add `inlinedDeps` field to `TsdownBundle` to track inlined deps
- Extract `parseBundledDep` in DepPlugin to resolve dep name and version
- Merge inlined deps from all format builds (ESM + CJS) with dedup
- Write `inlinedDependencies` to package.json via `writeExports`
- Add `exports.inlinedDependencies` option to disable (default: true)

Ref: e18e/ecosystem-issues#237
@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 0567036
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/69a6972f9e602f0008928853
😎 Deploy Preview https://deploy-preview-785--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 3, 2026

Open in StackBlitz

tsdown

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

create-tsdown

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

tsdown-migrate

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

commit: 0567036

sxzz added 2 commits March 3, 2026 17:01
Adopt main's parameter destructuring style for DepPlugin while keeping
the tsdownBundle parameter and always-run generateBundle handler.
@sxzz sxzz merged commit 5c71f67 into main Mar 3, 2026
16 of 17 checks passed
@sxzz sxzz deleted the sxzz/inlined-deps-field branch March 3, 2026 08:48
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.

1 participant