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.
- package/README.md +64 -0
- package/cli.js +10 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/api-contract.cjs +172 -0
- package/dist/api-contract.cjs.map +1 -0
- package/dist/api-contract.mjs +171 -0
- package/dist/api-contract.mjs.map +1 -0
- package/dist/api.cjs +124 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +36 -0
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +36 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +119 -0
- package/dist/api.mjs.map +1 -0
- package/dist/app.cjs +156 -0
- package/dist/app.cjs.map +1 -0
- package/dist/app.mjs +153 -0
- package/dist/app.mjs.map +1 -0
- package/dist/cli/catalog.cjs +30 -0
- package/dist/cli/catalog.cjs.map +1 -0
- package/dist/cli/catalog.mjs +29 -0
- package/dist/cli/catalog.mjs.map +1 -0
- package/dist/cli/help.cjs +16 -0
- package/dist/cli/help.cjs.map +1 -0
- package/dist/cli/help.mjs +16 -0
- package/dist/cli/help.mjs.map +1 -0
- package/dist/cli/init.cjs +287 -0
- package/dist/cli/init.cjs.map +1 -0
- package/dist/cli/init.d.cts +36 -0
- package/dist/cli/init.d.cts.map +1 -0
- package/dist/cli/init.d.mts +36 -0
- package/dist/cli/init.d.mts.map +1 -0
- package/dist/cli/init.mjs +279 -0
- package/dist/cli/init.mjs.map +1 -0
- package/dist/cli/parse.cjs +96 -0
- package/dist/cli/parse.cjs.map +1 -0
- package/dist/cli/parse.mjs +95 -0
- package/dist/cli/parse.mjs.map +1 -0
- package/dist/cli/prompts.cjs +42 -0
- package/dist/cli/prompts.cjs.map +1 -0
- package/dist/cli/prompts.mjs +41 -0
- package/dist/cli/prompts.mjs.map +1 -0
- package/dist/cli.cjs +167 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +166 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/components/dev-view.cjs +307 -0
- package/dist/components/dev-view.cjs.map +1 -0
- package/dist/components/dev-view.mjs +306 -0
- package/dist/components/dev-view.mjs.map +1 -0
- package/dist/components/streaming-view.cjs +146 -0
- package/dist/components/streaming-view.cjs.map +1 -0
- package/dist/components/streaming-view.mjs +144 -0
- package/dist/components/streaming-view.mjs.map +1 -0
- package/dist/config.cjs +280 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +35 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +35 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +266 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract.cjs +209 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +490 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +490 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.meta.cjs +104 -0
- package/dist/contract.meta.cjs.map +1 -0
- package/dist/contract.meta.d.cts +141 -0
- package/dist/contract.meta.d.cts.map +1 -0
- package/dist/contract.meta.d.mts +141 -0
- package/dist/contract.meta.d.mts.map +1 -0
- package/dist/contract.meta.mjs +102 -0
- package/dist/contract.meta.mjs.map +1 -0
- package/dist/contract.mjs +186 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/dev-logs.cjs +53 -0
- package/dist/dev-logs.cjs.map +1 -0
- package/dist/dev-logs.mjs +51 -0
- package/dist/dev-logs.mjs.map +1 -0
- package/dist/dev-session.cjs +195 -0
- package/dist/dev-session.cjs.map +1 -0
- package/dist/dev-session.mjs +194 -0
- package/dist/dev-session.mjs.map +1 -0
- package/dist/fastkv.cjs +89 -0
- package/dist/fastkv.cjs.map +1 -0
- package/dist/fastkv.d.cts +11 -0
- package/dist/fastkv.d.cts.map +1 -0
- package/dist/fastkv.d.mts +11 -0
- package/dist/fastkv.d.mts.map +1 -0
- package/dist/fastkv.mjs +82 -0
- package/dist/fastkv.mjs.map +1 -0
- package/dist/federation.server.cjs +27 -0
- package/dist/federation.server.cjs.map +1 -0
- package/dist/federation.server.mjs +27 -0
- package/dist/federation.server.mjs.map +1 -0
- package/dist/host.cjs +367 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.cts +22 -0
- package/dist/host.d.cts.map +1 -0
- package/dist/host.d.mts +22 -0
- package/dist/host.d.mts.map +1 -0
- package/dist/host.mjs +364 -0
- package/dist/host.mjs.map +1 -0
- package/dist/index.cjs +122 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +9 -0
- package/dist/integrity.cjs +39 -0
- package/dist/integrity.cjs.map +1 -0
- package/dist/integrity.d.cts +7 -0
- package/dist/integrity.d.cts.map +1 -0
- package/dist/integrity.d.mts +7 -0
- package/dist/integrity.d.mts.map +1 -0
- package/dist/integrity.mjs +35 -0
- package/dist/integrity.mjs.map +1 -0
- package/dist/internal/manifest-normalizer.cjs +140 -0
- package/dist/internal/manifest-normalizer.cjs.map +1 -0
- package/dist/internal/manifest-normalizer.mjs +138 -0
- package/dist/internal/manifest-normalizer.mjs.map +1 -0
- package/dist/mf.cjs +77 -0
- package/dist/mf.cjs.map +1 -0
- package/dist/mf.d.cts +19 -0
- package/dist/mf.d.cts.map +1 -0
- package/dist/mf.d.mts +19 -0
- package/dist/mf.d.mts.map +1 -0
- package/dist/mf.mjs +71 -0
- package/dist/mf.mjs.map +1 -0
- package/dist/near-cli.cjs +196 -0
- package/dist/near-cli.cjs.map +1 -0
- package/dist/near-cli.mjs +193 -0
- package/dist/near-cli.mjs.map +1 -0
- package/dist/network.cjs +9 -0
- package/dist/network.cjs.map +1 -0
- package/dist/network.mjs +8 -0
- package/dist/network.mjs.map +1 -0
- package/dist/orchestrator.cjs +441 -0
- package/dist/orchestrator.cjs.map +1 -0
- package/dist/orchestrator.d.cts +40 -0
- package/dist/orchestrator.d.cts.map +1 -0
- package/dist/orchestrator.d.mts +40 -0
- package/dist/orchestrator.d.mts.map +1 -0
- package/dist/orchestrator.mjs +436 -0
- package/dist/orchestrator.mjs.map +1 -0
- package/dist/plugin.cjs +830 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +347 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.mts +348 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +827 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/process-registry.cjs +120 -0
- package/dist/process-registry.cjs.map +1 -0
- package/dist/process-registry.d.cts +25 -0
- package/dist/process-registry.d.cts.map +1 -0
- package/dist/process-registry.d.mts +25 -0
- package/dist/process-registry.d.mts.map +1 -0
- package/dist/process-registry.mjs +119 -0
- package/dist/process-registry.mjs.map +1 -0
- package/dist/sdk.cjs +61 -0
- package/dist/sdk.d.cts +5 -0
- package/dist/sdk.d.mts +5 -0
- package/dist/sdk.mjs +6 -0
- package/dist/shared.cjs +143 -0
- package/dist/shared.cjs.map +1 -0
- package/dist/shared.d.cts +33 -0
- package/dist/shared.d.cts.map +1 -0
- package/dist/shared.d.mts +33 -0
- package/dist/shared.d.mts.map +1 -0
- package/dist/shared.mjs +140 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/types.cjs +160 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +269 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +269 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +144 -0
- package/dist/types.mjs.map +1 -0
- package/dist/ui/head.cjs +67 -0
- package/dist/ui/head.cjs.map +1 -0
- package/dist/ui/head.d.cts +19 -0
- package/dist/ui/head.d.cts.map +1 -0
- package/dist/ui/head.d.mts +19 -0
- package/dist/ui/head.d.mts.map +1 -0
- package/dist/ui/head.mjs +61 -0
- package/dist/ui/head.mjs.map +1 -0
- package/dist/ui/index.cjs +32 -0
- package/dist/ui/index.d.cts +7 -0
- package/dist/ui/index.d.mts +7 -0
- package/dist/ui/index.mjs +6 -0
- package/dist/ui/metadata.cjs +106 -0
- package/dist/ui/metadata.cjs.map +1 -0
- package/dist/ui/metadata.d.cts +35 -0
- package/dist/ui/metadata.d.cts.map +1 -0
- package/dist/ui/metadata.d.mts +35 -0
- package/dist/ui/metadata.d.mts.map +1 -0
- package/dist/ui/metadata.mjs +100 -0
- package/dist/ui/metadata.mjs.map +1 -0
- package/dist/ui/router.cjs +56 -0
- package/dist/ui/router.cjs.map +1 -0
- package/dist/ui/router.d.cts +11 -0
- package/dist/ui/router.d.cts.map +1 -0
- package/dist/ui/router.d.mts +11 -0
- package/dist/ui/router.d.mts.map +1 -0
- package/dist/ui/router.mjs +51 -0
- package/dist/ui/router.mjs.map +1 -0
- package/dist/ui/runtime.cjs +65 -0
- package/dist/ui/runtime.cjs.map +1 -0
- package/dist/ui/runtime.d.cts +29 -0
- package/dist/ui/runtime.d.cts.map +1 -0
- package/dist/ui/runtime.d.mts +29 -0
- package/dist/ui/runtime.d.mts.map +1 -0
- package/dist/ui/runtime.mjs +53 -0
- package/dist/ui/runtime.mjs.map +1 -0
- package/dist/ui/types.cjs +0 -0
- package/dist/ui/types.d.cts +52 -0
- package/dist/ui/types.d.cts.map +1 -0
- package/dist/ui/types.d.mts +52 -0
- package/dist/ui/types.d.mts.map +1 -0
- package/dist/ui/types.mjs +1 -0
- package/dist/utils/banner.cjs +24 -0
- package/dist/utils/banner.cjs.map +1 -0
- package/dist/utils/banner.mjs +23 -0
- package/dist/utils/banner.mjs.map +1 -0
- package/dist/utils/linkify.cjs +15 -0
- package/dist/utils/linkify.cjs.map +1 -0
- package/dist/utils/linkify.mjs +14 -0
- package/dist/utils/linkify.mjs.map +1 -0
- package/dist/utils/run.cjs +40 -0
- package/dist/utils/run.cjs.map +1 -0
- package/dist/utils/run.mjs +39 -0
- package/dist/utils/run.mjs.map +1 -0
- package/dist/utils/theme.cjs +44 -0
- package/dist/utils/theme.cjs.map +1 -0
- package/dist/utils/theme.mjs +37 -0
- package/dist/utils/theme.mjs.map +1 -0
- package/package.json +269 -80
- package/src/api-contract.ts +309 -0
- package/src/api.ts +181 -0
- package/src/app.ts +346 -0
- package/src/cli/catalog.ts +49 -0
- package/src/cli/help.ts +13 -0
- package/src/cli/init.ts +386 -0
- package/src/cli/parse.ts +130 -0
- package/src/cli/prompts.ts +64 -0
- package/src/cli.ts +203 -1507
- package/src/components/dev-view.tsx +307 -255
- package/src/components/streaming-view.ts +164 -128
- package/src/config.ts +462 -532
- package/src/contract.meta.ts +96 -0
- package/src/contract.ts +164 -561
- package/src/dev-logs.ts +85 -0
- package/src/dev-session.ts +318 -0
- package/src/fastkv.ts +153 -0
- package/src/federation.server.ts +43 -0
- package/src/host.ts +526 -0
- package/src/index.ts +6 -3
- package/src/integrity.ts +54 -0
- package/src/internal/manifest-normalizer.ts +251 -0
- package/src/mf.ts +105 -0
- package/src/near-cli.ts +284 -0
- package/src/network.ts +3 -0
- package/src/orchestrator.ts +648 -0
- package/src/plugin.ts +1130 -2311
- package/src/process-registry.ts +154 -0
- package/src/scripts/sync-api-contract.ts +24 -0
- package/src/sdk.ts +14 -0
- package/src/shared.ts +206 -0
- package/src/types.ts +152 -206
- package/src/ui/head.ts +34 -27
- package/src/ui/index.ts +3 -3
- package/src/ui/metadata.ts +95 -0
- package/src/ui/router.ts +22 -6
- package/src/ui/runtime.ts +55 -6
- package/src/ui/types.ts +24 -11
- package/src/utils/banner.ts +10 -6
- package/src/utils/run.ts +26 -27
- package/src/utils/theme.ts +3 -66
- package/src/components/monitor-view.tsx +0 -475
- package/src/components/status-view.tsx +0 -173
- package/src/lib/env.ts +0 -109
- package/src/lib/near-cli.ts +0 -289
- package/src/lib/nova.ts +0 -266
- package/src/lib/orchestrator.ts +0 -276
- package/src/lib/process-registry.ts +0 -166
- package/src/lib/process.ts +0 -550
- package/src/lib/resource-monitor/assertions.ts +0 -234
- package/src/lib/resource-monitor/command.ts +0 -283
- package/src/lib/resource-monitor/diff.ts +0 -157
- package/src/lib/resource-monitor/errors.ts +0 -127
- package/src/lib/resource-monitor/index.ts +0 -305
- package/src/lib/resource-monitor/platform/darwin.ts +0 -306
- package/src/lib/resource-monitor/platform/index.ts +0 -35
- package/src/lib/resource-monitor/platform/linux.ts +0 -332
- package/src/lib/resource-monitor/platform/windows.ts +0 -298
- package/src/lib/resource-monitor/snapshot.ts +0 -217
- package/src/lib/resource-monitor/types.ts +0 -74
- package/src/lib/session-recorder/errors.ts +0 -102
- package/src/lib/session-recorder/flows/login.ts +0 -210
- package/src/lib/session-recorder/index.ts +0 -361
- package/src/lib/session-recorder/playwright.ts +0 -257
- package/src/lib/session-recorder/report.ts +0 -353
- package/src/lib/session-recorder/server.ts +0 -268
- package/src/lib/session-recorder/types.ts +0 -115
- package/src/lib/sync.ts +0 -1
- package/src/ui/files.ts +0 -134
package/src/types.ts
CHANGED
|
@@ -1,234 +1,180 @@
|
|
|
1
|
-
import { z } from "
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
14
|
+
export type SharedConfig = z.infer<typeof SharedConfigSchema>;
|
|
15
|
+
export type SharedDepConfig = SharedConfig;
|
|
16
|
+
export const SharedDepConfigSchema = SharedConfigSchema;
|
|
51
17
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
25
|
+
export type FederationEntry = z.infer<typeof FederationEntrySchema>;
|
|
59
26
|
|
|
60
|
-
export const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
67
|
-
|
|
68
|
-
export const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
74
|
-
|
|
75
|
-
export const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
71
|
+
export type UiConfig = z.infer<typeof UiConfigSchema>;
|
|
128
72
|
|
|
129
|
-
export const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
79
|
+
export type HostConfig = z.infer<typeof HostConfigSchema>;
|
|
136
80
|
|
|
137
|
-
export const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
|
88
|
+
export type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;
|
|
143
89
|
|
|
144
|
-
export const
|
|
145
|
-
|
|
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
|
|
93
|
+
export type BosStaging = z.infer<typeof BosStagingSchema>;
|
|
152
94
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
|
110
|
+
export type BosConfig = z.infer<typeof BosConfigSchema>;
|
|
163
111
|
|
|
164
112
|
export const RuntimeConfigSchema = z.object({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
runtimeConfig: Partial<ClientRuntimeConfig> | undefined,
|
|
32
|
+
containerName = "ui",
|
|
33
|
+
hydratePath = "./Hydrate",
|
|
27
34
|
): HeadScript {
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
+
const { assetsUrl, runtimeConfig, containerName, hydratePath, integrity } = options;
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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
|
@@ -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)
|
|
10
|
-
|
|
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
|
|
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
|
|
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) {
|