Skip to content

Commit 876a2a9

Browse files
Version Packages (#420)
# Releases ## react-live@5.0.0 ### Major Changes - [#418](#418) [`be53ccd`](be53ccd) - Support React 19 type definitions, add an `exports` map, drop `engines`, and raise the output target. `LivePreview`'s overloads referenced the global `JSX` namespace, which `@types/react@19` removed. Because those types are emitted into the published declarations, consumers on React 19 types failed to compile. They now use `React.JSX`, which resolves under both `@types/react@18` and `@types/react@19`. The package also gains an `exports` map with separate types for the ESM and CJS conditions. Filenames are unchanged from 4.1.x (`dist/index.js`, `dist/index.mjs`, `dist/index.d.ts`), so `main`, `module`, and `types` resolve exactly as before. Subpaths other than `./package.json` are no longer importable; only the package root was ever documented. Output is now built for `es2022` rather than `es6`, so the bundle may contain syntax such as optional chaining that previous releases transpiled away. The `engines` field is gone, along with the `node: ">= 0.12.0"` and `npm: ">= 2.0.0"` it declared. Both were years out of date, and neither constrained anything real: this is browser code, so the Node version that installs it has no bearing on whether it runs. npm will no longer print an engine warning against those bounds. None of this changes the public API -- same exports, same props, same `react >=18` peer range -- but the `exports` map and the raised output target are enough that a major release is the honest way to ship them. - [#421](#421) [`004b007`](004b007) - Type the `live` prop that `withLive` injects, instead of `Record<string, unknown>`. Wrapped components saw `unknown` for every key, so `live.element` could not be rendered and `live.error` could not be read without casting first. The prop now uses the same type the context is created with, which is the shape [the docs](https://github.com/FormidableLabs/react-live/blob/main/docs/api.md) have always described: `code`, `error`, `element`, `onError`, `onChange`. ```tsx const Panel = withLive(({ live }) => { const Result = live.element; // was `unknown`, now a component return Result ? <Result /> : <pre>{live.error}</pre>; }); ``` Types only, with no runtime change. It is a narrowing, so a wrapped component that reads a key outside that shape off `live` will now fail to compile. ### Patch Changes - [#418](#418) [`be53ccd`](be53ccd) - Forward the `Editor` `prism` prop to `prism-react-renderer`. It was typed but never passed through, so a custom Prism instance was silently ignored. - [#418](#418) [`be53ccd`](be53ccd) - Stop emitting React's `__self` and `__source` debug props from transpiled code. Sucrase adds these props to every element it compiles. They describe a source file, and there is no source file here -- the code comes from a live editor rather than from disk, so the filename sucrase emitted was always the empty string. React ignores both props, and React 19 additionally treats `__self` as the signature of an outdated JSX transform, logging "Your app (or one of its dependencies) is using an outdated JSX transform" to the console of every page rendering a `LiveProvider`. Transpiling with sucrase's `production` option drops both props, and with them the `_jsxFileName` constant that the transform pipeline used to splice out and re-add solely to keep `__source` resolvable. - [#418](#418) [`be53ccd`](be53ccd) - Add `getDerivedStateFromError` to the internal error boundary, so a runtime error in live code no longer logs a React warning about it. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 004b007 commit 876a2a9

8 files changed

Lines changed: 68 additions & 77 deletions

File tree

‎.changeset/nervous-donkeys-smile.md‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎.changeset/olive-dolls-repeat.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.changeset/olive-otters-listen.md‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎.changeset/plenty-hoops-wonder.md‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎.changeset/tame-moons-shake.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/react-live/CHANGELOG.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,71 @@
11
# react-live
22

3+
## 5.0.0
4+
5+
### Major Changes
6+
7+
- [#418](https://github.com/FormidableLabs/react-live/pull/418) [`be53ccd`](https://github.com/FormidableLabs/react-live/commit/be53ccd06370220da0055caa9bc2c18db96e94c5) - Support React 19 type definitions, add an `exports` map, drop `engines`, and raise the
8+
output target.
9+
10+
`LivePreview`'s overloads referenced the global `JSX` namespace, which `@types/react@19`
11+
removed. Because those types are emitted into the published declarations, consumers on React
12+
19 types failed to compile. They now use `React.JSX`, which resolves under both
13+
`@types/react@18` and `@types/react@19`.
14+
15+
The package also gains an `exports` map with separate types for the ESM and CJS conditions.
16+
Filenames are unchanged from 4.1.x (`dist/index.js`, `dist/index.mjs`, `dist/index.d.ts`), so
17+
`main`, `module`, and `types` resolve exactly as before. Subpaths other than
18+
`./package.json` are no longer importable; only the package root was ever documented.
19+
20+
Output is now built for `es2022` rather than `es6`, so the bundle may contain syntax such as
21+
optional chaining that previous releases transpiled away.
22+
23+
The `engines` field is gone, along with the `node: ">= 0.12.0"` and `npm: ">= 2.0.0"` it
24+
declared. Both were years out of date, and neither constrained anything real: this is browser
25+
code, so the Node version that installs it has no bearing on whether it runs. npm will no
26+
longer print an engine warning against those bounds.
27+
28+
None of this changes the public API -- same exports, same props, same `react >=18` peer
29+
range -- but the `exports` map and the raised output target are enough that a major release
30+
is the honest way to ship them.
31+
32+
- [#421](https://github.com/FormidableLabs/react-live/pull/421) [`004b007`](https://github.com/FormidableLabs/react-live/commit/004b0071ca518b4f75a4bc77c0615e11979d814c) - Type the `live` prop that `withLive` injects, instead of `Record<string, unknown>`.
33+
34+
Wrapped components saw `unknown` for every key, so `live.element` could not be
35+
rendered and `live.error` could not be read without casting first. The prop now
36+
uses the same type the context is created with, which is the shape
37+
[the docs](https://github.com/FormidableLabs/react-live/blob/main/docs/api.md)
38+
have always described: `code`, `error`, `element`, `onError`, `onChange`.
39+
40+
```tsx
41+
const Panel = withLive(({ live }) => {
42+
const Result = live.element; // was `unknown`, now a component
43+
return Result ? <Result /> : <pre>{live.error}</pre>;
44+
});
45+
```
46+
47+
Types only, with no runtime change. It is a narrowing, so a wrapped component
48+
that reads a key outside that shape off `live` will now fail to compile.
49+
50+
### Patch Changes
51+
52+
- [#418](https://github.com/FormidableLabs/react-live/pull/418) [`be53ccd`](https://github.com/FormidableLabs/react-live/commit/be53ccd06370220da0055caa9bc2c18db96e94c5) - Forward the `Editor` `prism` prop to `prism-react-renderer`. It was typed but never passed through, so a custom Prism instance was silently ignored.
53+
54+
- [#418](https://github.com/FormidableLabs/react-live/pull/418) [`be53ccd`](https://github.com/FormidableLabs/react-live/commit/be53ccd06370220da0055caa9bc2c18db96e94c5) - Stop emitting React's `__self` and `__source` debug props from transpiled code.
55+
56+
Sucrase adds these props to every element it compiles. They describe a source file, and there
57+
is no source file here -- the code comes from a live editor rather than from disk, so the
58+
filename sucrase emitted was always the empty string. React ignores both props, and React 19
59+
additionally treats `__self` as the signature of an outdated JSX transform, logging
60+
"Your app (or one of its dependencies) is using an outdated JSX transform" to the console of
61+
every page rendering a `LiveProvider`.
62+
63+
Transpiling with sucrase's `production` option drops both props, and with them the
64+
`_jsxFileName` constant that the transform pipeline used to splice out and re-add solely to
65+
keep `__source` resolvable.
66+
67+
- [#418](https://github.com/FormidableLabs/react-live/pull/418) [`be53ccd`](https://github.com/FormidableLabs/react-live/commit/be53ccd06370220da0055caa9bc2c18db96e94c5) - Add `getDerivedStateFromError` to the internal error boundary, so a runtime error in live code no longer logs a React warning about it.
68+
369
## 4.1.8
470

571
### Patch Changes

‎packages/react-live/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-live",
3-
"version": "4.1.8",
3+
"version": "5.0.0",
44
"description": "A production-focused playground for live editing React code",
55
"license": "MIT",
66
"author": "@FormidableLabs",

0 commit comments

Comments
 (0)