Repository navigation
fix: compatibility and robustness hardening, 0.1.2 - #1
Merged
Merged
Conversation
No consumer config changes are needed; only inputs that were already silently broken now fail at build time. - tracking: never touch window/document when they are absent, so the enhancement is a no-op in SSR/tests instead of a ReferenceError; recognise cross-realm elements by nodeType - tracking: isolate the one-widget:click dispatch and the dataLayer push so a throwing listener or a non-array dataLayer cannot break the other sink or navigation; one bad widget no longer stops the rest - tracking: report middle-click opens via auxclick; ignore right clicks - tracking: match ?from= case-insensitively after trimming, and report the configured spelling so buckets stay low-cardinality - render: return "" when no item is enabled instead of an empty <nav> landmark; blank ariaLabel falls back to the default; trim tracking strings and de-duplicate the allowlist; accept null options - model: treat null optional fields (JSON/CMS exports) as unset; reject mailto: links without a recipient - registry: normalise declared hosts like URL#hostname (case, IDN, trailing dot, pasted scheme) while leaving path-scoped entries unmatched as before; protocols may omit the colon; a differently-cased custom key replaces the built-in; accept Map definitions; reject non-object platforms/icons and non-Map registries with clear errors - package: add main/types/typesVersions and "default" export conditions so node10 resolution and default-only tooling resolve entries and types - types: readonly item arrays, nullable options, TrackingEnvironment exported from the main entry - css: wrap long labels, keep the focus ring unclipped in the inline scroller, :focus fallback without :focus-visible, forced-colors borders, clip-path for sr-only text - ci: GitHub Actions on Node 20/22/24 plus Astro 5/6/7 fixture builds - docs: CHANGELOG 0.1.2 (unreleased), README and architecture notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSHDa6j758YbQZUK7QHez4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSHDa6j758YbQZUK7QHez4
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.
概要
兼容性与健壮性加固,发布为 0.1.2。需要改配置:否——现有
items/tracking配置原样可用,新增的构建期报错只针对此前就无法正常工作的输入。改动
客户端归因(
src/tracking.js)window/document的环境(SSR、测试、Worker)里调用不再抛ReferenceError;跨 iframe 的元素按nodeType识别。one-widget:click派发与dataLayer推送互相隔离:页面监听器抛错、或dataLayer被定义成非数组,都不会影响另一路上报或链接跳转。enhancePromotionWidgets()中单个 widget 出错不再中断其它 widget。auxclick上报;右键不上报。?from=去首尾空白、忽略大小写匹配,上报配置里的写法(此前?from=GitHub归入other)。渲染与模型(
src/render.js、src/model.js、src/registry.js、src/icons.js)<nav>地标;空白ariaLabel回落到默认值。tracking字符串去空白、allowlist 去重;options可为null。null可选字段视为未设置。hosts按URL#hostname规则规范化(大小写、IDN、结尾点号、误贴的 scheme);带路径的条目仍不匹配,避免意外扩大到整个域名。protocols可省略冒号;platforms/icons接受Map。mailto:;platforms/icons为数组或非对象;registry/iconRegistry不是Map。包与类型
package.json增加main、types、typesVersions与导出的default条件,moduleResolution: "node10"及只认default条件的工具也能解析。readonly数组与可空 options;TrackingEnvironment从主入口导出。样式(
src/styles.css)inline滚动容器不再裁掉焦点环;无:focus-visible时回落:focus;forced-colors 下保留边框;sr-only 改用clip-path。CI
.github/workflows/ci.yml:Node 20 / 22 / 24 跑npm run check+pack:check,Astro 5 / 6 / 7 构建 fixture 并断言。升级后可见的行为变化
other。<nav>。验证
npm run check:41 个测试通过(原 27 个),契约测试未改动。verify.mjs。NodeNext、bundler、node10三种解析方式下通过。?from=GitHub→github,390px 无横向溢出,Tab 焦点环可见。发布说明
v0.1.2tag 打在本分支 head 上。请用 Create a merge commit 合并,这样 tag 指向的提交会留在main历史里(squash / rebase 会生成新提交,tag 就不在main上了)。🤖 Generated with Claude Code
https://claude.ai/code/session_01SSHDa6j758YbQZUK7QHez4
Generated by Claude Code