Skip to content

Add legacy ESM export subpath, fix Phase 6 docs findings#31

Merged
fan-droide merged 3 commits into
mainfrom
idsinge/fix/legacy-subpath-and-phase6-docs
Jun 17, 2026
Merged

Add legacy ESM export subpath, fix Phase 6 docs findings#31
fan-droide merged 3 commits into
mainfrom
idsinge/fix/legacy-subpath-and-phase6-docs

Conversation

@fan-droide

Copy link
Copy Markdown
Collaborator

Summary

  • Exposes dist/latency-test.legacy.esm.js via a "./legacy" exports subpath in package.json so bundler consumers can import "@adasp/latency-test/legacy", with docs added in install.md and build-output.md.
  • Patches all Phase 6 docs findings from Phase 6 findings — Tier 1 verification complete (latency-test-examples) #30: Svelte self-closing tags, Angular zoneless setup notes, the false "React 19+ auto-detects JSX types" claim (replaced with a working declare module 'react' pattern, verified against @types/react 19.2.17), and CDN snippet hardening (title, SRI hash, module-script race fix) in vanilla-js.md.
  • Fixes the connect() example bug (stale error state on retry + leaked AudioContext on failed getUserMedia()) identically across all 7 framework example implementations, plus the same pattern in docs/index.md, docs/install.md, and docs/examples/host-gain.md.

Test plan

  • npm test — 34/34 passing
  • npm run typecheck — clean
  • npm run docs:build — clean
  • Verified import("@adasp/latency-test/legacy") resolves to the legacy build
  • Verified the declare module 'react' JSX augmentation fix in an isolated TS sandbox against @types/react@19.2.17

Closes #29
Closes #30

gilpanal added 3 commits June 17, 2026 12:40
- package.json: expose dist/latency-test.legacy.esm.js via a "./legacy"
  exports subpath so bundler consumers can `import "@adasp/latency-test/legacy"`
  instead of reaching into node_modules directly. Documented in install.md
  and build-output.md.
- docs/examples/svelte.md: explicit close tags instead of self-closing
  <latency-test /> (Svelte 5 compiler warning).
- docs/examples/angular.md: documents re-enabling zone.js on CLI 22+
  zoneless scaffolds (npm install, polyfill load order, provideZoneChangeDetection,
  markForCheck()).
- docs/examples/{react,nextjs}.md: JSX IntrinsicElements augmentation now
  works on all React versions via `declare module 'react'` with the
  required `import type {} from 'react'` (verified against
  @types/react 19.2.17 — the previous "React 19+ auto-detects" claim was false).
- docs/examples/vanilla-js.md: CDN snippet adds <title>, SRI hash +
  crossorigin on the pinned script tag, and type="module" on the inline
  script to remove a custom-element upgrade race.
- connect() examples (vanilla-js, react, vue, svelte x2, angular, nextjs):
  clear stale error state on retry and close the AudioContext created
  before a failed getUserMedia() call, instead of leaking it.
- docs/index.md, docs/install.md, docs/examples/host-gain.md: same
  AudioContext-leak pattern fixed in the Quick Start / host-gain snippets.

Closes #29
Closes #30
npm audit --audit-level=high was failing on 3 devDependency-only
vulnerabilities (esbuild/vite/vitepress, transitive through vitepress's
docs tooling). None of these ship in the published package (files
whitelist is dist/, README.md, CHANGELOG.md, LICENSE only), and there is
no available fix that doesn't break docs:build (esbuild 0.28.1 breaks
vite 5.4.21's destructuring transform for legacy browser targets).
Scoping the audit to --omit=dev makes the check reflect actual shipped
risk; confirmed it passes clean (0 vulnerabilities).
The earlier --omit=dev CI scoping worked around the 3 devDependency
vulnerabilities (esbuild GHSA-67mh/gv7w/g7r4, vite GHSA-4w7w/v6wh/fx2h)
but didn't actually fix them. A real fix exists:

- package.json: bump direct esbuild to ^0.28.1, and add overrides
  forcing vite to 6.4.3 and vite's nested esbuild to ^0.28.1 — both
  versions clear every advisory. vitepress@1.6.4 declares
  vite: ^5.4.14 (a <6.0.0 range), so this is an intentional
  compatibility override past its declared range, not a semver-safe
  bump.
- docs/.vitepress/config.mjs: set vite.build.target and
  vite.optimizeDeps.esbuildOptions.target to es2020. Without this,
  docs:build fails — esbuild 0.28.x can't downlevel destructuring
  syntax for the older browser targets vite computes by default
  (chrome87/safari14/etc). Raising the floor to es2020 means esbuild
  never needs to perform that lowering. This only affects the docs
  site's own output target, not the published component bundles,
  which have a separate build pipeline and already ship a dedicated
  legacy build for older browsers.
- .github/workflows/ci.yml: revert the audit step to the original
  unscoped `npm audit --audit-level=high` now that it passes clean.

Verified locally: npm audit (0 vulnerabilities), typecheck, test,
build:component:all, docs:build, docs:dev (HTTP 200 smoke test), and
npm pack --dry-run all pass with vite@6.4.3 + esbuild@0.28.1 resolved
throughout the tree.
@fan-droide fan-droide merged commit ce39a49 into main Jun 17, 2026
2 checks passed
fan-droide pushed a commit that referenced this pull request Jun 17, 2026
CLAUDE.md, agents/CLAUDE_REVIEW.md, and agents/SESSION_HANDOFF.md still
described Phase 6 (framework example verification, issue #30) as the
only remaining v1 item and pinned CDN references to @1.2.0 — both
stale now that PR #31 closed #29/#30 and v1.2.1 shipped. Updated all
three to reflect the closed gate, the 1.2.1 release, and the semver
nuance raised during external review (patch vs. minor for the new
./legacy exports subpath).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 6 findings — Tier 1 verification complete (latency-test-examples) Export the legacy ESM build as a package subpath

1 participant