npm-pkgbuild 7.14.13 → 7.14.14

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": "npm-pkgbuild",
3
- "version": "7.14.13",
3
+ "version": "7.14.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,8 +9,14 @@ import {
9
9
  equalSeparatedKeyValuePairOptions
10
10
  } from "key-value-transformer";
11
11
  import { Packager } from "./packager.mjs";
12
- import { copyEntries, transform, fieldProvider } from "../util.mjs";
13
- import { quote, utf8StreamOptions } from "../util.mjs";
12
+ import {
13
+ copyEntries,
14
+ transform,
15
+ fieldProvider,
16
+ createPropertiesInterceptor,
17
+ quote,
18
+ utf8StreamOptions
19
+ } from "../util.mjs";
14
20
 
15
21
  /**
16
22
  * @type KeyValueTransformOptions
@@ -43,8 +49,7 @@ export class ARCH extends Packager {
43
49
  return "arch";
44
50
  }
45
51
 
46
- static get description()
47
- {
52
+ static get description() {
48
53
  return "generate Arch-Linux package";
49
54
  }
50
55
 
@@ -89,18 +94,13 @@ package() {
89
94
  }
90
95
 
91
96
  if (properties.hooks) {
92
- async function* transformer(expression, remainder, source, cb) {
93
- const value = properties[expression];
94
- yield value === undefined ? "" : value;
95
- }
96
-
97
97
  await pipeline(
98
98
  iterableStringInterceptor(
99
99
  createReadStream(
100
100
  join(options.pkgdir, properties.hooks),
101
101
  utf8StreamOptions
102
102
  ),
103
- transformer
103
+ createPropertiesInterceptor(properties)
104
104
  ),
105
105
  createWriteStream(join(staging, properties.install), utf8StreamOptions)
106
106
  );
package/src/util.mjs CHANGED
@@ -58,7 +58,6 @@ export function fieldProvider(properties, fields) {
58
58
  };
59
59
  }
60
60
 
61
-
62
61
  export function createModeTransformer(mode, match) {
63
62
  return {
64
63
  name: "mode",
@@ -67,15 +66,18 @@ export function createModeTransformer(mode, match) {
67
66
  };
68
67
  }
69
68
 
70
- export function createExpressionTransformer(
71
- properties,
72
- match = entry => entry.name.match(/\.(conf|json|html|txt|service|socket)$/) ? true : false
73
- ) {
74
- async function* transformer(expression, remainder, source, cb) {
69
+ export function createPropertiesInterceptor(properties) {
70
+ return async function* transformer(expression, remainder, source, cb) {
75
71
  const value = properties[expression];
76
72
  yield value === undefined ? "" : value;
77
- }
73
+ };
74
+ }
78
75
 
76
+ export function createExpressionTransformer(
77
+ properties,
78
+ match = entry =>
79
+ entry.name.match(/\.(conf|json|html|txt|service|socket)$/) ? true : false
80
+ ) {
79
81
  return {
80
82
  name: "expression",
81
83
  match,
@@ -85,7 +87,7 @@ export function createExpressionTransformer(
85
87
  entry.name,
86
88
  iterableStringInterceptor(
87
89
  await entry.getReadStream(utf8StreamOptions),
88
- transformer
90
+ createPropertiesInterceptor(properties)
89
91
  )
90
92
  );
91
93
  ne.destination = entry.destination; // TODO all the other attributes ?