Updated 4 files and added 1725 files (automated)

mane
Mia Raindrops 4 weeks ago
parent 21b1d34b71
commit d23fe2e21d
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -2,12 +2,6 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
if (str_starts_with($_GET["_"], "ogo") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"]))) {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
die(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
}
$id = $_GET["_"];
$data = parseId($id);

@ -76,7 +76,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
<?php if ($request["type"] === "galleryupload"): ?>
<p><img src="/uploads/<?= $request["_id"] ?>.jpg" style="max-width: 30vw; max-height: 30vh;"></p>
<?php elseif(isset($request["contents"]) && trim($request["contents"]) !== ""): ?>
<iframe style="width: 100%; background: white;" src="data:text/html;base64,<?= base64_encode("<html><head><meta charset='utf-8'></head><body>" . $request["contents"] . "</body></html>") ?>"></iframe>
<div style="max-height: 300px; overflow: auto; background-color: rgba(0, 0, 0, .25); padding: 5px 10px; border-radius: 10px; margin-bottom: 20px;">
<?= $request["contents"] ?>
</div>
<?php else: ?>
<pre>[No contents provided]</pre>
<?php endif; ?>

@ -90,7 +90,7 @@ function initLang(): void {
initLang();
function getSearchEntries($ignoreProfiles = false) {
function getSearchEntries($ignoreProfiles = false, $addRequests = false) {
$entries = [
...array_map(function ($i) {
$id = substr($i, 0, -5);
@ -151,10 +151,44 @@ function getSearchEntries($ignoreProfiles = false) {
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return str_ends_with($i, ".json"); }))));
}
if ($addRequests) {
array_push($entries, ...array_map(function ($i) {
$id = substr($i, 0, -5);
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $i), true);
return [
"id" => $id,
"type" => "requests",
"url" => null,
"alts" => [],
"name" => $id,
"extract" => null
];
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests"), function ($i) { return str_ends_with($i, ".json"); }))));
}
return $entries;
}
function search($query, $ignoreExact = false, $ignoreProfiles = false): array {
function search($query, $ignoreExact = false, $ignoreProfiles = false) {
$result = [];
$id = "/tmp/query-" . uuid() . ".json";
file_put_contents($id, json_encode([
"entries" => getSearchEntries($ignoreProfiles),
"query" => $query,
"exact" => !$ignoreExact
]));
exec('"' . $_SERVER['DOCUMENT_ROOT'] . '/includes/search/build/search-linux-x64" "' . $id . '"', $result);
$results = json_decode(implode("\n", $result), true);
unlink($id);
return array_values($results);
}
function search_old($query, $ignoreExact = false, $ignoreProfiles = false): array {
$entries = getSearchEntries($ignoreProfiles);
$scored = array_map(function ($i) use ($query, $ignoreExact) {

@ -274,7 +274,7 @@ foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/uploads/"), function
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive");
foreach (getSearchEntries() as $entry) {
foreach (getSearchEntries(false, true) as $entry) {
$data = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $entry["type"] . "/" . $entry["id"] . ".json");
if (str_contains($data, $upload) || $entry["id"] === explode(".", $upload)[0]) {
@ -282,7 +282,7 @@ foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/uploads/"), function
}
}
if (!$used) {
if (!$used && time() - filemtime($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $upload) > 3600) {
println(" " . $upload);
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $upload, $_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $upload);
}

@ -0,0 +1,34 @@
const Fuse = require('fuse.js');
const fs = require('fs');
const entries = JSON.parse(fs.readFileSync(process.argv[2]).toString())["entries"];
const query = JSON.parse(fs.readFileSync(process.argv[2]).toString())["query"];
const allowExactMatch = JSON.parse(fs.readFileSync(process.argv[2]).toString())["exact"];
let fuse = new Fuse(entries, {
includeScore: true,
findAllMatches: true,
keys: [
{
name: "name",
weight: 0.7
},
{
name: "alts",
weight: 0.5
},
{
name: "extract",
weight: 0.3
}
]
});
let results = fuse.search(query);
console.log(JSON.stringify(results.map(i => {
return {
score: i.score,
breakdown: [],
value: i.item
}
}).filter(i => allowExactMatch || (!allowExactMatch && i.value.name.toLowerCase() !== query.toLowerCase()))));

@ -0,0 +1 @@
../jsesc/bin/jsesc

@ -0,0 +1 @@
../@babel/parser/bin/babel-parser.js

@ -0,0 +1 @@
../pkg/lib-es5/bin.js

@ -0,0 +1 @@
../pkg-fetch/lib-es5/bin.js

@ -0,0 +1 @@
../prebuild-install/bin.js

@ -0,0 +1 @@
../rc/cli.js

@ -0,0 +1 @@
../resolve/bin/resolve

@ -0,0 +1 @@
../semver/bin/semver.js

File diff suppressed because it is too large Load Diff

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,19 @@
# @babel/generator
> Turns an AST into code.
See our website [@babel/generator](https://babeljs.io/docs/en/babel-generator) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/generator
```
or using yarn:
```sh
yarn add @babel/generator --dev
```

@ -0,0 +1,254 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function SourcePos() {
return {
identifierName: undefined,
line: undefined,
column: undefined,
filename: undefined
};
}
const SPACES_RE = /^[ \t]+$/;
class Buffer {
constructor(map) {
this._map = null;
this._buf = "";
this._last = 0;
this._queue = [];
this._position = {
line: 1,
column: 0
};
this._sourcePosition = SourcePos();
this._disallowedPop = null;
this._map = map;
}
get() {
this._flush();
const map = this._map;
const result = {
code: this._buf.trimRight(),
decodedMap: map == null ? void 0 : map.getDecoded(),
get map() {
return result.map = map ? map.get() : null;
},
set map(value) {
Object.defineProperty(result, "map", {
value,
writable: true
});
},
get rawMappings() {
return result.rawMappings = map == null ? void 0 : map.getRawMappings();
},
set rawMappings(value) {
Object.defineProperty(result, "rawMappings", {
value,
writable: true
});
}
};
return result;
}
append(str) {
this._flush();
const {
line,
column,
filename,
identifierName
} = this._sourcePosition;
this._append(str, line, column, identifierName, filename);
}
queue(str) {
if (str === "\n") {
while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {
this._queue.shift();
}
}
const {
line,
column,
filename,
identifierName
} = this._sourcePosition;
this._queue.unshift([str, line, column, identifierName, filename]);
}
queueIndentation(str) {
this._queue.unshift([str, undefined, undefined, undefined, undefined]);
}
_flush() {
let item;
while (item = this._queue.pop()) {
this._append(...item);
}
}
_append(str, line, column, identifierName, filename) {
this._buf += str;
this._last = str.charCodeAt(str.length - 1);
let i = str.indexOf("\n");
let last = 0;
if (i !== 0) {
this._mark(line, column, identifierName, filename);
}
while (i !== -1) {
this._position.line++;
this._position.column = 0;
last = i + 1;
if (last < str.length) {
this._mark(++line, 0, identifierName, filename);
}
i = str.indexOf("\n", last);
}
this._position.column += str.length - last;
}
_mark(line, column, identifierName, filename) {
var _this$_map;
(_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, filename);
}
removeTrailingNewline() {
if (this._queue.length > 0 && this._queue[0][0] === "\n") {
this._queue.shift();
}
}
removeLastSemicolon() {
if (this._queue.length > 0 && this._queue[0][0] === ";") {
this._queue.shift();
}
}
getLastChar() {
let last;
if (this._queue.length > 0) {
const str = this._queue[0][0];
last = str.charCodeAt(0);
} else {
last = this._last;
}
return last;
}
endsWithCharAndNewline() {
const queue = this._queue;
if (queue.length > 0) {
const last = queue[0][0];
const lastCp = last.charCodeAt(0);
if (lastCp !== 10) return;
if (queue.length > 1) {
const secondLast = queue[1][0];
return secondLast.charCodeAt(0);
} else {
return this._last;
}
}
}
hasContent() {
return this._queue.length > 0 || !!this._last;
}
exactSource(loc, cb) {
this.source("start", loc);
cb();
this.source("end", loc);
this._disallowPop("start", loc);
}
source(prop, loc) {
if (prop && !loc) return;
this._normalizePosition(prop, loc, this._sourcePosition);
}
withSource(prop, loc, cb) {
if (!this._map) return cb();
const originalLine = this._sourcePosition.line;
const originalColumn = this._sourcePosition.column;
const originalFilename = this._sourcePosition.filename;
const originalIdentifierName = this._sourcePosition.identifierName;
this.source(prop, loc);
cb();
if (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename) {
this._sourcePosition.line = originalLine;
this._sourcePosition.column = originalColumn;
this._sourcePosition.filename = originalFilename;
this._sourcePosition.identifierName = originalIdentifierName;
this._disallowedPop = null;
}
}
_disallowPop(prop, loc) {
if (prop && !loc) return;
this._disallowedPop = this._normalizePosition(prop, loc, SourcePos());
}
_normalizePosition(prop, loc, targetObj) {
const pos = loc ? loc[prop] : null;
targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || undefined;
targetObj.line = pos == null ? void 0 : pos.line;
targetObj.column = pos == null ? void 0 : pos.column;
targetObj.filename = loc == null ? void 0 : loc.filename;
return targetObj;
}
getCurrentColumn() {
const extra = this._queue.reduce((acc, item) => item[0] + acc, "");
const lastIndex = extra.lastIndexOf("\n");
return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex;
}
getCurrentLine() {
const extra = this._queue.reduce((acc, item) => item[0] + acc, "");
let count = 0;
for (let i = 0; i < extra.length; i++) {
if (extra[i] === "\n") count++;
}
return this._position.line + count;
}
}
exports.default = Buffer;

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlockStatement = BlockStatement;
exports.Directive = Directive;
exports.DirectiveLiteral = DirectiveLiteral;
exports.File = File;
exports.InterpreterDirective = InterpreterDirective;
exports.Placeholder = Placeholder;
exports.Program = Program;
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) {
var _node$directives;
this.token("{");
this.printInnerComments(node);
const hasDirectives = (_node$directives = node.directives) == null ? void 0 : _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(10)) this.newline();
this.rightBrace();
} else {
this.source("end", node.loc);
this.token("}");
}
}
function Directive(node) {
this.print(node.value, node);
this.semicolon();
}
const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
function DirectiveLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && 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();
}
}

@ -0,0 +1,213 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ClassAccessorProperty = ClassAccessorProperty;
exports.ClassBody = ClassBody;
exports.ClassExpression = exports.ClassDeclaration = ClassDeclaration;
exports.ClassMethod = ClassMethod;
exports.ClassPrivateMethod = ClassPrivateMethod;
exports.ClassPrivateProperty = ClassPrivateProperty;
exports.ClassProperty = ClassProperty;
exports.StaticBlock = StaticBlock;
exports._classMethodHead = _classMethodHead;
var _t = require("@babel/types");
const {
isExportDefaultDeclaration,
isExportNamedDeclaration
} = _t;
function ClassDeclaration(node, parent) {
if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) {
this.printJoin(node.decorators, node);
}
if (node.declare) {
this.word("declare");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
this.word("class");
this.printInnerComments(node);
if (node.id) {
this.space();
this.print(node.id, node);
}
this.print(node.typeParameters, node);
if (node.superClass) {
this.space();
this.word("extends");
this.space();
this.print(node.superClass, node);
this.print(node.superTypeParameters, node);
}
if (node.implements) {
this.space();
this.word("implements");
this.space();
this.printList(node.implements, node);
}
this.space();
this.print(node.body, node);
}
function ClassBody(node) {
this.token("{");
this.printInnerComments(node);
if (node.body.length === 0) {
this.token("}");
} else {
this.newline();
this.indent();
this.printSequence(node.body, node);
this.dedent();
if (!this.endsWith(10)) this.newline();
this.rightBrace();
}
}
function ClassProperty(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node, true);
if (node.computed) {
this.token("[");
this.print(node.key, node);
this.token("]");
} else {
this._variance(node);
this.print(node.key, node);
}
if (node.optional) {
this.token("?");
}
if (node.definite) {
this.token("!");
}
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
this.token("=");
this.space();
this.print(node.value, node);
}
this.semicolon();
}
function ClassAccessorProperty(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node, true);
this.word("accessor");
this.printInnerComments(node);
this.space();
if (node.computed) {
this.token("[");
this.print(node.key, node);
this.token("]");
} else {
this._variance(node);
this.print(node.key, node);
}
if (node.optional) {
this.token("?");
}
if (node.definite) {
this.token("!");
}
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
this.token("=");
this.space();
this.print(node.value, node);
}
this.semicolon();
}
function ClassPrivateProperty(node) {
this.printJoin(node.decorators, node);
if (node.static) {
this.word("static");
this.space();
}
this.print(node.key, node);
this.print(node.typeAnnotation, node);
if (node.value) {
this.space();
this.token("=");
this.space();
this.print(node.value, node);
}
this.semicolon();
}
function ClassMethod(node) {
this._classMethodHead(node);
this.space();
this.print(node.body, node);
}
function ClassPrivateMethod(node) {
this._classMethodHead(node);
this.space();
this.print(node.body, node);
}
function _classMethodHead(node) {
this.printJoin(node.decorators, node);
this.source("end", node.key.loc);
this.tsPrintClassMemberModifiers(node, false);
this._methodHead(node);
}
function StaticBlock(node) {
this.word("static");
this.space();
this.token("{");
if (node.body.length === 0) {
this.token("}");
} else {
this.newline();
this.printSequence(node.body, node, {
indent: true
});
this.rightBrace();
}
}

@ -0,0 +1,354 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression;
exports.AssignmentPattern = AssignmentPattern;
exports.AwaitExpression = void 0;
exports.BindExpression = BindExpression;
exports.CallExpression = CallExpression;
exports.ConditionalExpression = ConditionalExpression;
exports.Decorator = Decorator;
exports.DoExpression = DoExpression;
exports.EmptyStatement = EmptyStatement;
exports.ExpressionStatement = ExpressionStatement;
exports.Import = Import;
exports.MemberExpression = MemberExpression;
exports.MetaProperty = MetaProperty;
exports.ModuleExpression = ModuleExpression;
exports.NewExpression = NewExpression;
exports.OptionalCallExpression = OptionalCallExpression;
exports.OptionalMemberExpression = OptionalMemberExpression;
exports.ParenthesizedExpression = ParenthesizedExpression;
exports.PrivateName = PrivateName;
exports.SequenceExpression = SequenceExpression;
exports.Super = Super;
exports.ThisExpression = ThisExpression;
exports.UnaryExpression = UnaryExpression;
exports.UpdateExpression = UpdateExpression;
exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
exports.YieldExpression = void 0;
var _t = require("@babel/types");
var n = require("../node");
const {
isCallExpression,
isLiteral,
isMemberExpression,
isNewExpression
} = _t;
function UnaryExpression(node) {
if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") {
this.word(node.operator);
this.space();
} else {
this.token(node.operator);
}
this.print(node.argument, node);
}
function DoExpression(node) {
if (node.async) {
this.word("async");
this.space();
}
this.word("do");
this.space();
this.print(node.body, node);
}
function ParenthesizedExpression(node) {
this.token("(");
this.print(node.expression, node);
this.token(")");
}
function UpdateExpression(node) {
if (node.prefix) {
this.token(node.operator);
this.print(node.argument, node);
} else {
this.startTerminatorless(true);
this.print(node.argument, node);
this.endTerminatorless();
this.token(node.operator);
}
}
function ConditionalExpression(node) {
this.print(node.test, node);
this.space();
this.token("?");
this.space();
this.print(node.consequent, node);
this.space();
this.token(":");
this.space();
this.print(node.alternate, node);
}
function NewExpression(node, parent) {
this.word("new");
this.space();
this.print(node.callee, node);
if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, {
callee: node
}) && !isMemberExpression(parent) && !isNewExpression(parent)) {
return;
}
this.print(node.typeArguments, node);
this.print(node.typeParameters, node);
if (node.optional) {
this.token("?.");
}
this.token("(");
this.printList(node.arguments, node);
this.token(")");
}
function SequenceExpression(node) {
this.printList(node.expressions, node);
}
function ThisExpression() {
this.word("this");
}
function Super() {
this.word("super");
}
function isDecoratorMemberExpression(node) {
switch (node.type) {
case "Identifier":
return true;
case "MemberExpression":
return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object);
default:
return false;
}
}
function shouldParenthesizeDecoratorExpression(node) {
if (node.type === "CallExpression") {
node = node.callee;
}
if (node.type === "ParenthesizedExpression") {
return false;
}
return !isDecoratorMemberExpression(node);
}
function Decorator(node) {
this.token("@");
const {
expression
} = node;
if (shouldParenthesizeDecoratorExpression(expression)) {
this.token("(");
this.print(expression, node);
this.token(")");
} else {
this.print(expression, node);
}
this.newline();
}
function OptionalMemberExpression(node) {
this.print(node.object, node);
if (!node.computed && isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property");
}
let computed = node.computed;
if (isLiteral(node.property) && typeof node.property.value === "number") {
computed = true;
}
if (node.optional) {
this.token("?.");
}
if (computed) {
this.token("[");
this.print(node.property, node);
this.token("]");
} else {
if (!node.optional) {
this.token(".");
}
this.print(node.property, node);
}
}
function OptionalCallExpression(node) {
this.print(node.callee, node);
this.print(node.typeArguments, node);
this.print(node.typeParameters, node);
if (node.optional) {
this.token("?.");
}
this.token("(");
this.printList(node.arguments, node);
this.token(")");
}
function CallExpression(node) {
this.print(node.callee, node);
this.print(node.typeArguments, node);
this.print(node.typeParameters, node);
this.token("(");
this.printList(node.arguments, node);
this.token(")");
}
function Import() {
this.word("import");
}
function buildYieldAwait(keyword) {
return function (node) {
this.word(keyword);
if (node.delegate) {
this.token("*");
}
if (node.argument) {
this.space();
const terminatorState = this.startTerminatorless();
this.print(node.argument, node);
this.endTerminatorless(terminatorState);
}
};
}
const YieldExpression = buildYieldAwait("yield");
exports.YieldExpression = YieldExpression;
const AwaitExpression = buildYieldAwait("await");
exports.AwaitExpression = AwaitExpression;
function EmptyStatement() {
this.semicolon(true);
}
function ExpressionStatement(node) {
this.print(node.expression, node);
this.semicolon();
}
function AssignmentPattern(node) {
this.print(node.left, node);
if (node.left.optional) this.token("?");
this.print(node.left.typeAnnotation, node);
this.space();
this.token("=");
this.space();
this.print(node.right, node);
}
function AssignmentExpression(node, parent) {
const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
if (parens) {
this.token("(");
}
this.print(node.left, node);
this.space();
if (node.operator === "in" || node.operator === "instanceof") {
this.word(node.operator);
} else {
this.token(node.operator);
}
this.space();
this.print(node.right, node);
if (parens) {
this.token(")");
}
}
function BindExpression(node) {
this.print(node.object, node);
this.token("::");
this.print(node.callee, node);
}
function MemberExpression(node) {
this.print(node.object, node);
if (!node.computed && isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property");
}
let computed = node.computed;
if (isLiteral(node.property) && typeof node.property.value === "number") {
computed = true;
}
if (computed) {
this.token("[");
this.print(node.property, node);
this.token("]");
} else {
this.token(".");
this.print(node.property, node);
}
}
function MetaProperty(node) {
this.print(node.meta, node);
this.token(".");
this.print(node.property, node);
}
function PrivateName(node) {
this.token("#");
this.print(node.id, node);
}
function V8IntrinsicIdentifier(node) {
this.token("%");
this.word(node.name);
}
function ModuleExpression(node) {
this.word("module");
this.space();
this.token("{");
if (node.body.body.length === 0) {
this.token("}");
} else {
this.newline();
this.printSequence(node.body.body, node, {
indent: true
});
this.rightBrace();
}
}

@ -0,0 +1,795 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AnyTypeAnnotation = AnyTypeAnnotation;
exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
exports.DeclareClass = DeclareClass;
exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
exports.DeclareExportDeclaration = DeclareExportDeclaration;
exports.DeclareFunction = DeclareFunction;
exports.DeclareInterface = DeclareInterface;
exports.DeclareModule = DeclareModule;
exports.DeclareModuleExports = DeclareModuleExports;
exports.DeclareOpaqueType = DeclareOpaqueType;
exports.DeclareTypeAlias = DeclareTypeAlias;
exports.DeclareVariable = DeclareVariable;
exports.DeclaredPredicate = DeclaredPredicate;
exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
exports.EnumBooleanBody = EnumBooleanBody;
exports.EnumBooleanMember = EnumBooleanMember;
exports.EnumDeclaration = EnumDeclaration;
exports.EnumDefaultedMember = EnumDefaultedMember;
exports.EnumNumberBody = EnumNumberBody;
exports.EnumNumberMember = EnumNumberMember;
exports.EnumStringBody = EnumStringBody;
exports.EnumStringMember = EnumStringMember;
exports.EnumSymbolBody = EnumSymbolBody;
exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.FunctionTypeParam = FunctionTypeParam;
exports.IndexedAccessType = IndexedAccessType;
exports.InferredPredicate = InferredPredicate;
exports.InterfaceDeclaration = InterfaceDeclaration;
exports.GenericTypeAnnotation = exports.ClassImplements = exports.InterfaceExtends = InterfaceExtends;
exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
exports.MixedTypeAnnotation = MixedTypeAnnotation;
exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
exports.NullableTypeAnnotation = NullableTypeAnnotation;
Object.defineProperty(exports, "NumberLiteralTypeAnnotation", {
enumerable: true,
get: function () {
return _types2.NumericLiteral;
}
});
exports.NumberTypeAnnotation = NumberTypeAnnotation;
exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
exports.ObjectTypeIndexer = ObjectTypeIndexer;
exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
exports.ObjectTypeProperty = ObjectTypeProperty;
exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
exports.OpaqueType = OpaqueType;
exports.OptionalIndexedAccessType = OptionalIndexedAccessType;
exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
enumerable: true,
get: function () {
return _types2.StringLiteral;
}
});
exports.StringTypeAnnotation = StringTypeAnnotation;
exports.SymbolTypeAnnotation = SymbolTypeAnnotation;
exports.ThisTypeAnnotation = ThisTypeAnnotation;
exports.TupleTypeAnnotation = TupleTypeAnnotation;
exports.TypeAlias = TypeAlias;
exports.TypeAnnotation = TypeAnnotation;
exports.TypeCastExpression = TypeCastExpression;
exports.TypeParameter = TypeParameter;
exports.TypeParameterDeclaration = exports.TypeParameterInstantiation = TypeParameterInstantiation;
exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.Variance = Variance;
exports.VoidTypeAnnotation = VoidTypeAnnotation;
exports._interfaceish = _interfaceish;
exports._variance = _variance;
var _t = require("@babel/types");
var _modules = require("./modules");
var _types2 = require("./types");
const {
isDeclareExportDeclaration,
isStatement
} = _t;
function AnyTypeAnnotation() {
this.word("any");
}
function ArrayTypeAnnotation(node) {
this.print(node.elementType, node);
this.token("[");
this.token("]");
}
function BooleanTypeAnnotation() {
this.word("boolean");
}
function BooleanLiteralTypeAnnotation(node) {
this.word(node.value ? "true" : "false");
}
function NullLiteralTypeAnnotation() {
this.word("null");
}
function DeclareClass(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("class");
this.space();
this._interfaceish(node);
}
function DeclareFunction(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("function");
this.space();
this.print(node.id, node);
this.print(node.id.typeAnnotation.typeAnnotation, node);
if (node.predicate) {
this.space();
this.print(node.predicate, node);
}
this.semicolon();
}
function InferredPredicate() {
this.token("%");
this.word("checks");
}
function DeclaredPredicate(node) {
this.token("%");
this.word("checks");
this.token("(");
this.print(node.value, node);
this.token(")");
}
function DeclareInterface(node) {
this.word("declare");
this.space();
this.InterfaceDeclaration(node);
}
function DeclareModule(node) {
this.word("declare");
this.space();
this.word("module");
this.space();
this.print(node.id, node);
this.space();
this.print(node.body, node);
}
function DeclareModuleExports(node) {
this.word("declare");
this.space();
this.word("module");
this.token(".");
this.word("exports");
this.print(node.typeAnnotation, node);
}
function DeclareTypeAlias(node) {
this.word("declare");
this.space();
this.TypeAlias(node);
}
function DeclareOpaqueType(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.OpaqueType(node);
}
function DeclareVariable(node, parent) {
if (!isDeclareExportDeclaration(parent)) {
this.word("declare");
this.space();
}
this.word("var");
this.space();
this.print(node.id, node);
this.print(node.id.typeAnnotation, node);
this.semicolon();
}
function DeclareExportDeclaration(node) {
this.word("declare");
this.space();
this.word("export");
this.space();
if (node.default) {
this.word("default");
this.space();
}
FlowExportDeclaration.apply(this, arguments);
}
function DeclareExportAllDeclaration() {
this.word("declare");
this.space();
_modules.ExportAllDeclaration.apply(this, arguments);
}
function EnumDeclaration(node) {
const {
id,
body
} = node;
this.word("enum");
this.space();
this.print(id, node);
this.print(body, node);
}
function enumExplicitType(context, name, hasExplicitType) {
if (hasExplicitType) {
context.space();
context.word("of");
context.space();
context.word(name);
}
context.space();
}
function enumBody(context, node) {
const {
members
} = node;
context.token("{");
context.indent();
context.newline();
for (const member of members) {
context.print(member, node);
context.newline();
}
if (node.hasUnknownMembers) {
context.token("...");
context.newline();
}
context.dedent();
context.token("}");
}
function EnumBooleanBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "boolean", explicitType);
enumBody(this, node);
}
function EnumNumberBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "number", explicitType);
enumBody(this, node);
}
function EnumStringBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "string", explicitType);
enumBody(this, node);
}
function EnumSymbolBody(node) {
enumExplicitType(this, "symbol", true);
enumBody(this, node);
}
function EnumDefaultedMember(node) {
const {
id
} = node;
this.print(id, node);
this.token(",");
}
function enumInitializedMember(context, node) {
const {
id,
init
} = node;
context.print(id, node);
context.space();
context.token("=");
context.space();
context.print(init, node);
context.token(",");
}
function EnumBooleanMember(node) {
enumInitializedMember(this, node);
}
function EnumNumberMember(node) {
enumInitializedMember(this, node);
}
function EnumStringMember(node) {
enumInitializedMember(this, node);
}
function FlowExportDeclaration(node) {
if (node.declaration) {
const declar = node.declaration;
this.print(declar, node);
if (!isStatement(declar)) this.semicolon();
} else {
this.token("{");
if (node.specifiers.length) {
this.space();
this.printList(node.specifiers, node);