Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into utili18n
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Nov 2, 2021
2 parents 32fdfe6 + 05e6713 commit e63b7dd
Show file tree
Hide file tree
Showing 7 changed files with 369 additions and 317 deletions.
1 change: 1 addition & 0 deletions build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ async function build(entryPath, distPath, opts = {minify: true}) {
format: 'iife',
sourcemap: DEBUG,
});
await bundle.close();
}

/**
Expand Down
1 change: 1 addition & 0 deletions build/build-lightrider-bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ async function buildStaticServerBundle() {
file: 'dist/lightrider/static-server.js',
format: 'commonjs',
});
await bundle.close();
}

async function run() {
Expand Down
28 changes: 19 additions & 9 deletions build/build-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function buildStandaloneReport() {
file: 'dist/report/standalone.js',
format: 'iife',
});
await bundle.close();
}

async function buildFlowReport() {
Expand Down Expand Up @@ -87,6 +88,7 @@ async function buildFlowReport() {
file: 'dist/report/flow.js',
format: 'iife',
});
await bundle.close();
}

async function buildEsModulesBundle() {
Expand All @@ -101,6 +103,7 @@ async function buildEsModulesBundle() {
file: 'dist/report/bundle.esm.js',
format: 'esm',
});
await bundle.close();
}

async function buildUmdBundle() {
Expand All @@ -121,34 +124,41 @@ async function buildUmdBundle() {
format: 'umd',
name: 'report',
});
await bundle.close();
}

if (require.main === module) {
async function main() {
if (process.argv.length <= 2) {
buildStandaloneReport();
buildFlowReport();
buildEsModulesBundle();
buildUmdBundle();
await Promise.all([
buildStandaloneReport(),
buildFlowReport(),
buildEsModulesBundle(),
buildUmdBundle(),
]);
}

if (process.argv.includes('--psi')) {
console.error('--psi build removed. use --umd instead.');
process.exit(1);
}
if (process.argv.includes('--standalone')) {
buildStandaloneReport();
await buildStandaloneReport();
}
if (process.argv.includes('--flow')) {
buildFlowReport();
await buildFlowReport();
}
if (process.argv.includes('--esm')) {
buildEsModulesBundle();
await buildEsModulesBundle();
}
if (process.argv.includes('--umd')) {
buildUmdBundle();
await buildUmdBundle();
}
}

if (require.main === module) {
main();
}

module.exports = {
buildStandaloneReport,
buildFlowReport,
Expand Down
1 change: 1 addition & 0 deletions build/build-smokehouse-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function build() {
file: bundleOutFile,
format: 'commonjs',
});
await bundle.close();
}

build();
16 changes: 14 additions & 2 deletions lighthouse-core/lib/proto-preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@ function processForProto(lhr) {
// 'ignore unknown fields' in the language of conversion.
if (reportJson.configSettings) {
// The settings that are in both proto and LHR
const {formFactor, locale, onlyCategories, channel} = reportJson.configSettings;
const {
formFactor,
locale,
onlyCategories,
channel,
throttling,
throttlingMethod} = reportJson.configSettings;

// @ts-expect-error - intentionally only a subset of settings.
reportJson.configSettings = {formFactor, locale, onlyCategories, channel};
reportJson.configSettings = {
formFactor,
locale,
onlyCategories,
channel,
throttling,
throttlingMethod};
}

// Remove runtimeError if it is NO_ERROR
Expand Down
29 changes: 28 additions & 1 deletion proto/lighthouse-result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ message LighthouseResult {
map<string, CategoryGroup> category_groups = 11;

// Message containing the configuration settings for the LH run
// Next field number: 6
// Next ID: 9
message ConfigSettings {
// The possible form factors an audit can be run in.
// This enum served the emulated_form_factor field, but in v7, that field
Expand Down Expand Up @@ -158,6 +158,33 @@ message LighthouseResult {
// How Lighthouse was run, e.g. from the Chrome extension or from the npm
// module
string channel = 4;

// Next ID: 7
message ThrottlingSettings {
// The round trip time in milliseconds.
double rtt_ms = 1;

// The network throughput in kilobits per second.
double throughput_kbps = 2;

// The network request latency in milliseconds.
double request_latency_ms = 3;

// The network download throughput in kilobits per second.
double download_throughput_kbps = 4;

// The network upload throughput in kilobits per second.
double upload_throughput_kbps = 5;

// The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>).
double cpu_slowdown_multiplier = 6;
}

// The throttling config settings.
ThrottlingSettings throttling = 7;

// The method used to throttle the network.
string throttling_method = 8;
}

// The settings that were used to run this audit
Expand Down
Loading

0 comments on commit e63b7dd

Please sign in to comment.