@t8/docsgen 0.2.39 → 0.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/package.json +8 -8
- package/src/bin/cleanup.ts +1 -1
- package/src/bin/createFiles.ts +4 -4
- package/src/bin/getConfig.ts +7 -7
- package/src/bin/getCounterContent.ts +1 -1
- package/src/bin/getIcon.ts +1 -1
- package/src/bin/getInjectedContent.ts +3 -3
- package/src/bin/getLocation.ts +1 -1
- package/src/bin/getNav.ts +4 -4
- package/src/bin/getRepoLink.ts +1 -1
- package/src/bin/getTitle.ts +2 -2
- package/src/bin/parsing/buildNav.ts +3 -3
- package/src/bin/parsing/getParsedContent.ts +9 -9
- package/src/bin/run.ts +2 -2
- package/src/bin/runEntry.ts +3 -3
- package/src/bin/setCName.ts +1 -1
- package/src/bin/setContent.ts +13 -13
- package/src/bin/setImages.ts +2 -2
- package/src/bin/toConfig.ts +3 -3
- package/src/bin/toRepoURL.ts +1 -1
- package/src/scripts/patch.ts +29 -0
- package/src/types/Config.ts +1 -1
- package/src/types/ContentInjectionMap.ts +2 -2
- package/src/types/Context.ts +2 -2
- package/src/types/EntryConfig.ts +2 -2
- package/tsconfig.json +3 -1
package/dist/bin.js
CHANGED
|
@@ -455,7 +455,7 @@ function getTitle(ctx, { cover, originalContent, withPackageURL } = {}) {
|
|
|
455
455
|
|
|
456
456
|
// src/bin/parsing/getParsedContent.ts
|
|
457
457
|
var import_jsdom3 = require("jsdom");
|
|
458
|
-
var import_markdown_it = __toESM(require("markdown-it"));
|
|
458
|
+
var import_markdown_it = __toESM(require("markdown-it"), 1);
|
|
459
459
|
|
|
460
460
|
// src/bin/getSlug.ts
|
|
461
461
|
function getSlug(title) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t8/docsgen",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/bin.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"bin": {
|
|
7
8
|
"docsgen": "dist/bin.js"
|
|
8
9
|
},
|
|
@@ -12,10 +13,10 @@
|
|
|
12
13
|
"build-css": "node -e \"require('node:fs').cpSync('src/css', 'dist/css', { force: true, recursive: true });\"",
|
|
13
14
|
"build-schema": "npx ts-json-schema-generator -p src/types/Config.ts -t Config -o schema.json --minify",
|
|
14
15
|
"clean": "node -e \"require('node:fs').rmSync('dist', { force: true, recursive: true });\"",
|
|
16
|
+
"patch": "node src/scripts/patch.ts",
|
|
15
17
|
"prepublishOnly": "npm run build",
|
|
16
|
-
"preversion": "npx npm-run-all
|
|
17
|
-
"shape": "npx codeshape"
|
|
18
|
-
"typecheck": "tsc --noEmit"
|
|
18
|
+
"preversion": "npx npm-run-all shape build-schema build",
|
|
19
|
+
"shape": "npx codeshape --typecheck"
|
|
19
20
|
},
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
@@ -26,12 +27,11 @@
|
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/jsdom": "^27.0.0",
|
|
28
29
|
"@types/markdown-it": "^14.1.2",
|
|
29
|
-
"@types/node": "^24.
|
|
30
|
-
"typescript": "^5.9.3"
|
|
30
|
+
"@types/node": "^24.10.1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"args-json": "^1.2.
|
|
34
|
-
"jsdom": "^27.
|
|
33
|
+
"args-json": "^1.2.8",
|
|
34
|
+
"jsdom": "^27.2.0",
|
|
35
35
|
"markdown-it": "^14.1.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/bin/cleanup.ts
CHANGED
package/src/bin/createFiles.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { access, mkdir } from "node:fs/promises";
|
|
2
|
-
import type { Context } from "../types/Context";
|
|
3
|
-
import { setCName } from "./setCName";
|
|
4
|
-
import { setContent } from "./setContent";
|
|
5
|
-
import { setImages } from "./setImages";
|
|
2
|
+
import type { Context } from "../types/Context.ts";
|
|
3
|
+
import { setCName } from "./setCName.ts";
|
|
4
|
+
import { setContent } from "./setContent.ts";
|
|
5
|
+
import { setImages } from "./setImages.ts";
|
|
6
6
|
|
|
7
7
|
export async function createFiles(ctx: Context) {
|
|
8
8
|
let { dir } = ctx;
|
package/src/bin/getConfig.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parseArgs } from "args-json";
|
|
2
|
-
import type { Config } from "../types/Config";
|
|
3
|
-
import type { EntryConfig } from "../types/EntryConfig";
|
|
4
|
-
import type { PackageMetadata } from "../types/PackageMetadata";
|
|
5
|
-
import { fetchContent } from "./fetchContent";
|
|
6
|
-
import { getLocation } from "./getLocation";
|
|
7
|
-
import { stripHTML } from "./stripHTML";
|
|
8
|
-
import { toConfig } from "./toConfig";
|
|
2
|
+
import type { Config } from "../types/Config.ts";
|
|
3
|
+
import type { EntryConfig } from "../types/EntryConfig.ts";
|
|
4
|
+
import type { PackageMetadata } from "../types/PackageMetadata.ts";
|
|
5
|
+
import { fetchContent } from "./fetchContent.ts";
|
|
6
|
+
import { getLocation } from "./getLocation.ts";
|
|
7
|
+
import { stripHTML } from "./stripHTML.ts";
|
|
8
|
+
import { toConfig } from "./toConfig.ts";
|
|
9
9
|
|
|
10
10
|
async function addMetadata(config: EntryConfig) {
|
|
11
11
|
try {
|
package/src/bin/getIcon.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ContentInjectionTarget } from "../types/ContentInjectionTarget";
|
|
2
|
-
import type { Context } from "../types/Context";
|
|
3
|
-
import type { Page } from "../types/Page";
|
|
1
|
+
import type { ContentInjectionTarget } from "../types/ContentInjectionTarget.ts";
|
|
2
|
+
import type { Context } from "../types/Context.ts";
|
|
3
|
+
import type { Page } from "../types/Page.ts";
|
|
4
4
|
|
|
5
5
|
export function getInjectedContent(
|
|
6
6
|
ctx: Context,
|
package/src/bin/getLocation.ts
CHANGED
package/src/bin/getNav.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSDOM } from "jsdom";
|
|
2
|
-
import type { Context } from "../types/Context";
|
|
3
|
-
import type { NavItem } from "../types/NavItem";
|
|
4
|
-
import { fetchContent } from "./fetchContent";
|
|
5
|
-
import { getRepoLink } from "./getRepoLink";
|
|
2
|
+
import type { Context } from "../types/Context.ts";
|
|
3
|
+
import type { NavItem } from "../types/NavItem.ts";
|
|
4
|
+
import { fetchContent } from "./fetchContent.ts";
|
|
5
|
+
import { getRepoLink } from "./getRepoLink.ts";
|
|
6
6
|
|
|
7
7
|
export async function getNav(ctx: Context, navItems: NavItem[]) {
|
|
8
8
|
let { name, root, contentDir, backstory, nav } = ctx;
|
package/src/bin/getRepoLink.ts
CHANGED
package/src/bin/getTitle.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSDOM } from "jsdom";
|
|
2
|
-
import type { Context } from "../../types/Context";
|
|
3
|
-
import type { NavItem } from "../../types/NavItem";
|
|
4
|
-
import { getSlug } from "../getSlug";
|
|
2
|
+
import type { Context } from "../../types/Context.ts";
|
|
3
|
+
import type { NavItem } from "../../types/NavItem.ts";
|
|
4
|
+
import { getSlug } from "../getSlug.ts";
|
|
5
5
|
|
|
6
6
|
export function buildNav(ctx: Context, dom: JSDOM) {
|
|
7
7
|
let { root, contentDir, singlePage } = ctx;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { JSDOM } from "jsdom";
|
|
2
2
|
import Markdown from "markdown-it";
|
|
3
|
-
import type { Context } from "../../types/Context";
|
|
4
|
-
import { fetchContent } from "../fetchContent";
|
|
5
|
-
import { getLocation } from "../getLocation";
|
|
6
|
-
import { buildNav } from "./buildNav";
|
|
7
|
-
import { getInstallationCode } from "./getInstallationCode";
|
|
8
|
-
import { getSectionPostprocess } from "./getSectionPostprocess";
|
|
9
|
-
import { isBadgeContainer } from "./isBadgeContainer";
|
|
10
|
-
import { joinLines } from "./joinLines";
|
|
11
|
-
import { preprocessContent } from "./preprocessContent";
|
|
3
|
+
import type { Context } from "../../types/Context.ts";
|
|
4
|
+
import { fetchContent } from "../fetchContent.ts";
|
|
5
|
+
import { getLocation } from "../getLocation.ts";
|
|
6
|
+
import { buildNav } from "./buildNav.ts";
|
|
7
|
+
import { getInstallationCode } from "./getInstallationCode.ts";
|
|
8
|
+
import { getSectionPostprocess } from "./getSectionPostprocess.ts";
|
|
9
|
+
import { isBadgeContainer } from "./isBadgeContainer.ts";
|
|
10
|
+
import { joinLines } from "./joinLines.ts";
|
|
11
|
+
import { preprocessContent } from "./preprocessContent.ts";
|
|
12
12
|
|
|
13
13
|
const md = new Markdown({
|
|
14
14
|
html: true,
|
package/src/bin/run.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { getConfig } from "./getConfig";
|
|
3
|
-
import { runEntry } from "./runEntry";
|
|
2
|
+
import { getConfig } from "./getConfig.ts";
|
|
3
|
+
import { runEntry } from "./runEntry.ts";
|
|
4
4
|
|
|
5
5
|
async function run() {
|
|
6
6
|
let { targetIds, entries, ...rootCtx } = await getConfig();
|
package/src/bin/runEntry.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { exec as defaultExec } from "node:child_process";
|
|
2
2
|
import { access } from "node:fs/promises";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
|
-
import type { Context } from "../types/Context";
|
|
5
|
-
import { cleanup } from "./cleanup";
|
|
6
|
-
import { createFiles } from "./createFiles";
|
|
4
|
+
import type { Context } from "../types/Context.ts";
|
|
5
|
+
import { cleanup } from "./cleanup.ts";
|
|
6
|
+
import { createFiles } from "./createFiles.ts";
|
|
7
7
|
|
|
8
8
|
const exec = promisify(defaultExec);
|
|
9
9
|
const stdout = async (cmd: string) => (await exec(cmd)).stdout.trim();
|
package/src/bin/setCName.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type { Context } from "../types/Context";
|
|
3
|
+
import type { Context } from "../types/Context.ts";
|
|
4
4
|
|
|
5
5
|
export async function setCName({ dir = "", name, cname, jsorg }: Context) {
|
|
6
6
|
let domain = "";
|
package/src/bin/setContent.ts
CHANGED
|
@@ -2,19 +2,19 @@ import { exec as defaultExec } from "node:child_process";
|
|
|
2
2
|
import { access, cp, mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
|
-
import { packageName } from "../const/packageName";
|
|
6
|
-
import type { Context } from "../types/Context";
|
|
7
|
-
import { escapeHTML } from "../utils/escapeHTML";
|
|
8
|
-
import { escapeRegExp } from "../utils/escapeRegExp";
|
|
9
|
-
import { getCounterContent } from "./getCounterContent";
|
|
10
|
-
import { getIcon } from "./getIcon";
|
|
11
|
-
import { getInjectedContent } from "./getInjectedContent";
|
|
12
|
-
import { getNav } from "./getNav";
|
|
13
|
-
import { getRepoLink } from "./getRepoLink";
|
|
14
|
-
import { getTitle } from "./getTitle";
|
|
15
|
-
import { getParsedContent } from "./parsing/getParsedContent";
|
|
16
|
-
import { stripHTML } from "./stripHTML";
|
|
17
|
-
import { toFileContent } from "./toFileContent";
|
|
5
|
+
import { packageName } from "../const/packageName.ts";
|
|
6
|
+
import type { Context } from "../types/Context.ts";
|
|
7
|
+
import { escapeHTML } from "../utils/escapeHTML.ts";
|
|
8
|
+
import { escapeRegExp } from "../utils/escapeRegExp.ts";
|
|
9
|
+
import { getCounterContent } from "./getCounterContent.ts";
|
|
10
|
+
import { getIcon } from "./getIcon.ts";
|
|
11
|
+
import { getInjectedContent } from "./getInjectedContent.ts";
|
|
12
|
+
import { getNav } from "./getNav.ts";
|
|
13
|
+
import { getRepoLink } from "./getRepoLink.ts";
|
|
14
|
+
import { getTitle } from "./getTitle.ts";
|
|
15
|
+
import { getParsedContent } from "./parsing/getParsedContent.ts";
|
|
16
|
+
import { stripHTML } from "./stripHTML.ts";
|
|
17
|
+
import { toFileContent } from "./toFileContent.ts";
|
|
18
18
|
|
|
19
19
|
const exec = promisify(defaultExec);
|
|
20
20
|
|
package/src/bin/setImages.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type { Context } from "../types/Context";
|
|
4
|
-
import { getIconContent } from "../utils/getIconContent";
|
|
3
|
+
import type { Context } from "../types/Context.ts";
|
|
4
|
+
import { getIconContent } from "../utils/getIconContent.ts";
|
|
5
5
|
|
|
6
6
|
export async function setImages({ dir = "", baseColor, favicon }: Context) {
|
|
7
7
|
if (favicon) return;
|
package/src/bin/toConfig.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Config } from "../types/Config";
|
|
2
|
-
import type { PackageMetadata } from "../types/PackageMetadata";
|
|
3
|
-
import { toRepoURL } from "./toRepoURL";
|
|
1
|
+
import type { Config } from "../types/Config.ts";
|
|
2
|
+
import type { PackageMetadata } from "../types/PackageMetadata.ts";
|
|
3
|
+
import { toRepoURL } from "./toRepoURL.ts";
|
|
4
4
|
|
|
5
5
|
export function toConfig(metadata: PackageMetadata): Partial<Config> {
|
|
6
6
|
let { name, description, version, repository } = metadata;
|
package/src/bin/toRepoURL.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
/** @see https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/57467 */
|
|
4
|
+
async function fixJSDOMTypes() {
|
|
5
|
+
let path = "node_modules/@types/jsdom/base.d.ts";
|
|
6
|
+
let insertion = " // @ts-ignore";
|
|
7
|
+
let ignoredLines = [
|
|
8
|
+
' readonly ["Infinity"]: number;',
|
|
9
|
+
' readonly ["NaN"]: number;',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
let lines = (await readFile(path, { encoding: "utf-8" })).split(/\r?\n/);
|
|
14
|
+
let updated = false;
|
|
15
|
+
|
|
16
|
+
for (let s of ignoredLines) {
|
|
17
|
+
let k = lines.indexOf(s);
|
|
18
|
+
|
|
19
|
+
if (k !== -1 && lines[k - 1] !== insertion) {
|
|
20
|
+
lines.splice(k, 0, insertion);
|
|
21
|
+
updated = true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (updated) await writeFile(path, lines.join("\n"));
|
|
26
|
+
} catch {}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await fixJSDOMTypes();
|
package/src/types/Config.ts
CHANGED
package/src/types/Context.ts
CHANGED
package/src/types/EntryConfig.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"include": ["src
|
|
2
|
+
"include": ["./src"],
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
"noEmit": true,
|
|
4
5
|
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
|
5
6
|
"target": "ESNext",
|
|
6
7
|
"outDir": "dist",
|
|
7
8
|
"module": "nodenext",
|
|
8
9
|
"moduleResolution": "nodenext",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
9
11
|
"strict": true,
|
|
10
12
|
"allowSyntheticDefaultImports": true,
|
|
11
13
|
"noUnusedLocals": true,
|