Skip to content

Commit c0bcc2a

Browse files
committed
Fixed code to deal w/ new esm export
1 parent d463a6f commit c0bcc2a

File tree

17 files changed

+147
-128
lines changed

17 files changed

+147
-128
lines changed
+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
module.exports = require('./binary-extensions.json');
1+
import binaryExtensions from './binary-extensions.json' with {type: 'json'};
2+
3+
export default binaryExtensions;
+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "binary-extensions",
3-
"version": "2.3.0",
3+
"version": "3.0.0",
44
"description": "List of binary file extensions",
55
"license": "MIT",
66
"repository": "sindresorhus/binary-extensions",
@@ -10,18 +10,23 @@
1010
"email": "[email protected]",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": {
15+
"types": "./index.d.ts",
16+
"default": "./index.js"
17+
},
1318
"sideEffects": false,
1419
"engines": {
15-
"node": ">=8"
20+
"node": ">=18.20"
1621
},
1722
"scripts": {
18-
"test": "xo && ava && tsd"
23+
"//test": "xo && ava && tsd",
24+
"test": "ava && tsd"
1925
},
2026
"files": [
2127
"index.js",
2228
"index.d.ts",
23-
"binary-extensions.json",
24-
"binary-extensions.json.d.ts"
29+
"binary-extensions.json"
2530
],
2631
"keywords": [
2732
"binary",
@@ -33,8 +38,8 @@
3338
"array"
3439
],
3540
"devDependencies": {
36-
"ava": "^1.4.1",
37-
"tsd": "^0.7.2",
38-
"xo": "^0.24.0"
41+
"ava": "^6.1.2",
42+
"tsd": "^0.31.0",
43+
"xo": "^0.58.0"
3944
}
4045
}

node_modules/walk-up-path/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The ISC License
22

3-
Copyright (c) Isaac Z. Schlueter
3+
Copyright (c) 2020-2023 Isaac Z. Schlueter
44

55
Permission to use, copy, modify, and/or distribute this software for any
66
purpose with or without fee is hereby granted, provided that the above
+37-38
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
{
22
"name": "walk-up-path",
3-
"version": "3.0.1",
3+
"version": "4.0.0",
44
"files": [
55
"dist"
66
],
7-
"main": "./dist/cjs/index.js",
8-
"module": "./dist/mjs/index.js",
9-
"types": "./dist/mjs/index.d.ts",
10-
"exports": {
11-
".": {
12-
"require": {
13-
"types": "./dist/cjs/index.d.ts",
14-
"default": "./dist/cjs/index.js"
15-
},
16-
"import": {
17-
"types": "./dist/mjs/index.d.ts",
18-
"default": "./dist/mjs/index.js"
19-
}
20-
}
21-
},
227
"description": "Given a path string, return a generator that walks up the path, emitting each dirname.",
238
"repository": {
249
"type": "git",
@@ -30,15 +15,16 @@
3015
"preversion": "npm test",
3116
"postversion": "npm publish",
3217
"prepublishOnly": "git push origin --follow-tags",
33-
"prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh",
18+
"prepare": "tshy",
3419
"pretest": "npm run prepare",
3520
"presnap": "npm run prepare",
36-
"test": "c8 tap",
37-
"snap": "c8 tap",
38-
"format": "prettier --write . --loglevel warn",
21+
"test": "tap",
22+
"snap": "tap",
23+
"format": "prettier --write . --log-level warn",
3924
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts"
4025
},
4126
"prettier": {
27+
"experimentalTernaries": true,
4228
"semi": false,
4329
"printWidth": 75,
4430
"tabWidth": 2,
@@ -49,24 +35,37 @@
4935
"arrowParens": "avoid",
5036
"endOfLine": "lf"
5137
},
52-
"tap": {
53-
"coverage": false,
54-
"node-arg": [
55-
"--no-warnings",
56-
"--loader",
57-
"ts-node/esm"
58-
],
59-
"ts": false
60-
},
6138
"devDependencies": {
62-
"@types/node": "^18.15.5",
63-
"@types/tap": "^15.0.8",
64-
"c8": "^7.13.0",
65-
"eslint-config-prettier": "^8.8.0",
66-
"prettier": "^2.8.6",
67-
"tap": "^16.3.4",
68-
"ts-node": "^10.9.1",
69-
"typedoc": "^0.23.28",
70-
"typescript": "^5.0.2"
39+
"@types/node": "^20.14.10",
40+
"prettier": "^3.3.2",
41+
"tap": "^20.0.3",
42+
"tshy": "^3.0.0",
43+
"typedoc": "^0.26.3"
44+
},
45+
"type": "module",
46+
"tshy": {
47+
"exports": {
48+
"./package.json": "./package.json",
49+
".": "./src/index.ts"
50+
}
51+
},
52+
"exports": {
53+
"./package.json": "./package.json",
54+
".": {
55+
"import": {
56+
"types": "./dist/esm/index.d.ts",
57+
"default": "./dist/esm/index.js"
58+
},
59+
"require": {
60+
"types": "./dist/commonjs/index.d.ts",
61+
"default": "./dist/commonjs/index.js"
62+
}
63+
}
64+
},
65+
"main": "./dist/commonjs/index.js",
66+
"types": "./dist/commonjs/index.d.ts",
67+
"module": "./dist/esm/index.js",
68+
"engines": {
69+
"node": "20 || >=22"
7170
}
7271
}

package-lock.json

+42-12
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,13 @@
21642164
"node": "^18.17.0 || >=20.5.0"
21652165
}
21662166
},
2167+
"mock-registry/node_modules/walk-up-path": {
2168+
"version": "3.0.1",
2169+
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz",
2170+
"integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==",
2171+
"dev": true,
2172+
"license": "ISC"
2173+
},
21672174
"node_modules/@actions/core": {
21682175
"version": "1.11.1",
21692176
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
@@ -4462,6 +4469,13 @@
44624469
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
44634470
}
44644471
},
4472+
"node_modules/@npmcli/template-oss/node_modules/walk-up-path": {
4473+
"version": "3.0.1",
4474+
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz",
4475+
"integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==",
4476+
"dev": true,
4477+
"license": "ISC"
4478+
},
44654479
"node_modules/@npmcli/template-oss/node_modules/which": {
44664480
"version": "4.0.0",
44674481
"resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz",
@@ -5495,12 +5509,12 @@
54955509
}
54965510
},
54975511
"node_modules/binary-extensions": {
5498-
"version": "2.3.0",
5499-
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
5500-
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
5512+
"version": "3.0.0",
5513+
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-3.0.0.tgz",
5514+
"integrity": "sha512-X0RfwMgXPEesg6PCXzytQZt9Unh9gtc4SfeTNJvKifUL//Oegcc/Yf31z6hThNZ8dnD3Ir3wkHVN0eWrTvP5ww==",
55015515
"license": "MIT",
55025516
"engines": {
5503-
"node": ">=8"
5517+
"node": ">=18.20"
55045518
},
55055519
"funding": {
55065520
"url": "https://github.com/sponsors/sindresorhus"
@@ -9325,6 +9339,19 @@
93259339
"node": ">=8"
93269340
}
93279341
},
9342+
"node_modules/is-binary-path/node_modules/binary-extensions": {
9343+
"version": "2.3.0",
9344+
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
9345+
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
9346+
"dev": true,
9347+
"license": "MIT",
9348+
"engines": {
9349+
"node": ">=8"
9350+
},
9351+
"funding": {
9352+
"url": "https://github.com/sponsors/sindresorhus"
9353+
}
9354+
},
93289355
"node_modules/is-boolean-object": {
93299356
"version": "1.1.2",
93309357
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz",
@@ -17966,10 +17993,13 @@
1796617993
}
1796717994
},
1796817995
"node_modules/walk-up-path": {
17969-
"version": "3.0.1",
17970-
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz",
17971-
"integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==",
17972-
"license": "ISC"
17996+
"version": "4.0.0",
17997+
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-4.0.0.tgz",
17998+
"integrity": "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==",
17999+
"license": "ISC",
18000+
"engines": {
18001+
"node": "20 || >=22"
18002+
}
1797318003
},
1797418004
"node_modules/web-namespaces": {
1797518005
"version": "2.0.1",
@@ -18476,7 +18506,7 @@
1847618506
"semver": "^7.3.7",
1847718507
"ssri": "^12.0.0",
1847818508
"treeverse": "^3.0.0",
18479-
"walk-up-path": "^3.0.1"
18509+
"walk-up-path": "^4.0.0"
1848018510
},
1848118511
"bin": {
1848218512
"arborist": "bin/index.js"
@@ -18508,7 +18538,7 @@
1850818538
"nopt": "^8.0.0",
1850918539
"proc-log": "^5.0.0",
1851018540
"semver": "^7.3.5",
18511-
"walk-up-path": "^3.0.1"
18541+
"walk-up-path": "^4.0.0"
1851218542
},
1851318543
"devDependencies": {
1851418544
"@npmcli/eslint-config": "^5.0.1",
@@ -18543,7 +18573,7 @@
1854318573
"dependencies": {
1854418574
"@npmcli/arborist": "^9.0.0-pre.0",
1854518575
"@npmcli/installed-package-contents": "^3.0.0",
18546-
"binary-extensions": "^2.3.0",
18576+
"binary-extensions": "^3.0.0",
1854718577
"diff": "^5.1.0",
1854818578
"minimatch": "^9.0.4",
1854918579
"npm-package-arg": "^12.0.0",
@@ -18572,7 +18602,7 @@
1857218602
"read": "^4.0.0",
1857318603
"read-package-json-fast": "^4.0.0",
1857418604
"semver": "^7.3.7",
18575-
"walk-up-path": "^3.0.1"
18605+
"walk-up-path": "^4.0.0"
1857618606
},
1857718607
"devDependencies": {
1857818608
"@npmcli/eslint-config": "^5.0.1",

workspaces/arborist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"semver": "^7.3.7",
3737
"ssri": "^12.0.0",
3838
"treeverse": "^3.0.0",
39-
"walk-up-path": "^3.0.1"
39+
"walk-up-path": "^4.0.0"
4040
},
4141
"devDependencies": {
4242
"@npmcli/eslint-config": "^5.0.1",

workspaces/config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"nopt": "^8.0.0",
4545
"proc-log": "^5.0.0",
4646
"semver": "^7.3.5",
47-
"walk-up-path": "^3.0.1"
47+
"walk-up-path": "^4.0.0"
4848
},
4949
"engines": {
5050
"node": "^20.17.0 || >=22.9.0"

workspaces/libnpmdiff/lib/format-diff.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const color = (colorStr, colorId) => {
1919
return colorStr.replace(/[^\n\r]+/g, open + '$&' + close)
2020
}
2121

22-
const formatDiff = ({ files, opts = {}, refs, versions }) => {
22+
const formatDiff = async ({ files, opts = {}, refs, versions }) => {
2323
let res = ''
2424
const srcPrefix = opts.diffNoPrefix ? '' : opts.diffSrcPrefix || 'a/'
2525
const dstPrefix = opts.diffNoPrefix ? '' : opts.diffDstPrefix || 'b/'
@@ -77,7 +77,7 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
7777
/* eslint-disable-next-line max-len */
7878
header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`)
7979

80-
if (shouldPrintPatch(filename)) {
80+
if (await shouldPrintPatch(filename)) {
8181
patch += jsDiff.createTwoFilesPatch(
8282
names.a,
8383
names.b,

workspaces/libnpmdiff/lib/should-print-patch.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const { basename, extname } = require('node:path')
22

3-
const binaryExtensions = require('binary-extensions')
4-
53
// we should try to print patches as long as the
64
// extension is not identified as binary files
7-
const shouldPrintPatch = (path, opts = {}) => {
5+
const shouldPrintPatch = async (path, opts = {}) => {
86
if (opts.diffText) {
97
return true
108
}
119

10+
const { default: binaryExtensions } = await import('binary-extensions')
11+
1212
const filename = basename(path)
1313
const extension = (
1414
filename.startsWith('.')

workspaces/libnpmdiff/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"dependencies": {
5050
"@npmcli/arborist": "^9.0.0-pre.0",
5151
"@npmcli/installed-package-contents": "^3.0.0",
52-
"binary-extensions": "^2.3.0",
52+
"binary-extensions": "^3.0.0",
5353
"diff": "^5.1.0",
5454
"minimatch": "^9.0.4",
5555
"npm-package-arg": "^12.0.0",

0 commit comments

Comments
 (0)