Skip to content

fix: stable entry order - #1130

Open
oblador wants to merge 1 commit into
rolldown:mainfrom
oblador:fix-glob-order
Open

oblador wants to merge 1 commit into
rolldown:mainfrom
oblador:fix-glob-order

Conversation

@oblador

@oblador oblador commented Nov 10, 2026

Copy link
Copy Markdown
  • No AI was used in this PR.
  • AI was used: Codex + GPT 6 Astra Extra High
    • I have carefully reviewed the AI-generated content myself.

Description

I'm getting non-deterministic builds with tsdown with import order in d.ts files differing between invocations. My AI tracked this down to that glob results may arrive in different filesystem traversal orders between builds. Passing that order through to Rolldown changes the ordering of emitted imports, producing different declaration files from unchanged sources.

This PR fixes this by slapping a sort on the glob results.

Linked Issues

Maybe related: rolldown/rolldown#10227

Additional context

Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:02
@netlify

netlify Bot commented Nov 10, 2026

Copy link
Copy Markdown

👷 Deploy request for tsdown-main pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 320b4ed

@pkg-pr-new

pkg-pr-new Bot commented Nov 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

tsdown

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

create-tsdown

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

@tsdown/css

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

@tsdown/exe

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

tsdown-migrate

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

commit: 320b4ed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change to stabilize glob-expanded entry ordering.

No open issues 🎉

What changed in this PR

This PR stabilizes glob-expanded entry ordering in tsdown to address non-deterministic declaration import order caused by filesystem traversal differences.

Changes:

  • Sort glob results for array entries and within each object-entry key.
  • Add regression tests using reversed glob results and verify that explicit entry order remains unchanged.
File Description
src/​features/​entry.ts Sorts glob-expanded paths before constructing entries.
src/​features/​entry.test.ts Tests stable glob ordering and preservation of explicit entry order.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants