summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance-new
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/performance-new')
-rw-r--r--devtools/client/performance-new/@types/gecko.d.ts2
-rw-r--r--devtools/client/performance-new/aboutprofiling/initializer.js4
-rw-r--r--devtools/client/performance-new/panel/initializer.js4
-rw-r--r--devtools/client/performance-new/shared/#typescript-lazy-load.jsm.js#55
-rw-r--r--devtools/client/performance-new/tsconfig.json7
5 files changed, 11 insertions, 61 deletions
diff --git a/devtools/client/performance-new/@types/gecko.d.ts b/devtools/client/performance-new/@types/gecko.d.ts
index f5da78697e..682db32c13 100644
--- a/devtools/client/performance-new/@types/gecko.d.ts
+++ b/devtools/client/performance-new/@types/gecko.d.ts
@@ -28,7 +28,7 @@ declare namespace MockedExports {
"resource://devtools/shared/loader/Loader.sys.mjs": typeof import("resource://devtools/shared/loader/Loader.sys.mjs");
"resource://devtools/client/performance-new/shared/background.sys.mjs": typeof import("resource://devtools/client/performance-new/shared/background.sys.mjs");
"resource://devtools/client/performance-new/shared/symbolication.sys.mjs": typeof import("resource://devtools/client/performance-new/shared/symbolication.sys.mjs");
- "resource://devtools/shared/loader/browser-loader.js": any;
+ "resource://devtools/shared/loader/browser-loader.sys.mjs": any;
"resource://devtools/client/performance-new/popup/menu-button.sys.mjs": typeof import("resource://devtools/client/performance-new/popup/menu-button.sys.mjs");
"resource://devtools/client/performance-new/shared/typescript-lazy-load.sys.mjs": typeof import("resource://devtools/client/performance-new/shared/typescript-lazy-load.sys.mjs");
"resource://devtools/client/performance-new/popup/logic.sys.mjs": typeof import("resource://devtools/client/performance-new/popup/logic.sys.mjs");
diff --git a/devtools/client/performance-new/aboutprofiling/initializer.js b/devtools/client/performance-new/aboutprofiling/initializer.js
index 8dd854007c..2e99ca0a3a 100644
--- a/devtools/client/performance-new/aboutprofiling/initializer.js
+++ b/devtools/client/performance-new/aboutprofiling/initializer.js
@@ -19,8 +19,8 @@
// TypeScript. See devtools/client/performance-new/typescript.md and
// the section on "Do not overload require" for more information.
- const { BrowserLoader } = ChromeUtils.import(
- "resource://devtools/shared/loader/browser-loader.js"
+ const { BrowserLoader } = ChromeUtils.importESModule(
+ "resource://devtools/shared/loader/browser-loader.sys.mjs"
);
const browserLoader = BrowserLoader({
baseURI: "resource://devtools/client/performance-new/aboutprofiling",
diff --git a/devtools/client/performance-new/panel/initializer.js b/devtools/client/performance-new/panel/initializer.js
index 2264e4764f..25a2176a36 100644
--- a/devtools/client/performance-new/panel/initializer.js
+++ b/devtools/client/performance-new/panel/initializer.js
@@ -23,8 +23,8 @@
// TypeScript. See devtools/client/performance-new/typescript.md and
// the section on "Do not overload require" for more information.
- const { BrowserLoader } = ChromeUtils.import(
- "resource://devtools/shared/loader/browser-loader.js"
+ const { BrowserLoader } = ChromeUtils.importESModule(
+ "resource://devtools/shared/loader/browser-loader.sys.mjs"
);
const browserLoader = BrowserLoader({
baseURI: "resource://devtools/client/performance-new/",
diff --git a/devtools/client/performance-new/shared/#typescript-lazy-load.jsm.js# b/devtools/client/performance-new/shared/#typescript-lazy-load.jsm.js#
deleted file mode 100644
index de982cc3ff..0000000000
--- a/devtools/client/performance-new/shared/#typescript-lazy-load.jsm.js#
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-// @ts-check
-"use strict";
-
-/**
- * TypeScript can't understand the lazyRequireGetter mechanism, due to how it defines
- * properties as a getter. This function, instead provides lazy loading in a
- * TypeScript-friendly manner. It applies the lazy load memoization to each property
- * of the provided object.
- *
- * Example usage:
- *
- * const lazy = createLazyLoaders({
- * moduleA: () => require("module/a"),
- * moduleB: () => require("module/b"),
- * });
- *
- * Later:
- *
- * const moduleA = lazy.moduleA();
- * const { objectInModuleB } = lazy.moduleB();
- *
- * @template {{ [key: string]: () => any }} T
- * @param {T} definition - An object where each property has a function that loads a module.
- * @returns {T} - The load memoized version of T.
- */
-function createLazyLoaders(definition) {
- /** @type {any} */
- const result = {};
- for (const [key, callback] of Object.entries(definition)) {
- /** @type {any} */
- let cache;
- result[key] = () => {
- if (cache === undefined) {
- cache = callback();
- }
- return cache;
- };
- }
- return result;
-}
-
-// Provide an exports object for the JSM to be properly read by TypeScript.
-/** @type {any} */
-var module = {};
-
-module.exports = {
- createLazyLoaders,
-};
-
-// Object.keys() confuses the linting which expects a static array expression.
-// eslint-disable-next-line
-var EXPORTED_SYMBOLS = Object.keys(module.exports);
diff --git a/devtools/client/performance-new/tsconfig.json b/devtools/client/performance-new/tsconfig.json
index f98b4b33d4..80bababd37 100644
--- a/devtools/client/performance-new/tsconfig.json
+++ b/devtools/client/performance-new/tsconfig.json
@@ -14,7 +14,12 @@
"noEmit": true,
// Allow esnext syntax. Otherwise the default is ES5 only.
"target": "esnext",
- "lib": ["esnext", "dom"]
+ "lib": ["esnext", "dom"],
+ // Make sure that only this project is taken into account when checking types.
+ // In the future we'll want to use the same types as in the rest of Gecko, but
+ // that's not ready yet.
+ // See Bug 1891209
+ "typeRoots": ["./@types", "./node_modules/@types"]
},
"files": ["./@types/gecko.d.ts"],
// Add a @ts-check comment to a JS file to start type checking it.