Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2fe97e5

Browse files
authored
Merge pull request#32802 from mrginglymus/no-semver-react
React: Simplify version detection
2 parents950fdaa +ca35a93 commit2fe97e5

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

‎code/renderers/react/package.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"@types/escodegen":"^0.0.6",
6262
"@types/estree":"^1.0.6",
6363
"@types/node":"^22.0.0",
64-
"@types/semver":"^7.3.4",
6564
"acorn":"^7.4.1",
6665
"acorn-jsx":"^5.3.1",
6766
"acorn-walk":"^7.2.0",
@@ -73,7 +72,6 @@
7372
"prop-types":"^15.7.2",
7473
"react-element-to-jsx-string":"npm:@7rulnik/react-element-to-jsx-string@15.0.1",
7574
"require-from-string":"^2.0.2",
76-
"semver":"^7.3.7",
7775
"ts-dedent":"^2.0.0",
7876
"type-fest":"~2.19"
7977
},

‎code/renderers/react/src/entry-preview.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react';
22

33
import{global}from'@storybook/global';
44

5-
importsemverfrom'semver';
65
import{configure}from'storybook/test';
76

87
import{getAct,getReactActEnvironment,setReactActEnvironment}from'./act-compat';
@@ -19,8 +18,11 @@ export const decorators: Decorator[] = [
1918
returnstory();
2019
}
2120

22-
constmajor=semver.major(React.version);
23-
constminor=semver.minor(React.version);
21+
const[major,minor]=React.version.split('.').map((part)=>parseInt(part,10));
22+
23+
if(!Number.isInteger(major)||!Number.isInteger(minor)){
24+
thrownewError('Unable to parse React version');
25+
}
2426
if(major<18||(major===18&&minor<3)){
2527
thrownewError('React Server Components require React >= 18.3');
2628
}

‎code/yarn.lock‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6819,7 +6819,6 @@ __metadata:
68196819
"@types/escodegen": "npm:^0.0.6"
68206820
"@types/estree": "npm:^1.0.6"
68216821
"@types/node": "npm:^22.0.0"
6822-
"@types/semver": "npm:^7.3.4"
68236822
acorn: "npm:^7.4.1"
68246823
acorn-jsx: "npm:^5.3.1"
68256824
acorn-walk: "npm:^7.2.0"
@@ -6831,7 +6830,6 @@ __metadata:
68316830
prop-types: "npm:^15.7.2"
68326831
react-element-to-jsx-string: "npm:@7rulnik/react-element-to-jsx-string@15.0.1"
68336832
require-from-string: "npm:^2.0.2"
6834-
semver: "npm:^7.3.7"
68356833
ts-dedent: "npm:^2.0.0"
68366834
type-fest: "npm:~2.19"
68376835
peerDependencies:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp