pmcf 3.10.8 → 3.10.10

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "3.10.8",
3
+ "version": "3.10.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "ip-utilties": "^1.4.9",
55
- "npm-pkgbuild": "^18.2.30",
56
- "pacc": "^4.18.3",
55
+ "npm-pkgbuild": "^18.2.31",
56
+ "pacc": "^4.22.0",
57
57
  "package-directory": "^8.1.0"
58
58
  },
59
59
  "devDependencies": {
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
- getAttribute,
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
- switch (typeof object) {
495
- case "string":
496
- return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
497
- return this.property(m1) ?? getAttribute(this, m1) ?? "${" + m1 + "}";
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/types/base.d.mts CHANGED
@@ -109,6 +109,7 @@ export class Base {
109
109
  set tags(value: Set<any>);
110
110
  get tags(): Set<any>;
111
111
  get isTemplate(): boolean;
112
+ get properties(): any;
112
113
  property(name: any): any;
113
114
  expand(object: any): any;
114
115
  finalize(action: any): void;