Skip to content

Commit 393cac4

Browse files
Merge pull request #224 from hypermod-io/fix-ts-parsing
Remove flow + bump babel + fix presetId detection bug
2 parents 2a9253b + 4c8ce78 commit 393cac4

File tree

7 files changed

+1088
-1100
lines changed

7 files changed

+1088
-1100
lines changed

.changeset/loud-jeans-rest.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@hypermod/fetcher': minor
3+
'@hypermod/core': minor
4+
'@hypermod/cli': minor
5+
---
6+
7+
Removes unused Flow parser, bumps babel presets/plugins, fixes a minor bug where transforms could be detected in preset strings

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"release": "yarn changeset publish"
3838
},
3939
"dependencies": {
40-
"@babel/core": "^7.13.16",
41-
"@babel/parser": "^7.13.16",
42-
"@babel/preset-env": "^7.13.16",
43-
"@babel/preset-typescript": "^7.13.16",
40+
"@babel/core": "^7.23.0",
41+
"@babel/parser": "^7.23.0",
42+
"@babel/preset-env": "^7.23.0",
43+
"@babel/preset-typescript": "^7.23.0",
4444
"@changesets/cli": "^2.6.2",
4545
"@manypkg/cli": "^0.20.0",
4646
"@parcel/packager-ts": "^2.8.3",

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ program
3939
'-p, --parser <parser>',
4040
'Parser to use for parsing the source files',
4141
)
42-
.choices(['babel', 'babylon', 'flow', 'ts', 'tsx'])
42+
.choices(['babel', 'babylon', 'ts', 'tsx'])
4343
.default('tsx'),
4444
)
4545
.option(

packages/core/lib/Worker.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function prepareJscodeshift(options) {
4747
}
4848

4949
function retrieveTransformId(str) {
50+
if (str.includes('#')) return false;
5051
return (str.match(/[^@]*(?:[@](?!.*[@]))(.*)$/) || [, ''])[1];
5152
}
5253
function retrievePresetId(str) {
@@ -68,11 +69,7 @@ function setup(entryPath, babel) {
6869
presets.push([presetEnv.default, { targets: { node: true } }]);
6970
}
7071

71-
presets.push(
72-
/\.tsx?$/.test(entryPath)
73-
? require('@babel/preset-typescript').default
74-
: require('@babel/preset-flow').default,
75-
);
72+
presets.push(require('@babel/preset-typescript').default);
7673

7774
require('@babel/register')({
7875
configFile: false,

packages/core/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@
77
"license": "MIT",
88
"repository": "https://github.com/hypermod-io/hypermod-community/tree/main/packages/core",
99
"dependencies": {
10-
"@babel/core": "^7.13.16",
11-
"@babel/parser": "^7.13.16",
10+
"@babel/core": "^7.23.0",
11+
"@babel/parser": "^7.23.0",
1212
"@babel/plugin-proposal-class-properties": "^7.13.0",
1313
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
1414
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
1515
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
16-
"@babel/preset-flow": "^7.13.13",
17-
"@babel/preset-typescript": "^7.13.16",
18-
"@babel/register": "^7.13.16",
16+
"@babel/preset-typescript": "^7.23.0",
17+
"@babel/register": "^7.23.0",
1918
"@types/neo-async": "^2.6.0",
2019
"@types/write-file-atomic": "^4.0.0",
21-
"babel-core": "^7.0.0-bridge.0",
2220
"chalk": "^4.1.0",
2321
"graceful-fs": "^4.2.4",
2422
"jscodeshift": "^0.13.1",

packages/fetcher/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
"license": "MIT",
88
"repository": "https://github.com/hypermod-io/hypermod-community/tree/main/packages/fetcher",
99
"dependencies": {
10-
"@babel/core": "^7.13.16",
11-
"@babel/parser": "^7.13.16",
10+
"@babel/core": "^7.23.0",
11+
"@babel/parser": "^7.23.0",
1212
"@babel/plugin-proposal-class-properties": "^7.13.0",
1313
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
1414
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
1515
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
16-
"@babel/preset-flow": "^7.13.13",
17-
"@babel/preset-typescript": "^7.13.16",
18-
"@babel/register": "^7.13.16",
16+
"@babel/preset-typescript": "^7.23.0",
17+
"@babel/register": "^7.23.0",
1918
"@hypermod/types": "*",
20-
"babel-core": "^7.0.0-bridge.0",
2119
"chalk": "^4.1.0",
2220
"fs-extra": "^9.1.0",
2321
"globby": "^11.1.0",

0 commit comments

Comments
 (0)