Skip to content

chore: 🤖 update dependencies and add support for env config files - #10

Merged
tianyingchun merged 1 commit into
hyperse-io:mainfrom
ShunquanWang:feat/env
Jan 14, 2026
Merged

chore: 🤖 update dependencies and add support for env config files#10
tianyingchun merged 1 commit into
hyperse-io:mainfrom
ShunquanWang:feat/env

Conversation

@ShunquanWang

@ShunquanWang ShunquanWang commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for environment-based configuration files, enabling the config-loader to discover and load environment-specific configurations in addition to standard config formats.
  • Chores

    • Updated multiple dependencies to latest stable versions including @swc/core, commitlint, eslint, vitest, rollup, and tsup.
    • Released as a patch version update.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds support for environment-based config file discovery by extending the config loader's search locations to include env.{moduleName}.ts and env.{moduleName}.mts files. It also bumps multiple dependencies and provides comprehensive test coverage via new test fixtures.

Changes

Cohort / File(s) Summary
Release Management
.changeset/silly-pillows-rescue.md
New changeset documenting patch version bump for @hyperse/config-loader with notes on dependency updates and environment config file support.
Dependency Updates
package.json
Multiple dependency and devDependency version bumps across @hyperse/unplugin-swc, @swc/core, get-tsconfig, changesets packages, commitlint, @types/node, hyperse eslint config, typescript, vitest, eslint, execa, lint-staged, rollup, tsup, and others.
Core Feature
src/config-loader/searchConfig.ts
Extended cosmiconfig search sequence with two new environment-based config file locations: env.{moduleName}.ts and env.{moduleName}.mts.
Test Coverage
tests/config-loader/esm-ts.spec.ts
Added test cases validating loading and searching of environment-based TypeScript config files (.ts and .mts variants), covering both loadConfig and searchConfig workflows.
Test Fixtures
tests/config-loader/fixtures/esm-ts/env.valid.ts, env.valid.mts, env-test/env.valid.ts, env-test/env.valid.mts, env-mts-test/env.valid.mts
Simple ESM TypeScript fixture files exporting test config objects with cake property values for environment-based config testing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A searching rabbit hops with glee,
Finding configs in .ts and .mts decree,
New paths in searchConfig's array,
Environment files light the way!
With fixtures in place, tests run true,
Dependencies bumped—refreshed and new! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: dependency updates and new support for environment config files (env.{moduleName}.ts/mts in searchConfig).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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

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

@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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 52-78: package.json updates bump several packages with breaking
changes (notably vitest to 4.0, commitlint to 20.x, and `@types/node` to 25.x);
run the full test suite and CI locally and update configs: audit and update
vitest config keys and options (remove deprecated keys like
poolMatchGlobs/environmentMatchGlobs, migrate deps.external/inline/fallbackCJS
and reporter hooks usage, adjust coverage remapping and browser provider
config), update tests that rely on vi mocking/spy semantics (replace/adjust uses
of vi.fn().getMockName(), vi.restoreAllMocks() assumptions and automock
behavior), tweak commitlint rules if you relied on body-max-line-length for
URLs, and verify TypeScript/Node typings with `@types/node`@25; if immediate
compatibility fixes are nontrivial, pin the previous working versions in
package.json (restore vitest/commitlint/@types/node) until tests and configs are
updated and CI passes.
🧹 Nitpick comments (1)
src/config-loader/searchConfig.ts (1)

29-35: Consider adding .mts variant for the rc-style TypeScript config.

For consistency, the rc-style TypeScript config (line 30) has only .ts while the regular config has both .ts and .mts (lines 31-32). The new env configs follow the latter pattern with both extensions. You might want to add .${moduleName}rc.mts to maintain consistency across all TypeScript config patterns.

♻️ Optional consistency improvement
       // TS
       `.${moduleName}rc.ts`,
+      `.${moduleName}rc.mts`,
       `${moduleName}.config.ts`,
       `${moduleName}.config.mts`,
       // ENV
       `env.${moduleName}.ts`,
       `env.${moduleName}.mts`,
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ca6e50 and f76d982.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • .changeset/silly-pillows-rescue.md
  • package.json
  • src/config-loader/searchConfig.ts
  • tests/config-loader/esm-ts.spec.ts
  • tests/config-loader/fixtures/esm-ts/env-mts-test/env.valid.mts
  • tests/config-loader/fixtures/esm-ts/env-test/env.valid.mts
  • tests/config-loader/fixtures/esm-ts/env-test/env.valid.ts
  • tests/config-loader/fixtures/esm-ts/env.valid.mts
  • tests/config-loader/fixtures/esm-ts/env.valid.ts
🧰 Additional context used
🧬 Code graph analysis (1)
tests/config-loader/esm-ts.spec.ts (2)
src/config-loader/loadConfig.ts (1)
  • loadConfig (6-21)
src/config-loader/searchConfig.ts (1)
  • searchConfig (11-42)
🔇 Additional comments (9)
tests/config-loader/fixtures/esm-ts/env.valid.mts (1)

1-4: LGTM!

Simple and well-structured test fixture for validating .mts environment config file loading.

.changeset/silly-pillows-rescue.md (1)

1-5: LGTM!

Patch release level is appropriate for this additive, non-breaking feature. The description accurately captures the scope of changes.

tests/config-loader/fixtures/esm-ts/env.valid.ts (1)

1-4: LGTM!

Clean fixture for validating .ts environment config file loading.

src/config-loader/searchConfig.ts (1)

33-35: LGTM!

The new environment config search locations are consistent with existing TypeScript patterns (no .cts variant, matching lines 30-32). The placement at the end of the search order is reasonable.

tests/config-loader/fixtures/esm-ts/env-mts-test/env.valid.mts (1)

1-4: LGTM!

Clean fixture for testing searchConfig with .mts environment config files in a dedicated test directory.

tests/config-loader/fixtures/esm-ts/env-test/env.valid.ts (1)

1-4: LGTM!

Clean test fixture that follows the established pattern for config files in this test suite. The distinct value 'a lie env' allows tests to verify the correct file is being loaded.

tests/config-loader/fixtures/esm-ts/env-test/env.valid.mts (1)

1-4: LGTM!

Properly structured .mts fixture with a distinct value that enables testing the fallback behavior when .ts variant doesn't exist.

tests/config-loader/esm-ts.spec.ts (2)

45-59: LGTM!

Good test coverage for direct loading of both .ts and .mts env config files. The tests follow the established pattern and correctly validate the expected config values.


103-119: Good coverage for env config search functionality.

The tests properly validate both the .ts env config discovery and the .mts fallback when .ts doesn't exist. The test directory setup is correct: env-test contains both .ts and .mts files (search priority), while env-mts-test contains only the .mts file, ensuring the fallback behavior is properly tested.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread package.json
Comment on lines 52 to 78
"dependencies": {
"@hyperse/deep-merge": "^1.0.1",
"@hyperse/unplugin-swc": "^1.0.1",
"@hyperse/unplugin-swc": "^1.0.2",
"@manypkg/get-packages": "^3.1.0",
"@swc/core": "^1.13.5",
"@swc/core": "^1.15.8",
"cosmiconfig": "^9.0.0",
"get-tsconfig": "^4.10.1"
"get-tsconfig": "^4.13.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "^2.29.7",
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
"@hyperse/eslint-config-hyperse": "^1.4.8",
"@types/node": "^24.5.2",
"@changesets/changelog-github": "^0.5.2",
"@changesets/cli": "^2.29.8",
"@commitlint/cli": "^20.3.1",
"@commitlint/config-conventional": "^20.3.1",
"@hyperse/eslint-config-hyperse": "^1.5.0",
"@types/node": "^25.0.8",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^9.36.0",
"execa": "^9.6.0",
"eslint": "^9.39.2",
"execa": "^9.6.1",
"husky": "^9.1.7",
"lint-staged": "^16.1.6",
"lint-staged": "^16.2.7",
"npm-run-all": "^4.1.5",
"rollup": "^4.52.0",
"tsup": "^8.5.0",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
"rollup": "^4.55.1",
"tsup": "^8.5.1",
"typescript": "^5.9.3",
"vitest": "^4.0.17"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

vitest 4.0 breaking changes migration guide

💡 Result:

Here are the main Vitest 4.0 breaking changes and the minimal migration actions you should take. See the official migration guide and release post for full details. [1][2]

  • V8 coverage remapping changed

    • Expect different coverage numbers; no action unless you rely on v8-to-istanbul specifics. Validate reports and update CI thresholds if needed. [1]
  • Mocking / spies behavior changed

    • vi.fn().getMockName() now defaults to no name (affects mock snapshots).
    • vi.restoreAllMocks() no longer resets automocks (only restores spies from vi.spyOn); .mockRestore still clears implementations.
    • vi.spyOn called on a mock returns the same mock.
    • Update tests that relied on the previous restore/spy behaviors and snapshot names. [1]
  • Deprecated APIs removed — update config/tests to new options

    • Replace poolMatchGlobs / environmentMatchGlobs with projects.
    • Move deps.external/inline/fallbackCJS → server.deps.external/inline/fallbackCJS.
    • Replace browser.testerScripts → browser.testerHtmlPath.
    • Remove minWorkers (use maxWorkers only).
    • Reporter hook APIs (onCollected, onSpecsCollected, onPathsCollected, onTaskUpdate, onFinished) removed — migrate to the new Reporters API. [1][5]
  • Browser mode / providers changes

    • Browser provider config now uses objects (provider factories) instead of strings; provider packages are separate (e.g. @vitest/browser-playwright). Update test config and imports accordingly. [5][2]
  • Internal/entry changes

    • vitest/execute entrypoint removed.
    • __vitest_executor injection removed; moduleRunner injected instead.
    • vite-node is no longer a dependency.
    • Custom environments should provide viteEnvironment instead of transformMode. [1][5]
  • Other renames / env vars

    • VITE_NODE_DEPS_MODULE_DIRECTORIES → VITEST_MODULE_DIRECTORIES.
    • deps.optimizer.web → deps.optimizer.client (or custom name). [1]
  • Reporters / defaults

    • Basic reporter removed; use equivalent default reporter config instead. [5]

Quick migration checklist

  1. Read your test run and coverage reports after upgrading. Adjust CI thresholds. [1]
  2. Search & update usages of removed config keys and APIs in vitest config and custom reporters. [1][5]
  3. Update mocks/spy-based tests that assume old vi.restoreAllMocks/vi.spyOn behaviors and snapshot names. [1]
  4. If you use Browser Mode, install the new provider packages and convert provider config to the new object/factory form. [5][2]
  5. Run full test suite and fix failures caused by API/behavior changes.

Sources:

  1. Vitest Migration Guide — "Migrating to Vitest 4.0". [Vitest docs]. [1]
  2. Vitest 4.0 release announcement / blog. [2]

Would you like a PR-ready patch (search-and-replace script) for your vitest config and common patterns?


🌐 Web query:

commitlint 20.0 breaking changes

💡 Result:

Summary — breaking change in commitlint v20.0.0 (released Sep 25, 2025)

  • The rule body-max-line-length now ignores lines that contain URLs (so long URL lines no longer count toward the body max-line-length). [1][2]

Impact and migration

  • If you relied on body-max-line-length to enforce max length for all body lines (including URL lines), update your checks or add a custom rule to re-include URL lines. Otherwise no other major breaking changes were listed in the v20.0.0 release. [1][2]

Sources

  • commitlint v20.0.0 release notes (GitHub). [1]
  • commitlint npm/newreleases v20.0.0 summary. [2]

🌐 Web query:

@types/node 25 breaking changes

💡 Result:

Short answer: there’s no dedicated “@types/node v25 changelog.” Breaking/type changes for @types/node v25 mainly mirror Node.js v25 API changes (removed/EOLed APIs and new globals/DOM-ish APIs) and TypeScript-compatibility updates. Check these sources to see what will break and how to migrate:

  • Node.js v25 release notes (lists semver‑major removals/changes that drive type changes — e.g. removal/finalization of SlowBuffer, global ErrorEvent, Web Storage enabled by default, new permissions like --allow-net). (nodejs.org)
  • DefinitelyTyped discussion explaining there is no centralized @types/node changelog and that you must inspect DT commits/PRs or the upstream Node changes. (github.com)
  • @types/node release history / diffs (inspect specific @types/node v25.x releases or use a package-diff/compare tool to see the exact .d.ts changes). Example release list. (releasealert.dev)

If you want, I can:

  • List the specific Node v25 API changes most likely to affect your code (based on your codebase, e.g. uses of SlowBuffer, global ErrorEvent, fs.Dir GC behavior, node:_internal modules).
  • Produce a diff of your current @types/node version → v25 and highlight breaking type changes (I can fetch the two releases and summarize).

Citations:


Verify vitest 4.0 compatibility — multiple breaking changes require attention.

The major version bumps here warrant careful testing:

  • vitest 4.0 has significant breaking changes: V8 coverage remapping (may affect CI thresholds), mocking/spy behavior changes (e.g., vi.fn().getMockName() defaults differ, vi.restoreAllMocks() no longer resets automocks), deprecated config keys removed (poolMatchGlobs, environmentMatchGlobs, deps.external/inline/fallbackCJS, reporter hooks API), browser mode provider changes, and removed internal APIs. Verify your test config and test suite runs cleanly.

  • commitlint 20.x: One minor breaking change — body-max-line-length now ignores URLs. Update config if you relied on strict line length for URL lines.

  • @types/node 25.x: Type-only update mirroring Node.js v25 API changes. Low risk for build tools; verify in CI.

Ensure CI passes with these updates before merging.

🤖 Prompt for AI Agents
In `@package.json` around lines 52 - 78, package.json updates bump several
packages with breaking changes (notably vitest to 4.0, commitlint to 20.x, and
`@types/node` to 25.x); run the full test suite and CI locally and update configs:
audit and update vitest config keys and options (remove deprecated keys like
poolMatchGlobs/environmentMatchGlobs, migrate deps.external/inline/fallbackCJS
and reporter hooks usage, adjust coverage remapping and browser provider
config), update tests that rely on vi mocking/spy semantics (replace/adjust uses
of vi.fn().getMockName(), vi.restoreAllMocks() assumptions and automock
behavior), tweak commitlint rules if you relied on body-max-line-length for
URLs, and verify TypeScript/Node typings with `@types/node`@25; if immediate
compatibility fixes are nontrivial, pin the previous working versions in
package.json (restore vitest/commitlint/@types/node) until tests and configs are
updated and CI passes.

@tianyingchun
tianyingchun merged commit 45a2c31 into hyperse-io:main Jan 14, 2026
3 checks passed
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