mirror of
https://github.com/status-im/metro.git
synced 2025-01-22 00:50:52 +00:00
Updates from Wed Mar 4
- [ReactNative] modernize DatePicker | Spencer Ahrens - React Native: Force !ExecutionEnvironment.canUseDOM | Tim Yung - [react-packager] Recover and warn from corrupted cache file | Amjad Masad - [ReactNative] Github repo's gitignore is written at export | Amjad Masad - [ReactNative] Use strings instead of constants for keyboardDismissMode | Christopher Chedeau
This commit is contained in:
parent
f76e0b593d
commit
164c3ea712
16
react-packager/src/JSTransformer/Cache.js
vendored
16
react-packager/src/JSTransformer/Cache.js
vendored
@ -112,13 +112,23 @@ Cache.prototype._persistCache = function() {
|
|||||||
return this._persisting;
|
return this._persisting;
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadCacheSync(cacheFilepath) {
|
function loadCacheSync(cachePath) {
|
||||||
var ret = Object.create(null);
|
var ret = Object.create(null);
|
||||||
if (!fs.existsSync(cacheFilepath)) {
|
if (!fs.existsSync(cachePath)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cacheOnDisk = JSON.parse(fs.readFileSync(cacheFilepath));
|
var cacheOnDisk;
|
||||||
|
try {
|
||||||
|
cacheOnDisk = JSON.parse(fs.readFileSync(cachePath));
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
console.warn('Unable to parse cache file. Will clear and continue.');
|
||||||
|
fs.unlinkSync(cachePath);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter outdated cache and convert to promises.
|
// Filter outdated cache and convert to promises.
|
||||||
Object.keys(cacheOnDisk).forEach(function(key) {
|
Object.keys(cacheOnDisk).forEach(function(key) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user