Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/check-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches: [main]
paths:
- "js/**/*"
- "pkg-js/**/*"
- "pkg-py/src/shinyreact/www/**"
- "pkg-r/inst/lib/shiny/**"
- ".github/workflows/check-js.yaml"
pull_request:
paths:
- "js/**/*"
- "pkg-js/**/*"
- "pkg-py/src/shinyreact/www/**"
- "pkg-r/inst/lib/shiny/**"
- ".github/workflows/check-js.yaml"
Expand All @@ -27,7 +27,7 @@ jobs:

- name: 🔎 Extract node version from .nvmrc
id: nvm
working-directory: js
working-directory: pkg-js
run: |
echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:

- name: 🔎 Extract node version from .nvmrc
id: nvm
working-directory: js
working-directory: pkg-js
run: |
echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ __pycache__/
build/
develop-eggs/
dist/
!js/dist/
!pkg-js/dist/
downloads/
eggs/
.eggs/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ repos:
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: ^(js/dist/|pkg-py/src/shinyreact/www/|pkg-r/inst/lib/shiny/)
exclude: ^(pkg-js/dist/|pkg-py/src/shinyreact/www/|pkg-r/inst/lib/shiny/)
- id: end-of-file-fixer
exclude: ^(js/dist/|pkg-py/src/shinyreact/www/|pkg-r/inst/lib/shiny/)
exclude: ^(pkg-js/dist/|pkg-py/src/shinyreact/www/|pkg-r/inst/lib/shiny/)
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
Expand Down
14 changes: 7 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The repo ships one first-class pattern: the **`ui.tsx` pattern** — `set_react_
## Repo structure

```
js/ # TypeScript/React Vite IIFE bundle
pkg-js/ # TypeScript/React Vite IIFE bundle
src/ # index.ts, global.ts, shiny-output.tsx, shiny.d.ts, shinyreact.css
dist/ # Built assets (committed to repo)
src/shiny-react/ # Vendored @posit/shiny-react source (hooks, registries)
Expand All @@ -43,11 +43,11 @@ Makefile # All build/check/format commands
```bash
# Initial setup
uv sync --all-extras --all-groups # Python env
make js-setup # JS deps (cd js && npm install)
make js-setup # JS deps (cd pkg-js && npm install)
pre-commit install # Pre-commit hooks

# Build
make js-build # Build JS bundle (js/dist/)
make js-build # Build JS bundle (pkg-js/dist/)
make update-dist # Build JS + copy to pkg-py/www/ and pkg-r/inst/lib/shiny/

# Python checks (run all before committing)
Expand Down Expand Up @@ -78,7 +78,7 @@ Run `make help` to see all targets.

### JS bundle

The JS output (`js/dist/shinyreact.js`) is a self-contained IIFE that bundles React 19 and vendored `@posit/shiny-react`, and installs the public API at `window.shinyreact`.
The JS output (`pkg-js/dist/shinyreact.js`) is a self-contained IIFE that bundles React 19 and vendored `@posit/shiny-react`, and installs the public API at `window.shinyreact`.

**Global API exposed at `window.shinyreact`:**
- `useShinyInput`, `useShinyInputValue`, `useSetShinyInput`, `useShinyOutputValue`, `useShinyOutputStatus`, `useShinyMessageHandler`, `useShinyInitialized`, `useShinyBusy` — re-exported shiny-react hooks
Expand Down Expand Up @@ -109,7 +109,7 @@ The deliberate remaining divergences (decided in #184) are recorded in `decision

### Built assets

`js/dist/` and `pkg-py/src/shinyreact/www/` are both committed to the repo. After changing JS source, run `make update-dist` to rebuild and copy. `pkg-r/inst/lib/shiny/` is the R counterpart (same flow).
`pkg-js/dist/` and `pkg-py/src/shinyreact/www/` are both committed to the repo. After changing JS source, run `make update-dist` to rebuild and copy. `pkg-r/inst/lib/shiny/` is the R counterpart (same flow).

### Build backend

Expand Down Expand Up @@ -271,7 +271,7 @@ When fixing a bug, add or update unit tests to cover the fix whenever possible.

- **Python tests:** `pkg-py/tests/` — run with `make py-check-tests`
- **R tests:** `pkg-r/tests/testthat/` — run with `make r-check-tests`
- **JS tests:** `js/src/shiny-react/__tests__/` — run with `cd js && npx vitest run`
- **JS tests:** `pkg-js/src/shiny-react/__tests__/` — run with `cd pkg-js && npx vitest run`
- **Playwright e2e tests:** `pkg-py/tests/playwright/` — run with `make py-test-e2e`. The `[tool.pytest.ini_options]` block ignores this subtree by default so `make py-check-tests` stays fast; `py-test-e2e` clears that with `-o addopts=`. **Adding a new e2e test:** see [`.claude/references/playwright-e2e-tests.md`](.claude/references/playwright-e2e-tests.md) for the fixture-app layout, the four traps that bit us while writing the suite, and the canonical assertion patterns.

### Cover both R and Python
Expand Down Expand Up @@ -301,5 +301,5 @@ R currently has no e2e suite; that gap is tracked in #194, so Playwright tests a
## Key decisions

- `decisions/` contains architecture decision records. `decisions/2026-03-17-playwright-testing-architecture.md` documents the recommended approach (code-gen from TypeScript) for future browser testing — not yet implemented.
- `shiny-react` is vendored at `js/src/shiny-react/` rather than installed as an npm dependency (commit `4137071`).
- `shiny-react` is vendored at `pkg-js/src/shiny-react/` rather than installed as an npm dependency (commit `4137071`).
- The app.py pattern (server-side JSON-spec rendering: `Node`/`node()`, `render_react`, `output_react`, `page_react`, the JS renderer/registry, and the `shinyui` prototype) was removed in #168. History pointers live in a comment on #167.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ QUARTO_VERSION ?= 1.8.27
QUARTO_PATH = ~/.local/share/qvm/versions/v${QUARTO_VERSION}/bin/quarto
PATH_PKG_R := pkg-r
PATH_PKG_PY := pkg-py
PATH_PKG_JS := js
PATH_PKG_JS := pkg-js

.PHONY: install-quarto
install-quarto:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The bundle re-exports these hooks from `@posit/shiny-react`:

## Architecture

- **JS bundle** (`js/dist/shinyreact.js`): Self-contained IIFE bundling React 19 and vendored `@posit/shiny-react`, exposing the hook API at `window.shinyreact`. Shared by both language packages.
- **JS bundle** (`pkg-js/dist/shinyreact.js`): Self-contained IIFE bundling React 19 and vendored `@posit/shiny-react`, exposing the hook API at `window.shinyreact`. Shared by both language packages.
- **Python package** (`pkg-py/`): `set_react_page()` / `page_react_html()` page entry points, the `reactive_output` renderer, `send_message()`, built-in input handlers, and bookmark restore support.
- **R package** (`pkg-r/`): `page_react_html()`, `reactive_output()`, `send_message()`, the same input handlers and bookmark support. Same JS bundle as Python.

Expand Down
2 changes: 1 addition & 1 deletion docs/posit-conf-2026-goals.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Remaining known issues are tracked in the [GitHub issue tracker](https://github.

### 2. Migrate Shiny JavaScript to its own repo

The vendored `shiny-react` code at `js/src/shiny-react/` and the broader Shiny JS infrastructure should live in its own repository, independent of `shinyreact`. This enables:
The vendored `shiny-react` code at `pkg-js/src/shiny-react/` and the broader Shiny JS infrastructure should live in its own repository, independent of `shinyreact`. This enables:

- Other packages (not just `shinyreact`) to depend on shiny-react
- Independent versioning and release cycle
Expand Down
4 changes: 2 additions & 2 deletions examples/09-hmr/src/shiny-bridge.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// with this example's OWN dev React (Fast Refresh needs a dev React build;
// window.shinyreact.React is production). `resolve.dedupe` in vite.config keeps
// these and App.tsx on a single React copy. The relative path reaches the
// vendored source at the repo's js/src/shiny-react/ (served thanks to
// vendored source at the repo's pkg-js/src/shiny-react/ (served thanks to
// server.fs.allow in vite.config). Downstream apps would import a published
// @posit/shiny-react instead.
export {
useShinyInitialized,
useShinyInput,
useShinyOutputValue,
} from "../../../../js/src/shiny-react/index";
} from "../../../../pkg-js/src/shiny-react/index";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading