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

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;
;

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

@@ -0,0 +1 @@
export * from "./babel";

4
node_modules/recast/parsers/babylon.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./babel"), exports);

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

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

30
node_modules/recast/parsers/esprima.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
"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 ECMAScript code with Esprima:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/esprima")
// });
//
var util_1 = require("../lib/util");
function parse(source, options) {
var comments = [];
var ast = require("esprima").parse(source, {
loc: true,
locations: true,
comment: true,
onComment: comments,
range: util_1.getOption(options, "range", false),
tolerant: util_1.getOption(options, "tolerant", true),
tokens: true,
jsx: util_1.getOption(options, "jsx", false)
});
if (!Array.isArray(ast.comments)) {
ast.comments = comments;
}
return ast;
}
exports.parse = parse;
;

2
node_modules/recast/parsers/flow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Overrides } from "./_babel_options";
export declare function parse(source: string, options?: Overrides): import("@babel/types").File;

20
node_modules/recast/parsers/flow.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
var tslib_1 = require("tslib");
var babel_1 = require("./babel");
var _babel_options_1 = tslib_1.__importDefault(require("./_babel_options"));
// This module is suitable for passing as options.parser when calling
// recast.parse to process Flow code:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/flow")
// });
//
function parse(source, options) {
var babelOptions = _babel_options_1.default(options);
babelOptions.plugins.push("jsx", "flow");
return babel_1.parser.parse(source, babelOptions);
}
exports.parse = parse;
;

2
node_modules/recast/parsers/typescript.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Overrides } from "./_babel_options";
export declare function parse(source: string, options?: Overrides): import("@babel/types").File;

20
node_modules/recast/parsers/typescript.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
var tslib_1 = require("tslib");
var babel_1 = require("./babel");
var _babel_options_1 = tslib_1.__importDefault(require("./_babel_options"));
// This module is suitable for passing as options.parser when calling
// recast.parse to process TypeScript code:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/typescript")
// });
//
function parse(source, options) {
var babelOptions = _babel_options_1.default(options);
babelOptions.plugins.push("typescript");
return babel_1.parser.parse(source, babelOptions);
}
exports.parse = parse;
;