зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497839 - Provide method for NetMonitor to use JSX r=jlast
Differential Revision: https://phabricator.services.mozilla.com/D20888 --HG-- rename : devtools/client/debugger/new/build/babel.js => devtools/client/shared/build/babel.js rename : devtools/client/debugger/new/build/copy-module.js => devtools/client/shared/build/build-debugger.js extra : moz-landing-system : lando
This commit is contained in:
Родитель
b7d4901086
Коммит
4222a51e78
|
@ -9,7 +9,7 @@ DIRS += [
|
|||
'src',
|
||||
]
|
||||
|
||||
include('node-templates.mozbuild')
|
||||
include('../../shared/build/node-templates.mozbuild')
|
||||
|
||||
DevToolsModules(
|
||||
'panel.js',
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
@template
|
||||
def DebuggerModules(*modules):
|
||||
# Compute where to put transpiled files into omni.ja package
|
||||
# All DevTools modules are used via resource://devtools/ URI
|
||||
# See devtools/shared/jar.mn for how this resource is mapped into jar package.
|
||||
base = FINAL_TARGET_FILES.chrome.devtools.modules
|
||||
|
||||
# Now, navigate to the right sub-directory into devtools root modules folder
|
||||
for dir in RELATIVEDIR.split('/'):
|
||||
base = base[dir]
|
||||
|
||||
size = 0
|
||||
for m in modules:
|
||||
base += ["!" + m]
|
||||
size += 1
|
||||
|
||||
if size == 0:
|
||||
return
|
||||
|
||||
# For the same reason as https://searchfox.org/mozilla-central/source/mobile/android/base/moz.build#180-184
|
||||
# we have to insert a first entry as recursivemake overrides the first entry and we end up with empty files
|
||||
# for the first file only.
|
||||
outputs = tuple(("node.stub",) + modules)
|
||||
GENERATED_FILES += [outputs]
|
||||
|
||||
bundle = GENERATED_FILES[outputs]
|
||||
bundle.script = '/python/mozbuild/mozbuild/action/node.py:generate'
|
||||
bundle.inputs = ['/devtools/client/debugger/new/build/copy-module.js']
|
||||
bundle.inputs.extend(modules)
|
|
@ -7,6 +7,6 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'setInScopeLines.js',
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'addBreakpoint.js',
|
||||
'breakpointPositions.js',
|
||||
'index.js',
|
||||
|
|
|
@ -11,7 +11,7 @@ DIRS += [
|
|||
'utils',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'ast.js',
|
||||
'debuggee.js',
|
||||
'event-listeners.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'breakOnNext.js',
|
||||
'commands.js',
|
||||
'continueToHere.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'blackbox.js',
|
||||
'index.js',
|
||||
'loadSourceText.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'history.js',
|
||||
'log.js',
|
||||
'promise.js',
|
||||
|
|
|
@ -7,6 +7,6 @@ DIRS += [
|
|||
'middleware',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'create-store.js',
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'commands.js',
|
||||
'create.js',
|
||||
'events.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'commands.js',
|
||||
'create.js',
|
||||
'events.js',
|
||||
|
|
|
@ -8,7 +8,7 @@ DIRS += [
|
|||
'firefox',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'chrome.js',
|
||||
'firefox.js',
|
||||
'index.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
'Popup.js',
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'breakpoints.js',
|
||||
'editor.js',
|
||||
'source.js',
|
||||
|
|
|
@ -8,7 +8,7 @@ DIRS += [
|
|||
'Preview',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'Breakpoint.js',
|
||||
'Breakpoints.js',
|
||||
'ColumnBreakpoint.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
'Outline.js',
|
||||
'OutlineFilter.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'Breakpoint.js',
|
||||
'BreakpointHeading.js',
|
||||
'BreakpointHeadingsContextMenu.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'Frame.js',
|
||||
'FrameIndent.js',
|
||||
'FrameMenu.js',
|
||||
|
|
|
@ -8,7 +8,7 @@ DIRS += [
|
|||
'Frames',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'CommandBar.js',
|
||||
'EventListeners.js',
|
||||
'Expressions.js',
|
||||
|
|
|
@ -10,7 +10,7 @@ DIRS += [
|
|||
'shared',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'A11yIntention.js',
|
||||
'App.js',
|
||||
'ProjectSearch.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'CloseButton.js',
|
||||
'CommandBarButton.js',
|
||||
'index.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'CloseButton.css',
|
||||
'CommandBarButton.css',
|
||||
'PaneToggleButton.css',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
'Button',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'AccessibleImage.js',
|
||||
'Accordion.js',
|
||||
'Badge.js',
|
||||
|
|
|
@ -13,7 +13,7 @@ DIRS += [
|
|||
'workers',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'main.development.js',
|
||||
'main.js',
|
||||
'vendors.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'ast.js',
|
||||
'async-requests.js',
|
||||
'breakpoints.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'breakpointAtLocation.js',
|
||||
'breakpoints.js',
|
||||
'breakpointSources.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'astBreakpointLocation.js',
|
||||
'index.js',
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'create-editor.js',
|
||||
'get-expression.js',
|
||||
'get-token-location.js',
|
||||
|
|
|
@ -10,7 +10,7 @@ DIRS += [
|
|||
'sources-tree',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'assert.js',
|
||||
'ast.js',
|
||||
'asyncStoreHelper.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'annotateFrames.js',
|
||||
'collapseFrames.js',
|
||||
'displayName.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'buildGeneratedBindingList.js',
|
||||
'filtering.js',
|
||||
'findGeneratedBindingFromPosition.js',
|
||||
|
|
|
@ -9,7 +9,7 @@ DIRS += [
|
|||
'scopes',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
'why.js',
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'getScope.js',
|
||||
'getVariables.js',
|
||||
'index.js',
|
||||
|
|
|
@ -7,7 +7,7 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'addToTree.js',
|
||||
'collapseTree.js',
|
||||
'createTree.js',
|
||||
|
|
|
@ -9,6 +9,6 @@ DIRS += [
|
|||
'search',
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
|
||||
)
|
||||
|
|
|
@ -7,6 +7,6 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
)
|
||||
|
|
|
@ -7,6 +7,6 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
)
|
||||
|
|
|
@ -7,6 +7,6 @@ DIRS += [
|
|||
|
||||
]
|
||||
|
||||
DebuggerModules(
|
||||
CompiledModules(
|
||||
'index.js',
|
||||
)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/* 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/>. */
|
||||
/* globals process, __filename, __dirname */
|
||||
|
||||
const Babel = require("./babel");
|
||||
const fs = require("fs");
|
||||
const _path = require("path");
|
||||
const { execFileSync } = require("child_process");
|
||||
|
||||
const EXCLUDED_FILES = {
|
||||
"../assets/panel/debugger.properties": "devtools/shared/flags",
|
||||
"devtools-connection": "devtools/shared/flags",
|
||||
"chrome-remote-interface": "devtools/shared/flags",
|
||||
"devtools-launchpad": "devtools/shared/flags"
|
||||
"devtools-launchpad": "devtools/shared/flags",
|
||||
};
|
||||
|
||||
const mappings = Object.assign(
|
||||
|
@ -46,10 +46,6 @@ function isRequire(t, node) {
|
|||
return node && t.isCallExpression(node) && node.callee.name == "require";
|
||||
}
|
||||
|
||||
function isImport(t, node) {
|
||||
return node && t.isImportDeclaration(node);
|
||||
}
|
||||
|
||||
// List of vendored modules.
|
||||
// Should be synchronized with vendors.js
|
||||
const VENDORS = [
|
||||
|
@ -75,18 +71,18 @@ const moduleMapping = {
|
|||
};
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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++) {
|
||||
let specifier = specifiers[i];
|
||||
const specifier = specifiers[i];
|
||||
const localName = specifier.local.name;
|
||||
if (localName in moduleMapping) {
|
||||
const newImport = t.importDeclaration(
|
||||
|
@ -108,9 +104,9 @@ function updateDevtoolsModulesImport(path, t) {
|
|||
}
|
||||
|
||||
/**
|
||||
* This Babel plugin is used to transpile a single Debugger module into a module that
|
||||
* can be loaded in Firefox via the regular DevTools loader.
|
||||
*/
|
||||
* This Babel plugin is used to transpile a single Debugger module into a module that
|
||||
* can be loaded in Firefox via the regular DevTools loader.
|
||||
*/
|
||||
function transformMC({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
|
@ -195,45 +191,22 @@ function transformMC({ types: t }) {
|
|||
!(value.startsWith("devtools") || mappingValues.includes(value))
|
||||
) {
|
||||
path.replaceWith(t.stringLiteral(`${value}/index`));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Babel.registerPlugin("transform-mc", transformMC);
|
||||
|
||||
function transform(filePath) {
|
||||
const doc = fs.readFileSync(filePath, "utf8");
|
||||
const out = Babel.transform(doc, {
|
||||
plugins: [
|
||||
"transform-flow-strip-types",
|
||||
"syntax-trailing-function-commas",
|
||||
"transform-class-properties",
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-react-jsx",
|
||||
"syntax-object-rest-spread",
|
||||
["transform-mc", { mappings, vendors: VENDORS, filePath }]
|
||||
]
|
||||
});
|
||||
|
||||
return out.code;
|
||||
}
|
||||
|
||||
const deps = [
|
||||
__filename,
|
||||
_path.resolve(__dirname, "babel.js")
|
||||
];
|
||||
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const srcPath = process.argv[i];
|
||||
const code = transform(srcPath);
|
||||
const filePath = _path.basename(srcPath);
|
||||
fs.writeFileSync(filePath, code);
|
||||
deps.push(srcPath);
|
||||
}
|
||||
|
||||
// Print all dependencies prefixed with 'dep:' in order to help node.py, the script that
|
||||
// calls this module, to report back the precise list of all dependencies.
|
||||
console.log(deps.map(file => "dep:" + file).join("\n"));
|
||||
module.exports = function(filePath) {
|
||||
return [
|
||||
"transform-flow-strip-types",
|
||||
"syntax-trailing-function-commas",
|
||||
"transform-class-properties",
|
||||
"transform-es2015-modules-commonjs",
|
||||
"transform-react-jsx",
|
||||
"syntax-object-rest-spread",
|
||||
["transform-mc", { mappings, vendors: VENDORS, filePath }],
|
||||
];
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* 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/>. */
|
||||
/* globals process, __filename, __dirname */
|
||||
|
||||
const Babel = require("./babel");
|
||||
const fs = require("fs");
|
||||
const _path = require("path");
|
||||
|
||||
const defaultPlugins = [
|
||||
"transform-flow-strip-types",
|
||||
"transform-class-properties",
|
||||
"transform-react-jsx",
|
||||
];
|
||||
|
||||
function transform(filePath) {
|
||||
// Use the extra plugins only for the debugger
|
||||
const plugins = filePath.includes("devtools/client/debugger/new")
|
||||
? require("./build-debugger")(filePath)
|
||||
: defaultPlugins;
|
||||
|
||||
const doc = fs.readFileSync(filePath, "utf8");
|
||||
const out = Babel.transform(doc, { plugins });
|
||||
|
||||
return out.code;
|
||||
}
|
||||
|
||||
const deps = [
|
||||
__filename,
|
||||
_path.resolve(__dirname, "babel.js"),
|
||||
];
|
||||
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const srcPath = process.argv[i];
|
||||
const code = transform(srcPath);
|
||||
const filePath = _path.basename(srcPath);
|
||||
fs.writeFileSync(filePath, code);
|
||||
deps.push(srcPath);
|
||||
}
|
||||
|
||||
// Print all dependencies prefixed with 'dep:' in order to help node.py, the script that
|
||||
// calls this module, to report back the precise list of all dependencies.
|
||||
console.log(deps.map(file => "dep:" + file).join("\n"));
|
|
@ -0,0 +1,41 @@
|
|||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
@template
|
||||
def CompiledModules(*modules):
|
||||
# Compute where to put compiled files into omni.ja package
|
||||
# All DevTools modules are used via resource://devtools/ URI
|
||||
# See devtools/shared/jar.mn for how this resource is mapped into jar package.
|
||||
base = FINAL_TARGET_FILES.chrome.devtools.modules
|
||||
|
||||
compiled_directory_whitelist = (
|
||||
"devtools/client/debugger/new/src",
|
||||
)
|
||||
|
||||
if not RELATIVEDIR.startswith(compiled_directory_whitelist):
|
||||
error("File in directory provided to CompiledModules not allowed: " + RELATIVEDIR)
|
||||
|
||||
# Now, navigate to the right sub-directory into devtools root modules folder
|
||||
for dir in RELATIVEDIR.split('/'):
|
||||
base = base[dir]
|
||||
|
||||
size = 0
|
||||
for m in modules:
|
||||
base += ["!" + m]
|
||||
size += 1
|
||||
|
||||
if size == 0:
|
||||
return
|
||||
|
||||
# For the same reason as https://searchfox.org/mozilla-central/source/mobile/android/base/moz.build#180-184
|
||||
# we have to insert a first entry as recursivemake overrides the first entry and we end up with empty files
|
||||
# for the first file only.
|
||||
outputs = tuple(("node.stub",) + modules)
|
||||
GENERATED_FILES += [outputs]
|
||||
|
||||
bundle = GENERATED_FILES[outputs]
|
||||
bundle.script = '/python/mozbuild/mozbuild/action/node.py:generate'
|
||||
bundle.inputs = ['/devtools/client/shared/build/build.js',]
|
||||
bundle.inputs.extend(modules)
|
|
@ -10,7 +10,7 @@ import subprocess
|
|||
import sys
|
||||
|
||||
SCRIPT_ALLOWLIST = [
|
||||
buildconfig.topsrcdir + "/devtools/client/debugger/new/build/copy-module.js"
|
||||
buildconfig.topsrcdir + "/devtools/client/shared/build/build.js"
|
||||
]
|
||||
|
||||
ALLOWLIST_ERROR = '''
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
browser/components/translation/cld2/
|
||||
db/sqlite3/src/
|
||||
devtools/client/shared/build/babel.js
|
||||
devtools/client/shared/sourceeditor/codemirror/
|
||||
devtools/client/shared/sourceeditor/tern/
|
||||
devtools/shared/heapsnapshot/CoreDump.pb.cc
|
||||
|
|
Загрузка…
Ссылка в новой задаче