typerighter 0.2.2 → 0.3.1
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/bin/typerighter.js +1 -1
- package/dist/cli-VgaueuJP.js +585 -0
- package/dist/cli.js +1 -1
- package/dist/{vite-BNDqb1zM.js → constants-B7b8AsH0.js} +126 -315
- package/dist/index.js +4 -4
- package/dist/init-Ci83UWu-.js +2358 -0
- package/dist/node/build/index.d.ts +2 -3
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/node/build/{render.d.ts → prerender.d.ts} +6 -3
- package/dist/node/build/prerender.d.ts.map +1 -0
- package/dist/node/cli/index.d.ts +1 -1
- package/dist/node/cli/index.d.ts.map +1 -1
- package/dist/node/cli/init.d.ts +1 -1
- package/dist/node/cli/init.d.ts.map +1 -1
- package/dist/node/context.d.ts +14 -0
- package/dist/node/context.d.ts.map +1 -0
- package/dist/node/lib/logger.d.ts +10 -3
- package/dist/node/lib/logger.d.ts.map +1 -1
- package/dist/node/lib/progress.d.ts +10 -0
- package/dist/node/lib/progress.d.ts.map +1 -0
- package/dist/node/lib/typedown-context.d.ts +1 -3
- package/dist/node/lib/typedown-context.d.ts.map +1 -1
- package/dist/node/plugin/vite/codegen.d.ts +2 -0
- package/dist/node/plugin/vite/codegen.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts +5 -1
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/plugin-DRzll98J.js +1 -0
- package/dist/rolldown-runtime-Dqa2HsxW.js +20 -0
- package/dist/shared/utils/format.d.ts +2 -0
- package/dist/shared/utils/format.d.ts.map +1 -0
- package/dist/shared/utils/html.d.ts +2 -0
- package/dist/shared/utils/html.d.ts.map +1 -0
- package/dist/shared/utils/html.test.d.ts.map +1 -0
- package/dist/shared/utils/index.d.ts +2 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/vite-D9ePlTzy.js +229 -0
- package/dist/vite.js +2 -2
- package/package.json +6 -3
- package/dist/cli-CfMrevh1.js +0 -160
- package/dist/constants-BN1OmC7K.js +0 -46
- package/dist/init-0BIO3hYI.js +0 -647
- package/dist/node/build/html.d.ts +0 -21
- package/dist/node/build/html.d.ts.map +0 -1
- package/dist/node/build/html.test.d.ts.map +0 -1
- package/dist/node/build/render.d.ts.map +0 -1
- package/dist/plugin-B-At85hl.js +0 -1
- /package/dist/{node/build → shared/utils}/html.test.d.ts +0 -0
package/dist/cli-CfMrevh1.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t } from "./constants-BN1OmC7K.js";
|
|
2
|
-
import { a as n, i as r, n as i, o as a, r as o, t as s } from "./vite-BNDqb1zM.js";
|
|
3
|
-
import c from "node:path";
|
|
4
|
-
import l from "node:fs/promises";
|
|
5
|
-
import { build as u, createLogger as d, createServer as f } from "vite";
|
|
6
|
-
//#region src/node/build/render.ts
|
|
7
|
-
var p = /* @__PURE__ */ t(a(), 1);
|
|
8
|
-
async function m(t) {
|
|
9
|
-
let n = await import(t.ssrEntryPath), { clientEntry: r, cssFiles: i, jsFiles: a } = await h(t.clientOutDir);
|
|
10
|
-
for (let o = 0; o < t.pagePaths.length; o += 8) {
|
|
11
|
-
let s = t.pagePaths.slice(o, o + 8);
|
|
12
|
-
await Promise.all(s.map(async (o) => {
|
|
13
|
-
let s = await n.render(o), u = e({
|
|
14
|
-
content: s.html,
|
|
15
|
-
title: s.pageData.title,
|
|
16
|
-
description: s.pageData.frontmatter.description === void 0 ? "" : String(s.pageData.frontmatter.description),
|
|
17
|
-
clientEntry: r,
|
|
18
|
-
cssFiles: i,
|
|
19
|
-
jsFiles: a,
|
|
20
|
-
base: t.base
|
|
21
|
-
}), d = o === "/" ? "index.html" : `${o.replace(/^\//, "")}.html`, f = c.join(t.outDir, d);
|
|
22
|
-
await l.mkdir(c.dirname(f), { recursive: !0 }), await l.writeFile(f, u);
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function h(e) {
|
|
27
|
-
let t = c.join(e, "assets"), n = [], r = await l.readdir(t).catch(() => n), i = [], a = [], o = "";
|
|
28
|
-
for (let e of r) e.endsWith(".css") ? i.push(`assets/${e}`) : e.endsWith(".js") && (e.startsWith("client-entry") || e.startsWith("index") ? o = `assets/${e}` : a.push(`assets/${e}`));
|
|
29
|
-
return !o && a.length > 0 && (o = a[0], a.splice(0, 1)), {
|
|
30
|
-
clientEntry: o,
|
|
31
|
-
cssFiles: i,
|
|
32
|
-
jsFiles: a
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/node/build/index.ts
|
|
37
|
-
var g = "typerighter/client/theme-default";
|
|
38
|
-
async function _(e) {
|
|
39
|
-
let t = c.resolve(e.root), a = c.resolve(t, e.outDir ?? "dist"), d = e.base ?? "/", f = c.join(a, ".client"), p = c.join(a, ".server"), h = await r(), [_, y, b] = await Promise.all([
|
|
40
|
-
h.getConfig(),
|
|
41
|
-
h.listFiles(),
|
|
42
|
-
h.listFilesGroupedBySchema()
|
|
43
|
-
]), x = y.some((e) => e === "index.td"), S = JSON.stringify({
|
|
44
|
-
title: _.siteTitle,
|
|
45
|
-
description: _.siteDescription
|
|
46
|
-
}), C = JSON.stringify({ sidebarGroups: b }), w = c.join(t, "node_modules", ".typerighter");
|
|
47
|
-
await l.mkdir(w, { recursive: !0 });
|
|
48
|
-
let T = c.join(w, "client-entry.js"), E = c.join(w, "ssr-entry.js");
|
|
49
|
-
await Promise.all([l.writeFile(T, i({
|
|
50
|
-
contentDir: _.contentDir,
|
|
51
|
-
siteTitle: _.siteTitle,
|
|
52
|
-
siteDescription: _.siteDescription,
|
|
53
|
-
hasIndex: x,
|
|
54
|
-
sidebarGroups: b
|
|
55
|
-
})), l.writeFile(E, o({
|
|
56
|
-
contentDir: _.contentDir,
|
|
57
|
-
layoutImport: g,
|
|
58
|
-
siteConfig: S,
|
|
59
|
-
siteData: C
|
|
60
|
-
}))]);
|
|
61
|
-
try {
|
|
62
|
-
let r = s();
|
|
63
|
-
n.phase("\nPhase 1: Building client bundle...\n"), await u({
|
|
64
|
-
...e.viteConfig,
|
|
65
|
-
root: t,
|
|
66
|
-
base: d,
|
|
67
|
-
plugins: r,
|
|
68
|
-
build: {
|
|
69
|
-
...e.viteConfig?.build,
|
|
70
|
-
outDir: f,
|
|
71
|
-
ssrManifest: !0,
|
|
72
|
-
emptyOutDir: !0,
|
|
73
|
-
rollupOptions: {
|
|
74
|
-
...e.viteConfig?.build?.rollupOptions,
|
|
75
|
-
input: T
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}), n.phase("\nPhase 2: Building SSR bundle...\n"), await u({
|
|
79
|
-
...e.viteConfig,
|
|
80
|
-
root: t,
|
|
81
|
-
base: d,
|
|
82
|
-
plugins: r,
|
|
83
|
-
build: {
|
|
84
|
-
...e.viteConfig?.build,
|
|
85
|
-
outDir: p,
|
|
86
|
-
ssr: E,
|
|
87
|
-
emptyOutDir: !0
|
|
88
|
-
}
|
|
89
|
-
}), n.phase("\nPhase 3: Pre-rendering pages...\n");
|
|
90
|
-
let i = y.map((e) => {
|
|
91
|
-
let t = e.replace(/\.td$/, "");
|
|
92
|
-
return t === "index" ? "/" : `/${t}`;
|
|
93
|
-
});
|
|
94
|
-
x || i.push("/"), await m({
|
|
95
|
-
ssrEntryPath: c.join(p, "ssr-entry.js"),
|
|
96
|
-
clientOutDir: f,
|
|
97
|
-
outDir: a,
|
|
98
|
-
base: d,
|
|
99
|
-
pagePaths: i
|
|
100
|
-
});
|
|
101
|
-
let o = c.join(f, "assets"), h = c.join(a, "assets");
|
|
102
|
-
await l.cp(o, h, { recursive: !0 }).catch(() => {}), await v(c.join(t, _.contentDir), a);
|
|
103
|
-
} finally {
|
|
104
|
-
await Promise.all([
|
|
105
|
-
l.rm(w, {
|
|
106
|
-
recursive: !0,
|
|
107
|
-
force: !0
|
|
108
|
-
}),
|
|
109
|
-
l.rm(f, {
|
|
110
|
-
recursive: !0,
|
|
111
|
-
force: !0
|
|
112
|
-
}),
|
|
113
|
-
l.rm(p, {
|
|
114
|
-
recursive: !0,
|
|
115
|
-
force: !0
|
|
116
|
-
})
|
|
117
|
-
]);
|
|
118
|
-
}
|
|
119
|
-
n.phase(`\nBuild complete. Output: ${a}`);
|
|
120
|
-
}
|
|
121
|
-
async function v(e, t) {
|
|
122
|
-
let n = (await l.readdir(e, {
|
|
123
|
-
recursive: !0,
|
|
124
|
-
withFileTypes: !0
|
|
125
|
-
})).filter((e) => e.isFile() && !e.name.endsWith(".td")).map(async (n) => {
|
|
126
|
-
let r = c.join(n.parentPath, n.name), i = c.relative(e, r), a = c.join(t, i);
|
|
127
|
-
return l.mkdir(c.dirname(a), { recursive: !0 }).then(() => l.copyFile(r, a));
|
|
128
|
-
});
|
|
129
|
-
await Promise.all(n);
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/node/cli/index.ts
|
|
133
|
-
async function y() {
|
|
134
|
-
let e = process.argv.slice(2), t = e[0], n = e[1] ?? process.cwd();
|
|
135
|
-
try {
|
|
136
|
-
if (!t || t === "dev") {
|
|
137
|
-
let e = await f({
|
|
138
|
-
root: n,
|
|
139
|
-
configFile: !1,
|
|
140
|
-
plugins: [s()]
|
|
141
|
-
});
|
|
142
|
-
await e.listen(), e.printUrls();
|
|
143
|
-
} else if (t === "build") await _({ root: n }), process.exit(0);
|
|
144
|
-
else if (t === "init") {
|
|
145
|
-
let { initialize: e } = await import("./init-0BIO3hYI.js");
|
|
146
|
-
await e(n);
|
|
147
|
-
} else if (t === "preview") {
|
|
148
|
-
let { preview: e } = await import("vite");
|
|
149
|
-
(await e({ root: n })).printUrls();
|
|
150
|
-
} else b(`unknown command "${t}".`);
|
|
151
|
-
} catch (e) {
|
|
152
|
-
b(`${t ?? "dev"} error:`, e);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function b(e, t) {
|
|
156
|
-
let n = d(), r = [p.default.red(e)];
|
|
157
|
-
t instanceof Error && (r.push(t.message), t.stack && r.push(t.stack)), n.error(r.join("\n")), process.exit(1);
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
export { _ as n, y as t };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
3
|
-
let r = {};
|
|
4
|
-
for (var i in e) t(r, i, {
|
|
5
|
-
get: e[i],
|
|
6
|
-
enumerable: !0
|
|
7
|
-
});
|
|
8
|
-
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
-
}, c = (e, i, o, s) => {
|
|
10
|
-
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
11
|
-
get: ((e) => i[e]).bind(null, d),
|
|
12
|
-
enumerable: !(s = n(i, d)) || s.enumerable
|
|
13
|
-
});
|
|
14
|
-
return e;
|
|
15
|
-
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
16
|
-
value: n,
|
|
17
|
-
enumerable: !0
|
|
18
|
-
}) : a, n));
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/node/build/html.ts
|
|
21
|
-
function u(e) {
|
|
22
|
-
let t = e.cssFiles.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), n = e.jsFiles.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n");
|
|
23
|
-
return `<!DOCTYPE html>
|
|
24
|
-
<html lang="${e.lang ?? "en"}">
|
|
25
|
-
<head>
|
|
26
|
-
<meta charset="UTF-8">
|
|
27
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
28
|
-
<title>${d(e.title)}</title>
|
|
29
|
-
<meta name="description" content="${d(e.description)}">
|
|
30
|
-
${t}
|
|
31
|
-
${n}
|
|
32
|
-
</head>
|
|
33
|
-
<body>
|
|
34
|
-
<div id="app">${e.content}</div>
|
|
35
|
-
<script type="module" src="${e.base}${e.clientEntry}"><\/script>
|
|
36
|
-
</body>
|
|
37
|
-
</html>`;
|
|
38
|
-
}
|
|
39
|
-
function d(e) {
|
|
40
|
-
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/node/plugin/vite/constants.ts
|
|
44
|
-
var f = "@typedown/app", p = "\0@typedown/app", m = "__typedown_index__.td";
|
|
45
|
-
//#endregion
|
|
46
|
-
export { u as a, l as c, d as i, f as n, o, m as r, s, p as t };
|