File tree Expand file tree Collapse file tree 4 files changed +7
-48
lines changed
Expand file tree Collapse file tree 4 files changed +7
-48
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,7 @@ export default function initialize() {
2525 configurations &&
2626 configurations . package &&
2727 configurations . package . parsed &&
28- configurations . package . parsed . dependencies ,
29-
30- configurations &&
31- configurations . package &&
32- configurations . package . parsed &&
33- configurations . package . parsed . devDependencies
28+ configurations . package . parsed . dependencies
3429 ) &&
3530 ! v2Initialized
3631 ) {
Original file line number Diff line number Diff line change 11import isESModule from '../../utils/is-es-module' ;
22
3- const JSXSyntax = / ( . * ) < \w ( .| \n ) * ? \/ ? > / ;
3+ const JSXSyntax = / < \w ( .| \n ) * \/ ? > / ;
44
55export function shouldTranspile ( code : string , path : string ) {
6- if ( isESModule ( code ) ) {
7- return true ;
8- }
9-
10- const match = code . match ( JSXSyntax ) ;
11- if ( match ) {
12- const startOfLine = match [ 1 ] ;
13-
14- // If it's in a comment or string, we're extremely aggressive here because
15- // transpiling is absolutely our last resort.
16- if (
17- startOfLine . indexOf ( '//' ) > - 1 ||
18- startOfLine . indexOf ( '*' ) > - 1 ||
19- startOfLine . indexOf ( "'" ) > - 1 ||
20- startOfLine . indexOf ( '"' ) > - 1 ||
21- startOfLine . indexOf ( '`' ) > - 1
22- ) {
23- return false ;
24- }
25-
26- return true ;
27- }
28- return false ;
6+ return isESModule ( code ) || JSXSyntax . test ( code ) ;
297}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import semver from 'semver' ;
22
33function isCRAVersion2 ( dependencies , devDependencies ) {
4- const reactScriptsVersion =
5- dependencies [ 'react-scripts' ] || devDependencies [ 'react-scripts' ] ;
6- if ( reactScriptsVersion ) {
4+ const usedDeps = { ...dependencies , ...devDependencies } ;
5+ if ( usedDeps [ 'react-scripts' ] ) {
6+ const reactScriptsVersion = usedDeps [ 'react-scripts' ] ;
7+
78 return (
89 / ^ [ a - z ] / . test ( reactScriptsVersion ) ||
910 semver . intersects ( reactScriptsVersion , '^2.0.0' )
You can’t perform that action at this time.
0 commit comments