Skip to content

Commit 43831d0

Browse files
committed
1 parent 44e8fec commit 43831d0

File tree

12 files changed

+69
-26
lines changed

12 files changed

+69
-26
lines changed

mock-registry/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"json-stringify-safe": "^5.0.1",
5757
"nock": "^13.3.3",
5858
"npm-package-arg": "^11.0.0",
59-
"pacote": "^17.0.2",
59+
"pacote": "^17.0.3",
6060
"tap": "^16.3.8"
6161
}
6262
}

node_modules/.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@
202202
!/npm-install-checks
203203
!/npm-normalize-package-bin
204204
!/npm-package-arg
205-
!/npm-packlist
206205
!/npm-pick-manifest
207206
!/npm-profile
208207
!/npm-registry-fetch
@@ -211,6 +210,9 @@
211210
!/once
212211
!/p-map
213212
!/pacote
213+
!/pacote/node_modules/
214+
/pacote/node_modules/*
215+
!/pacote/node_modules/npm-packlist
214216
!/parse-conflict-json
215217
!/path-is-absolute
216218
!/path-key

node_modules/npm-packlist/lib/index.js renamed to node_modules/pacote/node_modules/npm-packlist/lib/index.js

+31-3
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,22 @@ const defaults = [
3838
]
3939

4040
const strictDefaults = [
41-
// these are forcibly included at all levels
41+
// these are forcibly excluded
42+
'/.git',
43+
]
44+
45+
const allLevels = [
46+
// these are included by default but can be excluded by package.json files array
4247
'!/readme{,.*[^~$]}',
4348
'!/copying{,.*[^~$]}',
4449
'!/license{,.*[^~$]}',
4550
'!/licence{,.*[^~$]}',
46-
// these are forcibly excluded
47-
'/.git',
51+
]
52+
53+
const rootOnly = [
54+
/^!.*readme/i,
55+
/^!.*copying/i,
56+
/^!.*licen[sc]e/i,
4857
]
4958

5059
const normalizePath = (path) => path.split('\\').join('/')
@@ -132,6 +141,7 @@ class PackWalker extends IgnoreWalker {
132141
// known required files for this directory
133142
this.injectRules(strictRules, [
134143
...strictDefaults,
144+
...allLevels,
135145
...this.requiredFiles.map((file) => `!${file}`),
136146
])
137147
}
@@ -284,6 +294,7 @@ class PackWalker extends IgnoreWalker {
284294
const ignores = []
285295
const strict = [
286296
...strictDefaults,
297+
...allLevels,
287298
'!/package.json',
288299
'/.git',
289300
'/node_modules',
@@ -304,6 +315,9 @@ class PackWalker extends IgnoreWalker {
304315
file = file.slice(0, -2)
305316
}
306317
const inverse = `!${file}`
318+
319+
this.excludeNonRoot(file)
320+
307321
try {
308322
// if an entry in the files array is a specific file, then we need to include it as a
309323
// strict requirement for this package. if it's a directory or a pattern, it's a default
@@ -352,6 +366,20 @@ class PackWalker extends IgnoreWalker {
352366
this.injectRules(strictRules, strict, callback)
353367
}
354368

369+
// excludes non root files by checking if elements from the files array in
370+
// package.json contain an ! and readme/license/licence/copying, and then
371+
// removing readme/license/licence/copying accordingly from strict defaults
372+
excludeNonRoot (file) {
373+
// Find the pattern
374+
const matchingPattern = rootOnly.find(regex => regex.test(file))
375+
376+
if (matchingPattern) {
377+
// Find which index matches the pattern and remove it from allLevels
378+
const indexToRemove = allLevels.findIndex(element => matchingPattern.test(element))
379+
allLevels.splice(indexToRemove, 1)
380+
}
381+
}
382+
355383
// custom method: after we've finished gathering the files for the root package, we call this
356384
// before emitting the 'done' event in order to gather all of the files for bundled deps
357385
async gatherBundles () {

node_modules/npm-packlist/package.json renamed to node_modules/pacote/node_modules/npm-packlist/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "npm-packlist",
3-
"version": "7.0.4",
3+
"version": "8.0.0",
44
"description": "Get a list of the files to add from a folder into an npm package",
55
"directories": {
66
"test": "test"
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@npmcli/arborist": "^6.0.0 || ^6.0.0-pre.0",
2020
"@npmcli/eslint-config": "^4.0.0",
21-
"@npmcli/template-oss": "4.10.0",
21+
"@npmcli/template-oss": "4.18.0",
2222
"mutate-fs": "^2.1.1",
2323
"tap": "^16.0.1"
2424
},
@@ -55,6 +55,7 @@
5555
},
5656
"templateOSS": {
5757
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
58-
"version": "4.10.0"
58+
"version": "4.18.0",
59+
"publish": true
5960
}
6061
}

node_modules/pacote/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pacote",
3-
"version": "17.0.2",
3+
"version": "17.0.3",
44
"description": "JavaScript package downloader",
55
"author": "GitHub Inc.",
66
"bin": {
@@ -52,7 +52,7 @@
5252
"fs-minipass": "^3.0.0",
5353
"minipass": "^7.0.2",
5454
"npm-package-arg": "^11.0.0",
55-
"npm-packlist": "^7.0.0",
55+
"npm-packlist": "^8.0.0",
5656
"npm-pick-manifest": "^9.0.0",
5757
"npm-registry-fetch": "^16.0.0",
5858
"proc-log": "^3.0.0",

package-lock.json

+23-11
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"npm-user-validate": "^2.0.0",
140140
"npmlog": "^7.0.1",
141141
"p-map": "^4.0.0",
142-
"pacote": "^17.0.2",
142+
"pacote": "^17.0.3",
143143
"parse-conflict-json": "^3.0.1",
144144
"proc-log": "^3.0.0",
145145
"qrcode-terminal": "^0.12.0",
@@ -230,7 +230,7 @@
230230
"json-stringify-safe": "^5.0.1",
231231
"nock": "^13.3.3",
232232
"npm-package-arg": "^11.0.0",
233-
"pacote": "^17.0.2",
233+
"pacote": "^17.0.3",
234234
"tap": "^16.3.8"
235235
},
236236
"engines": {
@@ -9791,7 +9791,7 @@
97919791
"version": "7.0.4",
97929792
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-7.0.4.tgz",
97939793
"integrity": "sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q==",
9794-
"inBundle": true,
9794+
"dev": true,
97959795
"dependencies": {
97969796
"ignore-walk": "^6.0.0"
97979797
},
@@ -10379,9 +10379,9 @@
1037910379
}
1038010380
},
1038110381
"node_modules/pacote": {
10382-
"version": "17.0.2",
10383-
"resolved": "https://registry.npmjs.org/pacote/-/pacote-17.0.2.tgz",
10384-
"integrity": "sha512-Us2QUwVHu4wwUhGZVOHlFIG9LhQ0Aq8zsv1ZvJ37rQwfxSIe/PaPfskz905hHycEXRfmlGKJ5xoEtrF+y66T6w==",
10382+
"version": "17.0.3",
10383+
"resolved": "https://registry.npmjs.org/pacote/-/pacote-17.0.3.tgz",
10384+
"integrity": "sha512-nT66y5NK2u/d7qV9lP6ye+powAufDl6OHT+aOZ4Cmtq89GSqgB05Ar6aQ7DM+0+bIE5NCdYUcqFlkK4m/0LVHA==",
1038510385
"inBundle": true,
1038610386
"dependencies": {
1038710387
"@npmcli/git": "^5.0.0",
@@ -10392,7 +10392,7 @@
1039210392
"fs-minipass": "^3.0.0",
1039310393
"minipass": "^7.0.2",
1039410394
"npm-package-arg": "^11.0.0",
10395-
"npm-packlist": "^7.0.0",
10395+
"npm-packlist": "^8.0.0",
1039610396
"npm-pick-manifest": "^9.0.0",
1039710397
"npm-registry-fetch": "^16.0.0",
1039810398
"proc-log": "^3.0.0",
@@ -10410,6 +10410,18 @@
1041010410
"node": "^16.14.0 || >=18.0.0"
1041110411
}
1041210412
},
10413+
"node_modules/pacote/node_modules/npm-packlist": {
10414+
"version": "8.0.0",
10415+
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-8.0.0.tgz",
10416+
"integrity": "sha512-ErAGFB5kJUciPy1mmx/C2YFbvxoJ0QJ9uwkCZOeR6CqLLISPZBOiFModAbSXnjjlwW5lOhuhXva+fURsSGJqyw==",
10417+
"inBundle": true,
10418+
"dependencies": {
10419+
"ignore-walk": "^6.0.0"
10420+
},
10421+
"engines": {
10422+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
10423+
}
10424+
},
1041310425
"node_modules/parent-module": {
1041410426
"version": "1.0.1",
1041510427
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
@@ -15852,7 +15864,7 @@
1585215864
"npm-pick-manifest": "^9.0.0",
1585315865
"npm-registry-fetch": "^16.0.0",
1585415866
"npmlog": "^7.0.1",
15855-
"pacote": "^17.0.2",
15867+
"pacote": "^17.0.3",
1585615868
"parse-conflict-json": "^3.0.0",
1585715869
"proc-log": "^3.0.0",
1585815870
"promise-all-reject-late": "^1.0.0",
@@ -15933,7 +15945,7 @@
1593315945
"diff": "^5.1.0",
1593415946
"minimatch": "^9.0.0",
1593515947
"npm-package-arg": "^11.0.0",
15936-
"pacote": "^17.0.2",
15948+
"pacote": "^17.0.3",
1593715949
"tar": "^6.1.13"
1593815950
},
1593915951
"devDependencies": {
@@ -15954,7 +15966,7 @@
1595415966
"ci-info": "^3.7.1",
1595515967
"npm-package-arg": "^11.0.0",
1595615968
"npmlog": "^7.0.1",
15957-
"pacote": "^17.0.2",
15969+
"pacote": "^17.0.3",
1595815970
"proc-log": "^3.0.0",
1595915971
"read": "^2.0.0",
1596015972
"read-package-json-fast": "^3.0.2",
@@ -16032,7 +16044,7 @@
1603216044
"@npmcli/arborist": "^6.3.0",
1603316045
"@npmcli/run-script": "^6.0.0",
1603416046
"npm-package-arg": "^11.0.0",
16035-
"pacote": "^17.0.2"
16047+
"pacote": "^17.0.3"
1603616048
},
1603716049
"devDependencies": {
1603816050
"@npmcli/eslint-config": "^4.0.0",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"npm-user-validate": "^2.0.0",
105105
"npmlog": "^7.0.1",
106106
"p-map": "^4.0.0",
107-
"pacote": "^17.0.2",
107+
"pacote": "^17.0.3",
108108
"parse-conflict-json": "^3.0.1",
109109
"proc-log": "^3.0.0",
110110
"qrcode-terminal": "^0.12.0",

workspaces/arborist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"npm-pick-manifest": "^9.0.0",
2727
"npm-registry-fetch": "^16.0.0",
2828
"npmlog": "^7.0.1",
29-
"pacote": "^17.0.2",
29+
"pacote": "^17.0.3",
3030
"parse-conflict-json": "^3.0.0",
3131
"proc-log": "^3.0.0",
3232
"promise-all-reject-late": "^1.0.0",

workspaces/libnpmdiff/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"diff": "^5.1.0",
5454
"minimatch": "^9.0.0",
5555
"npm-package-arg": "^11.0.0",
56-
"pacote": "^17.0.2",
56+
"pacote": "^17.0.3",
5757
"tar": "^6.1.13"
5858
},
5959
"templateOSS": {

workspaces/libnpmexec/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"ci-info": "^3.7.1",
6565
"npm-package-arg": "^11.0.0",
6666
"npmlog": "^7.0.1",
67-
"pacote": "^17.0.2",
67+
"pacote": "^17.0.3",
6868
"proc-log": "^3.0.0",
6969
"read": "^2.0.0",
7070
"read-package-json-fast": "^3.0.2",

workspaces/libnpmpack/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@npmcli/arborist": "^6.3.0",
4040
"@npmcli/run-script": "^6.0.0",
4141
"npm-package-arg": "^11.0.0",
42-
"pacote": "^17.0.2"
42+
"pacote": "^17.0.3"
4343
},
4444
"engines": {
4545
"node": "^16.14.0 || >=18.0.0"

0 commit comments

Comments
 (0)