Commit e55e98bc authored by Tim van der Lippe's avatar Tim van der Lippe Committed by Commit Bot

Migrate console_counters/ to ESM

- Also upgrade the refactor script to automatically add the
extensionpoint to the BUILD.gn to save myself some typing.

Bug: 1006759
Change-Id: I3f789f96122569141194ce26ac288f01af68f6e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852209Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704600}
parent e23461b9
......@@ -156,7 +156,6 @@ if (!external_devtools_frontend) {
"front_end/console/module.json",
"front_end/console_counters/errorWarningCounter.css",
"front_end/console_counters/module.json",
"front_end/console_counters/WarningErrorCounter.js",
"front_end/console_test_runner/ConsoleTestRunner.js",
"front_end/console_test_runner/module.json",
"front_end/cookie_table/CookiesTable.js",
......@@ -815,6 +814,8 @@ if (!external_devtools_frontend) {
all_devtools_files += lighthouse_locale_files
all_devtools_modules = [
"front_end/console_counters/console_counters.js",
"front_end/console_counters/WarningErrorCounter.js",
"front_end/extensions/extensions.js",
"front_end/extensions/ExtensionAPI.js",
"front_end/extensions/ExtensionPanel.js",
......@@ -1211,6 +1212,8 @@ if (!external_devtools_frontend) {
]
copied_devtools_modules = [
"$resources_out_dir/console_counters/console_counters.js",
"$resources_out_dir/console_counters/WarningErrorCounter.js",
"$resources_out_dir/extensions/extensions.js",
"$resources_out_dir/extensions/ExtensionAPI.js",
"$resources_out_dir/extensions/ExtensionPanel.js",
......
......@@ -6,9 +6,9 @@
* @implements {UI.ToolbarItem.Provider}
* @unrestricted
*/
ConsoleCounters.WarningErrorCounter = class {
export default class WarningErrorCounter {
constructor() {
ConsoleCounters.WarningErrorCounter._instanceForTest = this;
WarningErrorCounter._instanceForTest = this;
const countersWrapper = createElement('div');
this._toolbarItem = new UI.ToolbarItem(countersWrapper);
......@@ -146,4 +146,13 @@ ConsoleCounters.WarningErrorCounter = class {
item() {
return this._toolbarItem;
}
};
}
/* Legacy exported object */
self.ConsoleCounters = self.ConsoleCounters || {};
/* Legacy exported object */
ConsoleCounters = ConsoleCounters || {};
/** @constructor */
ConsoleCounters.WarningErrorCounter = WarningErrorCounter;
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as WarningErrorCounter from './WarningErrorCounter.js';
export {
WarningErrorCounter,
};
......@@ -12,7 +12,9 @@
"ui",
"sdk"
],
"scripts": [
"scripts": [],
"modules": [
"console_counters.js",
"WarningErrorCounter.js"
],
"resources": [
......
......@@ -18,3 +18,4 @@ import './components/components.js';
import './persistence/persistence.js';
import './browser_sdk/browser_sdk.js';
import './extensions/extensions.js';
import './console_counters/console_counters.js';
\ No newline at end of file
......@@ -49,6 +49,10 @@ do
echo "import * as $FILE from './$FILE.js';" >> $MODULE_FILE
done
# Add module entrypoint to GN variables
sed -i -e "s/all\_devtools\_modules = \[/all\_devtools\_modules = \[ \"front\_end\/$1\/$1.js\"\,/" "$BUILD_GN_PATH"
sed -i -e "s/copied\_devtools\_modules = \[/copied\_devtools\_modules = \[ \"\$resources\_out\_dir\/$1\/$1.js\"\,/" "$BUILD_GN_PATH"
echo "" >> $MODULE_FILE
echo "export {" >> $MODULE_FILE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment