mirror of https://github.com/webpack/webpack.git
refactor: code
This commit is contained in:
parent
79b8f00ea5
commit
db323536f2
|
@ -17,11 +17,7 @@ const { ExportPresenceModes } = require("./HarmonyImportDependency");
|
|||
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
||||
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
||||
|
||||
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */
|
||||
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||
/** @typedef {import("estree").Identifier} Identifier */
|
||||
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
||||
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("estree").Literal} Literal */
|
||||
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
||||
|
@ -31,7 +27,11 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
|||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ExportAllDeclaration} ExportAllDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportDeclaration} ImportDeclaration */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
||||
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
||||
|
|
|
@ -15,13 +15,13 @@ const ImportDependency = require("./ImportDependency");
|
|||
const ImportEagerDependency = require("./ImportEagerDependency");
|
||||
const ImportWeakDependency = require("./ImportWeakDependency");
|
||||
|
||||
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||
/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
|
||||
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
|
||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||
|
||||
class ImportParserPlugin {
|
||||
|
|
|
@ -125,7 +125,8 @@ class SystemPlugin {
|
|||
/** @type {import("estree").Literal} */
|
||||
(expr.arguments[0]),
|
||||
loc: expr.loc,
|
||||
range: expr.range
|
||||
range: expr.range,
|
||||
options: null
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -26,11 +26,9 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
|||
/** @typedef {import("estree").CallExpression} CallExpression */
|
||||
/** @typedef {import("estree").BaseCallExpression} BaseCallExpression */
|
||||
/** @typedef {import("estree").StaticBlock} StaticBlock */
|
||||
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
||||
/** @typedef {import("estree").ClassDeclaration} ClassDeclaration */
|
||||
/** @typedef {import("estree").ForStatement} ForStatement */
|
||||
/** @typedef {import("estree").SwitchStatement} SwitchStatement */
|
||||
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||
/** @typedef {import("estree").ClassExpression} ClassExpression */
|
||||
/** @typedef {import("estree").Comment} Comment */
|
||||
/** @typedef {import("estree").ConditionalExpression} ConditionalExpression */
|
||||
|
@ -70,7 +68,6 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
|||
/** @typedef {import("estree").WithStatement} WithStatement */
|
||||
/** @typedef {import("estree").ThrowStatement} ThrowStatement */
|
||||
/** @typedef {import("estree").MethodDefinition} MethodDefinition */
|
||||
/** @typedef {import("estree").ModuleDeclaration} ModuleDeclaration */
|
||||
/** @typedef {import("estree").NewExpression} NewExpression */
|
||||
/** @typedef {import("estree").SpreadElement} SpreadElement */
|
||||
/** @typedef {import("estree").FunctionExpression} FunctionExpression */
|
||||
|
@ -84,9 +81,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
|||
/** @typedef {import("estree").Program} Program */
|
||||
/** @typedef {import("estree").Directive} Directive */
|
||||
/** @typedef {import("estree").Statement} Statement */
|
||||
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
||||
/** @typedef {import("estree").ExportDefaultDeclaration} ExportDefaultDeclaration */
|
||||
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */
|
||||
/** @typedef {import("estree").Super} Super */
|
||||
/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpression */
|
||||
/** @typedef {import("estree").TemplateLiteral} TemplateLiteral */
|
||||
|
@ -104,7 +99,13 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
|||
/** @typedef {function(string, Identifier): void} OnIdent */
|
||||
/** @typedef {StatementPathItem[]} StatementPath */
|
||||
|
||||
/** @typedef {Record<string, string> & { _isLegacyAssert?: boolean }} ImportAttributes */
|
||||
// TODO remove cast when @types/estree has been updated to import assertions
|
||||
/** @typedef {import("estree").BaseNode & { type: "ImportAttribute", key: Identifier | Literal, value: Literal }} ImportAttribute */
|
||||
/** @typedef {import("estree").ImportDeclaration & { attributes?: Array<ImportAttribute> }} ImportDeclaration */
|
||||
/** @typedef {import("estree").ExportNamedDeclaration & { attributes?: Array<ImportAttribute> }} ExportNamedDeclaration */
|
||||
/** @typedef {import("estree").ExportAllDeclaration & { attributes?: Array<ImportAttribute> }} ExportAllDeclaration */
|
||||
/** @typedef {import("estree").ImportExpression & { options?: Expression | null }} ImportExpression */
|
||||
/** @typedef {ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration} ModuleDeclaration */
|
||||
|
||||
/** @type {string[]} */
|
||||
const EMPTY_ARRAY = [];
|
||||
|
@ -122,20 +123,16 @@ const importAssertions = Parser =>
|
|||
/** @type {typeof AcornParser} */ (
|
||||
/** @type {unknown} */ (
|
||||
class extends Parser {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
}
|
||||
|
||||
parseWithClause() {
|
||||
const nodes = [];
|
||||
|
||||
const isAssertLegacy = this.value === "assert";
|
||||
|
||||
if (
|
||||
!this.eat(tokTypes._with) &&
|
||||
isAssertLegacy &&
|
||||
!this.eat(tokTypes.name)
|
||||
) {
|
||||
if (isAssertLegacy) {
|
||||
if (!this.eat(tokTypes.name)) {
|
||||
return nodes;
|
||||
}
|
||||
} else if (!this.eat(tokTypes._with)) {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
|
@ -182,10 +179,10 @@ const importAssertions = Parser =>
|
|||
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
|
||||
const parser = AcornParser.extend(importAssertions);
|
||||
|
||||
/** @typedef {{ type: "ImportAttribute", key: Identifier | Literal, value: Literal }} ImportAttribute */
|
||||
/** @typedef {Record<string, string> & { _isLegacyAssert?: boolean }} ImportAttributes */
|
||||
|
||||
/**
|
||||
* @param {(ImportDeclaration & { attributes: Array<ImportAttribute> }) | (ExportNamedDeclaration & { attributes: Array<ImportAttribute> }) | (ExportAllDeclaration & { attributes: Array<ImportAttribute> }) | (ImportExpression & { options: Expression | null })} node node with assertions
|
||||
* @param {ImportDeclaration | ExportNamedDeclaration | ExportAllDeclaration | ImportExpression} node node with assertions
|
||||
* @returns {ImportAttributes | undefined} import attributes
|
||||
*/
|
||||
const getImportAttributes = node => {
|
||||
|
@ -195,8 +192,11 @@ const getImportAttributes = node => {
|
|||
node.options.type === "ObjectExpression" &&
|
||||
node.options.properties[0] &&
|
||||
node.options.properties[0].type === "Property" &&
|
||||
node.options.properties[0].key.type === "Identifier" &&
|
||||
(node.options.properties[0].key.name === "with" ||
|
||||
node.options.properties[0].key.name === "assert") &&
|
||||
node.options.properties[0].value.type === "ObjectExpression" &&
|
||||
node.options.properties[0].value.properties
|
||||
node.options.properties[0].value.properties.length > 0
|
||||
) {
|
||||
const properties =
|
||||
/** @type {Property[]} */
|
||||
|
@ -229,8 +229,7 @@ const getImportAttributes = node => {
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO remove cast when @types/estree has been updated to import assertions
|
||||
if (node.attributes === undefined) {
|
||||
if (node.attributes === undefined || node.attributes.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
AssignmentPattern,
|
||||
AssignmentProperty,
|
||||
AwaitExpression,
|
||||
BaseNode,
|
||||
BigIntLiteral,
|
||||
BinaryExpression,
|
||||
BlockStatement,
|
||||
|
@ -30,9 +31,9 @@ import {
|
|||
Directive,
|
||||
DoWhileStatement,
|
||||
EmptyStatement,
|
||||
ExportAllDeclaration,
|
||||
ExportAllDeclaration as ExportAllDeclarationImport,
|
||||
ExportDefaultDeclaration,
|
||||
ExportNamedDeclaration,
|
||||
ExportNamedDeclaration as ExportNamedDeclarationImport,
|
||||
ExportSpecifier,
|
||||
ExpressionStatement,
|
||||
ForInStatement,
|
||||
|
@ -42,9 +43,9 @@ import {
|
|||
FunctionExpression,
|
||||
Identifier,
|
||||
IfStatement,
|
||||
ImportDeclaration,
|
||||
ImportDeclaration as ImportDeclarationImport,
|
||||
ImportDefaultSpecifier,
|
||||
ImportExpression,
|
||||
ImportExpression as ImportExpressionImport,
|
||||
ImportNamespaceSpecifier,
|
||||
ImportSpecifier,
|
||||
LabeledStatement,
|
||||
|
@ -561,10 +562,10 @@ declare abstract class BasicEvaluatedExpression {
|
|||
getMemberRanges?: () => [number, number][];
|
||||
expression?:
|
||||
| Program
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportExpression
|
||||
| ImportDeclarationImport
|
||||
| ExportNamedDeclarationImport
|
||||
| ExportAllDeclarationImport
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -784,10 +785,10 @@ declare abstract class BasicEvaluatedExpression {
|
|||
setExpression(
|
||||
expression?:
|
||||
| Program
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportExpression
|
||||
| ImportDeclarationImport
|
||||
| ExportNamedDeclarationImport
|
||||
| ExportAllDeclarationImport
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -4366,6 +4367,9 @@ declare interface ExperimentsNormalizedExtra {
|
|||
*/
|
||||
lazyCompilation?: false | LazyCompilationOptions;
|
||||
}
|
||||
type ExportAllDeclarationJavascriptParser = ExportAllDeclarationImport & {
|
||||
attributes?: ImportAttribute[];
|
||||
};
|
||||
declare abstract class ExportInfo {
|
||||
name: string;
|
||||
|
||||
|
@ -4463,6 +4467,9 @@ declare abstract class ExportInfo {
|
|||
| "not provided";
|
||||
getRenameInfo(): string;
|
||||
}
|
||||
type ExportNamedDeclarationJavascriptParser = ExportNamedDeclarationImport & {
|
||||
attributes?: ImportAttribute[];
|
||||
};
|
||||
declare interface ExportSpec {
|
||||
/**
|
||||
* the name of the export
|
||||
|
@ -4614,7 +4621,7 @@ declare interface ExposesObject {
|
|||
[index: string]: string | ExposesConfig | string[];
|
||||
}
|
||||
type Expression =
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -5307,7 +5314,7 @@ declare interface HMRJavascriptParserHooks {
|
|||
hotAcceptCallback: SyncBailHook<
|
||||
[
|
||||
(
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -5602,16 +5609,50 @@ type IgnorePluginOptions =
|
|||
*/
|
||||
checkResource: (resource: string, context: string) => boolean;
|
||||
};
|
||||
declare interface ImportAttribute {
|
||||
type ImportAttribute = BaseNode & {
|
||||
type: "ImportAttribute";
|
||||
key: Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
||||
value: Literal;
|
||||
}
|
||||
};
|
||||
type ImportAttributes = Record<string, string> & {};
|
||||
type ImportDeclarationJavascriptParser = ImportDeclarationImport & {
|
||||
attributes?: ImportAttribute[];
|
||||
};
|
||||
declare interface ImportDependencyMeta {
|
||||
attributes?: ImportAttributes;
|
||||
externalType?: "import" | "module";
|
||||
}
|
||||
type ImportExpressionJavascriptParser = ImportExpressionImport & {
|
||||
options?:
|
||||
| null
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
| AssignmentExpression
|
||||
| AwaitExpression
|
||||
| BinaryExpression
|
||||
| SimpleCallExpression
|
||||
| NewExpression
|
||||
| ChainExpression
|
||||
| ClassExpression
|
||||
| ConditionalExpression
|
||||
| FunctionExpression
|
||||
| Identifier
|
||||
| SimpleLiteral
|
||||
| RegExpLiteral
|
||||
| BigIntLiteral
|
||||
| LogicalExpression
|
||||
| MemberExpression
|
||||
| MetaProperty
|
||||
| ObjectExpression
|
||||
| SequenceExpression
|
||||
| TaggedTemplateExpression
|
||||
| TemplateLiteral
|
||||
| ThisExpression
|
||||
| UpdateExpression
|
||||
| YieldExpression;
|
||||
};
|
||||
declare interface ImportModuleOptions {
|
||||
/**
|
||||
* the target layer
|
||||
|
@ -5851,7 +5892,7 @@ declare class JavascriptParser extends Parser {
|
|||
evaluate: HookMap<
|
||||
SyncBailHook<
|
||||
[
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -5915,7 +5956,7 @@ declare class JavascriptParser extends Parser {
|
|||
SyncBailHook<
|
||||
[
|
||||
(
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -5954,9 +5995,9 @@ declare class JavascriptParser extends Parser {
|
|||
>;
|
||||
preStatement: SyncBailHook<
|
||||
[
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -5985,9 +6026,9 @@ declare class JavascriptParser extends Parser {
|
|||
>;
|
||||
blockPreStatement: SyncBailHook<
|
||||
[
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6016,9 +6057,9 @@ declare class JavascriptParser extends Parser {
|
|||
>;
|
||||
statement: SyncBailHook<
|
||||
[
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6066,24 +6107,33 @@ declare class JavascriptParser extends Parser {
|
|||
boolean | void
|
||||
>;
|
||||
label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
|
||||
import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
|
||||
import: SyncBailHook<
|
||||
[ImportDeclarationJavascriptParser, ImportSource],
|
||||
boolean | void
|
||||
>;
|
||||
importSpecifier: SyncBailHook<
|
||||
[ImportDeclaration, ImportSource, null | string, string],
|
||||
[ImportDeclarationJavascriptParser, ImportSource, null | string, string],
|
||||
boolean | void
|
||||
>;
|
||||
export: SyncBailHook<
|
||||
[ExportNamedDeclaration | ExportDefaultDeclaration],
|
||||
[ExportNamedDeclarationJavascriptParser | ExportDefaultDeclaration],
|
||||
boolean | void
|
||||
>;
|
||||
exportImport: SyncBailHook<
|
||||
[ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
|
||||
[
|
||||
(
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
),
|
||||
ImportSource
|
||||
],
|
||||
boolean | void
|
||||
>;
|
||||
exportDeclaration: SyncBailHook<
|
||||
[
|
||||
(
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| ExportDefaultDeclaration
|
||||
),
|
||||
Declaration
|
||||
|
@ -6097,8 +6147,8 @@ declare class JavascriptParser extends Parser {
|
|||
exportSpecifier: SyncBailHook<
|
||||
[
|
||||
(
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| ExportDefaultDeclaration
|
||||
),
|
||||
string,
|
||||
|
@ -6109,7 +6159,10 @@ declare class JavascriptParser extends Parser {
|
|||
>;
|
||||
exportImportSpecifier: SyncBailHook<
|
||||
[
|
||||
ExportNamedDeclaration | ExportAllDeclaration,
|
||||
(
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
),
|
||||
ImportSource,
|
||||
null | string,
|
||||
null | string,
|
||||
|
@ -6134,10 +6187,13 @@ declare class JavascriptParser extends Parser {
|
|||
SyncBailHook<[AssignmentExpression, string[]], boolean | void>
|
||||
>;
|
||||
typeof: HookMap<SyncBailHook<[Expression], boolean | void>>;
|
||||
importCall: SyncBailHook<[ImportExpression], boolean | void>;
|
||||
importCall: SyncBailHook<
|
||||
[ImportExpressionJavascriptParser],
|
||||
boolean | void
|
||||
>;
|
||||
topLevelAwait: SyncBailHook<
|
||||
[
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6224,10 +6280,10 @@ declare class JavascriptParser extends Parser {
|
|||
semicolons?: Set<number>;
|
||||
statementPath?: StatementPathItem[];
|
||||
prevStatement?:
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportExpression
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6288,7 +6344,7 @@ declare class JavascriptParser extends Parser {
|
|||
): undefined | Set<DestructuringAssignmentProperty>;
|
||||
getRenameIdentifier(
|
||||
expr:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6324,9 +6380,9 @@ declare class JavascriptParser extends Parser {
|
|||
*/
|
||||
preWalkStatements(
|
||||
statements: (
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6358,9 +6414,9 @@ declare class JavascriptParser extends Parser {
|
|||
*/
|
||||
blockPreWalkStatements(
|
||||
statements: (
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6392,9 +6448,9 @@ declare class JavascriptParser extends Parser {
|
|||
*/
|
||||
walkStatements(
|
||||
statements: (
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6426,9 +6482,9 @@ declare class JavascriptParser extends Parser {
|
|||
*/
|
||||
preWalkStatement(
|
||||
statement:
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6455,9 +6511,9 @@ declare class JavascriptParser extends Parser {
|
|||
): void;
|
||||
blockPreWalkStatement(
|
||||
statement:
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6484,9 +6540,9 @@ declare class JavascriptParser extends Parser {
|
|||
): void;
|
||||
walkStatement(
|
||||
statement:
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6548,16 +6604,24 @@ declare class JavascriptParser extends Parser {
|
|||
walkFunctionDeclaration(statement: FunctionDeclaration): void;
|
||||
blockPreWalkExpressionStatement(statement: ExpressionStatement): void;
|
||||
preWalkAssignmentExpression(expression: AssignmentExpression): void;
|
||||
blockPreWalkImportDeclaration(statement: ImportDeclaration): void;
|
||||
blockPreWalkImportDeclaration(
|
||||
statement: ImportDeclarationJavascriptParser
|
||||
): void;
|
||||
enterDeclaration(
|
||||
declaration: Declaration,
|
||||
onIdent: (arg0: string, arg1: Identifier) => void
|
||||
): void;
|
||||
blockPreWalkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
|
||||
walkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
|
||||
blockPreWalkExportNamedDeclaration(
|
||||
statement: ExportNamedDeclarationJavascriptParser
|
||||
): void;
|
||||
walkExportNamedDeclaration(
|
||||
statement: ExportNamedDeclarationJavascriptParser
|
||||
): void;
|
||||
blockPreWalkExportDefaultDeclaration(statement?: any): void;
|
||||
walkExportDefaultDeclaration(statement: ExportDefaultDeclaration): void;
|
||||
blockPreWalkExportAllDeclaration(statement: ExportAllDeclaration): void;
|
||||
blockPreWalkExportAllDeclaration(
|
||||
statement: ExportAllDeclarationJavascriptParser
|
||||
): void;
|
||||
preWalkVariableDeclaration(statement: VariableDeclaration): void;
|
||||
blockPreWalkVariableDeclaration(statement: VariableDeclaration): void;
|
||||
preWalkVariableDeclarator(declarator: VariableDeclarator): void;
|
||||
|
@ -6576,7 +6640,7 @@ declare class JavascriptParser extends Parser {
|
|||
walkExpressions(
|
||||
expressions: (
|
||||
| null
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6630,7 +6694,7 @@ declare class JavascriptParser extends Parser {
|
|||
walkTaggedTemplateExpression(expression: TaggedTemplateExpression): void;
|
||||
walkClassExpression(expression: ClassExpression): void;
|
||||
walkChainExpression(expression: ChainExpression): void;
|
||||
walkImportExpression(expression: ImportExpression): void;
|
||||
walkImportExpression(expression: ImportExpressionJavascriptParser): void;
|
||||
walkCallExpression(expression: CallExpression): void;
|
||||
walkMemberExpression(expression: MemberExpression): void;
|
||||
walkMemberExpressionWithExpressionName(
|
||||
|
@ -6646,7 +6710,7 @@ declare class JavascriptParser extends Parser {
|
|||
callHooksForExpression<T, R>(
|
||||
hookMap: HookMap<SyncBailHook<T, R>>,
|
||||
expr:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6679,7 +6743,7 @@ declare class JavascriptParser extends Parser {
|
|||
callHooksForExpressionWithFallback<T, R>(
|
||||
hookMap: HookMap<SyncBailHook<T, R>>,
|
||||
expr:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6759,9 +6823,9 @@ declare class JavascriptParser extends Parser {
|
|||
inBlockScope(fn: () => void): void;
|
||||
detectMode(
|
||||
statements: (
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| FunctionDeclaration
|
||||
| VariableDeclaration
|
||||
| ClassDeclaration
|
||||
|
@ -6834,7 +6898,7 @@ declare class JavascriptParser extends Parser {
|
|||
): void;
|
||||
evaluateExpression(
|
||||
expression:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6876,7 +6940,7 @@ declare class JavascriptParser extends Parser {
|
|||
expr:
|
||||
| undefined
|
||||
| null
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6928,7 +6992,7 @@ declare class JavascriptParser extends Parser {
|
|||
};
|
||||
extractMemberExpressionChain(
|
||||
expression:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6959,7 +7023,7 @@ declare class JavascriptParser extends Parser {
|
|||
): {
|
||||
members: string[];
|
||||
object:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -6995,7 +7059,7 @@ declare class JavascriptParser extends Parser {
|
|||
): undefined | { name: string; info: string | VariableInfo };
|
||||
getMemberExpressionInfo(
|
||||
expression:
|
||||
| ImportExpression
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
@ -7039,40 +7103,10 @@ declare class JavascriptParser extends Parser {
|
|||
static ALLOWED_MEMBER_TYPES_CALL_EXPRESSION: 1;
|
||||
static getImportAttributes: (
|
||||
node:
|
||||
| (ImportDeclaration & { attributes: ImportAttribute[] })
|
||||
| (ExportNamedDeclaration & { attributes: ImportAttribute[] })
|
||||
| (ExportAllDeclaration & { attributes: ImportAttribute[] })
|
||||
| (ImportExpression & {
|
||||
options:
|
||||
| null
|
||||
| ImportExpression
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
| AssignmentExpression
|
||||
| AwaitExpression
|
||||
| BinaryExpression
|
||||
| SimpleCallExpression
|
||||
| NewExpression
|
||||
| ChainExpression
|
||||
| ClassExpression
|
||||
| ConditionalExpression
|
||||
| FunctionExpression
|
||||
| Identifier
|
||||
| SimpleLiteral
|
||||
| RegExpLiteral
|
||||
| BigIntLiteral
|
||||
| LogicalExpression
|
||||
| MemberExpression
|
||||
| MetaProperty
|
||||
| ObjectExpression
|
||||
| SequenceExpression
|
||||
| TaggedTemplateExpression
|
||||
| TemplateLiteral
|
||||
| ThisExpression
|
||||
| UpdateExpression
|
||||
| YieldExpression;
|
||||
})
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| ImportExpressionJavascriptParser
|
||||
) => undefined | ImportAttributes;
|
||||
}
|
||||
|
||||
|
@ -14412,10 +14446,10 @@ type Statement =
|
|||
| ForInStatement
|
||||
| ForOfStatement;
|
||||
type StatementPathItem =
|
||||
| ImportDeclaration
|
||||
| ExportNamedDeclaration
|
||||
| ExportAllDeclaration
|
||||
| ImportExpression
|
||||
| ImportDeclarationJavascriptParser
|
||||
| ExportNamedDeclarationJavascriptParser
|
||||
| ExportAllDeclarationJavascriptParser
|
||||
| ImportExpressionImport
|
||||
| UnaryExpression
|
||||
| ArrayExpression
|
||||
| ArrowFunctionExpression
|
||||
|
|
Loading…
Reference in New Issue