Skip to content

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Apr 9, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Resolved a module typing issue to enhance compatibility across different module systems.
  • New Features

    • Introduced improved export support for seamless integration with both CommonJS and modern module formats.
  • Chores

    • Upgraded the dependency management tool and updated related dependencies.
    • Streamlined workflow configuration for greater consistency.

@JounQin JounQin requested a review from Copilot April 9, 2025 18:31
Copy link

changeset-bot bot commented Apr 9, 2025

🦋 Changeset detected

Latest commit: b71797c

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

This PR includes changesets to release 1 package
Name Type
@pkgr/core 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

Copy link

coderabbitai bot commented Apr 9, 2025

Walkthrough

This pull request introduces a patch for the @pkgr/core package by documenting a fix for incorrect CommonJS typing. It adjusts the GitHub Actions workflow by standardizing whitespace in a branch check condition, upgrades Yarn from version 4.8.1 to 4.9.0, and updates dependency versions and resolutions in the main package.json. In addition, a new file is added in the packages/core directory with corresponding changes in its package.json to restructure exports and update type definitions.

Changes

Affected Files Change Summary
.changeset/sharp-bulldogs-chew.md New file documenting a patch that fixes incorrect CommonJS typing for the @pkgr/core package.
.github/workflows/vercel.yml Adjusted whitespace in the branch check condition to enforce consistent formatting without altering functionality.
.yarnrc.yml, package.json Upgraded Yarn from 4.8.1 to 4.9.0. The main package.json also updates the packageManager field, several dependency versions (@swc/core, @types/react-dom), and adds a new resolution for es5-ext.
packages/core/index.d.cts, packages/core/package.json Added a new file that re-exports the CommonJS module from lib/index.js. Updated the packages/core/package.json with a new types field, restructured exports, and included the new file in the files array.

Sequence Diagram(s)

sequenceDiagram
    participant C as Consumer
    participant CP as Core Package (CJS Entry)
    participant L as lib Module (CJS)

    C->>CP: require("core")
    CP->>L: Redirect to ./lib/index.cjs (with types from index.d.cts)
    L-->>CP: Module instance
    CP-->>C: Return module instance
Loading
sequenceDiagram
    participant C as Consumer
    participant CP as Core Package (ESM Entry)
    participant L as lib Module (ESM)

    C->>CP: import { ... } from "core"
    CP->>L: Redirect to ./lib/index.js (with types from ./lib/index.d.ts)
    L-->>CP: Module instance
    CP-->>C: Return module instance
Loading

Possibly related PRs

  • chore: release package(s) #385: Addresses issues with incorrect CommonJS typing for the @pkgr/core package, aligning closely with the changes implemented in this PR.

Poem

I'm a hopping rabbit, leaving a cheerful print,
Fixing bugs and typos with a nimble, joyful sprint.
Upgraded Yarn and structured exports anew,
Dependencies gleam in the code's bright view.
With each well-crafted change, my heart does cheer—
Celebrating updates with a twitch of my ear!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/core/index.d.cts

Oops! Something went wrong! :(

ESLint: 9.24.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 163932d and b71797c.

⛔ Files ignored due to path filters (3)
  • .yarn/releases/yarn-4.8.1.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.0.cjs is excluded by !**/.yarn/**
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/sharp-bulldogs-chew.md (1 hunks)
  • .github/workflows/vercel.yml (1 hunks)
  • .yarnrc.yml (1 hunks)
  • package.json (4 hunks)
  • packages/core/index.d.cts (1 hunks)
  • packages/core/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
🔇 Additional comments (11)
.changeset/sharp-bulldogs-chew.md (1)

1-6: Ensure Changeset Documentation is Clear and Consistent
The changeset file correctly documents the patch for @pkgr/core addressing the incorrect CommonJS typing. The YAML separators and the message "fix(core): incorrect typing for cjs entry" are clear.

packages/core/index.d.cts (1)

1-3: Validate CommonJS Export for Typings
The file correctly imports from ./lib/index.js and then re-exports it using the CommonJS style (export = core), which aligns with the intended fix for incorrect typings for the CJS entry. Ensure that the module in lib/index.js is compatible with this export style.

.yarnrc.yml (1)

10-11: Yarn Version Upgrade Confirmed
The update of yarnPath to .yarn/releases/yarn-4.9.0.cjs is consistent with the corresponding changes in package.json. This ensures that the project uses the intended newer Yarn version.

.github/workflows/vercel.yml (1)

20-23: Standardize Branch Check Formatting
The whitespace adjustment in the branch check condition (line 22) maintains the original logic while ensuring formatting consistency in the workflow. This standardization should help prevent potential parsing issues in other contexts.

package.json (4)

14-14: Update Package Manager Version
The packageManager field is updated to "yarn@4.9.0", which aligns with the changes in .yarnrc.yml and the overall upgrade objective.


39-39: Dependency Version Update for @swc/core
The version for @swc/core has been updated to ^1.11.18. This update should be verified for compatibility across the build pipeline.


48-48: Update for @types/react-dom
The version for @types/react-dom is updated to ^19.1.2, ensuring that the type definitions remain current with any relevant changes in React's ecosystem.


77-78: Add Resolution for es5-ext
A new resolution for es5-ext is added as "npm:@unes/es5-ext@latest". This helps enforce a consistent version across dependencies. Verify that this resolution does not introduce conflicts with other transitive dependencies.

packages/core/package.json (3)

15-15: Updated "types" Field Reference

The "types" field now points to "./index.d.cts", which should correctly reference the new type definition file. Please verify that the index.d.cts file exists and correctly re-exports the types as intended for improved CommonJS typing resolution.


17-33: Revised "exports" Structure for Module Resolution

The exports configuration has been restructured into a nested object to clearly differentiate between "import", "module-sync", and "require" environments. Notably, the "require" key now uses an object containing "types": "./index.d.cts" and "default": "./lib/index.cjs", which addresses the incorrect typing issue for the CommonJS entry point. This structure ensures that both ES module and CommonJS consumers will reference the appropriate files.


34-37: Inclusion of New Type Definition File in Package Files

The "files" array has been updated to include "index.d.cts", ensuring that this new type definition file is published with the package. This change is consistent with updating the "types" field and guarantees that end users receive the correct type definitions.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 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.

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

Files not reviewed (2)
  • package.json: Language not supported
  • packages/core/package.json: Language not supported

Copy link

codesandbox-ci bot commented Apr 9, 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.

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 9.97%. Comparing base (163932d) to head (b71797c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #387   +/-   ##
======================================
  Coverage    9.97%   9.97%           
======================================
  Files          12      12           
  Lines         421     421           
  Branches      184     184           
======================================
  Hits           42      42           
  Misses        379     379           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

socket-security bot commented Apr 9, 2025

Copy link

pkg-pr-new bot commented Apr 9, 2025

Open in StackBlitz

@pkgr/browser

npm i https://pkg.pr.new/@pkgr/browser@387

@pkgr/core

npm i https://pkg.pr.new/@pkgr/core@387

@pkgr/es-modules

npm i https://pkg.pr.new/@pkgr/es-modules@387

@pkgr/imagemin

npm i https://pkg.pr.new/@pkgr/imagemin@387

@pkgr/rollup

npm i https://pkg.pr.new/@pkgr/rollup@387

@pkgr/umd-globals

npm i https://pkg.pr.new/@pkgr/umd-globals@387

@pkgr/utils

npm i https://pkg.pr.new/@pkgr/utils@387

commit: 153282f

Copy link
Contributor

github-actions bot commented Apr 9, 2025

Deploy preview for pkgr ready!

✅ Preview
https://pkgr-8av4cb5ix-1stg.vercel.app

Built with commit b71797c.
This pull request is being automatically deployed with vercel-action

Copy link
Contributor

github-actions bot commented Apr 9, 2025

📊 Package size report   No changes

File Before After
Total (Includes all files) 2.9 MB 2.9 MB
Tarball size 1.0 MB 1.0 MB
Unchanged files
File Size
.changeset/config.json 309 B
.changeset/README.md 510 B
.codesandbox/ci.json 76 B
.editorconfig 145 B
.gitattributes 35 B
.github/workflows/autofix.yml 917 B
.github/workflows/ci.yml 1.4 kB
.github/workflows/pkg-pr-new.yml 641 B
.github/workflows/pkg-size.yml 723 B
.github/workflows/release.yml 1.5 kB
.github/workflows/vercel.yml 1.0 kB
.lintstagedrc.js 48 B
.nvmrc 6 B
.prettierignore 6 B
.remarkrc 42 B
.renovaterc 49 B
.simple-git-hooks.js 49 B
.stylelintignore 99 B
.stylelintrc 42 B
.yarn/plugins/plugin-prepare-lifecycle.cjs 202 B
.yarn/releases/yarn-4.8.1.cjs 2.8 MB
.yarnrc.yml 397 B
CHANGELOG.md 486 B
docs/App.tsx 1.2 kB
docs/global.css 321 B
docs/index.tsx 299 B
eslint.config.js 258 B
index.html 402 B
LICENSE 1.1 kB
package.json 2.9 kB
packages/browser/CHANGELOG.md 878 B
packages/browser/index.d.cts 60 B
packages/browser/index.ts 4.7 kB
packages/browser/openChrome.applescript 2.5 kB
packages/browser/package.json 1.2 kB
packages/browser/tsconfig.json 139 B
packages/core/CHANGELOG.md 1.4 kB
packages/core/package.json 784 B
packages/core/src/constants.ts 448 B
packages/core/src/helpers.ts 1.9 kB
packages/core/src/index.ts 60 B
packages/core/tsconfig.json 154 B
packages/es-modules/CHANGELOG.md 5.0 kB
packages/es-modules/index.d.cts 64 B
packages/es-modules/index.ts 1.4 kB
packages/es-modules/package.json 1.1 kB
packages/es-modules/README.md 3.6 kB
packages/es-modules/test/test.spec.ts 936 B
packages/es-modules/tsconfig.json 139 B
packages/imagemin/CHANGELOG.md 8.7 kB
packages/imagemin/index.d.cts 57 B
packages/imagemin/package.json 1.4 kB
packages/imagemin/src/cli.ts 508 B
packages/imagemin/src/index.ts 1.2 kB
packages/imagemin/tsconfig.json 154 B
packages/rollup/CHANGELOG.md 21.2 kB
packages/rollup/package.json 1.6 kB
packages/rollup/shim.d.ts 647 B
packages/rollup/src/cli.ts 4.0 kB
packages/rollup/src/config.ts 11.9 kB
packages/rollup/tsconfig.json 132 B
packages/umd-globals/CHANGELOG.md 5.9 kB
packages/umd-globals/index.d.cts 66 B
packages/umd-globals/index.ts 1.8 kB
packages/umd-globals/package.json 1.0 kB
packages/umd-globals/README.md 3.4 kB
packages/umd-globals/test/test.spec.ts 1.9 kB
packages/umd-globals/tsconfig.json 139 B
packages/utils/CHANGELOG.md 11.8 kB
packages/utils/index.d.cts 51 B
packages/utils/package.json 1.1 kB
packages/utils/src/constants.ts 497 B
packages/utils/src/helpers.ts 2.8 kB
packages/utils/src/index.ts 117 B
packages/utils/src/monorepo.ts 691 B
packages/utils/tsconfig.json 154 B
README.md 4.1 kB
test/global.d.ts 41 B
test/tsconfig.json 96 B
tsconfig.base.json 41 B
tsconfig.json 395 B
vercel.json 190 B
vite.config.ts 544 B
vitest.config.ts 342 B

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

@JounQin JounQin merged commit e392649 into master Apr 9, 2025
33 checks passed
@JounQin JounQin deleted the fix/core branch April 9, 2025 18:39
@JounQin JounQin mentioned this pull request Apr 9, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 19, 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.

1 participant