@deck-shelves/host 1.3.1 → 1.4.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/README.md +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[](https://www.npmjs.com/package/@deck-shelves/host)
|
|
12
12
|
[](https://www.npmjs.com/package/@deck-shelves/host)
|
|
13
13
|
[](https://www.npmjs.com/package/@deck-shelves/host)
|
|
14
|
-
[](src/contract/index.test.ts)
|
|
15
15
|
[](src/contract/index.ts)
|
|
16
16
|
[](https://bundlephobia.com/package/@deck-shelves/host)
|
|
17
17
|
[](LICENSE)
|
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ var HOST_API_VERSION = "1.2.0";
|
|
|
5
5
|
var INJECTED_HOST_GLOBAL = "__SHELVES_HOST__";
|
|
6
6
|
var FORCE_OWNER_GLOBAL = "__SHELVES_FORCE_OWNER__";
|
|
7
7
|
var OWNER_GLOBAL = "__DECK_SHELVES_OWNER__";
|
|
8
|
+
var OWNER_METADATA_GLOBAL = "__DECK_SHELVES_OWNER_META__";
|
|
8
9
|
function ownershipScope() {
|
|
9
10
|
const g = globalThis;
|
|
10
11
|
return g.window ?? g;
|
|
@@ -38,6 +39,7 @@ exports.FORCE_OWNER_GLOBAL = FORCE_OWNER_GLOBAL;
|
|
|
38
39
|
exports.HOST_API_VERSION = HOST_API_VERSION;
|
|
39
40
|
exports.INJECTED_HOST_GLOBAL = INJECTED_HOST_GLOBAL;
|
|
40
41
|
exports.OWNER_GLOBAL = OWNER_GLOBAL;
|
|
42
|
+
exports.OWNER_METADATA_GLOBAL = OWNER_METADATA_GLOBAL;
|
|
41
43
|
exports.getInjectedHost = getInjectedHost;
|
|
42
44
|
exports.isForcedOwner = isForcedOwner;
|
|
43
45
|
exports.readForcedOwner = readForcedOwner;
|
package/dist/index.d.cts
CHANGED
|
@@ -38,6 +38,14 @@ interface HostLifecycle {
|
|
|
38
38
|
register(plugin: PluginDescriptor): Disposable;
|
|
39
39
|
onMount(cb: () => void): void;
|
|
40
40
|
onUnmount(cb: () => void): void;
|
|
41
|
+
/**
|
|
42
|
+
* Dispose the CURRENT bundle instance: runs every `onUnmount` handler once and
|
|
43
|
+
* clears them. The host calls this before it hot-swaps a new bundle in place, so
|
|
44
|
+
* two instances never both own the Home. Optional (feature-detected) — a bundle
|
|
45
|
+
* needing clean re-eval should register real teardown in `onUnmount`.
|
|
46
|
+
* Returns the number of handlers run.
|
|
47
|
+
*/
|
|
48
|
+
teardown?(): number;
|
|
41
49
|
}
|
|
42
50
|
/** Generic RPC channel into the host backend. Each host routes it to the
|
|
43
51
|
* plugin's data backend through its own transport (an in-process bridge, a
|
|
@@ -242,6 +250,22 @@ interface HostApi {
|
|
|
242
250
|
/** Optional self-update surface; present only on hosts that can obtain and
|
|
243
251
|
* apply an update themselves (see `HostUpdates`). */
|
|
244
252
|
readonly updates?: HostUpdates;
|
|
253
|
+
/** Optional handshake: identifies the host and the capabilities it implements,
|
|
254
|
+
* so a bundle can adapt (and skip feature-detecting each member). Present on
|
|
255
|
+
* hosts that support it; absent hosts are read via direct feature detection. */
|
|
256
|
+
handshake?(): HostHandshake;
|
|
257
|
+
}
|
|
258
|
+
/** What {@link HostApi.handshake} reports: who is hosting, its versions, and a
|
|
259
|
+
* flat map of capability flags the bundle can branch on. `hostKind` is an opaque
|
|
260
|
+
* host-chosen label (see {@link HostOwnerKind}); the contract names no host. */
|
|
261
|
+
interface HostHandshake {
|
|
262
|
+
readonly hostKind: HostOwnerKind;
|
|
263
|
+
/** The host's own product version (e.g. the daemon version). */
|
|
264
|
+
readonly hostVersion: string;
|
|
265
|
+
/** The contract version the host implements ({@link HOST_API_VERSION}). */
|
|
266
|
+
readonly hostApiVersion: string;
|
|
267
|
+
/** Feature flags, e.g. `{ teardown: true, selfUpdate: true, nativeQam: true }`. */
|
|
268
|
+
readonly capabilities: Readonly<Record<string, boolean>>;
|
|
245
269
|
}
|
|
246
270
|
/** An owner label is an opaque, host-chosen string; the contract never enumerates
|
|
247
271
|
concrete names (that would bake a host/loader identity into the boundary). */
|
|
@@ -250,6 +274,12 @@ type HostOwnerKind = string;
|
|
|
250
274
|
declare const INJECTED_HOST_GLOBAL: "__SHELVES_HOST__";
|
|
251
275
|
declare const FORCE_OWNER_GLOBAL: "__SHELVES_FORCE_OWNER__";
|
|
252
276
|
declare const OWNER_GLOBAL: "__DECK_SHELVES_OWNER__";
|
|
277
|
+
declare const OWNER_METADATA_GLOBAL: "__DECK_SHELVES_OWNER_META__";
|
|
278
|
+
/** Version identity published by the bundle that currently owns the renderer. */
|
|
279
|
+
interface HostOwnerMetadata {
|
|
280
|
+
host: HostOwnerKind;
|
|
281
|
+
dsVersion: string;
|
|
282
|
+
}
|
|
253
283
|
/** The injected host runtime, or null when no neutral host is present. */
|
|
254
284
|
declare function getInjectedHost(): ShelvesHostGlobal | null;
|
|
255
285
|
/** The forced-owner label a host stamped, or null when none. */
|
|
@@ -313,7 +343,9 @@ declare global {
|
|
|
313
343
|
* settings writes) so there is exactly one injector and one writer.
|
|
314
344
|
*/
|
|
315
345
|
__DECK_SHELVES_OWNER__?: HostOwnerKind;
|
|
346
|
+
/** Version identity of the bundle that currently owns the renderer. */
|
|
347
|
+
__DECK_SHELVES_OWNER_META__?: HostOwnerMetadata;
|
|
316
348
|
}
|
|
317
349
|
}
|
|
318
350
|
|
|
319
|
-
export { type Disposable, FORCE_OWNER_GLOBAL, HOST_API_VERSION, type HostApi, type HostLifecycle, type HostMainMenu, type HostNotifications, type HostOwnerKind, type HostQam, type HostRoutes, type HostRpc, type HostUi, type HostUpdates, INJECTED_HOST_GLOBAL, type MainMenuEntry, OWNER_GLOBAL, type PlatformApi, type PlatformAppMeta, type PlatformCollection, type PlatformTab, type PluginDescriptor, type QamPanel, type ShelfSource, type ShelvesHostGlobal, type ToastOptions, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
|
351
|
+
export { type Disposable, FORCE_OWNER_GLOBAL, HOST_API_VERSION, type HostApi, type HostHandshake, type HostLifecycle, type HostMainMenu, type HostNotifications, type HostOwnerKind, type HostOwnerMetadata, type HostQam, type HostRoutes, type HostRpc, type HostUi, type HostUpdates, INJECTED_HOST_GLOBAL, type MainMenuEntry, OWNER_GLOBAL, OWNER_METADATA_GLOBAL, type PlatformApi, type PlatformAppMeta, type PlatformCollection, type PlatformTab, type PluginDescriptor, type QamPanel, type ShelfSource, type ShelvesHostGlobal, type ToastOptions, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ interface HostLifecycle {
|
|
|
38
38
|
register(plugin: PluginDescriptor): Disposable;
|
|
39
39
|
onMount(cb: () => void): void;
|
|
40
40
|
onUnmount(cb: () => void): void;
|
|
41
|
+
/**
|
|
42
|
+
* Dispose the CURRENT bundle instance: runs every `onUnmount` handler once and
|
|
43
|
+
* clears them. The host calls this before it hot-swaps a new bundle in place, so
|
|
44
|
+
* two instances never both own the Home. Optional (feature-detected) — a bundle
|
|
45
|
+
* needing clean re-eval should register real teardown in `onUnmount`.
|
|
46
|
+
* Returns the number of handlers run.
|
|
47
|
+
*/
|
|
48
|
+
teardown?(): number;
|
|
41
49
|
}
|
|
42
50
|
/** Generic RPC channel into the host backend. Each host routes it to the
|
|
43
51
|
* plugin's data backend through its own transport (an in-process bridge, a
|
|
@@ -242,6 +250,22 @@ interface HostApi {
|
|
|
242
250
|
/** Optional self-update surface; present only on hosts that can obtain and
|
|
243
251
|
* apply an update themselves (see `HostUpdates`). */
|
|
244
252
|
readonly updates?: HostUpdates;
|
|
253
|
+
/** Optional handshake: identifies the host and the capabilities it implements,
|
|
254
|
+
* so a bundle can adapt (and skip feature-detecting each member). Present on
|
|
255
|
+
* hosts that support it; absent hosts are read via direct feature detection. */
|
|
256
|
+
handshake?(): HostHandshake;
|
|
257
|
+
}
|
|
258
|
+
/** What {@link HostApi.handshake} reports: who is hosting, its versions, and a
|
|
259
|
+
* flat map of capability flags the bundle can branch on. `hostKind` is an opaque
|
|
260
|
+
* host-chosen label (see {@link HostOwnerKind}); the contract names no host. */
|
|
261
|
+
interface HostHandshake {
|
|
262
|
+
readonly hostKind: HostOwnerKind;
|
|
263
|
+
/** The host's own product version (e.g. the daemon version). */
|
|
264
|
+
readonly hostVersion: string;
|
|
265
|
+
/** The contract version the host implements ({@link HOST_API_VERSION}). */
|
|
266
|
+
readonly hostApiVersion: string;
|
|
267
|
+
/** Feature flags, e.g. `{ teardown: true, selfUpdate: true, nativeQam: true }`. */
|
|
268
|
+
readonly capabilities: Readonly<Record<string, boolean>>;
|
|
245
269
|
}
|
|
246
270
|
/** An owner label is an opaque, host-chosen string; the contract never enumerates
|
|
247
271
|
concrete names (that would bake a host/loader identity into the boundary). */
|
|
@@ -250,6 +274,12 @@ type HostOwnerKind = string;
|
|
|
250
274
|
declare const INJECTED_HOST_GLOBAL: "__SHELVES_HOST__";
|
|
251
275
|
declare const FORCE_OWNER_GLOBAL: "__SHELVES_FORCE_OWNER__";
|
|
252
276
|
declare const OWNER_GLOBAL: "__DECK_SHELVES_OWNER__";
|
|
277
|
+
declare const OWNER_METADATA_GLOBAL: "__DECK_SHELVES_OWNER_META__";
|
|
278
|
+
/** Version identity published by the bundle that currently owns the renderer. */
|
|
279
|
+
interface HostOwnerMetadata {
|
|
280
|
+
host: HostOwnerKind;
|
|
281
|
+
dsVersion: string;
|
|
282
|
+
}
|
|
253
283
|
/** The injected host runtime, or null when no neutral host is present. */
|
|
254
284
|
declare function getInjectedHost(): ShelvesHostGlobal | null;
|
|
255
285
|
/** The forced-owner label a host stamped, or null when none. */
|
|
@@ -313,7 +343,9 @@ declare global {
|
|
|
313
343
|
* settings writes) so there is exactly one injector and one writer.
|
|
314
344
|
*/
|
|
315
345
|
__DECK_SHELVES_OWNER__?: HostOwnerKind;
|
|
346
|
+
/** Version identity of the bundle that currently owns the renderer. */
|
|
347
|
+
__DECK_SHELVES_OWNER_META__?: HostOwnerMetadata;
|
|
316
348
|
}
|
|
317
349
|
}
|
|
318
350
|
|
|
319
|
-
export { type Disposable, FORCE_OWNER_GLOBAL, HOST_API_VERSION, type HostApi, type HostLifecycle, type HostMainMenu, type HostNotifications, type HostOwnerKind, type HostQam, type HostRoutes, type HostRpc, type HostUi, type HostUpdates, INJECTED_HOST_GLOBAL, type MainMenuEntry, OWNER_GLOBAL, type PlatformApi, type PlatformAppMeta, type PlatformCollection, type PlatformTab, type PluginDescriptor, type QamPanel, type ShelfSource, type ShelvesHostGlobal, type ToastOptions, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
|
351
|
+
export { type Disposable, FORCE_OWNER_GLOBAL, HOST_API_VERSION, type HostApi, type HostHandshake, type HostLifecycle, type HostMainMenu, type HostNotifications, type HostOwnerKind, type HostOwnerMetadata, type HostQam, type HostRoutes, type HostRpc, type HostUi, type HostUpdates, INJECTED_HOST_GLOBAL, type MainMenuEntry, OWNER_GLOBAL, OWNER_METADATA_GLOBAL, type PlatformApi, type PlatformAppMeta, type PlatformCollection, type PlatformTab, type PluginDescriptor, type QamPanel, type ShelfSource, type ShelvesHostGlobal, type ToastOptions, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ var HOST_API_VERSION = "1.2.0";
|
|
|
3
3
|
var INJECTED_HOST_GLOBAL = "__SHELVES_HOST__";
|
|
4
4
|
var FORCE_OWNER_GLOBAL = "__SHELVES_FORCE_OWNER__";
|
|
5
5
|
var OWNER_GLOBAL = "__DECK_SHELVES_OWNER__";
|
|
6
|
+
var OWNER_METADATA_GLOBAL = "__DECK_SHELVES_OWNER_META__";
|
|
6
7
|
function ownershipScope() {
|
|
7
8
|
const g = globalThis;
|
|
8
9
|
return g.window ?? g;
|
|
@@ -32,4 +33,4 @@ function isForcedOwner() {
|
|
|
32
33
|
return readForcedOwner() != null;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export { FORCE_OWNER_GLOBAL, HOST_API_VERSION, INJECTED_HOST_GLOBAL, OWNER_GLOBAL, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
|
36
|
+
export { FORCE_OWNER_GLOBAL, HOST_API_VERSION, INJECTED_HOST_GLOBAL, OWNER_GLOBAL, OWNER_METADATA_GLOBAL, getInjectedHost, isForcedOwner, readForcedOwner, readOwner };
|
package/package.json
CHANGED