npm-pkgbuild 8.3.2 → 8.3.5
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": "8.3.
|
|
3
|
+
"version": "8.3.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"commander": "^9.1.0",
|
|
46
46
|
"content-entry": "^4.1.9",
|
|
47
47
|
"content-entry-filesystem": "^4.0.9",
|
|
48
|
-
"content-entry-transform": "^1.3.
|
|
48
|
+
"content-entry-transform": "^1.3.16",
|
|
49
49
|
"execa": "^6.1.0",
|
|
50
50
|
"expression-expander": "^7.0.16",
|
|
51
51
|
"globby": "^13.1.0",
|
|
52
|
-
"ini": "^
|
|
52
|
+
"ini": "^3.0.0",
|
|
53
53
|
"iterable-string-interceptor": "^1.0.15",
|
|
54
54
|
"key-value-transformer": "^2.1.1",
|
|
55
55
|
"node-fetch": "^3.2.3",
|
|
56
56
|
"npm-package-walker": "^5.0.6",
|
|
57
57
|
"npm-packlist": "^4.0.0",
|
|
58
|
-
"pacote": "^13.0
|
|
58
|
+
"pacote": "^13.1.0",
|
|
59
59
|
"pkg-dir": "^6.0.1",
|
|
60
60
|
"tar-stream": "^2.2.0"
|
|
61
61
|
},
|
|
@@ -103,6 +103,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
103
103
|
const toBeSkipped = new RegExp(
|
|
104
104
|
"(" +
|
|
105
105
|
[
|
|
106
|
+
"package-lock.json",
|
|
106
107
|
"~",
|
|
107
108
|
"\\.\\d",
|
|
108
109
|
"\\.map",
|
|
@@ -140,16 +141,17 @@ const toBeSkipped = new RegExp(
|
|
|
140
141
|
"Copyrightnotice\\.txt",
|
|
141
142
|
"Doxyfile",
|
|
142
143
|
"Dockerfile",
|
|
143
|
-
"CODE_OF_CONDUCT(\\.md)?",
|
|
144
|
+
"CODE_OF_CONDUCT(\\.md|\\.txt)?",
|
|
144
145
|
"GOVERNANCE(\\.md)?",
|
|
145
146
|
"CODEOWNERS(\\.md)?",
|
|
146
147
|
"UPGRAD(E|ING)(\\.md)?",
|
|
147
|
-
"AUTHORS(\\.md)?",
|
|
148
|
+
"AUTHORS(\\.md|\\.txt)?",
|
|
148
149
|
"OWNERS",
|
|
149
150
|
"CONTRIBUT(ORS|ING)(\\.md)?",
|
|
150
151
|
"CHANGELOG(\\.md)?",
|
|
151
152
|
"CHANGES(\\.md)?",
|
|
152
153
|
"HISTORY(\\.md)?",
|
|
154
|
+
"DOCUMENTATION(\\.md)?",
|
|
153
155
|
"LICEN[SC]E(\\-\\w+(\\.txt)?|\\.md|\\.txt|\\.BSD|\\.APACHE2|\\.MIT|\\.terms)?",
|
|
154
156
|
"README(.*\\.md|\\.txt)?",
|
|
155
157
|
"INSTALL(.*\\.md)?",
|
|
@@ -212,6 +214,6 @@ const toBeSkipped = new RegExp(
|
|
|
212
214
|
"chains and topics\\.md",
|
|
213
215
|
"build_detect_platform"
|
|
214
216
|
].join("|") +
|
|
215
|
-
")$|(node_modules/(@types|node-addon-api)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
|
|
217
|
+
")$|(node_modules/(@types|node-addon-api|node-gyp)|(win32|android|darwin)-(ia32|x64|arm|arm64))",
|
|
216
218
|
"i"
|
|
217
219
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { pipeline } from "stream/promises";
|
|
2
2
|
import { createGunzip } from "zlib";
|
|
3
3
|
import pacote from "pacote";
|
|
4
|
-
import
|
|
5
|
-
import { ContentProvider } from "./content-provider.mjs";
|
|
4
|
+
import { extract as tarExtract } from "tar-stream";
|
|
6
5
|
import { BufferContentEntry } from "content-entry";
|
|
6
|
+
import { ContentProvider } from "./content-provider.mjs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Content from npm pack.
|
|
@@ -26,8 +26,7 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
26
26
|
this.entryProperties = entryProperties;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
toString()
|
|
30
|
-
{
|
|
29
|
+
toString() {
|
|
31
30
|
return `${this.constructor.name}: ${this.dir} -> ${this.entryProperties.destination}`;
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -35,7 +34,7 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
35
34
|
const entries = [];
|
|
36
35
|
|
|
37
36
|
await pacote.tarball.stream(this.dir, async stream => {
|
|
38
|
-
const extract =
|
|
37
|
+
const extract = tarExtract();
|
|
39
38
|
|
|
40
39
|
extract.on("entry", async (header, stream, next) => {
|
|
41
40
|
stream.on("end", () => next());
|
|
@@ -46,12 +45,12 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
entries.push(
|
|
49
|
-
Object.
|
|
48
|
+
Object.create(
|
|
50
49
|
new BufferContentEntry(
|
|
51
50
|
header.name.substring(8),
|
|
52
51
|
Buffer.concat(chunks)
|
|
53
52
|
),
|
|
54
|
-
|
|
53
|
+
{ mode: { value: header.mode } }
|
|
55
54
|
)
|
|
56
55
|
);
|
|
57
56
|
|
package/src/output/rpm.mjs
CHANGED
|
@@ -31,13 +31,13 @@ const hookMapping = {
|
|
|
31
31
|
post_upgrade:*/
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export function requiresFromDependencies(dependencies)
|
|
35
|
-
{
|
|
34
|
+
export function requiresFromDependencies(dependencies) {
|
|
36
35
|
return Object.entries(dependencies).map(
|
|
37
36
|
([name, e]) =>
|
|
38
|
-
`${
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
`${packageNameMapping[name] ? packageNameMapping[name] : name}${e
|
|
38
|
+
.replace(/^\s*(\w+)/, (match, p1) => ` = ${p1}`)
|
|
39
|
+
.replace(/^\s*$/, "")
|
|
40
|
+
.replace(/^\s*(<|<=|>|>=|=)\s*(\w+)/, (match, p1, p2) => ` ${p1} ${p2}`)}`
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
package/src/util.mjs
CHANGED
|
@@ -39,18 +39,28 @@ export function decodePassword(password)
|
|
|
39
39
|
*/
|
|
40
40
|
export async function* extractFunctions(source) {
|
|
41
41
|
let name;
|
|
42
|
+
let insideBody;
|
|
42
43
|
const body = [];
|
|
43
44
|
|
|
44
45
|
for await (const line of asLines(source)) {
|
|
45
46
|
let m;
|
|
46
47
|
|
|
47
|
-
if ((m = line.match(/^\s*(function\s*)?([\w_]+)\s*\(\s*\)
|
|
48
|
+
if ((m = line.match(/^\s*(function\s*)?([\w_]+)\s*\(\s*\)\s*(\{)?/))) {
|
|
48
49
|
name = m[2];
|
|
50
|
+
insideBody = m[3] ? true : false;
|
|
49
51
|
continue;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
if (name) {
|
|
53
|
-
if (line.match(
|
|
55
|
+
if (line.match(/^\s*{\s*$/)) {
|
|
56
|
+
if(insideBody) {
|
|
57
|
+
body.push(line);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
insideBody = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (line.match(/^}$/)) {
|
|
54
64
|
yield { name, body: body.join("\n")};
|
|
55
65
|
name = undefined;
|
|
56
66
|
body.length = 0;
|
|
@@ -114,7 +124,7 @@ export function fieldProvider(properties, fields) {
|
|
|
114
124
|
if (value === undefined) {
|
|
115
125
|
if (field.default === undefined) {
|
|
116
126
|
if (field.mandatory) {
|
|
117
|
-
console.
|
|
127
|
+
console.error(`Missing value for mandatory field ${name}`);
|
|
118
128
|
}
|
|
119
129
|
} else {
|
|
120
130
|
yield [name, field.default];
|