"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const babel = require("@babel/parser");
exports.babelParser = {
    parse: (source, options) => {
        let ast = babel.parse(source, defaultOptions);
        if (isASTNode(ast)) {
            return ast;
        }
        throw new Error("This is not an AST Node!");
    }
};
const defaultOptions = {
    sourceType: "module",
    allowImportExportEverywhere: true,
    allowReturnOutsideFunction: true,
    startLine: 1,
    tokens: true,
    plugins: [
        ['flow', { all: true }],
        'jsx',
        'asyncGenerators',
        'bigInt',
        'classProperties',
        'classPrivateProperties',
        'classPrivateMethods',
        ['decorators', { decoratorsBeforeExport: true }],
        'doExpressions',
        'dynamicImport',
        'exportDefaultFrom',
        'exportNamespaceFrom',
        'functionBind',
        'functionSent',
        'importMeta',
        'nullishCoalescingOperator',
        'numericSeparator',
        'objectRestSpread',
        'optionalCatchBinding',
        'optionalChaining',
        ['pipelineOperator', { proposal: 'minimal' }],
        'throwExpressions',
    ],
};
function isASTNode(ast) {
    return ast.loc != null;
}
