feat: <meta> タグによる API キーのフォールバック解決を追加#473
Closed
yuiseki wants to merge 1 commit into
Closed
Conversation
keyring.ts の parse() に <meta name="geolonia-api-key"> によるフォールバックを追加。 既存の <script src> パース方式は一切変更せず、スクリプトタグで API キーが 見つからなかった場合のみ <meta> タグを検索する。 モダン Web フレームワーク(Next.js, Astro, SvelteKit 等)では <script> タグが バンドラに加工されるため、従来の方式で API キーを解決できない問題への対策。 <meta> タグはどのフレームワークでもバンドル加工の対象にならない。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughGeolonia ライブラリに、スクリプト URL から API キーが見つからない場合にメタタグから API キーを読み込むフォールバック機能を追加しました。この機能をカバーする E2E テストとユニットテストも新たに追加されています。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
yuiseki
requested review from
bougan1160,
madmaid,
naogify,
niryuu,
sanak and
smellman
March 16, 2026 03:09
Member
Author
|
v5.1.0 のリリースによって不要になったので閉じます |
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
keyring.tsのparse()に<meta name="geolonia-api-key">によるフォールバックを追加<script src>パース方式は一切変更なし。スクリプトタグで API キーが見つからなかった場合のみ<meta>タグを検索するBackground
モダン Web フレームワーク(Next.js, Astro, SvelteKit 等)では
<script>タグがバンドラに加工されるため、現行の API キー解決方式(document.currentScript/getElementsByTagName('script')で自身のスクリプトタグを探す)が動作しません。3つの PoC(Vercel + Next.js / Netlify + Astro / Cloudflare + React Router)で検証し、いずれもそのままでは
Cannot load API keyエラーが発生することを確認しました。<meta>タグはどのフレームワークでもバンドル加工の対象にならないため、最も安全なフォールバック手段です。使い方
後方互換性
<script src="...?geolonia-api-key=XXX">による既存の解決パスは一切変更なし<script>で API キーが見つかった場合、<meta>フォールバックは実行されない<meta>タグがない既存ページの動作に影響なし(既存 21 テスト全パスで確認)Test plan
npm run buildでビルド成功npx playwright testで 27 テスト全パス(既存 21 + 新規 6)<meta>優先度、空 content、<script>との優先順位)🤖 Generated with Claude Code
Memo
Summary by CodeRabbit
リリースノート
新機能
テスト