mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
f0c3b4bba7
CR-loop confirmation-round findings on the #3324 guard: - validator: replace the single-`typesIndex` model with per-mode resolution. import- and require-mode resolve independently (each picks the first present of {types, <mode>, node, default} in object order), so a trailing `default`/`node` shadowed by a typed `import` + `require` is no longer a false positive, while a genuinely misordered/absent `types` is still flagged. - helper: make `withTypesConditions` idempotent (skip an object that already carries a `types` key, so re-application never re-nests `default`) and optional-chain `ctx` so a missing context hits the fail-loud message. - CI: run scripts/__tests__/tsdown-exports.test.ts in the guard workflow (the helper is the mechanism that injects the types conditions, and its test ran in NO workflow) and add it to the trigger `paths`; note the standalone gate validates committed artifacts, not build output. - tests: assert `types` is emitted FIRST via serialization (toEqual is key-order-insensitive and missed a types-last regression); add idempotency and trailing-default regression cases. - react-native: document why its exports map is hand-maintained (no tsdown `exports` hook) and guarded by validate:exports. Call sites enumerated: - walk / findExportsTypeViolations — internal to the validator + its tests; signatures unchanged. JS_CONDITIONS removed (grep-confirmed no refs); replaced by RESOLUTION_MODES + isActiveCondition. - withTypesConditions — 13 tsdown configs via customExports; signature unchanged, tsdown always supplies ctx.pkg.packageJsonPath and never re-applies or emits null/array, so the new guards never fire on current input. 28 tests pass; validator typechecks; real 25-package validate:exports exits 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>