@netlify/cache-utils 5.1.5 → 5.1.6

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/lib/dir.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const getCacheDir: ({ cacheDir, cwd }?: {
2
+ cacheDir?: string | undefined;
3
+ cwd?: string | undefined;
4
+ }) => string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Calculate the expiration date based on a time to leave in seconds
3
+ * This might be used to retrieve the expiration date when caching a file
4
+ */
5
+ export declare const getExpires: (timeToLeave: number) => number | undefined;
6
+ /**
7
+ * Check if a expiredDate in milliseconds (retrieved by `Date.now`) has already expired
8
+ * This might be used to check if a file is expired
9
+ */
10
+ export declare const checkExpires: (expiredDate: number) => boolean;
package/lib/fs.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Move or copy a cached file/directory from/to a local one
3
+ * @param src The src directory or file to cache
4
+ * @param dest The destination location
5
+ * @param move If the file should be moved, moving is faster but removes the source files locally
6
+ */
7
+ export declare const moveCacheFile: (src: string, dest: string, move?: boolean) => Promise<void | string[]>;
8
+ /**
9
+ * Non-existing files and empty directories are always skipped
10
+ */
11
+ export declare const hasFiles: (src: string) => Promise<boolean>;
package/lib/hash.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const getHash: (digests: any, move: any) => Promise<string | undefined>;
package/lib/list.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const list: ({ cacheDir, cwd: cwdOpt, depth, }?: {
2
+ cacheDir?: string;
3
+ cwd?: string;
4
+ depth?: number;
5
+ }) => Promise<string[]>;
package/lib/main.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export { getCacheDir } from './dir.js';
2
+ export { list } from './list.js';
3
+ export declare const save: any;
4
+ export declare const restore: any;
5
+ export declare const remove: any;
6
+ export declare const has: any;
7
+ export declare const bindOpts: (opts: any) => {
8
+ save: (paths: any, optsA: any) => any;
9
+ restore: (paths: any, optsA: any) => any;
10
+ remove: (paths: any, optsA: any) => any;
11
+ has: (paths: any, optsA: any) => any;
12
+ list: (optsA: any) => Promise<string[]>;
13
+ getCacheDir: (optsA: any) => string;
14
+ };
@@ -0,0 +1,19 @@
1
+ export declare const getManifestInfo: ({ cachePath, move, ttl, digests }: {
2
+ cachePath: any;
3
+ move: any;
4
+ ttl: any;
5
+ digests: any;
6
+ }) => Promise<{
7
+ manifestInfo: {
8
+ manifestPath: string;
9
+ manifestString: string;
10
+ };
11
+ identical: boolean;
12
+ }>;
13
+ export declare const writeManifest: ({ manifestPath, manifestString }: {
14
+ manifestPath: any;
15
+ manifestString: any;
16
+ }) => Promise<void>;
17
+ export declare const removeManifest: (cachePath: string) => Promise<void>;
18
+ export declare const isManifest: (filePath: any) => any;
19
+ export declare const isExpired: (cachePath: any) => Promise<boolean>;
package/lib/path.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export declare const parsePath: ({ path, cacheDir, cwdOpt }: {
2
+ path: any;
3
+ cacheDir: any;
4
+ cwdOpt: any;
5
+ }) => Promise<{
6
+ srcPath: string;
7
+ cachePath: string;
8
+ }>;
9
+ export declare const getBases: (cwdOpt?: string) => Promise<{
10
+ name: string;
11
+ base: string;
12
+ }[]>;
@@ -0,0 +1 @@
1
+ export declare const safeGetCwd: (cwdOpt?: string) => Promise<string>;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@netlify/cache-utils",
3
- "version": "5.1.5",
3
+ "version": "5.1.6",
4
4
  "description": "Utility for caching files in Netlify Build",
5
5
  "type": "module",
6
6
  "exports": "./lib/main.js",
7
7
  "main": "./lib/main.js",
8
- "types": "./lib.main.d.ts",
8
+ "types": "./lib/main.d.ts",
9
9
  "files": [
10
- "lib/**/*.js"
10
+ "lib/**/*.{js,d.ts}"
11
11
  ],
12
12
  "author": "Netlify Inc.",
13
13
  "scripts": {
@@ -60,13 +60,13 @@
60
60
  "readdirp": "^3.4.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@types/node": "^18.14.2",
63
+ "@types/node": "^14.18.53",
64
64
  "tmp-promise": "^3.0.0",
65
65
  "typescript": "^5.0.0",
66
- "vitest": "^0.30.1"
66
+ "vitest": "^0.34.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": "^14.16.0 || >=16.0.0"
70
70
  },
71
- "gitHead": "6c093847fef2347fc80740059cbf0ee49ea193fc"
71
+ "gitHead": "507a010535ba4028153a755b397501109fa872c9"
72
72
  }