typerighter 0.3.1 → 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-VgaueuJP.js → cli-s44ly0MH.js} +227 -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-Ci83UWu-.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 -29
  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-DRzll98J.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-D9ePlTzy.js +0 -229
  90. package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +0 -1094
  91. package/dist/xypic-DrMJn58R-B4fw2rYo.js +0 -14846
@@ -1,229 +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`, n = e.hasIndex ? "" : `pages['/${e.contentDir}/${i}'] = import('${i}');`, r = e.hasIndex ? "" : ` || (pagePath === '/' ? pages['/${e.contentDir}/${i}'] : undefined)`;
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
- ${n}
81
-
82
- function loadPageModule(pagePath) {
83
- const key = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '.td';
84
- const altKey = '/${e.contentDir}/' + pagePath.replace(/^\\//, '') + '/index.td';
85
- return Promise.resolve(pages[key] || pages[altKey]${r});
86
- }
87
-
88
- export async function render(url) {
89
- const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig}, ${e.siteData});
90
- await router.go(url, { replace: true });
91
- const html = await renderToString(app);
92
- return { html, pageData: router.route.data };
93
- }
94
- `;
95
- }
96
- //#endregion
97
- //#region src/node/plugin/vite/alias.ts
98
- var h = u(import.meta.url);
99
- function g() {
100
- return [{
101
- find: "vue/server-renderer",
102
- replacement: h.resolve("vue/server-renderer")
103
- }, {
104
- find: "vue",
105
- replacement: h.resolve("vue/dist/vue.runtime.esm-bundler.js")
106
- }];
107
- }
108
- //#endregion
109
- //#region src/node/plugin/vite/index.ts
110
- function _(e = {}) {
111
- let i = e.context, u;
112
- function m() {
113
- if (i === void 0) throw Error("typedown plugin not initialized");
114
- return i.getTdContext();
115
- }
116
- return [
117
- {
118
- name: "vite-plugin-typedown",
119
- enforce: "pre",
120
- configResolved(e) {
121
- i ||= t(r(e.root));
122
- },
123
- config() {
124
- return {
125
- resolve: { alias: g() },
126
- ssr: { noExternal: ["typerighter"] }
127
- };
128
- },
129
- resolveId(e) {
130
- if (e === "/@typedown/app" || e === "@typedown/app") return o;
131
- if (e.endsWith("__typedown_index__.td")) return e;
132
- },
133
- async load(e) {
134
- let t = await m();
135
- if (e === "\0@typedown/app") {
136
- let [e, n, r] = await Promise.all([
137
- t.getConfig(),
138
- t.listFiles(),
139
- t.listFilesGroupedBySchema()
140
- ]), i = n.some((e) => e === "index.td");
141
- return f({
142
- ...e,
143
- hasIndex: i,
144
- sidebarGroups: r
145
- });
146
- }
147
- if (e.endsWith("__typedown_index__.td")) return p(await t.listFilesGroupedBySchema());
148
- },
149
- async configureServer(e) {
150
- u = e;
151
- let t = await m();
152
- return t.rpc.onConfigChanged(() => u && y(u)), t.rpc.onContentChanged(({ content: e }) => {
153
- if (u) {
154
- for (let t of u.moduleGraph.idToModuleMap.values()) if (t.file?.endsWith(e)) {
155
- u.moduleGraph.invalidateModule(t), u.hot.send({
156
- type: "update",
157
- updates: [{
158
- type: "js-update",
159
- path: t.url,
160
- acceptedPath: t.url,
161
- timestamp: Date.now()
162
- }]
163
- });
164
- break;
165
- }
166
- }
167
- }), 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)), () => {
168
- e.middlewares.use((e, r, i) => {
169
- if (!e.url || r.writableEnded || e.url.startsWith("/@") || e.url.startsWith("/node_modules") || e.url.includes(".")) return i();
170
- t.getConfig().then((e) => {
171
- let t = `<!DOCTYPE html>
172
- <html lang="en">
173
- <head>
174
- <meta charset="UTF-8">
175
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
176
- <title>${a(e.siteTitle)}</title>
177
- <link rel="icon" type="image/svg+xml" href="${s}">
178
- </head>
179
- <body>
180
- <div id="app"></div>
181
- <script type="module" src="/${n}"><\/script>
182
- </body>
183
- </html>`;
184
- r.setHeader("Content-Type", "text/html"), r.end(t);
185
- }).catch(i);
186
- });
187
- };
188
- },
189
- async transform(e, t) {
190
- let n = t.split("?")[0];
191
- if (!n.endsWith(".td") || n.includes("__typedown_index__.td")) return;
192
- 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);
193
- return {
194
- code: s,
195
- map: null
196
- };
197
- },
198
- handleHotUpdate({ file: e }) {
199
- if (e.endsWith(".td")) return [];
200
- }
201
- },
202
- l({ include: /\.(?:vue|td)$/ }),
203
- ...c()
204
- ];
205
- }
206
- function v(e) {
207
- return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
208
- }
209
- function y(e) {
210
- for (let t of v(e)) e.moduleGraph.invalidateModule(t);
211
- e.hot.send({ type: "full-reload" });
212
- }
213
- function b(e) {
214
- let t = v(e).map((t) => (e.moduleGraph.invalidateModule(t), x(t)));
215
- 0 < t.length && e.hot.send({
216
- type: "update",
217
- updates: t
218
- });
219
- }
220
- function x(e) {
221
- return {
222
- type: "js-update",
223
- path: e.url,
224
- acceptedPath: e.url,
225
- timestamp: Date.now()
226
- };
227
- }
228
- //#endregion
229
- export { f as n, m as r, _ as t };