@mosetta/build 0.0.31 → 0.0.33
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/CHANGELOG.md +24 -0
- package/package.json +6 -6
- package/src/build.mjs +32 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mosetta/build
|
|
2
2
|
|
|
3
|
+
## 0.0.33
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A service may be granted a site's own code: each call then comes with a key to the site's palette alone, taken back once it is answered (the site a call works for names it: `SITE_TOKEN.code`). A token may have a scope; one with a scope opens its palette's code at the API and nothing else. A service may also be granted the site's icon and the person's own repositories, and play one more part in a workbench — dictation. A host may name services every site of its takes; it connects them, and moves them to the newest version offered, as an editor opens the workbench.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @mosetta/server-action@0.0.33
|
|
10
|
+
- @mosetta/server@0.0.33
|
|
11
|
+
- @mosetta/router@0.0.33
|
|
12
|
+
- @mosetta/runtime@0.0.33
|
|
13
|
+
- @mosetta/tar@0.0.33
|
|
14
|
+
|
|
15
|
+
## 0.0.32
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- A palette can offer itself as a service in its mosetta.json (`service: { grant, workbench }`): what it asks to call on a site that takes it, and the part it plays in that site's workbench (the assistant: which of its actions a turn of the conversation is). The site that publishes it lists it among its offers; a site that takes it keeps the part from the offer, takes the palette's blocks (its public code only), and declares where its services are (host capability `services`).
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @mosetta/server@0.0.32
|
|
22
|
+
- @mosetta/router@0.0.32
|
|
23
|
+
- @mosetta/runtime@0.0.32
|
|
24
|
+
- @mosetta/server-action@0.0.32
|
|
25
|
+
- @mosetta/tar@0.0.32
|
|
26
|
+
|
|
3
27
|
## 0.0.31
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mosetta/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The core of the tile forge: builds a tile palette — its tile side artifacts, their dependency closure, the tile host descriptor. Environment-agnostic — the file system and the bundling engine are supplied from outside.",
|
|
6
6
|
"type": "module",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"scheduler": "*",
|
|
29
29
|
"systemjs": "^6.15.1",
|
|
30
30
|
"yaml": "^2.9.0",
|
|
31
|
-
"@mosetta/
|
|
32
|
-
"@mosetta/
|
|
33
|
-
"@mosetta/server": "0.0.
|
|
34
|
-
"@mosetta/
|
|
35
|
-
"@mosetta/
|
|
31
|
+
"@mosetta/router": "0.0.33",
|
|
32
|
+
"@mosetta/runtime": "0.0.33",
|
|
33
|
+
"@mosetta/server": "0.0.33",
|
|
34
|
+
"@mosetta/server-action": "0.0.33",
|
|
35
|
+
"@mosetta/tar": "0.0.33"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
package/src/build.mjs
CHANGED
|
@@ -375,8 +375,10 @@ export async function build(root, { mode = 'development', log, fileSystem, resol
|
|
|
375
375
|
for (const r of builtRoots) {
|
|
376
376
|
// the APP's own prefabs are its site's content (the picker's "prefabs of this site"), not a
|
|
377
377
|
// distribution: the app counts only for blocks of its own
|
|
378
|
+
// (a palette offering itself as a service is named too: the sites taking it read its offer here)
|
|
378
379
|
const brings = mods.some((m) => m.namespace === r.namespace)
|
|
379
|
-
|| (r.dir !== root && discoverPrefabsIn(fileSystem, r.dir, () => {}).length > 0)
|
|
380
|
+
|| (r.dir !== root && discoverPrefabsIn(fileSystem, r.dir, () => {}).length > 0)
|
|
381
|
+
|| readConfig(fileSystem, r.dir)?.service !== undefined;
|
|
380
382
|
if (!brings) continue;
|
|
381
383
|
const descriptor = distributionDescriptor(fileSystem, r, (key, file) => {
|
|
382
384
|
watchFiles.add(file);
|
|
@@ -554,6 +556,33 @@ export function sourceLinkOf(repository) {
|
|
|
554
556
|
return directory ? `${base}/tree/HEAD/${directory}` : base;
|
|
555
557
|
}
|
|
556
558
|
|
|
559
|
+
/** what a service may be granted on a site that takes it: palettes, a palette's tile, or the host's doors */
|
|
560
|
+
const SERVICE_GRANT_RE = /^(?:@(?:previews|media|code|icon|repositories)|[a-z][a-z0-9-]{0,62}(?:\/[a-z][A-Za-z0-9]{0,63})?)$/;
|
|
561
|
+
/** a service's action named for a workbench: `<tile>.<action>` */
|
|
562
|
+
const SERVICE_ACTION_RE = /^[a-z][A-Za-z0-9]{0,63}\.[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* A distribution's offer of itself as a service (mosetta.json `service: { grant: [...] }`): what it
|
|
566
|
+
* asks to call on a site that takes it, as the person a call comes from. Anything else is no offer —
|
|
567
|
+
* loudly: a palette that meant one must not ship without it.
|
|
568
|
+
*/
|
|
569
|
+
export function serviceOf(raw) {
|
|
570
|
+
if (raw === undefined) return null;
|
|
571
|
+
const grant = raw?.grant ?? [];
|
|
572
|
+
if (!Array.isArray(grant) || grant.length > 32 || !grant.every((g) => typeof g === 'string' && SERVICE_GRANT_RE.test(g))) {
|
|
573
|
+
throw new Error('mosetta.json: service.grant is up to 32 palettes (`brand`), tiles (`brand/tile`) or host doors (`@previews`, `@media`, `@code`, `@icon`, `@repositories`) the service asks to call');
|
|
574
|
+
}
|
|
575
|
+
// the parts it plays in a workbench that takes it — the assistant's turn, dictation — each `<tile>.<action>`
|
|
576
|
+
const workbench = {};
|
|
577
|
+
for (const role of ['assistant', 'transcribe']) {
|
|
578
|
+
const named = raw?.workbench?.[role];
|
|
579
|
+
if (named === undefined) continue;
|
|
580
|
+
if (typeof named !== 'string' || !SERVICE_ACTION_RE.test(named)) throw new Error(`mosetta.json: service.workbench.${role} names an action of the palette, \`<tile>.<action>\``);
|
|
581
|
+
workbench[role] = named;
|
|
582
|
+
}
|
|
583
|
+
return { grant: [...new Set(grant)], ...(Object.keys(workbench).length ? { workbench } : {}) };
|
|
584
|
+
}
|
|
585
|
+
|
|
557
586
|
/**
|
|
558
587
|
* A distribution's catalog entity: what it calls itself, from its mosetta.json (title,
|
|
559
588
|
* description, icon, cover, source) with package.json behind the description and the source.
|
|
@@ -582,6 +611,8 @@ export function distributionDescriptor(fileSystem, root, ship) {
|
|
|
582
611
|
...(cfg.internal === true ? { internal: true } : {}),
|
|
583
612
|
// the distribution others are built on (the UI kit): always connected, no switch
|
|
584
613
|
...(cfg.base === true ? { base: true } : {}),
|
|
614
|
+
// offered to other sites as a SERVICE: what it asks to call on a site that takes it
|
|
615
|
+
...(serviceOf(cfg.service) ? { service: serviceOf(cfg.service) } : {}),
|
|
585
616
|
...(text(cfg.description) ?? text(pkg.description) ? { description: text(cfg.description) ?? text(pkg.description) } : {}),
|
|
586
617
|
...(text(cfg.source) ?? sourceLinkOf(pkg.repository) ? { source: text(cfg.source) ?? sourceLinkOf(pkg.repository) } : {}),
|
|
587
618
|
...(changesOf(fileSystem, root) ? { changes: changesOf(fileSystem, root) } : {}),
|