Skip to content

Commit

Permalink
Merge pull request #18253 from vinodkumarsharma276/patch-1
Browse files Browse the repository at this point in the history
Upgrade file-system-cache to 2.0.0 and remove custom types
  • Loading branch information
ndelangen authored Jul 1, 2022
2 parents 9cd5d81 + 265631b commit 3b8b8c3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 101 deletions.
2 changes: 1 addition & 1 deletion lib/core-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"chalk": "^4.1.0",
"core-js": "^3.8.2",
"express": "^4.17.1",
"file-system-cache": "^1.0.5",
"file-system-cache": "^2.0.0",
"find-up": "^5.0.0",
"fork-ts-checker-webpack-plugin": "^6.0.4",
"fs-extra": "^9.0.1",
Expand Down
2 changes: 1 addition & 1 deletion lib/core-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Configuration, Stats } from 'webpack';
import type { TransformOptions } from '@babel/core';
import { Router } from 'express';
import { Server } from 'http';
import { FileSystemCache } from './utils/file-cache';
import type { FileSystemCache } from './utils/file-cache';

/**
* ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
Expand Down
63 changes: 3 additions & 60 deletions lib/core-common/src/utils/file-cache.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,8 @@
// @ts-ignore - this package has no typings, so we wrap it and add typings that way, because we expose it
import Cache from 'file-system-cache';

export interface Options {
basePath?: string;
ns?: string | string[];
extension?: string;
}

export class FileSystemCache {
constructor(options: Options) {
this.internal = Cache(options) as any as FileSystemCache;
}

private internal: FileSystemCache;

path(key: string): string {
return this.internal.path(key);
}

fileExists(key: string): Promise<boolean> {
return this.internal.fileExists(key);
}

ensureBasePath(): Promise<void> {
return this.internal.ensureBasePath();
}

get(key: string, defaultValue?: any): Promise<any | typeof defaultValue> {
return this.internal.get(key, defaultValue);
}

getSync(key: string, defaultValue?: any): any | typeof defaultValue {
return this.internal.getSync(key, defaultValue);
}

set(key: string, value: any): Promise<{ path: string }> {
return this.internal.set(key, value);
}

setSync(key: string, value: any): this {
this.internal.setSync(key, value);
return this;
}

remove(key: string): Promise<void> {
return this.internal.remove(key);
}

clear(): Promise<void> {
return this.internal.clear();
}

save(): Promise<{ paths: string[] }> {
return this.internal.save();
}

load(): Promise<{ files: Array<{ path: string; value: any }> }> {
return this.internal.load();
}
}
export type Options = Parameters<typeof Cache>['0'];
export type FileSystemCache = ReturnType<typeof Cache>;

export function createFileSystemCache(options: Options): FileSystemCache {
return new FileSystemCache(options);
return Cache(options);
}
63 changes: 24 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7689,7 +7689,7 @@ __metadata:
chalk: ^4.1.0
core-js: ^3.8.2
express: ^4.17.1
file-system-cache: ^1.0.5
file-system-cache: ^2.0.0
find-up: ^5.0.0
fork-ts-checker-webpack-plugin: ^6.0.4
fs-extra: ^9.0.1
Expand Down Expand Up @@ -14993,7 +14993,7 @@ __metadata:
languageName: node
linkType: hard

"bluebird@npm:^3.1.1, bluebird@npm:^3.3.5, bluebird@npm:^3.4.6, bluebird@npm:^3.5.1, bluebird@npm:^3.5.3, bluebird@npm:^3.5.5, bluebird@npm:^3.7.2":
"bluebird@npm:^3.1.1, bluebird@npm:^3.4.6, bluebird@npm:^3.5.1, bluebird@npm:^3.5.3, bluebird@npm:^3.5.5, bluebird@npm:^3.7.2":
version: 3.7.2
resolution: "bluebird@npm:3.7.2"
checksum: 680de03adc54ff925eaa6c7bb9a47a0690e8b5de60f4792604aae8ed618c65e6b63a7893b57ca924beaf53eee69c5af4f8314148c08124c550fe1df1add897d2
Expand Down Expand Up @@ -23025,14 +23025,13 @@ __metadata:
languageName: node
linkType: hard

"file-system-cache@npm:^1.0.5":
version: 1.0.5
resolution: "file-system-cache@npm:1.0.5"
"file-system-cache@npm:^2.0.0":
version: 2.0.0
resolution: "file-system-cache@npm:2.0.0"
dependencies:
bluebird: ^3.3.5
fs-extra: ^0.30.0
ramda: ^0.21.0
checksum: 4898deb88303c8d54548b857920bea7227535d951ad4ec873c3b26d2b31a03b6ce112df856e9b5fc5993be6dbfb30cb40a3a8feef4054c286c1017f241f9f533
fs-extra: ^10.1.0
ramda: ^0.28.0
checksum: 8ff29a9afa9edd6d0608bd345ea0e22376ff14b6bf11406ebff47877a8081263b7c20eadeb54c7f9b03404ace5743cc61eef9d262734c3b2fdb72ff9b7a468c1
languageName: node
linkType: hard

Expand Down Expand Up @@ -23722,19 +23721,6 @@ __metadata:
languageName: node
linkType: hard

"fs-extra@npm:^0.30.0":
version: 0.30.0
resolution: "fs-extra@npm:0.30.0"
dependencies:
graceful-fs: ^4.1.2
jsonfile: ^2.1.0
klaw: ^1.0.0
path-is-absolute: ^1.0.0
rimraf: ^2.2.8
checksum: 24f3c966018c7bf436bf38ca3a126f1d95bf0f82598302195c4f0c8887767f045dae308f92c53a39cead74631dabbc30fcf1c71dbe96f1f0148f6de8edd114bc
languageName: node
linkType: hard

"fs-extra@npm:^10.0.0, fs-extra@npm:^10.0.1":
version: 10.0.1
resolution: "fs-extra@npm:10.0.1"
Expand All @@ -23746,6 +23732,17 @@ __metadata:
languageName: node
linkType: hard

"fs-extra@npm:^10.1.0":
version: 10.1.0
resolution: "fs-extra@npm:10.1.0"
dependencies:
graceful-fs: ^4.2.0
jsonfile: ^6.0.1
universalify: ^2.0.0
checksum: 5f579466e7109719d162a9249abbeffe7f426eb133ea486e020b89bc6d67a741134076bf439983f2eb79276ceaf6bd7b7c1e43c3fd67fe889863e69072fb0a5e
languageName: node
linkType: hard

"fs-extra@npm:^4.0.2":
version: 4.0.3
resolution: "fs-extra@npm:4.0.3"
Expand Down Expand Up @@ -24717,7 +24714,7 @@ __metadata:
languageName: node
linkType: hard

"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9":
version: 4.2.9
resolution: "graceful-fs@npm:4.2.9"
checksum: 2a66760ce6677ca18a24a1ef15d440cfd970086446af1e78c9e9de083c48122d8bd9c3fdc37f8f80f34aae833fa0d9dd52725e75a1c3f433ddd34eece39e7376
Expand Down Expand Up @@ -29780,18 +29777,6 @@ __metadata:
languageName: node
linkType: hard

"klaw@npm:^1.0.0":
version: 1.3.1
resolution: "klaw@npm:1.3.1"
dependencies:
graceful-fs: ^4.1.9
dependenciesMeta:
graceful-fs:
optional: true
checksum: da994768b02b3843cc994c99bad3cf1c8c67716beb4dd2834133c919e9e9ee788669fbe27d88ab0ad9a3991349c28280afccbde01c2318229b662dd7a05e4728
languageName: node
linkType: hard

"kleur@npm:4.1.4, kleur@npm:^4.0.3":
version: 4.1.4
resolution: "kleur@npm:4.1.4"
Expand Down Expand Up @@ -37865,10 +37850,10 @@ __metadata:
languageName: node
linkType: hard

"ramda@npm:^0.21.0":
version: 0.21.0
resolution: "ramda@npm:0.21.0"
checksum: a5d28ef8f09f7fd024b2a92477f5356e6323c26be29992c87139757e39b20f9006b6a4c69002b952b2ddb88d983823b26ed68020257660617e3a395b7ea2d6da
"ramda@npm:^0.28.0":
version: 0.28.0
resolution: "ramda@npm:0.28.0"
checksum: 0f9dc0cc3b0432ff047f1e2a5e58860c531a84574674c0f52fef535efc6e1e07fa3851102fff3da7dd551a592c743f6f6fa521379a6aa5fe50266f8af8f0b570
languageName: node
linkType: hard

Expand Down

0 comments on commit 3b8b8c3

Please sign in to comment.