libnpmdiff 7.0.0 → 8.0.0-pre.1

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.
@@ -19,7 +19,7 @@ const color = (colorStr, colorId) => {
19
19
  return colorStr.replace(/[^\n\r]+/g, open + '$&' + close)
20
20
  }
21
21
 
22
- const formatDiff = ({ files, opts = {}, refs, versions }) => {
22
+ const formatDiff = async ({ files, opts = {}, refs, versions }) => {
23
23
  let res = ''
24
24
  const srcPrefix = opts.diffNoPrefix ? '' : opts.diffSrcPrefix || 'a/'
25
25
  const dstPrefix = opts.diffNoPrefix ? '' : opts.diffDstPrefix || 'b/'
@@ -77,7 +77,7 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
77
77
  /* eslint-disable-next-line max-len */
78
78
  header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`)
79
79
 
80
- if (shouldPrintPatch(filename)) {
80
+ if (await shouldPrintPatch(filename)) {
81
81
  patch += jsDiff.createTwoFilesPatch(
82
82
  names.a,
83
83
  names.b,
@@ -1,14 +1,14 @@
1
1
  const { basename, extname } = require('node:path')
2
2
 
3
- const binaryExtensions = require('binary-extensions')
4
-
5
3
  // we should try to print patches as long as the
6
4
  // extension is not identified as binary files
7
- const shouldPrintPatch = (path, opts = {}) => {
5
+ const shouldPrintPatch = async (path, opts = {}) => {
8
6
  if (opts.diffText) {
9
7
  return true
10
8
  }
11
9
 
10
+ const { default: binaryExtensions } = await import('binary-extensions')
11
+
12
12
  const filename = basename(path)
13
13
  const extension = (
14
14
  filename.startsWith('.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libnpmdiff",
3
- "version": "7.0.0",
3
+ "version": "8.0.0-pre.1",
4
4
  "description": "The registry diff",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  "lib/"
14
14
  ],
15
15
  "engines": {
16
- "node": "^18.17.0 || >=20.5.0"
16
+ "node": "^20.17.0 || >=22.9.0"
17
17
  },
18
18
  "keywords": [
19
19
  "npm",
@@ -43,22 +43,22 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@npmcli/eslint-config": "^5.0.1",
46
- "@npmcli/template-oss": "4.23.3",
46
+ "@npmcli/template-oss": "4.23.5",
47
47
  "tap": "^16.3.8"
48
48
  },
49
49
  "dependencies": {
50
- "@npmcli/arborist": "^8.0.0",
50
+ "@npmcli/arborist": "^9.0.0-pre.1",
51
51
  "@npmcli/installed-package-contents": "^3.0.0",
52
- "binary-extensions": "^2.3.0",
53
- "diff": "^5.1.0",
52
+ "binary-extensions": "^3.0.0",
53
+ "diff": "^7.0.0",
54
54
  "minimatch": "^9.0.4",
55
55
  "npm-package-arg": "^12.0.0",
56
- "pacote": "^19.0.0",
56
+ "pacote": "^21.0.0",
57
57
  "tar": "^6.2.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.23.3",
61
+ "version": "4.23.5",
62
62
  "content": "../../scripts/template-oss/index.js"
63
63
  },
64
64
  "tap": {