File tree Expand file tree Collapse file tree 16 files changed +352
-4
lines changed
packages/metro-cache/types Expand file tree Collapse file tree 16 files changed +352
-4
lines changed Original file line number Diff line number Diff line change 57
57
- checkout
58
58
- yarn_install
59
59
- run : yarn typecheck
60
+ - run : yarn typecheck-ts
60
61
- run : yarn lint
61
62
- run : yarn test-smoke
62
63
Original file line number Diff line number Diff line change 7
7
examples /react-native
8
8
flow-typed /**
9
9
packages /* /build /**
10
- types /**
11
10
website /
12
11
** /third-party /**
Original file line number Diff line number Diff line change 10
10
11
11
'use strict' ;
12
12
13
- /** @type {import('eslint').Linter.Config } */
14
13
module . exports = {
15
14
extends : './scripts/eslint/base' ,
16
15
overrides : [
@@ -21,6 +20,10 @@ module.exports = {
21
20
'lint/flow-function-shape' : 'off' ,
22
21
} ,
23
22
} ,
23
+ {
24
+ files : [ 'packages/*/types/**/*.d.ts' ] ,
25
+ extends : './scripts/eslint/typescript' ,
26
+ } ,
24
27
{
25
28
files : [ 'packages/metro-source-map/**/*.js' ] ,
26
29
rules : {
Original file line number Diff line number Diff line change 5
5
"@babel/plugin-syntax-class-properties" : " ^7.0.0" ,
6
6
"@babel/plugin-transform-flow-strip-types" : " ^7.0.0" ,
7
7
"@babel/plugin-transform-modules-commonjs" : " ^7.0.0" ,
8
+ "@tsconfig/node16" : " 1.0.1" ,
9
+ "@typescript-eslint/eslint-plugin" : " ^5.30.5" ,
10
+ "@typescript-eslint/parser" : " ^5.30.5" ,
8
11
"acorn" : " ^8.7.1" ,
9
12
"babel-jest" : " ^29.2.1" ,
10
13
"chalk" : " ^4.0.0" ,
34
37
"micromatch" : " ^4.0.4" ,
35
38
"prettier" : " 2.7.1" ,
36
39
"progress" : " ^2.0.0" ,
37
- "promise" : " ^8.3.0"
40
+ "promise" : " ^8.3.0" ,
41
+ "typescript" : " 4.1.3"
38
42
},
39
43
"scripts" : {
40
44
"build-clean" : " rm -rf ./packages/*/build" ,
46
50
"postpublish" : " yarn workspaces run cleanup-release" ,
47
51
"publish" : " yarn run build-clean && yarn run build && yarn workspaces run prepare-release && npm publish --workspaces" ,
48
52
"start" : " node packages/metro/src/cli" ,
53
+ "test" : " yarn run typecheck && yarn run lint && yarn run build && yarn run jest" ,
49
54
"test-coverage" : " yarn run build && yarn run jest --coverage -i && node scripts/mapCoverage.js" ,
50
55
"test-smoke" : " yarn start build --config packages/metro/src/integration_tests/metro.config.js TestBundle.js --out /tmp/TestBundle" ,
51
- "test" : " yarn run typecheck && yarn run lint && yarn run build && yarn run jest" ,
52
56
"typecheck" : " flow check" ,
57
+ "typecheck-ts" : " tsc --project tsconfig.json" ,
53
58
"update-version" : " node ./scripts/updateVersion"
54
59
},
55
60
"workspaces" : [
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ import { CacheStore } from './types' ;
12
+
13
+ /**
14
+ * Main cache class. Receives an array of cache instances, and sequentially
15
+ * traverses them to return a previously stored value. It also ensures setting
16
+ * the value in all instances.
17
+ *
18
+ * All get/set operations are logged via Metro's logger.
19
+ */
20
+ export default class Cache < T > {
21
+ constructor ( stores : ReadonlyArray < CacheStore < T > > ) ;
22
+ get ( key : Buffer ) : Promise < T | null > ;
23
+ set ( key : Buffer , value : T ) : void ;
24
+ get isDisabled ( ) : boolean ;
25
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ // <reference types="node" />
12
+
13
+ import AutoCleanFileStore from './stores/AutoCleanFileStore' ;
14
+ import FileStore from './stores/FileStore' ;
15
+ import HttpGetStore from './stores/HttpGetStore' ;
16
+ import HttpStore from './stores/HttpStore' ;
17
+ import Cache from './Cache' ;
18
+ import stableHash from './stableHash' ;
19
+
20
+ export type { Options as FileOptions } from './stores/FileStore' ;
21
+ export type { Options as HttpOptions } from './stores/HttpStore' ;
22
+ export type { CacheStore } from './types' ;
23
+
24
+ export interface MetroCache {
25
+ AutoCleanFileStore : typeof AutoCleanFileStore ;
26
+ Cache : typeof Cache ;
27
+ FileStore : typeof FileStore ;
28
+ HttpGetStore : typeof HttpGetStore ;
29
+ HttpStore : typeof HttpStore ;
30
+ stableHash : typeof stableHash ;
31
+ }
32
+
33
+ export {
34
+ AutoCleanFileStore ,
35
+ Cache ,
36
+ FileStore ,
37
+ HttpGetStore ,
38
+ HttpStore ,
39
+ stableHash ,
40
+ } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ export default function stableHash ( value : unknown ) : Buffer ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ import type FileStore from './FileStore' ;
12
+
13
+ export default class AutoCleanFileStore < T > extends FileStore < T > { }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ export interface Options {
12
+ root : string ;
13
+ }
14
+
15
+ export default class FileStore < T > {
16
+ constructor ( options : Options ) ;
17
+ get ( key : Buffer ) : Promise < T | null > ;
18
+ set ( key : Buffer , value : T ) : Promise < void > ;
19
+ clear ( ) : void ;
20
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall react_native
9
+ */
10
+
11
+ import type { Options } from './HttpStore' ;
12
+
13
+ export default class HttpGetStore < T > {
14
+ constructor ( options : Options ) ;
15
+ get ( key : Buffer ) : Promise < T | null > ;
16
+ set ( key : Buffer , value : T ) : Promise < void > ;
17
+ clear ( ) : void ;
18
+ }
You can’t perform that action at this time.
0 commit comments