Skip to content

Commit 3ae796d

Browse files
committed
feat: implement new npm-packlist behavior
This also lands the latest `pacote` which now requires passing in an `Arborist` constructor for use in loading the package tree that gets passed to `npm-packlist`. BREAKING CHANGE: `npm pack` now follows a strict order of operations when applying ignore rules. If a files array is present in the package.json, then rules in .gitignore and .npmignore files from the root will be ignored.
1 parent f0e7584 commit 3ae796d

File tree

35 files changed

+481
-1135
lines changed

35 files changed

+481
-1135
lines changed

DEPENDENCIES.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ graph LR;
2525
libnpmaccess-->npmcli-eslint-config["@npmcli/eslint-config"];
2626
libnpmaccess-->npmcli-template-oss["@npmcli/template-oss"];
2727
libnpmdiff-->npm-package-arg;
28+
libnpmdiff-->npmcli-arborist["@npmcli/arborist"];
2829
libnpmdiff-->npmcli-disparity-colors["@npmcli/disparity-colors"];
2930
libnpmdiff-->npmcli-eslint-config["@npmcli/eslint-config"];
3031
libnpmdiff-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
@@ -54,6 +55,7 @@ graph LR;
5455
libnpmorg-->npmcli-eslint-config["@npmcli/eslint-config"];
5556
libnpmorg-->npmcli-template-oss["@npmcli/template-oss"];
5657
libnpmpack-->npm-package-arg;
58+
libnpmpack-->npmcli-arborist["@npmcli/arborist"];
5759
libnpmpack-->npmcli-eslint-config["@npmcli/eslint-config"];
5860
libnpmpack-->npmcli-run-script["@npmcli/run-script"];
5961
libnpmpack-->npmcli-template-oss["@npmcli/template-oss"];
@@ -139,8 +141,6 @@ graph LR;
139141
npm-package-arg-->semver;
140142
npm-package-arg-->validate-npm-package-name;
141143
npm-packlist-->ignore-walk;
142-
npm-packlist-->npm-bundled;
143-
npm-packlist-->npm-normalize-package-bin;
144144
npm-profile-->npm-registry-fetch;
145145
npm-profile-->proc-log;
146146
npm-registry-fetch-->make-fetch-happen;
@@ -333,6 +333,7 @@ graph LR;
333333
libnpmdiff-->diff;
334334
libnpmdiff-->minimatch;
335335
libnpmdiff-->npm-package-arg;
336+
libnpmdiff-->npmcli-arborist["@npmcli/arborist"];
336337
libnpmdiff-->npmcli-disparity-colors["@npmcli/disparity-colors"];
337338
libnpmdiff-->npmcli-eslint-config["@npmcli/eslint-config"];
338339
libnpmdiff-->npmcli-installed-package-contents["@npmcli/installed-package-contents"];
@@ -379,6 +380,7 @@ graph LR;
379380
libnpmorg-->tap;
380381
libnpmpack-->nock;
381382
libnpmpack-->npm-package-arg;
383+
libnpmpack-->npmcli-arborist["@npmcli/arborist"];
382384
libnpmpack-->npmcli-eslint-config["@npmcli/eslint-config"];
383385
libnpmpack-->npmcli-run-script["@npmcli/run-script"];
384386
libnpmpack-->npmcli-template-oss["@npmcli/template-oss"];
@@ -554,10 +556,7 @@ graph LR;
554556
npm-package-arg-->proc-log;
555557
npm-package-arg-->semver;
556558
npm-package-arg-->validate-npm-package-name;
557-
npm-packlist-->glob;
558559
npm-packlist-->ignore-walk;
559-
npm-packlist-->npm-bundled;
560-
npm-packlist-->npm-normalize-package-bin;
561560
npm-pick-manifest-->npm-install-checks;
562561
npm-pick-manifest-->npm-normalize-package-bin;
563562
npm-pick-manifest-->npm-package-arg;
@@ -756,12 +755,13 @@ Each group depends on packages lower down the chain, nothing depends on
756755
packages higher up the chain.
757756

758757
- npm
759-
- libnpmexec, libnpmfund
760-
- @npmcli/arborist, libnpmpublish
761-
- @npmcli/metavuln-calculator, libnpmdiff, libnpmpack
758+
- libnpmpublish
759+
- libnpmdiff, libnpmexec, libnpmfund, libnpmpack
760+
- @npmcli/arborist
761+
- @npmcli/metavuln-calculator
762762
- pacote, libnpmaccess, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
763763
- npm-registry-fetch
764764
- make-fetch-happen, libnpmversion, @npmcli/config, init-package-json
765-
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, @npmcli/git, @npmcli/run-script, npm-packlist, read-package-json, @npmcli/query, readdir-scoped-modules, promzard
766-
- npm-bundled, read-package-json-fast, @npmcli/fs, unique-filename, @npmcli/promise-spawn, npm-package-arg, normalize-package-data, bin-links, nopt, npm-install-checks, npmlog, dezalgo, read
765+
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, @npmcli/git, @npmcli/run-script, read-package-json, @npmcli/query, readdir-scoped-modules, promzard
766+
- npm-bundled, read-package-json-fast, @npmcli/fs, unique-filename, @npmcli/promise-spawn, npm-package-arg, npm-packlist, normalize-package-data, bin-links, nopt, npm-install-checks, npmlog, dezalgo, read
767767
- npm-normalize-package-bin, @npmcli/name-from-folder, semver, @npmcli/move-file, fs-minipass, infer-owner, ssri, unique-slug, proc-log, @npmcli/node-gyp, hosted-git-info, validate-npm-package-name, ignore-walk, minipass-fetch, @npmcli/package-json, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, parse-conflict-json, wrappy, treeverse, @npmcli/eslint-config, @npmcli/template-oss, @npmcli/disparity-colors, @npmcli/ci-detect, mute-stream, ini, npm-audit-report, npm-user-validate

lib/commands/cache.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const cacache = require('cacache')
2+
const Arborist = require('@npmcli/arborist')
23
const { promisify } = require('util')
34
const pacote = require('pacote')
45
const path = require('path')
@@ -164,7 +165,7 @@ class Cache extends BaseCommand {
164165
return pacote.tarball.stream(spec, stream => {
165166
stream.resume()
166167
return stream.promise()
167-
}, this.npm.flatOptions)
168+
}, { ...this.npm.flatOptions, Arborist })
168169
}))
169170
}
170171

lib/package-url-cmd.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const pacote = require('pacote')
44
const hostedGitInfo = require('hosted-git-info')
5+
const Arborist = require('@npmcli/arborist')
56

67
const openUrl = require('./utils/open-url.js')
78
const log = require('./utils/log-shim')
@@ -31,6 +32,7 @@ class PackageUrlCommand extends BaseCommand {
3132
...this.npm.flatOptions,
3233
where: this.npm.localPrefix,
3334
fullMetadata: true,
35+
Arborist,
3436
}
3537
const mani = await pacote.manifest(arg, opts)
3638
const url = this.getUrl(arg, mani)

node_modules/@npmcli/metavuln-calculator/package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/metavuln-calculator",
3-
"version": "3.1.1",
3+
"version": "4.0.0-pre.0",
44
"main": "lib/index.js",
55
"files": [
66
"bin/",
@@ -18,9 +18,6 @@
1818
"posttest": "npm run lint",
1919
"snap": "tap",
2020
"postsnap": "npm run lint",
21-
"preversion": "npm test",
22-
"postversion": "npm publish",
23-
"prepublishOnly": "git push origin --follow-tags",
2421
"eslint": "eslint",
2522
"lint": "eslint \"**/*.js\"",
2623
"lintfix": "npm run lint -- --fix",
@@ -29,25 +26,29 @@
2926
},
3027
"tap": {
3128
"check-coverage": true,
32-
"coverage-map": "map.js"
29+
"coverage-map": "map.js",
30+
"nyc-arg": [
31+
"--exclude",
32+
"tap-snapshots/**"
33+
]
3334
},
3435
"devDependencies": {
3536
"@npmcli/eslint-config": "^3.0.1",
36-
"@npmcli/template-oss": "3.5.0",
37+
"@npmcli/template-oss": "4.4.2",
3738
"require-inject": "^1.4.4",
3839
"tap": "^16.0.1"
3940
},
4041
"dependencies": {
4142
"cacache": "^16.0.0",
4243
"json-parse-even-better-errors": "^2.3.1",
43-
"pacote": "^13.0.3",
44+
"pacote": "^14.0.0 || ^14.0.0-pre.0",
4445
"semver": "^7.3.5"
4546
},
4647
"engines": {
47-
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
48+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
4849
},
4950
"templateOSS": {
5051
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
51-
"version": "3.5.0"
52+
"version": "4.4.2"
5253
}
5354
}

node_modules/npm-bundled/LICENSE

-15
This file was deleted.

0 commit comments

Comments
 (0)