Skip to content

Commit 3430036

Browse files
robhoganfacebook-github-bot
authored andcommitted
Breaking: use named export in metro-cache-key
Summary: Switch `metro-cache-key` from a function-typed `module.exports` to a named `getCacheKey` export. This will help convert the module to ESM syntax with generated TS types without any issues with `default` export interop. It's also more IDE-friendly. Changelog: ``` - **[Breaking]**: metro-cache-key: Use a named `getCacheKey` export in place of default function export ``` Reviewed By: vzaidman Differential Revision: D78157825 fbshipit-source-id: 30f12fc905d4cb46dce20898ef8246377b30661b
1 parent 69bde93 commit 3430036

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/metro-cache-key/src/__tests__/index-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
jest.mock('fs', () => new (require('metro-memory-fs'))());
1515

16-
const getCacheKey = require('../index');
16+
const {getCacheKey} = require('../index');
1717
const fs = require('fs');
1818

1919
beforeAll(() => {

packages/metro-cache-key/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ function getCacheKey(files: Array<string>): string {
2323
.digest('hex');
2424
}
2525

26-
module.exports = getCacheKey;
26+
module.exports = {getCacheKey};

packages/metro-transform-worker/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const generate = require('@babel/generator').default;
4141
const babylon = require('@babel/parser');
4242
const types = require('@babel/types');
4343
const {stableHash} = require('metro-cache');
44-
const getCacheKey = require('metro-cache-key');
44+
const {getCacheKey} = require('metro-cache-key');
4545
const {
4646
fromRawMappings,
4747
functionMapBabelPlugin,

packages/metro/src/DeltaBundler/getTransformCacheKey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {JsTransformerConfig} from 'metro-transform-worker';
1616

1717
const VERSION = require('../../package.json').version;
1818
const crypto = require('crypto');
19-
const getCacheKey = require('metro-cache-key');
19+
const {getCacheKey} = require('metro-cache-key');
2020

2121
type CacheKeyProvider = {
2222
getCacheKey?: JsTransformerConfig => string,

0 commit comments

Comments
 (0)