Skip to content

fix(exports): use correct indentation for output#599

Merged
sxzz merged 3 commits intorolldown:mainfrom
msigwart:fix/use-correct-indentation-for-output
Nov 15, 2025
Merged

fix(exports): use correct indentation for output#599
sxzz merged 3 commits intorolldown:mainfrom
msigwart:fix/use-correct-indentation-for-output

Conversation

@msigwart
Copy link
Contributor

Description

Currently, when using exports: true with a package.json that's indented with four spaces, the output package.json will be indented with two spaces. This leads to unexpected diffs.

This PR adds a detectIndentation function to features/exports.ts to detect the indentation that's used in the original package.json. The returned value is then used when overwriting the package.json with the new exports.

Linked Issues

Fixes #346

Additional context

ba20fd5 already improved the auto-detection the indentation of the original package.json but only if \t is used as indent.

@netlify
Copy link

netlify bot commented Nov 14, 2025

Deploy Preview for tsdown ready!

Name Link
🔨 Latest commit 099c176
🔍 Latest deploy log https://app.netlify.com/projects/tsdown/deploys/69180129dc880d00081d4897
😎 Deploy Preview https://deploy-preview-599--tsdown.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 Nov 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/tsdown@599
npm i https://pkg.pr.new/create-tsdown@599

commit: 099c176

@msigwart msigwart changed the title fix: use correct indentation for output fix(exports): use correct indentation for output Nov 14, 2025
@sxzz sxzz force-pushed the fix/use-correct-indentation-for-output branch from d12bba8 to 099c176 Compare November 15, 2025 04:27
@sxzz sxzz merged commit 4de7074 into rolldown:main Nov 15, 2025
15 of 16 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.

exports: true doesn't respect package.json indentation

2 participants