forked from deco-cx/deco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
live.ts
50 lines (45 loc) · 1.25 KB
/
live.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/// <reference no-default-lib="true"/>
/// <reference lib="deno.ns" />
/// <reference lib="esnext" />
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />
import { SourceMap } from "./blocks/app.ts";
import { ReleaseResolver } from "./engine/core/mod.ts";
import { Release } from "./engine/releases/provider.ts";
import { AppManifest } from "./mod.ts";
export interface DecoRuntimeState {
manifest: AppManifest;
// deno-lint-ignore no-explicit-any
resolver: ReleaseResolver<any>;
sourceMap: SourceMap;
}
export interface InstanceInfo {
startedAt: Date;
readyAt?: Date;
}
// The global deco context
export type DecoContext = {
deploymentId: string | undefined;
isDeploy: boolean;
site: string;
siteId: number;
loginUrl?: string;
base?: string;
namespace?: string;
release?: Release;
runtime?: Promise<DecoRuntimeState>;
play?: boolean;
instance: InstanceInfo;
};
// While Fresh doesn't allow for injecting routes and middlewares,
// we have to deliberately store the manifest in this scope.
export const context: DecoContext = {
deploymentId: Deno.env.get("DENO_DEPLOYMENT_ID"),
isDeploy: Boolean(Deno.env.get("DENO_DEPLOYMENT_ID")),
site: "",
siteId: 0,
play: false,
instance: {
startedAt: new Date(),
},
};