Skip to content

feat(cli): expose tsdown types and entry#358

Merged
Brooooooklyn merged 1 commit intomainfrom
12-22-feat_cli_expose_tsdown_types_and_entry
Dec 23, 2025
Merged

feat(cli): expose tsdown types and entry#358
Brooooooklyn merged 1 commit intomainfrom
12-22-feat_cli_expose_tsdown_types_and_entry

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Dec 22, 2025

Note

Expose lib API and tsdown types via new exports; update build to bundle tsdown entries with generated d.ts and refine import rewriting/external handling.

  • CLI:
    • Add exports.{ "./lib": { import: "./dist/lib.js", types: "./dist/lib.d.ts" } } in packages/cli/package.json.
    • Extend UserConfig to accept lib options and add src/lib.ts re-exporting core lib APIs.
  • Core:
    • RewriteImportsPlugin: switch to resolveId with { order: 'pre', handler }.
    • Build system (build.ts):
      • Adjust externals filtering (include yaml and vite/ patterns) and place RewriteImportsPlugin before transforms.
      • Bundle tsdown with multiple inputs (run, index) and generate type declarations via rolldown-plugin-dts for index-types.
    • package.json: add exports["./lib"] pointing to dist/tsdown/index.mjs with types.
  • Dependencies:
    • Add rolldown-plugin-dts, hookable, and pkg-types; lockfile updates accordingly.

Written by Cursor Bugbot for commit 20c2492. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings December 22, 2025 12:13
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes tsdown types and entry points to enable programmatic usage of tsdown build functionality. The main purpose is to make tsdown's build APIs (defineConfig, build, buildSingle, and globalLogger) accessible through both the core and CLI packages.

Key changes:

  • Added new "./lib" export paths in both core and CLI packages to expose tsdown functionality
  • Configured build process to bundle tsdown source code and generate proper type definitions
  • Updated the RewriteImportsPlugin to use proper hook ordering with order: 'pre'

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Added new dependencies (hookable@6.0.1, pkg-types@2.3.0, exsolve@1.0.8, confbox@0.2.2, rolldown-plugin-dts@0.18.3) to support tsdown bundling and type generation
packages/core/package.json Added "./lib" export pointing to bundled tsdown, added new devDependencies (hookable, pkg-types, rolldown-plugin-dts)
packages/core/build.ts Extended bundleTsdown function to build both the runtime (index.mjs) and type definitions (index-types.d.ts), moved RewriteImportsPlugin earlier in plugin array, added yaml to externals list
packages/core/build-support/rewrite-imports.ts Restructured resolveId hook to use object syntax with explicit 'pre' order for proper plugin ordering
packages/cli/src/lib.ts New file that re-exports tsdown functionality from core/lib
packages/cli/src/index.ts Added type import for defineLibConfig and augmented UserConfig with optional lib configuration
packages/cli/package.json Added "./lib" export to make tsdown APIs available from the CLI package
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/build.ts
Comment thread packages/core/build.ts
Copy link
Copy Markdown
Member Author

Brooooooklyn commented Dec 23, 2025

Merge activity

  • Dec 23, 2:11 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 23, 2:11 AM UTC: @Brooooooklyn merged this pull request with Graphite.

@Brooooooklyn Brooooooklyn merged commit 4819622 into main Dec 23, 2025
24 checks passed
@Brooooooklyn Brooooooklyn deleted the 12-22-feat_cli_expose_tsdown_types_and_entry branch December 23, 2025 02:11
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