pmcf 6.39.1 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/content.mjs +32 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.39.1",
3
+ "version": "6.39.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
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";
@@ -32,6 +34,7 @@ export class content extends core {
32
34
  static priority = 1.9;
33
35
  static attributes = {
34
36
  name: name_attribute_writable,
37
+ description: description_attribute_writable,
35
38
  permissions: {
36
39
  ...default_collection_attribute_writable,
37
40
  type: permission,
@@ -89,6 +92,20 @@ export class content extends core {
89
92
  return this.name;
90
93
  }
91
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
+
92
109
  /**
93
110
  * @return {string}
94
111
  */
@@ -203,13 +220,25 @@ export class content extends core {
203
220
  */
204
221
  }
205
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
+
206
235
  async packageData(node) {
207
236
  const packageData = {
208
237
  sources: [],
209
238
  outputs: this.outputs,
210
239
  properties: {
211
240
  name: this.name,
212
- description: `${node.typeName} definitions for ${node.fullName}`,
241
+ description: this.description,
213
242
  access: this.access,
214
243
  groups: [...this.groups],
215
244
  depends: [...this.depends],
@@ -220,12 +249,7 @@ export class content extends core {
220
249
  }
221
250
  };
222
251
 
223
- for (const hook of this.hooks) {
224
- await loadHooks(
225
- packageData,
226
- new URL("host.install", import.meta.url).pathname
227
- );
228
- }
252
+ await this.loadHooks(packageData);
229
253
 
230
254
  return packageData;
231
255
  }