Conversation
2244672 to
5f3ac04
Compare
Member
Author
|
@LuciferChiu cc |
LuciferChiu
reviewed
Jun 26, 2025
LuciferChiu
approved these changes
Jul 1, 2025
chenjiahan
reviewed
Jul 1, 2025
Member
Author
There was a problem hiding this comment.
Pull Request Overview
This PR reimplements support for multiple retry rules by extending types, enhancing runtime logic, and updating documentation.
- Allow
testto be aRegExpand introduce arulesarray in options - Implement rule-based matching and processing in both initial and async chunk retry runtimes
- Update plugin entry to normalize multiple rules and refresh docs/examples
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/basic/multipleRules.test.ts | Added end-to-end tests covering multiple rule scenarios |
| src/types.ts | Extended test to accept RegExp and added rules union type |
| src/runtime/utils/urlCalculate.ts | Refactored domain lookup and next-domain logic |
| src/runtime/utils/findMatchingRule.ts | Added matching logic over test/domain/type |
| src/runtime/initialChunkRetry.ts | Updated retry/load handlers to iterate over rules |
| src/runtime/asyncChunkRetry.ts | Adapted async-chunk logic to pick and apply matching rule |
| src/index.ts | Modified getRuntimeOptions to produce arrays of normalized rules |
| README.md | Documented rules option and updated type signatures |
| README.zh-CN.md | Introduced rules section and examples |
Comments suppressed due to low confidence (4)
src/runtime/initialChunkRetry.ts:275
- [nitpick] The parameter
configholds an array of rules rather than a single config object. Rename it torulesto match its type and usage, improving clarity.
function load(config: NormalizedRuntimeRetryOptions[], e: Event) {
README.zh-CN.md:64
- The
testproperty can now also be aRegExp. Update the type tostring | RegExp | ((url: string) => boolean)to align with the code.
test?: string | ((url: string) => boolean);
src/runtime/utils/findMatchingRule.ts:1
- The function refers to
NormalizedRuntimeRetryOptionsbut the type isn't imported. Addimport type { NormalizedRuntimeRetryOptions } from '../types.js';at the top.
import { findCurrentDomain } from './urlCalculate.js';
src/runtime/utils/urlCalculate.ts:1
- The signature uses
NormalizedRuntimeRetryOptionsbut that type isn't imported. Please addimport type { NormalizedRuntimeRetryOptions } from '../../types.js';or the correct relative path.
export function findCurrentDomain(
chenjiahan
approved these changes
Jul 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

feat: support multiple rules
the reimplementation of #21
close #21
1.7kb -> 1.9kb