Skip to content

Commit df7349d

Browse files
committed
chore: reduce dependency count
1 parent 5a53779 commit df7349d

File tree

7 files changed

+1592
-1226
lines changed

7 files changed

+1592
-1226
lines changed

npm-shrinkwrap.json

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

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,44 @@
2424
"doc-kit": "./bin/cli.mjs"
2525
},
2626
"devDependencies": {
27-
"@eslint/js": "^9.39.1",
27+
"@eslint/js": "^9.39.2",
2828
"@reporters/github": "^1.11.0",
2929
"@types/mdast": "^4.0.4",
3030
"@types/node": "^24.10.1",
3131
"c8": "^10.1.3",
32-
"eslint": "^9.39.1",
32+
"eslint": "^9.39.2",
3333
"eslint-import-resolver-node": "^0.3.9",
3434
"eslint-plugin-import-x": "^4.16.1",
35-
"eslint-plugin-jsdoc": "^61.4.1",
35+
"eslint-plugin-jsdoc": "^61.5.0",
36+
"eslint-plugin-react-x": "^2.3.13",
3637
"husky": "^9.1.7",
3738
"lint-staged": "^16.2.7",
3839
"prettier": "3.7.4"
3940
},
4041
"dependencies": {
41-
"@actions/core": "^1.11.1",
42+
"@actions/core": "^2.0.1",
4243
"@clack/prompts": "^0.11.0",
4344
"@heroicons/react": "^2.2.0",
4445
"@minify-html/node": "^0.16.4",
4546
"@node-core/rehype-shiki": "1.3.0",
4647
"@node-core/ui-components": "1.4.1",
47-
"@orama/orama": "^3.1.16",
48+
"@orama/orama": "^3.1.17",
4849
"@orama/ui": "^1.5.3",
4950
"@rollup/plugin-virtual": "^3.0.2",
5051
"acorn": "^8.15.0",
5152
"commander": "^14.0.2",
52-
"dedent": "^1.7.0",
53-
"eslint-plugin-react-x": "^2.3.12",
53+
"dedent": "^1.7.1",
5454
"estree-util-to-js": "^2.0.0",
5555
"estree-util-visit": "^2.0.0",
5656
"github-slugger": "^2.0.0",
57-
"glob": "^13.0.0",
5857
"globals": "^16.5.0",
5958
"hast-util-to-string": "^3.0.1",
6059
"hastscript": "^9.0.1",
6160
"lightningcss": "^1.30.2",
6261
"mdast-util-slice-markdown": "^2.0.1",
6362
"piscina": "^5.1.4",
6463
"preact": "^11.0.0-beta.0",
65-
"preact-render-to-string": "^6.6.3",
64+
"preact-render-to-string": "^6.6.4",
6665
"reading-time": "^1.5.0",
6766
"recma-jsx": "^1.0.1",
6867
"rehype-raw": "^7.0.0",
@@ -72,10 +71,10 @@
7271
"remark-parse": "^11.0.0",
7372
"remark-rehype": "^11.1.2",
7473
"remark-stringify": "^11.0.0",
75-
"rolldown": "^1.0.0-beta.53",
74+
"rolldown": "^1.0.0-beta.55",
7675
"semver": "^7.7.3",
77-
"shiki": "^3.19.0",
78-
"to-vfile": "^8.0.0",
76+
"shiki": "^3.20.0",
77+
"tinyglobby": "^0.2.15",
7978
"unified": "^11.0.5",
8079
"unist-builder": "^4.0.0",
8180
"unist-util-find-after": "^5.0.0",

src/generators/ast-js/index.mjs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import { readFile } from 'node:fs/promises';
12
import { extname } from 'node:path';
23

3-
import { globSync } from 'glob';
4-
import { read } from 'to-vfile';
5-
6-
import { parseJsSource } from '../../parsers/javascript.mjs';
4+
import { parse } from 'acorn';
5+
import { globSync } from 'tinyglobby';
76

87
/**
98
* This generator parses Javascript sources passed into the generator's input
@@ -39,11 +38,17 @@ export default {
3938
const results = [];
4039

4140
for (const path of filePaths) {
42-
const vfile = await read(path, 'utf-8');
41+
const value = await readFile(path, 'utf-8');
42+
43+
const parsed = parse(value, {
44+
allowReturnOutsideFunction: true,
45+
ecmaVersion: 'latest',
46+
locations: true,
47+
});
4348

44-
const parsedJS = await parseJsSource(vfile);
49+
parsed.path = path;
4550

46-
results.push(parsedJS);
51+
results.push(parsed);
4752
}
4853

4954
return results;

src/generators/ast/index.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use strict';
22

3+
import { readFile } from 'node:fs/promises';
34
import { extname } from 'node:path';
45

5-
import { globSync } from 'glob';
6-
import { read } from 'to-vfile';
6+
import { globSync } from 'tinyglobby';
7+
import { VFile } from 'vfile';
78

89
import createQueries from '../../utils/queries/index.mjs';
910
import { getRemark } from '../../utils/remark.mjs';
@@ -41,7 +42,7 @@ export default {
4142
const results = [];
4243

4344
for (const path of filePaths) {
44-
const vfile = await read(path, 'utf-8');
45+
const vfile = new VFile({ path, value: await readFile(path, 'utf-8') });
4546

4647
updateStabilityPrefixToLink(vfile);
4748

src/generators/jsx-ast/utils/transformer.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const transformer = tree => {
2929
const thead = node.children.find(el => el.tagName === 'thead');
3030

3131
if (thead) {
32+
// TODO(@avivkeller): These are only strings afaict, so a `toString` dependency
33+
// might not actually be needed.
3234
const headers = thead.children[0].children.map(toString);
3335
const tbody = node.children.find(el => el.tagName === 'tbody');
3436

src/parsers/javascript.mjs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/utils/highlighter.mjs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
import createHighlighter from '@node-core/rehype-shiki';
4-
import { toString } from 'hast-util-to-string';
54
import { h as createElement } from 'hastscript';
65
import { SKIP, visit } from 'unist-util-visit';
76

@@ -84,18 +83,18 @@ export default function rehypeShikiji() {
8483
return;
8584
}
8685

87-
// Retrieve the whole <pre> contents as a parsed DOM string
88-
const preElementContents = toString(preElement);
89-
9086
// Grabs the relevant alias/name of the language
9187
const languageId = codeLanguage.slice(languagePrefix.length);
9288

9389
// Parses the <pre> contents and returns a HAST tree with the highlighted code
94-
const { children } = highlighter.shiki.codeToHast(preElementContents, {
95-
lang: languageId,
96-
// Allows support for dual themes (light, dark) for Shiki
97-
themes: { light: shikiConfig.themes[0], dark: shikiConfig.themes[1] },
98-
});
90+
const { children } = highlighter.shiki.codeToHast(
91+
preElement.children[0].value,
92+
{
93+
lang: languageId,
94+
// Allows support for dual themes (light, dark) for Shiki
95+
themes: { light: shikiConfig.themes[0], dark: shikiConfig.themes[1] },
96+
}
97+
);
9998

10099
// Adds the original language back to the <pre> element
101100
children[0].properties.class = `${children[0].properties.class} ${codeLanguage}`;

0 commit comments

Comments
 (0)