Skip to content

Commit c1bfa6e

Browse files
committed
Replace dev-dependency
1 parent 2a15577 commit c1bfa6e

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@
5050
"@babel/plugin-transform-react-jsx": "^7.0.0",
5151
"@types/babel__core": "^7.0.0",
5252
"@types/tape": "^4.0.0",
53-
"astring": "^1.0.0",
54-
"buble": "^0.20.0",
5553
"c8": "^7.0.0",
5654
"estree-util-build-jsx": "^2.0.0",
55+
"estree-util-to-js": "^1.0.0",
5756
"prettier": "^2.0.0",
5857
"remark-cli": "^11.0.0",
5958
"remark-preset-wooorm": "^9.0.0",

script/generate-jsx.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,45 @@ import path from 'node:path'
33
import babel from '@babel/core'
44
import {Parser} from 'acorn'
55
import acornJsx from 'acorn-jsx'
6-
import {generate} from 'astring'
6+
import {toJs} from 'estree-util-to-js'
77
import {buildJsx} from 'estree-util-build-jsx'
88

99
const doc = String(fs.readFileSync(path.join('test', 'jsx.jsx')))
1010

1111
fs.writeFileSync(
1212
path.join('test', 'jsx-build-jsx-classic.js'),
13-
generate(
13+
toJs(
14+
// @ts-expect-error it’s a program.
1415
buildJsx(
1516
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
1617
Parser.extend(acornJsx()).parse(
1718
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"),
18-
// @ts-expect-error Hush, `2021` is fine.
19+
// Note: different npms resolve this differently, so it may break or work, hence the ignore.
20+
// @ts-ignore Hush, `2021` is fine.
1921
{sourceType: 'module', ecmaVersion: 2021}
2022
),
2123
{pragma: 'x', pragmaFrag: 'null'}
2224
)
23-
)
25+
// @ts-expect-error Some bug in `to-js`
26+
).value
2427
)
2528

2629
fs.writeFileSync(
2730
path.join('test', 'jsx-build-jsx-automatic.js'),
28-
generate(
31+
toJs(
32+
// @ts-expect-error it’s a program.
2933
buildJsx(
3034
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
3135
Parser.extend(acornJsx()).parse(
3236
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
33-
// @ts-expect-error Hush, `2021` is fine.
37+
// Note: different npms resolve this differently, so it may break or work, hence the ignore.
38+
// @ts-ignore Hush, `2021` is fine.
3439
{sourceType: 'module', ecmaVersion: 2021}
3540
),
3641
{runtime: 'automatic', importSource: '.'}
3742
)
38-
).replace(/\/jsx-runtime(?=["'])/g, './lib/runtime.js')
43+
// @ts-expect-error Some bug in `to-js`
44+
).value.replace(/\/jsx-runtime(?=["'])/g, './lib/runtime.js')
3945
)
4046

4147
fs.writeFileSync(

0 commit comments

Comments
 (0)