Skip to content

Commit

Permalink
core: add flow methods to cjs entry (#15045)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed May 4, 2023
1 parent b36b213 commit f5606ad
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/test/smokehouse/test-definitions/dobetterweb.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ const expectations = {
},
},
'metrics': {
// Flaky in DevTools
_excludeRunner: 'devtools',
details: {items: {0: {
timeToFirstByte: '450+/-100',
lcpLoadStart: '7750+/-500',
Expand Down
28 changes: 28 additions & 0 deletions core/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,33 @@ const legacyNavigation = async function legacyNavigation(...args) {
return legacyNavigation(...args);
};

/** @type {import('./index.js')['startFlow']} */
const startFlow = async function startFlow(...args) {
const {startFlow} = await import('./index.js');
return startFlow(...args);
};

/** @type {import('./index.js')['navigation']} */
const navigation = async function navigation(...args) {
const {navigation} = await import('./index.js');
return navigation(...args);
};

/** @type {import('./index.js')['startTimespan']} */
const startTimespan = async function startTimespan(...args) {
const {startTimespan} = await import('./index.js');
return startTimespan(...args);
};

/** @type {import('./index.js')['snapshot']} */
const snapshot = async function snapshot(...args) {
const {snapshot} = await import('./index.js');
return snapshot(...args);
};

module.exports = lighthouse;
module.exports.legacyNavigation = legacyNavigation;
module.exports.startFlow = startFlow;
module.exports.navigation = navigation;
module.exports.startTimespan = startTimespan;
module.exports.snapshot = snapshot;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build-extension-firefox": "node ./build/build-extension.js firefox",
"build-devtools": "yarn reset-link && node ./build/build-bundle.js clients/devtools/devtools-entry.js dist/lighthouse-dt-bundle.js && node ./build/build-dt-report-resources.js",
"build-smokehouse-bundle": "node ./build/build-smokehouse-bundle.js",
"build-lr": "yarn reset-link && node ./build/build-lightrider-bundles.js",
"build-lr": "yarn reset-link && node --max-old-space-size=4096 ./build/build-lightrider-bundles.js",
"build-pack": "bash build/build-pack.sh",
"build-report": "node build/build-report-components.js && node build/build-report.js",
"build-sample-reports": "yarn build-report && node build/build-sample-reports.js",
Expand Down

0 comments on commit f5606ad

Please sign in to comment.