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
    
  8.  */
    
  9. 
    
  10. export type ImportManifestEntry = {
    
  11.   id: string,
    
  12.   // chunks is a double indexed array of chunkId / chunkFilename pairs
    
  13.   chunks: Array<string>,
    
  14.   name: string,
    
  15. };
    
  16. 
    
  17. // This is the parsed shape of the wire format which is why it is
    
  18. // condensed to only the essentialy information
    
  19. export type ImportMetadata =
    
  20.   | [
    
  21.       /* id */ string,
    
  22.       /* chunks id/filename pairs, double indexed */ Array<string>,
    
  23.       /* name */ string,
    
  24.       /* async */ 1,
    
  25.     ]
    
  26.   | [
    
  27.       /* id */ string,
    
  28.       /* chunks id/filename pairs, double indexed */ Array<string>,
    
  29.       /* name */ string,
    
  30.     ];
    
  31. 
    
  32. export const ID = 0;
    
  33. export const CHUNKS = 1;
    
  34. export const NAME = 2;
    
  35. // export const ASYNC = 3;
    
  36. 
    
  37. // This logic is correct because currently only include the 4th tuple member
    
  38. // when the module is async. If that changes we will need to actually assert
    
  39. // the value is true. We don't index into the 4th slot because flow does not
    
  40. // like the potential out of bounds access
    
  41. export function isAsyncImport(metadata: ImportMetadata): boolean {
    
  42.   return metadata.length === 4;
    
  43. }