Skip to content

feat: support tsc -b#42

Merged
sxzz merged 7 commits intomainfrom
ocavue/build-ref-proj
Jun 4, 2025
Merged

feat: support tsc -b#42
sxzz merged 7 commits intomainfrom
ocavue/build-ref-proj

Conversation

@ocavue
Copy link
Copy Markdown
Collaborator

@ocavue ocavue commented Jun 1, 2025

Description

Build the project and its dependencies/references. This addresses issue rolldown/tsdown#286

Linked Issues

rolldown/tsdown#286

Additional context

N/A

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jun 1, 2025

Open in StackBlitz

npm i https://pkg.pr.new/sxzz/rolldown-plugin-dts@42

commit: 5d3742d

@ocavue ocavue marked this pull request as ready for review June 1, 2025 12:24
@ocavue ocavue requested review from Copilot and sxzz June 1, 2025 12:25
Copy link
Copy Markdown

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 ensures that a root TypeScript project with references is built (using the solution builder) before generating declaration output, and adds a fallback for existing .d.ts files.

  • Introduce a new tsconfig path option and propagate it through TscOptions.
  • Add buildSolution to run tsc --build on composite project references.
  • Update the map type to SourceMapInput and handle fallback when only declaration files exist.

Reviewed Changes

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

File Description
src/utils/tsc.ts Added tsconfig field, buildSolution logic, enhanced debug output, .d.ts fallback path, and map type update
src/generate.ts Imported and propagated tsconfig, updated SourceMapInput usage in plugin code
Comments suppressed due to low confidence (2)

src/utils/tsc.ts:202

  • This fallback branch for declaration files isn’t covered by existing tests. Add a test to verify that when isDeclarationFile is true and no emit occurs, the source text is returned.
if (!dtsCode && file.isDeclarationFile) {

src/utils/tsc.ts:39

  • [nitpick] The property name tsconfig may be ambiguous between a config object and a file path. Consider renaming it to tsconfigPath for clarity.
tsconfig: string | undefined

Copy link
Copy Markdown
Owner

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

LGTM, if there's one more unit test :P

@sxzz sxzz changed the title fix: build project with references feat: support tsc -b Jun 1, 2025
@ocavue ocavue force-pushed the ocavue/build-ref-proj branch from 763e707 to 6ad7987 Compare June 2, 2025 08:09
@ocavue
Copy link
Copy Markdown
Collaborator Author

ocavue commented Jun 2, 2025

@sxzz I've added a test. I also rearranged all commits so that we can ensure that the test can fail without the patch.

@ocavue ocavue requested a review from sxzz June 3, 2025 03:41
@sxzz sxzz merged commit 9c19f74 into main Jun 4, 2025
11 checks passed
@sxzz sxzz deleted the ocavue/build-ref-proj branch June 4, 2025 20:13
@sxzz sxzz mentioned this pull request Jun 4, 2025
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