Skip to content

Commit 0f8408e

Browse files
committed
[react19] JSX changes
1 parent a867c8b commit 0f8408e

17 files changed

Lines changed: 29 additions & 62 deletions

gulpfile.mjs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -477,17 +477,20 @@ const compileModule = async (
477477
'prettier/plugins/typescript',
478478
'react',
479479
'react-dom',
480+
'react/jsx-runtime',
480481
'url',
481482
'yjs',
482483
'tinybase/store',
483484
'tinybase/tools',
484485
'../ui-react',
485486
],
487+
jsx: 'react-jsx',
486488
input: inputFile,
487489
plugins: [
488490
esbuild({
489491
target,
490492
legalComments: 'inline',
493+
jsx: 'automatic',
491494
}),
492495
replace({
493496
'/*!': '\n/*',
@@ -504,18 +507,16 @@ const compileModule = async (
504507
shebang(),
505508
image(),
506509
min
507-
? [
508-
terser({
509-
toplevel: true,
510-
compress: {
511-
unsafe: true,
512-
passes: 3,
513-
...(module == 'tools'
514-
? {reduce_vars: false, reduce_funcs: false}
515-
: {}),
516-
},
517-
}),
518-
]
510+
? terser({
511+
toplevel: true,
512+
compress: {
513+
unsafe: true,
514+
passes: 3,
515+
...(module == 'tools'
516+
? {reduce_vars: false, reduce_funcs: false}
517+
: {}),
518+
},
519+
})
519520
: prettierPlugin(await getPrettierConfig()),
520521
],
521522
onwarn: (warning, warn) => {

src/common/react.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import {isUndefined} from './other.ts';
88

99
export const {
1010
PureComponent,
11-
Fragment,
1211
createContext,
13-
createElement,
1412
useCallback,
1513
useContext,
1614
useEffect,

src/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"removeComments": true,
88
"target": "ESNext",
99
"module": "NodeNext",
10-
"jsx": "react",
10+
"jsx": "react-jsx",
1111
"moduleResolution": "NodeNext",
1212
"allowSyntheticDefaultImports": true,
1313
"types": ["node", "@cloudflare/workers-types"],

src/ui-react-dom/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/** @jsx createElement */
2-
/** @jsxFrag Fragment */
3-
41
import {
52
BOOLEAN,
63
CELL,
@@ -72,19 +69,18 @@ import type {
7269
ValuesInHtmlTable as ValuesInHtmlTableDecl,
7370
ValuesInHtmlTableProps,
7471
} from '../@types/ui-react-dom/index.d.ts';
72+
import type {Id, Ids} from '../@types/common/index.d.ts';
7573
import {
76-
Fragment,
77-
createElement,
7874
getIndexStoreTableId,
7975
getProps,
8076
getRelationshipsStoreTableIds,
8177
useCallback,
8278
useMemo,
8379
useState,
8480
} from '../common/react.ts';
85-
import type {Id, Ids} from '../@types/common/index.d.ts';
8681
import {isArray, isString, isUndefined, mathMin} from '../common/other.ts';
8782
import {objMap, objNew, objToArray} from '../common/obj.ts';
83+
import React from 'react';
8884
import type {Relationships} from '../@types/relationships/index.d.ts';
8985
import {arrayMap} from '../common/array.ts';
9086

src/ui-react-inspector/Body.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
/** @jsx createElement */
2-
31
import {arrayIsEmpty, arrayMap} from '../common/array.ts';
2+
import {isUndefined, mathFloor} from '../common/other.ts';
43
import {
5-
createElement,
64
useCallback,
75
useLayoutEffect,
86
useRef,
97
useState,
108
} from '../common/react.ts';
11-
import {isUndefined, mathFloor} from '../common/other.ts';
129
import {
1310
useIndexes,
1411
useIndexesIds,
@@ -26,6 +23,7 @@ import {CURRENT_TARGET} from '../common/strings.ts';
2623
import {IndexesView} from './IndexesView.tsx';
2724
import {MetricsView} from './MetricsView.tsx';
2825
import {QueriesView} from './QueriesView.tsx';
26+
import React from 'react';
2927
import {RelationshipsView} from './RelationshipsView.tsx';
3028
import type {StoreProp} from './types.ts';
3129
import {StoreView} from './StoreView.tsx';

src/ui-react-inspector/Details.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/** @jsx createElement */
2-
31
import {OPEN_CELL, STATE_TABLE} from './common.ts';
42
import type {ReactNode, SyntheticEvent} from 'react';
53
import {useCell, useSetCellCallback} from '../ui-react/index.ts';
64
import {CURRENT_TARGET} from '../common/strings.ts';
75
import type {Id} from '../@types/common/index.d.ts';
6+
import React from 'react';
87
import type {StoreProp} from './types.ts';
9-
import {createElement} from '../common/react.ts';
108

119
export const Details = ({
1210
uniqueId,

src/ui-react-inspector/ErrorBoundary.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/** @jsx createElement */
2-
31
import type {ErrorInfo, ReactNode} from 'react';
4-
import {PureComponent, createElement} from '../common/react.ts';
2+
import {PureComponent} from '../common/react.ts';
3+
import React from 'react';
54

65
interface Props {
76
readonly children: ReactNode;

src/ui-react-inspector/Header.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/** @jsx createElement */
2-
31
import {OPEN_VALUE, POSITIONS, POSITION_VALUE, TITLE} from './common.ts';
42
import {useSetValueCallback, useValue} from '../ui-react/index.ts';
53
import {CURRENT_TARGET} from '../common/strings.ts';
64
import type {MouseEvent} from 'react';
5+
import React from 'react';
76
import type {StoreProp} from './types.ts';
87
import {arrayMap} from '../common/array.ts';
9-
import {createElement} from '../common/react.ts';
108

119
export const Header = ({s}: StoreProp) => {
1210
const position = useValue(POSITION_VALUE, s) ?? 1;

src/ui-react-inspector/IndexesView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
/** @jsx createElement */
2-
31
import type {IndexProps, SliceProps} from '../@types/ui-react/index.d.ts';
42
import {arrayIsEmpty, arrayMap} from '../common/array.ts';
53
import {getUniqueId, sortedIdsMap, useEditable} from './common.ts';
64
import {useIndexIds, useIndexes, useSliceIds} from '../ui-react/index.ts';
75
import {DEFAULT} from '../common/strings.ts';
86
import {Details} from './Details.tsx';
97
import type {Id} from '../@types/common/index.d.ts';
8+
import React from 'react';
109
import {SliceInHtmlTable} from '../ui-react-dom/index.tsx';
1110
import type {StoreProp} from './types.ts';
12-
import {createElement} from '../common/react.ts';
1311
import {isUndefined} from '../common/other.ts';
1412

1513
const IndexView = ({

src/ui-react-inspector/MetricsView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
/** @jsx createElement */
2-
31
import {arrayIsEmpty, arrayMap} from '../common/array.ts';
42
import {useMetric, useMetricIds, useMetrics} from '../ui-react/index.ts';
53
import {DEFAULT} from '../common/strings.ts';
64
import {Details} from './Details.tsx';
75
import type {Id} from '../@types/common/index.d.ts';
86
import type {MetricProps} from '../@types/ui-react/index.d.ts';
97
import type {Metrics} from '../@types/metrics/index.d.ts';
8+
import React from 'react';
109
import type {StoreProp} from './types.ts';
11-
import {createElement} from '../common/react.ts';
1210
import {getUniqueId} from './common.ts';
1311
import {isUndefined} from '../common/other.ts';
1412

0 commit comments

Comments
 (0)