metro 0.71.3 → 0.72.2

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 (108) hide show
  1. package/package.json +23 -21
  2. package/src/Assets.js +3 -2
  3. package/src/Assets.js.flow +3 -2
  4. package/src/Bundler.js +11 -2
  5. package/src/Bundler.js.flow +7 -1
  6. package/src/DeltaBundler/DeltaCalculator.js +83 -21
  7. package/src/DeltaBundler/DeltaCalculator.js.flow +61 -8
  8. package/src/DeltaBundler/Serializers/baseBytecodeBundle.js +3 -2
  9. package/src/DeltaBundler/Serializers/baseBytecodeBundle.js.flow +2 -1
  10. package/src/DeltaBundler/Serializers/helpers/bytecode.js +2 -2
  11. package/src/DeltaBundler/Serializers/helpers/bytecode.js.flow +2 -1
  12. package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +1 -3
  13. package/src/DeltaBundler/Transformer.js +27 -4
  14. package/src/DeltaBundler/Transformer.js.flow +18 -2
  15. package/src/DeltaBundler/Worker.flow.js +45 -1
  16. package/src/DeltaBundler/Worker.flow.js.flow +42 -1
  17. package/src/DeltaBundler/WorkerFarm.js +3 -2
  18. package/src/DeltaBundler/WorkerFarm.js.flow +3 -1
  19. package/src/DeltaBundler/graphOperations.js +170 -63
  20. package/src/DeltaBundler/graphOperations.js.flow +144 -64
  21. package/src/DeltaBundler/types.flow.js.flow +11 -5
  22. package/src/DeltaBundler.js.flow +1 -1
  23. package/src/HmrServer.js +11 -5
  24. package/src/HmrServer.js.flow +11 -4
  25. package/src/IncrementalBundler.js +22 -4
  26. package/src/IncrementalBundler.js.flow +23 -4
  27. package/src/ModuleGraph/node-haste/HasteFS.js.flow +1 -1
  28. package/src/ModuleGraph/node-haste/Package.js.flow +5 -5
  29. package/src/ModuleGraph/node-haste/node-haste.js +19 -8
  30. package/src/ModuleGraph/node-haste/node-haste.js.flow +43 -16
  31. package/src/ModuleGraph/output/indexed-ram-bundle.js.flow +5 -13
  32. package/src/ModuleGraph/output/multiple-files-ram-bundle.js.flow +4 -14
  33. package/src/ModuleGraph/output/util.js +3 -4
  34. package/src/ModuleGraph/output/util.js.flow +3 -3
  35. package/src/ModuleGraph/types.flow.js.flow +28 -5
  36. package/src/ModuleGraph/worker/collectDependencies.js +19 -30
  37. package/src/ModuleGraph/worker/collectDependencies.js.flow +23 -41
  38. package/src/Server.js +90 -32
  39. package/src/Server.js.flow +143 -44
  40. package/src/cli-utils.js.flow +1 -1
  41. package/src/commands/build.js +1 -2
  42. package/src/commands/build.js.flow +6 -9
  43. package/src/commands/dependencies.js +1 -1
  44. package/src/commands/serve.js +2 -1
  45. package/src/commands/serve.js.flow +7 -8
  46. package/src/index.flow.js +27 -16
  47. package/src/index.flow.js.flow +24 -15
  48. package/src/integration_tests/basic_bundle/require-context/conflict.js +25 -0
  49. package/src/integration_tests/basic_bundle/require-context/conflict.js.flow +27 -0
  50. package/src/integration_tests/basic_bundle/require-context/empty.js +29 -0
  51. package/src/integration_tests/basic_bundle/require-context/empty.js.flow +26 -0
  52. package/src/integration_tests/basic_bundle/require-context/matching.js +26 -0
  53. package/src/integration_tests/basic_bundle/require-context/matching.js.flow +27 -0
  54. package/src/integration_tests/basic_bundle/require-context/mode-eager.js +22 -0
  55. package/src/integration_tests/basic_bundle/require-context/mode-eager.js.flow +24 -0
  56. package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js +22 -0
  57. package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js.flow +24 -0
  58. package/src/integration_tests/basic_bundle/require-context/mode-lazy.js +22 -0
  59. package/src/integration_tests/basic_bundle/require-context/mode-lazy.js.flow +24 -0
  60. package/src/integration_tests/basic_bundle/require-context/mode-sync.js +20 -0
  61. package/src/integration_tests/basic_bundle/require-context/mode-sync.js.flow +22 -0
  62. package/src/integration_tests/basic_bundle/require-context/subdir/a.js +12 -0
  63. package/src/integration_tests/basic_bundle/require-context/subdir/a.js.flow +11 -0
  64. package/src/integration_tests/basic_bundle/require-context/subdir/b.js +18 -0
  65. package/src/integration_tests/basic_bundle/require-context/subdir/b.js.flow +11 -0
  66. package/src/integration_tests/basic_bundle/require-context/subdir/c.js +12 -0
  67. package/src/integration_tests/basic_bundle/require-context/subdir/c.js.flow +11 -0
  68. package/src/integration_tests/basic_bundle/require-context/subdir/nested/d.js +12 -0
  69. package/src/integration_tests/basic_bundle/require-context/subdir/nested/d.js.flow +11 -0
  70. package/src/integration_tests/basic_bundle/require-context/subdir-conflict/index.js +12 -0
  71. package/src/integration_tests/basic_bundle/require-context/subdir-conflict/index.js.flow +11 -0
  72. package/src/integration_tests/basic_bundle/require-context/utils.js +29 -0
  73. package/src/integration_tests/basic_bundle/require-context/utils.js.flow +44 -0
  74. package/src/lib/CountingSet.js +1 -0
  75. package/src/lib/CountingSet.js.flow +1 -0
  76. package/src/lib/RamBundleParser.js +1 -0
  77. package/src/lib/RamBundleParser.js.flow +1 -0
  78. package/src/lib/bundleToBytecode.js +3 -2
  79. package/src/lib/bundleToBytecode.js.flow +2 -2
  80. package/src/lib/contextModule.js +80 -0
  81. package/src/lib/contextModule.js.flow +86 -0
  82. package/src/lib/contextModuleTemplates.js +186 -0
  83. package/src/lib/contextModuleTemplates.js.flow +148 -0
  84. package/src/lib/getGraphId.js +17 -3
  85. package/src/lib/getGraphId.js.flow +12 -9
  86. package/src/lib/getPrependedScripts.js +15 -5
  87. package/src/lib/getPrependedScripts.js.flow +8 -1
  88. package/src/lib/parseCustomResolverOptions.js +26 -0
  89. package/src/lib/parseCustomResolverOptions.js.flow +38 -0
  90. package/src/lib/parseOptionsFromUrl.js +3 -0
  91. package/src/lib/parseOptionsFromUrl.js.flow +9 -18
  92. package/src/lib/splitBundleOptions.js +3 -0
  93. package/src/lib/splitBundleOptions.js.flow +3 -0
  94. package/src/lib/transformHelpers.js +68 -22
  95. package/src/lib/transformHelpers.js.flow +73 -16
  96. package/src/node-haste/DependencyGraph/ModuleResolution.js +19 -2
  97. package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +8 -2
  98. package/src/node-haste/DependencyGraph/createHasteMap.js +7 -1
  99. package/src/node-haste/DependencyGraph/createHasteMap.js.flow +7 -1
  100. package/src/node-haste/DependencyGraph.js +39 -9
  101. package/src/node-haste/DependencyGraph.js.flow +63 -12
  102. package/src/node-haste/Module.js +1 -0
  103. package/src/node-haste/Module.js.flow +1 -0
  104. package/src/shared/output/bundle.flow.js +67 -0
  105. package/src/shared/output/bundle.flow.js.flow +89 -0
  106. package/src/shared/output/bundle.js +8 -55
  107. package/src/shared/output/bundle.js.flow +8 -75
  108. package/src/shared/types.flow.js.flow +7 -0
@@ -17,6 +17,7 @@ import type {
17
17
  AsyncDependencyType,
18
18
  } from 'metro/src/DeltaBundler/types.flow.js';
19
19
 
20
+ const crypto = require('crypto');
20
21
  const generate = require('@babel/generator').default;
21
22
  const template = require('@babel/template').default;
22
23
  const traverse = require('@babel/traverse').default;
@@ -38,7 +39,7 @@ export type Dependency<TSplitCondition> = $ReadOnly<{
38
39
  }>;
39
40
 
40
41
  // TODO: Convert to a Flow enum
41
- type ContextMode = 'sync' | 'eager' | 'lazy' | 'lazy-once';
42
+ export type ContextMode = 'sync' | 'eager' | 'lazy' | 'lazy-once';
42
43
 
43
44
  type ContextFilter = {pattern: string, flags: string};
44
45
 
@@ -52,6 +53,8 @@ export type RequireContextParams = $ReadOnly<{
52
53
  }>;
53
54
 
54
55
  type DependencyData<TSplitCondition> = $ReadOnly<{
56
+ // A locally unique key for this dependency within the current module.
57
+ key: string,
55
58
  // If null, then the dependency is synchronous.
56
59
  // (ex. `require('foo')`)
57
60
  asyncType: AsyncDependencyType | null,
@@ -726,8 +729,9 @@ function createModuleNameLiteral(dependency: InternalDependency<mixed>) {
726
729
 
727
730
  /**
728
731
  * Given an import qualifier, return a key used to register the dependency.
729
- * Generally this return the `ImportQualifier.name` property, but in the case
730
- * of `require.context` more attributes can be appended to distinguish various combinations that would otherwise conflict.
732
+ * Generally this return the `ImportQualifier.name` property, but more
733
+ * attributes can be appended to distinguish various combinations that would
734
+ * otherwise conflict.
731
735
  *
732
736
  * For example, the following case would have collision issues if they all utilized the `name` property:
733
737
  * ```
@@ -743,6 +747,11 @@ function createModuleNameLiteral(dependency: InternalDependency<mixed>) {
743
747
  function getKeyForDependency(qualifier: ImportQualifier): string {
744
748
  let key = qualifier.name;
745
749
 
750
+ const {asyncType} = qualifier;
751
+ if (asyncType) {
752
+ key += ['', asyncType].join('\0');
753
+ }
754
+
746
755
  const {contextParams} = qualifier;
747
756
  // Add extra qualifiers when using `require.context` to prevent collisions.
748
757
  if (contextParams) {
@@ -757,7 +766,7 @@ function getKeyForDependency(qualifier: ImportQualifier): string {
757
766
  String(contextParams.filter.flags),
758
767
  contextParams.mode,
759
768
  // Join together and append to the name:
760
- ].join('__');
769
+ ].join('\0');
761
770
  }
762
771
  return key;
763
772
  }
@@ -780,6 +789,7 @@ class DefaultModuleDependencyRegistry<TSplitCondition = void>
780
789
  asyncType: qualifier.asyncType,
781
790
  locs: [],
782
791
  index: this._dependencies.size,
792
+ key: crypto.createHash('sha1').update(key).digest('base64'),
783
793
  };
784
794
 
785
795
  if (qualifier.optional) {
@@ -790,15 +800,19 @@ class DefaultModuleDependencyRegistry<TSplitCondition = void>
790
800
  }
791
801
 
792
802
  dependency = newDependency;
793
- this._dependencies.set(key, dependency);
794
803
  } else {
795
- const original = dependency;
796
- dependency = collapseDependencies(original, qualifier);
797
- if (original !== dependency) {
798
- this._dependencies.set(key, dependency);
804
+ if (dependency.isOptional && !qualifier.optional) {
805
+ // A previously optionally required dependency was required non-optionally.
806
+ // Mark it non optional for the whole module
807
+ dependency = {
808
+ ...dependency,
809
+ isOptional: false,
810
+ };
799
811
  }
800
812
  }
801
813
 
814
+ this._dependencies.set(key, dependency);
815
+
802
816
  return dependency;
803
817
  }
804
818
 
@@ -807,36 +821,4 @@ class DefaultModuleDependencyRegistry<TSplitCondition = void>
807
821
  }
808
822
  }
809
823
 
810
- function collapseDependencies<TSplitCondition>(
811
- dependency: InternalDependency<TSplitCondition>,
812
- qualifier: ImportQualifier,
813
- ): InternalDependency<TSplitCondition> {
814
- let collapsed = dependency;
815
-
816
- // A previously optionally required dependency was required non-optionaly.
817
- // Mark it non optional for the whole module
818
- if (collapsed.isOptional && !qualifier.optional) {
819
- collapsed = {
820
- ...dependency,
821
- isOptional: false,
822
- };
823
- }
824
-
825
- // A previously asynchronously (or prefetch) required module was required synchronously.
826
- // Make the dependency sync.
827
- if (collapsed.asyncType != null && qualifier.asyncType == null) {
828
- collapsed = {...dependency, asyncType: null};
829
- }
830
-
831
- // A prefetched dependency was required async in the module. Mark it as async.
832
- if (collapsed.asyncType === 'prefetch' && qualifier.asyncType === 'async') {
833
- collapsed = {
834
- ...dependency,
835
- asyncType: 'async',
836
- };
837
- }
838
-
839
- return collapsed;
840
- }
841
-
842
824
  module.exports = collectDependencies;
package/src/Server.js CHANGED
@@ -62,8 +62,6 @@ const {
62
62
  Logger: { createActionStartEntry, createActionEndEntry, log },
63
63
  } = require("metro-core");
64
64
 
65
- const { VERSION: BYTECODE_VERSION } = require("metro-hermes-compiler");
66
-
67
65
  const mime = require("mime-types");
68
66
 
69
67
  const nullthrows = require("nullthrows");
@@ -77,6 +75,10 @@ const url = require("url");
77
75
  const DELTA_ID_HEADER = "X-Metro-Delta-ID";
78
76
  const FILES_CHANGED_COUNT_HEADER = "X-Metro-Files-Changed-Count";
79
77
 
78
+ function getBytecodeVersion() {
79
+ return require("metro-hermes-compiler").VERSION;
80
+ }
81
+
80
82
  class Server {
81
83
  constructor(config, options) {
82
84
  this._config = config;
@@ -129,12 +131,14 @@ class Server {
129
131
  entryFile,
130
132
  graphOptions,
131
133
  onProgress,
134
+ resolverOptions,
132
135
  serializerOptions,
133
136
  transformOptions,
134
137
  } = splitBundleOptions(options);
135
138
  const { prepend, graph } = await this._bundler.buildGraph(
136
139
  entryFile,
137
140
  transformOptions,
141
+ resolverOptions,
138
142
  {
139
143
  onProgress,
140
144
  shallow: graphOptions.shallow,
@@ -147,8 +151,9 @@ class Server {
147
151
  asyncRequireModulePath: await this._resolveRelativePath(
148
152
  this._config.transformer.asyncRequireModulePath,
149
153
  {
150
- transformOptions,
151
154
  relativeTo: "project",
155
+ resolverOptions,
156
+ transformOptions,
152
157
  }
153
158
  ),
154
159
  processModuleFilter: this._config.serializer.processModuleFilter,
@@ -217,12 +222,14 @@ class Server {
217
222
  entryFile,
218
223
  graphOptions,
219
224
  onProgress,
225
+ resolverOptions,
220
226
  serializerOptions,
221
227
  transformOptions,
222
228
  } = splitBundleOptions(options);
223
229
  const { prepend, graph } = await this._bundler.buildGraph(
224
230
  entryFile,
225
231
  transformOptions,
232
+ resolverOptions,
226
233
  {
227
234
  onProgress,
228
235
  shallow: graphOptions.shallow,
@@ -235,8 +242,9 @@ class Server {
235
242
  asyncRequireModulePath: await this._resolveRelativePath(
236
243
  this._config.transformer.asyncRequireModulePath,
237
244
  {
238
- transformOptions,
239
245
  relativeTo: "project",
246
+ resolverOptions,
247
+ transformOptions,
240
248
  }
241
249
  ),
242
250
  processModuleFilter: this._config.serializer.processModuleFilter,
@@ -265,11 +273,12 @@ class Server {
265
273
  }
266
274
 
267
275
  async getAssets(options) {
268
- const { entryFile, transformOptions, onProgress } =
276
+ const { entryFile, onProgress, resolverOptions, transformOptions } =
269
277
  splitBundleOptions(options);
270
278
  const dependencies = await this._bundler.getDependencies(
271
279
  [entryFile],
272
280
  transformOptions,
281
+ resolverOptions,
273
282
  {
274
283
  onProgress,
275
284
  shallow: false,
@@ -285,10 +294,15 @@ class Server {
285
294
  }
286
295
 
287
296
  async getOrderedDependencyPaths(options) {
288
- /* $FlowFixMe(>=0.122.0 site=react_native_fb) This comment suppresses an
289
- * error found when Flow v0.122.0 was deployed. To see the error, delete
290
- * this comment and run Flow. */
291
- const { entryFile, transformOptions, onProgress } = splitBundleOptions({
297
+ const {
298
+ entryFile,
299
+ onProgress,
300
+ resolverOptions,
301
+ transformOptions,
302
+ /* $FlowFixMe(>=0.122.0 site=react_native_fb) This comment suppresses an
303
+ * error found when Flow v0.122.0 was deployed. To see the error, delete
304
+ * this comment and run Flow. */
305
+ } = splitBundleOptions({
292
306
  ...Server.DEFAULT_BUNDLE_OPTIONS,
293
307
  ...options,
294
308
  bundleType: "bundle",
@@ -296,6 +310,7 @@ class Server {
296
310
  const { prepend, graph } = await this._bundler.buildGraph(
297
311
  entryFile,
298
312
  transformOptions,
313
+ resolverOptions,
299
314
  {
300
315
  onProgress,
301
316
  shallow: false,
@@ -395,7 +410,7 @@ class Server {
395
410
  return parseOptionsFromUrl(
396
411
  url,
397
412
  new Set(this._config.resolver.platforms),
398
- BYTECODE_VERSION
413
+ getBytecodeVersion()
399
414
  );
400
415
  }
401
416
 
@@ -454,21 +469,30 @@ class Server {
454
469
  finish,
455
470
  }) {
456
471
  return async function requestProcessor(req, res, bundleOptions) {
457
- const { entryFile, graphOptions, transformOptions, serializerOptions } =
458
- splitBundleOptions(bundleOptions);
472
+ const {
473
+ entryFile,
474
+ graphOptions,
475
+ resolverOptions,
476
+ serializerOptions,
477
+ transformOptions,
478
+ } = splitBundleOptions(bundleOptions);
459
479
  /**
460
480
  * `entryFile` is relative to projectRoot, we need to use resolution function
461
481
  * to find the appropriate file with supported extensions.
462
482
  */
463
483
 
464
484
  const resolvedEntryFilePath = await this._resolveRelativePath(entryFile, {
465
- transformOptions,
466
485
  relativeTo: "server",
486
+ resolverOptions,
487
+ transformOptions,
467
488
  });
468
489
  const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
469
- shallow: graphOptions.shallow,
470
490
  experimentalImportBundleSupport:
471
491
  this._config.transformer.experimentalImportBundleSupport,
492
+ unstable_allowRequireContext:
493
+ this._config.transformer.unstable_allowRequireContext,
494
+ resolverOptions,
495
+ shallow: graphOptions.shallow,
472
496
  }); // For resources that support deletion, handle the DELETE method.
473
497
 
474
498
  if (deleteFn && req.method === "DELETE") {
@@ -562,6 +586,7 @@ class Server {
562
586
  mres,
563
587
  onProgress,
564
588
  req,
589
+ resolverOptions,
565
590
  serializerOptions,
566
591
  transformOptions,
567
592
  };
@@ -644,6 +669,7 @@ class Server {
644
669
  graphId,
645
670
  graphOptions,
646
671
  onProgress,
672
+ resolverOptions,
647
673
  serializerOptions,
648
674
  transformOptions,
649
675
  }) => {
@@ -653,10 +679,15 @@ class Server {
653
679
 
654
680
  const { delta, revision } = await (revPromise != null
655
681
  ? this._bundler.updateGraph(await revPromise, false)
656
- : this._bundler.initializeGraph(entryFile, transformOptions, {
657
- onProgress,
658
- shallow: graphOptions.shallow,
659
- }));
682
+ : this._bundler.initializeGraph(
683
+ entryFile,
684
+ transformOptions,
685
+ resolverOptions,
686
+ {
687
+ onProgress,
688
+ shallow: graphOptions.shallow,
689
+ }
690
+ ));
660
691
 
661
692
  const serializer =
662
693
  this._config.serializer.customSerializer ||
@@ -672,8 +703,9 @@ class Server {
672
703
  asyncRequireModulePath: await this._resolveRelativePath(
673
704
  this._config.transformer.asyncRequireModulePath,
674
705
  {
675
- transformOptions,
676
706
  relativeTo: "project",
707
+ resolverOptions,
708
+ transformOptions,
677
709
  }
678
710
  ),
679
711
  processModuleFilter: this._config.serializer.processModuleFilter,
@@ -766,6 +798,7 @@ class Server {
766
798
  graphId,
767
799
  graphOptions,
768
800
  onProgress,
801
+ resolverOptions,
769
802
  serializerOptions,
770
803
  transformOptions,
771
804
  }) => {
@@ -775,17 +808,23 @@ class Server {
775
808
 
776
809
  const { delta, revision } = await (revPromise != null
777
810
  ? this._bundler.updateGraph(await revPromise, false)
778
- : this._bundler.initializeGraph(entryFile, transformOptions, {
779
- onProgress,
780
- shallow: graphOptions.shallow,
781
- }));
811
+ : this._bundler.initializeGraph(
812
+ entryFile,
813
+ transformOptions,
814
+ resolverOptions,
815
+ {
816
+ onProgress,
817
+ shallow: graphOptions.shallow,
818
+ }
819
+ ));
782
820
  const bundle = bundleToBytecode(
783
821
  baseBytecodeBundle(entryFile, revision.prepend, revision.graph, {
784
822
  asyncRequireModulePath: await this._resolveRelativePath(
785
823
  this._config.transformer.asyncRequireModulePath,
786
824
  {
787
- transformOptions,
788
825
  relativeTo: "project",
826
+ resolverOptions,
827
+ transformOptions,
789
828
  }
790
829
  ),
791
830
  processModuleFilter: this._config.serializer.processModuleFilter,
@@ -882,6 +921,7 @@ class Server {
882
921
  graphId,
883
922
  graphOptions,
884
923
  onProgress,
924
+ resolverOptions,
885
925
  serializerOptions,
886
926
  transformOptions,
887
927
  }) => {
@@ -893,6 +933,7 @@ class Server {
893
933
  ({ revision } = await this._bundler.initializeGraph(
894
934
  entryFile,
895
935
  transformOptions,
936
+ resolverOptions,
896
937
  {
897
938
  onProgress,
898
939
  shallow: graphOptions.shallow,
@@ -938,10 +979,16 @@ class Server {
938
979
  };
939
980
  },
940
981
 
941
- build: async ({ entryFile, transformOptions, onProgress }) => {
982
+ build: async ({
983
+ entryFile,
984
+ onProgress,
985
+ resolverOptions,
986
+ transformOptions,
987
+ }) => {
942
988
  const dependencies = await this._bundler.getDependencies(
943
989
  [entryFile],
944
990
  transformOptions,
991
+ resolverOptions,
945
992
  {
946
993
  onProgress,
947
994
  shallow: false,
@@ -1073,14 +1120,15 @@ class Server {
1073
1120
  const options = parseOptionsFromUrl(
1074
1121
  reqUrl,
1075
1122
  new Set(this._config.resolver.platforms),
1076
- BYTECODE_VERSION
1123
+ getBytecodeVersion()
1077
1124
  );
1078
1125
  const {
1079
1126
  entryFile,
1080
- transformOptions,
1081
- serializerOptions,
1082
1127
  graphOptions,
1083
1128
  onProgress,
1129
+ resolverOptions,
1130
+ serializerOptions,
1131
+ transformOptions,
1084
1132
  } = splitBundleOptions(options);
1085
1133
  /**
1086
1134
  * `entryFile` is relative to projectRoot, we need to use resolution function
@@ -1088,13 +1136,17 @@ class Server {
1088
1136
  */
1089
1137
 
1090
1138
  const resolvedEntryFilePath = await this._resolveRelativePath(entryFile, {
1091
- transformOptions,
1092
1139
  relativeTo: "server",
1140
+ resolverOptions,
1141
+ transformOptions,
1093
1142
  });
1094
1143
  const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
1095
- shallow: graphOptions.shallow,
1096
1144
  experimentalImportBundleSupport:
1097
1145
  this._config.transformer.experimentalImportBundleSupport,
1146
+ unstable_allowRequireContext:
1147
+ this._config.transformer.unstable_allowRequireContext,
1148
+ resolverOptions,
1149
+ shallow: graphOptions.shallow,
1098
1150
  });
1099
1151
  let revision;
1100
1152
 
@@ -1104,6 +1156,7 @@ class Server {
1104
1156
  ({ revision } = await this._bundler.initializeGraph(
1105
1157
  resolvedEntryFilePath,
1106
1158
  transformOptions,
1159
+ resolverOptions,
1107
1160
  {
1108
1161
  onProgress,
1109
1162
  shallow: graphOptions.shallow,
@@ -1127,10 +1180,14 @@ class Server {
1127
1180
  );
1128
1181
  }
1129
1182
 
1130
- async _resolveRelativePath(filePath, { transformOptions, relativeTo }) {
1183
+ async _resolveRelativePath(
1184
+ filePath,
1185
+ { relativeTo, resolverOptions, transformOptions }
1186
+ ) {
1131
1187
  const resolutionFn = await transformHelpers.getResolveDependencyFn(
1132
1188
  this._bundler.getBundler(),
1133
- transformOptions.platform
1189
+ transformOptions.platform,
1190
+ resolverOptions
1134
1191
  );
1135
1192
  const rootDir =
1136
1193
  relativeTo === "server"
@@ -1152,6 +1209,7 @@ class Server {
1152
1209
  }
1153
1210
 
1154
1211
  static DEFAULT_GRAPH_OPTIONS = {
1212
+ customResolverOptions: Object.create(null),
1155
1213
  customTransformOptions: Object.create(null),
1156
1214
  dev: true,
1157
1215
  hot: false,