@domphy/press 0.19.2 → 0.20.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.
- package/dist/{build-DKE372GH.js → build-SVIPUB2K.js} +1157 -387
- package/dist/cli.js +24 -9
- package/dist/index.d.ts +39 -38
- package/dist/index.js +79 -221
- package/dist/index.js.map +1 -1
- package/dist/{serve-LQBYPP6C.js → serve-CMS6MDDF.js} +19 -5
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -23,11 +23,18 @@ async function loadConfig(configFile) {
|
|
|
23
23
|
if (command === "build") {
|
|
24
24
|
const config = await loadConfig(flag("--config") ?? "press.config.ts");
|
|
25
25
|
const srcDir = resolve(process.cwd(), flag("--src") ?? config.srcDir ?? ".");
|
|
26
|
-
const outDir = resolve(
|
|
26
|
+
const outDir = resolve(
|
|
27
|
+
process.cwd(),
|
|
28
|
+
flag("--out") ?? config.outDir ?? "dist"
|
|
29
|
+
);
|
|
27
30
|
const publicDir = resolve(process.cwd(), "public");
|
|
28
|
-
const { buildSite } = await import("./build-
|
|
31
|
+
const { buildSite } = await import("./build-SVIPUB2K.js");
|
|
29
32
|
await buildSite({
|
|
30
|
-
config: {
|
|
33
|
+
config: {
|
|
34
|
+
...config,
|
|
35
|
+
srcDir: config.srcDir ?? ".",
|
|
36
|
+
outDir: config.outDir ?? "dist"
|
|
37
|
+
},
|
|
31
38
|
srcDir,
|
|
32
39
|
outDir,
|
|
33
40
|
publicDir: existsSync(publicDir) ? publicDir : void 0
|
|
@@ -37,15 +44,22 @@ if (command === "build") {
|
|
|
37
44
|
const configFile = flag("--config") ?? "press.config.ts";
|
|
38
45
|
const config = await loadConfig(configFile);
|
|
39
46
|
const srcDir = resolve(process.cwd(), flag("--src") ?? config.srcDir ?? ".");
|
|
40
|
-
const outDir = resolve(
|
|
47
|
+
const outDir = resolve(
|
|
48
|
+
process.cwd(),
|
|
49
|
+
flag("--out") ?? config.outDir ?? ".press-dev"
|
|
50
|
+
);
|
|
41
51
|
const publicDir = resolve(process.cwd(), "public");
|
|
42
|
-
const { buildSite } = await import("./build-
|
|
43
|
-
const { startDevServer } = await import("./serve-
|
|
52
|
+
const { buildSite } = await import("./build-SVIPUB2K.js");
|
|
53
|
+
const { startDevServer } = await import("./serve-CMS6MDDF.js");
|
|
44
54
|
async function rebuild() {
|
|
45
55
|
const start = Date.now();
|
|
46
56
|
try {
|
|
47
57
|
await buildSite({
|
|
48
|
-
config: {
|
|
58
|
+
config: {
|
|
59
|
+
...config,
|
|
60
|
+
srcDir: config.srcDir ?? ".",
|
|
61
|
+
outDir: config.outDir ?? ".press-dev"
|
|
62
|
+
},
|
|
49
63
|
srcDir,
|
|
50
64
|
outDir,
|
|
51
65
|
publicDir: existsSync(publicDir) ? publicDir : void 0
|
|
@@ -59,7 +73,8 @@ if (command === "build") {
|
|
|
59
73
|
const { notify } = startDevServer(outDir, port);
|
|
60
74
|
let rebuildTimer = null;
|
|
61
75
|
watch(srcDir, { recursive: true }, (_event, filename) => {
|
|
62
|
-
if (!filename?.endsWith(".md") && !filename?.endsWith(".ts") && !filename?.endsWith(".js"))
|
|
76
|
+
if (!filename?.endsWith(".md") && !filename?.endsWith(".ts") && !filename?.endsWith(".js"))
|
|
77
|
+
return;
|
|
63
78
|
if (rebuildTimer) clearTimeout(rebuildTimer);
|
|
64
79
|
rebuildTimer = setTimeout(async () => {
|
|
65
80
|
rebuildTimer = null;
|
|
@@ -83,7 +98,7 @@ if (command === "build") {
|
|
|
83
98
|
console.error(`No build at ${outDir}. Run "domphy-press build" first.`);
|
|
84
99
|
process.exit(1);
|
|
85
100
|
}
|
|
86
|
-
const { startServer } = await import("./serve-
|
|
101
|
+
const { startServer } = await import("./serve-CMS6MDDF.js");
|
|
87
102
|
startServer(outDir, port);
|
|
88
103
|
} else {
|
|
89
104
|
console.error(`Unknown command: ${command ?? "(none)"}`);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DomphyElement, ElementNode } from '@domphy/core';
|
|
2
|
+
export { DomphyElement } from '@domphy/core';
|
|
2
3
|
import { TocEntry } from '@domphy/markdown';
|
|
3
4
|
export { TocEntry } from '@domphy/markdown';
|
|
4
5
|
import { Server } from 'node:http';
|
|
@@ -133,6 +134,14 @@ interface PageEntry {
|
|
|
133
134
|
filePath: string;
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
interface BuildOptions {
|
|
138
|
+
config: SiteConfig;
|
|
139
|
+
srcDir: string;
|
|
140
|
+
outDir: string;
|
|
141
|
+
publicDir?: string;
|
|
142
|
+
}
|
|
143
|
+
declare function buildSite(options: BuildOptions): Promise<void>;
|
|
144
|
+
|
|
136
145
|
type UserConfig = Omit<SiteConfig, "base" | "srcDir" | "outDir" | "head"> & {
|
|
137
146
|
base?: string;
|
|
138
147
|
srcDir?: string;
|
|
@@ -141,19 +150,32 @@ type UserConfig = Omit<SiteConfig, "base" | "srcDir" | "outDir" | "head"> & {
|
|
|
141
150
|
};
|
|
142
151
|
declare function defineConfig(config: UserConfig): SiteConfig;
|
|
143
152
|
|
|
144
|
-
interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
interface FenceMeta {
|
|
154
|
+
lang: string;
|
|
155
|
+
highlightLines: Set<number>;
|
|
156
|
+
lineNumbers: boolean;
|
|
157
|
+
title: string | null;
|
|
149
158
|
}
|
|
150
|
-
declare function
|
|
159
|
+
declare function parseFenceInfo(info: string): FenceMeta;
|
|
160
|
+
declare function createHighlighter(): Promise<(code: string, lang: string) => string>;
|
|
161
|
+
declare function renderFence(code: string, info: string, highlight: (code: string, lang: string) => string): string;
|
|
151
162
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
interface LayoutContext {
|
|
164
|
+
route: string;
|
|
165
|
+
title: string;
|
|
166
|
+
body: DomphyElement[];
|
|
167
|
+
toc: TocEntry[];
|
|
168
|
+
frontmatter: Record<string, unknown>;
|
|
169
|
+
config: SiteConfig;
|
|
170
|
+
/** ISO date string from git log, if lastUpdated:true and git available. */
|
|
171
|
+
lastUpdated?: string;
|
|
172
|
+
/** Estimated reading time in minutes. */
|
|
173
|
+
readingTime?: number;
|
|
174
|
+
/** Relative path from srcDir (e.g. "guide/index.md"), used for editLink. */
|
|
175
|
+
filePath?: string;
|
|
176
|
+
}
|
|
177
|
+
declare function pageShell(ctx: LayoutContext): DomphyElement;
|
|
178
|
+
declare function homeShell(ctx: LayoutContext): DomphyElement;
|
|
157
179
|
|
|
158
180
|
declare function renderDoc(source: string, options: RenderDocOptions): Promise<RenderedDoc>;
|
|
159
181
|
|
|
@@ -195,33 +217,12 @@ interface SearchWidgetOptions {
|
|
|
195
217
|
declare function searchWidget(options?: SearchWidgetOptions): DomphyElement;
|
|
196
218
|
declare function mountSearch(host: HTMLElement, options?: SearchWidgetOptions): ElementNode;
|
|
197
219
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
declare function parseFenceInfo(info: string): FenceMeta;
|
|
205
|
-
declare function createHighlighter(): Promise<(code: string, lang: string) => string>;
|
|
206
|
-
declare function renderFence(code: string, info: string, highlight: (code: string, lang: string) => string): string;
|
|
207
|
-
|
|
208
|
-
interface LayoutContext {
|
|
209
|
-
route: string;
|
|
210
|
-
title: string;
|
|
211
|
-
body: DomphyElement[];
|
|
212
|
-
toc: TocEntry[];
|
|
213
|
-
frontmatter: Record<string, unknown>;
|
|
214
|
-
config: SiteConfig;
|
|
215
|
-
/** ISO date string from git log, if lastUpdated:true and git available. */
|
|
216
|
-
lastUpdated?: string;
|
|
217
|
-
/** Estimated reading time in minutes. */
|
|
218
|
-
readingTime?: number;
|
|
219
|
-
/** Relative path from srcDir (e.g. "guide/index.md"), used for editLink. */
|
|
220
|
-
filePath?: string;
|
|
221
|
-
}
|
|
222
|
-
declare function pageShell(ctx: LayoutContext): DomphyElement;
|
|
223
|
-
declare function homeShell(ctx: LayoutContext): DomphyElement;
|
|
220
|
+
declare function startServer(root: string, port: number): Server;
|
|
221
|
+
declare function startDevServer(root: string, port: number): {
|
|
222
|
+
server: Server;
|
|
223
|
+
notify: () => void;
|
|
224
|
+
};
|
|
224
225
|
|
|
225
226
|
declare function pressCSS(): string;
|
|
226
227
|
|
|
227
|
-
export { type EditLink, type FenceMeta, type IslandRef, type LayoutContext, type LocaleConfig, type NavItem, type PageEntry, type RenderDocOptions, type RenderedDoc, type SearchDocument, type SearchResult, type SearchWidgetOptions, type SidebarItem, type SiteConfig, type SocialLink, type ThemeConfig, type UserConfig, buildSearchIndex, buildSite, createHighlighter, defineConfig, discoverPages, flattenSidebar, homeShell, mountSearch, outFileForRoute, pageShell, parseFenceInfo, pressCSS, prevNextForRoute, queryIndex, renderDoc, renderFence, routeForFile, searchWidget, sidebarForRoute, startDevServer, startServer };
|
|
228
|
+
export { type EditLink, type FenceMeta, type IslandRef, type LayoutContext, type LayoutSlots, type LocaleConfig, type NavItem, type PageEntry, type RenderDocOptions, type RenderedDoc, type SearchDocument, type SearchResult, type SearchWidgetOptions, type SidebarItem, type SiteConfig, type SocialLink, type ThemeConfig, type UserConfig, buildSearchIndex, buildSite, createHighlighter, defineConfig, discoverPages, flattenSidebar, homeShell, mountSearch, outFileForRoute, pageShell, parseFenceInfo, pressCSS, prevNextForRoute, queryIndex, renderDoc, renderFence, routeForFile, searchWidget, sidebarForRoute, startDevServer, startServer };
|