metro 0.84.2 → 0.84.4

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 (42) hide show
  1. package/package.json +15 -16
  2. package/src/Assets.js +20 -13
  3. package/src/Assets.js.flow +20 -13
  4. package/src/Bundler/util.js.flow +3 -3
  5. package/src/DeltaBundler/DeltaCalculator.d.ts +1 -11
  6. package/src/DeltaBundler/DeltaCalculator.js +55 -46
  7. package/src/DeltaBundler/DeltaCalculator.js.flow +72 -61
  8. package/src/DeltaBundler/getTransformCacheKey.js +3 -1
  9. package/src/DeltaBundler/getTransformCacheKey.js.flow +7 -2
  10. package/src/HmrServer.d.ts +15 -3
  11. package/src/HmrServer.js +7 -0
  12. package/src/HmrServer.js.flow +15 -5
  13. package/src/ModuleGraph/worker/collectDependencies.js +52 -0
  14. package/src/ModuleGraph/worker/collectDependencies.js.flow +67 -0
  15. package/src/Server.d.ts +4 -1
  16. package/src/Server.js +42 -5
  17. package/src/Server.js.flow +45 -5
  18. package/src/index.d.ts +22 -3
  19. package/src/index.flow.js +2 -2
  20. package/src/index.flow.js.flow +23 -4
  21. package/src/lib/JsonReporter.js.flow +2 -2
  22. package/src/lib/TerminalReporter.js +39 -41
  23. package/src/lib/TerminalReporter.js.flow +51 -32
  24. package/src/lib/getAppendScripts.js.flow +2 -2
  25. package/src/lib/logToConsole.js +8 -7
  26. package/src/lib/logToConsole.js.flow +7 -7
  27. package/src/lib/reporting.js +16 -7
  28. package/src/lib/reporting.js.flow +16 -5
  29. package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +9 -22
  30. package/src/node-haste/DependencyGraph/ModuleResolution.js +4 -22
  31. package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +10 -59
  32. package/src/node-haste/DependencyGraph/createFileMap.js +1 -2
  33. package/src/node-haste/DependencyGraph/createFileMap.js.flow +4 -3
  34. package/src/node-haste/DependencyGraph.d.ts +2 -5
  35. package/src/node-haste/DependencyGraph.js +22 -11
  36. package/src/node-haste/DependencyGraph.js.flow +24 -13
  37. package/src/node-haste/PackageCache.d.ts +12 -16
  38. package/src/node-haste/PackageCache.js +65 -54
  39. package/src/node-haste/PackageCache.js.flow +103 -79
  40. package/src/node-haste/Package.d.ts +0 -28
  41. package/src/node-haste/Package.js +0 -28
  42. package/src/node-haste/Package.js.flow +0 -39
@@ -1,39 +0,0 @@
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
- * @flow strict-local
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- import type {PackageJson} from 'metro-resolver/private/types';
13
-
14
- import fs from 'fs';
15
- import path from 'path';
16
-
17
- export default class Package {
18
- path: string;
19
-
20
- _root: string;
21
- _content: ?PackageJson;
22
-
23
- constructor({file}: {file: string, ...}) {
24
- this.path = path.resolve(file);
25
- this._root = path.dirname(this.path);
26
- this._content = null;
27
- }
28
-
29
- invalidate() {
30
- this._content = null;
31
- }
32
-
33
- read(): PackageJson {
34
- if (this._content == null) {
35
- this._content = JSON.parse(fs.readFileSync(this.path, 'utf8'));
36
- }
37
- return this._content;
38
- }
39
- }