code: function patchBundle(bundle: Bundle, delta: DeltaBundle): Bundle {
    const map = new Map(bundle.modules);
  
    for (const [key, value] of delta.modified) {
      map.set(key, value);
    }
  
    for (const [key, value] of delta.added) {
      map.set(key, value);
    }
  
    for (const key of delta.deleted) {
      map.delete(key);
    }
  
    const modules = Array.from(map.entries());
  
    return {
      pre: bundle.pre,
      post: bundle.post,
      modules,
    };
  }
docs: Patches a bundle with a delta.