@jointhedots/gear 1.1.16 → 1.1.17
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.
|
@@ -30,9 +30,9 @@ export class BuildTarget {
|
|
|
30
30
|
this.transaction = this.storage.edit();
|
|
31
31
|
return this.transaction;
|
|
32
32
|
}
|
|
33
|
-
store() {
|
|
33
|
+
async store() {
|
|
34
34
|
if (this.transaction) {
|
|
35
|
-
this.transaction.accept();
|
|
35
|
+
await this.transaction.accept();
|
|
36
36
|
this.transaction = null;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -47,10 +47,10 @@ export class BuildTarget {
|
|
|
47
47
|
publish: undefined,
|
|
48
48
|
entries: undefined,
|
|
49
49
|
};
|
|
50
|
-
if (descriptor.
|
|
51
|
-
manifest.
|
|
52
|
-
for (const name in descriptor.
|
|
53
|
-
manifest.
|
|
50
|
+
if (descriptor.apis) {
|
|
51
|
+
manifest.apis = {};
|
|
52
|
+
for (const name in descriptor.apis) {
|
|
53
|
+
manifest.apis[name] = this.esmodules.add_resource_entry(descriptor.apis[name], baseDir, library);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
if (descriptor.resources) {
|
|
@@ -90,7 +90,7 @@ export class BuildTarget {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
this.store();
|
|
93
|
+
await this.store();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -287,7 +287,7 @@ export function StoragePlugin(task, onReady) {
|
|
|
287
287
|
throw new Error(`Invalid output file: ${file.path}`);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
task.target.store();
|
|
290
|
+
await task.target.store();
|
|
291
291
|
const storeTime = (Date.now() - storeStart) / 1000;
|
|
292
292
|
const buildTime = (Date.now() - buildStartTime) / 1000;
|
|
293
293
|
task.log.info(`Store ES graph in ${result.outputFiles.length} file(s) (compile: ${buildTime.toFixed(2)}s, store: ${storeTime.toFixed(2)}s)`);
|
package/esm/model/component.js
CHANGED
|
@@ -14,7 +14,7 @@ export function makeComponentPublication(manif) {
|
|
|
14
14
|
type: manif.type,
|
|
15
15
|
icon: manif.icon,
|
|
16
16
|
title: manif.title || manif.name || manif.$id,
|
|
17
|
-
services: manif.
|
|
17
|
+
services: manif.apis ? Object.keys(manif.apis) : [],
|
|
18
18
|
description: manif.description || "",
|
|
19
19
|
keywords: manif.keywords,
|
|
20
20
|
tags: manif.tags,
|
|
@@ -49,6 +49,10 @@ async function discover_component(lib, fpath) {
|
|
|
49
49
|
const err = checkComponentManifest(desc, fpath);
|
|
50
50
|
if (err)
|
|
51
51
|
throw err;
|
|
52
|
+
if (!desc.apis && desc["services"]) {
|
|
53
|
+
desc.apis = desc["services"]; // Migrate renaming 'services' -> 'apis'
|
|
54
|
+
lib.log.warn(`Component '${desc.$id}' manifest shall rename 'services' -> 'apis'`);
|
|
55
|
+
}
|
|
52
56
|
bundle.components.set(fpath, desc);
|
|
53
57
|
lib.log.info(`+ 🧩 component: ${desc.$id} ${desc.type ? `(${desc.type})` : ""}`);
|
|
54
58
|
return true;
|
package/esm/model/storage.js
CHANGED
|
@@ -50,24 +50,22 @@ export class StorageTransaction {
|
|
|
50
50
|
const hash = createContentCID(contentData);
|
|
51
51
|
this.pending.set(fpath, { data: contentData, hash });
|
|
52
52
|
}
|
|
53
|
-
accept() {
|
|
53
|
+
async accept() {
|
|
54
54
|
const { root, scratch, baseDir } = this;
|
|
55
|
-
|
|
55
|
+
await Fsp.mkdir(baseDir, { recursive: true });
|
|
56
56
|
const changes = { added: [], updated: [], changed: false };
|
|
57
|
+
const writes = [];
|
|
57
58
|
for (const [fpath, { data, hash }] of this.pending) {
|
|
58
59
|
const prev = root.cache.get(fpath);
|
|
59
60
|
if (prev !== hash) {
|
|
60
61
|
;
|
|
61
62
|
(prev ? changes.updated : changes.added).push(Path.basename(fpath));
|
|
62
|
-
|
|
63
|
-
Fs.writeFileSync(fpath, data);
|
|
63
|
+
writes.push(Fsp.mkdir(Path.dirname(fpath), { recursive: true }).then(() => Fsp.writeFile(fpath, data)));
|
|
64
64
|
}
|
|
65
65
|
root.cache.set(fpath, hash);
|
|
66
66
|
}
|
|
67
|
+
await Promise.all(writes);
|
|
67
68
|
this.pending.clear();
|
|
68
|
-
/*
|
|
69
|
-
const removed = root.cache.size - newCache.size + changes.added.length
|
|
70
|
-
changes.changed = removed !== 0 || changes.added.length !== 0 || changes.updated.length !== 0*/
|
|
71
69
|
if (changes.updated.length > 0 || changes.added.length > 0) {
|
|
72
70
|
root.on_changes.sendEventsToAll("change", changes);
|
|
73
71
|
}
|
package/package.json
CHANGED