tempfile 5.0.0 → 6.0.0

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 (2) hide show
  1. package/index.js +3 -7
  2. package/package.json +6 -5
package/index.js CHANGED
@@ -1,18 +1,14 @@
1
1
  import path from 'node:path';
2
2
  import {randomUUID} from 'node:crypto';
3
- import tempDirectory from 'temp-dir';
3
+ import temporaryDirectory from 'temp-dir';
4
4
 
5
5
  export default function tempfile(options = {}) {
6
- // TODO: Remove this for v6.
7
- if (typeof options === 'string') {
8
- throw new TypeError('You must now pass in the file extension as an object.');
9
- }
10
-
11
6
  let {extension} = options;
12
7
 
13
8
  if (typeof extension === 'string') {
9
+ extension = path.basename(extension);
14
10
  extension = extension.startsWith('.') ? extension : `.${extension}`;
15
11
  }
16
12
 
17
- return path.join(tempDirectory, randomUUID() + (extension ?? ''));
13
+ return path.join(temporaryDirectory, randomUUID() + (extension ?? ''));
18
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tempfile",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "Get a random temporary file path",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/tempfile",
@@ -15,8 +15,9 @@
15
15
  "types": "./index.d.ts",
16
16
  "default": "./index.js"
17
17
  },
18
+ "sideEffects": false,
18
19
  "engines": {
19
- "node": ">=14.18"
20
+ "node": ">=20"
20
21
  },
21
22
  "scripts": {
22
23
  "test": "xo && ava && tsd"
@@ -38,8 +39,8 @@
38
39
  "temp-dir": "^3.0.0"
39
40
  },
40
41
  "devDependencies": {
41
- "ava": "^5.2.0",
42
- "tsd": "^0.25.0",
43
- "xo": "^0.53.1"
42
+ "ava": "^6.4.1",
43
+ "tsd": "^0.33.0",
44
+ "xo": "^1.2.3"
44
45
  }
45
46
  }