npm-pkgbuild 20.8.17 → 20.9.0
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 +15 -3
- package/package.json +3 -3
- package/src/content/content-provider.mjs +38 -2
- package/src/content/file-content-provider.mjs +2 -3
- package/src/content/nft-content-provider.mjs +1 -1
- package/src/content/node-modules-content-provider.mjs +3 -3
- package/src/content/npm-pack-content-provider.mjs +3 -2
package/README.md
CHANGED
|
@@ -187,12 +187,14 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
187
187
|
* [Properties](#properties-6)
|
|
188
188
|
* [extractFunctions](#extractfunctions)
|
|
189
189
|
* [Parameters](#parameters-28)
|
|
190
|
-
* [
|
|
190
|
+
* [asArray](#asarray)
|
|
191
191
|
* [Parameters](#parameters-29)
|
|
192
|
-
* [
|
|
192
|
+
* [fieldProvider](#fieldprovider)
|
|
193
193
|
* [Parameters](#parameters-30)
|
|
194
|
-
* [
|
|
194
|
+
* [Expander](#expander)
|
|
195
195
|
* [Parameters](#parameters-31)
|
|
196
|
+
* [copyEntries](#copyentries)
|
|
197
|
+
* [Parameters](#parameters-32)
|
|
196
198
|
|
|
197
199
|
## allInputs
|
|
198
200
|
|
|
@@ -724,6 +726,16 @@ Extract shell functions from a given text.
|
|
|
724
726
|
|
|
725
727
|
Returns **AsyncIterable<[FunctionDecl](#functiondecl)>** 
|
|
726
728
|
|
|
729
|
+
## asArray
|
|
730
|
+
|
|
731
|
+
Convert scalar or iterable into Array.
|
|
732
|
+
|
|
733
|
+
### Parameters
|
|
734
|
+
|
|
735
|
+
* `value` **any** 
|
|
736
|
+
|
|
737
|
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>** 
|
|
738
|
+
|
|
727
739
|
## fieldProvider
|
|
728
740
|
|
|
729
741
|
### Parameters
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.9.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@npmcli/arborist": "^10.0.2",
|
|
50
|
-
"@vercel/nft": "^1.
|
|
50
|
+
"@vercel/nft": "^1.11.0",
|
|
51
51
|
"aggregate-async-iterator": "^1.2.5",
|
|
52
52
|
"commander": "^15.0.0",
|
|
53
53
|
"compare-versions": "^6.1.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"key-value-transformer": "^3.3.2",
|
|
61
61
|
"npm-package-walker": "^8.0.11",
|
|
62
62
|
"npm-packlist": "^11.3.0",
|
|
63
|
-
"pacc": "^11.2.
|
|
63
|
+
"pacc": "^11.2.3",
|
|
64
64
|
"package-directory": "^8.2.0",
|
|
65
65
|
"pacote": "^22.0.0",
|
|
66
66
|
"tar-stream": "^3.1.7",
|
|
@@ -8,17 +8,20 @@ export class ContentProvider {
|
|
|
8
8
|
entryProperties;
|
|
9
9
|
directoryProperties;
|
|
10
10
|
dir;
|
|
11
|
+
properties;
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} definitions
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} definitions
|
|
15
16
|
* @param {string} [definitions.dir]
|
|
17
|
+
* @param {Object} [definitions.properties]
|
|
16
18
|
* @param {Object} [entryProperties]
|
|
17
19
|
* @param {string} [entryProperties.destination]
|
|
18
20
|
* @param {Object} [directoryProperties]
|
|
19
21
|
*/
|
|
20
22
|
constructor(definitions, entryProperties, directoryProperties) {
|
|
21
23
|
this.dir = definitions.dir;
|
|
24
|
+
this.properties = definitions.properties ?? {};
|
|
22
25
|
this.entryProperties = entryProperties;
|
|
23
26
|
this.directoryProperties = directoryProperties;
|
|
24
27
|
if (this.entryProperties?.destination) {
|
|
@@ -29,6 +32,39 @@ export class ContentProvider {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {string} name
|
|
38
|
+
* @param {boolean} isCollection
|
|
39
|
+
* @returns {Object}
|
|
40
|
+
*/
|
|
41
|
+
propertiesFor(name, isCollection) {
|
|
42
|
+
for (const [pattern, properties] of Object.entries(this.properties)) {
|
|
43
|
+
if (pattern === name) {
|
|
44
|
+
return properties;
|
|
45
|
+
}
|
|
46
|
+
if (pattern.endsWith("**/*")) {
|
|
47
|
+
const prefix = pattern.substring(0, pattern.length - 4);
|
|
48
|
+
if (name.startsWith(prefix)) {
|
|
49
|
+
return properties;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (pattern.endsWith("*")) {
|
|
53
|
+
const prefix = pattern.substring(0, pattern.length - 1);
|
|
54
|
+
if (name.startsWith(prefix)) {
|
|
55
|
+
if (name.substring(prefix.length).indexOf("/") < 0) {
|
|
56
|
+
return properties;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (isCollection) {
|
|
63
|
+
return this.directoryProperties;
|
|
64
|
+
}
|
|
65
|
+
return this.entryProperties;
|
|
66
|
+
}
|
|
67
|
+
|
|
32
68
|
/**
|
|
33
69
|
* List all entries.
|
|
34
70
|
* @return {AsyncIterable<ContentEntry|CollectionEntry>} all entries
|
|
@@ -74,15 +74,14 @@ export class FileContentProvider extends ContentProvider {
|
|
|
74
74
|
withFileTypes: true
|
|
75
75
|
})) {
|
|
76
76
|
const name = join(entry.parentPath, entry.name).substring(startPos);
|
|
77
|
-
|
|
78
77
|
if (entry.isFile()) {
|
|
79
78
|
yield new FileSystemEntry(name, {
|
|
80
|
-
...this.
|
|
79
|
+
...this.propertiesFor(name),
|
|
81
80
|
baseDir
|
|
82
81
|
});
|
|
83
82
|
count++;
|
|
84
83
|
} else if (entry.isDirectory()) {
|
|
85
|
-
yield new CollectionEntry(name, this.
|
|
84
|
+
yield new CollectionEntry(name, this.propertiesFor(name, true));
|
|
86
85
|
count++;
|
|
87
86
|
}
|
|
88
87
|
}
|
|
@@ -143,7 +143,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
143
143
|
if (json) {
|
|
144
144
|
yield new StringContentEntry(
|
|
145
145
|
name,
|
|
146
|
-
this.
|
|
146
|
+
this.propertiesFor(name),
|
|
147
147
|
JSON.stringify(json)
|
|
148
148
|
);
|
|
149
149
|
}
|
|
@@ -154,11 +154,11 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
yield new FileSystemEntry(name, {
|
|
157
|
-
...this.
|
|
157
|
+
...this.propertiesFor(name),
|
|
158
158
|
baseDir: nodeModulesDir
|
|
159
159
|
});
|
|
160
160
|
} else if (entry.isDirectory()) {
|
|
161
|
-
yield new CollectionEntry(name, this.
|
|
161
|
+
yield new CollectionEntry(name, this.propertiesFor(name, true));
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
} catch (e) {
|
|
@@ -56,11 +56,12 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
56
56
|
chunks.push(chunk);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const name = header.name.substring(8);
|
|
59
60
|
entries.push(
|
|
60
61
|
new BufferContentEntry(
|
|
61
|
-
|
|
62
|
+
name,
|
|
62
63
|
{
|
|
63
|
-
...this.
|
|
64
|
+
...this.propertiesFor(name),
|
|
64
65
|
mtime: header.mtime,
|
|
65
66
|
mode: header.mode
|
|
66
67
|
},
|