@brett_lamy/docstream 0.3.5 → 0.3.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brett_lamy/docstream",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "GitBook-aware readonly markdown and AI stream renderer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -75,4 +75,4 @@
|
|
|
75
75
|
"@types/react": "^18.3.3",
|
|
76
76
|
"typescript": "^5.5.4"
|
|
77
77
|
}
|
|
78
|
-
}
|
|
78
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { PlaygroundStreamdown as GitbookStreamdown } from "./playground/PlaygroundStreamdown"
|
|
2
2
|
export type { PlaygroundStreamdownProps as GitbookStreamdownProps } from "./playground/PlaygroundStreamdown"
|
|
3
3
|
export { DocsRenderer, MarkdownContent } from "./docs/DocsRenderer"
|
|
4
|
+
export type { LivePreviewProps, LivePreviewRenderer } from "./docs/DocsRenderer"
|
|
4
5
|
export { ReplayEmbed, ReplayPreview } from "./replay"
|
|
5
6
|
export type {
|
|
6
7
|
ReplayEventsSource,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
createReactDemoFiles,
|
|
5
5
|
type AlmostNodeFiles,
|
|
6
6
|
type AlmostNodeWorkspace,
|
|
7
|
+
type AlmostNodeWorkspaceOptions,
|
|
7
8
|
} from "./filesystem"
|
|
8
9
|
|
|
9
10
|
export interface ReactDemoProps {
|
|
@@ -21,6 +22,8 @@ export interface ReactDemoProps {
|
|
|
21
22
|
autoStart?: boolean
|
|
22
23
|
/** iframe sandbox value. The same-origin permission lets the almost-node service worker route the preview. */
|
|
23
24
|
sandbox?: string
|
|
25
|
+
/** Extra options spread into `createAlmostNodeWorkspace` (e.g. `basePath` for static hosting). */
|
|
26
|
+
workspaceOptions?: Partial<AlmostNodeWorkspaceOptions>
|
|
24
27
|
className?: string
|
|
25
28
|
onReady?: (url: string) => void
|
|
26
29
|
onError?: (error: Error) => void
|
|
@@ -49,6 +52,7 @@ export function ReactDemo({
|
|
|
49
52
|
title = "Live React preview",
|
|
50
53
|
autoStart = true,
|
|
51
54
|
sandbox = "allow-scripts allow-same-origin allow-forms allow-modals",
|
|
55
|
+
workspaceOptions,
|
|
52
56
|
className,
|
|
53
57
|
onReady,
|
|
54
58
|
onError,
|
|
@@ -77,9 +81,11 @@ export function ReactDemo({
|
|
|
77
81
|
try {
|
|
78
82
|
const projectFiles = createReactDemoFiles(files, { entry })
|
|
79
83
|
workspace = await createAlmostNodeWorkspace(projectFiles, {
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
...workspaceOptions,
|
|
85
|
+
env: { ...DETACHED_SERVER_ENV, ...workspaceOptions?.env },
|
|
86
|
+
onServerReady: (serverPort, serverUrl) => {
|
|
82
87
|
readyUrl = serverUrl.endsWith("/") ? serverUrl : `${serverUrl}/`
|
|
88
|
+
workspaceOptions?.onServerReady?.(serverPort, serverUrl)
|
|
83
89
|
},
|
|
84
90
|
})
|
|
85
91
|
|
|
@@ -114,7 +120,7 @@ export function ReactDemo({
|
|
|
114
120
|
cancelled = true
|
|
115
121
|
workspace?.dispose()
|
|
116
122
|
}
|
|
117
|
-
}, [entry, files, onError, onReady, port, run])
|
|
123
|
+
}, [entry, files, onError, onReady, port, run, workspaceOptions])
|
|
118
124
|
|
|
119
125
|
const wrapperClass = className ? `docs-react-demo ${className}` : "docs-react-demo"
|
|
120
126
|
const running = state === "starting"
|