mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-02 02:08:24 +08:00
This Cl is the output of the following command: npm run install-deps -- dedupe This is an attempt to reduce the amount of disk usage of the node_modules folder. For more information, see https://github.com/eslint/eslint/issues/14098 DISABLE_THIRD_PARTY_CHECK=NPM dedupe R=jacktfranklin@chromium.org Bug: none Change-Id: If482ec6cf6ad1936aab4a7b0ff3e61bf5ea98a8f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2703961 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
97 lines
2.2 KiB
JavaScript
97 lines
2.2 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.File = File;
|
|
exports.Program = Program;
|
|
exports.BlockStatement = BlockStatement;
|
|
exports.Noop = Noop;
|
|
exports.Directive = Directive;
|
|
exports.DirectiveLiteral = DirectiveLiteral;
|
|
exports.InterpreterDirective = InterpreterDirective;
|
|
exports.Placeholder = Placeholder;
|
|
|
|
function File(node) {
|
|
if (node.program) {
|
|
this.print(node.program.interpreter, node);
|
|
}
|
|
|
|
this.print(node.program, node);
|
|
}
|
|
|
|
function Program(node) {
|
|
this.printInnerComments(node, false);
|
|
this.printSequence(node.directives, node);
|
|
if (node.directives && node.directives.length) this.newline();
|
|
this.printSequence(node.body, node);
|
|
}
|
|
|
|
function BlockStatement(node) {
|
|
this.token("{");
|
|
this.printInnerComments(node);
|
|
const hasDirectives = node.directives && node.directives.length;
|
|
|
|
if (node.body.length || hasDirectives) {
|
|
this.newline();
|
|
this.printSequence(node.directives, node, {
|
|
indent: true
|
|
});
|
|
if (hasDirectives) this.newline();
|
|
this.printSequence(node.body, node, {
|
|
indent: true
|
|
});
|
|
this.removeTrailingNewline();
|
|
this.source("end", node.loc);
|
|
if (!this.endsWith("\n")) this.newline();
|
|
this.rightBrace();
|
|
} else {
|
|
this.source("end", node.loc);
|
|
this.token("}");
|
|
}
|
|
}
|
|
|
|
function Noop() {}
|
|
|
|
function Directive(node) {
|
|
this.print(node.value, node);
|
|
this.semicolon();
|
|
}
|
|
|
|
const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
|
|
const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
|
|
|
|
function DirectiveLiteral(node) {
|
|
const raw = this.getPossibleRaw(node);
|
|
|
|
if (raw != null) {
|
|
this.token(raw);
|
|
return;
|
|
}
|
|
|
|
const {
|
|
value
|
|
} = node;
|
|
|
|
if (!unescapedDoubleQuoteRE.test(value)) {
|
|
this.token(`"${value}"`);
|
|
} else if (!unescapedSingleQuoteRE.test(value)) {
|
|
this.token(`'${value}'`);
|
|
} else {
|
|
throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes.");
|
|
}
|
|
}
|
|
|
|
function InterpreterDirective(node) {
|
|
this.token(`#!${node.value}\n`);
|
|
}
|
|
|
|
function Placeholder(node) {
|
|
this.token("%%");
|
|
this.print(node.name);
|
|
this.token("%%");
|
|
|
|
if (node.expectedNode === "Statement") {
|
|
this.semicolon();
|
|
}
|
|
} |