Bug 1668117 - [devtools] remove devtools-contextmenu and devtools-modules from debugger vendors r=nchevobbe
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 02 Oct 2020 15:40:04 +0000
changeset 551348 b1da49c81d0ca950d5fbdd5452e7779b614cc8e8
parent 551347 26b597ec35bb6a9e0da25cfb58a70d2504e48d18
child 551349 6fcccce2d45e1aaa2a8a015f724ffa401be2676e
push id37830
push usernbeleuzu@mozilla.com
push dateSat, 03 Oct 2020 10:23:35 +0000
treeherdermozilla-central@7d7faf0b6d7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1668117
milestone83.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1668117 - [devtools] remove devtools-contextmenu and devtools-modules from debugger vendors r=nchevobbe Depends on D92027 Differential Revision: https://phabricator.services.mozilla.com/D92028
devtools/client/debugger/src/vendors.js
devtools/client/shared/build/build-debugger.js
--- a/devtools/client/debugger/src/vendors.js
+++ b/devtools/client/debugger/src/vendors.js
@@ -15,19 +15,17 @@
  *
  * Both are fine, but cannot be mixed for the same module.
  */
 
 // Modules imported with destructuring
 import * as devtoolsComponents from "devtools-components";
 // $FlowIgnore
 import * as devtoolsConfig from "devtools-config";
-import * as devtoolsContextmenu from "devtools-contextmenu";
 import * as devtoolsEnvironment from "devtools-environment";
-import * as devtoolsModules from "devtools-modules";
 import * as devtoolsUtils from "devtools-utils";
 import * as fuzzaldrinPlus from "fuzzaldrin-plus";
 import * as transition from "react-transition-group/Transition";
 import * as reactAriaComponentsTabs from "react-aria-components/src/tabs";
 
 // Modules imported without destructuring
 import classnames from "classnames";
 import devtoolsSplitter from "devtools-splitter";
@@ -36,18 +34,16 @@ import move from "lodash-move";
 // We cannot directly export literals containing special characters
 // (eg. "my-module/Test") which is why they are nested in "vendored".
 // The keys of the vendored object should match the module names
 // !!! Should remain synchronized with .babel/transform-mc.js !!!
 export const vendored = {
   classnames,
   "devtools-components": devtoolsComponents,
   "devtools-config": devtoolsConfig,
-  "devtools-contextmenu": devtoolsContextmenu,
   "devtools-environment": devtoolsEnvironment,
-  "devtools-modules": devtoolsModules,
   "devtools-splitter": devtoolsSplitter,
   "devtools-utils": devtoolsUtils,
   "fuzzaldrin-plus": fuzzaldrinPlus,
   "lodash-move": move,
   "react-aria-components/src/tabs": reactAriaComponentsTabs,
   "react-transition-group/Transition": transition,
 };
--- a/devtools/client/shared/build/build-debugger.js
+++ b/devtools/client/shared/build/build-debugger.js
@@ -50,68 +50,26 @@ function isRequire(t, node) {
 }
 
 // List of vendored modules.
 // Should be synchronized with vendors.js
 const VENDORS = [
   "classnames",
   "devtools-components",
   "devtools-config",
-  "devtools-contextmenu",
   "devtools-environment",
-  "devtools-modules",
   "devtools-splitter",
   "devtools-utils",
   "fuzzaldrin-plus",
   "lodash-move",
   "react-aria-components/src/tabs",
   "react-transition-group/Transition",
   "Svg",
 ];
 
-const moduleMapping = {
-  Telemetry: "devtools/client/shared/telemetry",
-  PluralForm: "devtools/shared/plural-form",
-  DevToolsUtils: "devtools/shared/DevToolsUtils",
-  AppConstants: "resource://gre/modules/AppConstants.jsm",
-};
-
-/*
- * Updates devtools-modules imports such as
- * `import { Telemetry } from "devtools-modules"`
- * so that we can customize how we resolve certain modules in the package
- *
- * In the case of multiple declarations we need to move
- * the telemetry module into its own import.
- */
-function updateDevtoolsModulesImport(path, t) {
-  const specifiers = path.node.specifiers;
-
-  for (let i = 0; i < specifiers.length; i++) {
-    const specifier = specifiers[i];
-    const localName = specifier.local.name;
-    if (localName in moduleMapping) {
-      const newImport = t.importDeclaration(
-        [t.importDefaultSpecifier(specifier.local)],
-        t.stringLiteral(moduleMapping[localName])
-      );
-
-      if (specifiers.length > 1) {
-        path.insertAfter(newImport);
-        specifiers.splice(i, 1);
-      } else if (path.node.source) {
-        // Note we don't want to update import `Telemetry from "devtools-modules"`
-        if (path.node.specifiers[0].type !== "ImportDefaultSpecifier") {
-          path.replaceWith(newImport);
-        }
-      }
-    }
-  }
-}
-
 function shouldLazyLoad(value) {
   return (
     !value.includes("vendors") &&
     !value.includes("codemirror/") &&
     !value.endsWith(".properties") &&
     !value.startsWith("devtools/") &&
     // XXX: the lazyRequire rewriter (in transformMC) fails for this module, it
     // evaluates `t.thisExpression()` as `void 0` instead of `this`. But the
@@ -130,20 +88,16 @@ function transformMC({ types: t }) {
   return {
     visitor: {
       ModuleDeclaration(path, state) {
         const source = path.node.source;
         const value = source && source.value;
         if (value && value.includes(".css")) {
           path.remove();
         }
-
-        if (value && value == "devtools-modules") {
-          updateDevtoolsModulesImport(path, t);
-        }
       },
 
       StringLiteral(path, state) {
         const { filePath } = state.opts;
         let value = path.node.value;
 
         if (!isRequire(t, path.parent)) {
           return;