metro 0.84.4 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/package.json +17 -17
  2. package/src/Assets.js +3 -1
  3. package/src/Assets.js.flow +31 -25
  4. package/src/Bundler.d.ts +1 -5
  5. package/src/DeltaBundler/DeltaCalculator.d.ts +1 -16
  6. package/src/DeltaBundler/DeltaCalculator.js.flow +1 -1
  7. package/src/DeltaBundler/Graph.d.ts +1 -102
  8. package/src/DeltaBundler/Graph.js.flow +7 -7
  9. package/src/DeltaBundler/Serializers/getAllFiles.js.flow +1 -1
  10. package/src/DeltaBundler/Serializers/getAssets.js.flow +1 -1
  11. package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +3 -2
  12. package/src/DeltaBundler/Serializers/getExplodedSourceMap.js.flow +6 -5
  13. package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +3 -2
  14. package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js.flow +10 -9
  15. package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +3 -3
  16. package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +4 -4
  17. package/src/DeltaBundler/Serializers/sourceMapGenerator.js +2 -2
  18. package/src/DeltaBundler/Serializers/sourceMapGenerator.js.flow +7 -5
  19. package/src/DeltaBundler/Transformer.d.ts +2 -10
  20. package/src/DeltaBundler/Worker.flow.js.flow +1 -1
  21. package/src/DeltaBundler/WorkerFarm.d.ts +2 -47
  22. package/src/DeltaBundler/getTransformCacheKey.js.flow +3 -3
  23. package/src/DeltaBundler/types.js.flow +10 -10
  24. package/src/DeltaBundler.d.ts +1 -5
  25. package/src/HmrServer.d.ts +2 -45
  26. package/src/HmrServer.js.flow +10 -10
  27. package/src/IncrementalBundler.d.ts +1 -9
  28. package/src/IncrementalBundler.js.flow +9 -6
  29. package/src/ModuleGraph/worker/collectDependencies.d.ts +1 -2
  30. package/src/Server/symbolicate.js +66 -33
  31. package/src/Server/symbolicate.js.flow +90 -51
  32. package/src/Server.d.ts +3 -179
  33. package/src/Server.js.flow +25 -23
  34. package/src/index.d.ts +1 -23
  35. package/src/index.flow.js +1 -15
  36. package/src/index.flow.js.flow +0 -20
  37. package/src/lib/BatchProcessor.d.ts +1 -21
  38. package/src/lib/CountingSet.js.flow +1 -1
  39. package/src/lib/JsonReporter.d.ts +1 -2
  40. package/src/lib/JsonReporter.js.flow +4 -2
  41. package/src/lib/RamBundleParser.d.ts +1 -6
  42. package/src/lib/TerminalReporter.d.ts +2 -78
  43. package/src/lib/TerminalReporter.js.flow +1 -1
  44. package/src/lib/bundleToString.js.flow +2 -2
  45. package/src/lib/createWebsocketServer.js.flow +4 -4
  46. package/src/lib/formatBundlingError.js.flow +1 -1
  47. package/src/lib/getPreludeCode.js.flow +5 -5
  48. package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +1 -13
  49. package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +1 -1
  50. package/src/node-haste/DependencyGraph/createFileMap.js +23 -31
  51. package/src/node-haste/DependencyGraph/createFileMap.js.flow +23 -38
  52. package/src/node-haste/DependencyGraph.d.ts +1 -30
  53. package/src/node-haste/DependencyGraph.js.flow +2 -2
  54. package/src/shared/output/RamBundle/util.js.flow +4 -2
  55. package/src/shared/types.js.flow +31 -31
@@ -19,7 +19,7 @@ export type SerializedError = {
19
19
  ...
20
20
  };
21
21
 
22
- export type SerializedEvent<TEvent extends {+[string]: unknown, ...}> =
22
+ export type SerializedEvent<TEvent extends {readonly [string]: unknown, ...}> =
23
23
  TEvent extends {
24
24
  error: Error,
25
25
  ...
@@ -31,7 +31,9 @@ export type SerializedEvent<TEvent extends {+[string]: unknown, ...}> =
31
31
  }
32
32
  : TEvent;
33
33
 
34
- export default class JsonReporter<TEvent extends {+[string]: unknown, ...}> {
34
+ export default class JsonReporter<
35
+ TEvent extends {readonly [string]: unknown, ...},
36
+ > {
35
37
  _stream: Writable;
36
38
 
37
39
  constructor(stream: Writable) {
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @generated SignedSource<<ebddbde1dcdecbbee129fd96caaf3bb0>>
8
+ * @generated SignedSource<<7be940ed3f4c6dffc465780640e301ec>>
9
9
  *
10
10
  * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
11
11
  * Original file: packages/metro/src/lib/RamBundleParser.js
@@ -24,12 +24,7 @@
24
24
  * getModule(): returns the code for the specified module.
25
25
  */
26
26
  declare class RamBundleParser {
27
- _buffer: Buffer;
28
- _numModules: number;
29
- _startupCodeLength: number;
30
- _startOffset: number;
31
27
  constructor(buffer: Buffer);
32
- _readPosition(pos: number): number;
33
28
  getStartupCode(): string;
34
29
  getModule(id: number): string;
35
30
  }
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @noformat
8
8
  * @oncall react_native
9
- * @generated SignedSource<<8218e45d6b5186264c4bf9e54086708a>>
9
+ * @generated SignedSource<<14645ae49e4ed5ce74bdd181db9098d4>>
10
10
  *
11
11
  * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
12
  * Original file: packages/metro/src/lib/TerminalReporter.js
@@ -15,17 +15,9 @@
15
15
  * yarn run build-ts-defs (OSS)
16
16
  */
17
17
 
18
- import type {BundleDetails, ReportableEvent} from './reporting';
18
+ import type {ReportableEvent} from './reporting';
19
19
  import type {Terminal} from 'metro-core';
20
- import type {HealthCheckResult, WatcherStatus} from 'metro-file-map';
21
20
 
22
- type BundleProgress = {
23
- bundleDetails: BundleDetails;
24
- transformedFileCount: number;
25
- totalFileCount: number;
26
- ratio: number;
27
- isPrefetch?: boolean;
28
- };
29
21
  export type TerminalReportableEvent =
30
22
  | ReportableEvent
31
23
  | {
@@ -41,81 +33,13 @@ export type TerminalReportableEvent =
41
33
  }
42
34
  | {type: 'unstable_server_menu_updated'; message: string}
43
35
  | {type: 'unstable_server_menu_cleared'};
44
- type BuildPhase = 'in_progress' | 'done' | 'failed';
45
- interface SnippetError extends Error {
46
- code?: string;
47
- filename?: string;
48
- snippet?: string;
49
- }
50
36
  /**
51
37
  * We try to print useful information to the terminal for interactive builds.
52
38
  * This implements the `Reporter` interface from the './reporting' module.
53
39
  */
54
40
  declare class TerminalReporter {
55
- /**
56
- * The bundle builds for which we are actively maintaining the status on the
57
- * terminal, ie. showing a progress bar. There can be several bundles being
58
- * built at the same time.
59
- */
60
- _activeBundles: Map<string, BundleProgress>;
61
- _interactionStatus: null | undefined | string;
62
- _scheduleUpdateBundleProgress: {
63
- (data: {
64
- buildID: string;
65
- transformedFileCount: number;
66
- totalFileCount: number;
67
- }): void;
68
- cancel(): void;
69
- };
70
- _prevHealthCheckResult: null | undefined | HealthCheckResult;
71
41
  readonly terminal: Terminal;
72
42
  constructor(terminal: Terminal);
73
- /**
74
- * Construct a message that represents the progress of a
75
- * single bundle build, for example:
76
- *
77
- * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)
78
- */
79
- _getBundleStatusMessage(
80
- $$PARAM_0$$: BundleProgress,
81
- phase: BuildPhase,
82
- ): string;
83
- _logBundleBuildDone(buildID: string): void;
84
- _logBundleBuildFailed(buildID: string): void;
85
- _logInitializing(port: number, hasReducedPerformance: boolean): void;
86
- _logInitializingFailed(port: number, error: SnippetError): void;
87
- /**
88
- * This function is only concerned with logging and should not do state
89
- * or terminal status updates.
90
- */
91
- _log(event: TerminalReportableEvent): void;
92
- /**
93
- * We do not want to log the whole stacktrace for bundling error, because
94
- * these are operational errors, not programming errors, and the stacktrace
95
- * is not actionable to end users.
96
- */
97
- _logBundlingError(error: SnippetError): void;
98
- _logWorkerChunk(origin: 'stdout' | 'stderr', chunk: string): void;
99
- _updateBundleProgress($$PARAM_0$$: {
100
- buildID: string;
101
- transformedFileCount: number;
102
- totalFileCount: number;
103
- }): void;
104
- /**
105
- * This function is exclusively concerned with updating the internal state.
106
- * No logging or status updates should be done at this point.
107
- */
108
- _updateState(event: TerminalReportableEvent): void;
109
- /**
110
- * Return a status message that is always consistent with the current state
111
- * of the application. Having this single function ensures we don't have
112
- * different callsites overriding each other status messages.
113
- */
114
- _getStatusMessage(): string;
115
- _logHmrClientError(e: Error): void;
116
- _logWarning(message: string): void;
117
- _logWatcherHealthCheckResult(result: HealthCheckResult): void;
118
- _logWatcherStatus(status: WatcherStatus): void;
119
43
  /**
120
44
  * Single entry point for reporting events. That allows us to implement the
121
45
  * corresponding JSON reporter easily and have a consistent reporting.
@@ -100,7 +100,7 @@ export default class TerminalReporter {
100
100
  };
101
101
  _prevHealthCheckResult: ?HealthCheckResult;
102
102
 
103
- +terminal: Terminal;
103
+ readonly terminal: Terminal;
104
104
 
105
105
  constructor(terminal: Terminal) {
106
106
  this._activeBundles = new Map();
@@ -15,8 +15,8 @@ import type {Bundle, BundleMetadata} from 'metro-runtime/src/modules/types';
15
15
  * Serializes a bundle into a plain JS bundle.
16
16
  */
17
17
  export default function bundleToString(bundle: Bundle): {
18
- +code: string,
19
- +metadata: BundleMetadata,
18
+ readonly code: string,
19
+ readonly metadata: BundleMetadata,
20
20
  } {
21
21
  let code = bundle.pre.length > 0 ? bundle.pre + '\n' : '';
22
22
  const modules = [];
@@ -13,13 +13,13 @@ import {clearInterval, setInterval} from 'timers';
13
13
  import ws from 'ws';
14
14
 
15
15
  type WebsocketServiceInterface<T> = interface {
16
- +onClientConnect: (
16
+ readonly onClientConnect: (
17
17
  url: string,
18
18
  sendFn: (data: string) => void,
19
19
  ) => Promise<?T>,
20
- +onClientDisconnect?: (client: T) => unknown,
21
- +onClientError?: (client: T, e: Error) => unknown,
22
- +onClientMessage?: (
20
+ readonly onClientDisconnect?: (client: T) => unknown,
21
+ readonly onClientError?: (client: T, e: Error) => unknown,
22
+ readonly onClientMessage?: (
23
23
  client: T,
24
24
  message: string | Buffer | ArrayBuffer | Array<Buffer>,
25
25
  sendFn: (data: string) => void,
@@ -22,7 +22,7 @@ import serializeError from 'serialize-error';
22
22
 
23
23
  export type CustomError = Error &
24
24
  interface {
25
- +type?: string,
25
+ readonly type?: string,
26
26
  filename?: string,
27
27
  lineNumber?: number,
28
28
  errors?: Array<{
@@ -16,11 +16,11 @@ export default function getPreludeCode({
16
16
  requireCycleIgnorePatterns,
17
17
  unstable_forceFullRefreshPatterns,
18
18
  }: {
19
- +extraVars?: {[string]: unknown, ...},
20
- +isDev: boolean,
21
- +globalPrefix: string,
22
- +requireCycleIgnorePatterns: ReadonlyArray<RegExp>,
23
- +unstable_forceFullRefreshPatterns: ReadonlyArray<RegExp>,
19
+ readonly extraVars?: {[string]: unknown, ...},
20
+ readonly isDev: boolean,
21
+ readonly globalPrefix: string,
22
+ readonly requireCycleIgnorePatterns: ReadonlyArray<RegExp>,
23
+ readonly unstable_forceFullRefreshPatterns: ReadonlyArray<RegExp>,
24
24
  }): string {
25
25
  const vars = [
26
26
  // Ensure these variable names match the ones referenced in metro-runtime
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @noformat
8
8
  * @oncall react_native
9
- * @generated SignedSource<<0024fd05b95efe19a24f9acc84ff474b>>
9
+ * @generated SignedSource<<2948a6737474a8f5bd55952246f500d3>>
10
10
  *
11
11
  * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
12
  * Original file: packages/metro/src/node-haste/DependencyGraph/ModuleResolution.js
@@ -24,9 +24,7 @@ import type {ResolverInputOptions} from '../../shared/types';
24
24
  import type {
25
25
  CustomResolver,
26
26
  DoesFileExist,
27
- FileCandidates,
28
27
  FileSystemLookup,
29
- Resolution,
30
28
  ResolveAsset,
31
29
  } from 'metro-resolver';
32
30
  import type {PackageForModule, PackageJson} from 'metro-resolver/private/types';
@@ -68,11 +66,7 @@ type Options = Readonly<{
68
66
  unstable_incrementalResolution: boolean;
69
67
  }>;
70
68
  export declare class ModuleResolver {
71
- _options: Options;
72
- _projectRootFakeModulePath: string;
73
- _cachedEmptyModule: null | undefined | BundlerResolution;
74
69
  constructor(options: Options);
75
- _getEmptyModule(): BundlerResolution;
76
70
  resolveDependency(
77
71
  originModulePath: string,
78
72
  dependency: TransformResultDependency,
@@ -80,12 +74,6 @@ export declare class ModuleResolver {
80
74
  platform: string | null,
81
75
  resolverOptions: ResolverInputOptions,
82
76
  ): BundlerResolution;
83
- /**
84
- * TODO: Return Resolution instead of coercing to BundlerResolution here
85
- */
86
- _getFileResolvedModule(resolution: Resolution): BundlerResolution;
87
- _logWarning: (message: string) => void;
88
- _removeRoot(candidates: FileCandidates): FileCandidates;
89
77
  }
90
78
  export declare class UnableToResolveError extends Error {
91
79
  /**
@@ -291,7 +291,7 @@ export class UnableToResolveError extends Error {
291
291
  /**
292
292
  * Fixed type field in common with other Metro build errors.
293
293
  */
294
- +type: 'UnableToResolveError' = 'UnableToResolveError';
294
+ readonly type: 'UnableToResolveError' = 'UnableToResolveError';
295
295
 
296
296
  constructor(
297
297
  originModulePath: string,
@@ -36,36 +36,29 @@ function _interopRequireWildcard(e, t) {
36
36
  function _interopRequireDefault(e) {
37
37
  return e && e.__esModule ? e : { default: e };
38
38
  }
39
- function getIgnorePattern(config) {
40
- const { blockList, blacklistRE } = config.resolver;
41
- const ignorePattern = blacklistRE || blockList;
42
- if (!ignorePattern) {
43
- return / ^/;
39
+ const flattenBlockList = (regexes) => {
40
+ if (!Array.isArray(regexes)) {
41
+ return regexes;
44
42
  }
45
- const combine = (regexes) =>
46
- new RegExp(
47
- regexes
48
- .map((regex, index) => {
49
- if (regex.flags !== regexes[0].flags) {
50
- throw new Error(
51
- "Cannot combine blockList patterns, because they have different flags:\n" +
52
- " - Pattern 0: " +
53
- regexes[0].toString() +
54
- "\n" +
55
- ` - Pattern ${index}: ` +
56
- regexes[index].toString(),
57
- );
58
- }
59
- return "(" + regex.source + ")";
60
- })
61
- .join("|"),
62
- regexes[0]?.flags ?? "",
63
- );
64
- if (Array.isArray(ignorePattern)) {
65
- return combine(ignorePattern);
66
- }
67
- return ignorePattern;
68
- }
43
+ return new RegExp(
44
+ regexes
45
+ .map((regex, index) => {
46
+ if (regex.flags !== regexes[0].flags) {
47
+ throw new Error(
48
+ "Cannot combine blockList patterns, because they have different flags:\n" +
49
+ " - Pattern 0: " +
50
+ regexes[0].toString() +
51
+ "\n" +
52
+ ` - Pattern ${index}: ` +
53
+ regexes[index].toString(),
54
+ );
55
+ }
56
+ return "(" + regex.source + ")";
57
+ })
58
+ .join("|"),
59
+ regexes[0]?.flags ?? "",
60
+ );
61
+ };
69
62
  function createFileMap(config, options) {
70
63
  const watch = options?.watch == null ? !_ciInfo.default.isCI : options.watch;
71
64
  const { enabled: autoSaveEnabled, ...autoSaveOpts } =
@@ -114,9 +107,8 @@ function createFileMap(config, options) {
114
107
  ...config.watcher.additionalExts,
115
108
  ]),
116
109
  ),
117
- forceNodeFilesystemAPI: !config.resolver.useWatchman,
118
110
  healthCheck: config.watcher.healthCheck,
119
- ignorePattern: getIgnorePattern(config),
111
+ ignorePattern: flattenBlockList(config.resolver.blockList),
120
112
  maxWorkers: config.maxWorkers,
121
113
  plugins,
122
114
  retainAllFiles: true,
@@ -19,43 +19,29 @@ import MetroFileMap, {
19
19
  HastePlugin,
20
20
  } from 'metro-file-map';
21
21
 
22
- function getIgnorePattern(config: ConfigT): RegExp {
23
- // For now we support both options
24
- const {blockList, blacklistRE} = config.resolver;
25
- const ignorePattern = blacklistRE || blockList;
26
-
27
- // If neither option has been set, use default pattern
28
- if (!ignorePattern) {
29
- return / ^/;
30
- }
31
-
32
- const combine = (regexes: Array<RegExp>) =>
33
- new RegExp(
34
- regexes
35
- .map((regex, index) => {
36
- if (regex.flags !== regexes[0].flags) {
37
- throw new Error(
38
- 'Cannot combine blockList patterns, because they have different flags:\n' +
39
- ' - Pattern 0: ' +
40
- regexes[0].toString() +
41
- '\n' +
42
- ` - Pattern ${index}: ` +
43
- regexes[index].toString(),
44
- );
45
- }
46
- return '(' + regex.source + ')';
47
- })
48
- .join('|'),
49
- regexes[0]?.flags ?? '',
50
- );
51
-
52
- // If ignorePattern is an array, merge it into one
53
- if (Array.isArray(ignorePattern)) {
54
- return combine(ignorePattern);
22
+ const flattenBlockList = (regexes: ConfigT['resolver']['blockList']) => {
23
+ if (!Array.isArray(regexes)) {
24
+ return regexes;
55
25
  }
56
-
57
- return ignorePattern;
58
- }
26
+ return new RegExp(
27
+ regexes
28
+ .map((regex, index) => {
29
+ if (regex.flags !== regexes[0].flags) {
30
+ throw new Error(
31
+ 'Cannot combine blockList patterns, because they have different flags:\n' +
32
+ ' - Pattern 0: ' +
33
+ regexes[0].toString() +
34
+ '\n' +
35
+ ` - Pattern ${index}: ` +
36
+ regexes[index].toString(),
37
+ );
38
+ }
39
+ return '(' + regex.source + ')';
40
+ })
41
+ .join('|'),
42
+ regexes[0]?.flags ?? '',
43
+ );
44
+ };
59
45
 
60
46
  export default function createFileMap(
61
47
  config: ConfigT,
@@ -125,9 +111,8 @@ export default function createFileMap(
125
111
  ...config.watcher.additionalExts,
126
112
  ]),
127
113
  ),
128
- forceNodeFilesystemAPI: !config.resolver.useWatchman,
129
114
  healthCheck: config.watcher.healthCheck,
130
- ignorePattern: getIgnorePattern(config),
115
+ ignorePattern: flattenBlockList(config.resolver.blockList),
131
116
  maxWorkers: config.maxWorkers,
132
117
  plugins,
133
118
  retainAllFiles: true,
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @noformat
8
8
  * @oncall react_native
9
- * @generated SignedSource<<13f1483d2a732241f8d9eae463399b0e>>
9
+ * @generated SignedSource<<1cc985f3869f7db49aca7daeca848b82>>
10
10
  *
11
11
  * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
12
  * Original file: packages/metro/src/node-haste/DependencyGraph.js
@@ -21,32 +21,10 @@ import type {
21
21
  } from '../DeltaBundler/types';
22
22
  import type {ResolverInputOptions} from '../shared/types';
23
23
  import type {ConfigT} from 'metro-config';
24
- import type {
25
- ChangeEvent,
26
- FileSystem,
27
- HasteMap,
28
- HealthCheckResult,
29
- WatcherStatus,
30
- default as MetroFileMap,
31
- } from 'metro-file-map';
32
24
 
33
- import {ModuleResolver} from './DependencyGraph/ModuleResolution';
34
25
  import EventEmitter from 'events';
35
26
 
36
27
  declare class DependencyGraph extends EventEmitter {
37
- _config: ConfigT;
38
- _haste: MetroFileMap;
39
- _fileSystem: FileSystem;
40
- _hasteMap: HasteMap;
41
- _moduleResolver: ModuleResolver;
42
- _resolutionCache: Map<
43
- string | symbol,
44
- Map<
45
- string | symbol,
46
- Map<string | symbol, Map<string | symbol, BundlerResolution>>
47
- >
48
- >;
49
- _initializedPromise: Promise<void>;
50
28
  constructor(
51
29
  config: ConfigT,
52
30
  options?: {
@@ -54,14 +32,7 @@ declare class DependencyGraph extends EventEmitter {
54
32
  readonly watch?: boolean;
55
33
  },
56
34
  );
57
- _onWatcherHealthCheck(result: HealthCheckResult): void;
58
- _onWatcherStatus(status: WatcherStatus): void;
59
35
  ready(): Promise<void>;
60
- _onHasteChange($$PARAM_0$$: ChangeEvent): void;
61
- _createModuleResolver(): void;
62
- _getClosestPackage(
63
- absoluteModulePath: string,
64
- ): null | undefined | {packageJsonPath: string; packageRelativePath: string};
65
36
  getAllFiles(): Array<string>;
66
37
  /**
67
38
  * Used when watcher.unstable_lazySha1 is true
@@ -88,8 +88,8 @@ export default class DependencyGraph extends EventEmitter {
88
88
  constructor(
89
89
  config: ConfigT,
90
90
  options?: {
91
- +hasReducedPerformance?: boolean,
92
- +watch?: boolean,
91
+ readonly hasReducedPerformance?: boolean,
92
+ readonly watch?: boolean,
93
93
  },
94
94
  ) {
95
95
  super();
@@ -135,8 +135,10 @@ function combineMaps(
135
135
  return sections;
136
136
  }
137
137
 
138
- const joinModules = (modules: ReadonlyArray<{+code: string, ...}>): string =>
139
- modules.map((m: {+code: string, ...}) => m.code).join('\n');
138
+ const joinModules = (
139
+ modules: ReadonlyArray<{readonly code: string, ...}>,
140
+ ): string =>
141
+ modules.map((m: {readonly code: string, ...}) => m.code).join('\n');
140
142
 
141
143
  export {
142
144
  combineSourceMaps,
@@ -47,24 +47,24 @@ export type ReadonlySourceLocation = Readonly<{
47
47
  }>;
48
48
 
49
49
  export type BundleOptions = {
50
- +customResolverOptions: CustomResolverOptions,
50
+ readonly customResolverOptions: CustomResolverOptions,
51
51
  customTransformOptions: CustomTransformOptions,
52
52
  dev: boolean,
53
53
  entryFile: string,
54
- +excludeSource: boolean,
55
- +inlineSourceMap: boolean,
56
- +lazy: boolean,
54
+ readonly excludeSource: boolean,
55
+ readonly inlineSourceMap: boolean,
56
+ readonly lazy: boolean,
57
57
  minify: boolean,
58
- +modulesOnly: boolean,
58
+ readonly modulesOnly: boolean,
59
59
  onProgress: ?(doneCont: number, totalCount: number) => unknown,
60
- +platform: ?string,
61
- +runModule: boolean,
62
- +shallow: boolean,
60
+ readonly platform: ?string,
61
+ readonly runModule: boolean,
62
+ readonly shallow: boolean,
63
63
  sourceMapUrl: ?string,
64
64
  sourceUrl: ?string,
65
65
  createModuleIdFactory?: () => (path: string) => number,
66
- +unstable_transformProfile: TransformProfile,
67
- +sourcePaths: SourcePathsMode,
66
+ readonly unstable_transformProfile: TransformProfile,
67
+ readonly sourcePaths: SourcePathsMode,
68
68
  };
69
69
 
70
70
  export type BuildOptions = Readonly<{
@@ -77,18 +77,18 @@ export type ResolverInputOptions = Readonly<{
77
77
  }>;
78
78
 
79
79
  export type SerializerOptions = {
80
- +sourceMapUrl: ?string,
81
- +sourceUrl: ?string,
82
- +runModule: boolean,
83
- +excludeSource: boolean,
84
- +inlineSourceMap: boolean,
85
- +modulesOnly: boolean,
86
- +sourcePaths: SourcePathsMode,
80
+ readonly sourceMapUrl: ?string,
81
+ readonly sourceUrl: ?string,
82
+ readonly runModule: boolean,
83
+ readonly excludeSource: boolean,
84
+ readonly inlineSourceMap: boolean,
85
+ readonly modulesOnly: boolean,
86
+ readonly sourcePaths: SourcePathsMode,
87
87
  };
88
88
 
89
89
  export type GraphOptions = {
90
- +lazy: boolean,
91
- +shallow: boolean,
90
+ readonly lazy: boolean,
91
+ readonly shallow: boolean,
92
92
  };
93
93
 
94
94
  // Stricter representation of BundleOptions.
@@ -108,24 +108,24 @@ export type ModuleGroups = {
108
108
  };
109
109
 
110
110
  export type ModuleTransportLike = {
111
- +code: string,
112
- +id: number,
113
- +map: ?MetroSourceMapOrMappings,
114
- +name?: string,
115
- +sourcePath: string,
111
+ readonly code: string,
112
+ readonly id: number,
113
+ readonly map: ?MetroSourceMapOrMappings,
114
+ readonly name?: string,
115
+ readonly sourcePath: string,
116
116
  ...
117
117
  };
118
118
  export type ModuleTransportLikeStrict = {
119
- +code: string,
120
- +id: number,
121
- +map: ?MetroSourceMapOrMappings,
122
- +name?: string,
123
- +sourcePath: string,
119
+ readonly code: string,
120
+ readonly id: number,
121
+ readonly map: ?MetroSourceMapOrMappings,
122
+ readonly name?: string,
123
+ readonly sourcePath: string,
124
124
  };
125
125
  export type RamModuleTransport = {
126
126
  ...ModuleTransportLikeStrict,
127
- +source: string,
128
- +type: string,
127
+ readonly source: string,
128
+ readonly type: string,
129
129
  };
130
130
 
131
131
  export type OutputOptions = {