Skip to content

Commit 4e80d61

Browse files
committed
fix: use babel-parse-wild-code, try to fix bundling issue
1 parent 442f25c commit 4e80d61

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

package-lock.json

Lines changed: 14 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,6 @@
515515
"nyc": "^15.1.0",
516516
"prettier": "^2.2.1",
517517
"prettier-eslint": "^12.0.0",
518-
"react": "^17.0.2",
519-
"react-dom": "^17.0.2",
520518
"rimraf": "^3.0.2",
521519
"semantic-release": "^17.3.7",
522520
"semantic-release-vsce": "^2.2.8",
@@ -543,9 +541,10 @@
543541
},
544542
"dependencies": {
545543
"@babel/runtime": "^7.8.4",
546-
"flow-parser": "^0.117.1",
544+
"babel-parse-wild-code": "^1.1.1",
547545
"jscodeshift": "^0.7.0",
548-
"jscodeshift-choose-parser": "^1.0.0",
546+
"react": "^17.0.2",
547+
"react-dom": "^17.0.2",
549548
"read-pkg-up": "^7.0.0",
550549
"require-glob": "^3.2.0",
551550
"shallowequal": "^1.1.0"

src/getExistingImports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from 'vscode'
22
import jscodeshift, { ImportDeclaration, ASTPath } from 'jscodeshift'
3-
import chooseJSCodeshiftParser from 'jscodeshift-choose-parser'
3+
import { getParserSync } from 'babel-parse-wild-code'
44

55
export default function getExistingImports(document: vscode.TextDocument): {
66
existingComponents: Set<string>
@@ -11,7 +11,7 @@ export default function getExistingImports(document: vscode.TextDocument): {
1111
muiVersion: 4 | 5 | null
1212
} {
1313
const text = document.getText()
14-
const parser = chooseJSCodeshiftParser(document.uri.fsPath)
14+
const parser = getParserSync(document.uri.fsPath, { tokens: true })
1515
const j = parser ? jscodeshift.withParser(parser) : jscodeshift
1616

1717
const components: Set<string> = new Set()

0 commit comments

Comments
 (0)