everything-dev 0.3.3 → 1.3.3

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 (313) hide show
  1. package/README.md +64 -0
  2. package/cli.js +10 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/api-contract.cjs +172 -0
  5. package/dist/api-contract.cjs.map +1 -0
  6. package/dist/api-contract.mjs +171 -0
  7. package/dist/api-contract.mjs.map +1 -0
  8. package/dist/api.cjs +124 -0
  9. package/dist/api.cjs.map +1 -0
  10. package/dist/api.d.cts +36 -0
  11. package/dist/api.d.cts.map +1 -0
  12. package/dist/api.d.mts +36 -0
  13. package/dist/api.d.mts.map +1 -0
  14. package/dist/api.mjs +119 -0
  15. package/dist/api.mjs.map +1 -0
  16. package/dist/app.cjs +156 -0
  17. package/dist/app.cjs.map +1 -0
  18. package/dist/app.mjs +153 -0
  19. package/dist/app.mjs.map +1 -0
  20. package/dist/cli/catalog.cjs +30 -0
  21. package/dist/cli/catalog.cjs.map +1 -0
  22. package/dist/cli/catalog.mjs +29 -0
  23. package/dist/cli/catalog.mjs.map +1 -0
  24. package/dist/cli/help.cjs +16 -0
  25. package/dist/cli/help.cjs.map +1 -0
  26. package/dist/cli/help.mjs +16 -0
  27. package/dist/cli/help.mjs.map +1 -0
  28. package/dist/cli/init.cjs +287 -0
  29. package/dist/cli/init.cjs.map +1 -0
  30. package/dist/cli/init.d.cts +36 -0
  31. package/dist/cli/init.d.cts.map +1 -0
  32. package/dist/cli/init.d.mts +36 -0
  33. package/dist/cli/init.d.mts.map +1 -0
  34. package/dist/cli/init.mjs +279 -0
  35. package/dist/cli/init.mjs.map +1 -0
  36. package/dist/cli/parse.cjs +96 -0
  37. package/dist/cli/parse.cjs.map +1 -0
  38. package/dist/cli/parse.mjs +95 -0
  39. package/dist/cli/parse.mjs.map +1 -0
  40. package/dist/cli/prompts.cjs +42 -0
  41. package/dist/cli/prompts.cjs.map +1 -0
  42. package/dist/cli/prompts.mjs +41 -0
  43. package/dist/cli/prompts.mjs.map +1 -0
  44. package/dist/cli.cjs +167 -0
  45. package/dist/cli.cjs.map +1 -0
  46. package/dist/cli.d.cts +1 -0
  47. package/dist/cli.d.mts +1 -0
  48. package/dist/cli.mjs +166 -0
  49. package/dist/cli.mjs.map +1 -0
  50. package/dist/components/dev-view.cjs +307 -0
  51. package/dist/components/dev-view.cjs.map +1 -0
  52. package/dist/components/dev-view.mjs +306 -0
  53. package/dist/components/dev-view.mjs.map +1 -0
  54. package/dist/components/streaming-view.cjs +146 -0
  55. package/dist/components/streaming-view.cjs.map +1 -0
  56. package/dist/components/streaming-view.mjs +144 -0
  57. package/dist/components/streaming-view.mjs.map +1 -0
  58. package/dist/config.cjs +280 -0
  59. package/dist/config.cjs.map +1 -0
  60. package/dist/config.d.cts +35 -0
  61. package/dist/config.d.cts.map +1 -0
  62. package/dist/config.d.mts +35 -0
  63. package/dist/config.d.mts.map +1 -0
  64. package/dist/config.mjs +266 -0
  65. package/dist/config.mjs.map +1 -0
  66. package/dist/contract.cjs +209 -0
  67. package/dist/contract.cjs.map +1 -0
  68. package/dist/contract.d.cts +490 -0
  69. package/dist/contract.d.cts.map +1 -0
  70. package/dist/contract.d.mts +490 -0
  71. package/dist/contract.d.mts.map +1 -0
  72. package/dist/contract.meta.cjs +104 -0
  73. package/dist/contract.meta.cjs.map +1 -0
  74. package/dist/contract.meta.d.cts +141 -0
  75. package/dist/contract.meta.d.cts.map +1 -0
  76. package/dist/contract.meta.d.mts +141 -0
  77. package/dist/contract.meta.d.mts.map +1 -0
  78. package/dist/contract.meta.mjs +102 -0
  79. package/dist/contract.meta.mjs.map +1 -0
  80. package/dist/contract.mjs +186 -0
  81. package/dist/contract.mjs.map +1 -0
  82. package/dist/dev-logs.cjs +53 -0
  83. package/dist/dev-logs.cjs.map +1 -0
  84. package/dist/dev-logs.mjs +51 -0
  85. package/dist/dev-logs.mjs.map +1 -0
  86. package/dist/dev-session.cjs +195 -0
  87. package/dist/dev-session.cjs.map +1 -0
  88. package/dist/dev-session.mjs +194 -0
  89. package/dist/dev-session.mjs.map +1 -0
  90. package/dist/fastkv.cjs +89 -0
  91. package/dist/fastkv.cjs.map +1 -0
  92. package/dist/fastkv.d.cts +11 -0
  93. package/dist/fastkv.d.cts.map +1 -0
  94. package/dist/fastkv.d.mts +11 -0
  95. package/dist/fastkv.d.mts.map +1 -0
  96. package/dist/fastkv.mjs +82 -0
  97. package/dist/fastkv.mjs.map +1 -0
  98. package/dist/federation.server.cjs +27 -0
  99. package/dist/federation.server.cjs.map +1 -0
  100. package/dist/federation.server.mjs +27 -0
  101. package/dist/federation.server.mjs.map +1 -0
  102. package/dist/host.cjs +367 -0
  103. package/dist/host.cjs.map +1 -0
  104. package/dist/host.d.cts +22 -0
  105. package/dist/host.d.cts.map +1 -0
  106. package/dist/host.d.mts +22 -0
  107. package/dist/host.d.mts.map +1 -0
  108. package/dist/host.mjs +364 -0
  109. package/dist/host.mjs.map +1 -0
  110. package/dist/index.cjs +122 -0
  111. package/dist/index.d.cts +7 -0
  112. package/dist/index.d.mts +7 -0
  113. package/dist/index.mjs +9 -0
  114. package/dist/integrity.cjs +39 -0
  115. package/dist/integrity.cjs.map +1 -0
  116. package/dist/integrity.d.cts +7 -0
  117. package/dist/integrity.d.cts.map +1 -0
  118. package/dist/integrity.d.mts +7 -0
  119. package/dist/integrity.d.mts.map +1 -0
  120. package/dist/integrity.mjs +35 -0
  121. package/dist/integrity.mjs.map +1 -0
  122. package/dist/internal/manifest-normalizer.cjs +140 -0
  123. package/dist/internal/manifest-normalizer.cjs.map +1 -0
  124. package/dist/internal/manifest-normalizer.mjs +138 -0
  125. package/dist/internal/manifest-normalizer.mjs.map +1 -0
  126. package/dist/mf.cjs +77 -0
  127. package/dist/mf.cjs.map +1 -0
  128. package/dist/mf.d.cts +19 -0
  129. package/dist/mf.d.cts.map +1 -0
  130. package/dist/mf.d.mts +19 -0
  131. package/dist/mf.d.mts.map +1 -0
  132. package/dist/mf.mjs +71 -0
  133. package/dist/mf.mjs.map +1 -0
  134. package/dist/near-cli.cjs +196 -0
  135. package/dist/near-cli.cjs.map +1 -0
  136. package/dist/near-cli.mjs +193 -0
  137. package/dist/near-cli.mjs.map +1 -0
  138. package/dist/network.cjs +9 -0
  139. package/dist/network.cjs.map +1 -0
  140. package/dist/network.mjs +8 -0
  141. package/dist/network.mjs.map +1 -0
  142. package/dist/orchestrator.cjs +441 -0
  143. package/dist/orchestrator.cjs.map +1 -0
  144. package/dist/orchestrator.d.cts +40 -0
  145. package/dist/orchestrator.d.cts.map +1 -0
  146. package/dist/orchestrator.d.mts +40 -0
  147. package/dist/orchestrator.d.mts.map +1 -0
  148. package/dist/orchestrator.mjs +436 -0
  149. package/dist/orchestrator.mjs.map +1 -0
  150. package/dist/plugin.cjs +830 -0
  151. package/dist/plugin.cjs.map +1 -0
  152. package/dist/plugin.d.cts +347 -0
  153. package/dist/plugin.d.cts.map +1 -0
  154. package/dist/plugin.d.mts +348 -0
  155. package/dist/plugin.d.mts.map +1 -0
  156. package/dist/plugin.mjs +827 -0
  157. package/dist/plugin.mjs.map +1 -0
  158. package/dist/process-registry.cjs +120 -0
  159. package/dist/process-registry.cjs.map +1 -0
  160. package/dist/process-registry.d.cts +25 -0
  161. package/dist/process-registry.d.cts.map +1 -0
  162. package/dist/process-registry.d.mts +25 -0
  163. package/dist/process-registry.d.mts.map +1 -0
  164. package/dist/process-registry.mjs +119 -0
  165. package/dist/process-registry.mjs.map +1 -0
  166. package/dist/sdk.cjs +61 -0
  167. package/dist/sdk.d.cts +5 -0
  168. package/dist/sdk.d.mts +5 -0
  169. package/dist/sdk.mjs +6 -0
  170. package/dist/shared.cjs +143 -0
  171. package/dist/shared.cjs.map +1 -0
  172. package/dist/shared.d.cts +33 -0
  173. package/dist/shared.d.cts.map +1 -0
  174. package/dist/shared.d.mts +33 -0
  175. package/dist/shared.d.mts.map +1 -0
  176. package/dist/shared.mjs +140 -0
  177. package/dist/shared.mjs.map +1 -0
  178. package/dist/types.cjs +160 -0
  179. package/dist/types.cjs.map +1 -0
  180. package/dist/types.d.cts +269 -0
  181. package/dist/types.d.cts.map +1 -0
  182. package/dist/types.d.mts +269 -0
  183. package/dist/types.d.mts.map +1 -0
  184. package/dist/types.mjs +144 -0
  185. package/dist/types.mjs.map +1 -0
  186. package/dist/ui/head.cjs +67 -0
  187. package/dist/ui/head.cjs.map +1 -0
  188. package/dist/ui/head.d.cts +19 -0
  189. package/dist/ui/head.d.cts.map +1 -0
  190. package/dist/ui/head.d.mts +19 -0
  191. package/dist/ui/head.d.mts.map +1 -0
  192. package/dist/ui/head.mjs +61 -0
  193. package/dist/ui/head.mjs.map +1 -0
  194. package/dist/ui/index.cjs +32 -0
  195. package/dist/ui/index.d.cts +7 -0
  196. package/dist/ui/index.d.mts +7 -0
  197. package/dist/ui/index.mjs +6 -0
  198. package/dist/ui/metadata.cjs +106 -0
  199. package/dist/ui/metadata.cjs.map +1 -0
  200. package/dist/ui/metadata.d.cts +35 -0
  201. package/dist/ui/metadata.d.cts.map +1 -0
  202. package/dist/ui/metadata.d.mts +35 -0
  203. package/dist/ui/metadata.d.mts.map +1 -0
  204. package/dist/ui/metadata.mjs +100 -0
  205. package/dist/ui/metadata.mjs.map +1 -0
  206. package/dist/ui/router.cjs +56 -0
  207. package/dist/ui/router.cjs.map +1 -0
  208. package/dist/ui/router.d.cts +11 -0
  209. package/dist/ui/router.d.cts.map +1 -0
  210. package/dist/ui/router.d.mts +11 -0
  211. package/dist/ui/router.d.mts.map +1 -0
  212. package/dist/ui/router.mjs +51 -0
  213. package/dist/ui/router.mjs.map +1 -0
  214. package/dist/ui/runtime.cjs +65 -0
  215. package/dist/ui/runtime.cjs.map +1 -0
  216. package/dist/ui/runtime.d.cts +29 -0
  217. package/dist/ui/runtime.d.cts.map +1 -0
  218. package/dist/ui/runtime.d.mts +29 -0
  219. package/dist/ui/runtime.d.mts.map +1 -0
  220. package/dist/ui/runtime.mjs +53 -0
  221. package/dist/ui/runtime.mjs.map +1 -0
  222. package/dist/ui/types.cjs +0 -0
  223. package/dist/ui/types.d.cts +52 -0
  224. package/dist/ui/types.d.cts.map +1 -0
  225. package/dist/ui/types.d.mts +52 -0
  226. package/dist/ui/types.d.mts.map +1 -0
  227. package/dist/ui/types.mjs +1 -0
  228. package/dist/utils/banner.cjs +24 -0
  229. package/dist/utils/banner.cjs.map +1 -0
  230. package/dist/utils/banner.mjs +23 -0
  231. package/dist/utils/banner.mjs.map +1 -0
  232. package/dist/utils/linkify.cjs +15 -0
  233. package/dist/utils/linkify.cjs.map +1 -0
  234. package/dist/utils/linkify.mjs +14 -0
  235. package/dist/utils/linkify.mjs.map +1 -0
  236. package/dist/utils/run.cjs +40 -0
  237. package/dist/utils/run.cjs.map +1 -0
  238. package/dist/utils/run.mjs +39 -0
  239. package/dist/utils/run.mjs.map +1 -0
  240. package/dist/utils/theme.cjs +44 -0
  241. package/dist/utils/theme.cjs.map +1 -0
  242. package/dist/utils/theme.mjs +37 -0
  243. package/dist/utils/theme.mjs.map +1 -0
  244. package/package.json +269 -80
  245. package/src/api-contract.ts +309 -0
  246. package/src/api.ts +181 -0
  247. package/src/app.ts +346 -0
  248. package/src/cli/catalog.ts +49 -0
  249. package/src/cli/help.ts +13 -0
  250. package/src/cli/init.ts +386 -0
  251. package/src/cli/parse.ts +130 -0
  252. package/src/cli/prompts.ts +64 -0
  253. package/src/cli.ts +203 -1507
  254. package/src/components/dev-view.tsx +307 -255
  255. package/src/components/streaming-view.ts +164 -128
  256. package/src/config.ts +462 -532
  257. package/src/contract.meta.ts +96 -0
  258. package/src/contract.ts +164 -561
  259. package/src/dev-logs.ts +85 -0
  260. package/src/dev-session.ts +318 -0
  261. package/src/fastkv.ts +153 -0
  262. package/src/federation.server.ts +43 -0
  263. package/src/host.ts +526 -0
  264. package/src/index.ts +6 -3
  265. package/src/integrity.ts +54 -0
  266. package/src/internal/manifest-normalizer.ts +251 -0
  267. package/src/mf.ts +105 -0
  268. package/src/near-cli.ts +284 -0
  269. package/src/network.ts +3 -0
  270. package/src/orchestrator.ts +648 -0
  271. package/src/plugin.ts +1130 -2311
  272. package/src/process-registry.ts +154 -0
  273. package/src/scripts/sync-api-contract.ts +24 -0
  274. package/src/sdk.ts +14 -0
  275. package/src/shared.ts +206 -0
  276. package/src/types.ts +152 -206
  277. package/src/ui/head.ts +34 -27
  278. package/src/ui/index.ts +3 -3
  279. package/src/ui/metadata.ts +95 -0
  280. package/src/ui/router.ts +22 -6
  281. package/src/ui/runtime.ts +55 -6
  282. package/src/ui/types.ts +24 -11
  283. package/src/utils/banner.ts +10 -6
  284. package/src/utils/run.ts +26 -27
  285. package/src/utils/theme.ts +3 -66
  286. package/src/components/monitor-view.tsx +0 -475
  287. package/src/components/status-view.tsx +0 -173
  288. package/src/lib/env.ts +0 -109
  289. package/src/lib/near-cli.ts +0 -289
  290. package/src/lib/nova.ts +0 -266
  291. package/src/lib/orchestrator.ts +0 -276
  292. package/src/lib/process-registry.ts +0 -166
  293. package/src/lib/process.ts +0 -550
  294. package/src/lib/resource-monitor/assertions.ts +0 -234
  295. package/src/lib/resource-monitor/command.ts +0 -283
  296. package/src/lib/resource-monitor/diff.ts +0 -157
  297. package/src/lib/resource-monitor/errors.ts +0 -127
  298. package/src/lib/resource-monitor/index.ts +0 -305
  299. package/src/lib/resource-monitor/platform/darwin.ts +0 -306
  300. package/src/lib/resource-monitor/platform/index.ts +0 -35
  301. package/src/lib/resource-monitor/platform/linux.ts +0 -332
  302. package/src/lib/resource-monitor/platform/windows.ts +0 -298
  303. package/src/lib/resource-monitor/snapshot.ts +0 -217
  304. package/src/lib/resource-monitor/types.ts +0 -74
  305. package/src/lib/session-recorder/errors.ts +0 -102
  306. package/src/lib/session-recorder/flows/login.ts +0 -210
  307. package/src/lib/session-recorder/index.ts +0 -361
  308. package/src/lib/session-recorder/playwright.ts +0 -257
  309. package/src/lib/session-recorder/report.ts +0 -353
  310. package/src/lib/session-recorder/server.ts +0 -268
  311. package/src/lib/session-recorder/types.ts +0 -115
  312. package/src/lib/sync.ts +0 -1
  313. package/src/ui/files.ts +0 -134
package/src/types.ts CHANGED
@@ -1,234 +1,180 @@
1
- import { z } from "every-plugin/zod";
1
+ import { z } from "./sdk";
2
2
 
3
3
  export const SourceModeSchema = z.enum(["local", "remote"]);
4
4
  export type SourceMode = z.infer<typeof SourceModeSchema>;
5
5
 
6
- export const HostConfigSchema = z.object({
7
- development: z.string(),
8
- production: z.string(),
9
- secrets: z.array(z.string()).optional(),
10
- template: z.string().optional(),
11
- files: z.array(z.string()).optional(),
12
- sync: z.lazy(() => SyncConfigSchema).optional(),
13
- });
14
- export type HostConfig = z.infer<typeof HostConfigSchema>;
15
-
16
- export const RemoteConfigSchema = z.object({
17
- name: z.string(),
18
- development: z.string(),
19
- production: z.string(),
20
- ssr: z.string().optional(),
21
- proxy: z.string().optional(),
22
- variables: z.record(z.string(), z.string()).optional(),
23
- secrets: z.array(z.string()).optional(),
24
- template: z.string().optional(),
25
- files: z.array(z.string()).optional(),
26
- sync: z.lazy(() => SyncConfigSchema).optional(),
27
- });
28
- export type RemoteConfig = z.infer<typeof RemoteConfigSchema>;
29
-
30
- /**
31
- * Partial RemoteConfig for input configs (child configs that extend a base).
32
- * Only 'name' is required; development/production can be inherited.
33
- */
34
- export const PartialRemoteConfigSchema = z.object({
35
- name: z.string(),
36
- development: z.string().optional(),
37
- production: z.string().optional(),
38
- proxy: z.string().optional(),
39
- variables: z.record(z.string(), z.string()).optional(),
40
- secrets: z.array(z.string()).optional(),
41
- template: z.string().optional(),
42
- files: z.array(z.string()).optional(),
43
- sync: z.lazy(() => SyncConfigSchema).optional(),
44
- });
45
- export type PartialRemoteConfig = z.infer<typeof PartialRemoteConfigSchema>;
46
-
47
- export const NovaConfigSchema = z.object({
48
- account: z.string(),
6
+ export const SharedConfigSchema = z.object({
7
+ version: z.string(),
8
+ requiredVersion: z.string().optional(),
9
+ singleton: z.boolean().optional(),
10
+ eager: z.boolean().optional(),
11
+ strictVersion: z.boolean().optional(),
12
+ shareScope: z.string().optional(),
49
13
  });
50
- export type NovaConfig = z.infer<typeof NovaConfigSchema>;
14
+ export type SharedConfig = z.infer<typeof SharedConfigSchema>;
15
+ export type SharedDepConfig = SharedConfig;
16
+ export const SharedDepConfigSchema = SharedConfigSchema;
51
17
 
52
- export const GatewayConfigSchema = z.object({
53
- development: z.string(),
54
- production: z.string(),
55
- account: z.string().optional(),
56
- nova: NovaConfigSchema.optional(),
18
+ export const FederationEntrySchema = z.object({
19
+ name: z.string(),
20
+ url: z.string(),
21
+ entry: z.string(),
22
+ source: SourceModeSchema,
23
+ integrity: z.string().optional(),
57
24
  });
58
- export type GatewayConfig = z.infer<typeof GatewayConfigSchema>;
25
+ export type FederationEntry = z.infer<typeof FederationEntrySchema>;
59
26
 
60
- export const SharedDepConfigSchema = z.object({
61
- requiredVersion: z.string().optional(),
62
- singleton: z.boolean().optional(),
63
- eager: z.boolean().optional(),
64
- strictVersion: z.boolean().optional(),
27
+ export const ApiPluginConfigSchema = z.object({
28
+ name: z.string(),
29
+ development: z.string().optional(),
30
+ production: z.string().optional(),
31
+ productionIntegrity: z.string().optional(),
32
+ proxy: z.string().optional(),
33
+ variables: z.record(z.string(), z.string()).optional(),
34
+ secrets: z.array(z.string()).optional(),
65
35
  });
66
- export type SharedDepConfig = z.infer<typeof SharedDepConfigSchema>;
67
-
68
- export const SyncConfigSchema = z.object({
69
- scripts: z.union([z.array(z.string()), z.literal(true)]).optional(),
70
- dependencies: z.boolean().default(true),
71
- devDependencies: z.boolean().default(true),
36
+ export type ApiPluginConfig = z.infer<typeof ApiPluginConfigSchema>;
37
+
38
+ export const BosPluginRefSchema = z.object({
39
+ extends: z.string().optional(),
40
+ development: z.string().optional(),
41
+ production: z.string().optional(),
42
+ productionIntegrity: z.string().optional(),
43
+ proxy: z.string().optional(),
44
+ variables: z.record(z.string(), z.string()).optional(),
45
+ secrets: z.array(z.string()).optional(),
72
46
  });
73
- export type SyncConfig = z.infer<typeof SyncConfigSchema>;
74
-
75
- export const BosConfigSchema = z.object({
76
- extends: z.string().optional(),
77
- account: z.string(),
78
- testnet: z.string().optional(),
79
- nova: NovaConfigSchema.optional(),
80
- gateway: GatewayConfigSchema,
81
- template: z.string().optional(),
82
- cli: z
83
- .object({
84
- version: z.string().optional(),
85
- })
86
- .optional(),
87
- shared: z
88
- .record(z.string(), z.record(z.string(), SharedDepConfigSchema))
89
- .optional(),
90
- app: z
91
- .object({
92
- host: HostConfigSchema,
93
- })
94
- .catchall(z.union([RemoteConfigSchema, HostConfigSchema])),
47
+ export type BosPluginRef = z.infer<typeof BosPluginRefSchema>;
48
+
49
+ export const RuntimePluginConfigSchema = z.object({
50
+ name: z.string(),
51
+ url: z.string(),
52
+ entry: z.string(),
53
+ source: SourceModeSchema,
54
+ localPath: z.string().optional(),
55
+ port: z.number().optional(),
56
+ proxy: z.string().optional(),
57
+ variables: z.record(z.string(), z.string()).optional(),
58
+ secrets: z.array(z.string()).optional(),
59
+ integrity: z.string().optional(),
95
60
  });
96
- export type BosConfig = z.infer<typeof BosConfigSchema>;
97
-
98
- /**
99
- * BosConfigInputSchema - permissive schema for parsing input configs.
100
- * Supports extends and allows partial app configs (child overrides only what it needs).
101
- * After resolving extends, the result must be validated against the strict BosConfigSchema.
102
- */
103
- export const BosConfigInputSchema = z.object({
104
- extends: z.string().optional(),
105
- account: z.string().optional(),
106
- testnet: z.string().optional(),
107
- nova: NovaConfigSchema.optional(),
108
- gateway: GatewayConfigSchema.optional(),
109
- template: z.string().optional(),
110
- cli: z
111
- .object({
112
- version: z.string().optional(),
113
- })
114
- .optional(),
115
- shared: z
116
- .record(z.string(), z.record(z.string(), SharedDepConfigSchema))
117
- .optional(),
118
- app: z
119
- .object({
120
- host: HostConfigSchema.optional(),
121
- ui: PartialRemoteConfigSchema.optional(),
122
- api: PartialRemoteConfigSchema.optional(),
123
- })
124
- .partial()
125
- .catchall(z.union([HostConfigSchema, PartialRemoteConfigSchema])),
61
+ export type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;
62
+
63
+ export const UiConfigSchema = z.object({
64
+ name: z.string(),
65
+ development: z.string().optional(),
66
+ production: z.string().optional(),
67
+ productionIntegrity: z.string().optional(),
68
+ ssr: z.string().optional(),
69
+ ssrIntegrity: z.string().optional(),
126
70
  });
127
- export type BosConfigInput = z.infer<typeof BosConfigInputSchema>;
71
+ export type UiConfig = z.infer<typeof UiConfigSchema>;
128
72
 
129
- export const AppConfigSchema = z.object({
130
- host: SourceModeSchema,
131
- ui: SourceModeSchema,
132
- api: SourceModeSchema,
133
- proxy: z.boolean().optional(),
73
+ export const HostConfigSchema = z.object({
74
+ development: z.string(),
75
+ production: z.string(),
76
+ productionIntegrity: z.string().optional(),
77
+ secrets: z.array(z.string()).optional(),
134
78
  });
135
- export type AppConfig = z.infer<typeof AppConfigSchema>;
79
+ export type HostConfig = z.infer<typeof HostConfigSchema>;
136
80
 
137
- export const PortConfigSchema = z.object({
138
- host: z.number(),
139
- ui: z.number(),
140
- api: z.number(),
81
+ export const ClientRuntimeInfoSchema = z.object({
82
+ accountId: z.string(),
83
+ gatewayId: z.string(),
84
+ runtimeBasePath: z.string(),
85
+ title: z.string().nullable(),
86
+ hostUrl: z.string().nullable(),
141
87
  });
142
- export type PortConfig = z.infer<typeof PortConfigSchema>;
88
+ export type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;
143
89
 
144
- export const SharedConfigSchema = z.object({
145
- requiredVersion: z.string().optional(),
146
- singleton: z.boolean().optional(),
147
- eager: z.boolean().optional(),
148
- strictVersion: z.boolean().optional(),
149
- shareScope: z.string().optional(),
90
+ export const BosStagingSchema = z.object({
91
+ domain: z.string(),
150
92
  });
151
- export type SharedConfig = z.infer<typeof SharedConfigSchema>;
93
+ export type BosStaging = z.infer<typeof BosStagingSchema>;
152
94
 
153
- /**
154
- * Federation entry info - both base URL and computed manifest entry
155
- */
156
- export const FederationEntrySchema = z.object({
157
- name: z.string(),
158
- url: z.string(), // Base/assets URL
159
- entry: z.string(), // Computed federation entry (mf-manifest.json or remoteEntry.js)
160
- source: SourceModeSchema,
95
+ export const BosConfigSchema = z.object({
96
+ account: z.string(),
97
+ extends: z.string().optional(),
98
+ domain: z.string().optional(),
99
+ testnet: z.string().optional(),
100
+ staging: BosStagingSchema.optional(),
101
+ repository: z.string().optional(),
102
+ shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),
103
+ plugins: z.record(z.string(), BosPluginRefSchema).optional(),
104
+ app: z.object({
105
+ host: HostConfigSchema,
106
+ ui: UiConfigSchema,
107
+ api: ApiPluginConfigSchema,
108
+ }),
161
109
  });
162
- export type FederationEntry = z.infer<typeof FederationEntrySchema>;
110
+ export type BosConfig = z.infer<typeof BosConfigSchema>;
163
111
 
164
112
  export const RuntimeConfigSchema = z.object({
165
- env: z.enum(["development", "production"]),
166
- account: z.string(),
167
- title: z.string().optional(),
168
- hostUrl: z.string(),
169
- shared: z
170
- .object({
171
- ui: z.record(z.string(), SharedConfigSchema).optional(),
172
- })
173
- .optional(),
174
- ui: FederationEntrySchema.extend({
175
- ssrUrl: z.string().optional(),
176
- }),
177
- api: FederationEntrySchema.extend({
178
- proxy: z.string().optional(),
179
- variables: z.record(z.string(), z.string()).optional(),
180
- secrets: z.array(z.string()).optional(),
181
- }),
113
+ env: z.enum(["development", "production"]),
114
+ account: z.string(),
115
+ domain: z.string().optional(),
116
+ networkId: z.enum(["mainnet", "testnet"]),
117
+ title: z.string().optional(),
118
+ repository: z.string().optional(),
119
+ hostUrl: z.string(),
120
+ shared: z
121
+ .object({
122
+ ui: z.record(z.string(), SharedConfigSchema).optional(),
123
+ })
124
+ .optional(),
125
+ ui: FederationEntrySchema.extend({
126
+ localPath: z.string().optional(),
127
+ port: z.number().optional(),
128
+ ssrUrl: z.string().optional(),
129
+ ssrIntegrity: z.string().optional(),
130
+ }),
131
+ api: FederationEntrySchema.extend({
132
+ localPath: z.string().optional(),
133
+ port: z.number().optional(),
134
+ proxy: z.string().optional(),
135
+ variables: z.record(z.string(), z.string()).optional(),
136
+ secrets: z.array(z.string()).optional(),
137
+ }),
138
+ plugins: z.record(z.string(), RuntimePluginConfigSchema).optional(),
182
139
  });
183
140
  export type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
184
141
 
185
- /**
186
- * Client-side runtime config (injected via window.__RUNTIME_CONFIG__)
187
- * Contains federation entry info so browser can load remotes via manifest
188
- */
189
142
  export const ClientRuntimeConfigSchema = z.object({
190
- env: z.enum(["development", "production"]),
191
- account: z.string(),
192
- hostUrl: z.string().optional(),
193
- assetsUrl: z.string(), // Legacy: use ui.entry for MF loading
194
- apiBase: z.string(),
195
- rpcBase: z.string(),
196
- ui: z
197
- .object({
198
- name: z.string(),
199
- url: z.string(), // Base URL for assets
200
- entry: z.string(), // Federation entry (mf-manifest.json)
201
- })
202
- .optional(),
143
+ env: z.enum(["development", "production"]),
144
+ account: z.string(),
145
+ networkId: z.enum(["mainnet", "testnet"]),
146
+ hostUrl: z.string().optional(),
147
+ assetsUrl: z.string(),
148
+ apiBase: z.string(),
149
+ rpcBase: z.string(),
150
+ repository: z.string().optional(),
151
+ runtime: ClientRuntimeInfoSchema.optional(),
152
+ ui: z
153
+ .object({
154
+ name: z.string(),
155
+ url: z.string(),
156
+ entry: z.string(),
157
+ integrity: z.string().optional(),
158
+ })
159
+ .optional(),
160
+ api: z
161
+ .object({
162
+ name: z.string(),
163
+ url: z.string(),
164
+ entry: z.string(),
165
+ integrity: z.string().optional(),
166
+ })
167
+ .optional(),
168
+ plugins: z
169
+ .record(
170
+ z.string(),
171
+ z.object({
172
+ name: z.string(),
173
+ url: z.string(),
174
+ entry: z.string(),
175
+ integrity: z.string().optional(),
176
+ }),
177
+ )
178
+ .optional(),
203
179
  });
204
180
  export type ClientRuntimeConfig = z.infer<typeof ClientRuntimeConfigSchema>;
205
-
206
- /**
207
- * Error thrown when a circular extends dependency is detected
208
- */
209
- export class ConfigCircularExtendsError extends Error {
210
- constructor(chain: string[]) {
211
- super(`Circular extends detected: ${chain.join(" → ")}`);
212
- this.name = "ConfigCircularExtendsError";
213
- }
214
- }
215
-
216
- /**
217
- * Error thrown when config fetching fails
218
- */
219
- export class ConfigFetchError extends Error {
220
- constructor(url: string, cause: unknown) {
221
- super(`Failed to fetch config from ${url}: ${cause}`);
222
- this.name = "ConfigFetchError";
223
- }
224
- }
225
-
226
- /**
227
- * Error thrown when config resolution fails
228
- */
229
- export class ConfigResolutionError extends Error {
230
- constructor(message: string) {
231
- super(message);
232
- this.name = "ConfigResolutionError";
233
- }
234
- }
package/src/ui/head.ts CHANGED
@@ -2,31 +2,38 @@ import type { ClientRuntimeConfig } from "../types";
2
2
  import type { HeadScript } from "./types";
3
3
 
4
4
  export interface RemoteScriptsOptions {
5
- assetsUrl: string;
6
- runtimeConfig?: ClientRuntimeConfig;
7
- containerName?: string;
8
- hydratePath?: string;
5
+ assetsUrl: string;
6
+ runtimeConfig?: Partial<ClientRuntimeConfig>;
7
+ containerName?: string;
8
+ hydratePath?: string;
9
+ integrity?: string;
9
10
  }
10
11
 
11
- export function getRemoteEntryScript(assetsUrl: string): HeadScript {
12
- return {
13
- src: `${assetsUrl}/remoteEntry.js`,
14
- };
12
+ export function getRemoteEntryScript(assetsUrl: string, integrity?: string): HeadScript {
13
+ const script: HeadScript = {
14
+ src: `${assetsUrl}/remoteEntry.js`,
15
+ };
16
+ if (integrity) {
17
+ script.integrity = integrity;
18
+ script.crossOrigin = "anonymous";
19
+ }
20
+ return script;
15
21
  }
16
22
 
17
23
  export function getThemeInitScript(): HeadScript {
18
- return {
19
- children: `(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();`,
20
- };
24
+ return {
25
+ children:
26
+ "(function(){var t=localStorage.getItem('theme');if(t==='dark'||(!t&&window.matchMedia('(prefers-color-scheme: dark)').matches)){document.documentElement.classList.add('dark');}})();",
27
+ };
21
28
  }
22
29
 
23
30
  export function getHydrateScript(
24
- runtimeConfig: ClientRuntimeConfig | undefined,
25
- containerName = "ui",
26
- hydratePath = "./Hydrate",
31
+ runtimeConfig: Partial<ClientRuntimeConfig> | undefined,
32
+ containerName = "ui",
33
+ hydratePath = "./Hydrate",
27
34
  ): HeadScript {
28
- return {
29
- children: `
35
+ return {
36
+ children: `
30
37
  window.__RUNTIME_CONFIG__=${JSON.stringify(runtimeConfig)};
31
38
  function __hydrate(){
32
39
  var container = window['${containerName}'];
@@ -49,24 +56,24 @@ export function getHydrateScript(
49
56
  }).catch(function(e){
50
57
  console.error('[Hydrate] Failed:', e);
51
58
  });
52
- }
53
- if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}
54
- `.trim(),
55
- };
59
+ }
60
+ if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',__hydrate);}else{__hydrate();}
61
+ `.trim(),
62
+ };
56
63
  }
57
64
 
58
65
  export function getRemoteScripts(options: RemoteScriptsOptions): HeadScript[] {
59
- const { assetsUrl, runtimeConfig, containerName, hydratePath } = options;
66
+ const { assetsUrl, runtimeConfig, containerName, hydratePath, integrity } = options;
60
67
 
61
- return [
62
- getRemoteEntryScript(assetsUrl),
63
- getThemeInitScript(),
64
- getHydrateScript(runtimeConfig, containerName, hydratePath),
65
- ];
68
+ return [
69
+ getRemoteEntryScript(assetsUrl, integrity),
70
+ getThemeInitScript(),
71
+ getHydrateScript(runtimeConfig, containerName, hydratePath),
72
+ ];
66
73
  }
67
74
 
68
75
  export function getBaseStyles(): string {
69
- return `
76
+ return `
70
77
  *, *::before, *::after { box-sizing: border-box; }
71
78
  html { height: 100%; height: 100dvh; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }
72
79
  body { min-height: 100%; min-height: 100dvh; margin: 0; background-color: var(--background); color: var(--foreground); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
package/src/ui/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./types";
2
- export * from "./runtime";
3
1
  export * from "./head";
4
- export * from "./files";
2
+ export * from "./metadata";
5
3
  export * from "./router";
4
+ export * from "./runtime";
5
+ export * from "./types";
@@ -0,0 +1,95 @@
1
+ export const SOCIAL_IMAGE_WIDTH = 1200;
2
+ export const SOCIAL_IMAGE_HEIGHT = 630;
3
+
4
+ export interface SocialImageMetaOptions {
5
+ imageUrl: string;
6
+ title: string;
7
+ description: string;
8
+ siteName?: string;
9
+ siteUrl?: string;
10
+ type?: string;
11
+ alt?: string;
12
+ width?: number;
13
+ height?: number;
14
+ mimeType?: string;
15
+ }
16
+
17
+ export function getSocialImageMeta(options: SocialImageMetaOptions) {
18
+ const {
19
+ imageUrl,
20
+ title,
21
+ description,
22
+ siteName,
23
+ siteUrl,
24
+ type = "website",
25
+ alt,
26
+ width = SOCIAL_IMAGE_WIDTH,
27
+ height = SOCIAL_IMAGE_HEIGHT,
28
+ mimeType = "image/png",
29
+ } = options;
30
+
31
+ return [
32
+ { property: "og:title", content: title },
33
+ { property: "og:description", content: description },
34
+ { property: "og:type", content: type },
35
+ { property: "og:image", content: imageUrl },
36
+ { property: "og:image:type", content: mimeType },
37
+ { property: "og:image:width", content: String(width) },
38
+ { property: "og:image:height", content: String(height) },
39
+ ...(alt ? [{ property: "og:image:alt", content: alt }] : []),
40
+ ...(siteName ? [{ property: "og:site_name", content: siteName }] : []),
41
+ ...(siteUrl ? [{ property: "og:url", content: siteUrl }] : []),
42
+ { name: "twitter:card", content: "summary_large_image" },
43
+ { name: "twitter:title", content: title },
44
+ { name: "twitter:description", content: description },
45
+ { name: "twitter:image", content: imageUrl },
46
+ ...(alt ? [{ name: "twitter:image:alt", content: alt }] : []),
47
+ ];
48
+ }
49
+
50
+ export interface DotIconSvgOptions {
51
+ size?: number;
52
+ color?: string;
53
+ radius?: number;
54
+ background?: string;
55
+ }
56
+
57
+ export function createDotIconSvg(options: DotIconSvgOptions = {}) {
58
+ const {
59
+ size = 64,
60
+ color = "#111111",
61
+ radius = size * 0.34,
62
+ background = "transparent",
63
+ } = options;
64
+ const center = size / 2;
65
+
66
+ return `<?xml version="1.0" encoding="UTF-8"?>
67
+ <svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">
68
+ <rect width="${size}" height="${size}" fill="${background}" />
69
+ <circle cx="${center}" cy="${center}" r="${radius}" fill="${color}" />
70
+ </svg>`;
71
+ }
72
+
73
+ export function createPngIcoBuffer(png: Uint8Array, width: number, height: number) {
74
+ const header = new Uint8Array(22);
75
+ const view = new DataView(header.buffer);
76
+
77
+ view.setUint16(0, 0, true);
78
+ view.setUint16(2, 1, true);
79
+ view.setUint16(4, 1, true);
80
+
81
+ header[6] = width >= 256 ? 0 : width;
82
+ header[7] = height >= 256 ? 0 : height;
83
+ header[8] = 0;
84
+ header[9] = 0;
85
+
86
+ view.setUint16(10, 1, true);
87
+ view.setUint16(12, 32, true);
88
+ view.setUint32(14, png.byteLength, true);
89
+ view.setUint32(18, 22, true);
90
+
91
+ const ico = new Uint8Array(22 + png.byteLength);
92
+ ico.set(header, 0);
93
+ ico.set(png, 22);
94
+ return ico;
95
+ }
package/src/ui/router.ts CHANGED
@@ -6,8 +6,12 @@ export function getMetaKey(meta: HeadMeta): string {
6
6
  if ("title" in meta) return "title";
7
7
  if ("charSet" in meta) return "charSet";
8
8
  if ("name" in meta) return `name:${(meta as { name: string }).name}`;
9
- if ("property" in meta) return `property:${(meta as { property: string }).property}`;
10
- if ("httpEquiv" in meta) return `httpEquiv:${(meta as { httpEquiv: string }).httpEquiv}`;
9
+ if ("property" in meta) {
10
+ return `property:${(meta as { property: string }).property}`;
11
+ }
12
+ if ("httpEquiv" in meta) {
13
+ return `httpEquiv:${(meta as { httpEquiv: string }).httpEquiv}`;
14
+ }
11
15
  return JSON.stringify(meta);
12
16
  }
13
17
 
@@ -20,8 +24,9 @@ export function getLinkKey(link: HeadLink): string {
20
24
  export function getScriptKey(script: HeadScript): string {
21
25
  if (!script) return "null";
22
26
  if ("src" in script && script.src) return `src:${script.src}`;
23
- if ("children" in script && script.children)
27
+ if ("children" in script && script.children) {
24
28
  return `children:${typeof script.children === "string" ? script.children : JSON.stringify(script.children)}`;
29
+ }
25
30
  return JSON.stringify(script);
26
31
  }
27
32
 
@@ -33,16 +38,27 @@ export async function collectHeadData(router: AnyRouter): Promise<HeadData> {
33
38
  const scriptMap = new Map<string, HeadScript>();
34
39
 
35
40
  for (const match of router.state.matches) {
36
- const headFn = match.route?.options?.head;
41
+ const route =
42
+ (
43
+ router as AnyRouter & {
44
+ routesById?: Record<string, { options?: { head?: (...args: unknown[]) => unknown } }>;
45
+ }
46
+ ).routesById?.[(match as { routeId: string }).routeId] ??
47
+ (match as { route?: { options?: { head?: (...args: unknown[]) => unknown } } }).route;
48
+ const headFn = route?.options?.head;
37
49
  if (!headFn) continue;
38
50
 
39
51
  try {
40
- const headResult = await headFn({
52
+ const headResult = (await headFn({
41
53
  loaderData: match.loaderData,
42
54
  matches: router.state.matches,
43
55
  match,
44
56
  params: match.params,
45
- } as Parameters<typeof headFn>[0]);
57
+ })) as {
58
+ meta?: HeadMeta[];
59
+ links?: HeadLink[];
60
+ scripts?: HeadScript[];
61
+ };
46
62
 
47
63
  if (headResult?.meta) {
48
64
  for (const meta of headResult.meta) {