pmcf 6.39.0 → 6.39.2
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/README.md +2 -2
- package/bin/pmcf-info +24 -17
- package/package.json +1 -1
- package/src/base.mjs +0 -4
- package/src/content.mjs +38 -9
- package/src/core.mjs +4 -0
- package/src/initialization-context.mjs +2 -2
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ generates config packages for:
|
|
|
117
117
|
|
|
118
118
|
## Base
|
|
119
119
|
|
|
120
|
-
**Extends
|
|
120
|
+
**Extends core**
|
|
121
121
|
|
|
122
122
|
attributes: as declared in the types
|
|
123
123
|
properties: use defined values to support attribute value definitions
|
|
@@ -214,7 +214,7 @@ Walk the object graph in some directions and deliver seen nodes.
|
|
|
214
214
|
|
|
215
215
|
* `directions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `["this","extends","owner"]`)
|
|
216
216
|
|
|
217
|
-
Returns **Iterable\<
|
|
217
|
+
Returns **Iterable\<core>** 
|
|
218
218
|
|
|
219
219
|
## mapFromDirections
|
|
220
220
|
|
package/bin/pmcf-info
CHANGED
|
@@ -112,25 +112,32 @@ function show(value, indent, options) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
} else {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
if (typeof v.get === "function") {
|
|
116
|
+
console.log(name(attribute));
|
|
117
|
+
for(const [k,o] of v) {
|
|
118
|
+
show(o,indent + 2, options);
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
try {
|
|
122
|
+
const l = [...v];
|
|
123
|
+
|
|
124
|
+
if (l.length > 1) {
|
|
125
|
+
console.log(name(attribute));
|
|
126
|
+
|
|
127
|
+
if (l.length >= options.maxEntries) {
|
|
128
|
+
l[options.maxEntries] = { fullName: "..." };
|
|
129
|
+
l.length = options.maxEntries + 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (const o of l) {
|
|
133
|
+
console.log(prefix(indent + 2) + o.fullName);
|
|
134
|
+
}
|
|
135
|
+
} else if (l.length === 1) {
|
|
136
|
+
console.log(name(attribute) + l[0].fullName);
|
|
128
137
|
}
|
|
129
|
-
}
|
|
130
|
-
console.log(name(attribute)
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.log(name(attribute), v);
|
|
131
140
|
}
|
|
132
|
-
} catch (e) {
|
|
133
|
-
console.log(name(attribute), v);
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
} else {
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
package/src/content.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
1
2
|
import {
|
|
2
3
|
name_attribute_writable,
|
|
3
4
|
string_attribute_writable,
|
|
4
5
|
string_set_attribute_writable,
|
|
5
|
-
default_collection_attribute_writable
|
|
6
|
+
default_collection_attribute_writable,
|
|
7
|
+
description_attribute_writable
|
|
6
8
|
} from "pacc";
|
|
7
9
|
import { allOutputs } from "npm-pkgbuild";
|
|
8
10
|
import { core, addType } from "pmcf";
|
|
@@ -11,6 +13,7 @@ import { loadHooks } from "./hooks.mjs";
|
|
|
11
13
|
|
|
12
14
|
export class permission extends core {
|
|
13
15
|
static priority = 1.9;
|
|
16
|
+
static key = "pattern";
|
|
14
17
|
static attributes = {
|
|
15
18
|
pattern: { ...string_attribute_writable, key: true, name: "pattern" },
|
|
16
19
|
user: { ...string_attribute_writable, name: "user" },
|
|
@@ -22,7 +25,7 @@ export class permission extends core {
|
|
|
22
25
|
addType(this);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
get
|
|
28
|
+
get fullName() {
|
|
26
29
|
return this.pattern;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -31,6 +34,7 @@ export class content extends core {
|
|
|
31
34
|
static priority = 1.9;
|
|
32
35
|
static attributes = {
|
|
33
36
|
name: name_attribute_writable,
|
|
37
|
+
description: description_attribute_writable,
|
|
34
38
|
permissions: {
|
|
35
39
|
...default_collection_attribute_writable,
|
|
36
40
|
type: permission,
|
|
@@ -84,6 +88,24 @@ export class content extends core {
|
|
|
84
88
|
this._name = value;
|
|
85
89
|
}
|
|
86
90
|
|
|
91
|
+
get fullName() {
|
|
92
|
+
return this.name;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get description() {
|
|
96
|
+
let description = this.attribute("_description");
|
|
97
|
+
if (description !== undefined) {
|
|
98
|
+
return description;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const node = this.owner;
|
|
102
|
+
return `${node.typeName} definitions for ${node.fullName}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
set description(value) {
|
|
106
|
+
this._description = value;
|
|
107
|
+
}
|
|
108
|
+
|
|
87
109
|
/**
|
|
88
110
|
* @return {string}
|
|
89
111
|
*/
|
|
@@ -198,13 +220,25 @@ export class content extends core {
|
|
|
198
220
|
*/
|
|
199
221
|
}
|
|
200
222
|
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* @param {object} packageData
|
|
226
|
+
*/
|
|
227
|
+
async loadHooks(packageData) {
|
|
228
|
+
for (const node of this.walkDirections(["this", "extends"])) {
|
|
229
|
+
for (const hook of node._hooks) {
|
|
230
|
+
await loadHooks(packageData, join(node.owner.directory, hook));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
201
235
|
async packageData(node) {
|
|
202
236
|
const packageData = {
|
|
203
237
|
sources: [],
|
|
204
238
|
outputs: this.outputs,
|
|
205
239
|
properties: {
|
|
206
240
|
name: this.name,
|
|
207
|
-
description:
|
|
241
|
+
description: this.description,
|
|
208
242
|
access: this.access,
|
|
209
243
|
groups: [...this.groups],
|
|
210
244
|
depends: [...this.depends],
|
|
@@ -215,12 +249,7 @@ export class content extends core {
|
|
|
215
249
|
}
|
|
216
250
|
};
|
|
217
251
|
|
|
218
|
-
|
|
219
|
-
await loadHooks(
|
|
220
|
-
packageData,
|
|
221
|
-
new URL("host.install", import.meta.url).pathname
|
|
222
|
-
);
|
|
223
|
-
}
|
|
252
|
+
await this.loadHooks(packageData);
|
|
224
253
|
|
|
225
254
|
return packageData;
|
|
226
255
|
}
|
package/src/core.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveTypeLinks,
|
|
7
7
|
create
|
|
8
8
|
} from "pacc";
|
|
9
|
-
import {
|
|
9
|
+
import { core, root, assign } from "pmcf";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Keeps track of all in flight object creations and loose ends during config initialization.
|
|
@@ -122,7 +122,7 @@ export class InitializationContext {
|
|
|
122
122
|
this.instantiateAndAssign(object, attribute, v);
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
|
-
if (value instanceof
|
|
125
|
+
if (value instanceof core) {
|
|
126
126
|
assign(attribute, object, value);
|
|
127
127
|
} else {
|
|
128
128
|
for (const [objectName, objectData] of Object.entries(value)) {
|