зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1874363 - [devtools] Remove build-debugger mapping mechanism. r=devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D198422
This commit is contained in:
Родитель
ff3e8c83b5
Коммит
710949d857
|
@ -8,10 +8,6 @@ const Babel = require("./babel");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const _path = require("path");
|
const _path = require("path");
|
||||||
|
|
||||||
const mappings = {};
|
|
||||||
|
|
||||||
const mappingValues = Object.values(mappings);
|
|
||||||
|
|
||||||
function isRequire(t, node) {
|
function isRequire(t, node) {
|
||||||
return node && t.isCallExpression(node) && node.callee.name == "require";
|
return node && t.isCallExpression(node) && node.callee.name == "require";
|
||||||
}
|
}
|
||||||
|
@ -53,12 +49,6 @@ function transformMC({ types: t }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle require() to files mapped to other mozilla-central files.
|
|
||||||
if (Object.keys(mappings).includes(value)) {
|
|
||||||
path.replaceWith(t.stringLiteral(mappings[value]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle implicit index.js requires:
|
// Handle implicit index.js requires:
|
||||||
// in a node environment, require("my/folder") will automatically load
|
// in a node environment, require("my/folder") will automatically load
|
||||||
// my/folder/index.js if available. The DevTools load does not handle
|
// my/folder/index.js if available. The DevTools load does not handle
|
||||||
|
@ -71,7 +61,7 @@ function transformMC({ types: t }) {
|
||||||
!exists &&
|
!exists &&
|
||||||
!value.endsWith("index") &&
|
!value.endsWith("index") &&
|
||||||
!value.endsWith(".jsm") &&
|
!value.endsWith(".jsm") &&
|
||||||
!(value.startsWith("devtools") || mappingValues.includes(value))
|
!value.startsWith("devtools")
|
||||||
) {
|
) {
|
||||||
value = `${value}/index`;
|
value = `${value}/index`;
|
||||||
path.replaceWith(t.stringLiteral(value));
|
path.replaceWith(t.stringLiteral(value));
|
||||||
|
@ -134,6 +124,6 @@ module.exports = function (filePath) {
|
||||||
return [
|
return [
|
||||||
"proposal-class-properties",
|
"proposal-class-properties",
|
||||||
"transform-modules-commonjs",
|
"transform-modules-commonjs",
|
||||||
["transform-mc", { mappings, filePath }],
|
["transform-mc", { filePath }],
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче