packages/h2/src/index.js
function buildPushManifest (bundles, manifestFilename) {
      const manifestableBundles = filter(bundles, bundle => bundle.module);

      const bundlesByModuleId = chain(manifestableBundles)
        .map(bundle => [ bundle.module.id, bundle ])
        .fromPairs()
        .value();

      const bundleDepGraph = chain(manifestableBundles)
        .map(bundle => {
          const deepDependencyFilenames = map(bundle.module.deepDependencies,
            dependency => bundlesByModuleId[dependency.id].dest
          );
          return [ bundle.dest, deepDependencyFilenames ];
        })
        .fromPairs()
        .value();

      const output = pushManifestPretty ?
        JSON.stringify(bundleDepGraph, null, 2) :
        JSON.stringify(bundleDepGraph);

      return {
        raw: output,
        dest: manifestFilename
      };
    }
function buildPushManifest (bundles, manifestFilename) {
      const manifestableBundles = filter(bundles, bundle => bundle.module);

      const bundlesByModuleId = chain(manifestableBundles)
        .map(bundle => [ bundle.module.id, bundle ])
        .fromPairs()
        .value();

      const bundleDepGraph = chain(manifestableBundles)
        .map(bundle => {
          const deepDependencyFilenames = map(bundle.module.deepDependencies,
            dependency => bundlesByModuleId[dependency.id].dest
          );
          return [ bundle.dest, deepDependencyFilenames ];
        })
        .fromPairs()
        .value();

      const output = pushManifestPretty ?
        JSON.stringify(bundleDepGraph, null, 2) :
        JSON.stringify(bundleDepGraph);

      return {
        raw: output,
        dest: manifestFilename
      };
    }
function buildPushManifest ( bundles , manifestFilename ) { const manifestableBundles = filter ( bundles , bundle => bundle . module ) ; const bundlesByModuleId = chain ( manifestableBundles ) . map ( bundle => [ bundle . module . id , bundle ] ) . fromPairs ( ) . value ( ) ; const bundleDepGraph = chain ( manifestableBundles ) . map ( bundle => { const deepDependencyFilenames = map ( bundle . module . deepDependencies , dependency => bundlesByModuleId [ dependency . id ] . dest ) ; return [ bundle . dest , deepDependencyFilenames ] ; } ) . fromPairs ( ) . value ( ) ; const output = pushManifestPretty ? JSON . stringify ( bundleDepGraph , null , 2 ) : JSON . stringify ( bundleDepGraph ) ; return { raw : output , dest : manifestFilename } ; }
Build a bundle dependency graph, such that when a JS bundle is requested, the server can know what other files will be requested once the bundle loads in the client browser.
Build a bundle dependency graph such that when a JS bundle is requested the server can know what other files will be requested once the bundle loads in the client browser .