Skip to content

fix: use tsdown to bundle cjs outputs#235

Merged
JounQin merged 2 commits intomainfrom
fix/cjs
May 14, 2025
Merged

fix: use tsdown to bundle cjs outputs#235
JounQin merged 2 commits intomainfrom
fix/cjs

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented May 14, 2025

Important

Replaces rollup with tsdown for bundling cjs outputs, updating build scripts and dependencies in package.json.

  • Build Process:
    • Replaces rollup with tsdown for bundling cjs outputs in package.json.
    • Updates build:ts script to build:tsc and adds build:tsdown script in package.json.
  • Dependencies:
    • Removes @pkgr/rollup from devDependencies in package.json.
    • Adds tsdown to devDependencies in package.json.
  • File Changes:
    • Deletes index.d.cts file.

This description was created by Ellipsis for 12dbd6a. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Chores

    • Updated package metadata and build scripts to improve the build process and type declaration paths.
    • Added a new changeset documenting a patch update for the package.
    • Updated development dependencies.
  • Refactor

    • Removed an extra type declaration entry point, simplifying module exports.

@JounQin JounQin requested a review from Copilot May 14, 2025 04:01
@JounQin JounQin self-assigned this May 14, 2025
@JounQin JounQin added bug Something isn't working types labels May 14, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 14, 2025

🦋 Changeset detected

Latest commit: 4b5721f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
synckit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 14, 2025

Walkthrough

A changeset file was added to document a patch update for the "synckit" package, specifically addressing the build process by bundling CommonJS outputs with tsdown. The type declaration entry point file was removed, and package.json was updated to adjust type paths, build scripts, and dependencies to support these changes.

Changes

File(s) Change Summary
.changeset/stupid-clouds-wait.md Added a changeset describing a patch update for the "synckit" package to fix the build process with tsdown.
index.d.cts Removed the file that re-exported all exports from ./lib/index.js as synckit.
package.json Updated type declaration paths, modified build scripts, removed @pkgr/rollup, added tsdown as a dev dependency.

Poem

A patch floats in on clouds not shy,
With tsdown bundled, builds now fly!
Old exports gone, the path is clear,
New scripts and types, the end is near.
Dependencies shift, the toolkit’s sound—
Synckit hops on firmer ground!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

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 updates the build process to bundle CommonJS outputs using tsdown. Key changes include updating type declaration paths in package.json, adding a new build:tsdown script, and removing the redundant index.d.cts file.

Reviewed Changes

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

File Description
package.json Updated type declaration paths and build scripts to use tsdown for bundling CJS outputs
index.d.cts Removed the redundant type export file
Comments suppressed due to low confidence (2)

index.d.cts:1

  • Removing this file appears intentional with the new bundling setup. Confirm that the type declarations are fully covered by './lib/index.d.cts' to prevent breaking consumers who depend on these types.
import * as synckit from './lib/index.js'

package.json:15

  • The updated type declaration paths improve consistency with the new bundling process. Please ensure that all consumers reference the updated paths in their configurations.
"types": "./lib/index.d.cts",

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 14, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@socket-security
Copy link

socket-security bot commented May 14, 2025

@github-actions
Copy link
Contributor

github-actions bot commented May 14, 2025

size-limit report 📦

Path Size
lib/index.js 912 B (0%)

@petercat-assistant
Copy link

Walkthrough

This pull request updates the build process by replacing rollup with tsdown for bundling CommonJS (cjs) outputs. It modifies the package.json to reflect this change and updates dependencies accordingly. The yarn.lock file is also updated to reflect these changes.

Changes

Files Summary
index.d.cts Removed export of synckit.
package.json Updated types path, added tsdown script, removed rollup dependencies, and added tsdown dependency.
yarn.lock Updated to reflect changes in dependencies, including the addition of tsdown and removal of rollup.

@sonarqubecloud
Copy link

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/synckit@235

commit: 4b5721f

@github-actions
Copy link
Contributor

📊 Package size report   6%↑

File Before After
index.d.cts 60 B
lib/index.cjs 24.3 kB 0.3%↑24.4 kB
lib/index.d.cts 5.8 kB
package.json 4.2 kB 0.9%↑4.3 kB
Total (Includes all files) 96.1 kB 6%↑102.0 kB
Tarball size 23.2 kB 15%↑26.6 kB
Unchanged files
File Size
lib/common.d.ts 329 B
lib/common.js 987 B
lib/common.js.map 1.2 kB
lib/constants.d.ts 1.8 kB
lib/constants.js 2.4 kB
lib/constants.js.map 2.3 kB
lib/helpers.d.ts 1.5 kB
lib/helpers.js 17.3 kB
lib/helpers.js.map 15.3 kB
lib/index.d.ts 424 B
lib/index.js 2.6 kB
lib/index.js.map 2.5 kB
lib/types.d.ts 1.4 kB
lib/types.js 44 B
lib/types.js.map 102 B
LICENSE 1.1 kB
README.md 16.1 kB

🤖 This report was automatically generated by pkg-size-action

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 12dbd6a in 1 minute and 46 seconds. Click for details.
  • Reviewed 58 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. package.json:15
  • Draft comment:
    The 'types' field now points to './lib/index.d.cts' which is correct for the bundled output. Just verify that the corresponding file is generated and included in the package.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to verify something, which is against the rules. It doesn't provide a specific suggestion or point out a specific issue with the code. Therefore, it should be removed.
2. package.json:27
  • Draft comment:
    The 'files' array still lists 'index.d.cts', which was deleted. Remove this entry to avoid packaging a non-existent file.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. package.json:52
  • Draft comment:
    The new 'build:tsdown' script replaces the old 'build:r' script. Ensure that tsdown output is as expected and that all related docs/build steps are updated.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that the tsdown output is as expected and that all related documentation and build steps are updated. This falls under asking the author to double-check things and ensure behavior, which is against the rules.
4. package.json:97
  • Draft comment:
    The dependency '@pkgr/rollup' has been removed and 'tsdown' added. Verify that this switch aligns with your intended bundling strategy for CJS outputs.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify their intention regarding a dependency change. This violates the rule against asking the author to confirm their intention or ensure behavior is intended. The comment does not provide a specific suggestion or point out a clear issue.
5. package.json:15
  • Draft comment:
    The "types" field now reads "./lib/index.d.cts". However, the exports under "import" refer to "./lib/index.d.ts". This appears to be a typographical inconsistency. Please verify if the file extension should be '.d.cts' or '.d.ts'.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment assumes there's an inconsistency, but this is actually a well-structured dual-mode setup. The main "types" field using .d.cts makes sense as it aligns with the main field being CommonJS (index.cjs). The exports field correctly handles both ESM and CommonJS scenarios with their respective type definitions. Could there be a TypeScript best practice I'm not aware of regarding the primary types field? Maybe there's a reason .d.ts should be preferred here? The setup is clearly intentional and follows a logical pattern matching the package's dual-mode nature. The suggestion would actually break the consistency of the CommonJS default. The comment should be deleted as it misunderstands the intentional dual-mode type definition setup and would make an incorrect change.

Workflow ID: wflow_z3ddTzJSqUAVCJsQ

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
package.json (1)

27-30: ⚠️ Potential issue

Remove stale index.d.cts from files array
The root-level index.d.cts was removed; keeping it in the "files" array will lead to missing file errors on publish. Please delete that entry.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 420c844 and 4b5721f.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • .changeset/stupid-clouds-wait.md (1 hunks)
  • index.d.cts (0 hunks)
  • package.json (3 hunks)
💤 Files with no reviewable changes (1)
  • index.d.cts
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 23 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 23 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18.18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18.18 on ubuntu-latest
  • GitHub Check: Lint and Test with Node.js 18 on macos-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 23 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on macos-latest
  • GitHub Check: Lint and Test with Node.js 23 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 on macos-latest
  • GitHub Check: Lint and Test with Node.js 18.18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on macos-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
🔇 Additional comments (4)
package.json (3)

15-15: Types entry updated correctly
The "types" field now points to ./lib/index.d.cts, matching the relocated CJS declaration output from tsdown.


23-23: Require-export types path is correct
The "exports.require.types" entry now also references ./lib/index.d.cts, aligning with the new CJS type definitions.


100-100: DevDependency added as expected
Including tsdown@^0.11.9 in devDependencies aligns with the new build step.

.changeset/stupid-clouds-wait.md (1)

5-5: Changeset summary looks good
The description clearly documents the patch to use tsdown for CJS outputs.

@JounQin JounQin merged commit abdb67a into main May 14, 2025
47 checks passed
@JounQin JounQin deleted the fix/cjs branch May 14, 2025 04:18
@JounQin JounQin mentioned this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants