@mosetta/build 0.0.32 → 0.0.34
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 +36 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @mosetta/build
|
|
2
2
|
|
|
3
|
+
## 0.0.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The parts a palette plays in a workbench — its assistant, dictation — are the palette's own: `workbench` in `mosetta.json` (`{ "assistant": "<tile>.<action>", "transcribe": "<tile>.<action>" }`), carried by the palette's catalog entry, whichever way a site connects the palette. `service` is the grant alone; any other key in it is refused.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @mosetta/server@0.0.34
|
|
10
|
+
- @mosetta/router@0.0.34
|
|
11
|
+
- @mosetta/runtime@0.0.34
|
|
12
|
+
- @mosetta/server-action@0.0.34
|
|
13
|
+
- @mosetta/tar@0.0.34
|
|
14
|
+
|
|
15
|
+
## 0.0.33
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 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.
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @mosetta/server-action@0.0.33
|
|
22
|
+
- @mosetta/server@0.0.33
|
|
23
|
+
- @mosetta/router@0.0.33
|
|
24
|
+
- @mosetta/runtime@0.0.33
|
|
25
|
+
- @mosetta/tar@0.0.33
|
|
26
|
+
|
|
3
27
|
## 0.0.32
|
|
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.34",
|
|
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/
|
|
34
|
-
"@mosetta/
|
|
35
|
-
"@mosetta/
|
|
31
|
+
"@mosetta/runtime": "0.0.34",
|
|
32
|
+
"@mosetta/server": "0.0.34",
|
|
33
|
+
"@mosetta/router": "0.0.34",
|
|
34
|
+
"@mosetta/tar": "0.0.34",
|
|
35
|
+
"@mosetta/server-action": "0.0.34"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
package/src/build.mjs
CHANGED
|
@@ -375,10 +375,13 @@ 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
|
|
378
|
+
// (a palette offering itself as a service, or playing a part in a workbench, is named too: its
|
|
379
|
+
// offer and its parts are read here)
|
|
380
|
+
const cfg = readConfig(fileSystem, r.dir);
|
|
379
381
|
const brings = mods.some((m) => m.namespace === r.namespace)
|
|
380
382
|
|| (r.dir !== root && discoverPrefabsIn(fileSystem, r.dir, () => {}).length > 0)
|
|
381
|
-
||
|
|
383
|
+
|| cfg?.service !== undefined
|
|
384
|
+
|| cfg?.workbench !== undefined;
|
|
382
385
|
if (!brings) continue;
|
|
383
386
|
const descriptor = distributionDescriptor(fileSystem, r, (key, file) => {
|
|
384
387
|
watchFiles.add(file);
|
|
@@ -557,9 +560,11 @@ export function sourceLinkOf(repository) {
|
|
|
557
560
|
}
|
|
558
561
|
|
|
559
562
|
/** 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)|[a-z][a-z0-9-]{0,62}(?:\/[a-z][A-Za-z0-9]{0,63})?)$/;
|
|
561
|
-
/**
|
|
562
|
-
const
|
|
563
|
+
const SERVICE_GRANT_RE = /^(?:@(?:previews|media|code|icon|repositories)|[a-z][a-z0-9-]{0,62}(?:\/[a-z][A-Za-z0-9]{0,63})?)$/;
|
|
564
|
+
/** an action of the palette named for a workbench: `<tile>.<action>` */
|
|
565
|
+
const WORKBENCH_ACTION_RE = /^[a-z][A-Za-z0-9]{0,63}\.[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
566
|
+
/** the parts a palette may play in a workbench */
|
|
567
|
+
const WORKBENCH_ROLES = ['assistant', 'transcribe'];
|
|
563
568
|
|
|
564
569
|
/**
|
|
565
570
|
* A distribution's offer of itself as a service (mosetta.json `service: { grant: [...] }`): what it
|
|
@@ -568,16 +573,34 @@ const SERVICE_ACTION_RE = /^[a-z][A-Za-z0-9]{0,63}\.[A-Za-z][A-Za-z0-9_]{0,63}$/
|
|
|
568
573
|
*/
|
|
569
574
|
export function serviceOf(raw) {
|
|
570
575
|
if (raw === undefined) return null;
|
|
576
|
+
const unknown = raw !== null && typeof raw === 'object' ? Object.keys(raw).find((key) => key !== 'grant') : undefined;
|
|
577
|
+
if (unknown !== undefined) throw new Error(`mosetta.json: service.${unknown} is no part of a service's offer — it is { "grant": [...] }`);
|
|
571
578
|
const grant = raw?.grant ?? [];
|
|
572
579
|
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`) the service asks to call');
|
|
580
|
+
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
581
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
582
|
+
return { grant: [...new Set(grant)] };
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* The parts a palette plays in the workbench of a site it is connected to (mosetta.json
|
|
587
|
+
* `workbench: { assistant, transcribe }`): the assistant's turn, dictation — each an action of its
|
|
588
|
+
* own, `<tile>.<action>`. The palette's own, whichever way a site connects it — as code or as a
|
|
589
|
+
* service. A part named wrong stops the build: a palette that meant one must not ship without it.
|
|
590
|
+
*/
|
|
591
|
+
export function workbenchOf(raw) {
|
|
592
|
+
if (raw === undefined) return null;
|
|
593
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) throw new Error('mosetta.json: workbench names the parts the palette plays in a workbench: { "assistant": "<tile>.<action>", "transcribe": "<tile>.<action>" }');
|
|
594
|
+
const unknown = Object.keys(raw).find((role) => !WORKBENCH_ROLES.includes(role));
|
|
595
|
+
if (unknown !== undefined) throw new Error(`mosetta.json: workbench.${unknown} is no part of a workbench — the parts are ${WORKBENCH_ROLES.join(', ')}`);
|
|
596
|
+
const workbench = {};
|
|
597
|
+
for (const role of WORKBENCH_ROLES) {
|
|
598
|
+
const named = raw[role];
|
|
599
|
+
if (named === undefined) continue;
|
|
600
|
+
if (typeof named !== 'string' || !WORKBENCH_ACTION_RE.test(named)) throw new Error(`mosetta.json: workbench.${role} names an action of the palette, \`<tile>.<action>\``);
|
|
601
|
+
workbench[role] = named;
|
|
579
602
|
}
|
|
580
|
-
return
|
|
603
|
+
return Object.keys(workbench).length ? workbench : null;
|
|
581
604
|
}
|
|
582
605
|
|
|
583
606
|
/**
|
|
@@ -610,6 +633,8 @@ export function distributionDescriptor(fileSystem, root, ship) {
|
|
|
610
633
|
...(cfg.base === true ? { base: true } : {}),
|
|
611
634
|
// offered to other sites as a SERVICE: what it asks to call on a site that takes it
|
|
612
635
|
...(serviceOf(cfg.service) ? { service: serviceOf(cfg.service) } : {}),
|
|
636
|
+
// the parts it plays in a workbench (the assistant's turn, dictation)
|
|
637
|
+
...(workbenchOf(cfg.workbench) ? { workbench: workbenchOf(cfg.workbench) } : {}),
|
|
613
638
|
...(text(cfg.description) ?? text(pkg.description) ? { description: text(cfg.description) ?? text(pkg.description) } : {}),
|
|
614
639
|
...(text(cfg.source) ?? sourceLinkOf(pkg.repository) ? { source: text(cfg.source) ?? sourceLinkOf(pkg.repository) } : {}),
|
|
615
640
|
...(changesOf(fileSystem, root) ? { changes: changesOf(fileSystem, root) } : {}),
|