libnpmdiff 8.0.7 → 8.0.9

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.
Files changed (3) hide show
  1. package/README.md +27 -20
  2. package/lib/untar.js +2 -2
  3. package/package.json +9 -9
package/README.md CHANGED
@@ -52,15 +52,11 @@ index v1.1.0..v1.1.1 100644
52
52
  ### Contributing
53
53
 
54
54
  The npm team enthusiastically welcomes contributions and project participation!
55
- There's a bunch of things you can do if you want to contribute! The
56
- [Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)
57
- outlines the process for community interaction and contribution. Please don't
58
- hesitate to jump in if you'd like to, or even ask us questions if something
59
- isn't clear.
55
+ There's a bunch of things you can do if you want to contribute!
56
+ The [Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) outlines the process for community interaction and contribution.
57
+ Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.
60
58
 
61
- All participants and maintainers in this project are expected to follow the
62
- [npm Code of Conduct](https://docs.npmjs.com/policies/conduct), and just
63
- generally be excellent to each other.
59
+ All participants and maintainers in this project are expected to follow the [npm Code of Conduct](https://docs.npmjs.com/policies/conduct), and just generally be excellent to each other.
64
60
 
65
61
  Please refer to the [Changelog](CHANGELOG.md) for project history details, too.
66
62
 
@@ -70,23 +66,34 @@ Happy hacking!
70
66
 
71
67
  #### `> libnpmdif([ a, b ], [opts]) -> Promise<String>`
72
68
 
73
- Fetches the registry tarballs and compare files between a spec `a` and spec `b`. **npm** spec types are usually described in `<pkg-name>@<version>` form but multiple other types are alsos supported, for more info on valid specs take a look at [`npm-package-arg`](https://github.com/npm/npm-package-arg).
69
+ Fetches the registry tarballs and compare files between a spec `a` and spec `b`.
70
+ **npm** spec types are usually described in `<pkg-name>@<version>` form but multiple other types are also supported, for more info on valid specs take a look at [`npm-package-arg`](https://github.com/npm/npm-package-arg).
74
71
 
75
72
  **Options**:
76
73
 
77
- - `color <Boolean>`: Should add ANSI colors to string output? Defaults to `false`.
78
- - `tagVersionPrefix <Sring>`: What prefix should be used to define version numbers. Defaults to `v`
79
- - `diffUnified <Number>`: How many lines of code to print before/after each diff. Defaults to `3`.
80
- - `diffFiles <Array<String>>`: If set only prints patches for the files listed in this array (also accepts globs). Defaults to `undefined`.
81
- - `diffIgnoreAllSpace <Boolean>`: Whether or not should ignore changes in whitespace (very useful to avoid indentation changes extra diff lines). Defaults to `false`.
82
- - `diffNameOnly <Boolean>`: Prints only file names and no patch diffs. Defaults to `false`.
83
- - `diffNoPrefix <Boolean>`: If true then skips printing any prefixes in filenames. Defaults to `false`.
84
- - `diffSrcPrefix <String>`: Prefix to be used in the filenames from `a`. Defaults to `a/`.
85
- - `diffDstPrefix <String>`: Prefix to be used in the filenames from `b`. Defaults to `b/`.
86
- - `diffText <Boolean>`: Should treat all files as text and try to print diff for binary files. Defaults to `false`.
74
+ - `color <Boolean>`: Should add ANSI colors to string output?
75
+ Defaults to `false`.
76
+ - `tagVersionPrefix <String>`: What prefix should be used to define version numbers.
77
+ Defaults to `v`
78
+ - `diffUnified <Number>`: How many lines of code to print before/after each diff.
79
+ Defaults to `3`.
80
+ - `diffFiles <Array<String>>`: If set only prints patches for the files listed in this array (also accepts globs).
81
+ Defaults to `undefined`.
82
+ - `diffIgnoreAllSpace <Boolean>`: Whether or not should ignore changes in whitespace (very useful to avoid indentation changes extra diff lines).
83
+ Defaults to `false`.
84
+ - `diffNameOnly <Boolean>`: Prints only file names and no patch diffs.
85
+ Defaults to `false`.
86
+ - `diffNoPrefix <Boolean>`: If true then skips printing any prefixes in filenames.
87
+ Defaults to `false`.
88
+ - `diffSrcPrefix <String>`: Prefix to be used in the filenames from `a`.
89
+ Defaults to `a/`.
90
+ - `diffDstPrefix <String>`: Prefix to be used in the filenames from `b`.
91
+ Defaults to `b/`.
92
+ - `diffText <Boolean>`: Should treat all files as text and try to print diff for binary files.
93
+ Defaults to `false`.
87
94
  - ...`cache`, `registry`, `where` and other common options accepted by [pacote](https://github.com/npm/pacote#options)
88
95
 
89
- Returns a `Promise` that fullfils with a `String` containing the resulting patch diffs.
96
+ Returns a `Promise` that fulfills with a `String` containing the resulting patch diffs.
90
97
 
91
98
  Throws an error if either `a` or `b` are missing or if trying to diff more than two specs.
92
99
 
package/lib/untar.js CHANGED
@@ -37,7 +37,6 @@ const untar = ({ files, refs }, { filterFiles, item, prefix }) => {
37
37
  // should skip reading file when using --name-only option
38
38
  let content
39
39
  try {
40
- entry.setEncoding('utf8')
41
40
  content = entry.concat()
42
41
  } catch (e) {
43
42
  /* istanbul ignore next */
@@ -80,11 +79,12 @@ const readTarballs = async (tarballs, opts = {}) => {
80
79
  }
81
80
 
82
81
  // await to read all content from included files
82
+ // TODO this feels like it could be one in one pass instead of three (values, map, forEach)
83
83
  const allRefs = [...refs.values()]
84
84
  const contents = await Promise.all(allRefs.map(async ref => ref.content))
85
85
 
86
86
  contents.forEach((content, index) => {
87
- allRefs[index].content = content
87
+ allRefs[index].content = content.toString('utf8')
88
88
  })
89
89
 
90
90
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libnpmdiff",
3
- "version": "8.0.7",
3
+ "version": "8.0.9",
4
4
  "description": "The registry diff",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,22 +43,22 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@npmcli/eslint-config": "^5.0.1",
46
- "@npmcli/template-oss": "4.24.4",
46
+ "@npmcli/template-oss": "4.25.1",
47
47
  "tap": "^16.3.8"
48
48
  },
49
49
  "dependencies": {
50
- "@npmcli/arborist": "^9.1.4",
50
+ "@npmcli/arborist": "^9.1.6",
51
51
  "@npmcli/installed-package-contents": "^3.0.0",
52
52
  "binary-extensions": "^3.0.0",
53
- "diff": "^7.0.0",
54
- "minimatch": "^9.0.4",
55
- "npm-package-arg": "^12.0.0",
56
- "pacote": "^21.0.0",
57
- "tar": "^6.2.1"
53
+ "diff": "^8.0.2",
54
+ "minimatch": "^10.0.3",
55
+ "npm-package-arg": "^13.0.0",
56
+ "pacote": "^21.0.2",
57
+ "tar": "^7.5.1"
58
58
  },
59
59
  "templateOSS": {
60
60
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
61
- "version": "4.24.4",
61
+ "version": "4.25.1",
62
62
  "content": "../../scripts/template-oss/index.js"
63
63
  },
64
64
  "tap": {