@sparkelf/dsh-web-runtime-compat 0.0.0-stage → 0.2.9-alpha.99
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/lib/index.js +31 -0
- package/lib/types/index.d.ts +18 -0
- package/package.json +33 -4
- package/README.md +0 -3
package/lib/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { networkInterfaces } from "node:os";
|
|
2
|
+
//#region lib/types/index.js
|
|
3
|
+
/**
|
|
4
|
+
* Publish the pre-0.2.3 `webRuntime` service beside `webStartup`.
|
|
5
|
+
*
|
|
6
|
+
* 0.2.3 renamed the bind-dependent provider to `webStartup`. Third-party bundles
|
|
7
|
+
* that still inject `webRuntime` would stay pending forever, so this row rebuilds
|
|
8
|
+
* the old shape from the new services: the sampled LAN literals for a wildcard
|
|
9
|
+
* bind plus the deployment's own trusted hosts.
|
|
10
|
+
* @module @sparkelf/dsh-web-runtime-compat
|
|
11
|
+
*/
|
|
12
|
+
/** Stable plugin name. */
|
|
13
|
+
const name = "web-runtime-compat";
|
|
14
|
+
/** `webStartup` supplies the flags; `webServer` reports the bound host. */
|
|
15
|
+
const inject = ["webStartup", "webServer"];
|
|
16
|
+
/**
|
|
17
|
+
* Publish `webRuntime` for the lifetime of this plugin.
|
|
18
|
+
* @param ctx - plugin context injecting the startup and server services.
|
|
19
|
+
*/
|
|
20
|
+
function apply(ctx) {
|
|
21
|
+
const server = ctx.get("webServer");
|
|
22
|
+
const startup = ctx.get("webStartup");
|
|
23
|
+
const boundHost = server?.host ?? "";
|
|
24
|
+
const lanAddresses = boundHost === "" || boundHost === "0.0.0.0" || boundHost === "::" ? Object.values(networkInterfaces()).flat().filter((iface) => iface !== void 0 && iface.family === "IPv4" && !iface.internal).map((iface) => iface.address) : [];
|
|
25
|
+
ctx.provide("webRuntime", {
|
|
26
|
+
lanAddresses,
|
|
27
|
+
trustedHosts: [...lanAddresses, ...startup?.trustedHosts ?? []]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** Stable plugin name. */
|
|
3
|
+
export declare const name = "web-runtime-compat";
|
|
4
|
+
/** `webStartup` supplies the flags; `webServer` reports the bound host. */
|
|
5
|
+
export declare const inject: string[];
|
|
6
|
+
/** The pre-0.2.3 service shape. */
|
|
7
|
+
export interface WebRuntimeCompat {
|
|
8
|
+
/** Non-internal IPv4 literals sampled from a wildcard bind. */
|
|
9
|
+
readonly lanAddresses: readonly string[];
|
|
10
|
+
/** Authorities this deployment serves, as the old row exposed them. */
|
|
11
|
+
readonly trustedHosts: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Publish `webRuntime` for the lifetime of this plugin.
|
|
15
|
+
* @param ctx - plugin context injecting the startup and server services.
|
|
16
|
+
*/
|
|
17
|
+
export declare function apply(ctx: Context): void;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-web-runtime-compat",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "Provide the pre-0.2.3 webRuntime service from webStartup for third-party bundles that still inject it",
|
|
4
|
+
"version": "0.2.9-alpha.99",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/plus/web-runtime-compat"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/index.js",
|
|
25
|
+
"lib/types/**/*.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"bundle": "tsdown"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@deepseek-ai/cordis": ">=4.2.0-alpha.1",
|
|
33
|
+
"@deepseek-ai/dsh-host-webserver": ">=0.2.3-alpha.2"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/README.md
DELETED