From f9408f37adf0635dd497d57893043f6ec8eefd2c Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 6 Dec 2019 20:49:23 -0800 Subject: [PATCH] count lines --- lighthouse-core/computed/bundle-analysis.js | 7 ++----- lighthouse-core/test/fixtures/source-maps/foo.min.js | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lighthouse-core/computed/bundle-analysis.js b/lighthouse-core/computed/bundle-analysis.js index 012df29dea29..20859d17ae76 100644 --- a/lighthouse-core/computed/bundle-analysis.js +++ b/lighthouse-core/computed/bundle-analysis.js @@ -84,7 +84,7 @@ function computeGeneratedFileSizesForCDT(sourceMapData) { // }); continue; } - mappingLength = lastGeneratedColumn - generatedColumn + 0; + mappingLength = lastGeneratedColumn - generatedColumn; } else { // TODO Buffer.byteLength? mappingLength = line.length - generatedColumn; @@ -93,10 +93,7 @@ function computeGeneratedFileSizesForCDT(sourceMapData) { mappedBytes += mappingLength; } - // TODO: remove? - // Don't count newlines as original version didn't count newlines - const totalBytes = content.length - lines.length + 1; - + const totalBytes = content.length; return { files, unmappedBytes: totalBytes - mappedBytes, diff --git a/lighthouse-core/test/fixtures/source-maps/foo.min.js b/lighthouse-core/test/fixtures/source-maps/foo.min.js index b08f1772ef49..c94761626dda 100644 --- a/lighthouse-core/test/fixtures/source-maps/foo.min.js +++ b/lighthouse-core/test/fixtures/source-maps/foo.min.js @@ -1,2 +1,3 @@ !function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){return o(e[i][1][r]||r)}),p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i