Skip to content

Commit d0c8e88

Browse files
committed
Remove superfluous dev-dependencies
1 parent 88315af commit d0c8e88

File tree

3 files changed

+20
-60
lines changed

3 files changed

+20
-60
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,9 @@
4848
"@types/xast": "^1.0.0"
4949
},
5050
"devDependencies": {
51-
"@babel/core": "^7.0.0",
52-
"@babel/plugin-syntax-jsx": "^7.0.0",
53-
"@babel/plugin-transform-react-jsx": "^7.0.0",
54-
"@types/babel__core": "^7.0.0",
5551
"@types/tape": "^4.0.0",
5652
"c8": "^7.0.0",
53+
"esast-util-from-js": "^1.0.0",
5754
"estree-util-build-jsx": "^2.0.0",
5855
"estree-util-to-js": "^1.0.0",
5956
"prettier": "^2.0.0",

script/generate-jsx.js

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,50 @@
1-
import fs from 'node:fs'
1+
import fs from 'node:fs/promises'
22
import path from 'node:path'
3-
import babel from '@babel/core'
4-
import {Parser} from 'acorn'
53
import acornJsx from 'acorn-jsx'
4+
import {fromJs} from 'esast-util-from-js'
65
import {toJs} from 'estree-util-to-js'
76
import {buildJsx} from 'estree-util-build-jsx'
87

9-
const doc = String(fs.readFileSync(path.join('test', 'jsx.jsx')))
8+
const doc = String(await fs.readFile(path.join('test', 'jsx.jsx')))
109

11-
fs.writeFileSync(
10+
await fs.writeFile(
1211
path.join('test', 'jsx-build-jsx-classic.js'),
1312
toJs(
14-
// @ts-expect-error it’s a program.
1513
buildJsx(
16-
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
17-
Parser.extend(acornJsx()).parse(
18-
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"),
19-
// Note: different npms resolve this differently, so it may break or work, hence the ignore.
20-
// @ts-ignore Hush, `2021` is fine.
21-
{sourceType: 'module', ecmaVersion: 2021}
22-
),
14+
fromJs(doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"), {
15+
plugins: [acornJsx()],
16+
module: true
17+
}),
2318
{pragma: 'x', pragmaFrag: 'null'}
2419
)
25-
// @ts-expect-error Some bug in `to-js`
2620
).value
2721
)
2822

29-
fs.writeFileSync(
23+
await fs.writeFile(
3024
path.join('test', 'jsx-build-jsx-automatic.js'),
3125
toJs(
32-
// @ts-expect-error it’s a program.
3326
buildJsx(
34-
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
35-
Parser.extend(acornJsx()).parse(
27+
fromJs(
3628
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
37-
// Note: different npms resolve this differently, so it may break or work, hence the ignore.
38-
// @ts-ignore Hush, `2021` is fine.
39-
{sourceType: 'module', ecmaVersion: 2021}
29+
{plugins: [acornJsx()], module: true}
4030
),
4131
{runtime: 'automatic', importSource: 'xastscript'}
4232
)
43-
// @ts-expect-error Some bug in `to-js`
4433
).value
4534
)
4635

47-
fs.writeFileSync(
36+
await fs.writeFile(
4837
path.join('test', 'jsx-build-jsx-automatic-development.js'),
4938
toJs(
50-
// @ts-expect-error it’s a program.
5139
buildJsx(
52-
// @ts-expect-error Acorn nodes are assignable to ESTree nodes.
53-
Parser.extend(acornJsx()).parse(
54-
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
55-
{sourceType: 'module', ecmaVersion: 2021}
40+
fromJs(
41+
doc.replace(
42+
/'name'/,
43+
"'jsx (estree-util-build-jsx, automatic, development)'"
44+
),
45+
{plugins: [acornJsx()], module: true}
5646
),
5747
{runtime: 'automatic', importSource: 'xastscript', development: true}
5848
)
59-
// @ts-expect-error Some bug in `to-js`
6049
).value
6150
)
62-
63-
fs.writeFileSync(
64-
path.join('test', 'jsx-babel-automatic.js'),
65-
// @ts-expect-error Result always given.
66-
babel.transformSync(doc.replace(/'name'/, "'jsx (babel, automatic)'"), {
67-
plugins: [
68-
[
69-
'@babel/plugin-transform-react-jsx',
70-
{runtime: 'automatic', importSource: 'xastscript'}
71-
]
72-
]
73-
}).code
74-
)
75-
76-
fs.writeFileSync(
77-
path.join('test', 'jsx-babel-automatic-development.js'),
78-
// @ts-expect-error Result always given.
79-
babel.transformSync(doc.replace(/'name'/, "'jsx (babel, automatic)'"), {
80-
plugins: [
81-
[
82-
'@babel/plugin-transform-react-jsx',
83-
{runtime: 'automatic', importSource: 'xastscript', development: true}
84-
]
85-
]
86-
}).code
87-
)

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable import/no-unassigned-import */
22
import './core.js'
3-
import './jsx-babel-automatic.js'
43
import './jsx-build-jsx-classic.js'
54
import './jsx-build-jsx-automatic.js'
5+
import './jsx-build-jsx-automatic-development.js'
66
/* eslint-enable import/no-unassigned-import */

0 commit comments

Comments
 (0)