@writedocs/generator 0.13.4 → 0.14.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/README.md +28 -28
- package/astro.config.mjs +645 -645
- package/bin/writedocs.js +359 -356
- package/package.json +99 -99
- package/src/cli/base-path-layout.js +44 -44
- package/src/cli/build-auth.js +135 -135
- package/src/cli/build.js +223 -203
- package/src/cli/check-built-styles.js +41 -41
- package/src/cli/convert.js +124 -124
- package/src/cli/dev.js +269 -268
- package/src/cli/exit-when-flushed.js +42 -42
- package/src/cli/generate-api-pages.js +509 -507
- package/src/cli/og-image-worker.js +20 -20
- package/src/cli/og-images.js +70 -70
- package/src/cli/page-list-watch.js +71 -69
- package/src/cli/run-astro.js +97 -97
- package/src/cli/run-pagefind.js +154 -154
- package/src/cli/write-mcp-files.js +103 -103
- package/src/cli/write-redirects-file.js +158 -158
- package/src/components/ApiReferencePanel.astro +1792 -1792
- package/src/components/AppIcon.astro +51 -51
- package/src/components/Card.astro +193 -193
- package/src/components/CodeGroup.astro +63 -39
- package/src/components/CopyPageMenu.astro +374 -374
- package/src/components/Hint.astro +188 -188
- package/src/components/Icon.astro +72 -72
- package/src/components/Image.astro +165 -165
- package/src/components/Tile.astro +67 -67
- package/src/components/Video.astro +137 -137
- package/src/content.config.ts +219 -203
- package/src/layout/BaseLayout.astro +908 -908
- package/src/layout/components/AnalyticsScripts.astro +49 -49
- package/src/layout/components/Breadcrumbs.astro +98 -98
- package/src/layout/components/ConsentBanner.astro +119 -119
- package/src/layout/components/MobileMenu.astro +225 -225
- package/src/layout/components/NavTree.astro +422 -408
- package/src/layout/components/Sidebar.astro +232 -232
- package/src/layout/components/SiteFooter.astro +87 -87
- package/src/layout/components/TopBar.astro +386 -386
- package/src/layout/styles/base.css +332 -326
- package/src/layout/styles/mobile-menu.css +285 -285
- package/src/lib/agent-markdown.js +164 -164
- package/src/lib/asset-dimensions.js +89 -89
- package/src/lib/base-path.js +90 -90
- package/src/lib/cli-report.js +22 -22
- package/src/lib/code-line-numbers.js +13 -0
- package/src/lib/config-schema.js +12 -1
- package/src/lib/config-schema.ts +2523 -2509
- package/src/lib/config.ts +1331 -1316
- package/src/lib/consent.js +108 -108
- package/src/lib/content-check.js +4 -1
- package/src/lib/content-store-reload-integration.js +101 -101
- package/src/lib/drafts.js +186 -0
- package/src/lib/icon-data-dev.js +53 -53
- package/src/lib/image-size.js +152 -152
- package/src/lib/json-schema-descriptions.js +228 -228
- package/src/lib/link-check.js +553 -544
- package/src/lib/llms-index.ts +90 -90
- package/src/lib/mcp-dev-integration.js +65 -65
- package/src/lib/mcp-index.ts +102 -102
- package/src/lib/mintlify-convert.js +605 -605
- package/src/lib/moved-api-pages.js +49 -49
- package/src/lib/og-cards.js +33 -33
- package/src/lib/og-image.js +235 -235
- package/src/lib/openapi-dev-status.js +80 -80
- package/src/lib/openapi-reload-integration.js +193 -193
- package/src/lib/pages.js +346 -312
- package/src/lib/project-files-integration.js +116 -116
- package/src/lib/project-files.js +137 -137
- package/src/lib/rehype-base-path.js +62 -62
- package/src/lib/rehype-image-loading.js +71 -71
- package/src/lib/robots-txt.js +21 -21
- package/src/lib/search-scope.js +44 -44
- package/src/lib/selector-placement.js +50 -50
- package/src/lib/seo-tags.js +157 -155
- package/src/lib/shiki-code-block.js +7 -1
- package/src/lib/site-base.ts +27 -27
- package/src/lib/styles-asset-integration.js +291 -291
- package/src/lib/wdignore-cases.json +195 -195
- package/src/lib/wdignore.js +177 -177
- package/src/pages/404.astro +63 -63
- package/src/pages/[...slug].astro +1773 -1608
- package/src/pages/[...slug].md.ts +93 -93
- package/src/pages/llms-full.txt.ts +88 -88
- package/src/pages/og/[...slug].png.ts +63 -63
- package/src/scripts/mobile-menu.ts +80 -80
- package/src/scripts/search.ts +245 -245
- package/src/scripts/sidebar-scroll.ts +61 -61
- package/src/styles/global.css +40 -40
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
// Leaving a process without losing what it printed. astro-worker.js ends with
|
|
2
|
-
// process.exit() - Astro leaves handles open, so the process wouldn't end by
|
|
3
|
-
// itself - and on a pipe both stdout/stderr and the IPC channel are
|
|
4
|
-
// asynchronous (on Linux): exit() drops whatever is still queued in the
|
|
5
|
-
// process. A fixed wait isn't enough: a page that prints 1 MiB on a busy
|
|
6
|
-
// machine still had most of it queued after 50 ms, and the CLI got the output
|
|
7
|
-
// cut short with the build exiting 0.
|
|
8
|
-
//
|
|
9
|
-
// bin/writedocs.js leaves a failed command the same way (no IPC message
|
|
10
|
-
// there): its process.exit() lost the end of `writedocs validate`'s output in
|
|
11
|
-
// a CI log.
|
|
12
|
-
//
|
|
13
|
-
// Plain JavaScript with no Astro import, so scripts/exit-when-flushed.test.js
|
|
14
|
-
// can run it in a child process of its own.
|
|
15
|
-
|
|
16
|
-
/** How long the wait may take. If the CLI stops reading (alive, but stuck),
|
|
17
|
-
* the worker exits anyway instead of hanging. */
|
|
18
|
-
export const MAX_FLUSH_WAIT_MS = 10_000;
|
|
19
|
-
|
|
20
|
-
/** Resolves once everything written to `stream` so far has left the process. */
|
|
21
|
-
function flushed(stream) {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
if (!stream.writable || stream.destroyed) return resolve();
|
|
24
|
-
stream.write('', () => resolve());
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Sends `lastMessage` to the parent (when there is one), waits for it and
|
|
29
|
-
* for stdout and stderr to leave the process, then exits with `code` - or
|
|
30
|
-
* after `maxWaitMs`, whichever comes first. */
|
|
31
|
-
export async function exitWhenFlushed(code, lastMessage, { maxWaitMs = MAX_FLUSH_WAIT_MS } = {}) {
|
|
32
|
-
// unref: the timer alone never keeps the process alive.
|
|
33
|
-
const deadline = setTimeout(() => process.exit(code), maxWaitMs);
|
|
34
|
-
deadline.unref();
|
|
35
|
-
await new Promise((resolve) => {
|
|
36
|
-
if (lastMessage !== undefined && typeof process.send === 'function' && process.connected) {
|
|
37
|
-
process.send(lastMessage, () => resolve());
|
|
38
|
-
} else resolve();
|
|
39
|
-
});
|
|
40
|
-
await Promise.all([flushed(process.stdout), flushed(process.stderr)]);
|
|
41
|
-
process.exit(code);
|
|
42
|
-
}
|
|
1
|
+
// Leaving a process without losing what it printed. astro-worker.js ends with
|
|
2
|
+
// process.exit() - Astro leaves handles open, so the process wouldn't end by
|
|
3
|
+
// itself - and on a pipe both stdout/stderr and the IPC channel are
|
|
4
|
+
// asynchronous (on Linux): exit() drops whatever is still queued in the
|
|
5
|
+
// process. A fixed wait isn't enough: a page that prints 1 MiB on a busy
|
|
6
|
+
// machine still had most of it queued after 50 ms, and the CLI got the output
|
|
7
|
+
// cut short with the build exiting 0.
|
|
8
|
+
//
|
|
9
|
+
// bin/writedocs.js leaves a failed command the same way (no IPC message
|
|
10
|
+
// there): its process.exit() lost the end of `writedocs validate`'s output in
|
|
11
|
+
// a CI log.
|
|
12
|
+
//
|
|
13
|
+
// Plain JavaScript with no Astro import, so scripts/exit-when-flushed.test.js
|
|
14
|
+
// can run it in a child process of its own.
|
|
15
|
+
|
|
16
|
+
/** How long the wait may take. If the CLI stops reading (alive, but stuck),
|
|
17
|
+
* the worker exits anyway instead of hanging. */
|
|
18
|
+
export const MAX_FLUSH_WAIT_MS = 10_000;
|
|
19
|
+
|
|
20
|
+
/** Resolves once everything written to `stream` so far has left the process. */
|
|
21
|
+
function flushed(stream) {
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
if (!stream.writable || stream.destroyed) return resolve();
|
|
24
|
+
stream.write('', () => resolve());
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Sends `lastMessage` to the parent (when there is one), waits for it and
|
|
29
|
+
* for stdout and stderr to leave the process, then exits with `code` - or
|
|
30
|
+
* after `maxWaitMs`, whichever comes first. */
|
|
31
|
+
export async function exitWhenFlushed(code, lastMessage, { maxWaitMs = MAX_FLUSH_WAIT_MS } = {}) {
|
|
32
|
+
// unref: the timer alone never keeps the process alive.
|
|
33
|
+
const deadline = setTimeout(() => process.exit(code), maxWaitMs);
|
|
34
|
+
deadline.unref();
|
|
35
|
+
await new Promise((resolve) => {
|
|
36
|
+
if (lastMessage !== undefined && typeof process.send === 'function' && process.connected) {
|
|
37
|
+
process.send(lastMessage, () => resolve());
|
|
38
|
+
} else resolve();
|
|
39
|
+
});
|
|
40
|
+
await Promise.all([flushed(process.stdout), flushed(process.stderr)]);
|
|
41
|
+
process.exit(code);
|
|
42
|
+
}
|