pmcf 1.14.0 → 1.15.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 +4 -1
- package/src/model.mjs +17 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -64,5 +64,8 @@
|
|
|
64
64
|
"arlac77/template-node-app",
|
|
65
65
|
"arlac77/template-typescript"
|
|
66
66
|
]
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"pacc": "^3.1.9"
|
|
67
70
|
}
|
|
68
71
|
}
|
package/src/model.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile, writeFile, mkdir, glob } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { getAttribute } from "pacc";
|
|
3
4
|
|
|
4
5
|
export class Base {
|
|
5
6
|
owner;
|
|
@@ -89,18 +90,24 @@ export class Base {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
expand(object) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
switch (typeof object) {
|
|
94
|
+
case "string":
|
|
95
|
+
return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
|
|
96
|
+
return getAttribute(this, m1) || "${" + m1 + "}";
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
case "object":
|
|
100
|
+
if (Array.isArray(object)) {
|
|
101
|
+
return object.map(e => this.expand(e));
|
|
102
|
+
}
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
if (object instanceof Set) {
|
|
105
|
+
return new Set([...object].map(e => this.expand(e)));
|
|
106
|
+
}
|
|
101
107
|
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
/*return Object.fromEntries(
|
|
109
|
+
Object.entries(object).map(([k, v]) => [k, this.expand(v)])
|
|
110
|
+
);*/
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
return object;
|