@dreamboard-games/cli 0.1.30-alpha.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.
Files changed (134) hide show
  1. package/README.md +50 -0
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs +227 -0
  3. package/dist/agent-verifier/chunk-2E5P5NWG.mjs +835 -0
  4. package/dist/agent-verifier/chunk-2GBBP27W.mjs +301 -0
  5. package/dist/agent-verifier/chunk-2NZNKIND.mjs +166 -0
  6. package/dist/agent-verifier/chunk-2QMNAVV4.mjs +14522 -0
  7. package/dist/agent-verifier/chunk-2SZHMP6F.mjs +264 -0
  8. package/dist/agent-verifier/chunk-54TAYXUD.mjs +12 -0
  9. package/dist/agent-verifier/chunk-6A5HRJMQ.mjs +3174 -0
  10. package/dist/agent-verifier/chunk-6UUJEYDV.mjs +213 -0
  11. package/dist/agent-verifier/chunk-7653FPGJ.mjs +381 -0
  12. package/dist/agent-verifier/chunk-BVVNBJM4.mjs +221 -0
  13. package/dist/agent-verifier/chunk-CEDUHGNH.mjs +74 -0
  14. package/dist/agent-verifier/chunk-CEQ2VJWN.mjs +149 -0
  15. package/dist/agent-verifier/chunk-CFU5EWIC.mjs +69 -0
  16. package/dist/agent-verifier/chunk-DTMJCPS4.mjs +730 -0
  17. package/dist/agent-verifier/chunk-EIQWDQWJ.mjs +186 -0
  18. package/dist/agent-verifier/chunk-EOQIV6PS.mjs +649 -0
  19. package/dist/agent-verifier/chunk-HBNDKQT5.mjs +8381 -0
  20. package/dist/agent-verifier/chunk-HJFQDSTU.mjs +225 -0
  21. package/dist/agent-verifier/chunk-LI3ZR3BI.mjs +41 -0
  22. package/dist/agent-verifier/chunk-LM3OZLZG.mjs +48 -0
  23. package/dist/agent-verifier/chunk-MINCYHXN.mjs +106 -0
  24. package/dist/agent-verifier/chunk-MRCUP5SW.mjs +128 -0
  25. package/dist/agent-verifier/chunk-PM3SVG6R.mjs +38 -0
  26. package/dist/agent-verifier/chunk-RBDDIIPM.mjs +19 -0
  27. package/dist/agent-verifier/chunk-RJBLBYHX.mjs +1681 -0
  28. package/dist/agent-verifier/chunk-SHUMAVAP.mjs +59 -0
  29. package/dist/agent-verifier/chunk-SYPLYRGB.mjs +2812 -0
  30. package/dist/agent-verifier/chunk-U6OJN7XS.mjs +8092 -0
  31. package/dist/agent-verifier/chunk-VYJTHSYR.mjs +44 -0
  32. package/dist/agent-verifier/chunk-XYDL7GY6.mjs +10 -0
  33. package/dist/agent-verifier/compile-WNCQQVOF.mjs +313 -0
  34. package/dist/agent-verifier/global-config-WX3ZZIVU.mjs +17 -0
  35. package/dist/agent-verifier/keychain-backend-TNOPQV3Z.mjs +134 -0
  36. package/dist/agent-verifier/local-files-MTPLP62S.mjs +46 -0
  37. package/dist/agent-verifier/local-typecheck-QFYYAZOK.mjs +9 -0
  38. package/dist/agent-verifier/materialize-workspace-EWGZIVOY.mjs +90 -0
  39. package/dist/agent-verifier/project-state-7GR6BQTQ.mjs +32 -0
  40. package/dist/agent-verifier/prompt-3BAINGAQ.mjs +755 -0
  41. package/dist/agent-verifier/reducer-bundle-preflight-C73LEXI2.mjs +23 -0
  42. package/dist/agent-verifier/reducer-contract-preflight-22X7DSZW.mjs +10 -0
  43. package/dist/agent-verifier/reducer-native-test-harness-GMWBUISX.mjs +53 -0
  44. package/dist/agent-verifier/static-scaffold-4YEQME5N.mjs +28 -0
  45. package/dist/agent-verifier/sync-LOQAH4RC.mjs +594 -0
  46. package/dist/agent-verifier/test-YOJERVHN.mjs +356 -0
  47. package/dist/agent-verifier/testing-5K2BJYF2.mjs +674 -0
  48. package/dist/agent-verifier/workspace-codegen-JDZJRSDV.mjs +11 -0
  49. package/dist/agent-verifier/workspace-dependencies-HZ6VVS4G.mjs +14 -0
  50. package/dist/chunk-2H7UOFLK.js +11 -0
  51. package/dist/chunk-2H7UOFLK.js.map +1 -0
  52. package/dist/chunk-3XNJT3RK.js +39809 -0
  53. package/dist/chunk-3XNJT3RK.js.map +1 -0
  54. package/dist/chunk-7FOO4AJI.js +50 -0
  55. package/dist/chunk-7FOO4AJI.js.map +1 -0
  56. package/dist/chunk-TSJVWTJO.js +430 -0
  57. package/dist/chunk-TSJVWTJO.js.map +1 -0
  58. package/dist/dev-host/components/drawer.tsx +132 -0
  59. package/dist/dev-host/components/input.tsx +21 -0
  60. package/dist/dev-host/dev-api-proxy-plugin.ts +328 -0
  61. package/dist/dev-host/dev-author-dom-warnings.ts +100 -0
  62. package/dist/dev-host/dev-diagnostics.ts +62 -0
  63. package/dist/dev-host/dev-fallback-stylesheet.ts +53 -0
  64. package/dist/dev-host/dev-hmr-guard-plugin.ts +47 -0
  65. package/dist/dev-host/dev-host-controller.ts +674 -0
  66. package/dist/dev-host/dev-host-player-query.ts +17 -0
  67. package/dist/dev-host/dev-host-session-transport.ts +52 -0
  68. package/dist/dev-host/dev-host-storage.ts +56 -0
  69. package/dist/dev-host/dev-log-relay-plugin.ts +510 -0
  70. package/dist/dev-host/dev-runtime-config.ts +14 -0
  71. package/dist/dev-host/dev-runtime-platform.ts +335 -0
  72. package/dist/dev-host/dev-virtual-modules-plugin.ts +64 -0
  73. package/dist/dev-host/host-main.css +224 -0
  74. package/dist/dev-host/host-main.tsx +948 -0
  75. package/dist/dev-host/index.html +56 -0
  76. package/dist/dev-host/lib/utils.ts +6 -0
  77. package/dist/dev-host/plugin-main.ts +61 -0
  78. package/dist/dev-host/plugin.html +24 -0
  79. package/dist/dev-host/shared-styles.css +144 -0
  80. package/dist/dev-host/start-dev-server.ts +140 -0
  81. package/dist/dev-host/virtual-modules.d.ts +27 -0
  82. package/dist/global-config-UKSWNDTX.js +15 -0
  83. package/dist/global-config-UKSWNDTX.js.map +1 -0
  84. package/dist/index.js +8473 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/internal.d.ts +311 -0
  87. package/dist/internal.js +52 -0
  88. package/dist/internal.js.map +1 -0
  89. package/dist/keychain-backend-JHTXAKWC.js +135 -0
  90. package/dist/keychain-backend-JHTXAKWC.js.map +1 -0
  91. package/dist/prompt-GMZABCJC.js +756 -0
  92. package/dist/prompt-GMZABCJC.js.map +1 -0
  93. package/dist/runtime-packages/ui-host-runtime/src/actor-principal.ts +71 -0
  94. package/dist/runtime-packages/ui-host-runtime/src/browser-interaction.ts +139 -0
  95. package/dist/runtime-packages/ui-host-runtime/src/components/host-controls.tsx +374 -0
  96. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback-toaster.tsx +266 -0
  97. package/dist/runtime-packages/ui-host-runtime/src/components/host-feedback.tsx +212 -0
  98. package/dist/runtime-packages/ui-host-runtime/src/components/host-primitives.tsx +271 -0
  99. package/dist/runtime-packages/ui-host-runtime/src/components/host-session-metadata.tsx +135 -0
  100. package/dist/runtime-packages/ui-host-runtime/src/components/index.ts +5 -0
  101. package/dist/runtime-packages/ui-host-runtime/src/components/perf-overlay.tsx +194 -0
  102. package/dist/runtime-packages/ui-host-runtime/src/gameplay-authority-transport.ts +626 -0
  103. package/dist/runtime-packages/ui-host-runtime/src/host-controls.tsx +1 -0
  104. package/dist/runtime-packages/ui-host-runtime/src/host-feedback.tsx +1 -0
  105. package/dist/runtime-packages/ui-host-runtime/src/host-session-transport.ts +294 -0
  106. package/dist/runtime-packages/ui-host-runtime/src/index.ts +3 -0
  107. package/dist/runtime-packages/ui-host-runtime/src/logger.ts +11 -0
  108. package/dist/runtime-packages/ui-host-runtime/src/perf.ts +324 -0
  109. package/dist/runtime-packages/ui-host-runtime/src/plugin-bridge.ts +195 -0
  110. package/dist/runtime-packages/ui-host-runtime/src/plugin-health-check.ts +138 -0
  111. package/dist/runtime-packages/ui-host-runtime/src/plugin-messages.ts +159 -0
  112. package/dist/runtime-packages/ui-host-runtime/src/plugin-session-gateway.ts +551 -0
  113. package/dist/runtime-packages/ui-host-runtime/src/runtime/index.ts +13 -0
  114. package/dist/runtime-packages/ui-host-runtime/src/screenshot/projection-to-snapshot.ts +122 -0
  115. package/dist/runtime-packages/ui-host-runtime/src/screenshot/static-store-api.ts +26 -0
  116. package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +583 -0
  117. package/dist/runtime-packages/ui-host-runtime/src/session-ingress.ts +219 -0
  118. package/dist/runtime-packages/ui-host-runtime/src/session-live-runtime.ts +117 -0
  119. package/dist/runtime-packages/ui-host-runtime/src/session-model.ts +431 -0
  120. package/dist/runtime-packages/ui-host-runtime/src/session-projection.ts +211 -0
  121. package/dist/runtime-packages/ui-host-runtime/src/session-recovery.ts +80 -0
  122. package/dist/runtime-packages/ui-host-runtime/src/session-state-reducer.ts +1034 -0
  123. package/dist/runtime-packages/ui-host-runtime/src/sse-manager.ts +416 -0
  124. package/dist/runtime-packages/ui-host-runtime/src/unified-session-store.ts +184 -0
  125. package/dist/scaffold/assets/static/app/tsconfig.framework.json +26 -0
  126. package/dist/scaffold/assets/static/app/tsconfig.json +3 -0
  127. package/dist/scaffold/assets/static/ui/index.tsx +13 -0
  128. package/dist/scaffold/assets/static/ui/style.css +4 -0
  129. package/dist/scaffold/assets/static/ui/tsconfig.framework.json +19 -0
  130. package/dist/scaffold/assets/static/ui/tsconfig.json +5 -0
  131. package/dist/testing-KLSV6CPJ.js +674 -0
  132. package/dist/testing-KLSV6CPJ.js.map +1 -0
  133. package/package.json +72 -0
  134. package/skills/dreamboard/SKILL.md +130 -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,6 @@
1
+ import { clsx, type ClassValue } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -0,0 +1,61 @@
1
+ import devConfig from "virtual:dreamboard-dev-config";
2
+ import { stringifyForRelay } from "./dev-diagnostics.js";
3
+ import { installPlayableZoneItemWarnings } from "./dev-author-dom-warnings.js";
4
+
5
+ installPluginConsoleRelay();
6
+ const disposePlayableZoneWarnings = installPlayableZoneItemWarnings();
7
+
8
+ void import("virtual:dreamboard-project-entry").catch((error: unknown) => {
9
+ console.error("[dreamboard-dev] Failed to load project entry.", error);
10
+ });
11
+
12
+ if (import.meta.hot) {
13
+ import.meta.hot.dispose(() => {
14
+ disposePlayableZoneWarnings();
15
+ });
16
+ }
17
+
18
+ function installPluginConsoleRelay(): void {
19
+ const relay = (level: "log" | "warn" | "error", args: unknown[]): void => {
20
+ try {
21
+ window.parent.postMessage(
22
+ {
23
+ type: "dreamboard-dev-console",
24
+ level,
25
+ message: args.map((value) => stringifyForRelay(value)).join(" "),
26
+ },
27
+ "*",
28
+ );
29
+ } catch {
30
+ // Ignore logging failures in the dev iframe.
31
+ }
32
+ };
33
+
34
+ const original = {
35
+ log: console.log.bind(console),
36
+ warn: console.warn.bind(console),
37
+ error: console.error.bind(console),
38
+ };
39
+
40
+ console.log = (...args: unknown[]) => {
41
+ original.log(...args);
42
+ if (devConfig.debug) {
43
+ relay("log", args);
44
+ }
45
+ };
46
+ console.warn = (...args: unknown[]) => {
47
+ original.warn(...args);
48
+ relay("warn", args);
49
+ };
50
+ console.error = (...args: unknown[]) => {
51
+ original.error(...args);
52
+ relay("error", args);
53
+ };
54
+
55
+ window.addEventListener("error", (event) => {
56
+ relay("error", [`window.error ${event.message}`]);
57
+ });
58
+ window.addEventListener("unhandledrejection", (event) => {
59
+ relay("error", ["unhandledrejection", event.reason]);
60
+ });
61
+ }
@@ -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,144 @@
1
+ @import "tailwindcss";
2
+ @import "tw-animate-css";
3
+
4
+ @source "./**/*.{ts,tsx}";
5
+ @source "../runtime-packages/ui-host-runtime/src/**/*.{ts,tsx}";
6
+
7
+ :root {
8
+ --background: oklch(0.98 0.005 220);
9
+ --foreground: oklch(0.22 0.03 220);
10
+ --card: oklch(1 0 0);
11
+ --card-foreground: oklch(0.22 0.03 220);
12
+ --popover: oklch(1 0 0);
13
+ --popover-foreground: oklch(0.22 0.03 220);
14
+ --primary: oklch(0.45 0.15 165);
15
+ --primary-foreground: oklch(0.98 0.005 165);
16
+ --secondary: oklch(0.94 0.01 220);
17
+ --secondary-foreground: oklch(0.28 0.03 220);
18
+ --muted: oklch(0.94 0.01 220);
19
+ --muted-foreground: oklch(0.50 0.03 220);
20
+ --accent: oklch(0.94 0.01 220);
21
+ --accent-foreground: oklch(0.28 0.03 220);
22
+ --destructive: oklch(0.55 0.22 25);
23
+ --destructive-foreground: oklch(0.55 0.22 25);
24
+ --border: oklch(0.87 0.02 220);
25
+ --input: oklch(0.87 0.02 220);
26
+ --ring: oklch(0.45 0.15 165);
27
+ --chart-1: oklch(0.45 0.15 165);
28
+ --chart-2: oklch(0.55 0.12 200);
29
+ --chart-3: oklch(0.60 0.15 40);
30
+ --chart-4: oklch(0.75 0.14 80);
31
+ --chart-5: oklch(0.60 0.12 280);
32
+ --radius: 0.625rem;
33
+ --sidebar: oklch(0.96 0.008 220);
34
+ --sidebar-foreground: oklch(0.22 0.03 220);
35
+ --sidebar-primary: oklch(0.45 0.15 165);
36
+ --sidebar-primary-foreground: oklch(0.98 0.005 165);
37
+ --sidebar-accent: oklch(0.94 0.01 220);
38
+ --sidebar-accent-foreground: oklch(0.28 0.03 220);
39
+ --sidebar-border: oklch(0.87 0.02 220);
40
+ --sidebar-ring: oklch(0.45 0.15 165);
41
+ }
42
+
43
+ .dark {
44
+ --background: oklch(0.16 0.02 230);
45
+ --foreground: oklch(0.93 0.01 220);
46
+ --card: oklch(0.20 0.025 230);
47
+ --card-foreground: oklch(0.93 0.01 220);
48
+ --popover: oklch(0.20 0.025 230);
49
+ --popover-foreground: oklch(0.93 0.01 220);
50
+ --primary: oklch(0.70 0.17 162);
51
+ --primary-foreground: oklch(0.15 0.02 165);
52
+ --secondary: oklch(0.25 0.03 230);
53
+ --secondary-foreground: oklch(0.90 0.01 220);
54
+ --muted: oklch(0.25 0.03 230);
55
+ --muted-foreground: oklch(0.58 0.03 220);
56
+ --accent: oklch(0.35 0.06 165);
57
+ --accent-foreground: oklch(0.93 0.01 220);
58
+ --destructive: oklch(0.45 0.18 350);
59
+ --destructive-foreground: oklch(0.65 0.22 350);
60
+ --border: oklch(0.28 0.03 230);
61
+ --input: oklch(0.28 0.03 230);
62
+ --ring: oklch(0.70 0.17 162);
63
+ --chart-1: oklch(0.70 0.17 162);
64
+ --chart-2: oklch(0.65 0.12 200);
65
+ --chart-3: oklch(0.72 0.12 40);
66
+ --chart-4: oklch(0.80 0.14 80);
67
+ --chart-5: oklch(0.70 0.15 280);
68
+ --sidebar: oklch(0.18 0.025 230);
69
+ --sidebar-foreground: oklch(0.93 0.01 220);
70
+ --sidebar-primary: oklch(0.70 0.17 162);
71
+ --sidebar-primary-foreground: oklch(0.15 0.02 165);
72
+ --sidebar-accent: oklch(0.25 0.03 230);
73
+ --sidebar-accent-foreground: oklch(0.93 0.01 220);
74
+ --sidebar-border: oklch(0.28 0.03 230);
75
+ --sidebar-ring: oklch(0.70 0.17 162);
76
+ }
77
+
78
+ @theme inline {
79
+ --color-background: var(--background);
80
+ --color-foreground: var(--foreground);
81
+ --color-card: var(--card);
82
+ --color-card-foreground: var(--card-foreground);
83
+ --color-popover: var(--popover);
84
+ --color-popover-foreground: var(--popover-foreground);
85
+ --color-primary: var(--primary);
86
+ --color-primary-foreground: var(--primary-foreground);
87
+ --color-secondary: var(--secondary);
88
+ --color-secondary-foreground: var(--secondary-foreground);
89
+ --color-muted: var(--muted);
90
+ --color-muted-foreground: var(--muted-foreground);
91
+ --color-accent: var(--accent);
92
+ --color-accent-foreground: var(--accent-foreground);
93
+ --color-destructive: var(--destructive);
94
+ --color-destructive-foreground: var(--destructive-foreground);
95
+ --color-border: var(--border);
96
+ --color-input: var(--input);
97
+ --color-ring: var(--ring);
98
+ --color-chart-1: var(--chart-1);
99
+ --color-chart-2: var(--chart-2);
100
+ --color-chart-3: var(--chart-3);
101
+ --color-chart-4: var(--chart-4);
102
+ --color-chart-5: var(--chart-5);
103
+ --radius-sm: calc(var(--radius) - 4px);
104
+ --radius-md: calc(var(--radius) - 2px);
105
+ --radius-lg: var(--radius);
106
+ --radius-xl: calc(var(--radius) + 4px);
107
+ --color-sidebar: var(--sidebar);
108
+ --color-sidebar-foreground: var(--sidebar-foreground);
109
+ --color-sidebar-primary: var(--sidebar-primary);
110
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
111
+ --color-sidebar-accent: var(--sidebar-accent);
112
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
113
+ --color-sidebar-border: var(--sidebar-border);
114
+ --color-sidebar-ring: var(--sidebar-ring);
115
+ }
116
+
117
+ @layer base {
118
+ * {
119
+ @apply border-border outline-ring/50;
120
+ }
121
+ body {
122
+ @apply bg-background text-foreground;
123
+ }
124
+ }
125
+
126
+ @theme {
127
+ /* Midnight Slate custom color scale */
128
+ --color-galaxy-950: #0a0e14;
129
+ --color-galaxy-900: #121820;
130
+ --color-galaxy-800: #1e2630;
131
+ --color-galaxy-700: #2b3544;
132
+ --color-galaxy-600: #3d4a5c;
133
+ --color-galaxy-500: #536478;
134
+ --color-galaxy-400: #748698;
135
+ --color-galaxy-300: #9cabb9;
136
+ --color-galaxy-200: #c4ced8;
137
+ --color-galaxy-100: #e4e9ee;
138
+ --color-galaxy-50: #f3f5f7;
139
+
140
+ /* Accent colors */
141
+ --color-cosmic-blue: #2d6a4f;
142
+ --color-nebula-pink: #c24a6e;
143
+ --color-star-gold: #c4b490;
144
+ }
@@ -0,0 +1,140 @@
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 { createDevHmrGuardPlugin } from "./dev-hmr-guard-plugin.js";
14
+ import type { DreamboardDevRuntimeConfig } from "./dev-runtime-config.js";
15
+
16
+ const require = createRequire(import.meta.url);
17
+ const tailwindCssEntry = require.resolve("tailwindcss/index.css");
18
+
19
+ export type { DreamboardDevRuntimeConfig } from "./dev-runtime-config.js";
20
+
21
+ export async function startDreamboardDevServer(options: {
22
+ projectRoot: string;
23
+ sessionFilePath: string;
24
+ port?: number;
25
+ host?: string | boolean;
26
+ allowedHosts?: string[];
27
+ runtimeConfig: DreamboardDevRuntimeConfig;
28
+ config: ResolvedConfig;
29
+ }): Promise<{
30
+ url: string;
31
+ networkUrls: string[];
32
+ close: () => Promise<void>;
33
+ server: ViteDevServer;
34
+ }> {
35
+ const { projectRoot, port, host, allowedHosts, runtimeConfig, config } =
36
+ options;
37
+ const platform = createDevRuntimePlatform({
38
+ importMetaUrl: import.meta.url,
39
+ projectRoot,
40
+ debug: runtimeConfig.debug,
41
+ port,
42
+ host,
43
+ allowedHosts,
44
+ tailwindCssEntry,
45
+ });
46
+ const generatedFallbackStylesheetPath = prepareFallbackStylesheet({
47
+ projectRoot,
48
+ repoRoot: platform.repoRoot,
49
+ });
50
+
51
+ const server = await createServer({
52
+ root: platform.devHostRoot,
53
+ appType: "spa",
54
+ plugins: [
55
+ createDevHmrGuardPlugin({ projectRoot }),
56
+ react(),
57
+ createVirtualDevModulesPlugin({
58
+ projectRoot,
59
+ runtimeConfig,
60
+ generatedFallbackStylesheetPath,
61
+ }),
62
+ createDevApiProxyPlugin({ config }),
63
+ createDevLogRelayPlugin({
64
+ sessionFilePath: options.sessionFilePath,
65
+ runtimeConfig,
66
+ config,
67
+ diagnosticsLevel: platform.diagnosticsLevel,
68
+ }),
69
+ ],
70
+ css: {
71
+ postcss: {
72
+ plugins: [tailwindcssPostcss()],
73
+ },
74
+ },
75
+ logLevel: platform.viteLogLevel,
76
+ resolve: {
77
+ dedupe: platform.resolveDedupe,
78
+ alias: platform.resolveAlias,
79
+ },
80
+ optimizeDeps: {
81
+ exclude: platform.optimizeDepsExclude,
82
+ },
83
+ server: platform.serverConfig,
84
+ });
85
+
86
+ await server.listen();
87
+ const resolvedPort = getBoundPort(server);
88
+ const url = `http://localhost:${resolvedPort}/index.html`;
89
+ return {
90
+ url,
91
+ networkUrls: getNetworkUrls(host, resolvedPort),
92
+ close: async () => {
93
+ await server.close();
94
+ if (generatedFallbackStylesheetPath) {
95
+ rmSync(generatedFallbackStylesheetPath, { force: true });
96
+ }
97
+ },
98
+ server,
99
+ };
100
+ }
101
+
102
+ function getNetworkUrls(
103
+ host: string | boolean | undefined,
104
+ port: number,
105
+ ): string[] {
106
+ if (!host) return [];
107
+ if (typeof host === "string" && isLoopbackHost(host)) return [];
108
+
109
+ const hosts =
110
+ host === true || host === "0.0.0.0" || host === "::"
111
+ ? getLanIpv4Addresses()
112
+ : [host];
113
+
114
+ return hosts.map(
115
+ (value) => `http://${formatUrlHost(value)}:${port}/index.html`,
116
+ );
117
+ }
118
+
119
+ function isLoopbackHost(host: string): boolean {
120
+ return host === "localhost" || host === "127.0.0.1" || host === "::1";
121
+ }
122
+
123
+ function getLanIpv4Addresses(): string[] {
124
+ return Object.values(os.networkInterfaces())
125
+ .flatMap((interfaces) => interfaces ?? [])
126
+ .filter((details) => details.family === "IPv4" && !details.internal)
127
+ .map((details) => details.address);
128
+ }
129
+
130
+ function formatUrlHost(host: string): string {
131
+ return host.includes(":") ? `[${host}]` : host;
132
+ }
133
+
134
+ function getBoundPort(server: ViteDevServer): number {
135
+ const address = server.httpServer?.address();
136
+ if (!address || typeof address === "string") {
137
+ throw new Error("Failed to determine local dev server port.");
138
+ }
139
+ return address.port;
140
+ }
@@ -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
+ }
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ getGlobalAuthPath,
4
+ getGlobalConfigPath,
5
+ loadGlobalConfig,
6
+ saveGlobalConfig
7
+ } from "./chunk-TSJVWTJO.js";
8
+ import "./chunk-2H7UOFLK.js";
9
+ export {
10
+ getGlobalAuthPath,
11
+ getGlobalConfigPath,
12
+ loadGlobalConfig,
13
+ saveGlobalConfig
14
+ };
15
+ //# sourceMappingURL=global-config-UKSWNDTX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}