pmcf 3.10.9 → 3.10.11
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 +1 -1
- package/src/base.mjs +14 -31
- package/src/types.mjs +2 -2
- package/types/base.d.mts +1 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { allOutputs } from "npm-pkgbuild";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
parse,
|
|
5
|
+
expand,
|
|
6
|
+
tokens,
|
|
5
7
|
baseTypes,
|
|
6
8
|
attributeIterator,
|
|
7
9
|
name_attribute_writable,
|
|
@@ -482,45 +484,26 @@ export class Base {
|
|
|
482
484
|
return false;
|
|
483
485
|
}
|
|
484
486
|
|
|
487
|
+
get properties() {
|
|
488
|
+
return this._properties;
|
|
489
|
+
}
|
|
490
|
+
|
|
485
491
|
property(name) {
|
|
486
492
|
return this._properties?.[name] ?? this.owner?.property(name);
|
|
487
493
|
}
|
|
488
494
|
|
|
489
495
|
expand(object) {
|
|
490
|
-
if (this.isTemplate) {
|
|
496
|
+
if (this.isTemplate || object instanceof Base) {
|
|
491
497
|
return object;
|
|
492
498
|
}
|
|
493
499
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
case "object":
|
|
501
|
-
if (object instanceof Base) {
|
|
502
|
-
return object;
|
|
503
|
-
}
|
|
504
|
-
if (object instanceof Map) {
|
|
505
|
-
return new Map(
|
|
506
|
-
[...object].map(([k, v]) => [this.expand(k), this.expand(v)])
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
if (object instanceof Set) {
|
|
511
|
-
return new Set([...object].map(e => this.expand(e)));
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
if (Array.isArray(object)) {
|
|
515
|
-
return object.map(e => this.expand(e));
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return Object.fromEntries(
|
|
519
|
-
Object.entries(object).map(([k, v]) => [k, this.expand(v)])
|
|
520
|
-
);
|
|
521
|
-
}
|
|
500
|
+
const context = {
|
|
501
|
+
stopClass: Base,
|
|
502
|
+
root: this,
|
|
503
|
+
globals: Object.assign({}, this.properties, this.owner.properties)
|
|
504
|
+
};
|
|
522
505
|
|
|
523
|
-
return object;
|
|
506
|
+
return expand(object, context);
|
|
524
507
|
}
|
|
525
508
|
|
|
526
509
|
finalize(action) {
|
package/src/types.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { baseTypes, attributeIterator, types } from "pacc";
|
|
|
2
2
|
import { asArray } from "./utils.mjs";
|
|
3
3
|
import { addServiceTypes } from "./service-types.mjs";
|
|
4
4
|
export { types };
|
|
5
|
+
|
|
5
6
|
export function addType(clazz) {
|
|
6
7
|
const type = clazz.typeDefinition;
|
|
7
8
|
|
|
@@ -24,8 +25,7 @@ export function resolveTypeLinks() {
|
|
|
24
25
|
type.owners = type.owners.map(owner =>
|
|
25
26
|
typeof owner === "string" ? types[owner] : owner
|
|
26
27
|
);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
28
|
+
} else {
|
|
29
29
|
type.owners = [];
|
|
30
30
|
}
|
|
31
31
|
for (const [path, attribute] of attributeIterator(type.attributes)) {
|
package/types/base.d.mts
CHANGED