feat(exe): add cross-platform executable building via @tsdown/exe#786
Merged
feat(exe): add cross-platform executable building via @tsdown/exe#786
Conversation
Add a new `@tsdown/exe` package that enables building executables for
multiple platforms (win/darwin/linux) and architectures (x64/arm64).
The package downloads Node.js binaries from nodejs.org, caches them in
the system cache directory, and uses the SEA `executable` config field
to produce cross-platform executables.
Users specify targets in their config:
```ts
exe: {
targets: [
{ platform: 'linux', arch: 'x64', nodeVersion: '22.14.0' },
{ platform: 'darwin', arch: 'arm64', nodeVersion: '22.14.0' },
{ platform: 'win', arch: 'x64', nodeVersion: '22.14.0' },
],
}
```
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
tsdown
create-tsdown
@tsdown/exe
tsdown-migrate
commit: |
…nce fileName documentation
- Validate target nodeVersion satisfies SEA requirements (>=18.16.0 <19.0.0 || >=19.7.0) - Add obug debug logging throughout download/extract flow - Add semver and obug as dependencies of @tsdown/exe
- Rename validateNodeVersion to normalizeNodeVersion (validates + strips leading v) - Simplify SEA version range to >=18.16.0 - Use throwOnError and stdio: inherit for tinyexec calls - Add debug log for --build-sea invocation
257190c to
0e908f0
Compare
0e908f0 to
dbdd618
Compare
- Add docs/options/exe.md (EN) and docs/zh-CN/options/exe.md (zh-CN) - Add sidebar entry and translation for Executable option - Update CLI reference (EN + zh-CN) with cross-platform info and doc links - Update skills: option-exe.md, reference-cli.md, SKILL.md - Remove SEA terminology throughout, link to Node.js docs instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#776
Summary
Adds cross-platform executable building support to
--exefeature via a new@tsdown/exepackage. Users can specify target platforms, architectures, and Node.js versions to build executables for different OS/arch combinations.Changes
New package:
@tsdown/exeplatform.ts— Types (ExeTarget,ExePlatform,ExeArch,ExeExtensionOptions) and URL construction for nodejs.org binary downloadscache.ts— System cache directory resolution (XDG, macOS Library/Caches, Windows LOCALAPPDATA)download.ts— Downloads and extracts Node.js binaries, with caching and debug logging (tsdown:exe:download)index.ts— Public API exports>=18.16.0(SEA support)semver,tinyexec,obugModified:
src/features/exe.tsExeOptionsnow extendsExeExtensionOptionsfrom@tsdown/exe(addstargetsfield)buildExe()refactored to handle both single-platform and cross-platform buildsbuildSingleExe()andresolveOutputFileName()helpers@tsdown/exe, downloads target Node.js binary, sets SEAexecutableoption.exesuffix, platform-arch suffix)throwOnErrorandstdio: 'inherit'for tinyexec callsOther changes
@tsdown/exeadded as optional peer dependency and dev dependencyscripts/release.ts: improved tinyexec error handlingsrc/features/pkg/exports.ts: supportinlinedDependenciesfieldUsage