Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/docs-engine-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"commander": "^12.0.0",
"chalk": "^5.3.0",
"ora": "^8.0.1",
"glob": "^10.3.10",
"glob": "^11.0.0",
"unified": "^11.0.5",
"remark-parse": "^11.0.0",
"remark-mdx": "^3.0.0",
"unist-util-visit": "^5.0.0",
"p-limit": "^5.0.0"
"p-limit": "^7.2.0"
},
"devDependencies": {
"@types/node": "^20.11.16",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
"@types/node": "^24.10.0",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
},
"keywords": [
"documentation",
Expand Down
4 changes: 4 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages:
- '.'
- 'site'
- 'packages/*'
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"vite": "^7.1.7"
},
"dependencies": {
"@goobits/docs-engine": "workspace:*",
"@lucide/svelte": "^0.553.0",
"dist": "file:../dist",
"gray-matter": "^4.0.3",
"katex": "^0.16.25",
"mdsvex": "^0.12.6",
Expand Down
4 changes: 2 additions & 2 deletions site/src/routes/docs/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';
import { error } from '@sveltejs/kit';
import { dev } from '$app/environment';
import { scanDocumentation } from 'dist/server/index.js';
import { buildNavigation, createSearchIndex } from 'dist/utils/index.js';
import { scanDocumentation } from '@goobits/docs-engine/server';
import { buildNavigation, createSearchIndex } from '@goobits/docs-engine/utils';
import { logError, createDevError } from '$lib/utils/error-logger';
import type { LayoutServerLoad } from './$types';

Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/docs/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import remarkParse from 'remark-parse';
import remarkGfm from 'remark-gfm';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import { remarkTableOfContents, linksPlugin } from 'dist/plugins/index.js';
import { remarkTableOfContents, linksPlugin } from '@goobits/docs-engine/plugins';
import type { PageServerLoad } from './$types';

export const load: PageServerLoad = async () => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/docs/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { page } from '$app/stores';
import { Home } from '@lucide/svelte';
import { DocsLayout } from 'dist/components/index.js';
import { DocsLayout } from '@goobits/docs-engine/components';
import type { PageData } from './$types';

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/docs/[...slug]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
collapsePlugin,
referencePlugin,
katexPlugin,
} from 'dist/plugins/index.js';
} from '@goobits/docs-engine/plugins';
import { logError, createDevError } from '$lib/utils/error-logger';
import type { PageServerLoad } from './$types';

Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/docs/[...slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { page } from '$app/stores';
import { Home } from '@lucide/svelte';
import { DocsLayout } from 'dist/components/index.js';
import { DocsLayout } from '@goobits/docs-engine/components';
import type { PageData } from './$types';

interface Props {
Expand Down
18 changes: 2 additions & 16 deletions src/lib/components/CodeCopyHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
* Finds all code blocks with data-copy-code attribute and mounts copy buttons
* Use this in your layout or page to hydrate static HTML
*/
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { mount } from 'svelte';
import { afterNavigate } from '$app/navigation';
import CodeCopyButton from './CodeCopyButton.svelte';
import { useHydrator } from '@goobits/docs-engine/utils';

interface Props {
/** Theme for styling */
Expand Down Expand Up @@ -71,17 +69,5 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>
29 changes: 2 additions & 27 deletions src/lib/components/CodeTabsHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
* Finds all .md-code-tabs divs and hydrates them into interactive tabs
* Use this in your layout or page to hydrate static HTML
*/
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { mount } from 'svelte';
import { afterNavigate } from '$app/navigation';
import CodeTabs from './CodeTabs.svelte';
import { createBrowserLogger } from '@goobits/docs-engine/utils';
import { createBrowserLogger, escapeHtml, useHydrator } from '@goobits/docs-engine/utils';

const logger = createBrowserLogger('CodeTabsHydrator');

Expand All @@ -21,16 +18,6 @@

let { theme = 'dracula' }: Props = $props();

// Simple HTML escape for error messages
function escapeHtml(str: string): string {
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}

function hydrate() {
// Use requestAnimationFrame to ensure DOM is fully rendered
requestAnimationFrame(() => {
Expand Down Expand Up @@ -70,17 +57,5 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>
19 changes: 2 additions & 17 deletions src/lib/components/CollapseHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* Client-side hydrator for collapsible sections
* Adds animations and accessibility to native <details> elements
*/
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { afterNavigate } from '$app/navigation';
import { createBrowserLogger } from '@goobits/docs-engine/utils';
import { createBrowserLogger, useHydrator } from '@goobits/docs-engine/utils';

const logger = createBrowserLogger('CollapseHydrator');

Expand Down Expand Up @@ -39,19 +36,7 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>

<style>
Expand Down
29 changes: 3 additions & 26 deletions src/lib/components/FileTreeHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* Finds all .md-filetree divs and renders them with FileTree component
* Use this in your layout or page to hydrate static HTML
*/
import { onMount, mount } from 'svelte';
import { browser } from '$app/environment';
import { afterNavigate } from '$app/navigation';
import { mount } from 'svelte';
import FileTree from './FileTree.svelte';
import type { TreeNode } from '@goobits/docs-engine/utils';
import { escapeHtml, useHydrator } from '@goobits/docs-engine/utils';

interface Props {
githubUrl?: string;
Expand All @@ -18,16 +17,6 @@

let { githubUrl, allowCopy = true }: Props = $props();

// Simple HTML escape for error messages
function escapeHtml(str: string): string {
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}

function hydrate() {
requestAnimationFrame(() => {
try {
Expand Down Expand Up @@ -75,17 +64,5 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>
28 changes: 2 additions & 26 deletions src/lib/components/MermaidHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,14 @@
* Finds all .md-mermaid divs and renders them
* Use this in your layout or page to hydrate static HTML
*/
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { afterNavigate } from '$app/navigation';
import { escapeHtml, useHydrator } from '@goobits/docs-engine/utils';

interface Props {
theme?: 'default' | 'dark' | 'forest' | 'neutral';
}

let { theme = 'dark' }: Props = $props();

// Simple HTML escape for error messages
function escapeHtml(str: string): string {
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}

let mermaidApi: typeof import('mermaid').default | undefined;
let initialized = false;
let modalOpen = $state(false);
Expand Down Expand Up @@ -234,19 +222,7 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>

<!-- Fullscreen Modal -->
Expand Down
19 changes: 2 additions & 17 deletions src/lib/components/OpenAPIHydrator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
* Finds all OpenAPI doc elements and mounts OpenAPIDoc components
* Use this in your layout or page to hydrate static HTML
*/
import { onMount } from 'svelte';
import { browser } from '$app/environment';
import { mount } from 'svelte';
import { afterNavigate } from '$app/navigation';
import OpenAPIDoc from './OpenAPIDoc.svelte';
import { parseOpenAPISpec, filterEndpointsByPath } from '../utils';
import { parseOpenAPISpec, filterEndpointsByPath, useHydrator } from '../utils';
import { sanitizeHtml } from '../utils/index.js';

interface Props {
Expand Down Expand Up @@ -91,19 +88,7 @@
});
}

onMount(() => {
if (!browser) return;

const unsubscribe = afterNavigate(() => hydrate());
// Defer hydration to avoid conflicts with Svelte's hydration phase
queueMicrotask(() => {
requestAnimationFrame(hydrate);
});

return () => {
unsubscribe?.();
};
});
useHydrator(hydrate);
</script>

<style>
Expand Down
Loading
Loading