npm-pkgbuild 8.3.9 → 8.3.12
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
CHANGED
|
@@ -67,7 +67,7 @@ content as provided by npm pack
|
|
|
67
67
|
content of all (production) dependencies
|
|
68
68
|
|
|
69
69
|
options:
|
|
70
|
-
- withoutDevelpmentDependencies when to stip away dev dependencies
|
|
70
|
+
- withoutDevelpmentDependencies when to stip away dev dependencies (defaults to true)
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
# API
|
|
@@ -76,40 +76,49 @@ options:
|
|
|
76
76
|
|
|
77
77
|
### Table of Contents
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
79
|
+
- [usage](#usage)
|
|
80
|
+
- [content providers](#content-providers)
|
|
81
|
+
- [files (default)](#files-default)
|
|
82
|
+
- [npm-pack](#npm-pack)
|
|
83
|
+
- [node-modules](#node-modules)
|
|
84
|
+
- [API](#api)
|
|
85
|
+
- [Table of Contents](#table-of-contents)
|
|
86
|
+
- [ContentProvider](#contentprovider)
|
|
87
|
+
- [asyncIterator](#asynciterator)
|
|
88
|
+
- [FileContentProvider](#filecontentprovider)
|
|
89
|
+
- [Parameters](#parameters)
|
|
90
|
+
- [name](#name)
|
|
91
|
+
- [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
92
|
+
- [Parameters](#parameters-1)
|
|
93
|
+
- [name](#name-1)
|
|
94
|
+
- [NPMPackContentProvider](#npmpackcontentprovider)
|
|
95
|
+
- [Parameters](#parameters-2)
|
|
96
|
+
- [name](#name-2)
|
|
97
|
+
- [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
98
|
+
- [fields](#fields)
|
|
99
|
+
- [fields](#fields-1)
|
|
100
|
+
- [fields](#fields-2)
|
|
101
|
+
- [hookMapping](#hookmapping)
|
|
102
|
+
- [hookMapping](#hookmapping-1)
|
|
103
|
+
- [Field](#field)
|
|
104
|
+
- [Properties](#properties)
|
|
105
|
+
- [Packager](#packager)
|
|
106
|
+
- [Parameters](#parameters-3)
|
|
107
|
+
- [tmpdir](#tmpdir)
|
|
108
|
+
- [execute](#execute)
|
|
109
|
+
- [Parameters](#parameters-4)
|
|
110
|
+
- [decodePassword](#decodepassword)
|
|
111
|
+
- [Parameters](#parameters-5)
|
|
112
|
+
- [extractFunctions](#extractfunctions)
|
|
113
|
+
- [Parameters](#parameters-6)
|
|
114
|
+
- [fieldProvider](#fieldprovider)
|
|
115
|
+
- [Parameters](#parameters-7)
|
|
116
|
+
- [Expander](#expander)
|
|
117
|
+
- [Parameters](#parameters-8)
|
|
118
|
+
- [copyEntries](#copyentries)
|
|
119
|
+
- [Parameters](#parameters-9)
|
|
120
|
+
- [install](#install)
|
|
121
|
+
- [license](#license)
|
|
113
122
|
|
|
114
123
|
## ContentProvider
|
|
115
124
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@npmcli/arborist": "^5.0.
|
|
43
|
+
"@npmcli/arborist": "^5.0.5",
|
|
44
44
|
"aggregate-async-iterator": "^1.1.10",
|
|
45
45
|
"commander": "^9.1.0",
|
|
46
46
|
"content-entry": "^4.1.9",
|
|
@@ -30,11 +30,6 @@ export class FileContentProvider extends ContentProvider {
|
|
|
30
30
|
} else {
|
|
31
31
|
this.definitions = { pattern: ["**/*"], ...definitions };
|
|
32
32
|
this.definitions.pattern = asArray(this.definitions.pattern);
|
|
33
|
-
/*
|
|
34
|
-
if(entryProperties && entryProperties.destination && !entryProperties.destination.endsWith('/')) {
|
|
35
|
-
entryProperties.destination += '/';
|
|
36
|
-
}
|
|
37
|
-
*/
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
this.entryProperties = entryProperties;
|
|
@@ -214,6 +214,6 @@ const toBeSkipped = new RegExp(
|
|
|
214
214
|
"chains and topics\\.md",
|
|
215
215
|
"build_detect_platform"
|
|
216
216
|
].join("|") +
|
|
217
|
-
")$|(node_modules/(@types|node-addon-api|node-gyp)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
|
|
217
|
+
")$|(node_modules/(@types|node-addon-api)|(node_modules/node-gyp$)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
|
|
218
218
|
"i"
|
|
219
219
|
);
|
|
@@ -28,78 +28,78 @@ export const archMapping = Object.fromEntries(
|
|
|
28
28
|
* @param {string} dir
|
|
29
29
|
* @returns {Object}
|
|
30
30
|
*/
|
|
31
|
-
export async function extractFromPackage(
|
|
31
|
+
export async function extractFromPackage(json, dir) {
|
|
32
32
|
const properties = Object.fromEntries(
|
|
33
33
|
["name", "version", "description", "homepage", "license"]
|
|
34
|
-
.map(key => [key,
|
|
34
|
+
.map(key => [key, json[key]])
|
|
35
35
|
.filter(([k, v]) => v !== undefined)
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
if (
|
|
39
|
-
if (
|
|
40
|
-
properties.bugs =
|
|
38
|
+
if (json.bugs) {
|
|
39
|
+
if (json.bugs.url) {
|
|
40
|
+
properties.bugs = json.bugs.url;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
Object.assign(properties,
|
|
44
|
+
Object.assign(properties, json.config);
|
|
45
45
|
|
|
46
46
|
if (properties.name) {
|
|
47
47
|
properties.name = properties.name.replace(/^\@\w+\//, "");
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
properties.access = "private";
|
|
51
|
-
if (
|
|
52
|
-
properties.access =
|
|
51
|
+
if (json.publishConfig) {
|
|
52
|
+
properties.access = json.publishConfig.access;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
if (
|
|
56
|
-
properties.maintainer =
|
|
55
|
+
if (json.contributors) {
|
|
56
|
+
properties.maintainer = json.contributors.map(
|
|
57
57
|
c => `${c.name} <${c.email}>`
|
|
58
58
|
)[0];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
if (
|
|
62
|
-
if (typeof
|
|
63
|
-
properties.source =
|
|
61
|
+
if (json.repository) {
|
|
62
|
+
if (typeof json.repository === "string") {
|
|
63
|
+
properties.source = json.repository;
|
|
64
64
|
} else {
|
|
65
|
-
if (
|
|
66
|
-
properties.source =
|
|
65
|
+
if (json.repository.url) {
|
|
66
|
+
properties.source = json.repository.url;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const context = createContext({ properties });
|
|
72
72
|
|
|
73
|
-
let dependencies = { ...
|
|
73
|
+
let dependencies = { ...json.engines };
|
|
74
74
|
let sources = [];
|
|
75
75
|
let output = {};
|
|
76
76
|
let arch = new Set();
|
|
77
77
|
|
|
78
|
-
const processPkg = (
|
|
79
|
-
|
|
80
|
-
const pkgbuild = pkg.pkg;
|
|
78
|
+
const processPkg = (json, dir, modulePath) => {
|
|
79
|
+
const pkg = json.pkg;
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
81
|
+
if (pkg) {
|
|
82
|
+
if (json.cpu) {
|
|
83
|
+
for (const a of asArray(json.cpu)) {
|
|
84
|
+
arch.add(npmArchMapping[a]);
|
|
87
85
|
}
|
|
86
|
+
}
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (pkg.abstract || !modulePath) {
|
|
89
|
+
if (pkg.arch) {
|
|
90
|
+
for (const a of asArray(pkg.arch)) {
|
|
91
91
|
arch.add(a);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
Object.assign(output,
|
|
95
|
+
Object.assign(output, pkg.output);
|
|
96
96
|
|
|
97
|
-
Object.entries(
|
|
97
|
+
Object.entries(pkg)
|
|
98
98
|
.filter(([k, v]) => typeof v === "string")
|
|
99
99
|
.forEach(([k, v]) => (properties[k] = v));
|
|
100
100
|
|
|
101
|
-
if (
|
|
102
|
-
Object.entries(
|
|
101
|
+
if (pkg.content && !modulePath) {
|
|
102
|
+
Object.entries(pkg.content).forEach(
|
|
103
103
|
([destination, definitions]) => {
|
|
104
104
|
destination = context.expand(destination);
|
|
105
105
|
definitions = context.expand(definitions);
|
|
@@ -126,18 +126,18 @@ export async function extractFromPackage(pkg, dir) {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
Object.assign(dependencies,
|
|
129
|
+
Object.assign(dependencies, pkg.depends);
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
await packageWalker(async (
|
|
133
|
+
await packageWalker(async (json, base, modulePath) => {
|
|
134
134
|
if (modulePath.length > 0) {
|
|
135
|
-
processPkg(
|
|
135
|
+
processPkg(json, base, modulePath);
|
|
136
136
|
}
|
|
137
137
|
return true;
|
|
138
138
|
}, dir);
|
|
139
139
|
|
|
140
|
-
processPkg(
|
|
140
|
+
processPkg(json, dir);
|
|
141
141
|
|
|
142
142
|
if (arch.size > 0) {
|
|
143
143
|
properties.arch = [...arch].filter(a => a === npmArchMapping[hostArch]);
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
package/src/util.mjs
CHANGED
|
@@ -144,7 +144,7 @@ export function fieldProvider(properties, fields) {
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Copy content from source into destinationDirectory.
|
|
147
|
-
*
|
|
147
|
+
* Destination paths a generated without leading '/' (as for as entry names too).
|
|
148
148
|
* @param {AsyncIterator<ContentEntry>} source
|
|
149
149
|
* @param {string} destinationDirectory
|
|
150
150
|
* @param {Expander} expander
|