Skip to content

fix(deps): update temporal-polyfill to v1 and fix CJS build#528

Merged
jens-maus merged 2 commits into
jens-maus:masterfrom
KristjanESPERANTO:temporal-polyfill
Jul 20, 2026
Merged

fix(deps): update temporal-polyfill to v1 and fix CJS build#528
jens-maus merged 2 commits into
jens-maus:masterfrom
KristjanESPERANTO:temporal-polyfill

Conversation

@KristjanESPERANTO

@KristjanESPERANTO KristjanESPERANTO commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

The new temporal-polyfill v1 release dropped CJS support, which broke the CJS build (ERR_PACKAGE_PATH_NOT_EXPORTED). I fixed it by bundling it into node-ical.cjs instead of leaving it external. rrule-temporal stays external.

No user-facing changes - public API (Date objects, CJS/ESM entry points) stays the same. v1 does bring the polyfill up to the latest Temporal spec with a few DST/duration edge-case fixes upstream.

Also added tests so this doesn't regress silently again.

Summary by CodeRabbit

  • Bug Fixes

    • Improved compatibility for CommonJS environments when using Temporal-based recurrence features by adjusting how the Temporal polyfill is provided at runtime.
    • Updated the Temporal polyfill dependency to a newer version to improve load-time reliability.
  • Tests

    • Added checks to confirm the Temporal polyfill is installed at the expected major version.
    • Added coverage to verify the polyfill can be dynamically loaded and exposes the expected Temporal export.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9874e724-f246-47a0-a228-971b558bd6b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1f3d11d and 9212175.

📒 Files selected for processing (2)
  • build/build-cjs.js
  • test/polyfill-check.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • build/build-cjs.js

📝 Walkthrough

Walkthrough

The CommonJS build externalizes rrule-temporal modules, the project requires temporal-polyfill 1.x, and tests verify the dependency version and Temporal export.

Changes

Temporal runtime configuration

Layer / File(s) Summary
Runtime dependency and build configuration
build/build-cjs.js, package.json
The CommonJS build externalizes rrule-temporal and rrule-temporal/totext, while temporal-polyfill is upgraded to ^1.0.1.
Temporal polyfill validation
test/polyfill-check.test.js
Tests verify that temporal-polyfill is installed at version 1.x and exposes Temporal through dynamic import.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: thomasbachem

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: upgrading temporal-polyfill to v1 and fixing the CommonJS build.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/polyfill-check.test.js (1)

15-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider handling execSync exceptions for npm ls.

The npm ls command exits with a non-zero status if there are any peer dependency issues or missing packages anywhere in the tree. This causes execSync to throw an error, which will fail this test even if temporal-polyfill is correctly installed.
Consider either reading the version directly from package.json or handling the potential exception from execSync to safely parse the output.

♻️ Proposed refactor to safely read the version
   it('should use temporal-polyfill v1 as a direct dependency', () => {
-    const result = execSync('npm ls temporal-polyfill --json', {encoding: 'utf8'});
-    const data = JSON.parse(result);
+    let result;
+    try {
+      result = execSync('npm ls temporal-polyfill --json', {encoding: 'utf8'});
+    } catch (error) {
+      result = error.stdout?.toString() || '{}';
+    }
+    const data = JSON.parse(result);
     const resolved = data.dependencies?.['temporal-polyfill'];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/polyfill-check.test.js` around lines 15 - 29, Update the “should use
temporal-polyfill v1 as a direct dependency” test to avoid failing solely
because npm ls exits non-zero for unrelated dependency issues. Prefer reading
temporal-polyfill’s installed package metadata directly, or catch execSync
errors and safely parse any available stdout before asserting the resolved v1
version; leave the ESM import test unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/polyfill-check.test.js`:
- Around line 15-29: Update the “should use temporal-polyfill v1 as a direct
dependency” test to avoid failing solely because npm ls exits non-zero for
unrelated dependency issues. Prefer reading temporal-polyfill’s installed
package metadata directly, or catch execSync errors and safely parse any
available stdout before asserting the resolved v1 version; leave the ESM import
test unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7c7ca44-81c0-41f3-8d26-e80e60a594a4

📥 Commits

Reviewing files that changed from the base of the PR and between 7d81fb7 and 1f3d11d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • build/build-cjs.js
  • package.json
  • test/polyfill-check.test.js

@jens-maus
jens-maus merged commit 9c6d962 into jens-maus:master Jul 20, 2026
14 checks passed
@KristjanESPERANTO
KristjanESPERANTO deleted the temporal-polyfill branch July 20, 2026 16:19
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.

2 participants