Skip to content

Commit 04a40a5

Browse files
committed
Update @types/hast, utilities
1 parent 42748d4 commit 04a40a5

File tree

4 files changed

+48
-27
lines changed

4 files changed

+48
-27
lines changed

Diff for: lib/core.js

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export function core(schema, defaultTagName, caseSensitive) {
9393

9494
for (key in properties) {
9595
if (own.call(properties, key)) {
96-
// @ts-expect-error `node.properties` is set.
9796
addProperty(schema, node.properties, key, properties[key])
9897
}
9998
}

Diff for: package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,27 @@
5757
"index.js"
5858
],
5959
"dependencies": {
60-
"@types/hast": "^2.0.0",
60+
"@types/hast": "^3.0.0",
6161
"comma-separated-tokens": "^2.0.0",
62-
"hast-util-parse-selector": "^3.0.0",
62+
"hast-util-parse-selector": "^4.0.0",
6363
"property-information": "^6.0.0",
6464
"space-separated-tokens": "^2.0.0"
6565
},
6666
"devDependencies": {
6767
"@types/node": "^20.0.0",
6868
"acorn-jsx": "^5.0.0",
6969
"c8": "^8.0.0",
70-
"esast-util-from-js": "^1.0.0",
71-
"estree-util-build-jsx": "^2.0.0",
72-
"estree-util-to-js": "^1.0.0",
70+
"esast-util-from-js": "^2.0.0",
71+
"estree-util-build-jsx": "^3.0.0",
72+
"estree-util-to-js": "^2.0.0",
7373
"prettier": "^3.0.0",
7474
"remark-cli": "^11.0.0",
7575
"remark-preset-wooorm": "^9.0.0",
7676
"svg-tag-names": "^3.0.0",
7777
"tsd": "^0.28.0",
7878
"type-coverage": "^2.0.0",
7979
"typescript": "^5.0.0",
80-
"unist-builder": "^3.0.0",
80+
"unist-builder": "^4.0.0",
8181
"xo": "^0.55.0"
8282
},
8383
"scripts": {

Diff for: script/generate-jsx.js

+41-20
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,50 @@ const doc = String(
88
await fs.readFile(new URL('../test/jsx.jsx', import.meta.url))
99
)
1010

11-
await fs.writeFile(
12-
new URL('../test/jsx-build-jsx-classic.js', import.meta.url),
13-
toJs(
14-
buildJsx(
15-
fromJs(doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"), {
16-
plugins: [acornJsx()],
17-
module: true
18-
}),
19-
{pragma: 'h', pragmaFrag: 'null'}
20-
)
21-
).value
11+
const treeAutomatic = fromJs(
12+
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
13+
{plugins: [acornJsx()], module: true}
14+
)
15+
16+
const treeAutomaticDevelopment = fromJs(
17+
doc.replace(
18+
/'name'/,
19+
"'jsx (estree-util-build-jsx, automatic, development)'"
20+
),
21+
{plugins: [acornJsx()], module: true}
2222
)
2323

24+
const treeClassic = fromJs(
25+
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, classic)'"),
26+
{
27+
plugins: [acornJsx()],
28+
module: true
29+
}
30+
)
31+
32+
buildJsx(treeAutomatic, {
33+
runtime: 'automatic',
34+
importSource: 'hastscript'
35+
})
36+
buildJsx(treeAutomaticDevelopment, {
37+
runtime: 'automatic',
38+
importSource: 'hastscript',
39+
development: true
40+
})
41+
buildJsx(treeClassic, {pragma: 'h', pragmaFrag: 'null'})
42+
2443
await fs.writeFile(
2544
new URL('../test/jsx-build-jsx-automatic.js', import.meta.url),
45+
toJs(treeAutomatic).value
46+
)
47+
48+
await fs.writeFile(
49+
new URL('../test/jsx-build-jsx-automatic-development.js', import.meta.url),
50+
// There’s a problem with `this` that TS doesn’t like.
51+
'// @ts-nocheck\n\n' + toJs(treeAutomaticDevelopment).value
52+
)
2653

27-
toJs(
28-
buildJsx(
29-
fromJs(
30-
doc.replace(/'name'/, "'jsx (estree-util-build-jsx, automatic)'"),
31-
{plugins: [acornJsx()], module: true}
32-
),
33-
{runtime: 'automatic', importSource: 'hastscript'}
34-
)
35-
).value
54+
await fs.writeFile(
55+
new URL('../test/jsx-build-jsx-classic.js', import.meta.url),
56+
toJs(treeClassic).value
3657
)

Diff for: test/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
import './core.js'
33
import './jsx-build-jsx-classic.js'
44
import './jsx-build-jsx-automatic.js'
5+
import './jsx-build-jsx-automatic-development.js'
56
/* eslint-enable import/no-unassigned-import */

0 commit comments

Comments
 (0)