MCPcopy Index your code
hub / github.com/developit/optimize-plugin / generatePolyfillsChunkCached

Method generatePolyfillsChunkCached

src/index.js:226–243  ·  view source on GitHub ↗
(polyfills, cwd, polyfillsFilename, timings)

Source from the content-addressed store, hash-verified

224 }
225
226 async generatePolyfillsChunkCached (polyfills, cwd, polyfillsFilename, timings) {
227 const polyfillsKey = polyfills.join('\n');
228
229 let generatePolyfills = this.polyfillsCache.get(polyfillsKey);
230 if (!generatePolyfills) {
231 generatePolyfills = this.generatePolyfillsChunk(polyfills, cwd, timings);
232 this.polyfillsCache.set(polyfillsKey, generatePolyfills);
233 }
234
235 const output = await generatePolyfills;
236
237 return new SourceMapSource(
238 output.code,
239 polyfillsFilename,
240 // @ts-ignore
241 output.map
242 );
243 }
244
245 /**
246 * @todo Write cached polyfills chunk to disk

Callers 1

optimizeMethod · 0.95

Calls 1

Tested by

no test coverage detected