mirror of
https://github.com/status-im/metro.git
synced 2025-02-05 15:53:58 +00:00
Tweaks to experimental caches
Reviewed By: jeanlauliac Differential Revision: D7123128 fbshipit-source-id: 2f838d66c51ef5faef261a6ad474cefd9ac7e8ad
This commit is contained in:
parent
3bd7ef1d74
commit
b7e3e046cd
@ -13,7 +13,6 @@
|
||||
const fs = require('fs');
|
||||
const mkdirp = require('mkdirp');
|
||||
const path = require('path');
|
||||
const serializer = require('jest-serializer');
|
||||
|
||||
import type {TransformedCode} from 'metro/src/JSTransformer/worker';
|
||||
|
||||
@ -36,7 +35,7 @@ class FileStore {
|
||||
|
||||
get(key: Buffer): ?TransformedCode {
|
||||
try {
|
||||
return serializer.readFileSync(this._getFilePath(key));
|
||||
return JSON.parse(fs.readFileSync(this._getFilePath(key), 'utf-8'));
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return null;
|
||||
@ -47,7 +46,7 @@ class FileStore {
|
||||
}
|
||||
|
||||
set(key: Buffer, value: TransformedCode): void {
|
||||
fs.writeFileSync(this._getFilePath(key), serializer.serialize(value));
|
||||
fs.writeFileSync(this._getFilePath(key), JSON.stringify(value));
|
||||
}
|
||||
|
||||
_getFilePath(key: Buffer): string {
|
||||
|
@ -161,6 +161,7 @@ class ModuleCache {
|
||||
/* $FlowFixMe: there are missing arguments. */
|
||||
return new Polyfill({
|
||||
depGraphHelpers: this._depGraphHelpers,
|
||||
experimentalCaches: this._experimentalCaches,
|
||||
file,
|
||||
getTransformCacheKey: this._getTransformCacheKey,
|
||||
localPath: toLocalPath(this._roots, file),
|
||||
|
Loading…
x
Reference in New Issue
Block a user