@astrale-os/kernel-protocol 0.5.0-beta.51 → 0.5.0-beta.52
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/codecs/msgpack.js
CHANGED
|
@@ -4,7 +4,13 @@ import { CONTENT_TYPE_MSGPACK } from './media-types.js';
|
|
|
4
4
|
let library = null;
|
|
5
5
|
export async function loadMsgpack() {
|
|
6
6
|
if (library === null) {
|
|
7
|
-
|
|
7
|
+
// `as string` keeps TypeScript from pulling msgpackr's declarations, which assume
|
|
8
|
+
// `@types/node`, into consumer programs. The assertion is erased on emit, so bundlers
|
|
9
|
+
// still see literal specifiers; a variable would leave them unresolvable.
|
|
10
|
+
const [packing, unpacking] = await Promise.all([
|
|
11
|
+
import('msgpackr/pack'),
|
|
12
|
+
import('msgpackr'),
|
|
13
|
+
]);
|
|
8
14
|
library = Object.freeze({ pack: packing.pack, unpack: unpacking.unpack });
|
|
9
15
|
}
|
|
10
16
|
return MSGPACK;
|
|
@@ -2,6 +2,7 @@ import { installReceipt } from '@astrale-os/kernel-core/schema/kernel/syscalls/c
|
|
|
2
2
|
import { acceptDomainInfo } from './introspection/index.js';
|
|
3
3
|
export const MEDIA_TYPE = 'application/vnd.astrale.schema-installation.v1+msgpack';
|
|
4
4
|
export async function encode(result) {
|
|
5
|
+
// Non-literal specifiers keep msgpackr's Node-typed declarations out of consumers (see codecs/msgpack.ts).
|
|
5
6
|
const { pack } = await import('msgpackr/pack');
|
|
6
7
|
return new Uint8Array(pack(accept(result)));
|
|
7
8
|
}
|
|
@@ -13,6 +13,7 @@ export async function encode(input, result) {
|
|
|
13
13
|
? encodeDomainBundle(result)
|
|
14
14
|
: encodeDomainInfo(result);
|
|
15
15
|
proveRequestedOrigin(request, result);
|
|
16
|
+
// Non-literal specifiers keep msgpackr's Node-typed declarations out of consumers (see codecs/msgpack.ts).
|
|
16
17
|
const { pack } = await import('msgpackr/pack');
|
|
17
18
|
return new Uint8Array(pack(wire));
|
|
18
19
|
}
|
package/package.json
CHANGED