@bundle-stats/utils
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -6,2 +6,5 @@ module.exports = { | ||
modules: false, | ||
useBuiltIns: 'usage', | ||
corejs: 3, | ||
targets: '> 0.25%, not dead', | ||
}], | ||
@@ -8,0 +11,0 @@ ], |
@@ -7,3 +7,3 @@ module.exports = { | ||
targets: { | ||
node: 'current', | ||
node: '8', | ||
}, | ||
@@ -10,0 +10,0 @@ }], |
@@ -18,2 +18,8 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const METRIC_NAME_ALL = 'ALL'; | ||
@@ -25,3 +31,3 @@ const METRIC_NAME_PREFIX = 'totalSizeByType'; | ||
const constructInitialSizeByType = () => _fileTypes.FILE_TYPES.reduce((accumulator, fileType) => ({ ...accumulator, | ||
const constructInitialSizeByType = () => _fileTypes.FILE_TYPES.reduce((accumulator, fileType) => _objectSpread({}, accumulator, { | ||
[getMetricName(fileType)]: { | ||
@@ -36,7 +42,7 @@ value: 0 | ||
const value = accumulator[statName].value + current.size; | ||
return { ...accumulator, | ||
return _objectSpread({}, accumulator, { | ||
[statName]: { | ||
value | ||
} | ||
}; | ||
}); | ||
}, constructInitialSizeByType()); | ||
@@ -50,8 +56,9 @@ | ||
const filteredAssets = assets.filter(isAssetValid); | ||
const stats = { | ||
const stats = _objectSpread({ | ||
[getMetricName(METRIC_NAME_ALL)]: { | ||
value: (0, _sum2.default)((0, _map2.default)(filteredAssets, 'size')) | ||
}, | ||
...calculateTotalByType(filteredAssets) | ||
}; | ||
} | ||
}, calculateTotalByType(filteredAssets)); | ||
return stats; | ||
@@ -58,0 +65,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.array.flat"); | ||
require("core-js/modules/es.array.unscopables.flat"); | ||
@@ -16,2 +18,8 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const IGNORE_PATTERN = /\.map$/; | ||
@@ -51,3 +59,3 @@ /* | ||
} = asset; | ||
return { ...aggregator, | ||
return _objectSpread({}, aggregator, { | ||
[id]: { | ||
@@ -60,3 +68,3 @@ name, | ||
} | ||
}; | ||
}); | ||
}, {}); | ||
@@ -63,0 +71,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -12,2 +14,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const METRICS = { | ||
@@ -42,3 +50,3 @@ 'browsertime.firstPaint': 'statistics.timings.firstPaint.median', | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => ({ ...agg, | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => _objectSpread({}, agg, { | ||
[metricKey]: { | ||
@@ -45,0 +53,0 @@ value: (0, _get2.default)(browsertime, metricPath, 0) |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -24,2 +26,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const RAW_DATA_IDS = ['webpack.stats', 'lighthouse', 'browsertime']; | ||
@@ -38,11 +46,10 @@ /* | ||
return { ...agg | ||
}; | ||
return _objectSpread({}, agg); | ||
}, {}); | ||
const stats = (0, _create.createStats)(baseline && baseline.rawData, data.rawData); | ||
const summary = (0, _createSummary.createStatsSummary)(baseline && baseline.stats, stats); | ||
return { ...data, | ||
return _objectSpread({}, data, { | ||
stats, | ||
summary | ||
}; | ||
}); | ||
}; | ||
@@ -57,5 +64,5 @@ /* | ||
const createJobs = sources => { | ||
const jobs = (0, _reverse2.default)([...sources]).reduce((agg, source, idx) => [{ ...createJob(source, (0, _last2.default)(agg)), | ||
const jobs = (0, _reverse2.default)([...sources]).reduce((agg, source, idx) => [_objectSpread({}, createJob(source, (0, _last2.default)(agg)), { | ||
internalBuildNumber: sources.length - idx | ||
}, ...agg], []); | ||
}), ...agg], []); | ||
return jobs; | ||
@@ -62,0 +69,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -18,2 +20,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getScore = res => { | ||
@@ -39,3 +47,3 @@ const scores = (0, _map2.default)(res.reportCategories, 'score'); | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => ({ ...agg, | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => _objectSpread({}, agg, { | ||
[metricKey]: { | ||
@@ -42,0 +50,0 @@ value: typeof metricPath === 'function' ? metricPath(data) : (0, _get2.default)(data, metricPath, 0) |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
@@ -16,2 +16,8 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getMetricType = (key, type) => { | ||
@@ -22,7 +28,5 @@ const metric = (0, _get2.default)(_metrics.default, key, { | ||
}); | ||
return { ..._metrics.METRIC_TYPES[metric.type], | ||
...metric | ||
}; | ||
return _objectSpread({}, _metrics.METRIC_TYPES[metric.type], {}, metric); | ||
}; | ||
exports.getMetricType = getMetricType; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -18,2 +20,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const mergeWithRuns = (index, count) => (objValue, srcValue) => { | ||
@@ -32,8 +40,7 @@ // if there are no runs, just create an array and fill it with null | ||
const metricsById = runs.reduce((aggregator, run, index) => (0, _mergeWith2.default)(aggregator, run, mergeWithRuns(index, runsCount)), {}); | ||
return (0, _map2.default)(metricsById, (value, key) => ({ | ||
key, | ||
...value | ||
})); | ||
return (0, _map2.default)(metricsById, (value, key) => _objectSpread({ | ||
key | ||
}, value)); | ||
}; | ||
exports.mergeRunsById = mergeRunsById; |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
@@ -14,2 +14,12 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
const getChunkNames = (chunks = [], chunkId) => { | ||
@@ -39,16 +49,18 @@ const chunk = chunks.find(({ | ||
size, | ||
chunks: moduleChunks, | ||
...restModuleProps | ||
} = moduleEntry; | ||
const moduleMetric = { ...restModuleProps, | ||
chunks: moduleChunks | ||
} = moduleEntry, | ||
restModuleProps = _objectWithoutProperties(moduleEntry, ["name", "size", "chunks"]); | ||
const moduleMetric = _objectSpread({}, restModuleProps, { | ||
name, | ||
value: size | ||
}; | ||
}); | ||
const normalizedName = (0, _getModuleName.getModuleName)(name); | ||
return moduleChunks.reduce((aggWithChunks, chunkId) => ({ ...aggWithChunks, | ||
return moduleChunks.reduce((aggWithChunks, chunkId) => _objectSpread({}, aggWithChunks, { | ||
[chunkId]: { | ||
chunkNames: getChunkNames(chunks, chunkId), | ||
modules: { ...(0, _get2.default)(aggWithChunks, [chunkId, 'modules']), | ||
modules: _objectSpread({}, (0, _get2.default)(aggWithChunks, [chunkId, 'modules']), { | ||
[normalizedName]: moduleMetric | ||
} | ||
}) | ||
} | ||
@@ -55,0 +67,0 @@ }), aggregator); |
@@ -12,11 +12,17 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getStatsByMetrics = (stats, metricIds) => metricIds.reduce((agg, metricId) => { | ||
const value = (0, _get2.default)(stats, `${metricId}.value`, 0); | ||
return { ...agg, | ||
return _objectSpread({}, agg, { | ||
[metricId]: { | ||
value | ||
} | ||
}; | ||
}); | ||
}, {}); | ||
exports.getStatsByMetrics = getStatsByMetrics; |
@@ -30,2 +30,12 @@ "use strict"; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const SIZE_METRICS = ['webpack.assets.totalSizeByTypeJS', 'webpack.assets.totalSizeByTypeCSS', 'webpack.assets.totalSizeByTypeIMG', 'webpack.assets.totalSizeByTypeMEDIA', 'webpack.assets.totalSizeByTypeFONT', 'webpack.assets.totalSizeByTypeHTML', 'webpack.assets.totalSizeByTypeOTHER', 'webpack.assets.totalSizeByTypeALL', 'webpack.assets.totalInitialSizeCSS', 'webpack.assets.totalInitialSizeJS']; | ||
@@ -42,3 +52,3 @@ | ||
} = (0, _metrics2.getMetricType)(entry.key, metricType); | ||
return { ...entry, | ||
return _objectSpread({}, entry, { | ||
// Metric props | ||
@@ -56,16 +66,16 @@ biggerIsBetter, | ||
const { | ||
value, | ||
...restRun | ||
} = run; | ||
value | ||
} = run, | ||
restRun = _objectWithoutProperties(run, ["value"]); | ||
const delta = index < runs.length - 1 ? (0, _delta.getDelta)(runs[index + 1], run) : null; | ||
return { ...restRun, | ||
return _objectSpread({}, restRun, { | ||
value, | ||
displayValue: formatter(run.value), | ||
...(delta !== null ? { | ||
delta, | ||
displayDelta: (0, _delta.formatDelta)(delta) | ||
} : {}) | ||
}; | ||
displayValue: formatter(run.value) | ||
}, delta !== null ? { | ||
delta, | ||
displayDelta: (0, _delta.formatDelta)(delta) | ||
} : {}); | ||
}) | ||
}; | ||
}); | ||
}); | ||
@@ -72,0 +82,0 @@ |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
@@ -12,2 +12,8 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const METRIC_NAME_ALL = 'ALL'; | ||
@@ -19,3 +25,3 @@ const METRIC_NAME_PREFIX = 'totalSizeByType'; | ||
const constructInitialSizeByType = () => _fileTypes.FILE_TYPES.reduce((accumulator, fileType) => ({ ...accumulator, | ||
const constructInitialSizeByType = () => _fileTypes.FILE_TYPES.reduce((accumulator, fileType) => _objectSpread({}, accumulator, { | ||
[getMetricName(fileType)]: { | ||
@@ -30,7 +36,7 @@ value: 0 | ||
const value = accumulator[statName].value + current.size; | ||
return { ...accumulator, | ||
return _objectSpread({}, accumulator, { | ||
[statName]: { | ||
value | ||
} | ||
}; | ||
}); | ||
}, constructInitialSizeByType()); | ||
@@ -44,8 +50,9 @@ | ||
const filteredAssets = assets.filter(isAssetValid); | ||
const stats = { | ||
const stats = _objectSpread({ | ||
[getMetricName(METRIC_NAME_ALL)]: { | ||
value: (0, _lodash.sum)((0, _lodash.map)(filteredAssets, 'size')) | ||
}, | ||
...calculateTotalByType(filteredAssets) | ||
}; | ||
} | ||
}, calculateTotalByType(filteredAssets)); | ||
return stats; | ||
@@ -52,0 +59,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.array.flat"); | ||
require("core-js/modules/es.array.unscopables.flat"); | ||
@@ -14,2 +16,8 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const IGNORE_PATTERN = /\.map$/; | ||
@@ -49,3 +57,3 @@ /* | ||
} = asset; | ||
return { ...aggregator, | ||
return _objectSpread({}, aggregator, { | ||
[id]: { | ||
@@ -58,3 +66,3 @@ name, | ||
} | ||
}; | ||
}); | ||
}, {}); | ||
@@ -61,0 +69,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,2 +12,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const METRICS = { | ||
@@ -40,3 +48,3 @@ 'browsertime.firstPaint': 'statistics.timings.firstPaint.median', | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => ({ ...agg, | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => _objectSpread({}, agg, { | ||
[metricKey]: { | ||
@@ -43,0 +51,0 @@ value: (0, _lodash.get)(browsertime, metricPath, 0) |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -16,2 +18,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const RAW_DATA_IDS = ['webpack.stats', 'lighthouse', 'browsertime']; | ||
@@ -30,11 +38,10 @@ /* | ||
return { ...agg | ||
}; | ||
return _objectSpread({}, agg); | ||
}, {}); | ||
const stats = (0, _create.createStats)(baseline && baseline.rawData, data.rawData); | ||
const summary = (0, _createSummary.createStatsSummary)(baseline && baseline.stats, stats); | ||
return { ...data, | ||
return _objectSpread({}, data, { | ||
stats, | ||
summary | ||
}; | ||
}); | ||
}; | ||
@@ -49,5 +56,5 @@ /* | ||
const createJobs = sources => { | ||
const jobs = (0, _lodash.reverse)([...sources]).reduce((agg, source, idx) => [{ ...createJob(source, (0, _lodash.last)(agg)), | ||
const jobs = (0, _lodash.reverse)([...sources]).reduce((agg, source, idx) => [_objectSpread({}, createJob(source, (0, _lodash.last)(agg)), { | ||
internalBuildNumber: sources.length - idx | ||
}, ...agg], []); | ||
}), ...agg], []); | ||
return jobs; | ||
@@ -54,0 +61,0 @@ }; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,2 +12,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getScore = res => { | ||
@@ -31,3 +39,3 @@ const scores = (0, _lodash.map)(res.reportCategories, 'score'); | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => ({ ...agg, | ||
return Object.entries(METRICS).reduce((agg, [metricKey, metricPath]) => _objectSpread({}, agg, { | ||
[metricKey]: { | ||
@@ -34,0 +42,0 @@ value: typeof metricPath === 'function' ? metricPath(data) : (0, _lodash.get)(data, metricPath, 0) |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
@@ -14,2 +14,8 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getMetricType = (key, type) => { | ||
@@ -20,7 +26,5 @@ const metric = (0, _lodash.get)(_metrics.default, key, { | ||
}); | ||
return { ..._metrics.METRIC_TYPES[metric.type], | ||
...metric | ||
}; | ||
return _objectSpread({}, _metrics.METRIC_TYPES[metric.type], {}, metric); | ||
}; | ||
exports.getMetricType = getMetricType; |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -10,2 +12,8 @@ value: true | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const mergeWithRuns = (index, count) => (objValue, srcValue) => { | ||
@@ -24,8 +32,7 @@ // if there are no runs, just create an array and fill it with null | ||
const metricsById = runs.reduce((aggregator, run, index) => (0, _lodash.mergeWith)(aggregator, run, mergeWithRuns(index, runsCount)), {}); | ||
return (0, _lodash.map)(metricsById, (value, key) => ({ | ||
key, | ||
...value | ||
})); | ||
return (0, _lodash.map)(metricsById, (value, key) => _objectSpread({ | ||
key | ||
}, value)); | ||
}; | ||
exports.mergeRunsById = mergeRunsById; |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
@@ -12,2 +12,12 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
const getChunkNames = (chunks = [], chunkId) => { | ||
@@ -37,16 +47,18 @@ const chunk = chunks.find(({ | ||
size, | ||
chunks: moduleChunks, | ||
...restModuleProps | ||
} = moduleEntry; | ||
const moduleMetric = { ...restModuleProps, | ||
chunks: moduleChunks | ||
} = moduleEntry, | ||
restModuleProps = _objectWithoutProperties(moduleEntry, ["name", "size", "chunks"]); | ||
const moduleMetric = _objectSpread({}, restModuleProps, { | ||
name, | ||
value: size | ||
}; | ||
}); | ||
const normalizedName = (0, _getModuleName.getModuleName)(name); | ||
return moduleChunks.reduce((aggWithChunks, chunkId) => ({ ...aggWithChunks, | ||
return moduleChunks.reduce((aggWithChunks, chunkId) => _objectSpread({}, aggWithChunks, { | ||
[chunkId]: { | ||
chunkNames: getChunkNames(chunks, chunkId), | ||
modules: { ...(0, _lodash.get)(aggWithChunks, [chunkId, 'modules']), | ||
modules: _objectSpread({}, (0, _lodash.get)(aggWithChunks, [chunkId, 'modules']), { | ||
[normalizedName]: moduleMetric | ||
} | ||
}) | ||
} | ||
@@ -53,0 +65,0 @@ }), aggregator); |
@@ -10,11 +10,17 @@ "use strict"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const getStatsByMetrics = (stats, metricIds) => metricIds.reduce((agg, metricId) => { | ||
const value = (0, _lodash.get)(stats, `${metricId}.value`, 0); | ||
return { ...agg, | ||
return _objectSpread({}, agg, { | ||
[metricId]: { | ||
value | ||
} | ||
}; | ||
}); | ||
}, {}); | ||
exports.getStatsByMetrics = getStatsByMetrics; |
"use strict"; | ||
require("core-js/modules/es.array.flat-map"); | ||
require("core-js/modules/es.array.unscopables.flat-map"); | ||
@@ -24,2 +26,12 @@ | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const SIZE_METRICS = ['webpack.assets.totalSizeByTypeJS', 'webpack.assets.totalSizeByTypeCSS', 'webpack.assets.totalSizeByTypeIMG', 'webpack.assets.totalSizeByTypeMEDIA', 'webpack.assets.totalSizeByTypeFONT', 'webpack.assets.totalSizeByTypeHTML', 'webpack.assets.totalSizeByTypeOTHER', 'webpack.assets.totalSizeByTypeALL', 'webpack.assets.totalInitialSizeCSS', 'webpack.assets.totalInitialSizeJS']; | ||
@@ -36,3 +48,3 @@ | ||
} = (0, _metrics2.getMetricType)(entry.key, metricType); | ||
return { ...entry, | ||
return _objectSpread({}, entry, { | ||
// Metric props | ||
@@ -50,16 +62,16 @@ biggerIsBetter, | ||
const { | ||
value, | ||
...restRun | ||
} = run; | ||
value | ||
} = run, | ||
restRun = _objectWithoutProperties(run, ["value"]); | ||
const delta = index < runs.length - 1 ? (0, _delta.getDelta)(runs[index + 1], run) : null; | ||
return { ...restRun, | ||
return _objectSpread({}, restRun, { | ||
value, | ||
displayValue: formatter(run.value), | ||
...(delta !== null ? { | ||
delta, | ||
displayDelta: (0, _delta.formatDelta)(delta) | ||
} : {}) | ||
}; | ||
displayValue: formatter(run.value) | ||
}, delta !== null ? { | ||
delta, | ||
displayDelta: (0, _delta.formatDelta)(delta) | ||
} : {}); | ||
}) | ||
}; | ||
}); | ||
}); | ||
@@ -66,0 +78,0 @@ |
"use strict"; | ||
require("core-js/modules/es.array.iterator"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
"use strict"; | ||
require("core-js/modules/es.string.replace"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -4,0 +6,0 @@ value: true |
{ | ||
"name": "@bundle-stats/utils", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "BundleStats utils", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151189
3668