Skip to content

Commit bd59a67

Browse files
authored
Support for React 19 (#2559)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> - Fixes #2558 ## Summary <!-- Please brief explanation of the changes made --> - bezier-react를 React 19 버전으로 업데이트하고, 피어 디펜던시를 업데이트합니다. React 19 버전에서는 17 버전부터 도입된 새로운 JSX tranform을 사용하므로, 이를 지원하지 않는 16.8 버전에 대한 지원은 제거했습니다. 따라서 메이저 버전을 올립니다. - bezier-icons도 마찬가지로 React 19 버전으로 업데이트하고, 옵셔널 피어디펜던시로 React 17 버전 이상을 추가했습니다. bezier-icons는 svg만 사용할 수도 있으므로 옵셔널로 두었습니다. ## Details <!-- Please elaborate description of the changes --> 몇몇 개선사항들 - bezier-react에 새로운 JSX transform을 사용합니다. 사용처에서 번들 사이즈 감소와 성능 향상이 있을 거로 예상합니다. - bezier-icons에 browserlist를 추가하여 불필요한 polyfill이 생기지 않도록 합니다. 원래 `ai.mjs` 파일에 objectSpread2 폴리필이 추가되어있었는데, 제거되었습니다. 마찬가지로 사용처에서 번들 사이즈 감소와 성능 향상이 있을 거로 예상합니다. - babel의 corejs 속성 등 불필요한 속성을 제거했습니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> Yes. 더 이상 React 16.8 버전을 지원하지 않습니다. ## References <!-- Please list any other resources or points the reviewer should be aware of --> - https://react.dev/blog/2024/04/25/react-19-upgrade-guide#new-jsx-transform-is-now-required - https://babeljs.io/docs/babel-preset-react#react-automatic-runtime
1 parent 8105deb commit bd59a67

File tree

222 files changed

+314
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+314
-435
lines changed

.changeset/few-walls-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@channel.io/bezier-react': major
3+
---
4+
5+
Add support for React 19 and enable new JSX transform. Increase minimum supported React peer dependency version from 16.8 to 17.

.changeset/fifty-gorillas-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@channel.io/bezier-icons': minor
3+
---
4+
5+
Enable new JSX transform and update React peer dependency to be optional for version 17 and above

configs/tsconfig/browser.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://json.schemastore.org/tsconfig",
33
"extends": "@channel.io/typescript-config/web.json",
44
"compilerOptions": {
5+
"jsx": "react-jsx",
56
"allowJs": true
67
}
78
}

configs/tsconfig/node.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"compilerOptions": {
55
"module": "nodenext",
66
"moduleResolution": "nodenext",
7+
"jsx": "react-jsx",
78
"allowJs": true
89
}
910
}

packages/bezier-codemod/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
"@inkjs/ui": "^2.0.0",
3030
"ink": "^5.1.0",
3131
"meow": "^13.2.0",
32-
"react": "^18.3.1",
32+
"react": "^19.0.0",
3333
"ts-morph": "^24.0.0"
3434
},
3535
"devDependencies": {
3636
"@types/node": "^22.10.2",
37-
"@types/react": "^18.3.16",
37+
"@types/react": "^19.0.1",
3838
"eslint-config-bezier": "workspace:*",
3939
"tsconfig": "workspace:*"
4040
},

packages/bezier-codemod/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useState } from 'react'
1+
import { useCallback, useEffect, useState } from 'react'
22

33
import {
44
Select,

packages/bezier-codemod/src/cli.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env node
2-
import React from 'react'
32

43
import { render } from 'ink'
54
import meow from 'meow'

packages/bezier-codemod/src/transforms/icon-name-to-bezier-icons/fixtures/input1.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* External dependencies */
2-
import React from 'react'
32
import { Button } from '@channel.io/bezier-react'
43

54
/* Internal dependencies */

packages/bezier-codemod/src/transforms/icon-name-to-bezier-icons/fixtures/input2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* External dependencies */
2-
import React, { useMemo } from 'react'
2+
import { useMemo } from 'react'
33
import { Button } from '@channel.io/bezier-react'
44
import { ArrowRightIcon } from '@channel.io/bezier-icons'
55

packages/bezier-codemod/src/transforms/icon-name-to-bezier-icons/fixtures/output1.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* External dependencies */
2-
import React from 'react'
32
import { Button } from '@channel.io/bezier-react'
43
import { ArrowLeftIcon, AllIcon } from '@channel.io/bezier-icons'
54

packages/bezier-codemod/src/transforms/icon-name-to-bezier-icons/fixtures/output2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* External dependencies */
2-
import React, { useMemo } from 'react'
2+
import { useMemo } from 'react'
33
import { Button } from '@channel.io/bezier-react'
44
import { ArrowRightIcon, FlagFilledIcon, ArrowLeftIcon, AllIcon } from '@channel.io/bezier-icons'
55

packages/bezier-codemod/src/transforms/icons-to-bezier-icons/fixtures/input.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { AllIcon, Button, CheckIcon as CheckIconSource, Icon, type IconName, IconSize, LegacyIcon } from '@channel.io/bezier-react'
32

43
import { Foo } from './foo.js'

packages/bezier-codemod/src/transforms/icons-to-bezier-icons/fixtures/output.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { AllIcon, CheckIcon as CheckIconSource, type IconName } from '@channel.io/bezier-icons'
32
import { Button, Icon, IconSize, LegacyIcon } from '@channel.io/bezier-react'
43

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/input1.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, ProgressBarSize, ProgressBarVariant, AvatarSize, Avatar } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/input2.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, type ProgressBarSize, ProgressBarVariant } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/input3.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, ProgressBarSize, ProgressBarVariant } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/output1.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, Avatar } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/output2.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, type ProgressBarSize } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/src/transforms/v2-enum-member-to-string-literal/fixtures/output3.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import { ProgressBar, ProgressBarVariant } from '@channel.io/bezier-react'
32

43
export default function UploadProgress({

packages/bezier-codemod/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "tsconfig/node.json",
33
"compilerOptions": {
44
"outDir": "dist",
5-
"jsx": "react",
65
"declaration": true
76
},
87
"include": ["src"],

packages/bezier-figma-plugin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"license": "Apache-2.0",
2424
"devDependencies": {
2525
"@figma/plugin-typings": "^1.104.0",
26-
"@types/react": "^18.3.16",
27-
"@types/react-dom": "^18.3.5",
26+
"@types/react": "^19.0.1",
27+
"@types/react-dom": "^19.0.2",
2828
"css-loader": "^7.1.2",
2929
"eslint-config-bezier": "workspace:*",
3030
"html-webpack-inline-source-plugin": "^0.0.10",
@@ -41,8 +41,8 @@
4141
"@channel.io/bezier-icons": "0.38.0",
4242
"@channel.io/bezier-react": "2.6.2",
4343
"octokit": "^4.0.2",
44-
"react": "^18.3.1",
45-
"react-dom": "^18.3.1",
44+
"react": "^19.0.0",
45+
"react-dom": "^19.0.0",
4646
"react-router-dom": "^7.0.2"
4747
}
4848
}

packages/bezier-figma-plugin/src/ui/components/ExtractSuccess.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from 'react'
1+
import { useCallback } from 'react'
22

33
import { Button, Text, VStack } from '@channel.io/bezier-react'
44
import { useLocation, useNavigate } from 'react-router-dom'

packages/bezier-figma-plugin/src/ui/components/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from 'react'
1+
import { useCallback } from 'react'
22

33
import { HexahedronIcon } from '@channel.io/bezier-icons'
44
import { ListItem, VStack } from '@channel.io/bezier-react'

packages/bezier-figma-plugin/src/ui/components/IconExtract.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useState } from 'react'
1+
import { useCallback, useEffect, useState } from 'react'
22

33
import {
44
Button,

packages/bezier-figma-plugin/src/ui/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react'
2-
31
import { AppProvider } from '@channel.io/bezier-react'
42
import { createRoot } from 'react-dom/client'
53
import { MemoryRouter, Route, Routes } from 'react-router-dom'

packages/bezier-icons/.browserslistrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
>= 1% in KR
2+
>= 1% in JP
3+
>= 1% in US
4+
not dead

packages/bezier-icons/babel.config.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
module.exports = {
22
presets: [
3-
'@babel/preset-env',
4-
/**
5-
* Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.
6-
* Remove the helper function for Object.assign.
7-
* @see https://babeljs.io/docs/babel-preset-react#usebuiltins
8-
*/
9-
['@babel/preset-react', { useBuiltIns: true }],
3+
['@babel/preset-env', { bugfixes: true }],
4+
['@babel/preset-react', { runtime: 'automatic' }],
105
['@babel/preset-typescript', { isTSX: true, allExtensions: true }],
116
],
127
}

packages/bezier-icons/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,13 @@
6060
"rollup-plugin-visualizer": "^5.12.0",
6161
"svgo": "^3.3.2",
6262
"tsconfig": "workspace:*"
63+
},
64+
"peerDependencies": {
65+
"react": ">=17"
66+
},
67+
"peerDependenciesMeta": {
68+
"react": {
69+
"optional": true
70+
}
6371
}
6472
}

packages/bezier-icons/rollup.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function svgBuild(options = {}) {
197197
*/
198198
plugins: ['@svgr/plugin-jsx'],
199199
icon: true,
200-
jsxRuntime: 'classic',
200+
jsxRuntime: 'automatic',
201201
ref: true,
202202
template: reactIconTemplate,
203203
},
@@ -281,7 +281,7 @@ export default defineConfig({
281281
manualChunks,
282282
},
283283
],
284-
external: ['react'],
284+
external: ['react', 'react/jsx-runtime'],
285285
plugins: [
286286
virtual({ 'src/index.ts': entryModuleContent }),
287287
nodeResolve({ extensions }),

packages/bezier-icons/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extends": "tsconfig/node.json",
3-
"compilerOptions": {
4-
"jsx": "react-jsx"
5-
},
63
"include": ["utils", "script"]
74
}

packages/bezier-react/.storybook/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export default {
4545
* @see {@link https://github.com/webpack-contrib/sass-loader/releases/tag/v16.0.0}
4646
*/
4747
api: 'legacy',
48+
sassOptions: {
49+
silenceDeprecations: ['legacy-js-api'],
50+
},
4851
implementation: require.resolve('sass'),
4952
},
5053
},
@@ -91,7 +94,12 @@ export default {
9194
test: /\.(ts|tsx)$/,
9295
loader: require.resolve('babel-loader'),
9396
options: {
94-
presets: [['react-app', { flow: false, typescript: true }]],
97+
presets: [
98+
[
99+
'react-app',
100+
{ flow: false, typescript: true, runtime: 'automatic' },
101+
],
102+
],
95103
},
96104
},
97105
],

packages/bezier-react/.storybook/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { forwardRef } from 'react'
1+
import { forwardRef } from 'react'
22

33
import type { Preview } from '@storybook/react'
44

@@ -55,7 +55,7 @@ const preview: Preview = {
5555
),
5656
],
5757

58-
tags: ['autodocs']
58+
tags: ['autodocs'],
5959
}
6060

6161
export default preview

packages/bezier-react/babel.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
module.exports = {
22
presets: [
33
['@babel/preset-env', { bugfixes: true }],
4-
/**
5-
* Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.
6-
* Remove the helper function for Object.assign.
7-
* @see https://babeljs.io/docs/babel-preset-react#usebuiltins
8-
*/
9-
['@babel/preset-react', { useBuiltIns: true }],
4+
['@babel/preset-react', { runtime: 'automatic' }],
105
['@babel/preset-typescript', { isTSX: true, allExtensions: true }],
116
],
127
}

packages/bezier-react/jest.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ module.exports = {
66
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
77
transformIgnorePatterns: [],
88
transform: {
9-
'^.+\\.[t|j]sx?$': ['@swc/jest'],
9+
'^.+\\.[t|j]sx?$': [
10+
'@swc/jest',
11+
{
12+
jsc: {
13+
transform: {
14+
react: {
15+
runtime: 'automatic',
16+
},
17+
},
18+
},
19+
},
20+
],
1021
},
1122
testMatch: ['**/*.test.(ts|tsx)'],
1223
moduleNameMapper: {

packages/bezier-react/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
"@testing-library/react": "^16.1.0",
9191
"@testing-library/user-event": "^14.5.2",
9292
"@types/jest": "^29.5.14",
93-
"@types/react": "^18.3.16",
94-
"@types/react-dom": "^18.3.5",
93+
"@types/react": "^19.0.1",
94+
"@types/react-dom": "^19.0.2",
9595
"@types/uuid": "^10.0.0",
9696
"babel-loader": "^9.2.1",
9797
"babel-preset-react-app": "^10.0.1",
@@ -106,8 +106,8 @@
106106
"paths.macro": "^3.0.1",
107107
"postcss": "^8.4.49",
108108
"postcss-preset-env": "^10.1.1",
109-
"react": "^18.3.1",
110-
"react-dom": "^18.3.1",
109+
"react": "^19.0.0",
110+
"react-dom": "^19.0.0",
111111
"rollup": "^4.28.1",
112112
"rollup-plugin-node-externals": "^7.1.3",
113113
"rollup-plugin-postcss": "^4.0.2",
@@ -123,8 +123,8 @@
123123
},
124124
"peerDependencies": {
125125
"@channel.io/bezier-icons": ">=0.2.0",
126-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
127-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
126+
"react": ">=17",
127+
"react-dom": ">=17"
128128
},
129129
"peerDependenciesMeta": {
130130
"@channel.io/bezier-icons": {

packages/bezier-react/src/components/AlphaAvatar/AlphaAvatar.stories.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react'
2-
31
import { type Meta, type StoryFn, type StoryObj } from '@storybook/react'
42

53
import { Avatar } from './Avatar'

packages/bezier-react/src/components/AlphaAvatar/Avatar.figma.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react'
2-
31
import figma from '@figma/code-connect'
42

53
import { type StatusType } from '~/src/components/Status'

packages/bezier-react/src/components/AlphaAvatar/Avatar.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react'
2-
31
import { render } from '~/src/utils/test'
42

53
import {

packages/bezier-react/src/components/AlphaAvatar/Avatar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import React, { forwardRef, useMemo } from 'react'
3+
import { forwardRef, isValidElement, useMemo } from 'react'
44

55
import classNames from 'classnames'
66

@@ -95,7 +95,7 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
9595
const StatusComponent = useMemo(() => {
9696
if (
9797
(isEmpty(children) && !status) ||
98-
(children && !React.isValidElement(children))
98+
(children && !isValidElement(children))
9999
) {
100100
return null
101101
}

packages/bezier-react/src/components/AlphaAvatarGroup/AlphaAvatarGroup.stories.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react'
2-
31
import { type Meta, type StoryFn, type StoryObj } from '@storybook/react'
42

53
import { AlphaAvatar } from '~/src/components/AlphaAvatar'

0 commit comments

Comments
 (0)