MCPcopy Create free account
hub / github.com/btd/rollup-plugin-visualizer / getModuleLengths

Function getModuleLengths

plugin/index.ts:211–227  ·  view source on GitHub ↗
({
        id,
        code,
      }: {
        id: string;
        code: string | null;
      })

Source from the content-addressed store, hash-verified

209 : defaultSizeGetter;
210
211 const getModuleLengths = async ({
212 id,
213 code,
214 }: {
215 id: string;
216 code: string | null;
217 }): Promise<ModuleLengths & { id: string }> => {
218 const isCodeEmpty = code == null || code == "";
219
220 const result = {
221 id,
222 gzipLength: isCodeEmpty ? 0 : await gzipSizeGetter(code),
223 brotliLength: isCodeEmpty ? 0 : await brotliSizeGetter(code),
224 renderedLength: isCodeEmpty ? 0 : Buffer.byteLength(code, "utf-8"),
225 };
226 return result;
227 };
228
229 if (opts.sourcemap && !outputOptions.sourcemap) {
230 this.warn(WARN_SOURCEMAP_DISABLED);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected