@arkstack/contract 0.19.6 → 0.20.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.
- package/dist/global.d.ts +14 -9
- package/dist/index.d.ts +20 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/global.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arkstack } from '.'
|
|
1
|
+
import { Arkstack, ServerStartInfo, TunneledServerStartInfo } from '.'
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
function app(): Arkstack<never, never>
|
|
@@ -8,18 +8,23 @@ declare global {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'set:root-dir': {
|
|
14
|
-
after: (dir: string) => void
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
11
|
+
// `Hook` and its registry live in @arkstack/foundry (@arkstack/common only
|
|
12
|
+
// re-exports them), so typed hook names are declared there.
|
|
19
13
|
declare module '@arkstack/foundry' {
|
|
20
14
|
interface HookRegistry {
|
|
21
15
|
'set:root-dir': {
|
|
22
16
|
after: (dir: string) => void
|
|
23
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Fired by every driver once its server is listening (dev and production),
|
|
20
|
+
* after the startup banner and once any tunnel is open.
|
|
21
|
+
*/
|
|
22
|
+
'server:start': {
|
|
23
|
+
after: (info: ServerStartInfo) => void | Promise<void>
|
|
24
|
+
/**
|
|
25
|
+
* Only when the server is reachable through a tunnel; runs after `after`.
|
|
26
|
+
*/
|
|
27
|
+
tunneled: (info: TunneledServerStartInfo) => void | Promise<void>
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,25 @@ interface ArkstackMiddlewareConfig<TMiddleware> {
|
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/kits.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* What a driver passes to the `server:start` hook (`after` position) once its
|
|
12
|
+
* server is listening, and any tunnel is open.
|
|
13
|
+
*/
|
|
14
|
+
interface ServerStartInfo {
|
|
15
|
+
/** The address the server is bound to, e.g. `0.0.0.0`. */
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
scheme: 'http' | 'https';
|
|
19
|
+
secure: boolean;
|
|
20
|
+
/** A browsable local URL (`localhost` when bound to every interface). */
|
|
21
|
+
url: string;
|
|
22
|
+
/** The public tunnel URL (`TUNNEL_URL`, or the one `ark dev -t` opened), if any. */
|
|
23
|
+
tunnelUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** What the `server:start` hook's `tunneled` position receives: a tunnel is always open. */
|
|
26
|
+
type TunneledServerStartInfo = ServerStartInfo & {
|
|
27
|
+
tunnelUrl: string;
|
|
28
|
+
};
|
|
10
29
|
/**
|
|
11
30
|
* The ArkstackKitDriver class defines the contract for a driver
|
|
12
31
|
* that can be used with the ArkstackKitContract.
|
|
@@ -125,4 +144,4 @@ declare abstract class Arkstack<TApp, TRoutes = unknown, THandler = unknown> {
|
|
|
125
144
|
static setRootDir(dir: string): void;
|
|
126
145
|
}
|
|
127
146
|
//#endregion
|
|
128
|
-
export { Arkstack, ArkstackKitContract, ArkstackKitDriver, ArkstackMiddlewareConfig, ArkstackRouteListOptions, ArkstackRouterContract, ENV, PromiseOrValue, RootDirChangeListener };
|
|
147
|
+
export { Arkstack, ArkstackKitContract, ArkstackKitDriver, ArkstackMiddlewareConfig, ArkstackRouteListOptions, ArkstackRouterContract, ENV, PromiseOrValue, RootDirChangeListener, ServerStartInfo, TunneledServerStartInfo };
|
package/dist/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var Arkstack = class Arkstack {
|
|
|
92
92
|
const previousDir = Arkstack.appRootDir;
|
|
93
93
|
Arkstack.appRootDir = dir;
|
|
94
94
|
if (previousDir === dir) return;
|
|
95
|
-
|
|
95
|
+
Hook.emit("set:root-dir", "after", dir);
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Contract module for Arkstack, providing shared interfaces and type contracts used across the framework.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@arkstack/foundry": "^0.
|
|
32
|
+
"@arkstack/foundry": "^0.20.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsdown --config-loader unrun",
|