pmcf 4.6.2 → 4.7.0
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 +2 -2
- package/src/base.mjs +43 -36
- package/types/base.d.mts +8 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"package-directory": "^8.1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@types/node": "^25.0.
|
|
63
|
+
"@types/node": "^25.0.9",
|
|
64
64
|
"ava": "^6.4.1",
|
|
65
65
|
"c8": "^10.1.3",
|
|
66
66
|
"documentation": "^14.0.3",
|
package/src/base.mjs
CHANGED
|
@@ -310,29 +310,35 @@ export class Base {
|
|
|
310
310
|
return this.owner.addObject(object);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
*
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
}
|
|
313
|
+
*walkDirections(directions = ["this", "extends", "owner"]) {
|
|
314
|
+
yield* this._walkDirections(
|
|
315
|
+
directions,
|
|
316
|
+
directions.indexOf("this") >= 0,
|
|
317
|
+
new Set()
|
|
318
|
+
);
|
|
321
319
|
}
|
|
322
320
|
|
|
323
|
-
*
|
|
324
|
-
|
|
325
|
-
|
|
321
|
+
*_walkDirections(directions, withThis, seen) {
|
|
322
|
+
if (!seen.has(this)) {
|
|
323
|
+
seen.add(this);
|
|
326
324
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
325
|
+
if (withThis) {
|
|
326
|
+
yield this;
|
|
327
|
+
}
|
|
328
|
+
for (const direction of directions) {
|
|
329
|
+
const value = this[direction];
|
|
332
330
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
331
|
+
if (value) {
|
|
332
|
+
if (value[Symbol.iterator]) {
|
|
333
|
+
for (const node of value) {
|
|
334
|
+
yield* node._walkDirections(directions, true, seen);
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
yield* value._walkDirections(directions, true, seen);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
336
342
|
}
|
|
337
343
|
|
|
338
344
|
forOwner(owner) {
|
|
@@ -375,7 +381,7 @@ export class Base {
|
|
|
375
381
|
}
|
|
376
382
|
}
|
|
377
383
|
|
|
378
|
-
for (const e of this.
|
|
384
|
+
for (const e of this.walkDirections(["extends"])) {
|
|
379
385
|
yield* e._extendedPropertyIterator(propertyName, seen);
|
|
380
386
|
}
|
|
381
387
|
}
|
|
@@ -384,7 +390,7 @@ export class Base {
|
|
|
384
390
|
_extendedProperty(propertyName, seen) {
|
|
385
391
|
if (!seen.has(this)) {
|
|
386
392
|
seen.add(this);
|
|
387
|
-
for (const e of this.
|
|
393
|
+
for (const e of this.walkDirections(["extends"])) {
|
|
388
394
|
const value =
|
|
389
395
|
getAttribute(e, propertyName) ??
|
|
390
396
|
e._extendedProperty(propertyName, seen);
|
|
@@ -581,15 +587,16 @@ export class Base {
|
|
|
581
587
|
)
|
|
582
588
|
];
|
|
583
589
|
|
|
584
|
-
return [...this.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
+
return [...this.walkDirections(["this", "extends"])].map(e =>
|
|
591
|
+
transform(
|
|
592
|
+
new FileContentProvider(
|
|
593
|
+
{ dir: join(e.directory, "content"), pattern: "**/*" },
|
|
594
|
+
entryProperties,
|
|
595
|
+
directoryProperties
|
|
596
|
+
),
|
|
590
597
|
transformers
|
|
591
|
-
)
|
|
592
|
-
|
|
598
|
+
)
|
|
599
|
+
);
|
|
593
600
|
}
|
|
594
601
|
|
|
595
602
|
get tags() {
|
|
@@ -616,14 +623,14 @@ export class Base {
|
|
|
616
623
|
return this._properties;
|
|
617
624
|
}
|
|
618
625
|
|
|
626
|
+
/**
|
|
627
|
+
*
|
|
628
|
+
* @param {string} name
|
|
629
|
+
* @returns {any}
|
|
630
|
+
*/
|
|
619
631
|
property(name) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
return value;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
for (const o of this.owners()) {
|
|
626
|
-
const value = o.property(name);
|
|
632
|
+
for (const node of this.walkDirections(["this", "extends", "owner"])) {
|
|
633
|
+
const value = node._properties?.[name];
|
|
627
634
|
if (value !== undefined) {
|
|
628
635
|
return value;
|
|
629
636
|
}
|
package/types/base.d.mts
CHANGED
|
@@ -60,10 +60,8 @@ export class Base {
|
|
|
60
60
|
named(name: any): void;
|
|
61
61
|
typeNamed(typeName: any, name: any): any;
|
|
62
62
|
addObject(object: any): any;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
owners(): any;
|
|
66
|
-
thisAndOwners(): any;
|
|
63
|
+
walkDirections(directions?: string[]): Generator<any, void, any>;
|
|
64
|
+
_walkDirections(directions: any, withThis: any, seen: any): Generator<any, void, any>;
|
|
67
65
|
forOwner(owner: any): any;
|
|
68
66
|
isNamed(name: any): boolean;
|
|
69
67
|
relativeName(name: any): any;
|
|
@@ -129,7 +127,12 @@ export class Base {
|
|
|
129
127
|
get isTemplate(): any;
|
|
130
128
|
getGlobal(a: any): any;
|
|
131
129
|
get properties(): any;
|
|
132
|
-
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @param {string} name
|
|
133
|
+
* @returns {any}
|
|
134
|
+
*/
|
|
135
|
+
property(name: string): any;
|
|
133
136
|
/**
|
|
134
137
|
*
|
|
135
138
|
* @param {any} object
|