Skip to content

refactor(js): flatten and reorganize js/src TS files (#54) - #145

Merged
schloerke merged 6 commits into
mainfrom
issue-54
Jun 10, 2026
Merged

schloerke merged 6 commits into
mainfrom
issue-54

Conversation

@schloerke

Copy link
Copy Markdown
Collaborator

Summary

Behavior-preserving refactor of the IIFE entry module so every top-level file under js/src/ has one clear responsibility and index.ts reads as a boot sequence rather than a kitchen sink. Closes #54.

  • Extract output-binding.ts — moves ShinyreactOutputBinding out of index.ts behind an explicit registerShinyreactOutputBinding().
  • Extract global.ts — moves the Window.shinyreact declaration + window.shinyreact = Object.assign(...) assignment behind an explicit installGlobal().
  • Rename spec.ts → types.ts — the file is exclusively wire-tree TS types; exported type names unchanged, 5 importers repointed.
  • index.ts is now ~9 lines: CSS import + installGlobal() → registerShinyreactOutputBinding() → installInlineSpecSeeding().

No import-time side effects for our own modules (only the unavoidable ./shinyreact.css). No change to runtime behavior, exported type names, or the window.shinyreact surface. Vendored js/src/shiny-react/ untouched (its fate is downstream of #28).

Of the issue's five proposals: #3 (test colocation) was already done; #5 (vendored dir) is out of scope; this PR does #1, #2, and #4.

Test Plan

  • make js-lint (tsc --noEmit) clean
  • npx vitest run — 183 tests pass
  • make js-build produces a byte-similar dist/shinyreact.js (diff is bundler-internal mangled-symbol renames only; +40 bytes from one added doc comment)
  • make update-dist refreshed the bundled copies in pkg-py/ and pkg-r/

Spec and plan: docs/superpowers/specs/2026-06-10-flatten-js-src-design.md, docs/superpowers/plans/2026-06-10-flatten-js-src.md

@schloerke
schloerke merged commit 84ec041 into main Jun 10, 2026
16 checks passed
@schloerke
schloerke deleted the issue-54 branch June 10, 2026 17:09
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.

Flatten and reorganize js/src/ TS files

1 participant