feat: resolveIncludesAsync追加 & include処理をWikidot互換イテレーティブ方式に書き換え#36
Merged
Conversation
非同期fetcherに対応したinclude展開関数を追加。 Cloudflare Workers + D1等の非同期DB環境で、 ページを1つずつ非同期取得しながらinclude展開が可能になる。 - AsyncIncludeFetcher型を追加 - resolveIncludesAsync関数を追加(while + RegExp.exec + awaitで実装) - 既存の同期API (resolveIncludes, IncludeFetcher) は変更なし - テスト17件追加(同期版との結果一致、循環検出、maxDepth等)
DFS再帰方式からWikidotと同じdo-whileイテレーティブ方式に変更。 各イテレーションでソース全体の全includeを1段だけ一括置換し、 変化がなくなるかmaxIterationsに到達するまで繰り返す。 - expandText/expandTextAsync再帰を廃止 - expandIterative/expandIterativeAsync(forループ方式)に置換 - trace配列(循環検出)を削除(maxIterations + 変化なし検出で停止) - ResolveIncludesOptions: maxDepth削除 → maxIterations追加(デフォルト10) - inc-loopパターン(同一ページ・異なる変数での再帰include)が動作可能に BREAKING CHANGE: maxDepthオプション削除、循環includeのエラー文言廃止
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wdpr-demo-v1-files | c0084e9 | Commit Preview URL Branch Preview URL |
Mar 17 2026, 08:40 AM |
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.
Summary
resolveIncludesAsyncを追加(非同期fetcher対応)Changes
1.
resolveIncludesAsync追加AsyncIncludeFetcher型とresolveIncludesAsync関数を追加2. Wikidot互換イテレーティブ方式
maxIterations到達で停止(Wikidotのdo-while+level<5と同等)trace配列(循環検出)を削除 —maxIterations+ 変化なし検出で停止性を保証3. API変更
BREAKING CHANGE
ResolveIncludesOptions.maxDepthを削除 →maxIterationsに置換(デフォルト: 10)"Circular include detected")を廃止追加
AsyncIncludeFetcher型resolveIncludesAsync関数Test plan