@syncbridge/common 0.13.4 → 0.13.6
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/constants.d.ts +1 -1
- package/constants.js +1 -1
- package/package.json +5 -5
- package/registry/extension-registry.js +11 -7
package/constants.d.ts
CHANGED
package/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncbridge/common",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.6",
|
|
4
4
|
"description": "SyncBridge Common utilities",
|
|
5
5
|
"author": "Panates Inc",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@jsopen/objects": "^2.
|
|
8
|
+
"@jsopen/objects": "^2.3.4",
|
|
9
9
|
"fast-deep-equal": "^3.1.3",
|
|
10
10
|
"node-events-async": "^1.5.2",
|
|
11
11
|
"caller-callsite": "^6.0.0",
|
|
12
12
|
"reflect-metadata": "^0.2.2",
|
|
13
13
|
"semver": "^7.8.5",
|
|
14
|
-
"ts-gems": "^
|
|
15
|
-
"valgen": "^
|
|
14
|
+
"ts-gems": "^4.0.4",
|
|
15
|
+
"valgen": "^7.0.3"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@opra/common": ">=1.17.1 <2"
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|
|
@@ -102,7 +102,7 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
102
102
|
getComponent(uri, version = '*') {
|
|
103
103
|
const cmp = this.findComponent(uri, version);
|
|
104
104
|
if (!cmp) {
|
|
105
|
-
throw new SbError(`Component "${uri}
|
|
105
|
+
throw new SbError(`Component "${uri}${version ? `:${version}` : ''}" not found in registry`);
|
|
106
106
|
}
|
|
107
107
|
return cmp;
|
|
108
108
|
}
|
|
@@ -120,7 +120,7 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
120
120
|
getProcessor(uri, version = '*') {
|
|
121
121
|
const cmp = this.findProcessor(uri, version);
|
|
122
122
|
if (!cmp) {
|
|
123
|
-
throw new SbError(`Processor "${uri}
|
|
123
|
+
throw new SbError(`Processor "${uri}${version ? `:${version}` : ''}" not found in registry`);
|
|
124
124
|
}
|
|
125
125
|
return cmp;
|
|
126
126
|
}
|
|
@@ -241,10 +241,10 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
241
241
|
pkgVersions[i] = pkg;
|
|
242
242
|
else
|
|
243
243
|
pkgVersions.push(pkg);
|
|
244
|
-
pkgVersions.sort((a, b) =>
|
|
244
|
+
pkgVersions.sort((a, b) => semver.compare(b.version, a.version));
|
|
245
245
|
if (pkg.components?.length) {
|
|
246
246
|
for (const cmp of pkg.components) {
|
|
247
|
-
if (this.findProcessor(cmp.uri))
|
|
247
|
+
if (this.findProcessor(cmp.uri, '*'))
|
|
248
248
|
throw new SbError(`Component "${cmp.uri}" is already registered as a processor.`);
|
|
249
249
|
/** Store to components */
|
|
250
250
|
const id = uriToId(cmp.uri);
|
|
@@ -274,7 +274,7 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
274
274
|
}
|
|
275
275
|
if (pkg.processors?.length) {
|
|
276
276
|
for (const prc of pkg.processors) {
|
|
277
|
-
if (this.findComponent(prc.uri))
|
|
277
|
+
if (this.findComponent(prc.uri, '*'))
|
|
278
278
|
throw new SbError(`Processor "${prc.uri}" is already registered as a component.`);
|
|
279
279
|
/** Store to processors */
|
|
280
280
|
const id = uriToId(prc.uri);
|
|
@@ -286,8 +286,10 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
286
286
|
i = items.findIndex(v => v.version === prc.version);
|
|
287
287
|
if (i >= 0)
|
|
288
288
|
items[i] = prc;
|
|
289
|
-
else
|
|
289
|
+
else {
|
|
290
290
|
items.push(prc);
|
|
291
|
+
items.sort((a, b) => semver.compare(b.version, a.version));
|
|
292
|
+
}
|
|
291
293
|
/** Store to componentsByClassName */
|
|
292
294
|
items = this.processors.get(prc.className);
|
|
293
295
|
if (!items) {
|
|
@@ -297,8 +299,10 @@ export class ExtensionRegistry extends AsyncEventEmitter {
|
|
|
297
299
|
i = items.findIndex(v => v.version === prc.version);
|
|
298
300
|
if (i >= 0)
|
|
299
301
|
items[i] = prc;
|
|
300
|
-
else
|
|
302
|
+
else {
|
|
301
303
|
items.push(prc);
|
|
304
|
+
items.sort((a, b) => semver.compare(b.version, a.version));
|
|
305
|
+
}
|
|
302
306
|
this.emitSafe('register-processor', prc);
|
|
303
307
|
}
|
|
304
308
|
}
|