lucid-package 0.0.12 → 0.0.13
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
package/src/shapelibrary.js
CHANGED
|
@@ -38,10 +38,11 @@ const defaultNameMap = new Map([
|
|
|
38
38
|
//Produce JSON equivalent to the document service's
|
|
39
39
|
// /shapeLibraries/:name/shapes endpoint
|
|
40
40
|
async function getShapeListJson(name, packagePath) {
|
|
41
|
+
const packageManifest = await (0, packagemanifest_1.readManifest)(packagePath + '/');
|
|
41
42
|
const rawManifest = await fs.readFile(packagePath + `/shapelibraries/${name}/library.manifest`);
|
|
42
43
|
const manifest = hjson.parse(rawManifest.toString());
|
|
43
44
|
return JSON.stringify(await Promise.all(manifest['shapes'].map(async (shapeManifest, index) => {
|
|
44
|
-
var _a;
|
|
45
|
+
var _a, _b;
|
|
45
46
|
const rawShapeData = await fs.readFile(packagePath + `/shapelibraries/${name}/shapes/${shapeManifest['shape']}.shape`);
|
|
46
47
|
const shapeData = hjson.parse(rawShapeData.toString());
|
|
47
48
|
const properties = {
|
|
@@ -61,8 +62,8 @@ async function getShapeListJson(name, packagePath) {
|
|
|
61
62
|
'name': shapeManifest['name'],
|
|
62
63
|
'i18n': {},
|
|
63
64
|
'sourcePackage': {
|
|
64
|
-
'packageId': '__local__',
|
|
65
|
-
'version': '
|
|
65
|
+
'packageId': (_a = packageManifest['id']) !== null && _a !== void 0 ? _a : '__local__',
|
|
66
|
+
'version': packageManifest['version'],
|
|
66
67
|
'library': name,
|
|
67
68
|
'shape': shapeManifest['shape'],
|
|
68
69
|
},
|
|
@@ -98,7 +99,7 @@ async function getShapeListJson(name, packagePath) {
|
|
|
98
99
|
}
|
|
99
100
|
for (var key in shapeManifest['defaults']) {
|
|
100
101
|
if (key !== 'width' && key !== 'height') {
|
|
101
|
-
const outName = (
|
|
102
|
+
const outName = (_b = defaultNameMap.get(key)) !== null && _b !== void 0 ? _b : key;
|
|
102
103
|
properties[outName] = shapeManifest['defaults'][key];
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/** @ignore */
|
|
1
2
|
declare namespace lucid {
|
|
2
3
|
export function executeCommand(name: string, params: any): any;
|
|
3
4
|
export function listen(msg: any): void;
|
|
5
|
+
export function getPackageId(): string;
|
|
6
|
+
export function getVersion(): string;
|
|
4
7
|
}
|
|
5
8
|
|
|
9
|
+
/** @ignore */
|
|
6
10
|
declare namespace console {
|
|
7
11
|
export function log(...args: any[]): void;
|
|
8
12
|
}
|