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

Function getModuleLengths

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

Source from the content-addressed store, hash-verified

178 : defaultSizeGetter;
179
180 const getModuleLengths = async ({
181 id,
182 code,
183 }: {
184 id: string;
185 code: string | null;
186 }): Promise<ModuleLengths & { id: string }> => {
187 const isCodeEmpty = code == null || code == "";
188
189 const result = {
190 id,
191 gzipLength: isCodeEmpty ? 0 : await gzipSizeGetter(code),
192 brotliLength: isCodeEmpty ? 0 : await brotliSizeGetter(code),
193 renderedLength: isCodeEmpty ? 0 : Buffer.byteLength(code, "utf-8"),
194 };
195 return result;
196 };
197
198 if (opts.sourcemap && !outputOptions.sourcemap) {
199 this.warn(WARN_SOURCEMAP_DISABLED);

Callers 1

generateBundleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected