fix(deps): update dependency reduce-configs to v2#63
Conversation
7a88742 to
6a7d4e1
Compare
6a7d4e1 to
a5811e0
Compare
📝 WalkthroughWalkthroughThis PR updates the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@package.json`:
- Line 34: reduce-configs v2 returns a Promise but src/index.ts assigns const
pugOptions = reduceConfigs(...) without awaiting, causing an unresolved Promise
to be spread into Pug options; modify the surrounding function (e.g., the
function that calls reduceConfigs in src/index.ts) to be async and await
reduceConfigs(...) (await const pugOptions = ...) before using or spreading
...pugOptions, and update any upstream callers to handle the async behavior
(either await this function or propagate async) so that Pug receives a resolved
options object rather than a Promise.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b3ee76cf-d775-4098-bdea-28ac1bb999de
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
package.json
| "lodash": "^4.18.1", | ||
| "pug": "^3.0.4", | ||
| "reduce-configs": "^1.1.2" | ||
| "reduce-configs": "^2.0.1" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find all usages of reduceConfigs to verify Promise handling
# Search for reduceConfigs function calls
rg -nP '\breduceConfigs\s*\(' -A 3 -B 1Repository: rstackjs/rsbuild-plugin-pug
Length of output: 1947
🏁 Script executed:
#!/bin/bash
# Find reduce-configs usages that may require Promise/removed-API updates
rg -nP '\breduceConfigs(?:\w+)?\s*\(' src -S
rg -nP '\b(pugOptions|options\.pugOptions)\b' src -SRepository: rstackjs/rsbuild-plugin-pug
Length of output: 315
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect async context and callsite around reduceConfigs
sed -n '1,140p' src/index.ts | nl -ba
# Check for other reduce-configs API usages that may also be breaking
rg -nP '\b(reduceConfigsWithContext|reduceConfigsAsyncWithContext|reduceConfigsMergeContext)\b' src -S || trueRepository: rstackjs/rsbuild-plugin-pug
Length of output: 114
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Show beginning + area around the reduceConfigs call and the spread usage
cat -n src/index.ts | sed -n '1,140p'
# Find any other reduce-configs API usages
rg -nP '\b(reduceConfigsWithContext|reduceConfigsAsyncWithContext|reduceConfigsMergeContext|reduceConfigs)\b' src -SRepository: rstackjs/rsbuild-plugin-pug
Length of output: 4207
🌐 Web query:
reduce-configs v2 reduceConfigs returns Promise<T> pure ESM breaking changes
💡 Result:
The release of reduce-configs v2.0.0 introduced several major breaking changes, including the transition to a pure ESM package and asynchronous reducer execution [1][2]. Key changes in v2.0.0 include: 1. Return Type Change: The primary functions, reduceConfigs and reduceConfigsWithContext, now return a Promise instead of a synchronous T [1][3]. This accommodates the new support for asynchronous configuration callbacks [1][3]. 2. Pure ESM: The package has dropped CommonJS support entirely [2]. It is now an ESM-only package, requiring the use of "type": "module" in package.json or an ESM environment to consume it [2][4]. 3. Removed Exports: Legacy exports, including reduceConfigsAsyncWithContext and reduceConfigsMergeContext, have been removed [1]. These changes were implemented to unify the API and simplify the codebase [1][2]. Users upgrading to v2 must ensure their consuming code handles the asynchronous nature of these functions (e.g., using await) and supports ESM imports [1][2].
Citations:
- 1: feat!: make config reducers async reduce-configs#50
- 2: feat!: drop CommonJS build reduce-configs#51
- 3: rstackjs/reduce-configs@bb80212
- 4: rstackjs/reduce-configs@c1fe799
🏁 Script executed:
#!/bin/bash
rg -nP '\breduceConfigs(?:WithContext|MergeContext)?\s*\(' -S srcRepository: rstackjs/rsbuild-plugin-pug
Length of output: 126
reduce-configs v2 returns a Promise, but src/index.ts still uses it synchronously
src/index.ts assigns const pugOptions = reduceConfigs(...) without await and later spreads ...pugOptions into the Pug options; with reduce-configs@^2.0.1 (v2) returning Promise<T>, this will pass an unresolved Promise to Pug.
Required fix
- const pugOptions = reduceConfigs({
+ const pugOptions = await reduceConfigs({
initial: {
doctype: 'html',
compileDebug: false,
},
config: options.pugOptions,
});🤖 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 `@package.json` at line 34, reduce-configs v2 returns a Promise but
src/index.ts assigns const pugOptions = reduceConfigs(...) without awaiting,
causing an unresolved Promise to be spread into Pug options; modify the
surrounding function (e.g., the function that calls reduceConfigs in
src/index.ts) to be async and await reduceConfigs(...) (await const pugOptions =
...) before using or spreading ...pugOptions, and update any upstream callers to
handle the async behavior (either await this function or propagate async) so
that Pug receives a resolved options object rather than a Promise.
This PR contains the following updates:
^1.1.2→^2.0.1Release Notes
rstackjs/reduce-configs (reduce-configs)
v2.0.1Compare Source
What's Changed
Full Changelog: rstackjs/reduce-configs@v2.0.0...v2.0.1
v2.0.0Compare Source
Breaking Changes
reduceConfigsandreduceConfigsWithContextnow returnPromise<T>.reduceConfigsAsyncWithContext,reduceConfigsMergeContexthas been removed.What's Changed
48b55a0by @renovate[bot] in #40Full Changelog: rstackjs/reduce-configs@v1.1.2...v2.0.0
Configuration
📅 Schedule: (in timezone Asia/Shanghai)
* 0-3 1,15 * *)🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.