This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

306
node_modules/@babel/eslint-parser/lib/analyze-scope.cjs generated vendored Normal file
View File

@ -0,0 +1,306 @@
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
const {
Definition,
PatternVisitor: OriginalPatternVisitor,
Referencer: OriginalReferencer,
Scope,
ScopeManager
} = require("@nicolo-ribaudo/eslint-scope-5-internals");
const {
getKeys: fallback
} = require("eslint-visitor-keys");
let visitorKeysMap;
function getVisitorValues(nodeType, client) {
if (visitorKeysMap) return visitorKeysMap[nodeType];
const {
FLOW_FLIPPED_ALIAS_KEYS,
VISITOR_KEYS
} = client.getTypesInfo();
const flowFlippedAliasKeys = FLOW_FLIPPED_ALIAS_KEYS.concat(["ArrayPattern", "ClassDeclaration", "ClassExpression", "FunctionDeclaration", "FunctionExpression", "Identifier", "ObjectPattern", "RestElement"]);
visitorKeysMap = Object.entries(VISITOR_KEYS).reduce((acc, [key, value]) => {
if (!flowFlippedAliasKeys.includes(value)) {
acc[key] = value;
}
return acc;
}, {});
return visitorKeysMap[nodeType];
}
const propertyTypes = {
callProperties: {
type: "loop",
values: ["value"]
},
indexers: {
type: "loop",
values: ["key", "value"]
},
properties: {
type: "loop",
values: ["argument", "value"]
},
types: {
type: "loop"
},
params: {
type: "loop"
},
argument: {
type: "single"
},
elementType: {
type: "single"
},
qualification: {
type: "single"
},
rest: {
type: "single"
},
returnType: {
type: "single"
},
typeAnnotation: {
type: "typeAnnotation"
},
typeParameters: {
type: "typeParameters"
},
id: {
type: "id"
}
};
class PatternVisitor extends OriginalPatternVisitor {
ArrayPattern(node) {
node.elements.forEach(this.visit, this);
}
ObjectPattern(node) {
node.properties.forEach(this.visit, this);
}
}
var _client = new WeakMap();
class Referencer extends OriginalReferencer {
constructor(options, scopeManager, client) {
super(options, scopeManager);
_classPrivateFieldInitSpec(this, _client, {
writable: true,
value: void 0
});
_classPrivateFieldSet(this, _client, client);
}
visitPattern(node, options, callback) {
if (!node) {
return;
}
this._checkIdentifierOrVisit(node.typeAnnotation);
if (node.type === "AssignmentPattern") {
this._checkIdentifierOrVisit(node.left.typeAnnotation);
}
if (typeof options === "function") {
callback = options;
options = {
processRightHandNodes: false
};
}
const visitor = new PatternVisitor(this.options, node, callback);
visitor.visit(node);
if (options.processRightHandNodes) {
visitor.rightHandNodes.forEach(this.visit, this);
}
}
visitClass(node) {
this._visitArray(node.decorators);
const typeParamScope = this._nestTypeParamScope(node);
this._visitTypeAnnotation(node.implements);
this._visitTypeAnnotation(node.superTypeParameters && node.superTypeParameters.params);
super.visitClass(node);
if (typeParamScope) {
this.close(node);
}
}
visitFunction(node) {
const typeParamScope = this._nestTypeParamScope(node);
this._checkIdentifierOrVisit(node.returnType);
super.visitFunction(node);
if (typeParamScope) {
this.close(node);
}
}
visitProperty(node) {
var _node$value;
if (((_node$value = node.value) == null ? void 0 : _node$value.type) === "TypeCastExpression") {
this._visitTypeAnnotation(node.value);
}
this._visitArray(node.decorators);
super.visitProperty(node);
}
InterfaceDeclaration(node) {
this._createScopeVariable(node, node.id);
const typeParamScope = this._nestTypeParamScope(node);
this._visitArray(node.extends);
this.visit(node.body);
if (typeParamScope) {
this.close(node);
}
}
TypeAlias(node) {
this._createScopeVariable(node, node.id);
const typeParamScope = this._nestTypeParamScope(node);
this.visit(node.right);
if (typeParamScope) {
this.close(node);
}
}
ClassProperty(node) {
this._visitClassProperty(node);
}
ClassPrivateProperty(node) {
this._visitClassProperty(node);
}
PropertyDefinition(node) {
this._visitClassProperty(node);
}
ClassPrivateMethod(node) {
super.MethodDefinition(node);
}
DeclareModule(node) {
this._visitDeclareX(node);
}
DeclareFunction(node) {
this._visitDeclareX(node);
}
DeclareVariable(node) {
this._visitDeclareX(node);
}
DeclareClass(node) {
this._visitDeclareX(node);
}
OptionalMemberExpression(node) {
super.MemberExpression(node);
}
_visitClassProperty(node) {
this._visitTypeAnnotation(node.typeAnnotation);
this.visitProperty(node);
}
_visitDeclareX(node) {
if (node.id) {
this._createScopeVariable(node, node.id);
}
const typeParamScope = this._nestTypeParamScope(node);
if (typeParamScope) {
this.close(node);
}
}
_createScopeVariable(node, name) {
this.currentScope().variableScope.__define(name, new Definition("Variable", name, node, null, null, null));
}
_nestTypeParamScope(node) {
if (!node.typeParameters) {
return null;
}
const parentScope = this.scopeManager.__currentScope;
const scope = new Scope(this.scopeManager, "type-parameters", parentScope, node, false);
this.scopeManager.__nestScope(scope);
for (let j = 0; j < node.typeParameters.params.length; j++) {
const name = node.typeParameters.params[j];
scope.__define(name, new Definition("TypeParameter", name, name));
if (name.typeAnnotation) {
this._checkIdentifierOrVisit(name);
}
}
scope.__define = function () {
return parentScope.__define.apply(parentScope, arguments);
};
return scope;
}
_visitTypeAnnotation(node) {
if (!node) {
return;
}
if (Array.isArray(node)) {
node.forEach(this._visitTypeAnnotation, this);
return;
}
const visitorValues = getVisitorValues(node.type, _classPrivateFieldGet(this, _client));
if (!visitorValues) {
return;
}
for (let i = 0; i < visitorValues.length; i++) {
const visitorValue = visitorValues[i];
const propertyType = propertyTypes[visitorValue];
const nodeProperty = node[visitorValue];
if (propertyType == null || nodeProperty == null) {
continue;
}
if (propertyType.type === "loop") {
for (let j = 0; j < nodeProperty.length; j++) {
if (Array.isArray(propertyType.values)) {
for (let k = 0; k < propertyType.values.length; k++) {
const loopPropertyNode = nodeProperty[j][propertyType.values[k]];
if (loopPropertyNode) {
this._checkIdentifierOrVisit(loopPropertyNode);
}
}
} else {
this._checkIdentifierOrVisit(nodeProperty[j]);
}
}
} else if (propertyType.type === "single") {
this._checkIdentifierOrVisit(nodeProperty);
} else if (propertyType.type === "typeAnnotation") {
this._visitTypeAnnotation(node.typeAnnotation);
} else if (propertyType.type === "typeParameters") {
for (let l = 0; l < node.typeParameters.params.length; l++) {
this._checkIdentifierOrVisit(node.typeParameters.params[l]);
}
} else if (propertyType.type === "id") {
if (node.id.type === "Identifier") {
this._checkIdentifierOrVisit(node.id);
} else {
this._visitTypeAnnotation(node.id);
}
}
}
}
_checkIdentifierOrVisit(node) {
if (node != null && node.typeAnnotation) {
this._visitTypeAnnotation(node.typeAnnotation);
} else if ((node == null ? void 0 : node.type) === "Identifier") {
this.visit(node);
} else {
this._visitTypeAnnotation(node);
}
}
_visitArray(nodeList) {
if (nodeList) {
for (const node of nodeList) {
this.visit(node);
}
}
}
}
module.exports = function analyzeScope(ast, parserOptions, client) {
var _parserOptions$ecmaFe;
const options = {
ignoreEval: true,
optimistic: false,
directive: false,
nodejsScope: ast.sourceType === "script" && ((_parserOptions$ecmaFe = parserOptions.ecmaFeatures) == null ? void 0 : _parserOptions$ecmaFe.globalReturn) === true,
impliedStrict: false,
sourceType: ast.sourceType,
ecmaVersion: parserOptions.ecmaVersion,
fallback
};
options.childVisitorKeys = client.getVisitorKeys();
const scopeManager = new ScopeManager(options);
const referencer = new Referencer(options, scopeManager, client);
referencer.visit(ast);
return scopeManager;
};
//# sourceMappingURL=analyze-scope.cjs.map

File diff suppressed because one or more lines are too long

126
node_modules/@babel/eslint-parser/lib/client.cjs generated vendored Normal file
View File

@ -0,0 +1,126 @@
var _class, _worker, _worker_threads, _worker_threads_cache;
function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { if (descriptor === undefined) { throw new TypeError("attempted to " + action + " private static field before its declaration"); } }
function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } }
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
const path = require("path");
const ACTIONS = {
GET_VERSION: "GET_VERSION",
GET_TYPES_INFO: "GET_TYPES_INFO",
GET_VISITOR_KEYS: "GET_VISITOR_KEYS",
GET_TOKEN_LABELS: "GET_TOKEN_LABELS",
MAYBE_PARSE: "MAYBE_PARSE",
MAYBE_PARSE_SYNC: "MAYBE_PARSE_SYNC"
};
var _send = new WeakMap();
var _vCache = new WeakMap();
var _tiCache = new WeakMap();
var _vkCache = new WeakMap();
var _tlCache = new WeakMap();
class Client {
constructor(send) {
_classPrivateFieldInitSpec(this, _send, {
writable: true,
value: void 0
});
_classPrivateFieldInitSpec(this, _vCache, {
writable: true,
value: void 0
});
_classPrivateFieldInitSpec(this, _tiCache, {
writable: true,
value: void 0
});
_classPrivateFieldInitSpec(this, _vkCache, {
writable: true,
value: void 0
});
_classPrivateFieldInitSpec(this, _tlCache, {
writable: true,
value: void 0
});
_classPrivateFieldSet(this, _send, send);
}
getVersion() {
var _classPrivateFieldGet2;
return (_classPrivateFieldGet2 = _classPrivateFieldGet(this, _vCache)) != null ? _classPrivateFieldGet2 : _classPrivateFieldSet(this, _vCache, _classPrivateFieldGet(this, _send).call(this, ACTIONS.GET_VERSION, undefined));
}
getTypesInfo() {
var _classPrivateFieldGet3;
return (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _tiCache)) != null ? _classPrivateFieldGet3 : _classPrivateFieldSet(this, _tiCache, _classPrivateFieldGet(this, _send).call(this, ACTIONS.GET_TYPES_INFO, undefined));
}
getVisitorKeys() {
var _classPrivateFieldGet4;
return (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _vkCache)) != null ? _classPrivateFieldGet4 : _classPrivateFieldSet(this, _vkCache, _classPrivateFieldGet(this, _send).call(this, ACTIONS.GET_VISITOR_KEYS, undefined));
}
getTokLabels() {
var _classPrivateFieldGet5;
return (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _tlCache)) != null ? _classPrivateFieldGet5 : _classPrivateFieldSet(this, _tlCache, _classPrivateFieldGet(this, _send).call(this, ACTIONS.GET_TOKEN_LABELS, undefined));
}
maybeParse(code, options) {
return _classPrivateFieldGet(this, _send).call(this, ACTIONS.MAYBE_PARSE, {
code,
options
});
}
}
exports.WorkerClient = (_worker = new WeakMap(), (_class = class WorkerClient extends Client {
constructor() {
super((action, payload) => {
const signal = new Int32Array(new SharedArrayBuffer(8));
const subChannel = new (_classStaticPrivateFieldSpecGet(WorkerClient, _class, _worker_threads).MessageChannel)();
_classPrivateFieldGet(this, _worker).postMessage({
signal,
port: subChannel.port1,
action,
payload
}, [subChannel.port1]);
Atomics.wait(signal, 0, 0);
const {
message
} = _classStaticPrivateFieldSpecGet(WorkerClient, _class, _worker_threads).receiveMessageOnPort(subChannel.port2);
if (message.error) throw Object.assign(message.error, message.errorData);else return message.result;
});
_classPrivateFieldInitSpec(this, _worker, {
writable: true,
value: new (_classStaticPrivateFieldSpecGet(WorkerClient, _class, _worker_threads).Worker)(path.resolve(__dirname, "../lib/worker/index.cjs"), {
env: _classStaticPrivateFieldSpecGet(WorkerClient, _class, _worker_threads).SHARE_ENV
})
});
_classPrivateFieldGet(this, _worker).unref();
}
}, _worker_threads = {
get: _get_worker_threads,
set: void 0
}, _worker_threads_cache = {
writable: true,
value: void 0
}, _class));
function _get_worker_threads() {
var _classStaticPrivateFi2;
return (_classStaticPrivateFi2 = _classStaticPrivateFieldSpecGet(_class, _class, _worker_threads_cache)) != null ? _classStaticPrivateFi2 : _classStaticPrivateFieldSpecSet(_class, _class, _worker_threads_cache, require("worker_threads"));
}
{
var _class2, _handleMessage;
exports.LocalClient = (_class2 = class LocalClient extends Client {
constructor() {
var _classStaticPrivateFi;
(_classStaticPrivateFi = _classStaticPrivateFieldSpecGet(LocalClient, _class2, _handleMessage)) != null ? _classStaticPrivateFi : _classStaticPrivateFieldSpecSet(LocalClient, _class2, _handleMessage, require("./worker/handle-message.cjs"));
super((action, payload) => {
return _classStaticPrivateFieldSpecGet(LocalClient, _class2, _handleMessage).call(LocalClient, action === ACTIONS.MAYBE_PARSE ? ACTIONS.MAYBE_PARSE_SYNC : action, payload);
});
}
}, _handleMessage = {
writable: true,
value: void 0
}, _class2);
}
//# sourceMappingURL=client.cjs.map

1
node_modules/@babel/eslint-parser/lib/client.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
const _excluded = ["babelOptions", "ecmaVersion", "sourceType", "requireConfigFile"];
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
exports.normalizeESLintConfig = function (options) {
const {
babelOptions = {},
ecmaVersion = 2020,
sourceType = "module",
requireConfigFile = true
} = options,
otherOptions = _objectWithoutPropertiesLoose(options, _excluded);
return Object.assign({
babelOptions: Object.assign({
cwd: process.cwd()
}, babelOptions),
ecmaVersion: ecmaVersion === "latest" ? 1e8 : ecmaVersion,
sourceType,
requireConfigFile
}, otherOptions);
};
//# sourceMappingURL=configuration.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["exports","normalizeESLintConfig","options","babelOptions","ecmaVersion","sourceType","requireConfigFile","otherOptions","_objectWithoutPropertiesLoose","_excluded","Object","assign","cwd","process"],"sources":["../src/configuration.cjs"],"sourcesContent":["exports.normalizeESLintConfig = function (options) {\n const {\n babelOptions = {},\n // ESLint sets ecmaVersion: undefined when ecmaVersion is not set in the config.\n ecmaVersion = 2020,\n sourceType = \"module\",\n requireConfigFile = true,\n ...otherOptions\n } = options;\n\n return {\n babelOptions: { cwd: process.cwd(), ...babelOptions },\n ecmaVersion: ecmaVersion === \"latest\" ? 1e8 : ecmaVersion,\n sourceType,\n requireConfigFile,\n ...otherOptions,\n };\n};\n"],"mappings":";;AAAAA,OAAO,CAACC,qBAAqB,GAAG,UAAUC,OAAO,EAAE;EACjD,MAAM;MACJC,YAAY,GAAG,CAAC,CAAC;MAEjBC,WAAW,GAAG,IAAI;MAClBC,UAAU,GAAG,QAAQ;MACrBC,iBAAiB,GAAG;IAEtB,CAAC,GAAGJ,OAAO;IADNK,YAAY,GAAAC,6BAAA,CACbN,OAAO,EAAAO,SAAA;EAEX,OAAAC,MAAA,CAAAC,MAAA;IACER,YAAY,EAAAO,MAAA,CAAAC,MAAA;MAAIC,GAAG,EAAEC,OAAO,CAACD,GAAG,CAAC;IAAC,GAAKT,YAAY,CAAE;IACrDC,WAAW,EAAEA,WAAW,KAAK,QAAQ,GAAG,GAAG,GAAGA,WAAW;IACzDC,UAAU;IACVC;EAAiB,GACdC,YAAY;AAEnB,CAAC"}

View File

@ -0,0 +1,129 @@
const ESLINT_VERSION = require("../utils/eslint-version.cjs");
function* it(children) {
if (Array.isArray(children)) yield* children;else yield children;
}
function traverse(node, visitorKeys, visitor) {
const {
type
} = node;
if (!type) return;
const keys = visitorKeys[type];
if (!keys) return;
for (const key of keys) {
for (const child of it(node[key])) {
if (child && typeof child === "object") {
visitor.enter(child);
traverse(child, visitorKeys, visitor);
visitor.exit(child);
}
}
}
}
const convertNodesVisitor = {
enter(node) {
if (node.innerComments) {
delete node.innerComments;
}
if (node.trailingComments) {
delete node.trailingComments;
}
if (node.leadingComments) {
delete node.leadingComments;
}
},
exit(node) {
if (node.extra) {
delete node.extra;
}
if (node.loc.identifierName) {
delete node.loc.identifierName;
}
if (node.type === "TypeParameter") {
node.type = "Identifier";
node.typeAnnotation = node.bound;
delete node.bound;
}
if (node.type === "QualifiedTypeIdentifier") {
delete node.id;
}
if (node.type === "ObjectTypeProperty") {
delete node.key;
}
if (node.type === "ObjectTypeIndexer") {
delete node.id;
}
if (node.type === "FunctionTypeParam") {
delete node.name;
}
if (node.type === "ImportDeclaration") {
delete node.isType;
}
if (node.type === "TemplateLiteral") {
for (let i = 0; i < node.quasis.length; i++) {
const q = node.quasis[i];
q.range[0] -= 1;
if (q.tail) {
q.range[1] += 1;
} else {
q.range[1] += 2;
}
q.loc.start.column -= 1;
if (q.tail) {
q.loc.end.column += 1;
} else {
q.loc.end.column += 2;
}
if (ESLINT_VERSION >= 8) {
q.start -= 1;
if (q.tail) {
q.end += 1;
} else {
q.end += 2;
}
}
}
}
}
};
function convertNodes(ast, visitorKeys) {
traverse(ast, visitorKeys, convertNodesVisitor);
}
function convertProgramNode(ast) {
ast.type = "Program";
ast.sourceType = ast.program.sourceType;
ast.body = ast.program.body;
delete ast.program;
delete ast.errors;
if (ast.comments.length) {
const lastComment = ast.comments[ast.comments.length - 1];
if (ast.tokens.length) {
const lastToken = ast.tokens[ast.tokens.length - 1];
if (lastComment.end > lastToken.end) {
ast.range[1] = lastToken.end;
ast.loc.end.line = lastToken.loc.end.line;
ast.loc.end.column = lastToken.loc.end.column;
if (ESLINT_VERSION >= 8) {
ast.end = lastToken.end;
}
}
}
} else {
if (!ast.tokens.length) {
ast.loc.start.line = 1;
ast.loc.end.line = 1;
}
}
if (ast.body && ast.body.length > 0) {
ast.loc.start.line = ast.body[0].loc.start.line;
ast.range[0] = ast.body[0].start;
if (ESLINT_VERSION >= 8) {
ast.start = ast.body[0].start;
}
}
}
module.exports = function convertAST(ast, visitorKeys) {
convertNodes(ast, visitorKeys);
convertProgramNode(ast);
};
//# sourceMappingURL=convertAST.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
module.exports = function convertComments(comments) {
for (const comment of comments) {
if (comment.type === "CommentBlock") {
comment.type = "Block";
} else if (comment.type === "CommentLine") {
comment.type = "Line";
}
if (!comment.range) {
comment.range = [comment.start, comment.end];
}
}
};
//# sourceMappingURL=convertComments.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["module","exports","convertComments","comments","comment","type","range","start","end"],"sources":["../../src/convert/convertComments.cjs"],"sourcesContent":["module.exports = function convertComments(comments) {\n for (const comment of comments) {\n if (comment.type === \"CommentBlock\") {\n comment.type = \"Block\";\n } else if (comment.type === \"CommentLine\") {\n comment.type = \"Line\";\n }\n // sometimes comments don't get ranges computed,\n // even with options.ranges === true\n if (!comment.range) {\n comment.range = [comment.start, comment.end];\n }\n }\n};\n"],"mappings":"AAAAA,MAAM,CAACC,OAAO,GAAG,SAASC,eAAeA,CAACC,QAAQ,EAAE;EAClD,KAAK,MAAMC,OAAO,IAAID,QAAQ,EAAE;IAC9B,IAAIC,OAAO,CAACC,IAAI,KAAK,cAAc,EAAE;MACnCD,OAAO,CAACC,IAAI,GAAG,OAAO;IACxB,CAAC,MAAM,IAAID,OAAO,CAACC,IAAI,KAAK,aAAa,EAAE;MACzCD,OAAO,CAACC,IAAI,GAAG,MAAM;IACvB;IAGA,IAAI,CAACD,OAAO,CAACE,KAAK,EAAE;MAClBF,OAAO,CAACE,KAAK,GAAG,CAACF,OAAO,CAACG,KAAK,EAAEH,OAAO,CAACI,GAAG,CAAC;IAC9C;EACF;AACF,CAAC"}

View File

@ -0,0 +1,159 @@
const ESLINT_VERSION = require("../utils/eslint-version.cjs");
function convertTemplateType(tokens, tl) {
let curlyBrace = null;
let templateTokens = [];
const result = [];
function addTemplateType() {
const start = templateTokens[0];
const end = templateTokens[templateTokens.length - 1];
const value = templateTokens.reduce((result, token) => {
if (token.value) {
result += token.value;
} else if (token.type.label !== tl.template) {
result += token.type.label;
}
return result;
}, "");
result.push({
type: "Template",
value: value,
start: start.start,
end: end.end,
loc: {
start: start.loc.start,
end: end.loc.end
}
});
templateTokens = [];
}
tokens.forEach(token => {
switch (token.type.label) {
case tl.backQuote:
if (curlyBrace) {
result.push(curlyBrace);
curlyBrace = null;
}
templateTokens.push(token);
if (templateTokens.length > 1) {
addTemplateType();
}
break;
case tl.dollarBraceL:
templateTokens.push(token);
addTemplateType();
break;
case tl.braceR:
if (curlyBrace) {
result.push(curlyBrace);
}
curlyBrace = token;
break;
case tl.template:
if (curlyBrace) {
templateTokens.push(curlyBrace);
curlyBrace = null;
}
templateTokens.push(token);
break;
default:
if (curlyBrace) {
result.push(curlyBrace);
curlyBrace = null;
}
result.push(token);
}
});
return result;
}
function convertToken(token, source, tl) {
const {
type
} = token;
const {
label
} = type;
token.range = [token.start, token.end];
if (label === tl.name) {
if (token.value === "static") {
token.type = "Keyword";
} else {
token.type = "Identifier";
}
} else if (label === tl.semi || label === tl.comma || label === tl.parenL || label === tl.parenR || label === tl.braceL || label === tl.braceR || label === tl.slash || label === tl.dot || label === tl.bracketL || label === tl.bracketR || label === tl.ellipsis || label === tl.arrow || label === tl.pipeline || label === tl.star || label === tl.incDec || label === tl.colon || label === tl.question || label === tl.template || label === tl.backQuote || label === tl.dollarBraceL || label === tl.at || label === tl.logicalOR || label === tl.logicalAND || label === tl.nullishCoalescing || label === tl.bitwiseOR || label === tl.bitwiseXOR || label === tl.bitwiseAND || label === tl.equality || label === tl.relational || label === tl.bitShift || label === tl.plusMin || label === tl.modulo || label === tl.exponent || label === tl.bang || label === tl.tilde || label === tl.doubleColon || label === tl.hash || label === tl.questionDot || label === tl.braceHashL || label === tl.braceBarL || label === tl.braceBarR || label === tl.bracketHashL || label === tl.bracketBarL || label === tl.bracketBarR || label === tl.doubleCaret || label === tl.doubleAt || type.isAssign) {
var _token$value;
token.type = "Punctuator";
(_token$value = token.value) != null ? _token$value : token.value = label;
} else if (label === tl.jsxTagStart) {
token.type = "Punctuator";
token.value = "<";
} else if (label === tl.jsxTagEnd) {
token.type = "Punctuator";
token.value = ">";
} else if (label === tl.jsxName) {
token.type = "JSXIdentifier";
} else if (label === tl.jsxText) {
token.type = "JSXText";
} else if (type.keyword === "null") {
token.type = "Null";
} else if (type.keyword === "false" || type.keyword === "true") {
token.type = "Boolean";
} else if (type.keyword) {
token.type = "Keyword";
} else if (label === tl.num) {
token.type = "Numeric";
token.value = source.slice(token.start, token.end);
} else if (label === tl.string) {
token.type = "String";
token.value = source.slice(token.start, token.end);
} else if (label === tl.regexp) {
token.type = "RegularExpression";
const value = token.value;
token.regex = {
pattern: value.pattern,
flags: value.flags
};
token.value = `/${value.pattern}/${value.flags}`;
} else if (label === tl.bigint) {
token.type = "Numeric";
token.value = `${token.value}n`;
} else if (label === tl.privateName) {
token.type = "PrivateIdentifier";
} else if (label === tl.templateNonTail || label === tl.templateTail) {
token.type = "Template";
}
if (typeof token.type !== "string") {
delete token.type.rightAssociative;
}
}
module.exports = function convertTokens(tokens, code, tl) {
const result = [];
const templateTypeMergedTokens = convertTemplateType(tokens, tl);
for (let i = 0, {
length
} = templateTypeMergedTokens; i < length - 1; i++) {
const token = templateTypeMergedTokens[i];
const tokenType = token.type;
if (tokenType === "CommentLine" || tokenType === "CommentBlock") {
continue;
}
{
if (ESLINT_VERSION >= 8 && i + 1 < length && tokenType.label === tl.hash) {
const nextToken = templateTypeMergedTokens[i + 1];
if (nextToken.type.label === tl.name && token.end === nextToken.start) {
i++;
nextToken.type = "PrivateIdentifier";
nextToken.start -= 1;
nextToken.loc.start.column -= 1;
nextToken.range = [nextToken.start, nextToken.end];
result.push(nextToken);
continue;
}
}
}
convertToken(token, code, tl);
result.push(token);
}
return result;
};
//# sourceMappingURL=convertTokens.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
const convertTokens = require("./convertTokens.cjs");
const convertComments = require("./convertComments.cjs");
const convertAST = require("./convertAST.cjs");
exports.ast = function convert(ast, code, tokLabels, visitorKeys) {
ast.tokens = convertTokens(ast.tokens, code, tokLabels);
convertComments(ast.comments);
convertAST(ast, visitorKeys);
return ast;
};
exports.error = function convertError(err) {
if (err instanceof SyntaxError) {
err.lineNumber = err.loc.line;
err.column = err.loc.column;
}
return err;
};
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["convertTokens","require","convertComments","convertAST","exports","ast","convert","code","tokLabels","visitorKeys","tokens","comments","error","convertError","err","SyntaxError","lineNumber","loc","line","column"],"sources":["../../src/convert/index.cjs"],"sourcesContent":["const convertTokens = require(\"./convertTokens.cjs\");\nconst convertComments = require(\"./convertComments.cjs\");\nconst convertAST = require(\"./convertAST.cjs\");\n\nexports.ast = function convert(ast, code, tokLabels, visitorKeys) {\n ast.tokens = convertTokens(ast.tokens, code, tokLabels);\n convertComments(ast.comments);\n convertAST(ast, visitorKeys);\n return ast;\n};\n\nexports.error = function convertError(err) {\n if (err instanceof SyntaxError) {\n err.lineNumber = err.loc.line;\n err.column = err.loc.column;\n }\n return err;\n};\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGC,OAAO,CAAC,qBAAqB,CAAC;AACpD,MAAMC,eAAe,GAAGD,OAAO,CAAC,uBAAuB,CAAC;AACxD,MAAME,UAAU,GAAGF,OAAO,CAAC,kBAAkB,CAAC;AAE9CG,OAAO,CAACC,GAAG,GAAG,SAASC,OAAOA,CAACD,GAAG,EAAEE,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAE;EAChEJ,GAAG,CAACK,MAAM,GAAGV,aAAa,CAACK,GAAG,CAACK,MAAM,EAAEH,IAAI,EAAEC,SAAS,CAAC;EACvDN,eAAe,CAACG,GAAG,CAACM,QAAQ,CAAC;EAC7BR,UAAU,CAACE,GAAG,EAAEI,WAAW,CAAC;EAC5B,OAAOJ,GAAG;AACZ,CAAC;AAEDD,OAAO,CAACQ,KAAK,GAAG,SAASC,YAAYA,CAACC,GAAG,EAAE;EACzC,IAAIA,GAAG,YAAYC,WAAW,EAAE;IAC9BD,GAAG,CAACE,UAAU,GAAGF,GAAG,CAACG,GAAG,CAACC,IAAI;IAC7BJ,GAAG,CAACK,MAAM,GAAGL,GAAG,CAACG,GAAG,CAACE,MAAM;EAC7B;EACA,OAAOL,GAAG;AACZ,CAAC"}

View File

@ -0,0 +1,29 @@
const [major, minor] = process.versions.node.split(".").map(Number);
if (major < 12 || major === 12 && minor < 3) {
throw new Error("@babel/eslint-parser/experimental-worker requires Node.js >= 12.3.0");
}
const {
normalizeESLintConfig
} = require("./configuration.cjs");
const analyzeScope = require("./analyze-scope.cjs");
const baseParse = require("./parse.cjs");
const {
WorkerClient
} = require("./client.cjs");
const client = new WorkerClient();
exports.meta = {
name: "@babel/eslint-parser/experimental-worker",
version: "7.22.10"
};
exports.parseForESLint = function (code, options = {}) {
const normalizedOptions = normalizeESLintConfig(options);
const ast = baseParse(code, normalizedOptions, client);
const scopeManager = analyzeScope(ast, normalizedOptions, client);
return {
ast,
scopeManager,
visitorKeys: client.getVisitorKeys()
};
};
//# sourceMappingURL=experimental-worker.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["major","minor","process","versions","node","split","map","Number","Error","normalizeESLintConfig","require","analyzeScope","baseParse","WorkerClient","client","exports","meta","name","version","parseForESLint","code","options","normalizedOptions","ast","scopeManager","visitorKeys","getVisitorKeys"],"sources":["../src/experimental-worker.cjs"],"sourcesContent":["const [major, minor] = process.versions.node.split(\".\").map(Number);\n\nif (major < 12 || (major === 12 && minor < 3)) {\n throw new Error(\n \"@babel/eslint-parser/experimental-worker requires Node.js >= 12.3.0\",\n );\n}\n\nconst { normalizeESLintConfig } = require(\"./configuration.cjs\");\nconst analyzeScope = require(\"./analyze-scope.cjs\");\nconst baseParse = require(\"./parse.cjs\");\n\nconst { WorkerClient } = require(\"./client.cjs\");\nconst client = new WorkerClient();\n\nexports.meta = {\n name: \"@babel/eslint-parser/experimental-worker\",\n version: PACKAGE_JSON.version,\n};\n\nexports.parseForESLint = function (code, options = {}) {\n const normalizedOptions = normalizeESLintConfig(options);\n const ast = baseParse(code, normalizedOptions, client);\n const scopeManager = analyzeScope(ast, normalizedOptions, client);\n\n return { ast, scopeManager, visitorKeys: client.getVisitorKeys() };\n};\n"],"mappings":"AAAA,MAAM,CAACA,KAAK,EAAEC,KAAK,CAAC,GAAGC,OAAO,CAACC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC;AAEnE,IAAIP,KAAK,GAAG,EAAE,IAAKA,KAAK,KAAK,EAAE,IAAIC,KAAK,GAAG,CAAE,EAAE;EAC7C,MAAM,IAAIO,KAAK,CACb,qEACF,CAAC;AACH;AAEA,MAAM;EAAEC;AAAsB,CAAC,GAAGC,OAAO,CAAC,qBAAqB,CAAC;AAChE,MAAMC,YAAY,GAAGD,OAAO,CAAC,qBAAqB,CAAC;AACnD,MAAME,SAAS,GAAGF,OAAO,CAAC,aAAa,CAAC;AAExC,MAAM;EAAEG;AAAa,CAAC,GAAGH,OAAO,CAAC,cAAc,CAAC;AAChD,MAAMI,MAAM,GAAG,IAAID,YAAY,CAAC,CAAC;AAEjCE,OAAO,CAACC,IAAI,GAAG;EACbC,IAAI,EAAE,0CAA0C;EAChDC,OAAO;AACT,CAAC;AAEDH,OAAO,CAACI,cAAc,GAAG,UAAUC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EACrD,MAAMC,iBAAiB,GAAGb,qBAAqB,CAACY,OAAO,CAAC;EACxD,MAAME,GAAG,GAAGX,SAAS,CAACQ,IAAI,EAAEE,iBAAiB,EAAER,MAAM,CAAC;EACtD,MAAMU,YAAY,GAAGb,YAAY,CAACY,GAAG,EAAED,iBAAiB,EAAER,MAAM,CAAC;EAEjE,OAAO;IAAES,GAAG;IAAEC,YAAY;IAAEC,WAAW,EAAEX,MAAM,CAACY,cAAc,CAAC;EAAE,CAAC;AACpE,CAAC"}

29
node_modules/@babel/eslint-parser/lib/index.cjs generated vendored Normal file
View File

@ -0,0 +1,29 @@
const {
normalizeESLintConfig
} = require("./configuration.cjs");
const analyzeScope = require("./analyze-scope.cjs");
const baseParse = require("./parse.cjs");
const {
LocalClient,
WorkerClient
} = require("./client.cjs");
const client = new LocalClient();
exports.meta = {
name: "@babel/eslint-parser",
version: "7.22.10"
};
exports.parse = function (code, options = {}) {
return baseParse(code, normalizeESLintConfig(options), client);
};
exports.parseForESLint = function (code, options = {}) {
const normalizedOptions = normalizeESLintConfig(options);
const ast = baseParse(code, normalizedOptions, client);
const scopeManager = analyzeScope(ast, normalizedOptions, client);
return {
ast,
scopeManager,
visitorKeys: client.getVisitorKeys()
};
};
//# sourceMappingURL=index.cjs.map

1
node_modules/@babel/eslint-parser/lib/index.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"names":["normalizeESLintConfig","require","analyzeScope","baseParse","LocalClient","WorkerClient","client","exports","meta","name","version","parse","code","options","parseForESLint","normalizedOptions","ast","scopeManager","visitorKeys","getVisitorKeys"],"sources":["../src/index.cjs"],"sourcesContent":["const { normalizeESLintConfig } = require(\"./configuration.cjs\");\nconst analyzeScope = require(\"./analyze-scope.cjs\");\nconst baseParse = require(\"./parse.cjs\");\n\nconst { LocalClient, WorkerClient } = require(\"./client.cjs\");\nconst client = new (USE_ESM ? WorkerClient : LocalClient)();\n\nexports.meta = {\n name: PACKAGE_JSON.name,\n version: PACKAGE_JSON.version,\n};\n\nexports.parse = function (code, options = {}) {\n return baseParse(code, normalizeESLintConfig(options), client);\n};\n\nexports.parseForESLint = function (code, options = {}) {\n const normalizedOptions = normalizeESLintConfig(options);\n const ast = baseParse(code, normalizedOptions, client);\n const scopeManager = analyzeScope(ast, normalizedOptions, client);\n\n return { ast, scopeManager, visitorKeys: client.getVisitorKeys() };\n};\n"],"mappings":"AAAA,MAAM;EAAEA;AAAsB,CAAC,GAAGC,OAAO,CAAC,qBAAqB,CAAC;AAChE,MAAMC,YAAY,GAAGD,OAAO,CAAC,qBAAqB,CAAC;AACnD,MAAME,SAAS,GAAGF,OAAO,CAAC,aAAa,CAAC;AAExC,MAAM;EAAEG,WAAW;EAAEC;AAAa,CAAC,GAAGJ,OAAO,CAAC,cAAc,CAAC;AAC7D,MAAMK,MAAM,GAAG,IAA8BF,WAAW,CAAE,CAAC;AAE3DG,OAAO,CAACC,IAAI,GAAG;EACbC,IAAI,wBAAmB;EACvBC,OAAO;AACT,CAAC;AAEDH,OAAO,CAACI,KAAK,GAAG,UAAUC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EAC5C,OAAOV,SAAS,CAACS,IAAI,EAAEZ,qBAAqB,CAACa,OAAO,CAAC,EAAEP,MAAM,CAAC;AAChE,CAAC;AAEDC,OAAO,CAACO,cAAc,GAAG,UAAUF,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EACrD,MAAME,iBAAiB,GAAGf,qBAAqB,CAACa,OAAO,CAAC;EACxD,MAAMG,GAAG,GAAGb,SAAS,CAACS,IAAI,EAAEG,iBAAiB,EAAET,MAAM,CAAC;EACtD,MAAMW,YAAY,GAAGf,YAAY,CAACc,GAAG,EAAED,iBAAiB,EAAET,MAAM,CAAC;EAEjE,OAAO;IAAEU,GAAG;IAAEC,YAAY;IAAEC,WAAW,EAAEZ,MAAM,CAACa,cAAc,CAAC;EAAE,CAAC;AACpE,CAAC"}

38
node_modules/@babel/eslint-parser/lib/parse.cjs generated vendored Normal file
View File

@ -0,0 +1,38 @@
"use strict";
const semver = require("semver");
const convert = require("./convert/index.cjs");
const babelParser = require((((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
paths: [b]
}, M = require("module")) => {
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
if (f) return f;
f = new Error(`Cannot resolve module '${r}'`);
f.code = "MODULE_NOT_FOUND";
throw f;
})("@babel/parser", {
paths: [require.resolve("@babel/core/package.json")]
}));
let isRunningMinSupportedCoreVersion = null;
module.exports = function parse(code, options, client) {
let minSupportedCoreVersion = ">=7.2.0";
;
if (typeof isRunningMinSupportedCoreVersion !== "boolean") {
isRunningMinSupportedCoreVersion = semver.satisfies(client.getVersion(), minSupportedCoreVersion);
}
if (!isRunningMinSupportedCoreVersion) {
throw new Error(`@babel/eslint-parser@${"7.22.10"} does not support @babel/core@${client.getVersion()}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`);
}
const {
ast,
parserOptions
} = client.maybeParse(code, options);
if (ast) return ast;
try {
return convert.ast(babelParser.parse(code, parserOptions), code, client.getTokLabels(), client.getVisitorKeys());
} catch (err) {
throw convert.error(err);
}
};
//# sourceMappingURL=parse.cjs.map

1
node_modules/@babel/eslint-parser/lib/parse.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"names":["semver","require","convert","babelParser","v","w","split","process","versions","node","resolve","r","paths","b","M","f","_findPath","_nodeModulePaths","concat","Error","code","isRunningMinSupportedCoreVersion","module","exports","parse","options","client","minSupportedCoreVersion","satisfies","getVersion","ast","parserOptions","maybeParse","getTokLabels","getVisitorKeys","err","error"],"sources":["../src/parse.cjs"],"sourcesContent":["\"use strict\";\n\nconst semver = require(\"semver\");\nconst convert = require(\"./convert/index.cjs\");\n\nconst babelParser = require(require.resolve(\"@babel/parser\", {\n paths: [require.resolve(\"@babel/core/package.json\")],\n}));\n\nlet isRunningMinSupportedCoreVersion = null;\n\nmodule.exports = function parse(code, options, client) {\n // Ensure we're using a version of `@babel/core` that includes `parse()` and `tokTypes`.\n let minSupportedCoreVersion = \">=7.2.0\";\n // TODO(Babel 8): Update all the version checks\n if (process.env.BABEL_8_BREAKING) {\n minSupportedCoreVersion += \" || >=8.0.0-0\";\n }\n\n if (typeof isRunningMinSupportedCoreVersion !== \"boolean\") {\n isRunningMinSupportedCoreVersion = semver.satisfies(\n client.getVersion(),\n minSupportedCoreVersion,\n );\n }\n\n if (!isRunningMinSupportedCoreVersion) {\n throw new Error(\n `@babel/eslint-parser@${\n PACKAGE_JSON.version\n } does not support @babel/core@${client.getVersion()}. Please upgrade to @babel/core@${minSupportedCoreVersion}.`,\n );\n }\n\n const { ast, parserOptions } = client.maybeParse(code, options);\n\n if (ast) return ast;\n\n try {\n return convert.ast(\n babelParser.parse(code, parserOptions),\n code,\n client.getTokLabels(),\n client.getVisitorKeys(),\n );\n } catch (err) {\n throw convert.error(err);\n }\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,MAAMA,MAAM,GAAGC,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAMC,OAAO,GAAGD,OAAO,CAAC,qBAAqB,CAAC;AAE9C,MAAME,WAAW,GAAGF,OAAO,CAAC,GAAAG,CAAA,EAAAC,CAAA,MAAAD,CAAA,GAAAA,CAAA,CAAAE,KAAA,OAAAD,CAAA,GAAAA,CAAA,CAAAC,KAAA,QAAAF,CAAA,OAAAC,CAAA,OAAAD,CAAA,OAAAC,CAAA,QAAAD,CAAA,QAAAC,CAAA,MAAAE,OAAA,CAAAC,QAAA,CAAAC,IAAA,WAAAR,OAAA,CAAAS,OAAA,IAAAC,CAAA;EAAAC,KAAA,GAAAC,CAAA;AAAA,GAAAC,CAAA,GAAAb,OAAA;EAAA,IAAAc,CAAA,GAAAD,CAAA,CAAAE,SAAA,CAAAL,CAAA,EAAAG,CAAA,CAAAG,gBAAA,CAAAJ,CAAA,EAAAK,MAAA,CAAAL,CAAA;EAAA,IAAAE,CAAA,SAAAA,CAAA;EAAAA,CAAA,OAAAI,KAAA,2BAAAR,CAAA;EAAAI,CAAA,CAAAK,IAAA;EAAA,MAAAL,CAAA;AAAA,GAAgB,eAAe,EAAE;EAC3DH,KAAK,EAAE,CAACX,OAAO,CAACS,OAAO,CAAC,0BAA0B,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,IAAIW,gCAAgC,GAAG,IAAI;AAE3CC,MAAM,CAACC,OAAO,GAAG,SAASC,KAAKA,CAACJ,IAAI,EAAEK,OAAO,EAAEC,MAAM,EAAE;EAErD,IAAIC,uBAAuB,GAAG,SAAS;EAAC;EAMxC,IAAI,OAAON,gCAAgC,KAAK,SAAS,EAAE;IACzDA,gCAAgC,GAAGrB,MAAM,CAAC4B,SAAS,CACjDF,MAAM,CAACG,UAAU,CAAC,CAAC,EACnBF,uBACF,CAAC;EACH;EAEA,IAAI,CAACN,gCAAgC,EAAE;IACrC,MAAM,IAAIF,KAAK,CACZ,wBAAqB,SAErB,iCAAgCO,MAAM,CAACG,UAAU,CAAC,CAAE,mCAAkCF,uBAAwB,GACjH,CAAC;EACH;EAEA,MAAM;IAAEG,GAAG;IAAEC;EAAc,CAAC,GAAGL,MAAM,CAACM,UAAU,CAACZ,IAAI,EAAEK,OAAO,CAAC;EAE/D,IAAIK,GAAG,EAAE,OAAOA,GAAG;EAEnB,IAAI;IACF,OAAO5B,OAAO,CAAC4B,GAAG,CAChB3B,WAAW,CAACqB,KAAK,CAACJ,IAAI,EAAEW,aAAa,CAAC,EACtCX,IAAI,EACJM,MAAM,CAACO,YAAY,CAAC,CAAC,EACrBP,MAAM,CAACQ,cAAc,CAAC,CACxB,CAAC;EACH,CAAC,CAAC,OAAOC,GAAG,EAAE;IACZ,MAAMjC,OAAO,CAACkC,KAAK,CAACD,GAAG,CAAC;EAC1B;AACF,CAAC"}

View File

@ -0,0 +1,3 @@
module.exports = parseInt(require("eslint/package.json").version, 10);
//# sourceMappingURL=eslint-version.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["module","exports","parseInt","require","version"],"sources":["../../src/utils/eslint-version.cjs"],"sourcesContent":["module.exports = parseInt(require(\"eslint/package.json\").version, 10);\n"],"mappings":"AAAAA,MAAM,CAACC,OAAO,GAAGC,QAAQ,CAACC,OAAO,CAAC,qBAAqB,CAAC,CAACC,OAAO,EAAE,EAAE,CAAC"}

View File

@ -0,0 +1,29 @@
const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS;
const babel = require("./babel-core.cjs");
let visitorKeys;
exports.getVisitorKeys = function getVisitorKeys() {
if (!visitorKeys) {
const newTypes = {
ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,
ImportExpression: ESLINT_VISITOR_KEYS.ImportExpression,
Literal: ESLINT_VISITOR_KEYS.Literal,
MethodDefinition: ["decorators"].concat(ESLINT_VISITOR_KEYS.MethodDefinition),
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
PropertyDefinition: ["decorators", "typeAnnotation"].concat(ESLINT_VISITOR_KEYS.PropertyDefinition)
};
const conflictTypes = {
ClassPrivateMethod: ["decorators"].concat(ESLINT_VISITOR_KEYS.MethodDefinition),
ExportAllDeclaration: ESLINT_VISITOR_KEYS.ExportAllDeclaration
};
visitorKeys = Object.assign({}, newTypes, babel.types.VISITOR_KEYS, conflictTypes);
}
return visitorKeys;
};
let tokLabels;
exports.getTokLabels = function getTokLabels() {
return tokLabels || (tokLabels = (p => p.reduce((o, [k, v]) => Object.assign({}, o, {
[k]: v
}), {}))(Object.entries(babel.tokTypes).map(([key, tok]) => [key, tok.label])));
};
//# sourceMappingURL=ast-info.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["ESLINT_VISITOR_KEYS","require","KEYS","babel","visitorKeys","exports","getVisitorKeys","newTypes","ChainExpression","ImportExpression","Literal","MethodDefinition","concat","Property","PropertyDefinition","conflictTypes","ClassPrivateMethod","ExportAllDeclaration","Object","assign","types","VISITOR_KEYS","tokLabels","getTokLabels","p","reduce","o","k","v","entries","tokTypes","map","key","tok","label"],"sources":["../../src/worker/ast-info.cjs"],"sourcesContent":["const ESLINT_VISITOR_KEYS = require(\"eslint-visitor-keys\").KEYS;\nconst babel = require(\"./babel-core.cjs\");\n\nlet visitorKeys;\nexports.getVisitorKeys = function getVisitorKeys() {\n if (!visitorKeys) {\n // AST Types that are not presented in Babel AST\n const newTypes = {\n ChainExpression: ESLINT_VISITOR_KEYS.ChainExpression,\n ImportExpression: ESLINT_VISITOR_KEYS.ImportExpression,\n Literal: ESLINT_VISITOR_KEYS.Literal,\n MethodDefinition: [\"decorators\"].concat(\n ESLINT_VISITOR_KEYS.MethodDefinition,\n ),\n Property: [\"decorators\"].concat(ESLINT_VISITOR_KEYS.Property),\n PropertyDefinition: [\"decorators\", \"typeAnnotation\"].concat(\n ESLINT_VISITOR_KEYS.PropertyDefinition,\n ),\n };\n\n // AST Types that shares `\"type\"` property with Babel but have different shape\n const conflictTypes = {\n // todo: remove this when we drop Babel 7 support\n ClassPrivateMethod: [\"decorators\"].concat(\n ESLINT_VISITOR_KEYS.MethodDefinition,\n ),\n ExportAllDeclaration: ESLINT_VISITOR_KEYS.ExportAllDeclaration,\n };\n\n visitorKeys = {\n ...newTypes,\n ...babel.types.VISITOR_KEYS,\n ...conflictTypes,\n };\n }\n return visitorKeys;\n};\n\nlet tokLabels;\nexports.getTokLabels = function getTokLabels() {\n return (tokLabels ||= (\n process.env.BABEL_8_BREAKING\n ? Object.fromEntries\n : p => p.reduce((o, [k, v]) => ({ ...o, [k]: v }), {})\n )(Object.entries(babel.tokTypes).map(([key, tok]) => [key, tok.label])));\n};\n"],"mappings":"AAAA,MAAMA,mBAAmB,GAAGC,OAAO,CAAC,qBAAqB,CAAC,CAACC,IAAI;AAC/D,MAAMC,KAAK,GAAGF,OAAO,CAAC,kBAAkB,CAAC;AAEzC,IAAIG,WAAW;AACfC,OAAO,CAACC,cAAc,GAAG,SAASA,cAAcA,CAAA,EAAG;EACjD,IAAI,CAACF,WAAW,EAAE;IAEhB,MAAMG,QAAQ,GAAG;MACfC,eAAe,EAAER,mBAAmB,CAACQ,eAAe;MACpDC,gBAAgB,EAAET,mBAAmB,CAACS,gBAAgB;MACtDC,OAAO,EAAEV,mBAAmB,CAACU,OAAO;MACpCC,gBAAgB,EAAE,CAAC,YAAY,CAAC,CAACC,MAAM,CACrCZ,mBAAmB,CAACW,gBACtB,CAAC;MACDE,QAAQ,EAAE,CAAC,YAAY,CAAC,CAACD,MAAM,CAACZ,mBAAmB,CAACa,QAAQ,CAAC;MAC7DC,kBAAkB,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAACF,MAAM,CACzDZ,mBAAmB,CAACc,kBACtB;IACF,CAAC;IAGD,MAAMC,aAAa,GAAG;MAEpBC,kBAAkB,EAAE,CAAC,YAAY,CAAC,CAACJ,MAAM,CACvCZ,mBAAmB,CAACW,gBACtB,CAAC;MACDM,oBAAoB,EAAEjB,mBAAmB,CAACiB;IAC5C,CAAC;IAEDb,WAAW,GAAAc,MAAA,CAAAC,MAAA,KACNZ,QAAQ,EACRJ,KAAK,CAACiB,KAAK,CAACC,YAAY,EACxBN,aAAa,CACjB;EACH;EACA,OAAOX,WAAW;AACpB,CAAC;AAED,IAAIkB,SAAS;AACbjB,OAAO,CAACkB,YAAY,GAAG,SAASA,YAAYA,CAAA,EAAG;EAC7C,OAAQD,SAAS,KAATA,SAAS,GAAK,CAGhBE,CAAC,IAAIA,CAAC,CAACC,MAAM,CAAC,CAACC,CAAC,EAAE,CAACC,CAAC,EAAEC,CAAC,CAAC,KAAAV,MAAA,CAAAC,MAAA,KAAWO,CAAC;IAAE,CAACC,CAAC,GAAGC;EAAC,EAAG,EAAE,CAAC,CAAC,CAAC,EACxDV,MAAM,CAACW,OAAO,CAAC1B,KAAK,CAAC2B,QAAQ,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,GAAG,CAAC,KAAK,CAACD,GAAG,EAAEC,GAAG,CAACC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC"}

View File

@ -0,0 +1,16 @@
function initialize(babel) {
exports.init = null;
exports.version = babel.version;
exports.traverse = babel.traverse;
exports.types = babel.types;
exports.tokTypes = babel.tokTypes;
exports.parseSync = babel.parseSync;
exports.loadPartialConfigSync = babel.loadPartialConfigSync;
exports.loadPartialConfigAsync = babel.loadPartialConfigAsync;
exports.createConfigItem = babel.createConfigItem;
}
{
initialize(require("@babel/core"));
}
//# sourceMappingURL=babel-core.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["initialize","babel","exports","init","version","traverse","types","tokTypes","parseSync","loadPartialConfigSync","loadPartialConfigAsync","createConfigItem","require"],"sources":["../../src/worker/babel-core.cjs"],"sourcesContent":["function initialize(babel) {\n exports.init = null;\n exports.version = babel.version;\n exports.traverse = babel.traverse;\n exports.types = babel.types;\n exports.tokTypes = babel.tokTypes;\n exports.parseSync = babel.parseSync;\n exports.loadPartialConfigSync = babel.loadPartialConfigSync;\n exports.loadPartialConfigAsync = babel.loadPartialConfigAsync;\n exports.createConfigItem = babel.createConfigItem;\n}\n\nif (USE_ESM) {\n exports.init = import(\"@babel/core\").then(initialize);\n} else {\n initialize(require(\"@babel/core\"));\n}\n"],"mappings":"AAAA,SAASA,UAAUA,CAACC,KAAK,EAAE;EACzBC,OAAO,CAACC,IAAI,GAAG,IAAI;EACnBD,OAAO,CAACE,OAAO,GAAGH,KAAK,CAACG,OAAO;EAC/BF,OAAO,CAACG,QAAQ,GAAGJ,KAAK,CAACI,QAAQ;EACjCH,OAAO,CAACI,KAAK,GAAGL,KAAK,CAACK,KAAK;EAC3BJ,OAAO,CAACK,QAAQ,GAAGN,KAAK,CAACM,QAAQ;EACjCL,OAAO,CAACM,SAAS,GAAGP,KAAK,CAACO,SAAS;EACnCN,OAAO,CAACO,qBAAqB,GAAGR,KAAK,CAACQ,qBAAqB;EAC3DP,OAAO,CAACQ,sBAAsB,GAAGT,KAAK,CAACS,sBAAsB;EAC7DR,OAAO,CAACS,gBAAgB,GAAGV,KAAK,CAACU,gBAAgB;AACnD;AAIO;EACLX,UAAU,CAACY,OAAO,CAAC,aAAa,CAAC,CAAC;AACpC"}

View File

@ -0,0 +1,78 @@
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
const babel = require("./babel-core.cjs");
const ESLINT_VERSION = require("../utils/eslint-version.cjs");
function getParserPlugins(babelOptions) {
var _babelOptions$parserO, _babelOptions$parserO2;
const babelParserPlugins = (_babelOptions$parserO = (_babelOptions$parserO2 = babelOptions.parserOpts) == null ? void 0 : _babelOptions$parserO2.plugins) != null ? _babelOptions$parserO : [];
const estreeOptions = {
classFeatures: ESLINT_VERSION >= 8
};
for (const plugin of babelParserPlugins) {
if (Array.isArray(plugin) && plugin[0] === "estree") {
Object.assign(estreeOptions, plugin[1]);
break;
}
}
return [["estree", estreeOptions], ...babelParserPlugins];
}
function normalizeParserOptions(options) {
var _options$allowImportE, _options$ecmaFeatures, _options$ecmaFeatures2;
return Object.assign({
sourceType: options.sourceType,
filename: options.filePath
}, options.babelOptions, {
parserOpts: Object.assign({}, {
allowImportExportEverywhere: (_options$allowImportE = options.allowImportExportEverywhere) != null ? _options$allowImportE : false,
allowSuperOutsideMethod: true
}, {
allowReturnOutsideFunction: (_options$ecmaFeatures = (_options$ecmaFeatures2 = options.ecmaFeatures) == null ? void 0 : _options$ecmaFeatures2.globalReturn) != null ? _options$ecmaFeatures : true
}, options.babelOptions.parserOpts, {
plugins: getParserPlugins(options.babelOptions),
attachComment: false,
ranges: true,
tokens: true
}),
caller: Object.assign({
name: "@babel/eslint-parser"
}, options.babelOptions.caller)
});
}
function validateResolvedConfig(config, options, parseOptions) {
if (config !== null) {
if (options.requireConfigFile !== false) {
if (!config.hasFilesystemConfig()) {
let error = `No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;
if (config.options.filename.includes("node_modules")) {
error += `\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`;
}
throw new Error(error);
}
}
if (config.options) return config.options;
}
return getDefaultParserOptions(parseOptions);
}
function getDefaultParserOptions(options) {
return Object.assign({
plugins: []
}, options, {
babelrc: false,
configFile: false,
browserslistConfigFile: false,
ignore: null,
only: null
});
}
exports.normalizeBabelParseConfig = _asyncToGenerator(function* (options) {
const parseOptions = normalizeParserOptions(options);
const config = yield babel.loadPartialConfigAsync(parseOptions);
return validateResolvedConfig(config, options, parseOptions);
});
exports.normalizeBabelParseConfigSync = function (options) {
const parseOptions = normalizeParserOptions(options);
const config = babel.loadPartialConfigSync(parseOptions);
return validateResolvedConfig(config, options, parseOptions);
};
//# sourceMappingURL=configuration.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
module.exports = function extractParserOptionsPlugin() {
return {
parserOverride(code, opts) {
return opts;
}
};
};
//# sourceMappingURL=extract-parser-options-plugin.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["module","exports","extractParserOptionsPlugin","parserOverride","code","opts"],"sources":["../../src/worker/extract-parser-options-plugin.cjs"],"sourcesContent":["module.exports = function extractParserOptionsPlugin() {\n return {\n parserOverride(code, opts) {\n return opts;\n },\n };\n};\n"],"mappings":"AAAAA,MAAM,CAACC,OAAO,GAAG,SAASC,0BAA0BA,CAAA,EAAG;EACrD,OAAO;IACLC,cAAcA,CAACC,IAAI,EAAEC,IAAI,EAAE;MACzB,OAAOA,IAAI;IACb;EACF,CAAC;AACH,CAAC"}

View File

@ -0,0 +1,34 @@
const babel = require("./babel-core.cjs");
const maybeParse = require("./maybeParse.cjs");
const {
getVisitorKeys,
getTokLabels
} = require("./ast-info.cjs");
const {
normalizeBabelParseConfig,
normalizeBabelParseConfigSync
} = require("./configuration.cjs");
module.exports = function handleMessage(action, payload) {
switch (action) {
case "GET_VERSION":
return babel.version;
case "GET_TYPES_INFO":
return {
FLOW_FLIPPED_ALIAS_KEYS: babel.types.FLIPPED_ALIAS_KEYS.Flow,
VISITOR_KEYS: babel.types.VISITOR_KEYS
};
case "GET_TOKEN_LABELS":
return getTokLabels();
case "GET_VISITOR_KEYS":
return getVisitorKeys();
case "MAYBE_PARSE":
return normalizeBabelParseConfig(payload.options).then(options => maybeParse(payload.code, options));
case "MAYBE_PARSE_SYNC":
{
return maybeParse(payload.code, normalizeBabelParseConfigSync(payload.options));
}
}
throw new Error(`Unknown internal parser worker action: ${action}`);
};
//# sourceMappingURL=handle-message.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["babel","require","maybeParse","getVisitorKeys","getTokLabels","normalizeBabelParseConfig","normalizeBabelParseConfigSync","module","exports","handleMessage","action","payload","version","FLOW_FLIPPED_ALIAS_KEYS","types","FLIPPED_ALIAS_KEYS","Flow","VISITOR_KEYS","options","then","code","Error"],"sources":["../../src/worker/handle-message.cjs"],"sourcesContent":["const babel = require(\"./babel-core.cjs\");\nconst maybeParse = require(\"./maybeParse.cjs\");\nconst { getVisitorKeys, getTokLabels } = require(\"./ast-info.cjs\");\nconst {\n normalizeBabelParseConfig,\n normalizeBabelParseConfigSync,\n} = require(\"./configuration.cjs\");\n\nmodule.exports = function handleMessage(action, payload) {\n switch (action) {\n case \"GET_VERSION\":\n return babel.version;\n case \"GET_TYPES_INFO\":\n return {\n FLOW_FLIPPED_ALIAS_KEYS: babel.types.FLIPPED_ALIAS_KEYS.Flow,\n VISITOR_KEYS: babel.types.VISITOR_KEYS,\n };\n case \"GET_TOKEN_LABELS\":\n return getTokLabels();\n case \"GET_VISITOR_KEYS\":\n return getVisitorKeys();\n case \"MAYBE_PARSE\":\n return normalizeBabelParseConfig(payload.options).then(options =>\n maybeParse(payload.code, options),\n );\n case \"MAYBE_PARSE_SYNC\":\n if (!USE_ESM) {\n return maybeParse(\n payload.code,\n normalizeBabelParseConfigSync(payload.options),\n );\n }\n }\n\n throw new Error(`Unknown internal parser worker action: ${action}`);\n};\n"],"mappings":"AAAA,MAAMA,KAAK,GAAGC,OAAO,CAAC,kBAAkB,CAAC;AACzC,MAAMC,UAAU,GAAGD,OAAO,CAAC,kBAAkB,CAAC;AAC9C,MAAM;EAAEE,cAAc;EAAEC;AAAa,CAAC,GAAGH,OAAO,CAAC,gBAAgB,CAAC;AAClE,MAAM;EACJI,yBAAyB;EACzBC;AACF,CAAC,GAAGL,OAAO,CAAC,qBAAqB,CAAC;AAElCM,MAAM,CAACC,OAAO,GAAG,SAASC,aAAaA,CAACC,MAAM,EAAEC,OAAO,EAAE;EACvD,QAAQD,MAAM;IACZ,KAAK,aAAa;MAChB,OAAOV,KAAK,CAACY,OAAO;IACtB,KAAK,gBAAgB;MACnB,OAAO;QACLC,uBAAuB,EAAEb,KAAK,CAACc,KAAK,CAACC,kBAAkB,CAACC,IAAI;QAC5DC,YAAY,EAAEjB,KAAK,CAACc,KAAK,CAACG;MAC5B,CAAC;IACH,KAAK,kBAAkB;MACrB,OAAOb,YAAY,CAAC,CAAC;IACvB,KAAK,kBAAkB;MACrB,OAAOD,cAAc,CAAC,CAAC;IACzB,KAAK,aAAa;MAChB,OAAOE,yBAAyB,CAACM,OAAO,CAACO,OAAO,CAAC,CAACC,IAAI,CAACD,OAAO,IAC5DhB,UAAU,CAACS,OAAO,CAACS,IAAI,EAAEF,OAAO,CAClC,CAAC;IACH,KAAK,kBAAkB;MACP;QACZ,OAAOhB,UAAU,CACfS,OAAO,CAACS,IAAI,EACZd,6BAA6B,CAACK,OAAO,CAACO,OAAO,CAC/C,CAAC;MACH;EACJ;EAEA,MAAM,IAAIG,KAAK,CAAE,0CAAyCX,MAAO,EAAC,CAAC;AACrE,CAAC"}

39
node_modules/@babel/eslint-parser/lib/worker/index.cjs generated vendored Normal file
View File

@ -0,0 +1,39 @@
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
const babel = require("./babel-core.cjs");
const handleMessage = require("./handle-message.cjs");
const {
parentPort
} = require("worker_threads");
parentPort.addListener("message", _asyncToGenerator(function* ({
signal,
port,
action,
payload
}) {
let response;
try {
if (babel.init) yield babel.init;
response = {
result: yield handleMessage(action, payload)
};
} catch (error) {
response = {
error,
errorData: Object.assign({}, error)
};
}
try {
port.postMessage(response);
} catch (_unused) {
port.postMessage({
error: new Error("Cannot serialize worker response")
});
} finally {
port.close();
Atomics.store(signal, 0, 1);
Atomics.notify(signal, 0);
}
}));
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["babel","require","handleMessage","parentPort","addListener","_asyncToGenerator","signal","port","action","payload","response","init","result","error","errorData","Object","assign","postMessage","_unused","Error","close","Atomics","store","notify"],"sources":["../../src/worker/index.cjs"],"sourcesContent":["const babel = require(\"./babel-core.cjs\");\nconst handleMessage = require(\"./handle-message.cjs\");\n\nconst { parentPort } = require(\"worker_threads\");\n\nparentPort.addListener(\"message\", async ({ signal, port, action, payload }) => {\n let response;\n\n try {\n if (babel.init) await babel.init;\n\n response = { result: await handleMessage(action, payload) };\n } catch (error) {\n response = { error, errorData: { ...error } };\n }\n\n try {\n port.postMessage(response);\n } catch {\n port.postMessage({\n error: new Error(\"Cannot serialize worker response\"),\n });\n } finally {\n port.close();\n Atomics.store(signal, 0, 1);\n Atomics.notify(signal, 0);\n }\n});\n"],"mappings":";;AAAA,MAAMA,KAAK,GAAGC,OAAO,CAAC,kBAAkB,CAAC;AACzC,MAAMC,aAAa,GAAGD,OAAO,CAAC,sBAAsB,CAAC;AAErD,MAAM;EAAEE;AAAW,CAAC,GAAGF,OAAO,CAAC,gBAAgB,CAAC;AAEhDE,UAAU,CAACC,WAAW,CAAC,SAAS,EAAAC,iBAAA,CAAE,WAAO;EAAEC,MAAM;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAK;EAC7E,IAAIC,QAAQ;EAEZ,IAAI;IACF,IAAIV,KAAK,CAACW,IAAI,EAAE,MAAMX,KAAK,CAACW,IAAI;IAEhCD,QAAQ,GAAG;MAAEE,MAAM,QAAQV,aAAa,CAACM,MAAM,EAAEC,OAAO;IAAE,CAAC;EAC7D,CAAC,CAAC,OAAOI,KAAK,EAAE;IACdH,QAAQ,GAAG;MAAEG,KAAK;MAAEC,SAAS,EAAAC,MAAA,CAAAC,MAAA,KAAOH,KAAK;IAAG,CAAC;EAC/C;EAEA,IAAI;IACFN,IAAI,CAACU,WAAW,CAACP,QAAQ,CAAC;EAC5B,CAAC,CAAC,OAAAQ,OAAA,EAAM;IACNX,IAAI,CAACU,WAAW,CAAC;MACfJ,KAAK,EAAE,IAAIM,KAAK,CAAC,kCAAkC;IACrD,CAAC,CAAC;EACJ,CAAC,SAAS;IACRZ,IAAI,CAACa,KAAK,CAAC,CAAC;IACZC,OAAO,CAACC,KAAK,CAAChB,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3Be,OAAO,CAACE,MAAM,CAACjB,MAAM,EAAE,CAAC,CAAC;EAC3B;AACF,CAAC,EAAC"}

View File

@ -0,0 +1,45 @@
const babel = require("./babel-core.cjs");
const convert = require("../convert/index.cjs");
const {
getVisitorKeys,
getTokLabels
} = require("./ast-info.cjs");
const extractParserOptionsPlugin = require("./extract-parser-options-plugin.cjs");
const ref = {};
let extractParserOptionsConfigItem;
const MULTIPLE_OVERRIDES = /More than one plugin attempted to override parsing/;
module.exports = function maybeParse(code, options) {
if (!extractParserOptionsConfigItem) {
extractParserOptionsConfigItem = babel.createConfigItem([extractParserOptionsPlugin, ref], {
dirname: __dirname,
type: "plugin"
});
}
const {
plugins
} = options;
options.plugins = plugins.concat(extractParserOptionsConfigItem);
try {
return {
parserOptions: babel.parseSync(code, options),
ast: null
};
} catch (err) {
if (!MULTIPLE_OVERRIDES.test(err.message)) {
throw err;
}
}
options.plugins = plugins;
let ast;
try {
ast = babel.parseSync(code, options);
} catch (err) {
throw convert.error(err);
}
return {
ast: convert.ast(ast, code, getTokLabels(), getVisitorKeys()),
parserOptions: null
};
};
//# sourceMappingURL=maybeParse.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"names":["babel","require","convert","getVisitorKeys","getTokLabels","extractParserOptionsPlugin","ref","extractParserOptionsConfigItem","MULTIPLE_OVERRIDES","module","exports","maybeParse","code","options","createConfigItem","dirname","__dirname","type","plugins","concat","parserOptions","parseSync","ast","err","test","message","error"],"sources":["../../src/worker/maybeParse.cjs"],"sourcesContent":["const babel = require(\"./babel-core.cjs\");\nconst convert = require(\"../convert/index.cjs\");\nconst { getVisitorKeys, getTokLabels } = require(\"./ast-info.cjs\");\nconst extractParserOptionsPlugin = require(\"./extract-parser-options-plugin.cjs\");\n\nconst ref = {};\nlet extractParserOptionsConfigItem;\n\nconst MULTIPLE_OVERRIDES = /More than one plugin attempted to override parsing/;\n\nmodule.exports = function maybeParse(code, options) {\n if (!extractParserOptionsConfigItem) {\n extractParserOptionsConfigItem = babel.createConfigItem(\n [extractParserOptionsPlugin, ref],\n { dirname: __dirname, type: \"plugin\" },\n );\n }\n const { plugins } = options;\n options.plugins = plugins.concat(extractParserOptionsConfigItem);\n\n try {\n return {\n parserOptions: babel.parseSync(code, options),\n ast: null,\n };\n } catch (err) {\n if (!MULTIPLE_OVERRIDES.test(err.message)) {\n throw err;\n }\n }\n\n // There was already a parserOverride, so remove our plugin.\n options.plugins = plugins;\n\n let ast;\n try {\n ast = babel.parseSync(code, options);\n } catch (err) {\n throw convert.error(err);\n }\n\n return {\n ast: convert.ast(ast, code, getTokLabels(), getVisitorKeys()),\n parserOptions: null,\n };\n};\n"],"mappings":"AAAA,MAAMA,KAAK,GAAGC,OAAO,CAAC,kBAAkB,CAAC;AACzC,MAAMC,OAAO,GAAGD,OAAO,CAAC,sBAAsB,CAAC;AAC/C,MAAM;EAAEE,cAAc;EAAEC;AAAa,CAAC,GAAGH,OAAO,CAAC,gBAAgB,CAAC;AAClE,MAAMI,0BAA0B,GAAGJ,OAAO,CAAC,qCAAqC,CAAC;AAEjF,MAAMK,GAAG,GAAG,CAAC,CAAC;AACd,IAAIC,8BAA8B;AAElC,MAAMC,kBAAkB,GAAG,oDAAoD;AAE/EC,MAAM,CAACC,OAAO,GAAG,SAASC,UAAUA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAClD,IAAI,CAACN,8BAA8B,EAAE;IACnCA,8BAA8B,GAAGP,KAAK,CAACc,gBAAgB,CACrD,CAACT,0BAA0B,EAAEC,GAAG,CAAC,EACjC;MAAES,OAAO,EAAEC,SAAS;MAAEC,IAAI,EAAE;IAAS,CACvC,CAAC;EACH;EACA,MAAM;IAAEC;EAAQ,CAAC,GAAGL,OAAO;EAC3BA,OAAO,CAACK,OAAO,GAAGA,OAAO,CAACC,MAAM,CAACZ,8BAA8B,CAAC;EAEhE,IAAI;IACF,OAAO;MACLa,aAAa,EAAEpB,KAAK,CAACqB,SAAS,CAACT,IAAI,EAAEC,OAAO,CAAC;MAC7CS,GAAG,EAAE;IACP,CAAC;EACH,CAAC,CAAC,OAAOC,GAAG,EAAE;IACZ,IAAI,CAACf,kBAAkB,CAACgB,IAAI,CAACD,GAAG,CAACE,OAAO,CAAC,EAAE;MACzC,MAAMF,GAAG;IACX;EACF;EAGAV,OAAO,CAACK,OAAO,GAAGA,OAAO;EAEzB,IAAII,GAAG;EACP,IAAI;IACFA,GAAG,GAAGtB,KAAK,CAACqB,SAAS,CAACT,IAAI,EAAEC,OAAO,CAAC;EACtC,CAAC,CAAC,OAAOU,GAAG,EAAE;IACZ,MAAMrB,OAAO,CAACwB,KAAK,CAACH,GAAG,CAAC;EAC1B;EAEA,OAAO;IACLD,GAAG,EAAEpB,OAAO,CAACoB,GAAG,CAACA,GAAG,EAAEV,IAAI,EAAER,YAAY,CAAC,CAAC,EAAED,cAAc,CAAC,CAAC,CAAC;IAC7DiB,aAAa,EAAE;EACjB,CAAC;AACH,CAAC"}