dreamboard 0.1.21 → 0.1.22
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/{chunk-EYYWGWTO.js → chunk-2RCUHMGL.js} +343 -1911
- package/dist/chunk-2RCUHMGL.js.map +1 -0
- package/dist/{chunk-MOVHYB6E.js → chunk-AQ5UUNJS.js} +1018 -692
- package/dist/chunk-AQ5UUNJS.js.map +1 -0
- package/dist/{chunk-BMYC6772.js → chunk-H3O43F5P.js} +9765 -3068
- package/dist/chunk-H3O43F5P.js.map +1 -0
- package/dist/dev-host/dev-api-proxy-plugin.ts +330 -0
- package/dist/dev-host/dev-diagnostics.ts +62 -0
- package/dist/dev-host/dev-fallback-stylesheet.ts +50 -0
- package/dist/dev-host/dev-host-controller.ts +686 -0
- package/dist/dev-host/dev-host-player-query.ts +17 -0
- package/dist/dev-host/dev-host-session-transport.ts +52 -0
- package/dist/dev-host/dev-host-storage.ts +56 -0
- package/dist/dev-host/dev-log-relay-plugin.ts +469 -0
- package/dist/dev-host/dev-runtime-config.ts +14 -0
- package/dist/dev-host/dev-runtime-platform.ts +419 -0
- package/dist/dev-host/dev-virtual-modules-plugin.ts +63 -0
- package/dist/dev-host/host-main.css +182 -0
- package/dist/dev-host/host-main.tsx +754 -0
- package/dist/dev-host/index.html +56 -0
- package/dist/dev-host/plugin-main.ts +55 -0
- package/dist/dev-host/plugin.html +24 -0
- package/dist/dev-host/start-dev-server.ts +138 -0
- package/dist/dev-host/virtual-modules.d.ts +27 -0
- package/dist/dist-FEPN3BDN.js +16543 -0
- package/dist/dist-FEPN3BDN.js.map +1 -0
- package/dist/{dist-WJRJNFLI.js → dist-FRURQI7Q.js} +4 -2
- package/dist/index.js +3 -3
- package/dist/internal.js +159 -124
- package/dist/internal.js.map +1 -1
- package/dist/runtime-packages/tailwind-config/shared-styles.css +146 -0
- package/dist/runtime-packages/ui/src/components/.gitkeep +0 -0
- package/dist/runtime-packages/ui/src/components/accordion.tsx +66 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/actions.tsx +65 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/artifact.tsx +147 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/branch.tsx +215 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/canvas.tsx +22 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/chain-of-thought.tsx +228 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/code-block.tsx +179 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/confirmation.tsx +158 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/connection.tsx +28 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/context.tsx +408 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/controls.tsx +18 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/conversation.tsx +97 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/edge.tsx +140 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/image.tsx +24 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/inline-citation.tsx +287 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/loader.tsx +96 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/message.tsx +463 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/node.tsx +71 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/open-in-chat.tsx +365 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/panel.tsx +15 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/plan.tsx +142 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/prompt-input.tsx +1380 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/queue.tsx +274 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/reasoning.tsx +182 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/response.tsx +22 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/shimmer.tsx +64 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/sources.tsx +77 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/suggestion.tsx +53 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/task.tsx +87 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/tool.tsx +165 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/toolbar.tsx +16 -0
- package/dist/runtime-packages/ui/src/components/ai-elements/web-preview.tsx +263 -0
- package/dist/runtime-packages/ui/src/components/alert-dialog.tsx +157 -0
- package/dist/runtime-packages/ui/src/components/alert.tsx +66 -0
- package/dist/runtime-packages/ui/src/components/avatar.tsx +53 -0
- package/dist/runtime-packages/ui/src/components/badge.tsx +46 -0
- package/dist/runtime-packages/ui/src/components/button-group.tsx +83 -0
- package/dist/runtime-packages/ui/src/components/button.tsx +65 -0
- package/dist/runtime-packages/ui/src/components/card.tsx +92 -0
- package/dist/runtime-packages/ui/src/components/carousel.tsx +241 -0
- package/dist/runtime-packages/ui/src/components/collapsible.tsx +33 -0
- package/dist/runtime-packages/ui/src/components/command.tsx +184 -0
- package/dist/runtime-packages/ui/src/components/context-menu.tsx +252 -0
- package/dist/runtime-packages/ui/src/components/counter.tsx +11 -0
- package/dist/runtime-packages/ui/src/components/dialog.tsx +146 -0
- package/dist/runtime-packages/ui/src/components/drawer.tsx +132 -0
- package/dist/runtime-packages/ui/src/components/dropdown-menu.tsx +257 -0
- package/dist/runtime-packages/ui/src/components/form.tsx +168 -0
- package/dist/runtime-packages/ui/src/components/header.tsx +13 -0
- package/dist/runtime-packages/ui/src/components/hover-card.tsx +44 -0
- package/dist/runtime-packages/ui/src/components/input-group.tsx +178 -0
- package/dist/runtime-packages/ui/src/components/input.tsx +21 -0
- package/dist/runtime-packages/ui/src/components/item.tsx +193 -0
- package/dist/runtime-packages/ui/src/components/label.tsx +24 -0
- package/dist/runtime-packages/ui/src/components/navigation-menu.tsx +168 -0
- package/dist/runtime-packages/ui/src/components/popover.tsx +55 -0
- package/dist/runtime-packages/ui/src/components/progress.tsx +31 -0
- package/dist/runtime-packages/ui/src/components/radio-group.tsx +45 -0
- package/dist/runtime-packages/ui/src/components/resizable.tsx +56 -0
- package/dist/runtime-packages/ui/src/components/scroll-area.tsx +58 -0
- package/dist/runtime-packages/ui/src/components/select.tsx +187 -0
- package/dist/runtime-packages/ui/src/components/separator.tsx +28 -0
- package/dist/runtime-packages/ui/src/components/skeleton.tsx +13 -0
- package/dist/runtime-packages/ui/src/components/sonner.tsx +25 -0
- package/dist/runtime-packages/ui/src/components/spinner.tsx +16 -0
- package/dist/runtime-packages/ui/src/components/switch.tsx +31 -0
- package/dist/runtime-packages/ui/src/components/table.tsx +137 -0
- package/dist/runtime-packages/ui/src/components/tabs.tsx +74 -0
- package/dist/runtime-packages/ui/src/components/textarea.tsx +23 -0
- package/dist/runtime-packages/ui/src/components/theme-provider.tsx +73 -0
- package/dist/runtime-packages/ui/src/components/tooltip.tsx +61 -0
- package/dist/runtime-packages/ui/src/components/ui/file-upload.tsx +195 -0
- package/dist/runtime-packages/ui/src/hooks/.gitkeep +0 -0
- package/dist/runtime-packages/ui/src/index.ts +68 -0
- package/dist/runtime-packages/ui/src/lib/utils.ts +6 -0
- package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +68 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +359 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +274 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +214 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +135 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +5 -0
- package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +194 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +1 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +1 -0
- package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +162 -0
- package/dist/runtime-packages/ui-host-runtime/src/index.ts +2 -0
- package/dist/runtime-packages/ui-host-runtime/src/logger.ts +11 -0
- package/dist/runtime-packages/ui-host-runtime/src/perf.ts +253 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +195 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +138 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +159 -0
- package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +524 -0
- package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +12 -0
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +122 -0
- package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +26 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +477 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +209 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +112 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +318 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +211 -0
- package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +814 -0
- package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +334 -0
- package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +180 -0
- package/dist/scaffold/assets/static/app/tsconfig.framework.json +3 -1
- package/dist/scaffold/assets/static/ui/tsconfig.framework.json +7 -19
- package/package.json +52 -17
- package/skills/dreamboard/SKILL.md +41 -75
- package/LICENSE +0 -89
- package/NOTICE +0 -1
- package/dist/chunk-BMYC6772.js.map +0 -1
- package/dist/chunk-EYYWGWTO.js.map +0 -1
- package/dist/chunk-MOVHYB6E.js.map +0 -1
- package/dist/scaffold/assets/static/ui/App.tsx +0 -22
- package/dist/src-CUL7EGGG.js +0 -634
- package/dist/src-CUL7EGGG.js.map +0 -1
- package/skills/dreamboard/references/authoring-lifecycle.md +0 -102
- package/skills/dreamboard/references/board-surfaces.md +0 -36
- package/skills/dreamboard/references/board-topology.md +0 -443
- package/skills/dreamboard/references/boards-and-topology.md +0 -100
- package/skills/dreamboard/references/card-actions.md +0 -107
- package/skills/dreamboard/references/cli.md +0 -120
- package/skills/dreamboard/references/core-concepts.md +0 -514
- package/skills/dreamboard/references/custom-renderers.md +0 -26
- package/skills/dreamboard/references/derived-values.md +0 -55
- package/skills/dreamboard/references/effects.md +0 -111
- package/skills/dreamboard/references/game-contract.md +0 -89
- package/skills/dreamboard/references/game-definition.md +0 -89
- package/skills/dreamboard/references/game-shell.md +0 -80
- package/skills/dreamboard/references/hand-surfaces.md +0 -33
- package/skills/dreamboard/references/index.md +0 -112
- package/skills/dreamboard/references/inputs-and-targets.md +0 -160
- package/skills/dreamboard/references/interactions.md +0 -158
- package/skills/dreamboard/references/manifest-fields.md +0 -137
- package/skills/dreamboard/references/manifest.md +0 -81
- package/skills/dreamboard/references/package-surfaces.md +0 -69
- package/skills/dreamboard/references/phases.md +0 -145
- package/skills/dreamboard/references/prompts-and-choices.md +0 -55
- package/skills/dreamboard/references/quickstart.md +0 -71
- package/skills/dreamboard/references/rule-authoring.md +0 -144
- package/skills/dreamboard/references/setup-bootstrap.md +0 -78
- package/skills/dreamboard/references/stages-and-zones.md +0 -59
- package/skills/dreamboard/references/static-views.md +0 -67
- package/skills/dreamboard/references/table-queries-and-ops.md +0 -103
- package/skills/dreamboard/references/testing-bases.md +0 -147
- package/skills/dreamboard/references/testing-generated-contracts.md +0 -142
- package/skills/dreamboard/references/testing-runtime-assertions.md +0 -124
- package/skills/dreamboard/references/testing-scenarios.md +0 -148
- package/skills/dreamboard/references/testing-ui-tests.md +0 -174
- package/skills/dreamboard/references/testing.md +0 -161
- package/skills/dreamboard/references/ui-architecture.md +0 -137
- package/skills/dreamboard/references/ui-components.md +0 -34
- package/skills/dreamboard/references/views.md +0 -72
- package/skills/dreamboard/references/workspace-layout.md +0 -136
- /package/dist/{dist-WJRJNFLI.js.map → dist-FRURQI7Q.js.map} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link
|
|
7
|
+
rel="icon"
|
|
8
|
+
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23f59e0b'/%3E%3Ctext x='32' y='41' font-size='28' text-anchor='middle' fill='%23231f20' font-family='Arial,sans-serif'%3EDB%3C/text%3E%3C/svg%3E"
|
|
9
|
+
/>
|
|
10
|
+
<title>Dreamboard Dev</title>
|
|
11
|
+
<style>
|
|
12
|
+
:root {
|
|
13
|
+
color-scheme: light;
|
|
14
|
+
font-family:
|
|
15
|
+
ui-sans-serif,
|
|
16
|
+
system-ui,
|
|
17
|
+
-apple-system,
|
|
18
|
+
BlinkMacSystemFont,
|
|
19
|
+
"Segoe UI",
|
|
20
|
+
sans-serif;
|
|
21
|
+
background: #f5f1e7;
|
|
22
|
+
color: #1f2937;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
* {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
html,
|
|
30
|
+
body,
|
|
31
|
+
#app {
|
|
32
|
+
height: 100%;
|
|
33
|
+
margin: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body {
|
|
37
|
+
background:
|
|
38
|
+
radial-gradient(
|
|
39
|
+
circle at top left,
|
|
40
|
+
rgba(255, 255, 255, 0.8),
|
|
41
|
+
transparent 35%
|
|
42
|
+
),
|
|
43
|
+
linear-gradient(180deg, #f5f1e7 0%, #efe7d6 100%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#app {
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-rows: auto 1fr;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
51
|
+
</head>
|
|
52
|
+
<body>
|
|
53
|
+
<div id="app"></div>
|
|
54
|
+
<script type="module" src="/host-main.tsx"></script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import devConfig from "virtual:dreamboard-dev-config";
|
|
2
|
+
import { stringifyForRelay } from "./dev-diagnostics.js";
|
|
3
|
+
|
|
4
|
+
installPluginConsoleRelay();
|
|
5
|
+
|
|
6
|
+
void import("virtual:dreamboard-project-entry").catch((error: unknown) => {
|
|
7
|
+
console.error("[dreamboard-dev] Failed to load project entry.", error);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function installPluginConsoleRelay(): void {
|
|
11
|
+
const relay = (level: "log" | "warn" | "error", args: unknown[]): void => {
|
|
12
|
+
try {
|
|
13
|
+
window.parent.postMessage(
|
|
14
|
+
{
|
|
15
|
+
type: "dreamboard-dev-console",
|
|
16
|
+
level,
|
|
17
|
+
message: args.map((value) => stringifyForRelay(value)).join(" "),
|
|
18
|
+
},
|
|
19
|
+
"*",
|
|
20
|
+
);
|
|
21
|
+
} catch {
|
|
22
|
+
// Ignore logging failures in the dev iframe.
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const original = {
|
|
27
|
+
log: console.log.bind(console),
|
|
28
|
+
warn: console.warn.bind(console),
|
|
29
|
+
error: console.error.bind(console),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
console.log = (...args: unknown[]) => {
|
|
33
|
+
original.log(...args);
|
|
34
|
+
if (devConfig.debug) {
|
|
35
|
+
relay("log", args);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
console.warn = (...args: unknown[]) => {
|
|
39
|
+
original.warn(...args);
|
|
40
|
+
if (devConfig.debug) {
|
|
41
|
+
relay("warn", args);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
console.error = (...args: unknown[]) => {
|
|
45
|
+
original.error(...args);
|
|
46
|
+
relay("error", args);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
window.addEventListener("error", (event) => {
|
|
50
|
+
relay("error", [`window.error ${event.message}`]);
|
|
51
|
+
});
|
|
52
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
53
|
+
relay("error", ["unhandledrejection", event.reason]);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link
|
|
7
|
+
rel="icon"
|
|
8
|
+
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%23f59e0b'/%3E%3Ctext x='32' y='41' font-size='28' text-anchor='middle' fill='%23231f20' font-family='Arial,sans-serif'%3EDB%3C/text%3E%3C/svg%3E"
|
|
9
|
+
/>
|
|
10
|
+
<title>Dreamboard Plugin</title>
|
|
11
|
+
<style>
|
|
12
|
+
html,
|
|
13
|
+
body,
|
|
14
|
+
#root {
|
|
15
|
+
height: 100%;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div id="root"></div>
|
|
22
|
+
<script type="module" src="/plugin-main.ts"></script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import react from "@vitejs/plugin-react";
|
|
5
|
+
import tailwindcssPostcss from "@tailwindcss/postcss";
|
|
6
|
+
import { createServer, type ViteDevServer } from "vite";
|
|
7
|
+
import type { ResolvedConfig } from "../types.js";
|
|
8
|
+
import { createDevApiProxyPlugin } from "./dev-api-proxy-plugin.js";
|
|
9
|
+
import { createDevRuntimePlatform } from "./dev-runtime-platform.js";
|
|
10
|
+
import { createVirtualDevModulesPlugin } from "./dev-virtual-modules-plugin.js";
|
|
11
|
+
import { createDevLogRelayPlugin } from "./dev-log-relay-plugin.js";
|
|
12
|
+
import { prepareFallbackStylesheet } from "./dev-fallback-stylesheet.js";
|
|
13
|
+
import type { DreamboardDevRuntimeConfig } from "./dev-runtime-config.js";
|
|
14
|
+
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const tailwindCssEntry = require.resolve("tailwindcss/index.css");
|
|
17
|
+
|
|
18
|
+
export type { DreamboardDevRuntimeConfig } from "./dev-runtime-config.js";
|
|
19
|
+
|
|
20
|
+
export async function startDreamboardDevServer(options: {
|
|
21
|
+
projectRoot: string;
|
|
22
|
+
sessionFilePath: string;
|
|
23
|
+
port?: number;
|
|
24
|
+
host?: string | boolean;
|
|
25
|
+
allowedHosts?: string[];
|
|
26
|
+
runtimeConfig: DreamboardDevRuntimeConfig;
|
|
27
|
+
config: ResolvedConfig;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
url: string;
|
|
30
|
+
networkUrls: string[];
|
|
31
|
+
close: () => Promise<void>;
|
|
32
|
+
server: ViteDevServer;
|
|
33
|
+
}> {
|
|
34
|
+
const { projectRoot, port, host, allowedHosts, runtimeConfig, config } =
|
|
35
|
+
options;
|
|
36
|
+
const platform = createDevRuntimePlatform({
|
|
37
|
+
importMetaUrl: import.meta.url,
|
|
38
|
+
projectRoot,
|
|
39
|
+
debug: runtimeConfig.debug,
|
|
40
|
+
port,
|
|
41
|
+
host,
|
|
42
|
+
allowedHosts,
|
|
43
|
+
tailwindCssEntry,
|
|
44
|
+
});
|
|
45
|
+
const generatedFallbackStylesheetPath = prepareFallbackStylesheet({
|
|
46
|
+
projectRoot,
|
|
47
|
+
repoRoot: platform.repoRoot,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const server = await createServer({
|
|
51
|
+
root: platform.devHostRoot,
|
|
52
|
+
appType: "spa",
|
|
53
|
+
plugins: [
|
|
54
|
+
react(),
|
|
55
|
+
createVirtualDevModulesPlugin({
|
|
56
|
+
projectRoot,
|
|
57
|
+
runtimeConfig,
|
|
58
|
+
generatedFallbackStylesheetPath,
|
|
59
|
+
}),
|
|
60
|
+
createDevApiProxyPlugin({ config }),
|
|
61
|
+
createDevLogRelayPlugin({
|
|
62
|
+
sessionFilePath: options.sessionFilePath,
|
|
63
|
+
runtimeConfig,
|
|
64
|
+
config,
|
|
65
|
+
diagnosticsLevel: platform.diagnosticsLevel,
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
css: {
|
|
69
|
+
postcss: {
|
|
70
|
+
plugins: [tailwindcssPostcss()],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
logLevel: platform.viteLogLevel,
|
|
74
|
+
resolve: {
|
|
75
|
+
dedupe: platform.resolveDedupe,
|
|
76
|
+
alias: platform.resolveAlias,
|
|
77
|
+
},
|
|
78
|
+
optimizeDeps: {
|
|
79
|
+
exclude: platform.optimizeDepsExclude,
|
|
80
|
+
},
|
|
81
|
+
server: platform.serverConfig,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
await server.listen();
|
|
85
|
+
const resolvedPort = getBoundPort(server);
|
|
86
|
+
const url = `http://localhost:${resolvedPort}/index.html`;
|
|
87
|
+
return {
|
|
88
|
+
url,
|
|
89
|
+
networkUrls: getNetworkUrls(host, resolvedPort),
|
|
90
|
+
close: async () => {
|
|
91
|
+
await server.close();
|
|
92
|
+
if (generatedFallbackStylesheetPath) {
|
|
93
|
+
rmSync(generatedFallbackStylesheetPath, { force: true });
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
server,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getNetworkUrls(
|
|
101
|
+
host: string | boolean | undefined,
|
|
102
|
+
port: number,
|
|
103
|
+
): string[] {
|
|
104
|
+
if (!host) return [];
|
|
105
|
+
if (typeof host === "string" && isLoopbackHost(host)) return [];
|
|
106
|
+
|
|
107
|
+
const hosts =
|
|
108
|
+
host === true || host === "0.0.0.0" || host === "::"
|
|
109
|
+
? getLanIpv4Addresses()
|
|
110
|
+
: [host];
|
|
111
|
+
|
|
112
|
+
return hosts.map(
|
|
113
|
+
(value) => `http://${formatUrlHost(value)}:${port}/index.html`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function isLoopbackHost(host: string): boolean {
|
|
118
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function getLanIpv4Addresses(): string[] {
|
|
122
|
+
return Object.values(os.networkInterfaces())
|
|
123
|
+
.flatMap((interfaces) => interfaces ?? [])
|
|
124
|
+
.filter((details) => details.family === "IPv4" && !details.internal)
|
|
125
|
+
.map((details) => details.address);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function formatUrlHost(host: string): string {
|
|
129
|
+
return host.includes(":") ? `[${host}]` : host;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function getBoundPort(server: ViteDevServer): number {
|
|
133
|
+
const address = server.httpServer?.address();
|
|
134
|
+
if (!address || typeof address === "string") {
|
|
135
|
+
throw new Error("Failed to determine local dev server port.");
|
|
136
|
+
}
|
|
137
|
+
return address.port;
|
|
138
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare module "virtual:dreamboard-dev-config" {
|
|
2
|
+
export interface DreamboardDevConfig {
|
|
3
|
+
apiBaseUrl: string;
|
|
4
|
+
userId: string | null;
|
|
5
|
+
gameId: string;
|
|
6
|
+
compiledResultId: string;
|
|
7
|
+
setupProfileId: string | null;
|
|
8
|
+
playerCount: number;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
slug: string;
|
|
11
|
+
autoStartGame: boolean;
|
|
12
|
+
initialSession: {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
shortCode: string;
|
|
15
|
+
gameId: string;
|
|
16
|
+
seed: number | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const config: DreamboardDevConfig;
|
|
21
|
+
export default config;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module "virtual:dreamboard-project-entry" {
|
|
25
|
+
const projectEntry: unknown;
|
|
26
|
+
export default projectEntry;
|
|
27
|
+
}
|