fix(site-kit): flag data on a ./flags subpath + review follow-ups - #32
Merged
Conversation
…or, SSR test, a11y name, release verifier
- Move FLAG_COUNTRY/LOCALE_FLAGS/flagFor off the root barrel (src/core/index.mjs)
onto a dedicated @devslab/site-kit/flags export, so consumers that never render
a flag menu stop bundling ~110 KB of vendored SVG.
- Harden the flag generator: reject single-quoted id attributes and any id value
that doesn't match /^[\w-]+$/, and credit the flag-icons copyright holder in
the generated header.
- Assert the SSR flag-variant test actually renders artwork (viewBox + a stable
path fragment from the Korean flag), not just markup shape.
- Give the flag trigger a self-describing aria-label ("Language: English")
instead of the bare native name.
- Extend verify-site-kit-release.mjs to check the new files ship and that the
./flags subpath resolves from a fresh install.
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.
Fix-wave for the site-kit flag locale menu (#30, #31 → main 90786b1, unpublished 0.4.0), addressing final-review findings.
Fixes
Flag data off the root barrel.
FLAG_COUNTRY/LOCALE_FLAGS/flagForno longer re-export fromsrc/core/index.mjs/.d.mts; added"./flags"topackage.jsonexports (types/import→src/core/flags.d.mts/.mjs).src/solid/locale-menu.tsxalready imported../core/flags.mjsdirectly, so it's untouched. Updatedtests/site-kit-contracts.test.mjs(barrel must NOT matchflagFor; asserts the./flagsexport exists with the righttypes/import) and both READMEs to describe the flag data as living on@devslab/site-kit/flags, with the size rationale.tests/site-kit-core.test.mjsalready importedflags.mjsdirectly — no change needed there.Generator guard.
scripts/build-flags.mjsnow rejects a body containing a single-quotedid='or anyid="…"whose value doesn't match/^[\w-]+$/, throwing with the offending country. Generated header now also creditsCopyright (c) 2013 Panayiotis Lipiridis. Regeneratedflags.mjs/flags.d.mts;--checkpasses.SSR artwork assertion.
ssr.test.tsx's flag-variant test now assertsviewBox="0 0 640 480"and a stabled="…"path fragment pulled fromLOCALE_FLAGS.ko.bodyactually appear in the rendered HTML. Removed the vacuousnot.toContain("<script")check.Trigger accessible name. The flag trigger's
aria-labelis now`${props.messages.localeLabel}: ${current().nativeName}`(e.g. "Language: English"),titleunchanged. Updatedlocale-menu.test.tsxand thetests/browser/site-kit.spec.tsArabic fixture ("اللغة: العربية") + assertion.Release verifier.
scripts/verify-site-kit-release.mjsnow checkssrc/core/flags.mjs,src/core/flags.d.mts, andflags/LICENSE-flag-icons.txtship in the packed tarball, assertsflagForis a function when importingflags.mjsdirectly, and spawns a probe script from the installed tarball'snode_modulesto prove@devslab/site-kit/flagsresolves via the package'sexportsmap.Versioning note
0.4.0(the flag locale menu itself) hasn't been published yet. Added.changeset/flags-subpath.md(@devslab/site-kit: patch) — since site-kit is in the fixed release group, this bump means the release ships as0.4.1, with the flag menu and this follow-up going out together. Called out explicitly in the changeset text.Verification (all green)
pnpm run buildnode --test tests/site-kit-core.test.mjs tests/site-kit-contracts.test.mjs— 16 passpnpm --filter @devslab/site-kit run test— 17 pass (15 + 2 SSR)pnpm --filter @devslab/site-kit run checkpnpm run verify:site-kit:browser— 6 passpnpm run verify:site-kit:releasepnpm run verify