@toa.io/definitions 1.0.0-alpha.333 → 1.0.0-alpha.336

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/definitions",
3
- "version": "1.0.0-alpha.333",
3
+ "version": "1.0.0-alpha.336",
4
4
  "type": "module",
5
5
  "description": "What Toa packages declare, read without running them",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -72,5 +72,5 @@
72
72
  "optional": true
73
73
  }
74
74
  },
75
- "gitHead": "ddb74b2f99026fae540a8a8e0a49c26cbd22886a"
75
+ "gitHead": "ba35d24fcf468ae43c6c6844e407fbeba4f01b44"
76
76
  }
@@ -0,0 +1 @@
1
+ export { shipped, type Components } from './read.ts';
@@ -0,0 +1,2 @@
1
+ export { shipped } from './read.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/digest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,WAAW,CAAA"}
@@ -4,6 +4,11 @@
4
4
  * beside it; a running service reads them from the extension, where their code is.
5
5
  */
6
6
  export declare function components(suffix: string, filter?: (label: string) => boolean): Components;
7
+ /**
8
+ * Every component an extension ships, whichever of them an annotation deploys: what a running
9
+ * service looks the one it runs up in. Nothing where Toa ships no such extension.
10
+ */
11
+ export declare function shipped(suffix: string): Components | undefined;
7
12
  /**
8
13
  * What the components an extension ships declare in their manifests, by package name — read
9
14
  * from the digest for the reason the manifests are: the extension is not installed beside a
@@ -1,4 +1,4 @@
1
- import { readFileSync } from 'node:fs';
1
+ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
3
  /**
4
4
  * The components an extension ships, as the digest of their manifests generated when this
@@ -12,6 +12,15 @@ export function components(suffix, filter) {
12
12
  manifests: manifests.map((manifest) => structuredClone(manifest.manifest))
13
13
  };
14
14
  }
15
+ /**
16
+ * Every component an extension ships, whichever of them an annotation deploys: what a running
17
+ * service looks the one it runs up in. Nothing where Toa ships no such extension.
18
+ */
19
+ export function shipped(suffix) {
20
+ if (cache[suffix] === undefined && !existsSync(resolve(ROOT, suffix + '.json')))
21
+ return undefined;
22
+ return components(suffix);
23
+ }
15
24
  function digest(suffix) {
16
25
  cache[suffix] ??= JSON.parse(readFileSync(resolve(ROOT, suffix + '.json'), 'utf8'));
17
26
  return cache[suffix];
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../source/digest/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,MAAc,EACd,MAAmC;IAEnC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAA;IAEvF,OAAO;QACL,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnD,SAAS,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC3E,CAAA;AACH,CAAC;AAED,SAAS,MAAM,CAAC,MAAc;IAC5B,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;IAEnF,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,KAAK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