metro 0.72.0 → 0.72.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.
Files changed (71) hide show
  1. package/package.json +21 -21
  2. package/src/Bundler.js +11 -2
  3. package/src/Bundler.js.flow +7 -1
  4. package/src/DeltaBundler/DeltaCalculator.js +83 -21
  5. package/src/DeltaBundler/DeltaCalculator.js.flow +61 -8
  6. package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +1 -3
  7. package/src/DeltaBundler/Transformer.js +27 -4
  8. package/src/DeltaBundler/Transformer.js.flow +18 -2
  9. package/src/DeltaBundler/Worker.flow.js +45 -1
  10. package/src/DeltaBundler/Worker.flow.js.flow +42 -1
  11. package/src/DeltaBundler/WorkerFarm.js +3 -2
  12. package/src/DeltaBundler/WorkerFarm.js.flow +3 -1
  13. package/src/DeltaBundler/graphOperations.js +131 -20
  14. package/src/DeltaBundler/graphOperations.js.flow +106 -17
  15. package/src/DeltaBundler/types.flow.js.flow +6 -3
  16. package/src/HmrServer.js +2 -0
  17. package/src/HmrServer.js.flow +2 -0
  18. package/src/IncrementalBundler.js +6 -0
  19. package/src/IncrementalBundler.js.flow +6 -0
  20. package/src/ModuleGraph/node-haste/HasteFS.js.flow +1 -1
  21. package/src/ModuleGraph/node-haste/node-haste.js +2 -4
  22. package/src/ModuleGraph/node-haste/node-haste.js.flow +1 -3
  23. package/src/ModuleGraph/output/indexed-ram-bundle.js.flow +5 -13
  24. package/src/ModuleGraph/output/multiple-files-ram-bundle.js.flow +4 -14
  25. package/src/ModuleGraph/output/util.js.flow +1 -1
  26. package/src/ModuleGraph/worker/collectDependencies.js.flow +1 -1
  27. package/src/Server.js +4 -0
  28. package/src/Server.js.flow +37 -10
  29. package/src/integration_tests/basic_bundle/require-context/conflict.js +25 -0
  30. package/src/integration_tests/basic_bundle/require-context/conflict.js.flow +27 -0
  31. package/src/integration_tests/basic_bundle/require-context/empty.js +29 -0
  32. package/src/integration_tests/basic_bundle/require-context/empty.js.flow +26 -0
  33. package/src/integration_tests/basic_bundle/require-context/matching.js +26 -0
  34. package/src/integration_tests/basic_bundle/require-context/matching.js.flow +27 -0
  35. package/src/integration_tests/basic_bundle/require-context/mode-eager.js +22 -0
  36. package/src/integration_tests/basic_bundle/require-context/mode-eager.js.flow +24 -0
  37. package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js +22 -0
  38. package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js.flow +24 -0
  39. package/src/integration_tests/basic_bundle/require-context/mode-lazy.js +22 -0
  40. package/src/integration_tests/basic_bundle/require-context/mode-lazy.js.flow +24 -0
  41. package/src/integration_tests/basic_bundle/require-context/mode-sync.js +20 -0
  42. package/src/integration_tests/basic_bundle/require-context/mode-sync.js.flow +22 -0
  43. package/src/integration_tests/basic_bundle/require-context/subdir/a.js +12 -0
  44. package/src/integration_tests/basic_bundle/require-context/subdir/a.js.flow +11 -0
  45. package/src/integration_tests/basic_bundle/require-context/subdir/b.js +18 -0
  46. package/src/integration_tests/basic_bundle/require-context/subdir/b.js.flow +11 -0
  47. package/src/integration_tests/basic_bundle/require-context/subdir/c.js +12 -0
  48. package/src/integration_tests/basic_bundle/require-context/subdir/c.js.flow +11 -0
  49. package/src/integration_tests/basic_bundle/require-context/subdir/nested/d.js +12 -0
  50. package/src/integration_tests/basic_bundle/require-context/subdir/nested/d.js.flow +11 -0
  51. package/src/integration_tests/basic_bundle/require-context/subdir-conflict/index.js +12 -0
  52. package/src/integration_tests/basic_bundle/require-context/subdir-conflict/index.js.flow +11 -0
  53. package/src/integration_tests/basic_bundle/require-context/utils.js +29 -0
  54. package/src/integration_tests/basic_bundle/require-context/utils.js.flow +44 -0
  55. package/src/lib/CountingSet.js +1 -0
  56. package/src/lib/CountingSet.js.flow +1 -0
  57. package/src/lib/contextModule.js +80 -0
  58. package/src/lib/contextModule.js.flow +86 -0
  59. package/src/lib/contextModuleTemplates.js +186 -0
  60. package/src/lib/contextModuleTemplates.js.flow +148 -0
  61. package/src/lib/getGraphId.js +2 -1
  62. package/src/lib/getGraphId.js.flow +3 -0
  63. package/src/lib/getPrependedScripts.js +2 -0
  64. package/src/lib/getPrependedScripts.js.flow +2 -0
  65. package/src/lib/parseOptionsFromUrl.js.flow +7 -18
  66. package/src/lib/transformHelpers.js +41 -9
  67. package/src/lib/transformHelpers.js.flow +46 -9
  68. package/src/node-haste/DependencyGraph/ModuleResolution.js +1 -0
  69. package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +3 -2
  70. package/src/node-haste/DependencyGraph.js +5 -0
  71. package/src/node-haste/DependencyGraph.js.flow +14 -1
@@ -9,8 +9,6 @@
9
9
  */
10
10
 
11
11
  'use strict';
12
- import type {IdsForPathFn} from '../types.flow';
13
-
14
12
  import type {Module, OutputFn, OutputFnArg, OutputResult} from '../types.flow';
15
13
  import type {IndexMap} from 'metro-source-map';
16
14
 
@@ -30,18 +28,10 @@ function asMultipleFilesRamBundle({
30
28
  modules,
31
29
  requireCalls,
32
30
  preloadedModules,
33
- }: $TEMPORARY$object<{
34
- dependencyMapReservedName?: ?string,
35
- enableIDInlining: boolean,
36
- filename: string,
37
- globalPrefix: string,
38
- idsForPath: IdsForPathFn,
39
- modules: Iterable<Module>,
40
- preloadedModules: Set<string>,
31
+ }: $ReadOnly<{
32
+ ...OutputFnArg,
33
+ preloadedModules: $ReadOnlySet<string>,
41
34
  ramGroupHeads: ?$ReadOnlyArray<string>,
42
- requireCalls: Iterable<Module>,
43
- segmentID: number,
44
- sourceMapPath?: ?string,
45
35
  }>): OutputResult<IndexMap> {
46
36
  const idForPath = (x: {path: string, ...}) => idsForPath(x).moduleId;
47
37
  const [startup, deferred] = partition(modules, preloadedModules);
@@ -96,7 +86,7 @@ function asMultipleFilesRamBundle({
96
86
  }
97
87
 
98
88
  function createBuilder(
99
- preloadedModules: Set<string>,
89
+ preloadedModules: $ReadOnlySet<string>,
100
90
  ramGroupHeads: ?$ReadOnlyArray<string>,
101
91
  ): OutputFn<IndexMap> {
102
92
  return (x: OutputFnArg) =>
@@ -318,7 +318,7 @@ exports.requireCallsTo = function* (
318
318
  // the ones loaded deferredly (lazy loaded).
319
319
  exports.partition = (
320
320
  modules: Iterable<Module>,
321
- preloadedModules: Set<string>,
321
+ preloadedModules: $ReadOnlySet<string>,
322
322
  ): Array<Array<Module>> => {
323
323
  const startup = [];
324
324
  const deferred = [];
@@ -39,7 +39,7 @@ export type Dependency<TSplitCondition> = $ReadOnly<{
39
39
  }>;
40
40
 
41
41
  // TODO: Convert to a Flow enum
42
- type ContextMode = 'sync' | 'eager' | 'lazy' | 'lazy-once';
42
+ export type ContextMode = 'sync' | 'eager' | 'lazy' | 'lazy-once';
43
43
 
44
44
  type ContextFilter = {pattern: string, flags: string};
45
45
 
package/src/Server.js CHANGED
@@ -471,6 +471,8 @@ class Server {
471
471
  shallow: graphOptions.shallow,
472
472
  experimentalImportBundleSupport:
473
473
  this._config.transformer.experimentalImportBundleSupport,
474
+ unstable_allowRequireContext:
475
+ this._config.transformer.unstable_allowRequireContext,
474
476
  }); // For resources that support deletion, handle the DELETE method.
475
477
 
476
478
  if (deleteFn && req.method === "DELETE") {
@@ -1097,6 +1099,8 @@ class Server {
1097
1099
  shallow: graphOptions.shallow,
1098
1100
  experimentalImportBundleSupport:
1099
1101
  this._config.transformer.experimentalImportBundleSupport,
1102
+ unstable_allowRequireContext:
1103
+ this._config.transformer.unstable_allowRequireContext,
1100
1104
  });
1101
1105
  let revision;
1102
1106
 
@@ -351,7 +351,7 @@ class Server {
351
351
  res: ServerResponse,
352
352
  data: string | Buffer,
353
353
  assetPath: string,
354
- ) {
354
+ ): Buffer | string {
355
355
  if (req.headers && req.headers.range) {
356
356
  const [rangeStart, rangeEnd] = req.headers.range
357
357
  .replace(/bytes=/, '')
@@ -373,7 +373,10 @@ class Server {
373
373
  return data;
374
374
  }
375
375
 
376
- async _processSingleAssetRequest(req: IncomingMessage, res: ServerResponse) {
376
+ async _processSingleAssetRequest(
377
+ req: IncomingMessage,
378
+ res: ServerResponse,
379
+ ): Promise<void> {
377
380
  const urlObj = url.parse(decodeURI(req.url), true);
378
381
  let [, assetPath] =
379
382
  (urlObj &&
@@ -514,7 +517,11 @@ class Server {
514
517
  +build: (context: ProcessStartContext) => Promise<T>,
515
518
  +delete?: (context: ProcessDeleteContext) => Promise<void>,
516
519
  +finish: (context: ProcessEndContext<T>) => void,
517
- }) {
520
+ }): (
521
+ req: IncomingMessage,
522
+ res: ServerResponse,
523
+ bundleOptions: BundleOptions,
524
+ ) => Promise<void> {
518
525
  /* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
519
526
  * Flow's LTI update could not be added via codemod */
520
527
  return async function requestProcessor(
@@ -537,6 +544,8 @@ class Server {
537
544
  shallow: graphOptions.shallow,
538
545
  experimentalImportBundleSupport:
539
546
  this._config.transformer.experimentalImportBundleSupport,
547
+ unstable_allowRequireContext:
548
+ this._config.transformer.unstable_allowRequireContext,
540
549
  });
541
550
 
542
551
  // For resources that support deletion, handle the DELETE method.
@@ -694,7 +703,11 @@ class Server {
694
703
  };
695
704
  }
696
705
 
697
- _processBundleRequest = this._createRequestProcessor({
706
+ _processBundleRequest: (
707
+ req: IncomingMessage,
708
+ res: ServerResponse,
709
+ bundleOptions: BundleOptions,
710
+ ) => Promise<void> = this._createRequestProcessor({
698
711
  createStartEntry(context: ProcessStartContext) {
699
712
  return {
700
713
  action_name: 'Requesting bundle',
@@ -813,7 +826,11 @@ class Server {
813
826
  },
814
827
  });
815
828
 
816
- _processBytecodeBundleRequest = this._createRequestProcessor({
829
+ _processBytecodeBundleRequest: (
830
+ req: IncomingMessage,
831
+ res: ServerResponse,
832
+ bundleOptions: BundleOptions,
833
+ ) => Promise<void> = this._createRequestProcessor({
817
834
  createStartEntry(context: ProcessStartContext) {
818
835
  return {
819
836
  action_name: 'Requesting bundle',
@@ -931,7 +948,11 @@ class Server {
931
948
  );
932
949
  }
933
950
 
934
- _processSourceMapRequest = this._createRequestProcessor({
951
+ _processSourceMapRequest: (
952
+ req: IncomingMessage,
953
+ res: ServerResponse,
954
+ bundleOptions: BundleOptions,
955
+ ) => Promise<void> = this._createRequestProcessor({
935
956
  createStartEntry(context: ProcessStartContext) {
936
957
  return {
937
958
  action_name: 'Requesting sourcemap',
@@ -981,7 +1002,11 @@ class Server {
981
1002
  },
982
1003
  });
983
1004
 
984
- _processAssetsRequest = this._createRequestProcessor({
1005
+ _processAssetsRequest: (
1006
+ req: IncomingMessage,
1007
+ res: ServerResponse,
1008
+ bundleOptions: BundleOptions,
1009
+ ) => Promise<void> = this._createRequestProcessor({
985
1010
  createStartEntry(context: ProcessStartContext) {
986
1011
  return {
987
1012
  action_name: 'Requesting assets',
@@ -1143,6 +1168,8 @@ class Server {
1143
1168
  shallow: graphOptions.shallow,
1144
1169
  experimentalImportBundleSupport:
1145
1170
  this._config.transformer.experimentalImportBundleSupport,
1171
+ unstable_allowRequireContext:
1172
+ this._config.transformer.unstable_allowRequireContext,
1146
1173
  });
1147
1174
  let revision;
1148
1175
  const revPromise = this._bundler.getRevisionByGraphId(graphId);
@@ -1178,7 +1205,7 @@ class Server {
1178
1205
  transformOptions: TransformInputOptions,
1179
1206
  relativeTo: 'project' | 'server',
1180
1207
  }>,
1181
- ) {
1208
+ ): Promise<string> {
1182
1209
  const resolutionFn = await transformHelpers.getResolveDependencyFn(
1183
1210
  this._bundler.getBundler(),
1184
1211
  transformOptions.platform,
@@ -1240,11 +1267,11 @@ class Server {
1240
1267
  sourceUrl: null,
1241
1268
  };
1242
1269
 
1243
- _getServerRootDir() {
1270
+ _getServerRootDir(): string {
1244
1271
  return this._config.server.unstable_serverRoot ?? this._config.projectRoot;
1245
1272
  }
1246
1273
 
1247
- _getEntryPointAbsolutePath(entryFile: string) {
1274
+ _getEntryPointAbsolutePath(entryFile: string): string {
1248
1275
  return path.resolve(this._getServerRootDir(), entryFile);
1249
1276
  }
1250
1277
 
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ * @format
12
+ *
13
+ */
14
+ const normalModule = require("./subdir-conflict");
15
+
16
+ const contextModule = require.context("./subdir-conflict");
17
+
18
+ function main() {
19
+ return {
20
+ normalModule,
21
+ contextModule: (0, _utils.copyContextToObject)(contextModule),
22
+ };
23
+ }
24
+
25
+ module.exports = main();
@@ -0,0 +1,27 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import type {RequireWithContext} from './utils';
12
+
13
+ import {copyContextToObject} from './utils';
14
+
15
+ declare var require: RequireWithContext;
16
+
17
+ const normalModule = require('./subdir-conflict');
18
+ const contextModule = require.context('./subdir-conflict');
19
+
20
+ function main() {
21
+ return {
22
+ normalModule,
23
+ contextModule: copyContextToObject(contextModule),
24
+ };
25
+ }
26
+
27
+ module.exports = (main(): mixed);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @format
10
+ *
11
+ */
12
+ const empty = require.context("./no-such-dir");
13
+
14
+ function main() {
15
+ try {
16
+ empty("./no-such-file.js");
17
+ } catch (e) {
18
+ return {
19
+ error: {
20
+ message: e.message,
21
+ code: e.code,
22
+ },
23
+ };
24
+ }
25
+
26
+ return null;
27
+ }
28
+
29
+ module.exports = main();
@@ -0,0 +1,26 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import type {RequireWithContext} from './utils';
12
+
13
+ declare var require: RequireWithContext;
14
+
15
+ const empty = require.context('./no-such-dir');
16
+
17
+ function main() {
18
+ try {
19
+ empty('./no-such-file.js');
20
+ } catch (e) {
21
+ return {error: {message: e.message, code: e.code}};
22
+ }
23
+ return null;
24
+ }
25
+
26
+ module.exports = (main(): mixed);
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @format
10
+ *
11
+ */
12
+ const ab = require.context("./subdir", false, /\/(a|b)\.js$/);
13
+
14
+ const abc = require.context("./subdir", false);
15
+
16
+ const abcd = require.context("./subdir", true);
17
+
18
+ function main() {
19
+ return {
20
+ ab: ab.keys(),
21
+ abc: abc.keys(),
22
+ abcd: abcd.keys(),
23
+ };
24
+ }
25
+
26
+ module.exports = main();
@@ -0,0 +1,27 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import type {RequireWithContext} from './utils';
12
+
13
+ declare var require: RequireWithContext;
14
+
15
+ const ab = require.context('./subdir', false, /\/(a|b)\.js$/);
16
+ const abc = require.context('./subdir', false);
17
+ const abcd = require.context('./subdir', true);
18
+
19
+ function main() {
20
+ return {
21
+ ab: ab.keys(),
22
+ abc: abc.keys(),
23
+ abcd: abcd.keys(),
24
+ };
25
+ }
26
+
27
+ module.exports = (main(): mixed);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ * @format
12
+ *
13
+ */
14
+ function main() {
15
+ return (0, _utils.awaitProperties)(
16
+ (0, _utils.copyContextToObject)(
17
+ require.context("./subdir", undefined, undefined, "eager")
18
+ )
19
+ );
20
+ }
21
+
22
+ module.exports = main();
@@ -0,0 +1,24 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import {copyContextToObject, awaitProperties} from './utils';
12
+ import type {RequireWithContext} from './utils';
13
+
14
+ declare var require: RequireWithContext;
15
+
16
+ function main() {
17
+ return awaitProperties(
18
+ copyContextToObject(
19
+ require.context('./subdir', undefined, undefined, 'eager'),
20
+ ),
21
+ );
22
+ }
23
+
24
+ module.exports = (main(): mixed);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ * @format
12
+ *
13
+ */
14
+ function main() {
15
+ return (0, _utils.awaitProperties)(
16
+ (0, _utils.copyContextToObject)(
17
+ require.context("./subdir", undefined, undefined, "lazy-once")
18
+ )
19
+ );
20
+ }
21
+
22
+ module.exports = main();
@@ -0,0 +1,24 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import {copyContextToObject, awaitProperties} from './utils';
12
+ import type {RequireWithContext} from './utils';
13
+
14
+ declare var require: RequireWithContext;
15
+
16
+ function main() {
17
+ return awaitProperties(
18
+ copyContextToObject(
19
+ require.context('./subdir', undefined, undefined, 'lazy-once'),
20
+ ),
21
+ );
22
+ }
23
+
24
+ module.exports = (main(): mixed);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ * @format
12
+ *
13
+ */
14
+ function main() {
15
+ return (0, _utils.awaitProperties)(
16
+ (0, _utils.copyContextToObject)(
17
+ require.context("./subdir", undefined, undefined, "lazy")
18
+ )
19
+ );
20
+ }
21
+
22
+ module.exports = main();
@@ -0,0 +1,24 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import {copyContextToObject, awaitProperties} from './utils';
12
+ import type {RequireWithContext} from './utils';
13
+
14
+ declare var require: RequireWithContext;
15
+
16
+ function main() {
17
+ return awaitProperties(
18
+ copyContextToObject(
19
+ require.context('./subdir', undefined, undefined, 'lazy'),
20
+ ),
21
+ );
22
+ }
23
+
24
+ module.exports = (main(): mixed);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _utils = require("./utils");
4
+
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ * @format
12
+ *
13
+ */
14
+ function main() {
15
+ return (0, _utils.copyContextToObject)(
16
+ require.context("./subdir", undefined, undefined, "sync")
17
+ );
18
+ }
19
+
20
+ module.exports = main();
@@ -0,0 +1,22 @@
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
+ * @flow strict-local
9
+ */
10
+
11
+ import {copyContextToObject} from './utils';
12
+ import type {RequireWithContext} from './utils';
13
+
14
+ declare var require: RequireWithContext;
15
+
16
+ function main() {
17
+ return copyContextToObject(
18
+ require.context('./subdir', undefined, undefined, 'sync'),
19
+ );
20
+ }
21
+
22
+ module.exports = (main(): mixed);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @format
10
+ *
11
+ */
12
+ module.exports = "a";
@@ -0,0 +1,11 @@
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
+ * @flow strict
9
+ */
10
+
11
+ module.exports = 'a';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.default = void 0;
7
+
8
+ /**
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ *
14
+ * @format
15
+ *
16
+ */
17
+ var _default = "b";
18
+ exports.default = _default;
@@ -0,0 +1,11 @@
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
+ * @flow strict
9
+ */
10
+
11
+ export default 'b';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @format
10
+ *
11
+ */
12
+ module.exports = "c";
@@ -0,0 +1,11 @@
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
+ * @flow strict
9
+ */
10
+
11
+ module.exports = 'c';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @format
10
+ *
11
+ */
12
+ module.exports = "d";
@@ -0,0 +1,11 @@
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
+ * @flow strict
9
+ */
10
+
11
+ module.exports = 'd';