typerighter 0.3.0 → 0.4.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.

Files changed (91) hide show
  1. package/dist/app-Bw90hv7G.js +266 -0
  2. package/dist/brand-BtMsUv5o.js +201 -0
  3. package/dist/{cli-CoyGXgR1.js → cli-s44ly0MH.js} +233 -172
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +12 -4
  6. package/dist/client/app/index.d.ts.map +1 -1
  7. package/dist/client/app/router.d.ts.map +1 -1
  8. package/dist/client/theme-default.js +707 -149
  9. package/dist/client.js +2 -2
  10. package/dist/constants-E2UATqMm.js +32183 -0
  11. package/dist/es-ClqUVRJn.js +705 -0
  12. package/dist/index.js +4 -4
  13. package/dist/{init-CUo89E7j.js → init-0hKcjQtf.js} +10 -12
  14. package/dist/node/build/index.d.ts.map +1 -1
  15. package/dist/node/lib/markdown/index.d.ts.map +1 -1
  16. package/dist/node/lib/markdown/plugins/callout-container.d.ts +4 -0
  17. package/dist/node/lib/markdown/plugins/callout-container.d.ts.map +1 -0
  18. package/dist/node/lib/markdown/plugins/custom-container.d.ts +3 -0
  19. package/dist/node/lib/markdown/plugins/custom-container.d.ts.map +1 -0
  20. package/dist/node/lib/markdown/plugins/{highlight.d.ts → highlight/index.d.ts} +1 -1
  21. package/dist/node/lib/markdown/plugins/highlight/index.d.ts.map +1 -0
  22. package/dist/node/lib/markdown/plugins/highlight/language.d.ts +3 -0
  23. package/dist/node/lib/markdown/plugins/highlight/language.d.ts.map +1 -0
  24. package/dist/node/lib/progress.d.ts.map +1 -1
  25. package/dist/node/lib/render/vue.d.ts +2 -2
  26. package/dist/node/lib/render/vue.d.ts.map +1 -1
  27. package/dist/node/lib/typedown-context.d.ts +4 -4
  28. package/dist/node/lib/typedown-context.d.ts.map +1 -1
  29. package/dist/node/plugin/vite/constants.d.ts +2 -1
  30. package/dist/node/plugin/vite/constants.d.ts.map +1 -1
  31. package/dist/node/plugin/vite/index.d.ts +15 -1
  32. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  33. package/dist/node/plugin/vite/search.d.ts +15 -0
  34. package/dist/node/plugin/vite/search.d.ts.map +1 -0
  35. package/dist/shared/constants.d.ts +6 -0
  36. package/dist/shared/constants.d.ts.map +1 -0
  37. package/dist/shared/index.d.ts +1 -0
  38. package/dist/shared/index.d.ts.map +1 -1
  39. package/dist/shared/types/content.d.ts +54 -4
  40. package/dist/shared/types/content.d.ts.map +1 -1
  41. package/dist/shared/types/ssg.d.ts +3 -1
  42. package/dist/shared/types/ssg.d.ts.map +1 -1
  43. package/dist/shared/utils/content.d.ts +5 -5
  44. package/dist/shared/utils/content.d.ts.map +1 -1
  45. package/dist/shared/utils/debounce.d.ts +2 -0
  46. package/dist/shared/utils/debounce.d.ts.map +1 -0
  47. package/dist/shared/utils/format.d.ts +5 -1
  48. package/dist/shared/utils/format.d.ts.map +1 -1
  49. package/dist/shared/utils/html.d.ts +1 -0
  50. package/dist/shared/utils/html.d.ts.map +1 -1
  51. package/dist/shared/utils/index.d.ts +6 -4
  52. package/dist/shared/utils/index.d.ts.map +1 -1
  53. package/dist/shared/utils/path.d.ts +8 -0
  54. package/dist/shared/utils/path.d.ts.map +1 -0
  55. package/dist/shared/utils/regex.d.ts +2 -0
  56. package/dist/shared/utils/regex.d.ts.map +1 -0
  57. package/dist/shared/utils/time.d.ts +6 -0
  58. package/dist/shared/utils/time.d.ts.map +1 -0
  59. package/dist/shared/utils/url.d.ts +6 -2
  60. package/dist/shared/utils/url.d.ts.map +1 -1
  61. package/dist/typerighter.css +1 -1
  62. package/dist/vite-nzhkELg7.js +309 -0
  63. package/dist/vite.js +2 -3
  64. package/package.json +9 -5
  65. package/dist/app-CM3biamr.js +0 -184
  66. package/dist/brand-CeSqpEQ2.js +0 -4
  67. package/dist/chunk-DfAF0w94-EwUSVR-h.js +0 -13
  68. package/dist/constants-B7b8AsH0.js +0 -9530
  69. package/dist/content-BM3UKxcc.js +0 -16
  70. package/dist/lib-CBtriEt5-Ch50D04V.js +0 -3309
  71. package/dist/liteDOM-Cp0aN3bP-YwW1TGWI.js +0 -741
  72. package/dist/node/lib/markdown/plugins/container.d.ts +0 -3
  73. package/dist/node/lib/markdown/plugins/container.d.ts.map +0 -1
  74. package/dist/node/lib/markdown/plugins/highlight.d.ts.map +0 -1
  75. package/dist/node/plugin/vite/codegen.d.ts +0 -27
  76. package/dist/node/plugin/vite/codegen.d.ts.map +0 -1
  77. package/dist/node/plugin/vite/codegen.test.d.ts +0 -2
  78. package/dist/node/plugin/vite/codegen.test.d.ts.map +0 -1
  79. package/dist/plugin-D2xuSVM4.js +0 -1
  80. package/dist/rolldown-runtime-Dqa2HsxW.js +0 -20
  81. package/dist/shared/utils/environment.d.ts +0 -2
  82. package/dist/shared/utils/environment.d.ts.map +0 -1
  83. package/dist/shared/utils/highlight.d.ts +0 -3
  84. package/dist/shared/utils/highlight.d.ts.map +0 -1
  85. package/dist/shared/utils/html.test.d.ts +0 -2
  86. package/dist/shared/utils/html.test.d.ts.map +0 -1
  87. package/dist/shared-DzTfF-_d.js +0 -14
  88. package/dist/tex-svg-full-BI3fonbT-CfoPQ3xc.js +0 -60224
  89. package/dist/vite-BxXQPieu.js +0 -228
  90. package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +0 -1094
  91. package/dist/xypic-DrMJn58R-B4fw2rYo.js +0 -14846
@@ -1,228 +0,0 @@
1
- import "./shared-DzTfF-_d.js";
2
- import { r as e } from "./content-BM3UKxcc.js";
3
- import { a as t, n, o as r, r as i, s as a, t as o } from "./constants-B7b8AsH0.js";
4
- import { r as s } from "./brand-CeSqpEQ2.js";
5
- import c from "@tailwindcss/vite";
6
- import l from "@vitejs/plugin-vue";
7
- import { createRequire as u } from "node:module";
8
- //#region src/node/lib/render/vue.ts
9
- async function d(t, n, r) {
10
- let i = {
11
- path: r,
12
- relativePath: r,
13
- cleanUrls: !0
14
- }, a = await t.renderAsync(n.content, i), o = i.title || e(n.header, r), s = {
15
- schema: n.schema,
16
- frontmatter: n.header,
17
- headings: i.headers ?? [],
18
- title: o
19
- }, c = JSON.stringify(JSON.stringify(s)), l = JSON.stringify(a);
20
- return {
21
- vueSrc: [
22
- "<script>",
23
- `export const __pageData = JSON.parse(${c})`,
24
- `export default { name: ${JSON.stringify(r)}, data() { return { __html: ${l} } } }`,
25
- "<\/script>",
26
- "<template><div v-html=\"__html\" /></template>"
27
- ].join("\n"),
28
- pageData: s
29
- };
30
- }
31
- //#endregion
32
- //#region src/node/plugin/vite/codegen.ts
33
- function f(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}/${i}'] = () => import('${i}');`}
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}/${i}'] : 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 p(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
- function m(e) {
73
- let t = `/${e.contentDir}/**/*.td`;
74
- return `
75
- import { createTypedownApp } from 'typerighter/client';
76
- import { renderToString } from 'vue/server-renderer';
77
- import theme from '${e.layoutImport}';
78
-
79
- const pages = import.meta.glob('${t}', { eager: true });
80
-
81
- function loadPageModule(pagePath) {
82
- const key = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '.td';
83
- const altKey = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '/index.td';
84
- return Promise.resolve(pages[key] || pages[altKey]);
85
- }
86
-
87
- export async function render(url) {
88
- const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig}, ${e.siteData});
89
- await router.go(url, { replace: true });
90
- const html = await renderToString(app);
91
- return { html, pageData: router.route.data };
92
- }
93
- `;
94
- }
95
- //#endregion
96
- //#region src/node/plugin/vite/alias.ts
97
- var h = u(import.meta.url);
98
- function g() {
99
- return [{
100
- find: "vue/server-renderer",
101
- replacement: h.resolve("vue/server-renderer")
102
- }, {
103
- find: "vue",
104
- replacement: h.resolve("vue/dist/vue.runtime.esm-bundler.js")
105
- }];
106
- }
107
- //#endregion
108
- //#region src/node/plugin/vite/index.ts
109
- function _(e = {}) {
110
- let i = e.context, u;
111
- function m() {
112
- if (i === void 0) throw Error("typedown plugin not initialized");
113
- return i.getTdContext();
114
- }
115
- return [
116
- {
117
- name: "vite-plugin-typedown",
118
- enforce: "pre",
119
- configResolved(e) {
120
- i ||= t(r(e.root));
121
- },
122
- config() {
123
- return {
124
- resolve: { alias: g() },
125
- ssr: { noExternal: ["typerighter"] }
126
- };
127
- },
128
- resolveId(e) {
129
- if (e === "/@typedown/app" || e === "@typedown/app") return o;
130
- if (e.endsWith("__typedown_index__.td")) return e;
131
- },
132
- async load(e) {
133
- let t = await m();
134
- if (e === "\0@typedown/app") {
135
- let [e, n, r] = await Promise.all([
136
- t.getConfig(),
137
- t.listFiles(),
138
- t.listFilesGroupedBySchema()
139
- ]), i = n.some((e) => e === "index.td");
140
- return f({
141
- ...e,
142
- hasIndex: i,
143
- sidebarGroups: r
144
- });
145
- }
146
- if (e.endsWith("__typedown_index__.td")) return p(await t.listFilesGroupedBySchema());
147
- },
148
- async configureServer(e) {
149
- u = e;
150
- let t = await m();
151
- return t.rpc.onConfigChanged(() => u && y(u)), t.rpc.onContentChanged(({ content: e }) => {
152
- if (u) {
153
- for (let t of u.moduleGraph.idToModuleMap.values()) if (t.file?.endsWith(e)) {
154
- u.moduleGraph.invalidateModule(t), u.hot.send({
155
- type: "update",
156
- updates: [{
157
- type: "js-update",
158
- path: t.url,
159
- acceptedPath: t.url,
160
- timestamp: Date.now()
161
- }]
162
- });
163
- break;
164
- }
165
- }
166
- }), t.rpc.onContentCreated(() => u && b(u)), t.rpc.onContentDeleted(() => u && b(u)), t.rpc.onSchemaChanged(() => u && b(u)), t.rpc.onSchemaCreated(() => u && b(u)), t.rpc.onSchemaDeleted(() => u && b(u)), () => {
167
- e.middlewares.use((e, r, i) => {
168
- if (!e.url || r.writableEnded || e.url.startsWith("/@") || e.url.startsWith("/node_modules") || e.url.includes(".")) return i();
169
- t.getConfig().then((e) => {
170
- let t = `<!DOCTYPE html>
171
- <html lang="en">
172
- <head>
173
- <meta charset="UTF-8">
174
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
175
- <title>${a(e.siteTitle)}</title>
176
- <link rel="icon" type="image/svg+xml" href="${s}">
177
- </head>
178
- <body>
179
- <div id="app"></div>
180
- <script type="module" src="/${n}"><\/script>
181
- </body>
182
- </html>`;
183
- r.setHeader("Content-Type", "text/html"), r.end(t);
184
- }).catch(i);
185
- });
186
- };
187
- },
188
- async transform(e, t) {
189
- let n = t.split("?")[0];
190
- if (!n.endsWith(".td") || n.includes("__typedown_index__.td")) return;
191
- let r = await m(), i = (await r.getConfig()).contentDir, a = n.includes(i) ? n.slice(n.indexOf(i) + i.length + 1) : n, o = await r.getFile(a), { vueSrc: s } = await d(r.md, o, a);
192
- return {
193
- code: s,
194
- map: null
195
- };
196
- },
197
- handleHotUpdate({ file: e }) {
198
- if (e.endsWith(".td")) return [];
199
- }
200
- },
201
- l({ include: /\.(?:vue|td)$/ }),
202
- ...c()
203
- ];
204
- }
205
- function v(e) {
206
- return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
207
- }
208
- function y(e) {
209
- for (let t of v(e)) e.moduleGraph.invalidateModule(t);
210
- e.hot.send({ type: "full-reload" });
211
- }
212
- function b(e) {
213
- let t = v(e).map((t) => (e.moduleGraph.invalidateModule(t), x(t)));
214
- 0 < t.length && e.hot.send({
215
- type: "update",
216
- updates: t
217
- });
218
- }
219
- function x(e) {
220
- return {
221
- type: "js-update",
222
- path: e.url,
223
- acceptedPath: e.url,
224
- timestamp: Date.now()
225
- };
226
- }
227
- //#endregion
228
- export { f as n, m as r, _ as t };