Skip to content

Commit

Permalink
clients: convert extension to ES modules (#14181)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Jun 30, 2022
1 parent 133cb9f commit 53a4e3d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
1 change: 0 additions & 1 deletion build/build-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ async function buildEntryPoint() {
rollupPlugins.replace({
'___BROWSER_BRAND___': browserBrand,
}),
rollupPlugins.commonjs(),
rollupPlugins.nodeResolve(),
rollupPlugins.inlineFs({verbose: false}),
rollupPlugins.terser(),
Expand Down
2 changes: 1 addition & 1 deletion clients/extension/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

const SettingsController = require('./settings-controller.js');
import * as SettingsController from './settings-controller.js';

const VIEWER_URL = 'https://googlechrome.github.io/lighthouse/viewer/';
const optionsVisibleClass = 'main--options-visible';
Expand Down
2 changes: 1 addition & 1 deletion clients/extension/scripts/settings-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function loadSettings() {
});
}

module.exports = {
export {
DEFAULT_CATEGORIES,
STORAGE_KEYS,
saveSettings,
Expand Down
File renamed without changes.
11 changes: 5 additions & 6 deletions clients/test/extension/popup-test-pptr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
*/
'use strict';

const path = require('path');
const puppeteer = require('puppeteer-core');
const {getChromePath} = require('chrome-launcher');
const {DEFAULT_CATEGORIES, STORAGE_KEYS} =
require('../../extension/scripts/settings-controller.js');
const {LH_ROOT} = require('../../../root.js');
import path from 'path';
import puppeteer from 'puppeteer-core';
import {getChromePath} from 'chrome-launcher';
import {DEFAULT_CATEGORIES, STORAGE_KEYS} from '../../extension/scripts/settings-controller.js';
import {LH_ROOT} from '../../../root.js';

const lighthouseExtensionPath = path.resolve(LH_ROOT, 'dist/extension-chrome');

Expand Down
6 changes: 3 additions & 3 deletions clients/test/extension/settings-controller-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/
'use strict';

const SettingsController = require('../../extension/scripts/settings-controller.js');
const defaultConfig = require('../../../lighthouse-core/config/default-config.js');
const format = require('../../../shared/localization/format.js');
import * as SettingsController from '../../extension/scripts/settings-controller.js';
import defaultConfig from '../../../lighthouse-core/config/default-config.js';
import * as format from '../../../shared/localization/format.js';

describe('Lighthouse chrome extension SettingsController', () => {
it('default categories should be correct', () => {
Expand Down
4 changes: 0 additions & 4 deletions clients/test/lightrider/package.json

This file was deleted.

0 comments on commit 53a4e3d

Please sign in to comment.