@netlify/cache-utils 4.1.0 → 4.1.4
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.
- package/package.json +7 -7
- package/src/fs.js +6 -9
- package/src/hash.js +1 -1
- package/src/manifest.js +1 -1
- package/src/utils/cwd.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/cache-utils",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"description": "Utility for caching files in Netlify Build",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/main.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"cpy": "^8.1.0",
|
|
49
|
-
"del": "^
|
|
49
|
+
"del": "^6.0.0",
|
|
50
50
|
"get-stream": "^6.0.0",
|
|
51
|
-
"globby": "^
|
|
52
|
-
"junk": "^
|
|
53
|
-
"locate-path": "^
|
|
54
|
-
"move-file": "^
|
|
55
|
-
"path-exists": "^
|
|
51
|
+
"globby": "^13.0.0",
|
|
52
|
+
"junk": "^4.0.0",
|
|
53
|
+
"locate-path": "^7.0.0",
|
|
54
|
+
"move-file": "^3.0.0",
|
|
55
|
+
"path-exists": "^5.0.0",
|
|
56
56
|
"readdirp": "^3.4.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
package/src/fs.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promises as fs } from 'fs'
|
|
2
2
|
import { basename, dirname } from 'path'
|
|
3
|
-
import { promisify } from 'util'
|
|
4
3
|
|
|
5
4
|
import cpy from 'cpy'
|
|
6
|
-
import globby from 'globby'
|
|
7
|
-
import
|
|
8
|
-
import moveFile from 'move-file'
|
|
9
|
-
|
|
10
|
-
const pStat = promisify(stat)
|
|
5
|
+
import { globby } from 'globby'
|
|
6
|
+
import { isNotJunk } from 'junk'
|
|
7
|
+
import { moveFile } from 'move-file'
|
|
11
8
|
|
|
12
9
|
// Move or copy a cached file/directory from/to a local one
|
|
13
10
|
export const moveCacheFile = async function (src, dest, move) {
|
|
@@ -33,7 +30,7 @@ const isEmptyDir = async function ({ srcGlob, cwd, isDir }) {
|
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
const files = await globby(srcGlob, { cwd })
|
|
36
|
-
const filteredFiles = files.filter((file) =>
|
|
33
|
+
const filteredFiles = files.filter((file) => isNotJunk(basename(file)))
|
|
37
34
|
return filteredFiles.length === 0
|
|
38
35
|
}
|
|
39
36
|
|
|
@@ -58,6 +55,6 @@ const getSrcGlob = async function (src) {
|
|
|
58
55
|
|
|
59
56
|
const getStat = async function (src) {
|
|
60
57
|
try {
|
|
61
|
-
return await
|
|
58
|
+
return await fs.stat(src)
|
|
62
59
|
} catch {}
|
|
63
60
|
}
|
package/src/hash.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createHash } from 'crypto'
|
|
|
2
2
|
import { createReadStream } from 'fs'
|
|
3
3
|
|
|
4
4
|
import getStream from 'get-stream'
|
|
5
|
-
import locatePath from 'locate-path'
|
|
5
|
+
import { locatePath } from 'locate-path'
|
|
6
6
|
|
|
7
7
|
// Caching a big directory like `node_modules` is slow. However those can
|
|
8
8
|
// sometime be represented by a digest file such as `package-lock.json`. If this
|
package/src/manifest.js
CHANGED
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs'
|
|
|
2
2
|
import { dirname } from 'path'
|
|
3
3
|
|
|
4
4
|
import del from 'del'
|
|
5
|
-
import pathExists from 'path-exists'
|
|
5
|
+
import { pathExists } from 'path-exists'
|
|
6
6
|
|
|
7
7
|
import { getExpires, checkExpires } from './expire.js'
|
|
8
8
|
import { getHash } from './hash.js'
|
package/src/utils/cwd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'path'
|
|
2
2
|
import process from 'process'
|
|
3
3
|
|
|
4
|
-
import pathExists from 'path-exists'
|
|
4
|
+
import { pathExists } from 'path-exists'
|
|
5
5
|
|
|
6
6
|
// Like `process.cwd()` but safer when current directory is wrong
|
|
7
7
|
export const safeGetCwd = async function (cwdOpt) {
|