This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

13
node_modules/recast/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,13 @@
[*]
insert_final_newline = true
[{package.json}]
indent_style = space
indent_size = 2
[{*.js, *.ts}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8

16
node_modules/recast/.eslintrc.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
rules: {
"no-var": "error",
"no-case-declarations": "error",
"no-fallthrough": "error",
},
ignorePatterns: ["test/data"],
};

9
node_modules/recast/.github/dependabot.yml generated vendored Normal file
View File

@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"

29
node_modules/recast/.github/workflows/main.yml generated vendored Normal file
View File

@@ -0,0 +1,29 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['10.x', '12.x', '14.x', '15.x', '16.x']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: npm install, build and test
run: |
npm install
npm run build --if-present
npm test

1
node_modules/recast/.prettierignore generated vendored Normal file
View File

@@ -0,0 +1 @@
**/*.d.ts

14
node_modules/recast/.prettierrc.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
printWidth: 80,
trailingComma: "all",
singleQuote: false,
overrides: [
{
files: "*.md",
options: {
printWidth: 60,
},
},
],
};

20
node_modules/recast/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2012 Ben Newman <bn@cs.stanford.edu>
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.

208
node_modules/recast/README.md generated vendored Normal file
View File

@@ -0,0 +1,208 @@
# recast, _v_. ![CI](https://github.com/benjamn/recast/workflows/CI/badge.svg) [![Join the chat at https://gitter.im/benjamn/recast](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/benjamn/recast?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1. to give (a metal object) a different form by melting it down and reshaping it.
1. to form, fashion, or arrange again.
1. to remodel or reconstruct (a literary work, document, sentence, etc.).
1. to supply (a theater or opera work) with a new cast.
Installation
---
From NPM:
npm install recast
From GitHub:
cd path/to/node_modules
git clone git://github.com/benjamn/recast.git
cd recast
npm install .
Import style
---
Recast is designed to be imported using **named** imports:
```js
import { parse, print } from "recast";
console.log(print(parse(source)).code);
import * as recast from "recast";
console.log(recast.print(recast.parse(source)).code);
```
If you're using CommonJS:
```js
const { parse, print } = require("recast");
console.log(print(parse(source)).code);
const recast = require("recast");
console.log(recast.print(recast.parse(source)).code);
```
Usage
---
Recast exposes two essential interfaces, one for parsing JavaScript code (`require("recast").parse`) and the other for reprinting modified syntax trees (`require("recast").print`).
Here's a simple but non-trivial example of how you might use `.parse` and `.print`:
```js
import * as recast from "recast";
// Let's turn this function declaration into a variable declaration.
const code = [
"function add(a, b) {",
" return a +",
" // Weird formatting, huh?",
" b;",
"}"
].join("\n");
// Parse the code using an interface similar to require("esprima").parse.
const ast = recast.parse(code);
```
Now do *whatever* you want to `ast`. Really, anything at all!
See [ast-types](https://github.com/benjamn/ast-types) (especially the [def/core.ts](https://github.com/benjamn/ast-types/blob/master/def/core.ts)) module for a thorough overview of the `ast` API.
```js
// Grab a reference to the function declaration we just parsed.
const add = ast.program.body[0];
// Make sure it's a FunctionDeclaration (optional).
const n = recast.types.namedTypes;
n.FunctionDeclaration.assert(add);
// If you choose to use recast.builders to construct new AST nodes, all builder
// arguments will be dynamically type-checked against the Mozilla Parser API.
const b = recast.types.builders;
// This kind of manipulation should seem familiar if you've used Esprima or the
// Mozilla Parser API before.
ast.program.body[0] = b.variableDeclaration("var", [
b.variableDeclarator(add.id, b.functionExpression(
null, // Anonymize the function expression.
add.params,
add.body
))
]);
// Just for fun, because addition is commutative:
add.params.push(add.params.shift());
```
When you finish manipulating the AST, let `recast.print` work its magic:
```js
const output = recast.print(ast).code;
```
The `output` string now looks exactly like this, weird formatting and all:
```js
var add = function(b, a) {
return a +
// Weird formatting, huh?
b;
}
```
The magic of Recast is that it reprints only those parts of the syntax tree that you modify. In other words, the following identity is guaranteed:
```js
recast.print(recast.parse(source)).code === source
```
Whenever Recast cannot reprint a modified node using the original source code, it falls back to using a generic pretty printer. So the worst that can happen is that your changes trigger some harmless reformatting of your code.
If you really don't care about preserving the original formatting, you can access the pretty printer directly:
```js
var output = recast.prettyPrint(ast, { tabWidth: 2 }).code;
```
And here's the exact `output`:
```js
var add = function(b, a) {
return a + b;
}
```
Note that the weird formatting was discarded, yet the behavior and abstract structure of the code remain the same.
Using a different parser
---
By default, Recast uses the [Esprima JavaScript parser](https://www.npmjs.com/package/esprima) when you call `recast.parse(code)`. While Esprima supports almost all modern ECMAScript syntax, you may want to use a different parser to enable TypeScript or Flow syntax, or just because you want to match other compilation tools you might be using.
In order to get any benefits from Recast's conservative pretty-printing, **it is very important that you continue to call `recast.parse`** (rather than parsing the AST yourself using a different parser), and simply instruct `recast.parse` to use a different parser:
```js
const acornAst = recast.parse(source, {
parser: require("acorn")
});
```
Why is this so important? When you call `recast.parse`, it makes a shadow copy of the AST before returning it to you, giving every copied AST node a reference back to the original through a special `.original` property. This information is what enables `recast.print` to detect where the AST has been modified, so that it can preserve formatting for parts of the AST that were not modified.
Any `parser` object that supports a `parser.parse(source)` method will work here; however, if your parser requires additional options, you can always implement your own `parse` method that invokes your parser with custom options:
```js
const acornAst = recast.parse(source, {
parser: {
parse(source) {
return require("acorn").parse(source, {
// additional options
});
}
}
});
```
To take some of the guesswork out of configuring common parsers, Recast provides [several preconfigured parsers](https://github.com/benjamn/recast/tree/master/parsers), so you can parse TypeScript (for example) without worrying about the configuration details:
```js
const tsAst = recast.parse(source, {
parser: require("recast/parsers/typescript")
});
```
**Note:** Some of these parsers import npm packages that Recast does not directly depend upon, so please be aware you may have to run `npm install babylon@next` to use the `typescript`, `flow`, or `babylon` parsers, or `npm install acorn` to use the `acorn` parser. Only Esprima is installed by default when Recast is installed.
Source maps
---
One of the coolest consequences of tracking and reusing original source code during reprinting is that it's pretty easy to generate a high-resolution mapping between the original code and the generated code—completely automatically!
With every `slice`, `join`, and re-`indent`-ation, the reprinting process maintains exact knowledge of which character sequences are original, and where in the original source they came from.
All you have to think about is how to manipulate the syntax tree, and Recast will give you a [source map](https://github.com/mozilla/source-map) in exchange for specifying the names of your source file(s) and the desired name of the map:
```js
var result = recast.print(transform(recast.parse(source, {
sourceFileName: "source.js"
})), {
sourceMapName: "map.json"
});
console.log(result.code); // Resulting string of code.
console.log(result.map); // JSON source map.
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var smc = new SourceMapConsumer(result.map);
console.log(smc.originalPositionFor({
line: 3,
column: 15
})); // { source: 'source.js',
// line: 2,
// column: 10,
// name: null }
```
Note that you are free to mix and match syntax trees parsed from different source files, and the resulting source map will automatically keep track of the separate file origins for you.
Note also that the source maps generated by Recast are character-by-character maps, so meaningful identifier names are not recorded at this time. This approach leads to higher-resolution debugging in modern browsers, at the expense of somewhat larger map sizes. Striking the perfect balance here is an area for future exploration, but such improvements will not require any breaking changes to the interface demonstrated above.
Options
---
All Recast API functions take second parameter with configuration options, documented in
[options.ts](https://github.com/benjamn/recast/blob/master/lib/options.ts)
Motivation
---
The more code you have, the harder it becomes to make big, sweeping changes quickly and confidently. Even if you trust yourself not to make too many mistakes, and no matter how proficient you are with your text editor, changing tens of thousands of lines of code takes precious, non-refundable time.
Is there a better way? Not always! When a task requires you to alter the semantics of many different pieces of code in subtly different ways, your brain inevitably becomes the bottleneck, and there is little hope of completely automating the process. Your best bet is to plan carefully, buckle down, and get it right the first time. Love it or loathe it, that's the way programming goes sometimes.
What I hope to eliminate are the brain-wasting tasks, the tasks that are bottlenecked by keystrokes, the tasks that can be expressed as operations on the _syntactic structure_ of your code. Specifically, my goal is to make it possible for you to run your code through a parser, manipulate the abstract syntax tree directly, subject only to the constraints of your imagination, and then automatically translate those modifications back into source code, without upsetting the formatting of unmodified code.
And here's the best part: when you're done running a Recast script, if you're not completely satisfied with the results, blow them away with `git reset --hard`, tweak the script, and just run it again. Change your mind as many times as you like. Instead of typing yourself into a nasty case of [RSI](http://en.wikipedia.org/wiki/Repetitive_strain_injury), gaze upon your new wells of free time and ask yourself: what next?

44
node_modules/recast/example/add-braces generated vendored Normal file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/env node
var recast = require("recast");
var types = recast.types;
var n = types.namedTypes;
var b = types.builders;
require("recast").run(function(ast, callback) {
recast.visit(ast, {
visitIfStatement: function(path) {
var stmt = path.node;
stmt.consequent = fix(stmt.consequent);
var alt = stmt.alternate;
if (!n.IfStatement.check(alt)) {
stmt.alternate = fix(alt);
}
this.traverse(path);
},
visitWhileStatement: visitLoop,
visitForStatement: visitLoop,
visitForInStatement: visitLoop
});
callback(ast);
});
function visitLoop(path) {
var loop = path.node;
loop.body = fix(loop.body);
this.traverse(path);
}
function fix(clause) {
if (clause) {
if (!n.BlockStatement.check(clause)) {
clause = b.blockStatement([clause]);
}
}
return clause;
}

17
node_modules/recast/example/generic-identity generated vendored Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env node
// This script should reprint the contents of the given file without
// reusing the original source, but with identical AST structure.
var recast = require("recast");
recast.run(function(ast, callback) {
recast.visit(ast, {
visitNode: function(path) {
this.traverse(path);
path.node.original = null;
}
});
callback(ast);
});

8
node_modules/recast/example/identity generated vendored Normal file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
// This script should echo the contents of the given file without
// modification.
require("recast").run(function(ast, callback) {
callback(ast);
});

84
node_modules/recast/example/to-while generated vendored Normal file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/env node
// This script converts for and do-while loops into equivalent while loops.
// Note that for-in statements are left unmodified, as they do not have a
// simple analogy to while loops. Also note that labeled continue statements
// are not correctly handled at this point, and will trigger an assertion
// failure if encountered.
var assert = require("assert");
var recast = require("recast");
var types = recast.types;
var n = types.namedTypes;
var b = types.builders;
recast.run(function(ast, callback) {
recast.visit(ast, {
visitForStatement: function(path) {
var fst = path.node;
path.replace(
fst.init,
b.whileStatement(
fst.test,
insertBeforeLoopback(fst, fst.update)
)
);
this.traverse(path);
},
visitDoWhileStatement: function(path) {
var dwst = path.node;
return b.whileStatement(
b.literal(true),
insertBeforeLoopback(
dwst,
b.ifStatement(
dwst.test,
b.breakStatement()
)
)
);
}
});
callback(ast);
});
function insertBeforeLoopback(loop, toInsert) {
var body = loop.body;
if (!n.Statement.check(toInsert)) {
toInsert = b.expressionStatement(toInsert);
}
if (n.BlockStatement.check(body)) {
body.body.push(toInsert);
} else {
body = b.blockStatement([body, toInsert]);
loop.body = body;
}
recast.visit(body, {
visitContinueStatement: function(path) {
var cst = path.node;
assert.equal(
cst.label, null,
"Labeled continue statements are not yet supported."
);
path.replace(toInsert, path.node);
return false;
},
// Do not descend into nested loops.
visitWhileStatement: function() {},
visitForStatement: function() {},
visitForInStatement: function() {},
visitDoWhileStatement: function() {}
});
return body;
}

2
node_modules/recast/lib/comments.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare function attach(comments: any[], ast: any, lines: any): void;
export declare function printComments(path: any, print: any): any;

306
node_modules/recast/lib/comments.js generated vendored Normal file
View File

@@ -0,0 +1,306 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.printComments = exports.attach = void 0;
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var types = tslib_1.__importStar(require("ast-types"));
var n = types.namedTypes;
var isArray = types.builtInTypes.array;
var isObject = types.builtInTypes.object;
var lines_1 = require("./lines");
var util_1 = require("./util");
var childNodesCache = new WeakMap();
// TODO Move a non-caching implementation of this function into ast-types,
// and implement a caching wrapper function here.
function getSortedChildNodes(node, lines, resultArray) {
if (!node) {
return resultArray;
}
// The .loc checks below are sensitive to some of the problems that
// are fixed by this utility function. Specifically, if it decides to
// set node.loc to null, indicating that the node's .loc information
// is unreliable, then we don't want to add node to the resultArray.
util_1.fixFaultyLocations(node, lines);
if (resultArray) {
if (n.Node.check(node) && n.SourceLocation.check(node.loc)) {
// This reverse insertion sort almost always takes constant
// time because we almost always (maybe always?) append the
// nodes in order anyway.
var i = resultArray.length - 1;
for (; i >= 0; --i) {
var child = resultArray[i];
if (child &&
child.loc &&
util_1.comparePos(child.loc.end, node.loc.start) <= 0) {
break;
}
}
resultArray.splice(i + 1, 0, node);
return resultArray;
}
}
else {
var childNodes = childNodesCache.get(node);
if (childNodes) {
return childNodes;
}
}
var names;
if (isArray.check(node)) {
names = Object.keys(node);
}
else if (isObject.check(node)) {
names = types.getFieldNames(node);
}
else {
return resultArray;
}
if (!resultArray) {
childNodesCache.set(node, (resultArray = []));
}
for (var i = 0, nameCount = names.length; i < nameCount; ++i) {
getSortedChildNodes(node[names[i]], lines, resultArray);
}
return resultArray;
}
// As efficiently as possible, decorate the comment object with
// .precedingNode, .enclosingNode, and/or .followingNode properties, at
// least one of which is guaranteed to be defined.
function decorateComment(node, comment, lines) {
var childNodes = getSortedChildNodes(node, lines);
// Time to dust off the old binary search robes and wizard hat.
var left = 0;
var right = childNodes && childNodes.length;
var precedingNode;
var followingNode;
while (typeof right === "number" && left < right) {
var middle = (left + right) >> 1;
var child = childNodes[middle];
if (util_1.comparePos(child.loc.start, comment.loc.start) <= 0 &&
util_1.comparePos(comment.loc.end, child.loc.end) <= 0) {
// The comment is completely contained by this child node.
decorateComment((comment.enclosingNode = child), comment, lines);
return; // Abandon the binary search at this level.
}
if (util_1.comparePos(child.loc.end, comment.loc.start) <= 0) {
// This child node falls completely before the comment.
// Because we will never consider this node or any nodes
// before it again, this node must be the closest preceding
// node we have encountered so far.
precedingNode = child;
left = middle + 1;
continue;
}
if (util_1.comparePos(comment.loc.end, child.loc.start) <= 0) {
// This child node falls completely after the comment.
// Because we will never consider this node or any nodes after
// it again, this node must be the closest following node we
// have encountered so far.
followingNode = child;
right = middle;
continue;
}
throw new Error("Comment location overlaps with node location");
}
if (precedingNode) {
comment.precedingNode = precedingNode;
}
if (followingNode) {
comment.followingNode = followingNode;
}
}
function attach(comments, ast, lines) {
if (!isArray.check(comments)) {
return;
}
var tiesToBreak = [];
comments.forEach(function (comment) {
comment.loc.lines = lines;
decorateComment(ast, comment, lines);
var pn = comment.precedingNode;
var en = comment.enclosingNode;
var fn = comment.followingNode;
if (pn && fn) {
var tieCount = tiesToBreak.length;
if (tieCount > 0) {
var lastTie = tiesToBreak[tieCount - 1];
assert_1.default.strictEqual(lastTie.precedingNode === comment.precedingNode, lastTie.followingNode === comment.followingNode);
if (lastTie.followingNode !== comment.followingNode) {
breakTies(tiesToBreak, lines);
}
}
tiesToBreak.push(comment);
}
else if (pn) {
// No contest: we have a trailing comment.
breakTies(tiesToBreak, lines);
addTrailingComment(pn, comment);
}
else if (fn) {
// No contest: we have a leading comment.
breakTies(tiesToBreak, lines);
addLeadingComment(fn, comment);
}
else if (en) {
// The enclosing node has no child nodes at all, so what we
// have here is a dangling comment, e.g. [/* crickets */].
breakTies(tiesToBreak, lines);
addDanglingComment(en, comment);
}
else {
throw new Error("AST contains no nodes at all?");
}
});
breakTies(tiesToBreak, lines);
comments.forEach(function (comment) {
// These node references were useful for breaking ties, but we
// don't need them anymore, and they create cycles in the AST that
// may lead to infinite recursion if we don't delete them here.
delete comment.precedingNode;
delete comment.enclosingNode;
delete comment.followingNode;
});
}
exports.attach = attach;
function breakTies(tiesToBreak, lines) {
var tieCount = tiesToBreak.length;
if (tieCount === 0) {
return;
}
var pn = tiesToBreak[0].precedingNode;
var fn = tiesToBreak[0].followingNode;
var gapEndPos = fn.loc.start;
// Iterate backwards through tiesToBreak, examining the gaps
// between the tied comments. In order to qualify as leading, a
// comment must be separated from fn by an unbroken series of
// whitespace-only gaps (or other comments).
var indexOfFirstLeadingComment = tieCount;
var comment;
for (; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
comment = tiesToBreak[indexOfFirstLeadingComment - 1];
assert_1.default.strictEqual(comment.precedingNode, pn);
assert_1.default.strictEqual(comment.followingNode, fn);
var gap = lines.sliceString(comment.loc.end, gapEndPos);
if (/\S/.test(gap)) {
// The gap string contained something other than whitespace.
break;
}
gapEndPos = comment.loc.start;
}
while (indexOfFirstLeadingComment <= tieCount &&
(comment = tiesToBreak[indexOfFirstLeadingComment]) &&
// If the comment is a //-style comment and indented more
// deeply than the node itself, reconsider it as trailing.
(comment.type === "Line" || comment.type === "CommentLine") &&
comment.loc.start.column > fn.loc.start.column) {
++indexOfFirstLeadingComment;
}
tiesToBreak.forEach(function (comment, i) {
if (i < indexOfFirstLeadingComment) {
addTrailingComment(pn, comment);
}
else {
addLeadingComment(fn, comment);
}
});
tiesToBreak.length = 0;
}
function addCommentHelper(node, comment) {
var comments = node.comments || (node.comments = []);
comments.push(comment);
}
function addLeadingComment(node, comment) {
comment.leading = true;
comment.trailing = false;
addCommentHelper(node, comment);
}
function addDanglingComment(node, comment) {
comment.leading = false;
comment.trailing = false;
addCommentHelper(node, comment);
}
function addTrailingComment(node, comment) {
comment.leading = false;
comment.trailing = true;
addCommentHelper(node, comment);
}
function printLeadingComment(commentPath, print) {
var comment = commentPath.getValue();
n.Comment.assert(comment);
var loc = comment.loc;
var lines = loc && loc.lines;
var parts = [print(commentPath)];
if (comment.trailing) {
// When we print trailing comments as leading comments, we don't
// want to bring any trailing spaces along.
parts.push("\n");
}
else if (lines instanceof lines_1.Lines) {
var trailingSpace = lines.slice(loc.end, lines.skipSpaces(loc.end) || lines.lastPos());
if (trailingSpace.length === 1) {
// If the trailing space contains no newlines, then we want to
// preserve it exactly as we found it.
parts.push(trailingSpace);
}
else {
// If the trailing space contains newlines, then replace it
// with just that many newlines, with all other spaces removed.
parts.push(new Array(trailingSpace.length).join("\n"));
}
}
else {
parts.push("\n");
}
return lines_1.concat(parts);
}
function printTrailingComment(commentPath, print) {
var comment = commentPath.getValue(commentPath);
n.Comment.assert(comment);
var loc = comment.loc;
var lines = loc && loc.lines;
var parts = [];
if (lines instanceof lines_1.Lines) {
var fromPos = lines.skipSpaces(loc.start, true) || lines.firstPos();
var leadingSpace = lines.slice(fromPos, loc.start);
if (leadingSpace.length === 1) {
// If the leading space contains no newlines, then we want to
// preserve it exactly as we found it.
parts.push(leadingSpace);
}
else {
// If the leading space contains newlines, then replace it
// with just that many newlines, sans all other spaces.
parts.push(new Array(leadingSpace.length).join("\n"));
}
}
parts.push(print(commentPath));
return lines_1.concat(parts);
}
function printComments(path, print) {
var value = path.getValue();
var innerLines = print(path);
var comments = n.Node.check(value) && types.getFieldValue(value, "comments");
if (!comments || comments.length === 0) {
return innerLines;
}
var leadingParts = [];
var trailingParts = [innerLines];
path.each(function (commentPath) {
var comment = commentPath.getValue();
var leading = types.getFieldValue(comment, "leading");
var trailing = types.getFieldValue(comment, "trailing");
if (leading ||
(trailing &&
!(n.Statement.check(value) ||
comment.type === "Block" ||
comment.type === "CommentBlock"))) {
leadingParts.push(printLeadingComment(commentPath, print));
}
else if (trailing) {
trailingParts.push(printTrailingComment(commentPath, print));
}
}, "comments");
leadingParts.push.apply(leadingParts, trailingParts);
return lines_1.concat(leadingParts);
}
exports.printComments = printComments;

25
node_modules/recast/lib/fast-path.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
interface FastPathType {
stack: any[];
copy(): any;
getName(): any;
getValue(): any;
valueIsDuplicate(): any;
getNode(count?: number): any;
getParentNode(count?: number): any;
getRootValue(): any;
call(callback: any, ...names: any[]): any;
each(callback: any, ...names: any[]): any;
map(callback: any, ...names: any[]): any;
hasParens(): any;
getPrevToken(node: any): any;
getNextToken(node: any): any;
needsParens(assumeExpressionContext?: boolean): any;
canBeFirstInStatement(): any;
firstInStatement(): any;
}
interface FastPathConstructor {
new (value: any): FastPathType;
from(obj: any): any;
}
declare const FastPath: FastPathConstructor;
export default FastPath;

527
node_modules/recast/lib/fast-path.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

62
node_modules/recast/lib/lines.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import { Options } from "./options";
import { namedTypes } from "ast-types";
declare type Pos = namedTypes.Position;
declare type LineInfo = {
readonly line: string;
readonly indent: number;
readonly locked: boolean;
readonly sliceStart: number;
readonly sliceEnd: number;
};
export declare class Lines {
private infos;
readonly length: number;
readonly name: string | null;
private mappings;
private cachedSourceMap;
private cachedTabWidth;
constructor(infos: LineInfo[], sourceFileName?: string | null);
toString(options?: Options): string;
getSourceMap(sourceMapName: string, sourceRoot?: string): any;
bootstrapCharAt(pos: Pos): string;
charAt(pos: Pos): string;
stripMargin(width: number, skipFirstLine: boolean): Lines;
indent(by: number): Lines;
indentTail(by: number): Lines;
lockIndentTail(): Lines;
getIndentAt(line: number): number;
guessTabWidth(): number;
startsWithComment(): boolean;
isOnlyWhitespace(): boolean;
isPrecededOnlyByWhitespace(pos: Pos): boolean;
getLineLength(line: number): number;
nextPos(pos: Pos, skipSpaces?: boolean): boolean;
prevPos(pos: Pos, skipSpaces?: boolean): boolean;
firstPos(): {
line: number;
column: number;
};
lastPos(): {
line: number;
column: number;
};
skipSpaces(pos: Pos, backward?: boolean, modifyInPlace?: boolean): namedTypes.Position | null;
trimLeft(): Lines;
trimRight(): Lines;
trim(): Lines;
eachPos(callback: (pos: Pos) => any, startPos?: Pos, skipSpaces?: boolean): void;
bootstrapSlice(start: Pos, end: Pos): Lines;
slice(start?: Pos, end?: Pos): Lines;
bootstrapSliceString(start: Pos, end: Pos, options?: Options): string;
sliceString(start?: Pos, end?: Pos, options?: Options): string;
isEmpty(): boolean;
join(elements: (string | Lines)[]): Lines;
concat(...args: (string | Lines)[]): Lines;
}
export declare function countSpaces(spaces: any, tabWidth?: number): number;
/**
* @param {Object} options - Options object that configures printing.
*/
export declare function fromString(string: string | Lines, options?: Options): Lines;
export declare function concat(elements: any): Lines;
export {};

654
node_modules/recast/lib/lines.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

15
node_modules/recast/lib/mapping.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import { namedTypes } from "ast-types";
import { Lines } from "./lines";
declare type Pos = namedTypes.Position;
declare type Loc = namedTypes.SourceLocation;
export default class Mapping {
sourceLines: Lines;
sourceLoc: Loc;
targetLoc: Loc;
constructor(sourceLines: Lines, sourceLoc: Loc, targetLoc?: Loc);
slice(lines: Lines, start: Pos, end?: Pos): Mapping | null;
add(line: number, column: number): Mapping;
subtract(line: number, column: number): Mapping;
indent(by: number, skipFirstLine?: boolean, noNegativeColumns?: boolean): Mapping;
}
export {};

197
node_modules/recast/lib/mapping.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var util_1 = require("./util");
var Mapping = /** @class */ (function () {
function Mapping(sourceLines, sourceLoc, targetLoc) {
if (targetLoc === void 0) { targetLoc = sourceLoc; }
this.sourceLines = sourceLines;
this.sourceLoc = sourceLoc;
this.targetLoc = targetLoc;
}
Mapping.prototype.slice = function (lines, start, end) {
if (end === void 0) { end = lines.lastPos(); }
var sourceLines = this.sourceLines;
var sourceLoc = this.sourceLoc;
var targetLoc = this.targetLoc;
function skip(name) {
var sourceFromPos = sourceLoc[name];
var targetFromPos = targetLoc[name];
var targetToPos = start;
if (name === "end") {
targetToPos = end;
}
else {
assert_1.default.strictEqual(name, "start");
}
return skipChars(sourceLines, sourceFromPos, lines, targetFromPos, targetToPos);
}
if (util_1.comparePos(start, targetLoc.start) <= 0) {
if (util_1.comparePos(targetLoc.end, end) <= 0) {
targetLoc = {
start: subtractPos(targetLoc.start, start.line, start.column),
end: subtractPos(targetLoc.end, start.line, start.column),
};
// The sourceLoc can stay the same because the contents of the
// targetLoc have not changed.
}
else if (util_1.comparePos(end, targetLoc.start) <= 0) {
return null;
}
else {
sourceLoc = {
start: sourceLoc.start,
end: skip("end"),
};
targetLoc = {
start: subtractPos(targetLoc.start, start.line, start.column),
end: subtractPos(end, start.line, start.column),
};
}
}
else {
if (util_1.comparePos(targetLoc.end, start) <= 0) {
return null;
}
if (util_1.comparePos(targetLoc.end, end) <= 0) {
sourceLoc = {
start: skip("start"),
end: sourceLoc.end,
};
targetLoc = {
// Same as subtractPos(start, start.line, start.column):
start: { line: 1, column: 0 },
end: subtractPos(targetLoc.end, start.line, start.column),
};
}
else {
sourceLoc = {
start: skip("start"),
end: skip("end"),
};
targetLoc = {
// Same as subtractPos(start, start.line, start.column):
start: { line: 1, column: 0 },
end: subtractPos(end, start.line, start.column),
};
}
}
return new Mapping(this.sourceLines, sourceLoc, targetLoc);
};
Mapping.prototype.add = function (line, column) {
return new Mapping(this.sourceLines, this.sourceLoc, {
start: addPos(this.targetLoc.start, line, column),
end: addPos(this.targetLoc.end, line, column),
});
};
Mapping.prototype.subtract = function (line, column) {
return new Mapping(this.sourceLines, this.sourceLoc, {
start: subtractPos(this.targetLoc.start, line, column),
end: subtractPos(this.targetLoc.end, line, column),
});
};
Mapping.prototype.indent = function (by, skipFirstLine, noNegativeColumns) {
if (skipFirstLine === void 0) { skipFirstLine = false; }
if (noNegativeColumns === void 0) { noNegativeColumns = false; }
if (by === 0) {
return this;
}
var targetLoc = this.targetLoc;
var startLine = targetLoc.start.line;
var endLine = targetLoc.end.line;
if (skipFirstLine && startLine === 1 && endLine === 1) {
return this;
}
targetLoc = {
start: targetLoc.start,
end: targetLoc.end,
};
if (!skipFirstLine || startLine > 1) {
var startColumn = targetLoc.start.column + by;
targetLoc.start = {
line: startLine,
column: noNegativeColumns ? Math.max(0, startColumn) : startColumn,
};
}
if (!skipFirstLine || endLine > 1) {
var endColumn = targetLoc.end.column + by;
targetLoc.end = {
line: endLine,
column: noNegativeColumns ? Math.max(0, endColumn) : endColumn,
};
}
return new Mapping(this.sourceLines, this.sourceLoc, targetLoc);
};
return Mapping;
}());
exports.default = Mapping;
function addPos(toPos, line, column) {
return {
line: toPos.line + line - 1,
column: toPos.line === 1 ? toPos.column + column : toPos.column,
};
}
function subtractPos(fromPos, line, column) {
return {
line: fromPos.line - line + 1,
column: fromPos.line === line ? fromPos.column - column : fromPos.column,
};
}
function skipChars(sourceLines, sourceFromPos, targetLines, targetFromPos, targetToPos) {
var targetComparison = util_1.comparePos(targetFromPos, targetToPos);
if (targetComparison === 0) {
// Trivial case: no characters to skip.
return sourceFromPos;
}
var sourceCursor, targetCursor;
if (targetComparison < 0) {
// Skipping forward.
sourceCursor =
sourceLines.skipSpaces(sourceFromPos) || sourceLines.lastPos();
targetCursor =
targetLines.skipSpaces(targetFromPos) || targetLines.lastPos();
var lineDiff = targetToPos.line - targetCursor.line;
sourceCursor.line += lineDiff;
targetCursor.line += lineDiff;
if (lineDiff > 0) {
// If jumping to later lines, reset columns to the beginnings
// of those lines.
sourceCursor.column = 0;
targetCursor.column = 0;
}
else {
assert_1.default.strictEqual(lineDiff, 0);
}
while (util_1.comparePos(targetCursor, targetToPos) < 0 &&
targetLines.nextPos(targetCursor, true)) {
assert_1.default.ok(sourceLines.nextPos(sourceCursor, true));
assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
}
}
else {
// Skipping backward.
sourceCursor =
sourceLines.skipSpaces(sourceFromPos, true) || sourceLines.firstPos();
targetCursor =
targetLines.skipSpaces(targetFromPos, true) || targetLines.firstPos();
var lineDiff = targetToPos.line - targetCursor.line;
sourceCursor.line += lineDiff;
targetCursor.line += lineDiff;
if (lineDiff < 0) {
// If jumping to earlier lines, reset columns to the ends of
// those lines.
sourceCursor.column = sourceLines.getLineLength(sourceCursor.line);
targetCursor.column = targetLines.getLineLength(targetCursor.line);
}
else {
assert_1.default.strictEqual(lineDiff, 0);
}
while (util_1.comparePos(targetToPos, targetCursor) < 0 &&
targetLines.prevPos(targetCursor, true)) {
assert_1.default.ok(sourceLines.prevPos(sourceCursor, true));
assert_1.default.strictEqual(sourceLines.charAt(sourceCursor), targetLines.charAt(targetCursor));
}
}
return sourceCursor;
}

148
node_modules/recast/lib/options.d.ts generated vendored Normal file
View File

@@ -0,0 +1,148 @@
import { Omit } from "ast-types/types";
/**
* All Recast API functions take second parameter with configuration options,
* documented in options.js
*/
export interface Options extends DeprecatedOptions {
/**
* If you want to use a different branch of esprima, or any other module
* that supports a .parse function, pass that module object to
* recast.parse as options.parser (legacy synonym: options.esprima).
* @default require("recast/parsers/esprima")
*/
parser?: any;
/**
* Number of spaces the pretty-printer should use per tab for
* indentation. If you do not pass this option explicitly, it will be
* (quite reliably!) inferred from the original code.
* @default 4
*/
tabWidth?: number;
/**
* If you really want the pretty-printer to use tabs instead of spaces,
* make this option true.
* @default false
*/
useTabs?: boolean;
/**
* The reprinting code leaves leading whitespace untouched unless it has
* to reindent a line, or you pass false for this option.
* @default true
*/
reuseWhitespace?: boolean;
/**
* Override this option to use a different line terminator, e.g. \r\n.
* @default require("os").EOL || "\n"
*/
lineTerminator?: string;
/**
* Some of the pretty-printer code (such as that for printing function
* parameter lists) makes a valiant attempt to prevent really long
* lines. You can adjust the limit by changing this option; however,
* there is no guarantee that line length will fit inside this limit.
* @default 74
*/
wrapColumn?: number;
/**
* Pass a string as options.sourceFileName to recast.parse to tell the
* reprinter to keep track of reused code so that it can construct a
* source map automatically.
* @default null
*/
sourceFileName?: string | null;
/**
* Pass a string as options.sourceMapName to recast.print, and (provided
* you passed options.sourceFileName earlier) the PrintResult of
* recast.print will have a .map property for the generated source map.
* @default null
*/
sourceMapName?: string | null;
/**
* If provided, this option will be passed along to the source map
* generator as a root directory for relative source file paths.
* @default null
*/
sourceRoot?: string | null;
/**
* If you provide a source map that was generated from a previous call
* to recast.print as options.inputSourceMap, the old source map will be
* composed with the new source map.
* @default null
*/
inputSourceMap?: string | null;
/**
* If you want esprima to generate .range information (recast only uses
* .loc internally), pass true for this option.
* @default false
*/
range?: boolean;
/**
* If you want esprima not to throw exceptions when it encounters
* non-fatal errors, keep this option true.
* @default true
*/
tolerant?: boolean;
/**
* If you want to override the quotes used in string literals, specify
* either "single", "double", or "auto" here ("auto" will select the one
* which results in the shorter literal) Otherwise, use double quotes.
* @default null
*/
quote?: "single" | "double" | "auto" | null;
/**
* Controls the printing of trailing commas in object literals, array
* expressions and function parameters.
*
* This option could either be:
* * Boolean - enable/disable in all contexts (objects, arrays and function params).
* * Object - enable/disable per context.
*
* Example:
* trailingComma: {
* objects: true,
* arrays: true,
* parameters: false,
* }
*
* @default false
*/
trailingComma?: boolean;
/**
* Controls the printing of spaces inside array brackets.
* See: http://eslint.org/docs/rules/array-bracket-spacing
* @default false
*/
arrayBracketSpacing?: boolean;
/**
* Controls the printing of spaces inside object literals,
* destructuring assignments, and import/export specifiers.
* See: http://eslint.org/docs/rules/object-curly-spacing
* @default true
*/
objectCurlySpacing?: boolean;
/**
* If you want parenthesis to wrap single-argument arrow function
* parameter lists, pass true for this option.
* @default false
*/
arrowParensAlways?: boolean;
/**
* There are 2 supported syntaxes (`,` and `;`) in Flow Object Types;
* The use of commas is in line with the more popular style and matches
* how objects are defined in JS, making it a bit more natural to write.
* @default true
*/
flowObjectCommas?: boolean;
/**
* Whether to return an array of .tokens on the root AST node.
* @default true
*/
tokens?: boolean;
}
interface DeprecatedOptions {
/** @deprecated */
esprima?: any;
}
export declare type NormalizedOptions = Required<Omit<Options, keyof DeprecatedOptions>>;
export declare function normalize(opts?: Options): NormalizedOptions;
export {};

54
node_modules/recast/lib/options.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalize = void 0;
var defaults = {
parser: require("../parsers/esprima"),
tabWidth: 4,
useTabs: false,
reuseWhitespace: true,
lineTerminator: require("os").EOL || "\n",
wrapColumn: 74,
sourceFileName: null,
sourceMapName: null,
sourceRoot: null,
inputSourceMap: null,
range: false,
tolerant: true,
quote: null,
trailingComma: false,
arrayBracketSpacing: false,
objectCurlySpacing: true,
arrowParensAlways: false,
flowObjectCommas: true,
tokens: true,
};
var hasOwn = defaults.hasOwnProperty;
// Copy options and fill in default values.
function normalize(opts) {
var options = opts || defaults;
function get(key) {
return hasOwn.call(options, key) ? options[key] : defaults[key];
}
return {
tabWidth: +get("tabWidth"),
useTabs: !!get("useTabs"),
reuseWhitespace: !!get("reuseWhitespace"),
lineTerminator: get("lineTerminator"),
wrapColumn: Math.max(get("wrapColumn"), 0),
sourceFileName: get("sourceFileName"),
sourceMapName: get("sourceMapName"),
sourceRoot: get("sourceRoot"),
inputSourceMap: get("inputSourceMap"),
parser: get("esprima") || get("parser"),
range: get("range"),
tolerant: get("tolerant"),
quote: get("quote"),
trailingComma: get("trailingComma"),
arrayBracketSpacing: get("arrayBracketSpacing"),
objectCurlySpacing: get("objectCurlySpacing"),
arrowParensAlways: get("arrowParensAlways"),
flowObjectCommas: get("flowObjectCommas"),
tokens: !!get("tokens"),
};
}
exports.normalize = normalize;

2
node_modules/recast/lib/parser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Options } from "./options";
export declare function parse(source: string, options?: Partial<Options>): any;

250
node_modules/recast/lib/parser.js generated vendored Normal file
View File

@@ -0,0 +1,250 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var types = tslib_1.__importStar(require("ast-types"));
var b = types.builders;
var isObject = types.builtInTypes.object;
var isArray = types.builtInTypes.array;
var options_1 = require("./options");
var lines_1 = require("./lines");
var comments_1 = require("./comments");
var util = tslib_1.__importStar(require("./util"));
function parse(source, options) {
options = options_1.normalize(options);
var lines = lines_1.fromString(source, options);
var sourceWithoutTabs = lines.toString({
tabWidth: options.tabWidth,
reuseWhitespace: false,
useTabs: false,
});
var comments = [];
var ast = options.parser.parse(sourceWithoutTabs, {
jsx: true,
loc: true,
locations: true,
range: options.range,
comment: true,
onComment: comments,
tolerant: util.getOption(options, "tolerant", true),
ecmaVersion: 6,
sourceType: util.getOption(options, "sourceType", "module"),
});
// Use ast.tokens if possible, and otherwise fall back to the Esprima
// tokenizer. All the preconfigured ../parsers/* expose ast.tokens
// automatically, but custom parsers might need additional configuration
// to avoid this fallback.
var tokens = Array.isArray(ast.tokens)
? ast.tokens
: require("esprima").tokenize(sourceWithoutTabs, {
loc: true,
});
// We will reattach the tokens array to the file object below.
delete ast.tokens;
// Make sure every token has a token.value string.
tokens.forEach(function (token) {
if (typeof token.value !== "string") {
token.value = lines.sliceString(token.loc.start, token.loc.end);
}
});
if (Array.isArray(ast.comments)) {
comments = ast.comments;
delete ast.comments;
}
if (ast.loc) {
// If the source was empty, some parsers give loc.{start,end}.line
// values of 0, instead of the minimum of 1.
util.fixFaultyLocations(ast, lines);
}
else {
ast.loc = {
start: lines.firstPos(),
end: lines.lastPos(),
};
}
ast.loc.lines = lines;
ast.loc.indent = 0;
var file;
var program;
if (ast.type === "Program") {
program = ast;
// In order to ensure we reprint leading and trailing program
// comments, wrap the original Program node with a File node. Only
// ESTree parsers (Acorn and Esprima) return a Program as the root AST
// node. Most other (Babylon-like) parsers return a File.
file = b.file(ast, options.sourceFileName || null);
file.loc = {
start: lines.firstPos(),
end: lines.lastPos(),
lines: lines,
indent: 0,
};
}
else if (ast.type === "File") {
file = ast;
program = file.program;
}
// Expose file.tokens unless the caller passed false for options.tokens.
if (options.tokens) {
file.tokens = tokens;
}
// Expand the Program's .loc to include all comments (not just those
// attached to the Program node, as its children may have comments as
// well), since sometimes program.loc.{start,end} will coincide with the
// .loc.{start,end} of the first and last *statements*, mistakenly
// excluding comments that fall outside that region.
var trueProgramLoc = util.getTrueLoc({
type: program.type,
loc: program.loc,
body: [],
comments: comments,
}, lines);
program.loc.start = trueProgramLoc.start;
program.loc.end = trueProgramLoc.end;
// Passing file.program here instead of just file means that initial
// comments will be attached to program.body[0] instead of program.
comments_1.attach(comments, program.body.length ? file.program : file, lines);
// Return a copy of the original AST so that any changes made may be
// compared to the original.
return new TreeCopier(lines, tokens).copy(file);
}
exports.parse = parse;
var TreeCopier = function TreeCopier(lines, tokens) {
assert_1.default.ok(this instanceof TreeCopier);
this.lines = lines;
this.tokens = tokens;
this.startTokenIndex = 0;
this.endTokenIndex = tokens.length;
this.indent = 0;
this.seen = new Map();
};
var TCp = TreeCopier.prototype;
TCp.copy = function (node) {
if (this.seen.has(node)) {
return this.seen.get(node);
}
if (isArray.check(node)) {
var copy_1 = new Array(node.length);
this.seen.set(node, copy_1);
node.forEach(function (item, i) {
copy_1[i] = this.copy(item);
}, this);
return copy_1;
}
if (!isObject.check(node)) {
return node;
}
util.fixFaultyLocations(node, this.lines);
var copy = Object.create(Object.getPrototypeOf(node), {
original: {
// Provide a link from the copy to the original.
value: node,
configurable: false,
enumerable: false,
writable: true,
},
});
this.seen.set(node, copy);
var loc = node.loc;
var oldIndent = this.indent;
var newIndent = oldIndent;
var oldStartTokenIndex = this.startTokenIndex;
var oldEndTokenIndex = this.endTokenIndex;
if (loc) {
// When node is a comment, we set node.loc.indent to
// node.loc.start.column so that, when/if we print the comment by
// itself, we can strip that much whitespace from the left margin of
// the comment. This only really matters for multiline Block comments,
// but it doesn't hurt for Line comments.
if (node.type === "Block" ||
node.type === "Line" ||
node.type === "CommentBlock" ||
node.type === "CommentLine" ||
this.lines.isPrecededOnlyByWhitespace(loc.start)) {
newIndent = this.indent = loc.start.column;
}
// Every node.loc has a reference to the original source lines as well
// as a complete list of source tokens.
loc.lines = this.lines;
loc.tokens = this.tokens;
loc.indent = newIndent;
// Set loc.start.token and loc.end.token such that
// loc.tokens.slice(loc.start.token, loc.end.token) returns a list of
// all the tokens that make up this node.
this.findTokenRange(loc);
}
var keys = Object.keys(node);
var keyCount = keys.length;
for (var i = 0; i < keyCount; ++i) {
var key = keys[i];
if (key === "loc") {
copy[key] = node[key];
}
else if (key === "tokens" && node.type === "File") {
// Preserve file.tokens (uncopied) in case client code cares about
// it, even though Recast ignores it when reprinting.
copy[key] = node[key];
}
else {
copy[key] = this.copy(node[key]);
}
}
this.indent = oldIndent;
this.startTokenIndex = oldStartTokenIndex;
this.endTokenIndex = oldEndTokenIndex;
return copy;
};
// If we didn't have any idea where in loc.tokens to look for tokens
// contained by this loc, a binary search would be appropriate, but
// because we maintain this.startTokenIndex and this.endTokenIndex as we
// traverse the AST, we only need to make small (linear) adjustments to
// those indexes with each recursive iteration.
TCp.findTokenRange = function (loc) {
// In the unlikely event that loc.tokens[this.startTokenIndex] starts
// *after* loc.start, we need to rewind this.startTokenIndex first.
while (this.startTokenIndex > 0) {
var token = loc.tokens[this.startTokenIndex];
if (util.comparePos(loc.start, token.loc.start) < 0) {
--this.startTokenIndex;
}
else
break;
}
// In the unlikely event that loc.tokens[this.endTokenIndex - 1] ends
// *before* loc.end, we need to fast-forward this.endTokenIndex first.
while (this.endTokenIndex < loc.tokens.length) {
var token = loc.tokens[this.endTokenIndex];
if (util.comparePos(token.loc.end, loc.end) < 0) {
++this.endTokenIndex;
}
else
break;
}
// Increment this.startTokenIndex until we've found the first token
// contained by this node.
while (this.startTokenIndex < this.endTokenIndex) {
var token = loc.tokens[this.startTokenIndex];
if (util.comparePos(token.loc.start, loc.start) < 0) {
++this.startTokenIndex;
}
else
break;
}
// Index into loc.tokens of the first token within this node.
loc.start.token = this.startTokenIndex;
// Decrement this.endTokenIndex until we've found the first token after
// this node (not contained by the node).
while (this.endTokenIndex > this.startTokenIndex) {
var token = loc.tokens[this.endTokenIndex - 1];
if (util.comparePos(loc.end, token.loc.end) < 0) {
--this.endTokenIndex;
}
else
break;
}
// Index into loc.tokens of the first token *after* this node.
// If loc.start.token === loc.end.token, the node contains no tokens,
// and the index is that of the next token following this node.
loc.end.token = this.endTokenIndex;
};

12
node_modules/recast/lib/patcher.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
interface PatcherType {
replace(loc: any, lines: any): any;
get(loc?: any): any;
tryToReprintComments(newNode: any, oldNode: any, print: any): any;
deleteComments(node: any): any;
}
interface PatcherConstructor {
new (lines: any): PatcherType;
}
declare const Patcher: PatcherConstructor;
export { Patcher };
export declare function getReprinter(path: any): ((print: any) => any) | undefined;

386
node_modules/recast/lib/patcher.js generated vendored Normal file
View File

@@ -0,0 +1,386 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getReprinter = exports.Patcher = void 0;
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var linesModule = tslib_1.__importStar(require("./lines"));
var types = tslib_1.__importStar(require("ast-types"));
var Printable = types.namedTypes.Printable;
var Expression = types.namedTypes.Expression;
var ReturnStatement = types.namedTypes.ReturnStatement;
var SourceLocation = types.namedTypes.SourceLocation;
var util_1 = require("./util");
var fast_path_1 = tslib_1.__importDefault(require("./fast-path"));
var isObject = types.builtInTypes.object;
var isArray = types.builtInTypes.array;
var isString = types.builtInTypes.string;
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
var Patcher = function Patcher(lines) {
assert_1.default.ok(this instanceof Patcher);
assert_1.default.ok(lines instanceof linesModule.Lines);
var self = this, replacements = [];
self.replace = function (loc, lines) {
if (isString.check(lines))
lines = linesModule.fromString(lines);
replacements.push({
lines: lines,
start: loc.start,
end: loc.end,
});
};
self.get = function (loc) {
// If no location is provided, return the complete Lines object.
loc = loc || {
start: { line: 1, column: 0 },
end: { line: lines.length, column: lines.getLineLength(lines.length) },
};
var sliceFrom = loc.start, toConcat = [];
function pushSlice(from, to) {
assert_1.default.ok(util_1.comparePos(from, to) <= 0);
toConcat.push(lines.slice(from, to));
}
replacements
.sort(function (a, b) { return util_1.comparePos(a.start, b.start); })
.forEach(function (rep) {
if (util_1.comparePos(sliceFrom, rep.start) > 0) {
// Ignore nested replacement ranges.
}
else {
pushSlice(sliceFrom, rep.start);
toConcat.push(rep.lines);
sliceFrom = rep.end;
}
});
pushSlice(sliceFrom, loc.end);
return linesModule.concat(toConcat);
};
};
exports.Patcher = Patcher;
var Pp = Patcher.prototype;
Pp.tryToReprintComments = function (newNode, oldNode, print) {
var patcher = this;
if (!newNode.comments && !oldNode.comments) {
// We were (vacuously) able to reprint all the comments!
return true;
}
var newPath = fast_path_1.default.from(newNode);
var oldPath = fast_path_1.default.from(oldNode);
newPath.stack.push("comments", getSurroundingComments(newNode));
oldPath.stack.push("comments", getSurroundingComments(oldNode));
var reprints = [];
var ableToReprintComments = findArrayReprints(newPath, oldPath, reprints);
// No need to pop anything from newPath.stack or oldPath.stack, since
// newPath and oldPath are fresh local variables.
if (ableToReprintComments && reprints.length > 0) {
reprints.forEach(function (reprint) {
var oldComment = reprint.oldPath.getValue();
assert_1.default.ok(oldComment.leading || oldComment.trailing);
patcher.replace(oldComment.loc,
// Comments can't have .comments, so it doesn't matter whether we
// print with comments or without.
print(reprint.newPath).indentTail(oldComment.loc.indent));
});
}
return ableToReprintComments;
};
// Get all comments that are either leading or trailing, ignoring any
// comments that occur inside node.loc. Returns an empty array for nodes
// with no leading or trailing comments.
function getSurroundingComments(node) {
var result = [];
if (node.comments && node.comments.length > 0) {
node.comments.forEach(function (comment) {
if (comment.leading || comment.trailing) {
result.push(comment);
}
});
}
return result;
}
Pp.deleteComments = function (node) {
if (!node.comments) {
return;
}
var patcher = this;
node.comments.forEach(function (comment) {
if (comment.leading) {
// Delete leading comments along with any trailing whitespace they
// might have.
patcher.replace({
start: comment.loc.start,
end: node.loc.lines.skipSpaces(comment.loc.end, false, false),
}, "");
}
else if (comment.trailing) {
// Delete trailing comments along with any leading whitespace they
// might have.
patcher.replace({
start: node.loc.lines.skipSpaces(comment.loc.start, true, false),
end: comment.loc.end,
}, "");
}
});
};
function getReprinter(path) {
assert_1.default.ok(path instanceof fast_path_1.default);
// Make sure that this path refers specifically to a Node, rather than
// some non-Node subproperty of a Node.
var node = path.getValue();
if (!Printable.check(node))
return;
var orig = node.original;
var origLoc = orig && orig.loc;
var lines = origLoc && origLoc.lines;
var reprints = [];
if (!lines || !findReprints(path, reprints))
return;
return function (print) {
var patcher = new Patcher(lines);
reprints.forEach(function (reprint) {
var newNode = reprint.newPath.getValue();
var oldNode = reprint.oldPath.getValue();
SourceLocation.assert(oldNode.loc, true);
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print);
if (needToPrintNewPathWithComments) {
// Since we were not able to preserve all leading/trailing
// comments, we delete oldNode's comments, print newPath with
// comments, and then patch the resulting lines where oldNode used
// to be.
patcher.deleteComments(oldNode);
}
var newLines = print(reprint.newPath, {
includeComments: needToPrintNewPathWithComments,
// If the oldNode we're replacing already had parentheses, we may
// not need to print the new node with any extra parentheses,
// because the existing parentheses will suffice. However, if the
// newNode has a different type than the oldNode, let the printer
// decide if reprint.newPath needs parentheses, as usual.
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens(),
}).indentTail(oldNode.loc.indent);
var nls = needsLeadingSpace(lines, oldNode.loc, newLines);
var nts = needsTrailingSpace(lines, oldNode.loc, newLines);
// If we try to replace the argument of a ReturnStatement like
// return"asdf" with e.g. a literal null expression, we run the risk
// of ending up with returnnull, so we need to add an extra leading
// space in situations where that might happen. Likewise for
// "asdf"in obj. See #170.
if (nls || nts) {
var newParts = [];
nls && newParts.push(" ");
newParts.push(newLines);
nts && newParts.push(" ");
newLines = linesModule.concat(newParts);
}
patcher.replace(oldNode.loc, newLines);
});
// Recall that origLoc is the .loc of an ancestor node that is
// guaranteed to contain all the reprinted nodes and comments.
var patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
if (path.needsParens()) {
return linesModule.concat(["(", patchedLines, ")"]);
}
return patchedLines;
};
}
exports.getReprinter = getReprinter;
// If the last character before oldLoc and the first character of newLines
// are both identifier characters, they must be separated by a space,
// otherwise they will most likely get fused together into a single token.
function needsLeadingSpace(oldLines, oldLoc, newLines) {
var posBeforeOldLoc = util_1.copyPos(oldLoc.start);
// The character just before the location occupied by oldNode.
var charBeforeOldLoc = oldLines.prevPos(posBeforeOldLoc) && oldLines.charAt(posBeforeOldLoc);
// First character of the reprinted node.
var newFirstChar = newLines.charAt(newLines.firstPos());
return (charBeforeOldLoc &&
riskyAdjoiningCharExp.test(charBeforeOldLoc) &&
newFirstChar &&
riskyAdjoiningCharExp.test(newFirstChar));
}
// If the last character of newLines and the first character after oldLoc
// are both identifier characters, they must be separated by a space,
// otherwise they will most likely get fused together into a single token.
function needsTrailingSpace(oldLines, oldLoc, newLines) {
// The character just after the location occupied by oldNode.
var charAfterOldLoc = oldLines.charAt(oldLoc.end);
var newLastPos = newLines.lastPos();
// Last character of the reprinted node.
var newLastChar = newLines.prevPos(newLastPos) && newLines.charAt(newLastPos);
return (newLastChar &&
riskyAdjoiningCharExp.test(newLastChar) &&
charAfterOldLoc &&
riskyAdjoiningCharExp.test(charAfterOldLoc));
}
function findReprints(newPath, reprints) {
var newNode = newPath.getValue();
Printable.assert(newNode);
var oldNode = newNode.original;
Printable.assert(oldNode);
assert_1.default.deepEqual(reprints, []);
if (newNode.type !== oldNode.type) {
return false;
}
var oldPath = new fast_path_1.default(oldNode);
var canReprint = findChildReprints(newPath, oldPath, reprints);
if (!canReprint) {
// Make absolutely sure the calling code does not attempt to reprint
// any nodes.
reprints.length = 0;
}
return canReprint;
}
function findAnyReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
if (newNode === oldNode)
return true;
if (isArray.check(newNode))
return findArrayReprints(newPath, oldPath, reprints);
if (isObject.check(newNode))
return findObjectReprints(newPath, oldPath, reprints);
return false;
}
function findArrayReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
if (newNode === oldNode ||
newPath.valueIsDuplicate() ||
oldPath.valueIsDuplicate()) {
return true;
}
isArray.assert(newNode);
var len = newNode.length;
if (!(isArray.check(oldNode) && oldNode.length === len))
return false;
for (var i = 0; i < len; ++i) {
newPath.stack.push(i, newNode[i]);
oldPath.stack.push(i, oldNode[i]);
var canReprint = findAnyReprints(newPath, oldPath, reprints);
newPath.stack.length -= 2;
oldPath.stack.length -= 2;
if (!canReprint) {
return false;
}
}
return true;
}
function findObjectReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
isObject.assert(newNode);
if (newNode.original === null) {
// If newNode.original node was set to null, reprint the node.
return false;
}
var oldNode = oldPath.getValue();
if (!isObject.check(oldNode))
return false;
if (newNode === oldNode ||
newPath.valueIsDuplicate() ||
oldPath.valueIsDuplicate()) {
return true;
}
if (Printable.check(newNode)) {
if (!Printable.check(oldNode)) {
return false;
}
var newParentNode = newPath.getParentNode();
var oldParentNode = oldPath.getParentNode();
if (oldParentNode !== null &&
oldParentNode.type === "FunctionTypeAnnotation" &&
newParentNode !== null &&
newParentNode.type === "FunctionTypeAnnotation") {
var oldNeedsParens = oldParentNode.params.length !== 1 || !!oldParentNode.params[0].name;
var newNeedParens = newParentNode.params.length !== 1 || !!newParentNode.params[0].name;
if (!oldNeedsParens && newNeedParens) {
return false;
}
}
// Here we need to decide whether the reprinted code for newNode is
// appropriate for patching into the location of oldNode.
if (newNode.type === oldNode.type) {
var childReprints = [];
if (findChildReprints(newPath, oldPath, childReprints)) {
reprints.push.apply(reprints, childReprints);
}
else if (oldNode.loc) {
// If we have no .loc information for oldNode, then we won't be
// able to reprint it.
reprints.push({
oldPath: oldPath.copy(),
newPath: newPath.copy(),
});
}
else {
return false;
}
return true;
}
if (Expression.check(newNode) &&
Expression.check(oldNode) &&
// If we have no .loc information for oldNode, then we won't be
// able to reprint it.
oldNode.loc) {
// If both nodes are subtypes of Expression, then we should be able
// to fill the location occupied by the old node with code printed
// for the new node with no ill consequences.
reprints.push({
oldPath: oldPath.copy(),
newPath: newPath.copy(),
});
return true;
}
// The nodes have different types, and at least one of the types is
// not a subtype of the Expression type, so we cannot safely assume
// the nodes are syntactically interchangeable.
return false;
}
return findChildReprints(newPath, oldPath, reprints);
}
function findChildReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
isObject.assert(newNode);
isObject.assert(oldNode);
if (newNode.original === null) {
// If newNode.original node was set to null, reprint the node.
return false;
}
// If this node needs parentheses and will not be wrapped with
// parentheses when reprinted, then return false to skip reprinting and
// let it be printed generically.
if (newPath.needsParens() && !oldPath.hasParens()) {
return false;
}
var keys = util_1.getUnionOfKeys(oldNode, newNode);
if (oldNode.type === "File" || newNode.type === "File") {
// Don't bother traversing file.tokens, an often very large array
// returned by Babylon, and useless for our purposes.
delete keys.tokens;
}
// Don't bother traversing .loc objects looking for reprintable nodes.
delete keys.loc;
var originalReprintCount = reprints.length;
for (var k in keys) {
if (k.charAt(0) === "_") {
// Ignore "private" AST properties added by e.g. Babel plugins and
// parsers like Babylon.
continue;
}
newPath.stack.push(k, types.getFieldValue(newNode, k));
oldPath.stack.push(k, types.getFieldValue(oldNode, k));
var canReprint = findAnyReprints(newPath, oldPath, reprints);
newPath.stack.length -= 2;
oldPath.stack.length -= 2;
if (!canReprint) {
return false;
}
}
// Return statements might end up running into ASI issues due to
// comments inserted deep within the tree, so reprint them if anything
// changed within them.
if (ReturnStatement.check(newPath.getNode()) &&
reprints.length > originalReprintCount) {
return false;
}
return true;
}

14
node_modules/recast/lib/printer.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export interface PrintResultType {
code: string;
map?: any;
toString(): string;
}
interface PrinterType {
print(ast: any): PrintResultType;
printGenerically(ast: any): PrintResultType;
}
interface PrinterConstructor {
new (config?: any): PrinterType;
}
declare const Printer: PrinterConstructor;
export { Printer };

2262
node_modules/recast/lib/printer.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

16
node_modules/recast/lib/util.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
export declare function getOption(options: any, key: any, defaultValue: any): any;
export declare function getUnionOfKeys(...args: any[]): any;
export declare function comparePos(pos1: any, pos2: any): number;
export declare function copyPos(pos: any): {
line: any;
column: any;
};
export declare function composeSourceMaps(formerMap: any, latterMap: any): any;
export declare function getTrueLoc(node: any, lines: any): {
start: any;
end: any;
} | null;
export declare function fixFaultyLocations(node: any, lines: any): void;
export declare function isExportDeclaration(node: any): boolean;
export declare function getParentExportDeclaration(path: any): any;
export declare function isTrailingCommaEnabled(options: any, context: any): boolean;

323
node_modules/recast/lib/util.js generated vendored Normal file
View File

@@ -0,0 +1,323 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTrailingCommaEnabled = exports.getParentExportDeclaration = exports.isExportDeclaration = exports.fixFaultyLocations = exports.getTrueLoc = exports.composeSourceMaps = exports.copyPos = exports.comparePos = exports.getUnionOfKeys = exports.getOption = void 0;
var tslib_1 = require("tslib");
var assert_1 = tslib_1.__importDefault(require("assert"));
var types = tslib_1.__importStar(require("ast-types"));
var n = types.namedTypes;
var source_map_1 = tslib_1.__importDefault(require("source-map"));
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
var hasOwn = Object.prototype.hasOwnProperty;
function getOption(options, key, defaultValue) {
if (options && hasOwn.call(options, key)) {
return options[key];
}
return defaultValue;
}
exports.getOption = getOption;
function getUnionOfKeys() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var result = {};
var argc = args.length;
for (var i = 0; i < argc; ++i) {
var keys = Object.keys(args[i]);
var keyCount = keys.length;
for (var j = 0; j < keyCount; ++j) {
result[keys[j]] = true;
}
}
return result;
}
exports.getUnionOfKeys = getUnionOfKeys;
function comparePos(pos1, pos2) {
return pos1.line - pos2.line || pos1.column - pos2.column;
}
exports.comparePos = comparePos;
function copyPos(pos) {
return {
line: pos.line,
column: pos.column,
};
}
exports.copyPos = copyPos;
function composeSourceMaps(formerMap, latterMap) {
if (formerMap) {
if (!latterMap) {
return formerMap;
}
}
else {
return latterMap || null;
}
var smcFormer = new SourceMapConsumer(formerMap);
var smcLatter = new SourceMapConsumer(latterMap);
var smg = new SourceMapGenerator({
file: latterMap.file,
sourceRoot: latterMap.sourceRoot,
});
var sourcesToContents = {};
smcLatter.eachMapping(function (mapping) {
var origPos = smcFormer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn,
});
var sourceName = origPos.source;
if (sourceName === null) {
return;
}
smg.addMapping({
source: sourceName,
original: copyPos(origPos),
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn,
},
name: mapping.name,
});
var sourceContent = smcFormer.sourceContentFor(sourceName);
if (sourceContent && !hasOwn.call(sourcesToContents, sourceName)) {
sourcesToContents[sourceName] = sourceContent;
smg.setSourceContent(sourceName, sourceContent);
}
});
return smg.toJSON();
}
exports.composeSourceMaps = composeSourceMaps;
function getTrueLoc(node, lines) {
// It's possible that node is newly-created (not parsed by Esprima),
// in which case it probably won't have a .loc property (or an
// .original property for that matter). That's fine; we'll just
// pretty-print it as usual.
if (!node.loc) {
return null;
}
var result = {
start: node.loc.start,
end: node.loc.end,
};
function include(node) {
expandLoc(result, node.loc);
}
// If the node is an export declaration and its .declaration has any
// decorators, their locations might contribute to the true start/end
// positions of the export declaration node.
if (node.declaration &&
node.declaration.decorators &&
isExportDeclaration(node)) {
node.declaration.decorators.forEach(include);
}
if (comparePos(result.start, result.end) < 0) {
// Trim leading whitespace.
result.start = copyPos(result.start);
lines.skipSpaces(result.start, false, true);
if (comparePos(result.start, result.end) < 0) {
// Trim trailing whitespace, if the end location is not already the
// same as the start location.
result.end = copyPos(result.end);
lines.skipSpaces(result.end, true, true);
}
}
// If the node has any comments, their locations might contribute to
// the true start/end positions of the node.
if (node.comments) {
node.comments.forEach(include);
}
return result;
}
exports.getTrueLoc = getTrueLoc;
function expandLoc(parentLoc, childLoc) {
if (parentLoc && childLoc) {
if (comparePos(childLoc.start, parentLoc.start) < 0) {
parentLoc.start = childLoc.start;
}
if (comparePos(parentLoc.end, childLoc.end) < 0) {
parentLoc.end = childLoc.end;
}
}
}
function fixFaultyLocations(node, lines) {
var loc = node.loc;
if (loc) {
if (loc.start.line < 1) {
loc.start.line = 1;
}
if (loc.end.line < 1) {
loc.end.line = 1;
}
}
if (node.type === "File") {
// Babylon returns File nodes whose .loc.{start,end} do not include
// leading or trailing whitespace.
loc.start = lines.firstPos();
loc.end = lines.lastPos();
}
fixForLoopHead(node, lines);
fixTemplateLiteral(node, lines);
if (loc && node.decorators) {
// Expand the .loc of the node responsible for printing the decorators
// (here, the decorated node) so that it includes node.decorators.
node.decorators.forEach(function (decorator) {
expandLoc(loc, decorator.loc);
});
}
else if (node.declaration && isExportDeclaration(node)) {
// Nullify .loc information for the child declaration so that we never
// try to reprint it without also reprinting the export declaration.
node.declaration.loc = null;
// Expand the .loc of the node responsible for printing the decorators
// (here, the export declaration) so that it includes node.decorators.
var decorators = node.declaration.decorators;
if (decorators) {
decorators.forEach(function (decorator) {
expandLoc(loc, decorator.loc);
});
}
}
else if ((n.MethodDefinition && n.MethodDefinition.check(node)) ||
(n.Property.check(node) && (node.method || node.shorthand))) {
// If the node is a MethodDefinition or a .method or .shorthand
// Property, then the location information stored in
// node.value.loc is very likely untrustworthy (just the {body}
// part of a method, or nothing in the case of shorthand
// properties), so we null out that information to prevent
// accidental reuse of bogus source code during reprinting.
node.value.loc = null;
if (n.FunctionExpression.check(node.value)) {
// FunctionExpression method values should be anonymous,
// because their .id fields are ignored anyway.
node.value.id = null;
}
}
else if (node.type === "ObjectTypeProperty") {
var loc_1 = node.loc;
var end = loc_1 && loc_1.end;
if (end) {
end = copyPos(end);
if (lines.prevPos(end) && lines.charAt(end) === ",") {
// Some parsers accidentally include trailing commas in the
// .loc.end information for ObjectTypeProperty nodes.
if ((end = lines.skipSpaces(end, true, true))) {
loc_1.end = end;
}
}
}
}
}
exports.fixFaultyLocations = fixFaultyLocations;
function fixForLoopHead(node, lines) {
if (node.type !== "ForStatement") {
return;
}
function fix(child) {
var loc = child && child.loc;
var start = loc && loc.start;
var end = loc && copyPos(loc.end);
while (start && end && comparePos(start, end) < 0) {
lines.prevPos(end);
if (lines.charAt(end) === ";") {
// Update child.loc.end to *exclude* the ';' character.
loc.end.line = end.line;
loc.end.column = end.column;
}
else {
break;
}
}
}
fix(node.init);
fix(node.test);
fix(node.update);
}
function fixTemplateLiteral(node, lines) {
if (node.type !== "TemplateLiteral") {
return;
}
if (node.quasis.length === 0) {
// If there are no quasi elements, then there is nothing to fix.
return;
}
// node.loc is not present when using export default with a template literal
if (node.loc) {
// First we need to exclude the opening ` from the .loc of the first
// quasi element, in case the parser accidentally decided to include it.
var afterLeftBackTickPos = copyPos(node.loc.start);
assert_1.default.strictEqual(lines.charAt(afterLeftBackTickPos), "`");
assert_1.default.ok(lines.nextPos(afterLeftBackTickPos));
var firstQuasi = node.quasis[0];
if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) {
firstQuasi.loc.start = afterLeftBackTickPos;
}
// Next we need to exclude the closing ` from the .loc of the last quasi
// element, in case the parser accidentally decided to include it.
var rightBackTickPos = copyPos(node.loc.end);
assert_1.default.ok(lines.prevPos(rightBackTickPos));
assert_1.default.strictEqual(lines.charAt(rightBackTickPos), "`");
var lastQuasi = node.quasis[node.quasis.length - 1];
if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) {
lastQuasi.loc.end = rightBackTickPos;
}
}
// Now we need to exclude ${ and } characters from the .loc's of all
// quasi elements, since some parsers accidentally include them.
node.expressions.forEach(function (expr, i) {
// Rewind from expr.loc.start over any whitespace and the ${ that
// precedes the expression. The position of the $ should be the same
// as the .loc.end of the preceding quasi element, but some parsers
// accidentally include the ${ in the .loc of the quasi element.
var dollarCurlyPos = lines.skipSpaces(expr.loc.start, true, false);
if (lines.prevPos(dollarCurlyPos) &&
lines.charAt(dollarCurlyPos) === "{" &&
lines.prevPos(dollarCurlyPos) &&
lines.charAt(dollarCurlyPos) === "$") {
var quasiBefore = node.quasis[i];
if (comparePos(dollarCurlyPos, quasiBefore.loc.end) < 0) {
quasiBefore.loc.end = dollarCurlyPos;
}
}
// Likewise, some parsers accidentally include the } that follows
// the expression in the .loc of the following quasi element.
var rightCurlyPos = lines.skipSpaces(expr.loc.end, false, false);
if (lines.charAt(rightCurlyPos) === "}") {
assert_1.default.ok(lines.nextPos(rightCurlyPos));
// Now rightCurlyPos is technically the position just after the }.
var quasiAfter = node.quasis[i + 1];
if (comparePos(quasiAfter.loc.start, rightCurlyPos) < 0) {
quasiAfter.loc.start = rightCurlyPos;
}
}
});
}
function isExportDeclaration(node) {
if (node)
switch (node.type) {
case "ExportDeclaration":
case "ExportDefaultDeclaration":
case "ExportDefaultSpecifier":
case "DeclareExportDeclaration":
case "ExportNamedDeclaration":
case "ExportAllDeclaration":
return true;
}
return false;
}
exports.isExportDeclaration = isExportDeclaration;
function getParentExportDeclaration(path) {
var parentNode = path.getParentNode();
if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
return parentNode;
}
return null;
}
exports.getParentExportDeclaration = getParentExportDeclaration;
function isTrailingCommaEnabled(options, context) {
var trailingComma = options.trailingComma;
if (typeof trailingComma === "object") {
return !!trailingComma[context];
}
return !!trailingComma;
}
exports.isTrailingCommaEnabled = isTrailingCommaEnabled;

50
node_modules/recast/main.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import * as types from "ast-types";
import { parse } from "./lib/parser";
import { Options } from "./lib/options";
export {
/**
* Parse a string of code into an augmented syntax tree suitable for
* arbitrary modification and reprinting.
*/
parse,
/**
* Convenient shorthand for the ast-types package.
*/
types, };
/**
* Traverse and potentially modify an abstract syntax tree using a
* convenient visitor syntax:
*
* recast.visit(ast, {
* names: [],
* visitIdentifier: function(path) {
* var node = path.value;
* this.visitor.names.push(node.name);
* this.traverse(path);
* }
* });
*/
export { visit } from "ast-types";
/**
* Options shared between parsing and printing.
*/
export { Options } from "./lib/options";
/**
* Reprint a modified syntax tree using as much of the original source
* code as possible.
*/
export declare function print(node: types.ASTNode, options?: Options): import("./lib/printer").PrintResultType;
/**
* Print without attempting to reuse any original source code.
*/
export declare function prettyPrint(node: types.ASTNode, options?: Options): import("./lib/printer").PrintResultType;
/**
* Convenient command-line interface (see e.g. example/add-braces).
*/
export declare function run(transformer: Transformer, options?: RunOptions): void;
export interface Transformer {
(ast: types.ASTNode, callback: (ast: types.ASTNode) => void): void;
}
export interface RunOptions extends Options {
writeback?(code: string): void;
}

65
node_modules/recast/main.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = exports.prettyPrint = exports.print = exports.types = exports.parse = void 0;
var tslib_1 = require("tslib");
var fs_1 = tslib_1.__importDefault(require("fs"));
var types = tslib_1.__importStar(require("ast-types"));
exports.types = types;
var parser_1 = require("./lib/parser");
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parser_1.parse; } });
var printer_1 = require("./lib/printer");
/**
* Traverse and potentially modify an abstract syntax tree using a
* convenient visitor syntax:
*
* recast.visit(ast, {
* names: [],
* visitIdentifier: function(path) {
* var node = path.value;
* this.visitor.names.push(node.name);
* this.traverse(path);
* }
* });
*/
var ast_types_1 = require("ast-types");
Object.defineProperty(exports, "visit", { enumerable: true, get: function () { return ast_types_1.visit; } });
/**
* Reprint a modified syntax tree using as much of the original source
* code as possible.
*/
function print(node, options) {
return new printer_1.Printer(options).print(node);
}
exports.print = print;
/**
* Print without attempting to reuse any original source code.
*/
function prettyPrint(node, options) {
return new printer_1.Printer(options).printGenerically(node);
}
exports.prettyPrint = prettyPrint;
/**
* Convenient command-line interface (see e.g. example/add-braces).
*/
function run(transformer, options) {
return runFile(process.argv[2], transformer, options);
}
exports.run = run;
function runFile(path, transformer, options) {
fs_1.default.readFile(path, "utf-8", function (err, code) {
if (err) {
console.error(err);
return;
}
runString(code, transformer, options);
});
}
function defaultWriteback(output) {
process.stdout.write(output);
}
function runString(code, transformer, options) {
var writeback = options && options.writeback || defaultWriteback;
transformer(parser_1.parse(code, options), function (node) {
writeback(print(node, options).code);
});
}

View File

@@ -0,0 +1,15 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

12
node_modules/recast/node_modules/tslib/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,12 @@
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

164
node_modules/recast/node_modules/tslib/README.md generated vendored Normal file
View File

@@ -0,0 +1,164 @@
# tslib
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
This library is primarily used by the `--importHelpers` flag in TypeScript.
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
```ts
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
```
will instead be emitted as something like the following:
```ts
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
```
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
# Installing
For the latest stable version, run:
## npm
```sh
# TypeScript 3.9.2 or later
npm install tslib
# TypeScript 3.8.4 or earlier
npm install tslib@^1
# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1
```
## yarn
```sh
# TypeScript 3.9.2 or later
yarn add tslib
# TypeScript 3.8.4 or earlier
yarn add tslib@^1
# TypeScript 2.3.2 or earlier
yarn add tslib@1.6.1
```
## bower
```sh
# TypeScript 3.9.2 or later
bower install tslib
# TypeScript 3.8.4 or earlier
bower install tslib@^1
# TypeScript 2.3.2 or earlier
bower install tslib@1.6.1
```
## JSPM
```sh
# TypeScript 3.9.2 or later
jspm install tslib
# TypeScript 3.8.4 or earlier
jspm install tslib@^1
# TypeScript 2.3.2 or earlier
jspm install tslib@1.6.1
```
# Usage
Set the `importHelpers` compiler option on the command line:
```
tsc --importHelpers file.ts
```
or in your tsconfig.json:
```json
{
"compilerOptions": {
"importHelpers": true
}
}
```
#### For bower and JSPM users
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
```json
{
"compilerOptions": {
"module": "amd",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["bower_components/tslib/tslib.d.ts"]
}
}
}
```
For JSPM users:
```json
{
"compilerOptions": {
"module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
}
}
}
```
## Deployment
- Choose your new version number
- Set it in `package.json` and `bower.json`
- Create a tag: `git tag [version]`
- Push the tag: `git push --tags`
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
Done.
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
# Documentation
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
* [Programming handbook](http://www.typescriptlang.org/Handbook)
* [Homepage](http://www.typescriptlang.org/)

View File

@@ -0,0 +1,55 @@
import tslib from '../tslib.js';
const {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
} = tslib;
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
};

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

38
node_modules/recast/node_modules/tslib/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "tslib",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "2.4.0",
"license": "0BSD",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript",
"tslib",
"runtime"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts",
"sideEffects": false,
"exports": {
".": {
"module": "./tslib.es6.js",
"import": "./modules/index.js",
"default": "./tslib.js"
},
"./*": "./*",
"./": "./"
}
}

398
node_modules/recast/node_modules/tslib/tslib.d.ts generated vendored Normal file
View File

@@ -0,0 +1,398 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* Used to shim class extends.
*
* @param d The derived class.
* @param b The base class.
*/
export declare function __extends(d: Function, b: Function): void;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
*
* @param t The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
export declare function __assign(t: any, ...sources: any[]): any;
/**
* Performs a rest spread on an object.
*
* @param t The source value.
* @param propertyNames The property names excluded from the rest spread.
*/
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
/**
* Applies decorators to a target object
*
* @param decorators The set of decorators to apply.
* @param target The target object.
* @param key If specified, the own property to apply the decorators to.
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
* @experimental
*/
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
/**
* Creates an observing function decorator from a parameter decorator.
*
* @param paramIndex The parameter index to apply the decorator to.
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
* @experimental
*/
export declare function __param(paramIndex: number, decorator: Function): Function;
/**
* Creates a decorator that sets metadata.
*
* @param metadataKey The metadata key
* @param metadataValue The metadata value
* @experimental
*/
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
/**
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
* @param generator The generator function
*/
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
/**
* Creates an Iterator object using the body as the implementation.
*
* @param thisArg The reference to use as the `this` value in the function
* @param body The generator state-machine based implementation.
*
* @see [./docs/generator.md]
*/
export declare function __generator(thisArg: any, body: Function): any;
/**
* Creates bindings for all enumerable properties of `m` on `exports`
*
* @param m The source object
* @param exports The `exports` object.
*/
export declare function __exportStar(m: any, o: any): void;
/**
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
*/
export declare function __values(o: any): any;
/**
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
*
* @param o The object to read from.
* @param n The maximum number of arguments to read, defaults to `Infinity`.
*/
export declare function __read(o: any, n?: number): any[];
/**
* Creates an array from iterable spread.
*
* @param args The Iterable objects to spread.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spread(...args: any[][]): any[];
/**
* Creates an array from array spread.
*
* @param args The ArrayLikes to spread into the resulting array.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spreadArrays(...args: any[][]): any[];
/**
* Spreads the `from` array into the `to` array.
*
* @param pack Replace empty elements with `undefined`.
*/
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
/**
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
* and instead should be awaited and the resulting value passed back to the generator.
*
* @param v The value to await.
*/
export declare function __await(v: any): any;
/**
* Converts a generator function into an async generator function, by using `yield __await`
* in place of normal `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param generator The generator function
*/
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
/**
* Used to wrap a potentially async iterator in such a way so that it wraps the result
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
*
* @param o The potentially async iterator.
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
*/
export declare function __asyncDelegator(o: any): any;
/**
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
*/
export declare function __asyncValues(o: any): any;
/**
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
*
* @param cooked The cooked possibly-sparse array.
* @param raw The raw string content.
*/
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
/**
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default, { Named, Other } from "mod";
* // or
* import { default as Default, Named, Other } from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importStar<T>(mod: T): T;
/**
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importDefault<T>(mod: T): T | { default: T };
/**
* Emulates reading a private instance field.
*
* @param receiver The instance from which to read the private field.
* @param state A WeakMap containing the private field value for an instance.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, get(o: T): V | undefined },
kind?: "f"
): V;
/**
* Emulates reading a private static field.
*
* @param receiver The object from which to read the private static field.
* @param state The class constructor containing the definition of the static field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "f",
f: { value: V }
): V;
/**
* Emulates evaluating a private instance "get" accessor.
*
* @param receiver The instance on which to evaluate the private "get" accessor.
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
kind: "a",
f: () => V
): V;
/**
* Emulates evaluating a private static "get" accessor.
*
* @param receiver The object on which to evaluate the private static "get" accessor.
* @param state The class constructor containing the definition of the static "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "a",
f: () => V
): V;
/**
* Emulates reading a private instance method.
*
* @param receiver The instance from which to read a private method.
* @param state A WeakSet used to verify an instance supports the private method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private instance method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
receiver: T,
state: { has(o: T): boolean },
kind: "m",
f: V
): V;
/**
* Emulates reading a private static method.
*
* @param receiver The object from which to read the private static method.
* @param state The class constructor containing the definition of the static method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private static method.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
receiver: T,
state: T,
kind: "m",
f: V
): V;
/**
* Emulates writing to a private instance field.
*
* @param receiver The instance on which to set a private field value.
* @param state A WeakMap used to store the private field value for an instance.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, set(o: T, value: V): unknown },
value: V,
kind?: "f"
): V;
/**
* Emulates writing to a private static field.
*
* @param receiver The object on which to set the private static field.
* @param state The class constructor containing the definition of the private static field.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "f",
f: { value: V }
): V;
/**
* Emulates writing to a private instance "set" accessor.
*
* @param receiver The instance on which to evaluate the private instance "set" accessor.
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
* @param value The value to store in the private accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Emulates writing to a private static "set" accessor.
*
* @param receiver The object on which to evaluate the private static "set" accessor.
* @param state The class constructor containing the definition of the static "set" accessor.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Checks for the existence of a private field/method/accessor.
*
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
* @param receiver The object for which to test the presence of the private member.
*/
export declare function __classPrivateFieldIn(
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
receiver: unknown,
): boolean;
/**
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
*
* @param object The local `exports` object.
* @param target The object to re-export from.
* @param key The property key of `target` to re-export.
* @param objectKey The property key to re-export as. Defaults to `key`.
*/
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;

View File

@@ -0,0 +1 @@
<script src="tslib.es6.js"></script>

248
node_modules/recast/node_modules/tslib/tslib.es6.js generated vendored Normal file
View File

@@ -0,0 +1,248 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}

1
node_modules/recast/node_modules/tslib/tslib.html generated vendored Normal file
View File

@@ -0,0 +1 @@
<script src="tslib.js"></script>

317
node_modules/recast/node_modules/tslib/tslib.js generated vendored Normal file
View File

@@ -0,0 +1,317 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __spreadArray;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __classPrivateFieldIn;
var __createBinding;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
}
else {
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar = function(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
};
__createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
/** @deprecated */
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
/** @deprecated */
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
__asyncDelegator = function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
__makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
__importStar = function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
__classPrivateFieldIn = function (state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
};
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__createBinding", __createBinding);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
exporter("__spreadArrays", __spreadArrays);
exporter("__spreadArray", __spreadArray);
exporter("__await", __await);
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
exporter("__makeTemplateObject", __makeTemplateObject);
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
});

73
node_modules/recast/package.json generated vendored Normal file
View File

@@ -0,0 +1,73 @@
{
"author": "Ben Newman <bn@cs.stanford.edu>",
"name": "recast",
"version": "0.20.5",
"description": "JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator",
"keywords": [
"ast",
"rewriting",
"refactoring",
"codegen",
"syntax",
"transformation",
"parsing",
"pretty-printing"
],
"homepage": "http://github.com/benjamn/recast",
"repository": {
"type": "git",
"url": "git://github.com/benjamn/recast.git"
},
"license": "MIT",
"main": "main.js",
"types": "main.d.ts",
"scripts": {
"mocha": "test/run.sh",
"debug": "test/run.sh --inspect-brk",
"test": "npm run lint && npm run build && npm run mocha",
"build": "npm run clean && tsc",
"lint": "eslint --ext .ts .",
"format": "prettier --write '{lib,test}/**.ts' '*rc.js'",
"clean": "ts-emit-clean",
"prepack": "npm run build",
"postpack": "npm run clean"
},
"lint-staged": {
"*.ts": [
"eslint",
"prettier -c"
]
},
"browser": {
"fs": false
},
"dependencies": {
"ast-types": "0.14.2",
"esprima": "~4.0.0",
"source-map": "~0.6.1",
"tslib": "^2.0.1"
},
"devDependencies": {
"@babel/core": "7.14.8",
"@babel/parser": "7.14.8",
"@babel/preset-env": "7.12.13",
"@types/esprima": "4.0.2",
"@types/glob": "7.1.3",
"@types/mocha": "8.2.0",
"@types/node": "16.4.0",
"@typescript-eslint/parser": "^4.9.1",
"eslint": "^7.1.0",
"esprima-fb": "15001.1001.0-dev-harmony-fb",
"flow-parser": "0.156.0",
"glob": "7.1.6",
"lint-staged": "^10.2.6",
"mocha": "8.2.1",
"prettier": "^2.0.5",
"reify": "0.20.12",
"ts-emit-clean": "1.0.0",
"typescript": "^3.9.7"
},
"engines": {
"node": ">= 4"
}
}

8
node_modules/recast/parsers/_babel_options.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { ParserOptions, ParserPlugin } from "@babel/parser";
export declare type Overrides = Partial<{
sourceType: ParserOptions["sourceType"];
strictMode: ParserOptions["strictMode"];
}>;
export default function getBabelOptions(options?: Overrides): ParserOptions & {
plugins: ParserPlugin[];
};

42
node_modules/recast/parsers/_babel_options.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("../lib/util");
function getBabelOptions(options) {
// The goal here is to tolerate as much syntax as possible, since Recast
// is not in the business of forbidding anything. If you want your
// parser to be more restrictive for some reason, you can always pass
// your own parser object to recast.parse.
return {
sourceType: util_1.getOption(options, "sourceType", "module"),
strictMode: util_1.getOption(options, "strictMode", false),
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
startLine: 1,
tokens: true,
plugins: [
"asyncGenerators",
"bigInt",
"classPrivateMethods",
"classPrivateProperties",
"classProperties",
"decorators-legacy",
"doExpressions",
"dynamicImport",
"exportDefaultFrom",
"exportExtensions",
"exportNamespaceFrom",
"functionBind",
"functionSent",
"importMeta",
"nullishCoalescingOperator",
"numericSeparator",
"objectRestSpread",
"optionalCatchBinding",
"optionalChaining",
["pipelineOperator", { proposal: "minimal" }],
"throwExpressions",
]
};
}
exports.default = getBabelOptions;
;

1
node_modules/recast/parsers/acorn.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function parse(source: string, options?: any): any;

34
node_modules/recast/parsers/acorn.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
// This module is suitable for passing as options.parser when calling
// recast.parse to process JavaScript code with Acorn:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/acorn")
// });
//
var util_1 = require("../lib/util");
function parse(source, options) {
var comments = [];
var tokens = [];
var ast = require("acorn").parse(source, {
allowHashBang: true,
allowImportExportEverywhere: true,
allowReturnOutsideFunction: true,
ecmaVersion: util_1.getOption(options, "ecmaVersion", 8),
sourceType: util_1.getOption(options, "sourceType", "module"),
locations: true,
onComment: comments,
onToken: tokens,
});
if (!ast.comments) {
ast.comments = comments;
}
if (!ast.tokens) {
ast.tokens = tokens;
}
return ast;
}
exports.parse = parse;
;

8
node_modules/recast/parsers/babel.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { parse as babelParse } from "@babel/parser";
import { Overrides } from "./_babel_options";
declare type BabelParser = {
parse: typeof babelParse;
};
export declare const parser: BabelParser;
export declare function parse(source: string, options?: Overrides): import("@babel/types").File;
export {};

29
node_modules/recast/parsers/babel.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = exports.parser = void 0;
var tslib_1 = require("tslib");
var _babel_options_1 = tslib_1.__importDefault(require("./_babel_options"));
// Prefer the new @babel/parser package, but fall back to babylon if
// that's what's available.
exports.parser = function () {
try {
return require("@babel/parser");
}
catch (e) {
return require("babylon");
}
}();
// This module is suitable for passing as options.parser when calling
// recast.parse to process JavaScript code with Babel:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/babel")
// });
//
function parse(source, options) {
var babelOptions = _babel_options_1.default(options);
babelOptions.plugins.push("jsx", "flow");
return exports.parser.parse(source, babelOptions);
}
exports.parse = parse;
;

Some files were not shown because too many files have changed in this diff Show More