New Upstream Snapshot - node-path-type

Ready changes

Summary

Merged new upstream version: 5.0.0 (was: 4.0.0).

Resulting package

Built on 2022-11-21T11:53 (took 14m53s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots node-path-type

Lintian Result

Diff

diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 1c6314a..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-root = true
-
-[*]
-indent_style = tab
-end_of_line = lf
-charset = utf-8
-trim_trailing_whitespace = true
-insert_final_newline = true
-
-[*.yml]
-indent_style = space
-indent_size = 2
diff --git a/.npmrc b/.npmrc
deleted file mode 100644
index 43c97e7..0000000
--- a/.npmrc
+++ /dev/null
@@ -1 +0,0 @@
-package-lock=false
diff --git a/debian/changelog b/debian/changelog
index d4943bf..7b4a179 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-path-type (5.0.0-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 21 Nov 2022 11:44:48 -0000
+
 node-path-type (4.0.0-3) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --git a/index.d.ts b/index.d.ts
index 910a50a..fa742ad 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,51 +1,51 @@
 export type PathTypeFunction = (path: string) => Promise<boolean>;
 
 /**
- * Check whether the passed `path` is a file.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a file.
- */
+Check whether the passed `path` is a file.
+
+@param path - The path to check.
+@returns Whether the `path` is a file.
+*/
 export const isFile: PathTypeFunction;
 
 /**
- * Check whether the passed `path` is a directory.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a directory.
- */
+Check whether the passed `path` is a directory.
+
+@param path - The path to check.
+@returns Whether the `path` is a directory.
+*/
 export const isDirectory: PathTypeFunction;
 
 /**
- * Check whether the passed `path` is a symlink.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a symlink.
- */
+Check whether the passed `path` is a symlink.
+
+@param path - The path to check.
+@returns Whether the `path` is a symlink.
+*/
 export const isSymlink: PathTypeFunction;
 
 export type PathTypeSyncFunction = (path: string) => boolean;
 
 /**
- * Synchronously check whether the passed `path` is a file.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a file.
- */
+Synchronously check whether the passed `path` is a file.
+
+@param path - The path to check.
+@returns Whether the `path` is a file.
+*/
 export const isFileSync: PathTypeSyncFunction;
 
 /**
- * Synchronously check whether the passed `path` is a directory.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a directory.
- */
+Synchronously check whether the passed `path` is a directory.
+
+@param path - The path to check.
+@returns Whether the `path` is a directory.
+*/
 export const isDirectorySync: PathTypeSyncFunction;
 
 /**
- * Synchronously check whether the passed `path` is a symlink.
- *
- * @param path - The path to check.
- * @returns Whether the `path` is a directory.
- */
+Synchronously check whether the passed `path` is a symlink.
+
+@param path - The path to check.
+@returns Whether the `path` is a directory.
+*/
 export const isSymlinkSync: PathTypeSyncFunction;
diff --git a/index.js b/index.js
index b8f34b2..b43688d 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,4 @@
-'use strict';
-const {promisify} = require('util');
-const fs = require('fs');
+import fs, {promises as fsPromises} from 'fs';
 
 async function isType(fsStatType, statsMethodName, filePath) {
 	if (typeof filePath !== 'string') {
@@ -8,7 +6,7 @@ async function isType(fsStatType, statsMethodName, filePath) {
 	}
 
 	try {
-		const stats = await promisify(fs[fsStatType])(filePath);
+		const stats = await fsPromises[fsStatType](filePath);
 		return stats[statsMethodName]();
 	} catch (error) {
 		if (error.code === 'ENOENT') {
@@ -35,9 +33,9 @@ function isTypeSync(fsStatType, statsMethodName, filePath) {
 	}
 }
 
-exports.isFile = isType.bind(null, 'stat', 'isFile');
-exports.isDirectory = isType.bind(null, 'stat', 'isDirectory');
-exports.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
-exports.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
-exports.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
-exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
+export const isFile = isType.bind(null, 'stat', 'isFile');
+export const isDirectory = isType.bind(null, 'stat', 'isDirectory');
+export const isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
+export const isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
+export const isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
+export const isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
diff --git a/index.test-d.ts b/index.test-d.ts
deleted file mode 100644
index 8f2ce9c..0000000
--- a/index.test-d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import {expectType} from 'tsd-check';
-import {
-	isFile,
-	isDirectory,
-	isSymlink,
-	isFileSync,
-	isDirectorySync,
-	isSymlinkSync
-} from '.';
-
-expectType<Promise<boolean>>(isFile('package.json'));
-expectType<Promise<boolean>>(isDirectory('package.json'));
-expectType<Promise<boolean>>(isSymlink('package.json'));
-
-expectType<boolean>(isFileSync('package.json'));
-expectType<boolean>(isDirectorySync('package.json'));
-expectType<boolean>(isSymlinkSync('package.json'));
diff --git a/license b/license
index e7af2f7..fa7ceba 100644
--- a/license
+++ b/license
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
diff --git a/package.json b/package.json
index 635b711..15b59fd 100644
--- a/package.json
+++ b/package.json
@@ -1,19 +1,22 @@
 {
 	"name": "path-type",
-	"version": "4.0.0",
+	"version": "5.0.0",
 	"description": "Check if a path is a file, directory, or symlink",
 	"license": "MIT",
 	"repository": "sindresorhus/path-type",
+	"funding": "https://github.com/sponsors/sindresorhus",
 	"author": {
 		"name": "Sindre Sorhus",
 		"email": "sindresorhus@gmail.com",
-		"url": "sindresorhus.com"
+		"url": "https://sindresorhus.com"
 	},
+	"type": "module",
+	"exports": "./index.js",
 	"engines": {
-		"node": ">=8"
+		"node": ">=12"
 	},
 	"scripts": {
-		"test": "xo && nyc ava && tsd-check"
+		"test": "xo && nyc ava && tsd"
 	},
 	"files": [
 		"index.js",
@@ -26,7 +29,6 @@
 		"is",
 		"check",
 		"directory",
-		"dir",
 		"file",
 		"filepath",
 		"symlink",
@@ -37,9 +39,9 @@
 		"filesystem"
 	],
 	"devDependencies": {
-		"ava": "^1.3.1",
-		"nyc": "^13.3.0",
-		"tsd-check": "^0.3.0",
-		"xo": "^0.24.0"
+		"ava": "^3.15.0",
+		"nyc": "^15.1.0",
+		"tsd": "^0.14.0",
+		"xo": "^0.37.1"
 	}
 }
diff --git a/readme.md b/readme.md
index 4c972fa..85c5129 100644
--- a/readme.md
+++ b/readme.md
@@ -1,27 +1,22 @@
-# path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type)
+# path-type
 
 > Check if a path is a file, directory, or symlink
 
-
 ## Install
 
 ```
 $ npm install path-type
 ```
 
-
 ## Usage
 
 ```js
-const {isFile} = require('path-type');
+import {isFile} from 'path-type';
 
-(async () => {
-	console.log(await isFile('package.json'));
-	//=> true
-})();
+console.log(await isFile('package.json'));
+//=> true
 ```
 
-
 ## API
 
 ### isFile(path)
@@ -66,7 +61,14 @@ Synchronously check whether the passed `path` is a symlink.
 
 Returns a `boolean`.
 
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
+---
+
+<div align="center">
+	<b>
+		<a href="https://tidelift.com/subscription/pkg/npm-path-type?utm_source=npm-path-type&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+	</b>
+	<br>
+	<sub>
+		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+	</sub>
+</div>
diff --git a/symlink b/symlink
deleted file mode 120000
index 602eb8e..0000000
--- a/symlink
+++ /dev/null
@@ -1 +0,0 @@
-test.js
\ No newline at end of file
diff --git a/test/eacces.js b/test/eacces.js
deleted file mode 100644
index f560e74..0000000
--- a/test/eacces.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import fs from 'fs';
-import test from 'ava';
-import pathType from '..';
-
-function fakeError(fp) {
-	const error = new Error(`EACCES: permission denied, stat '${fp}'`);
-	error.code = 'EACCES';
-	return error;
-}
-
-Object.defineProperties(fs, {
-	stat: {
-		value(fp, cb) {
-			cb(fakeError(fp));
-		}
-	},
-	statSync: {
-		value(fp) {
-			throw fakeError(fp);
-		}
-	}
-});
-
-test('throws on EACCES error - async', async t => {
-	await t.throwsAsync(pathType.isFile('/root/private'));
-});
-
-test('throws on EACCES error - sync', t => {
-	t.throws(() => pathType.isFileSync('/root/private'));
-});
diff --git a/test/nominal.js b/test/nominal.js
deleted file mode 100644
index d47b057..0000000
--- a/test/nominal.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import test from 'ava';
-import pathType from '..';
-
-test('.file()', async t => {
-	t.true(await pathType.isFile('package.json'));
-	await t.throwsAsync(pathType.isFile(false));
-});
-
-test('.dir()', async t => {
-	t.true(await pathType.isDirectory('.'));
-	await t.throwsAsync(pathType.isDirectory(false));
-});
-
-if (process.platform !== 'win32') {
-	test('.symlink()', async t => {
-		t.true(await pathType.isSymlink('symlink'));
-		await t.throwsAsync(pathType.isSymlink(false));
-	});
-}
-
-test('.fileSync()', t => {
-	t.true(pathType.isFileSync('package.json'));
-});
-
-test('.dirSync()', t => {
-	t.true(pathType.isDirectorySync('.'));
-});
-
-if (process.platform !== 'win32') {
-	test('.symlinkSync()', t => {
-		t.true(pathType.isSymlinkSync('symlink'));
-	});
-}
-
-test('return false if path doesn\'t exist - async', async t => {
-	t.false(await pathType.isFile('unicorn'));
-});
-
-test('return false if path doesn\'t exist - sync', t => {
-	t.false(pathType.isFileSync('unicorn'));
-});
-
-test('throws invalid argument - async', async t => {
-	await t.throwsAsync(pathType.isFile(false));
-});
-
-test('throws on invalid argument - sync', t => {
-	t.throws(() => pathType.isFileSync(false));
-});

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details