typerighter 0.0.0 → 0.1.0
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.
Potentially problematic release.
This version of typerighter might be problematic. Click here for more details.
- package/LICENSE +674 -0
- package/dist/app-bn8sNpDS.js +180 -0
- package/dist/brand-DSd9HWVy.js +19 -0
- package/dist/chunk-DfAF0w94-EwUSVR-h.js +13 -0
- package/dist/client/app/components/Content.d.ts +4 -0
- package/dist/client/app/components/Content.d.ts.map +1 -0
- package/dist/client/app/composables/useTdContent.d.ts +4 -0
- package/dist/client/app/composables/useTdContent.d.ts.map +1 -0
- package/dist/client/app/composables/useTheme.d.ts +9 -0
- package/dist/client/app/composables/useTheme.d.ts.map +1 -0
- package/dist/client/app/index.d.ts +22 -0
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/app/router.d.ts +24 -0
- package/dist/client/app/router.d.ts.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/theme-default.js +339 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -4
- package/dist/lib-CBtriEt5-Ch50D04V.js +3309 -0
- package/dist/liteDOM-Cp0aN3bP-YwW1TGWI.js +741 -0
- package/dist/logger-DZLd8EDg.js +78 -0
- package/dist/node/build/codegen.d.ts +13 -0
- package/dist/node/build/codegen.d.ts.map +1 -0
- package/dist/node/build/html.d.ts +20 -0
- package/dist/node/build/html.d.ts.map +1 -0
- package/dist/node/build/index.d.ts +17 -0
- package/dist/node/build/index.d.ts.map +1 -0
- package/dist/node/build/render.d.ts +14 -0
- package/dist/node/build/render.d.ts.map +1 -0
- package/dist/node/cli/index.d.ts +2 -0
- package/dist/node/cli/index.d.ts.map +1 -0
- package/dist/node/cli/server.d.ts +5 -0
- package/dist/node/cli/server.d.ts.map +1 -0
- package/dist/node/index.d.ts +3 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/lib/index.d.ts +4 -0
- package/dist/node/lib/index.d.ts.map +1 -0
- package/dist/node/lib/logger.d.ts +6 -0
- package/dist/node/lib/logger.d.ts.map +1 -0
- package/dist/node/lib/markdown/index.d.ts +5 -0
- package/dist/node/lib/markdown/index.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/container.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/container.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/highlight.d.ts +2 -0
- package/dist/node/lib/markdown/plugins/highlight.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/image.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/image.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/line-number.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/line-number.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/link.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/link.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts +6 -0
- package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/restore-entities.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/restore-entities.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/table.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/table.d.ts.map +1 -0
- package/dist/node/lib/render/index.d.ts +2 -0
- package/dist/node/lib/render/index.d.ts.map +1 -0
- package/dist/node/lib/render/vue.d.ts +11 -0
- package/dist/node/lib/render/vue.d.ts.map +1 -0
- package/dist/node/lib/typedown-context.d.ts +29 -0
- package/dist/node/lib/typedown-context.d.ts.map +1 -0
- package/dist/node/plugin/codegen.d.ts +16 -0
- package/dist/node/plugin/codegen.d.ts.map +1 -0
- package/dist/node/plugin/codegen.test.d.ts +2 -0
- package/dist/node/plugin/codegen.test.d.ts.map +1 -0
- package/dist/node/plugin/constants.d.ts +4 -0
- package/dist/node/plugin/constants.d.ts.map +1 -0
- package/dist/node/plugin/index.d.ts +2 -0
- package/dist/node/plugin/index.d.ts.map +1 -0
- package/dist/node/plugin/vite.d.ts +3 -0
- package/dist/node/plugin/vite.d.ts.map +1 -0
- package/dist/shared/brand.d.ts +7 -0
- package/dist/shared/brand.d.ts.map +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/regexes.d.ts +2 -0
- package/dist/shared/regexes.d.ts.map +1 -0
- package/dist/shared/types/content.d.ts +10 -0
- package/dist/shared/types/content.d.ts.map +1 -0
- package/dist/shared/types/index.d.ts +4 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/markdown.d.ts +62 -0
- package/dist/shared/types/markdown.d.ts.map +1 -0
- package/dist/shared/types/ssg.d.ts +23 -0
- package/dist/shared/types/ssg.d.ts.map +1 -0
- package/dist/shared/utils/content.d.ts +6 -0
- package/dist/shared/utils/content.d.ts.map +1 -0
- package/dist/shared/utils/environment.d.ts +2 -0
- package/dist/shared/utils/environment.d.ts.map +1 -0
- package/dist/shared/utils/highlight.d.ts +3 -0
- package/dist/shared/utils/highlight.d.ts.map +1 -0
- package/dist/shared/utils/index.d.ts +5 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/url.d.ts +3 -0
- package/dist/shared/utils/url.d.ts.map +1 -0
- package/dist/shared-DzTfF-_d.js +14 -0
- package/dist/tex-svg-full-BI3fonbT-CfoPQ3xc.js +60224 -0
- package/dist/typedown-context-CWA07Yb7.js +9436 -0
- package/dist/typedown-context-D78bYNhH.js +2 -0
- package/dist/typerighter.css +2 -0
- package/dist/vite.js +174 -0
- package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +1094 -0
- package/dist/xypic-DrMJn58R-B4fw2rYo.js +14846 -0
- package/package.json +49 -16
- package/dist/client/theme-default/index.d.ts +0 -1
- package/dist/client/theme-default/index.d.ts.map +0 -1
- package/dist/index.cjs +0 -1
package/dist/vite.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { n as e } from "./typedown-context-CWA07Yb7.js";
|
|
2
|
+
import "./shared-DzTfF-_d.js";
|
|
3
|
+
import { c as t, r as n } from "./brand-DSd9HWVy.js";
|
|
4
|
+
import r from "@vitejs/plugin-vue";
|
|
5
|
+
//#region src/node/lib/render/vue.ts
|
|
6
|
+
async function i(e, n, r) {
|
|
7
|
+
let i = {
|
|
8
|
+
path: r,
|
|
9
|
+
relativePath: r,
|
|
10
|
+
cleanUrls: !0
|
|
11
|
+
}, a = await e.renderAsync(n.content, i), o = i.title || t(n.header, r), s = {
|
|
12
|
+
schema: n.schema,
|
|
13
|
+
frontmatter: n.header,
|
|
14
|
+
headings: i.headers ?? [],
|
|
15
|
+
title: o
|
|
16
|
+
}, c = JSON.stringify(JSON.stringify(s)), l = JSON.stringify(a);
|
|
17
|
+
return {
|
|
18
|
+
vueSrc: [
|
|
19
|
+
"<script>",
|
|
20
|
+
`export const __pageData = JSON.parse(${c})`,
|
|
21
|
+
`export default { name: ${JSON.stringify(r)}, data() { return { __html: ${l} } } }`,
|
|
22
|
+
"<\/script>",
|
|
23
|
+
"<template><div v-html=\"__html\" /></template>"
|
|
24
|
+
].join("\n"),
|
|
25
|
+
pageData: s
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/node/plugin/constants.ts
|
|
30
|
+
var a = "@typedown/app", o = "\0@typedown/app", s = "__typedown_index__.td";
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/node/plugin/codegen.ts
|
|
33
|
+
function c(e) {
|
|
34
|
+
let { contentDir: t, hasIndex: n } = e;
|
|
35
|
+
return `
|
|
36
|
+
import 'typerighter/style.css';
|
|
37
|
+
import { createTypedownApp } from 'typerighter/client';
|
|
38
|
+
import theme from 'typerighter/client/theme-default';
|
|
39
|
+
|
|
40
|
+
const pages = import.meta.glob('${`/${t}/**/*.td`}');
|
|
41
|
+
${n ? "" : `pages['/${t}/${s}'] = () => import('${s}');`}
|
|
42
|
+
|
|
43
|
+
async function loadPageModule(pagePath) {
|
|
44
|
+
const key = '/${t}/' + pagePath.replace(/^\\//, '') + '.td';
|
|
45
|
+
const altKey = '/${t}/' + pagePath.replace(/^\\//, '') + '/index.td';
|
|
46
|
+
const loader = pages[key] || pages[altKey]${n ? "" : ` || (pagePath === '/' ? pages['/${t}/${s}'] : undefined)`};
|
|
47
|
+
if (!loader) return undefined;
|
|
48
|
+
return loader();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const { app } = await createTypedownApp(loadPageModule, theme.Layout, ${JSON.stringify({
|
|
52
|
+
title: e.siteTitle,
|
|
53
|
+
description: e.siteDescription
|
|
54
|
+
})}, ${JSON.stringify({ sidebarGroups: e.sidebarGroups })});
|
|
55
|
+
app.mount('#app');
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
function l(e) {
|
|
59
|
+
let t = JSON.stringify(e).replace(/'/g, "\\'"), n = JSON.stringify({
|
|
60
|
+
schema: "",
|
|
61
|
+
frontmatter: {},
|
|
62
|
+
headings: [],
|
|
63
|
+
title: "Index"
|
|
64
|
+
});
|
|
65
|
+
return `<script>
|
|
66
|
+
import { TdOverview } from 'typerighter/client/theme-default';
|
|
67
|
+
export const __pageData = JSON.parse(${JSON.stringify(n)})
|
|
68
|
+
export default { name: "index", components: { TdOverview } }
|
|
69
|
+
<\/script>
|
|
70
|
+
<template><TdOverview :groups='${t}' /></template>`;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/node/plugin/vite.ts
|
|
74
|
+
function u() {
|
|
75
|
+
let t;
|
|
76
|
+
return [{
|
|
77
|
+
name: "vite-plugin-typedown",
|
|
78
|
+
enforce: "pre",
|
|
79
|
+
transformIndexHtml(e) {
|
|
80
|
+
return e.replace("</head>", ` <link rel="icon" type="image/svg+xml" href="${n}">\n</head>`).replace("</body>", ` <script type="module" src="/${a}"><\/script>\n</body>`);
|
|
81
|
+
},
|
|
82
|
+
resolveId(e) {
|
|
83
|
+
if (e === "/@typedown/app" || e === "@typedown/app") return o;
|
|
84
|
+
if (e.endsWith("__typedown_index__.td")) return e;
|
|
85
|
+
},
|
|
86
|
+
async load(t) {
|
|
87
|
+
if (t === "\0@typedown/app") {
|
|
88
|
+
let [t, n, r] = await Promise.all([
|
|
89
|
+
e.getConfig(),
|
|
90
|
+
e.listFiles(),
|
|
91
|
+
e.listFilesGroupedBySchema()
|
|
92
|
+
]), i = n.some((e) => e === "index.td");
|
|
93
|
+
return c({
|
|
94
|
+
...t,
|
|
95
|
+
hasIndex: i,
|
|
96
|
+
sidebarGroups: r
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (t.endsWith("__typedown_index__.td")) return l(await e.listFilesGroupedBySchema());
|
|
100
|
+
},
|
|
101
|
+
configureServer(r) {
|
|
102
|
+
return t = r, e.rpc.onConfigChanged(() => t && f(t)), e.rpc.onContentChanged(({ content: e }) => {
|
|
103
|
+
if (t) {
|
|
104
|
+
for (let n of t.moduleGraph.idToModuleMap.values()) if (n.file?.endsWith(e)) {
|
|
105
|
+
t.moduleGraph.invalidateModule(n), t.hot.send({
|
|
106
|
+
type: "update",
|
|
107
|
+
updates: [{
|
|
108
|
+
type: "js-update",
|
|
109
|
+
path: n.url,
|
|
110
|
+
acceptedPath: n.url,
|
|
111
|
+
timestamp: Date.now()
|
|
112
|
+
}]
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}), e.rpc.onContentCreated(() => t && p(t)), e.rpc.onContentDeleted(() => t && p(t)), e.rpc.onSchemaChanged(() => t && p(t)), e.rpc.onSchemaCreated(() => t && p(t)), e.rpc.onSchemaDeleted(() => t && p(t)), () => {
|
|
118
|
+
r.middlewares.use((e, t, r) => {
|
|
119
|
+
if (!e.url || t.writableEnded || e.url.startsWith("/@") || e.url.startsWith("/node_modules") || e.url.includes(".")) return r();
|
|
120
|
+
let i = `<!DOCTYPE html>
|
|
121
|
+
<html lang="en">
|
|
122
|
+
<head>
|
|
123
|
+
<meta charset="UTF-8">
|
|
124
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
125
|
+
<title>Typedown</title>
|
|
126
|
+
<link rel="icon" type="image/svg+xml" href="${n}">
|
|
127
|
+
</head>
|
|
128
|
+
<body>
|
|
129
|
+
<div id="app"></div>
|
|
130
|
+
<script type="module" src="/${a}"><\/script>
|
|
131
|
+
</body>
|
|
132
|
+
</html>`;
|
|
133
|
+
t.setHeader("Content-Type", "text/html"), t.end(i);
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
async transform(t, n) {
|
|
138
|
+
let r = n.split("?")[0];
|
|
139
|
+
if (!r.endsWith(".td") || r.includes("__typedown_index__.td")) return;
|
|
140
|
+
let a = (await e.getConfig()).contentDir, o = r.includes(a) ? r.slice(r.indexOf(a) + a.length + 1) : r, s = await e.getFile(o), { vueSrc: c } = await i(e.md, s, o);
|
|
141
|
+
return {
|
|
142
|
+
code: c,
|
|
143
|
+
map: null
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
handleHotUpdate({ file: e }) {
|
|
147
|
+
if (e.endsWith(".td")) return [];
|
|
148
|
+
}
|
|
149
|
+
}, r({ include: /\.(?:vue|td)$/ })];
|
|
150
|
+
}
|
|
151
|
+
function d(e) {
|
|
152
|
+
return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
|
|
153
|
+
}
|
|
154
|
+
function f(e) {
|
|
155
|
+
for (let t of d(e)) e.moduleGraph.invalidateModule(t);
|
|
156
|
+
e.hot.send({ type: "full-reload" });
|
|
157
|
+
}
|
|
158
|
+
function p(e) {
|
|
159
|
+
let t = d(e).map((t) => (e.moduleGraph.invalidateModule(t), m(t)));
|
|
160
|
+
0 < t.length && e.hot.send({
|
|
161
|
+
type: "update",
|
|
162
|
+
updates: t
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function m(e) {
|
|
166
|
+
return {
|
|
167
|
+
type: "js-update",
|
|
168
|
+
path: e.url,
|
|
169
|
+
acceptedPath: e.url,
|
|
170
|
+
timestamp: Date.now()
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
export { u as typedown };
|