metro 0.74.0 → 0.74.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro",
3
- "version": "0.74.0",
3
+ "version": "0.74.1",
4
4
  "description": "🚇 The JavaScript bundler for React Native.",
5
5
  "main": "src/index.js",
6
6
  "bin": "src/cli.js",
@@ -35,23 +35,23 @@
35
35
  "invariant": "^2.2.4",
36
36
  "jest-worker": "^27.2.0",
37
37
  "lodash.throttle": "^4.1.1",
38
- "metro-babel-transformer": "0.74.0",
39
- "metro-cache": "0.74.0",
40
- "metro-cache-key": "0.74.0",
41
- "metro-config": "0.74.0",
42
- "metro-core": "0.74.0",
43
- "metro-file-map": "0.74.0",
44
- "metro-hermes-compiler": "0.74.0",
45
- "metro-inspector-proxy": "0.74.0",
46
- "metro-minify-terser": "0.74.0",
47
- "metro-minify-uglify": "0.74.0",
48
- "metro-react-native-babel-preset": "0.74.0",
49
- "metro-resolver": "0.74.0",
50
- "metro-runtime": "0.74.0",
51
- "metro-source-map": "0.74.0",
52
- "metro-symbolicate": "0.74.0",
53
- "metro-transform-plugins": "0.74.0",
54
- "metro-transform-worker": "0.74.0",
38
+ "metro-babel-transformer": "0.74.1",
39
+ "metro-cache": "0.74.1",
40
+ "metro-cache-key": "0.74.1",
41
+ "metro-config": "0.74.1",
42
+ "metro-core": "0.74.1",
43
+ "metro-file-map": "0.74.1",
44
+ "metro-hermes-compiler": "0.74.1",
45
+ "metro-inspector-proxy": "0.74.1",
46
+ "metro-minify-terser": "0.74.1",
47
+ "metro-minify-uglify": "0.74.1",
48
+ "metro-react-native-babel-preset": "0.74.1",
49
+ "metro-resolver": "0.74.1",
50
+ "metro-runtime": "0.74.1",
51
+ "metro-source-map": "0.74.1",
52
+ "metro-symbolicate": "0.74.1",
53
+ "metro-transform-plugins": "0.74.1",
54
+ "metro-transform-worker": "0.74.1",
55
55
  "mime-types": "^2.1.27",
56
56
  "node-fetch": "^2.2.0",
57
57
  "nullthrows": "^1.1.1",
@@ -70,10 +70,10 @@
70
70
  "dedent": "^0.7.0",
71
71
  "jest-snapshot": "^26.5.2",
72
72
  "jest-snapshot-serializer-raw": "^1.2.0",
73
- "metro-babel-register": "0.74.0",
74
- "metro-memory-fs": "0.74.0",
75
- "metro-react-native-babel-preset": "0.74.0",
76
- "metro-react-native-babel-transformer": "0.74.0",
73
+ "metro-babel-register": "0.74.1",
74
+ "metro-memory-fs": "0.74.1",
75
+ "metro-react-native-babel-preset": "0.74.1",
76
+ "metro-react-native-babel-transformer": "0.74.1",
77
77
  "mock-req": "^0.2.0",
78
78
  "mock-res": "^0.6.0",
79
79
  "stack-trace": "^0.0.10"
@@ -12,6 +12,7 @@
12
12
  "use strict";
13
13
 
14
14
  var _Graph = require("./Graph");
15
+ const debug = require("debug")("Metro:DeltaCalculator");
15
16
  const { EventEmitter } = require("events");
16
17
 
17
18
  /**
@@ -145,7 +146,8 @@ class DeltaCalculator extends EventEmitter {
145
146
  * the listener only stores the modified file, which will then be used later
146
147
  * when the delta needs to be calculated.
147
148
  */
148
- _handleFileChange = ({ type, filePath }, logger) => {
149
+ _handleFileChange = ({ type, filePath, metadata }, logger) => {
150
+ debug("Handling %s: %s (type: %s)", type, filePath, metadata.type);
149
151
  let state;
150
152
  if (this._deletedFiles.has(filePath)) {
151
153
  state = "deleted";
@@ -14,7 +14,9 @@
14
14
  import {Graph} from './Graph';
15
15
  import type {DeltaResult, Options} from './types.flow';
16
16
  import type {RootPerfLogger} from 'metro-config';
17
+ import type {ChangeEventMetadata} from 'metro-file-map';
17
18
 
19
+ const debug = require('debug')('Metro:DeltaCalculator');
18
20
  const {EventEmitter} = require('events');
19
21
 
20
22
  /**
@@ -178,13 +180,16 @@ class DeltaCalculator<T> extends EventEmitter {
178
180
  {
179
181
  type,
180
182
  filePath,
183
+ metadata,
181
184
  }: {
182
185
  type: string,
183
186
  filePath: string,
187
+ metadata: ChangeEventMetadata,
184
188
  ...
185
189
  },
186
190
  logger: ?RootPerfLogger,
187
191
  ): mixed => {
192
+ debug('Handling %s: %s (type: %s)', type, filePath, metadata.type);
188
193
  let state: void | 'deleted' | 'modified' | 'added';
189
194
  if (this._deletedFiles.has(filePath)) {
190
195
  state = 'deleted';
@@ -429,7 +429,7 @@ class Graph {
429
429
  } else {
430
430
  try {
431
431
  resolvedDep = {
432
- absolutePath: options.resolve(parentPath, dep.name),
432
+ absolutePath: options.resolve(parentPath, dep.name).filePath,
433
433
  data: dep,
434
434
  };
435
435
 
@@ -503,7 +503,7 @@ export class Graph<T = MixedOutput> {
503
503
  } else {
504
504
  try {
505
505
  resolvedDep = {
506
- absolutePath: options.resolve(parentPath, dep.name),
506
+ absolutePath: options.resolve(parentPath, dep.name).filePath,
507
507
  data: dep,
508
508
  };
509
509
 
@@ -126,8 +126,13 @@ export type AllowOptionalDependencies =
126
126
  | boolean
127
127
  | AllowOptionalDependenciesWithOptions;
128
128
 
129
+ export type BundlerResolution = $ReadOnly<{
130
+ type: 'sourceFile',
131
+ filePath: string,
132
+ }>;
133
+
129
134
  export type Options<T = MixedOutput> = {
130
- +resolve: (from: string, to: string) => string,
135
+ +resolve: (from: string, to: string) => BundlerResolution,
131
136
  +transform: TransformFn<T>,
132
137
  +transformOptions: TransformInputOptions,
133
138
  +onProgress: ?(numProcessed: number, total: number) => mixed,
package/src/HmrServer.js CHANGED
@@ -82,7 +82,7 @@ class HmrServer {
82
82
  ? _this$_config$server$
83
83
  : this._config.projectRoot) + "/.",
84
84
  entryFile
85
- );
85
+ ).filePath;
86
86
  const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
87
87
  resolverOptions,
88
88
  shallow: graphOptions.shallow,
@@ -124,7 +124,7 @@ class HmrServer<TClient: Client> {
124
124
  (this._config.server.unstable_serverRoot ?? this._config.projectRoot) +
125
125
  '/.',
126
126
  entryFile,
127
- );
127
+ ).filePath;
128
128
  const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
129
129
  resolverOptions,
130
130
  shallow: graphOptions.shallow,
package/src/Server.js CHANGED
@@ -1162,7 +1162,7 @@ class Server {
1162
1162
  relativeTo === "server"
1163
1163
  ? this._getServerRootDir()
1164
1164
  : this._config.projectRoot;
1165
- return resolutionFn(`${rootDir}/.`, filePath);
1165
+ return resolutionFn(`${rootDir}/.`, filePath).filePath;
1166
1166
  }
1167
1167
  getNewBuildNumber() {
1168
1168
  return this._nextBundleBuildNumber++;
@@ -1364,7 +1364,7 @@ class Server {
1364
1364
  relativeTo === 'server'
1365
1365
  ? this._getServerRootDir()
1366
1366
  : this._config.projectRoot;
1367
- return resolutionFn(`${rootDir}/.`, filePath);
1367
+ return resolutionFn(`${rootDir}/.`, filePath).filePath;
1368
1368
  }
1369
1369
 
1370
1370
  getNewBuildNumber(): number {
@@ -59,18 +59,21 @@ function formatBundlingError(error) {
59
59
  } else if (error instanceof ResourceNotFoundError) {
60
60
  return {
61
61
  type: "ResourceNotFoundError",
62
+ // $FlowFixMe[missing-empty-array-annot]
62
63
  errors: [],
63
64
  message: error.message,
64
65
  };
65
66
  } else if (error instanceof GraphNotFoundError) {
66
67
  return {
67
68
  type: "GraphNotFoundError",
69
+ // $FlowFixMe[missing-empty-array-annot]
68
70
  errors: [],
69
71
  message: error.message,
70
72
  };
71
73
  } else if (error instanceof RevisionNotFoundError) {
72
74
  return {
73
75
  type: "RevisionNotFoundError",
76
+ // $FlowFixMe[missing-empty-array-annot]
74
77
  errors: [],
75
78
  message: error.message,
76
79
  };
@@ -74,18 +74,21 @@ function formatBundlingError(error: CustomError): FormattedError {
74
74
  } else if (error instanceof ResourceNotFoundError) {
75
75
  return {
76
76
  type: 'ResourceNotFoundError',
77
+ // $FlowFixMe[missing-empty-array-annot]
77
78
  errors: [],
78
79
  message: error.message,
79
80
  };
80
81
  } else if (error instanceof GraphNotFoundError) {
81
82
  return {
82
83
  type: 'GraphNotFoundError',
84
+ // $FlowFixMe[missing-empty-array-annot]
83
85
  errors: [],
84
86
  message: error.message,
85
87
  };
86
88
  } else if (error instanceof RevisionNotFoundError) {
87
89
  return {
88
90
  type: 'RevisionNotFoundError',
91
+ // $FlowFixMe[missing-empty-array-annot]
89
92
  errors: [],
90
93
  message: error.message,
91
94
  };
@@ -39,6 +39,7 @@ function getAppendScripts(entryPoint, modules, options) {
39
39
  data: {
40
40
  code,
41
41
  lineCount: countLines(code),
42
+ // $FlowFixMe[missing-empty-array-annot]
42
43
  map: [],
43
44
  },
44
45
  },
@@ -68,6 +69,7 @@ function getAppendScripts(entryPoint, modules, options) {
68
69
  data: {
69
70
  code,
70
71
  lineCount: countLines(code),
72
+ // $FlowFixMe[missing-empty-array-annot]
71
73
  map: [],
72
74
  },
73
75
  },
@@ -87,6 +89,7 @@ function getAppendScripts(entryPoint, modules, options) {
87
89
  data: {
88
90
  code,
89
91
  lineCount: countLines(code),
92
+ // $FlowFixMe[missing-empty-array-annot]
90
93
  map: [],
91
94
  },
92
95
  },
@@ -58,6 +58,7 @@ function getAppendScripts<T: number | string>(
58
58
  data: {
59
59
  code,
60
60
  lineCount: countLines(code),
61
+ // $FlowFixMe[missing-empty-array-annot]
61
62
  map: [],
62
63
  },
63
64
  },
@@ -89,6 +90,7 @@ function getAppendScripts<T: number | string>(
89
90
  data: {
90
91
  code,
91
92
  lineCount: countLines(code),
93
+ // $FlowFixMe[missing-empty-array-annot]
92
94
  map: [],
93
95
  },
94
96
  },
@@ -109,6 +111,7 @@ function getAppendScripts<T: number | string>(
109
111
  data: {
110
112
  code,
111
113
  lineCount: countLines(code),
114
+ // $FlowFixMe[missing-empty-array-annot]
112
115
  map: [],
113
116
  },
114
117
  },
@@ -90,6 +90,7 @@ function _getPrelude({ dev, globalPrefix, requireCycleIgnorePatterns }) {
90
90
  data: {
91
91
  code,
92
92
  lineCount: countLines(code),
93
+ // $FlowFixMe[missing-empty-array-annot]
93
94
  map: [],
94
95
  },
95
96
  },
@@ -113,6 +113,7 @@ function _getPrelude({
113
113
  data: {
114
114
  code,
115
115
  lineCount: countLines(code),
116
+ // $FlowFixMe[missing-empty-array-annot]
116
117
  map: [],
117
118
  },
118
119
  },
@@ -13,7 +13,10 @@
13
13
 
14
14
  import type Bundler from '../Bundler';
15
15
  import type DeltaBundler, {TransformFn} from '../DeltaBundler';
16
- import type {TransformInputOptions} from '../DeltaBundler/types.flow';
16
+ import type {
17
+ BundlerResolution,
18
+ TransformInputOptions,
19
+ } from '../DeltaBundler/types.flow';
17
20
  import type {TransformOptions} from '../DeltaBundler/Worker';
18
21
  import type {ConfigT} from 'metro-config/src/configTypes.flow';
19
22
  import type {Type} from 'metro-transform-worker';
@@ -203,7 +206,7 @@ async function getResolveDependencyFn(
203
206
  bundler: Bundler,
204
207
  platform: ?string,
205
208
  resolverOptions: ResolverInputOptions,
206
- ): Promise<(from: string, to: string) => string> {
209
+ ): Promise<(from: string, to: string) => BundlerResolution> {
207
210
  const dependencyGraph = await await bundler.getDependencyGraph();
208
211
 
209
212
  return (from: string, to: string) =>
@@ -126,6 +126,8 @@ class ModuleResolver {
126
126
  resolveHastePackage: (name) =>
127
127
  this._options.getHastePackagePath(name, platform),
128
128
  getPackageMainPath: this._getPackageMainPath,
129
+ unstable_enablePackageExports:
130
+ this._options.unstable_enablePackageExports,
129
131
  },
130
132
  moduleName,
131
133
  platform
@@ -180,21 +182,22 @@ class ModuleResolver {
180
182
  };
181
183
 
182
184
  /**
183
- * FIXME: get rid of this function and of the reliance on `TModule`
184
- * altogether, return strongly typed resolutions at the top-level instead.
185
+ * TODO: Return Resolution instead of coercing to BundlerResolution here
185
186
  */
186
187
  _getFileResolvedModule(resolution) {
187
188
  switch (resolution.type) {
188
189
  case "sourceFile":
189
- return this._options.moduleCache.getModule(resolution.filePath);
190
+ return resolution;
190
191
  case "assetFiles":
191
192
  // FIXME: we should forward ALL the paths/metadata,
192
193
  // not just an arbitrary item!
193
194
  const arbitrary = getArrayLowestItem(resolution.filePaths);
194
195
  invariant(arbitrary != null, "invalid asset resolution");
195
- return this._options.moduleCache.getModule(arbitrary);
196
+ return {
197
+ type: "sourceFile",
198
+ filePath: arbitrary,
199
+ };
196
200
  case "empty":
197
- // $FlowFixMe[incompatible-return]
198
201
  return this._getEmptyModule();
199
202
  default:
200
203
  resolution.type;
@@ -27,6 +27,7 @@ const Resolver = require('metro-resolver');
27
27
  const path = require('path');
28
28
  const util = require('util');
29
29
  import type {ResolverInputOptions} from '../../shared/types.flow';
30
+ import type {BundlerResolution} from '../../DeltaBundler/types.flow';
30
31
 
31
32
  export type DirExistsFn = (filePath: string) => boolean;
32
33
 
@@ -44,17 +45,16 @@ export type Moduleish = interface {
44
45
  getPackage(): ?Packageish,
45
46
  };
46
47
 
47
- export type ModuleishCache<TModule, TPackage> = interface {
48
+ export type ModuleishCache<TPackage> = interface {
48
49
  getPackage(
49
50
  name: string,
50
51
  platform?: string,
51
52
  supportsNativePlatform?: boolean,
52
53
  ): TPackage,
53
- getModule(path: string): TModule,
54
54
  getPackageOf(modulePath: string): ?TPackage,
55
55
  };
56
56
 
57
- type Options<TModule, TPackage> = $ReadOnly<{
57
+ type Options<TPackage> = $ReadOnly<{
58
58
  dirExists: DirExistsFn,
59
59
  disableHierarchicalLookup: boolean,
60
60
  doesFileExist: DoesFileExist,
@@ -64,24 +64,29 @@ type Options<TModule, TPackage> = $ReadOnly<{
64
64
  getHastePackagePath: (name: string, platform: ?string) => ?string,
65
65
  isAssetFile: IsAssetFile,
66
66
  mainFields: $ReadOnlyArray<string>,
67
- moduleCache: ModuleishCache<TModule, TPackage>,
67
+ moduleCache: ModuleishCache<TPackage>,
68
68
  nodeModulesPaths: $ReadOnlyArray<string>,
69
69
  preferNativePlatform: boolean,
70
70
  projectRoot: string,
71
71
  resolveAsset: ResolveAsset,
72
72
  resolveRequest: ?CustomResolver,
73
73
  sourceExts: $ReadOnlyArray<string>,
74
+ unstable_conditionNames: $ReadOnlyArray<string>,
75
+ unstable_conditionsByPlatform: $ReadOnly<{
76
+ [platform: string]: $ReadOnlyArray<string>,
77
+ }>,
78
+ unstable_enablePackageExports: boolean,
74
79
  }>;
75
80
 
76
- class ModuleResolver<TModule: Moduleish, TPackage: Packageish> {
77
- _options: Options<TModule, TPackage>;
81
+ class ModuleResolver<TPackage: Packageish> {
82
+ _options: Options<TPackage>;
78
83
  // A module representing the project root, used as the origin when resolving `emptyModulePath`.
79
84
  _projectRootFakeModule: Moduleish;
80
85
  // An empty module, the result of resolving `emptyModulePath` from the project root.
81
- _cachedEmptyModule: ?TModule;
86
+ _cachedEmptyModule: ?BundlerResolution;
82
87
 
83
88
  // $FlowFixMe[missing-local-annot]
84
- constructor(options: Options<TModule, TPackage>) {
89
+ constructor(options: Options<TPackage>) {
85
90
  this._options = options;
86
91
  const {projectRoot, moduleCache} = this._options;
87
92
  this._projectRootFakeModule = {
@@ -97,7 +102,7 @@ class ModuleResolver<TModule: Moduleish, TPackage: Packageish> {
97
102
  };
98
103
  }
99
104
 
100
- _getEmptyModule(): TModule | Moduleish {
105
+ _getEmptyModule(): BundlerResolution {
101
106
  let emptyModule = this._cachedEmptyModule;
102
107
  if (!emptyModule) {
103
108
  emptyModule = this.resolveDependency(
@@ -171,7 +176,7 @@ class ModuleResolver<TModule: Moduleish, TPackage: Packageish> {
171
176
  allowHaste: boolean,
172
177
  platform: string | null,
173
178
  resolverOptions: ResolverInputOptions,
174
- ): TModule {
179
+ ): BundlerResolution {
175
180
  try {
176
181
  const result = Resolver.resolve(
177
182
  {
@@ -187,6 +192,8 @@ class ModuleResolver<TModule: Moduleish, TPackage: Packageish> {
187
192
  resolveHastePackage: (name: string) =>
188
193
  this._options.getHastePackagePath(name, platform),
189
194
  getPackageMainPath: this._getPackageMainPath,
195
+ unstable_enablePackageExports:
196
+ this._options.unstable_enablePackageExports,
190
197
  },
191
198
  moduleName,
192
199
  platform,
@@ -244,21 +251,19 @@ class ModuleResolver<TModule: Moduleish, TPackage: Packageish> {
244
251
  };
245
252
 
246
253
  /**
247
- * FIXME: get rid of this function and of the reliance on `TModule`
248
- * altogether, return strongly typed resolutions at the top-level instead.
254
+ * TODO: Return Resolution instead of coercing to BundlerResolution here
249
255
  */
250
- _getFileResolvedModule(resolution: Resolution): TModule {
256
+ _getFileResolvedModule(resolution: Resolution): BundlerResolution {
251
257
  switch (resolution.type) {
252
258
  case 'sourceFile':
253
- return this._options.moduleCache.getModule(resolution.filePath);
259
+ return resolution;
254
260
  case 'assetFiles':
255
261
  // FIXME: we should forward ALL the paths/metadata,
256
262
  // not just an arbitrary item!
257
263
  const arbitrary = getArrayLowestItem(resolution.filePaths);
258
264
  invariant(arbitrary != null, 'invalid asset resolution');
259
- return this._options.moduleCache.getModule(arbitrary);
265
+ return {type: 'sourceFile', filePath: arbitrary};
260
266
  case 'empty':
261
- // $FlowFixMe[incompatible-return]
262
267
  return this._getEmptyModule();
263
268
  default:
264
269
  (resolution.type: empty);
@@ -112,6 +112,7 @@ function createHasteMap(config, options) {
112
112
  computeDependencies,
113
113
  computeSha1: true,
114
114
  dependencyExtractor: config.resolver.dependencyExtractor,
115
+ enableSymlinks: config.resolver.unstable_enableSymlinks,
115
116
  extensions: Array.from(
116
117
  new Set([
117
118
  ...config.resolver.sourceExts,
@@ -70,6 +70,7 @@ function createHasteMap(
70
70
  computeDependencies,
71
71
  computeSha1: true,
72
72
  dependencyExtractor: config.resolver.dependencyExtractor,
73
+ enableSymlinks: config.resolver.unstable_enableSymlinks,
73
74
  extensions: Array.from(
74
75
  new Set([
75
76
  ...config.resolver.sourceExts,
@@ -162,6 +162,11 @@ class DependencyGraph extends EventEmitter {
162
162
  },
163
163
  resolveRequest: this._config.resolver.resolveRequest,
164
164
  sourceExts: this._config.resolver.sourceExts,
165
+ unstable_conditionNames: this._config.resolver.unstable_conditionNames,
166
+ unstable_conditionsByPlatform:
167
+ this._config.resolver.unstable_conditionsByPlatform,
168
+ unstable_enablePackageExports:
169
+ this._config.resolver.unstable_enablePackageExports,
165
170
  });
166
171
  }
167
172
  _createModuleCache() {
@@ -254,16 +259,16 @@ class DependencyGraph extends EventEmitter {
254
259
  );
255
260
  const mapByTarget = getOrCreateMap(mapByOrigin, originKey);
256
261
  const mapByPlatform = getOrCreateMap(mapByTarget, targetKey);
257
- let modulePath = mapByPlatform.get(platformKey);
258
- if (!modulePath) {
262
+ let resolution = mapByPlatform.get(platformKey);
263
+ if (!resolution) {
259
264
  try {
260
- modulePath = this._moduleResolver.resolveDependency(
265
+ resolution = this._moduleResolver.resolveDependency(
261
266
  this._moduleCache.getModule(from),
262
267
  to,
263
268
  true,
264
269
  platform,
265
270
  resolverOptions
266
- ).path;
271
+ );
267
272
  } catch (error) {
268
273
  if (error instanceof _metroFileMap.DuplicateHasteCandidatesError) {
269
274
  throw new AmbiguousModuleResolutionError(from, error);
@@ -278,8 +283,8 @@ class DependencyGraph extends EventEmitter {
278
283
  throw error;
279
284
  }
280
285
  }
281
- mapByPlatform.set(platformKey, modulePath);
282
- return modulePath;
286
+ mapByPlatform.set(platformKey, resolution);
287
+ return resolution;
283
288
  }
284
289
  _doesFileExist = (filePath) => {
285
290
  return this._fileSystem.exists(filePath);
@@ -18,7 +18,6 @@ import type MetroFileMap, {
18
18
  HealthCheckResult,
19
19
  WatcherStatus,
20
20
  } from 'metro-file-map';
21
- import type Module from './Module';
22
21
 
23
22
  import {DuplicateHasteCandidatesError} from 'metro-file-map';
24
23
 
@@ -37,6 +36,7 @@ const {InvalidPackageError} = require('metro-resolver');
37
36
  const nullthrows = require('nullthrows');
38
37
  const path = require('path');
39
38
  import type {ResolverInputOptions} from '../shared/types.flow';
39
+ import type {BundlerResolution} from '../DeltaBundler/types.flow';
40
40
 
41
41
  const NULL_PLATFORM = Symbol();
42
42
 
@@ -59,7 +59,7 @@ class DependencyGraph extends EventEmitter {
59
59
  _fileSystem: FileSystem;
60
60
  _moduleCache: ModuleCache;
61
61
  _hasteModuleMap: IModuleMap;
62
- _moduleResolver: ModuleResolver<Module, Package>;
62
+ _moduleResolver: ModuleResolver<Package>;
63
63
  _resolutionCache: Map<
64
64
  // Custom resolver options
65
65
  string | symbol,
@@ -72,7 +72,7 @@ class DependencyGraph extends EventEmitter {
72
72
  Map<
73
73
  // Platform
74
74
  string | symbol,
75
- string,
75
+ BundlerResolution,
76
76
  >,
77
77
  >,
78
78
  >,
@@ -209,6 +209,11 @@ class DependencyGraph extends EventEmitter {
209
209
  },
210
210
  resolveRequest: this._config.resolver.resolveRequest,
211
211
  sourceExts: this._config.resolver.sourceExts,
212
+ unstable_conditionNames: this._config.resolver.unstable_conditionNames,
213
+ unstable_conditionsByPlatform:
214
+ this._config.resolver.unstable_conditionsByPlatform,
215
+ unstable_enablePackageExports:
216
+ this._config.resolver.unstable_enablePackageExports,
212
217
  });
213
218
  }
214
219
 
@@ -284,7 +289,7 @@ class DependencyGraph extends EventEmitter {
284
289
  {assumeFlatNodeModules}: {assumeFlatNodeModules: boolean} = {
285
290
  assumeFlatNodeModules: false,
286
291
  },
287
- ): string {
292
+ ): BundlerResolution {
288
293
  const isSensitiveToOriginFolder =
289
294
  // Resolution is always relative to the origin folder unless we assume a flat node_modules
290
295
  !assumeFlatNodeModules ||
@@ -313,17 +318,17 @@ class DependencyGraph extends EventEmitter {
313
318
  );
314
319
  const mapByTarget = getOrCreateMap(mapByOrigin, originKey);
315
320
  const mapByPlatform = getOrCreateMap(mapByTarget, targetKey);
316
- let modulePath = mapByPlatform.get(platformKey);
321
+ let resolution: ?BundlerResolution = mapByPlatform.get(platformKey);
317
322
 
318
- if (!modulePath) {
323
+ if (!resolution) {
319
324
  try {
320
- modulePath = this._moduleResolver.resolveDependency(
325
+ resolution = this._moduleResolver.resolveDependency(
321
326
  this._moduleCache.getModule(from),
322
327
  to,
323
328
  true,
324
329
  platform,
325
330
  resolverOptions,
326
- ).path;
331
+ );
327
332
  } catch (error) {
328
333
  if (error instanceof DuplicateHasteCandidatesError) {
329
334
  throw new AmbiguousModuleResolutionError(from, error);
@@ -339,8 +344,8 @@ class DependencyGraph extends EventEmitter {
339
344
  }
340
345
  }
341
346
 
342
- mapByPlatform.set(platformKey, modulePath);
343
- return modulePath;
347
+ mapByPlatform.set(platformKey, resolution);
348
+ return resolution;
344
349
  }
345
350
 
346
351
  _doesFileExist = (filePath: string): boolean => {