mirror of https://github.com/webpack/webpack.git
fix: types
This commit is contained in:
parent
c52d8b3b75
commit
cc8e6a195a
|
@ -1,4 +1,3 @@
|
||||||
type TODO = any;
|
|
||||||
type EXPECTED_ANY = any;
|
type EXPECTED_ANY = any;
|
||||||
type EXPECTED_FUNCTION = Function;
|
type EXPECTED_FUNCTION = Function;
|
||||||
type EXPECTED_OBJECT = object;
|
type EXPECTED_OBJECT = object;
|
||||||
|
|
|
@ -10,8 +10,9 @@ import type Hash from "../lib/util/Hash";
|
||||||
import type { InputFileSystem } from "../lib/util/fs";
|
import type { InputFileSystem } from "../lib/util/fs";
|
||||||
import type { Logger } from "../lib/logging/Logger";
|
import type { Logger } from "../lib/logging/Logger";
|
||||||
import type {
|
import type {
|
||||||
|
ImportModuleOptions,
|
||||||
ImportModuleCallback,
|
ImportModuleCallback,
|
||||||
ImportModuleOptions
|
ExecuteModuleExports
|
||||||
} from "../lib/dependencies/LoaderPlugin";
|
} from "../lib/dependencies/LoaderPlugin";
|
||||||
import type { Resolver } from "enhanced-resolve";
|
import type { Resolver } from "enhanced-resolve";
|
||||||
import type {
|
import type {
|
||||||
|
@ -92,7 +93,10 @@ export interface LoaderPluginLoaderContext {
|
||||||
options: ImportModuleOptions | undefined,
|
options: ImportModuleOptions | undefined,
|
||||||
callback: ImportModuleCallback
|
callback: ImportModuleCallback
|
||||||
): void;
|
): void;
|
||||||
importModule(request: string, options?: ImportModuleOptions): Promise<any>;
|
importModule(
|
||||||
|
request: string,
|
||||||
|
options?: ImportModuleOptions
|
||||||
|
): Promise<ExecuteModuleExports>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The properties are added by https://github.com/webpack/loader-runner */
|
/** The properties are added by https://github.com/webpack/loader-runner */
|
||||||
|
|
|
@ -19,7 +19,19 @@ const ConstDependency = require("./dependencies/ConstDependency");
|
||||||
/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */
|
/** @typedef {import("./dependencies/ContextDependency")} ContextDependency */
|
||||||
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
|
||||||
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("./javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("./javascript/JavascriptParser").TagData} TagData */
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} CompatibilitySettingsDeclaration
|
||||||
|
* @property {boolean} updated
|
||||||
|
* @property {DependencyLocation} loc
|
||||||
|
* @property {Range} range
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} CompatibilitySettings
|
||||||
|
* @property {string} name
|
||||||
|
* @property {CompatibilitySettingsDeclaration} declaration
|
||||||
|
*/
|
||||||
|
|
||||||
const nestedWebpackIdentifierTag = Symbol("nested webpack identifier");
|
const nestedWebpackIdentifierTag = Symbol("nested webpack identifier");
|
||||||
const PLUGIN_NAME = "CompatibilityPlugin";
|
const PLUGIN_NAME = "CompatibilityPlugin";
|
||||||
|
@ -103,7 +115,8 @@ class CompatibilityPlugin {
|
||||||
statement.id.name === RuntimeGlobals.require
|
statement.id.name === RuntimeGlobals.require
|
||||||
) {
|
) {
|
||||||
const newName = `__nested_webpack_require_${
|
const newName = `__nested_webpack_require_${
|
||||||
/** @type {Range} */ (statement.range)[0]
|
/** @type {Range} */
|
||||||
|
(statement.range)[0]
|
||||||
}__`;
|
}__`;
|
||||||
parser.tagVariable(
|
parser.tagVariable(
|
||||||
statement.id.name,
|
statement.id.name,
|
||||||
|
@ -112,8 +125,8 @@ class CompatibilityPlugin {
|
||||||
name: newName,
|
name: newName,
|
||||||
declaration: {
|
declaration: {
|
||||||
updated: false,
|
updated: false,
|
||||||
loc: statement.id.loc,
|
loc: /** @type {DependencyLocation} */ (statement.id.loc),
|
||||||
range: statement.id.range
|
range: /** @type {Range} */ (statement.id.range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -130,8 +143,8 @@ class CompatibilityPlugin {
|
||||||
name: newName,
|
name: newName,
|
||||||
declaration: {
|
declaration: {
|
||||||
updated: false,
|
updated: false,
|
||||||
loc: pattern.loc,
|
loc: /** @type {DependencyLocation} */ (pattern.loc),
|
||||||
range: pattern.range
|
range: /** @type {Range} */ (pattern.range)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -143,8 +156,8 @@ class CompatibilityPlugin {
|
||||||
name: "__nested_webpack_exports__",
|
name: "__nested_webpack_exports__",
|
||||||
declaration: {
|
declaration: {
|
||||||
updated: false,
|
updated: false,
|
||||||
loc: pattern.loc,
|
loc: /** @type {DependencyLocation} */ (pattern.loc),
|
||||||
range: pattern.range
|
range: /** @type {Range} */ (pattern.range)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
@ -153,7 +166,7 @@ class CompatibilityPlugin {
|
||||||
.for(nestedWebpackIdentifierTag)
|
.for(nestedWebpackIdentifierTag)
|
||||||
.tap(PLUGIN_NAME, (expr) => {
|
.tap(PLUGIN_NAME, (expr) => {
|
||||||
const { name, declaration } =
|
const { name, declaration } =
|
||||||
/** @type {TagData} */
|
/** @type {CompatibilitySettings} */
|
||||||
(parser.currentTagData);
|
(parser.currentTagData);
|
||||||
if (!declaration.updated) {
|
if (!declaration.updated) {
|
||||||
const dep = new ConstDependency(name, declaration.range);
|
const dep = new ConstDependency(name, declaration.range);
|
||||||
|
|
|
@ -721,7 +721,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
processAssetsHook.tapAsync(
|
processAssetsHook.tapAsync(
|
||||||
getOptions(options),
|
getOptions(options),
|
||||||
(assets, callback) =>
|
(assets, callback) =>
|
||||||
/** @type {TODO} */ (fn)(...getArgs(), callback)
|
/** @type {EXPECTED_ANY} */ (fn)(...getArgs(), callback)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
/** @type {AsyncSeriesHook<T>["tapPromise"]} */
|
/** @type {AsyncSeriesHook<T>["tapPromise"]} */
|
||||||
|
@ -1087,9 +1087,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
this.moduleMemCaches = undefined;
|
this.moduleMemCaches = undefined;
|
||||||
/** @type {ModuleMemCaches | undefined} */
|
/** @type {ModuleMemCaches | undefined} */
|
||||||
this.moduleMemCaches2 = undefined;
|
this.moduleMemCaches2 = undefined;
|
||||||
|
/** @type {ModuleGraph} */
|
||||||
this.moduleGraph = new ModuleGraph();
|
this.moduleGraph = new ModuleGraph();
|
||||||
/** @type {ChunkGraph} */
|
/** @type {ChunkGraph} */
|
||||||
this.chunkGraph = /** @type {TODO} */ (undefined);
|
this.chunkGraph = new ChunkGraph(
|
||||||
|
this.moduleGraph,
|
||||||
|
this.outputOptions.hashFunction
|
||||||
|
);
|
||||||
/** @type {CodeGenerationResults | undefined} */
|
/** @type {CodeGenerationResults | undefined} */
|
||||||
this.codeGenerationResults = undefined;
|
this.codeGenerationResults = undefined;
|
||||||
|
|
||||||
|
@ -3128,15 +3132,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
this.addModuleQueue.clear();
|
this.addModuleQueue.clear();
|
||||||
return callback(err);
|
return callback(err);
|
||||||
};
|
};
|
||||||
const chunkGraph = new ChunkGraph(
|
|
||||||
this.moduleGraph,
|
|
||||||
this.outputOptions.hashFunction
|
|
||||||
);
|
|
||||||
this.chunkGraph = chunkGraph;
|
|
||||||
|
|
||||||
if (this._backCompat) {
|
if (this._backCompat) {
|
||||||
for (const module of this.modules) {
|
for (const module of this.modules) {
|
||||||
ChunkGraph.setChunkGraphForModule(module, chunkGraph);
|
ChunkGraph.setChunkGraphForModule(module, this.chunkGraph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3181,7 +3180,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
||||||
|
|
||||||
const module = this.moduleGraph.getModule(dep);
|
const module = this.moduleGraph.getModule(dep);
|
||||||
if (module) {
|
if (module) {
|
||||||
chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
|
this.chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
|
||||||
entryModules.add(module);
|
entryModules.add(module);
|
||||||
const modulesList = chunkGraphInit.get(entrypoint);
|
const modulesList = chunkGraphInit.get(entrypoint);
|
||||||
if (modulesList === undefined) {
|
if (modulesList === undefined) {
|
||||||
|
|
|
@ -82,6 +82,7 @@ const webpack = require(".");
|
||||||
* @param {Error | null} err
|
* @param {Error | null} err
|
||||||
* @param {Chunk[]=} entries
|
* @param {Chunk[]=} entries
|
||||||
* @param {Compilation=} compilation
|
* @param {Compilation=} compilation
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,6 +97,7 @@ const makeSerializable = require("./util/makeSerializable");
|
||||||
* @callback ResolveDependenciesCallback
|
* @callback ResolveDependenciesCallback
|
||||||
* @param {Error | null} err
|
* @param {Error | null} err
|
||||||
* @param {ContextElementDependency[]=} dependencies
|
* @param {ContextElementDependency[]=} dependencies
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ const { join } = require("./util/fs");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {ContextResolveData & ContextOptions} BeforeContextResolveData */
|
/** @typedef {ContextResolveData & ContextOptions} BeforeContextResolveData */
|
||||||
/** @typedef {BeforeContextResolveData & { resource: TODO, resourceQuery: string | undefined, resourceFragment: string | undefined, resolveDependencies: ContextModuleFactory["resolveDependencies"] }} AfterContextResolveData */
|
/** @typedef {BeforeContextResolveData & { resource: string | string[], resourceQuery: string | undefined, resourceFragment: string | undefined, resolveDependencies: ContextModuleFactory["resolveDependencies"] }} AfterContextResolveData */
|
||||||
|
|
||||||
const EMPTY_RESOLVE_OPTIONS = {};
|
const EMPTY_RESOLVE_OPTIONS = {};
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class ContextModuleFactory extends ModuleFactory {
|
||||||
},
|
},
|
||||||
(err, result) => {
|
(err, result) => {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
callback(null, /** @type {string} */ (result));
|
callback(null, result);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -355,6 +355,7 @@ class ContextModuleFactory extends ModuleFactory {
|
||||||
* @param {string} directory directory
|
* @param {string} directory directory
|
||||||
* @param {(context: string, subResource: string, callback: () => void) => void} addSubDirectory addSubDirectoryFn
|
* @param {(context: string, subResource: string, callback: () => void) => void} addSubDirectory addSubDirectoryFn
|
||||||
* @param {ResolveDependenciesCallback} callback callback
|
* @param {ResolveDependenciesCallback} callback callback
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
const addDirectory = (ctx, directory, addSubDirectory, callback) => {
|
const addDirectory = (ctx, directory, addSubDirectory, callback) => {
|
||||||
fs.readdir(directory, (err, files) => {
|
fs.readdir(directory, (err, files) => {
|
||||||
|
|
|
@ -124,7 +124,14 @@ class ContextReplacementPlugin {
|
||||||
});
|
});
|
||||||
cmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => {
|
cmf.hooks.afterResolve.tap(PLUGIN_NAME, (result) => {
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
if (resourceRegExp.test(result.resource)) {
|
const isMatchResourceRegExp = () => {
|
||||||
|
if (Array.isArray(result.resource)) {
|
||||||
|
return result.resource.some((item) => resourceRegExp.test(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return resourceRegExp.test(result.resource);
|
||||||
|
};
|
||||||
|
if (isMatchResourceRegExp()) {
|
||||||
if (newContentResource !== undefined) {
|
if (newContentResource !== undefined) {
|
||||||
if (
|
if (
|
||||||
newContentResource.startsWith("/") ||
|
newContentResource.startsWith("/") ||
|
||||||
|
@ -132,10 +139,15 @@ class ContextReplacementPlugin {
|
||||||
) {
|
) {
|
||||||
result.resource = newContentResource;
|
result.resource = newContentResource;
|
||||||
} else {
|
} else {
|
||||||
|
const rootPath =
|
||||||
|
typeof result.resource === "string"
|
||||||
|
? result.resource
|
||||||
|
: /** @type {string} */
|
||||||
|
(result.resource.find((item) => resourceRegExp.test(item)));
|
||||||
result.resource = join(
|
result.resource = join(
|
||||||
/** @type {InputFileSystem} */
|
/** @type {InputFileSystem} */
|
||||||
(compiler.inputFileSystem),
|
(compiler.inputFileSystem),
|
||||||
result.resource,
|
rootPath,
|
||||||
newContentResource
|
newContentResource
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -155,18 +167,27 @@ class ContextReplacementPlugin {
|
||||||
if (typeof newContentCallback === "function") {
|
if (typeof newContentCallback === "function") {
|
||||||
const origResource = result.resource;
|
const origResource = result.resource;
|
||||||
newContentCallback(result);
|
newContentCallback(result);
|
||||||
if (
|
if (result.resource !== origResource) {
|
||||||
result.resource !== origResource &&
|
const newResource = Array.isArray(result.resource)
|
||||||
!result.resource.startsWith("/") &&
|
? result.resource
|
||||||
(result.resource.length <= 1 || result.resource[1] !== ":")
|
: [result.resource];
|
||||||
) {
|
|
||||||
// When the function changed it to an relative path
|
for (let i = 0; i < newResource.length; i++) {
|
||||||
result.resource = join(
|
if (
|
||||||
/** @type {InputFileSystem} */
|
!newResource[i].startsWith("/") &&
|
||||||
(compiler.inputFileSystem),
|
(newResource[i].length <= 1 || newResource[i][1] !== ":")
|
||||||
origResource,
|
) {
|
||||||
result.resource
|
// When the function changed it to an relative path
|
||||||
);
|
newResource[i] = join(
|
||||||
|
/** @type {InputFileSystem} */
|
||||||
|
(compiler.inputFileSystem),
|
||||||
|
origResource[i],
|
||||||
|
newResource[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.resource = newResource;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const d of result.dependencies) {
|
for (const d of result.dependencies) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ class ExportsInfo {
|
||||||
constructor() {
|
constructor() {
|
||||||
/** @type {Exports} */
|
/** @type {Exports} */
|
||||||
this._exports = new Map();
|
this._exports = new Map();
|
||||||
this._otherExportsInfo = new ExportInfo(/** @type {TODO} */ (null));
|
this._otherExportsInfo = new ExportInfo(null);
|
||||||
this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*");
|
this._sideEffectsOnlyInfo = new ExportInfo("*side effects only*");
|
||||||
this._exportsAreOrdered = false;
|
this._exportsAreOrdered = false;
|
||||||
/** @type {ExportsInfo=} */
|
/** @type {ExportsInfo=} */
|
||||||
|
@ -847,12 +847,12 @@ class ExportsInfo {
|
||||||
|
|
||||||
class ExportInfo {
|
class ExportInfo {
|
||||||
/**
|
/**
|
||||||
* @param {ExportInfoName} name the original name of the export
|
* @param {ExportInfoName | null} name the original name of the export
|
||||||
* @param {ExportInfo=} initFrom init values from this ExportInfo
|
* @param {ExportInfo=} initFrom init values from this ExportInfo
|
||||||
*/
|
*/
|
||||||
constructor(name, initFrom) {
|
constructor(name, initFrom) {
|
||||||
/** @type {ExportInfoName} */
|
/** @type {ExportInfoName} */
|
||||||
this.name = name;
|
this.name = /** @type {ExportInfoName} */ (name);
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ExportInfoUsedName}
|
* @type {ExportInfoUsedName}
|
||||||
|
|
|
@ -98,7 +98,7 @@ const makeSerializable = require("./util/makeSerializable");
|
||||||
/** @typedef {Set<string>} RuntimeRequirements */
|
/** @typedef {Set<string>} RuntimeRequirements */
|
||||||
/** @typedef {ReadonlySet<string>} ReadOnlyRuntimeRequirements */
|
/** @typedef {ReadonlySet<string>} ReadOnlyRuntimeRequirements */
|
||||||
|
|
||||||
/** @typedef {Map<"topLevelDeclarations", Set<string>> & Map<"chunkInitFragments", InitFragment<TODO>[]>} KnownCodeGenerationResultDataForJavascriptModules */
|
/** @typedef {Map<"topLevelDeclarations", Set<string>> & Map<"chunkInitFragments", InitFragment<EXPECTED_ANY>[]>} KnownCodeGenerationResultDataForJavascriptModules */
|
||||||
/** @typedef {Map<"url", { ["css-url"]: string }>} KnownCodeGenerationResultDataForCssModules */
|
/** @typedef {Map<"url", { ["css-url"]: string }>} KnownCodeGenerationResultDataForCssModules */
|
||||||
/** @typedef {Map<"filename", string> & Map<"assetInfo", AssetInfo> & Map<"fullContentHash", string>} KnownCodeGenerationResultDataForAssetModules */
|
/** @typedef {Map<"filename", string> & Map<"assetInfo", AssetInfo> & Map<"fullContentHash", string>} KnownCodeGenerationResultDataForAssetModules */
|
||||||
/** @typedef {Map<"share-init", [{ shareScope: string, initStage: number, init: string }]>} KnownCodeGenerationResultForSharing */
|
/** @typedef {Map<"share-init", [{ shareScope: string, initStage: number, init: string }]>} KnownCodeGenerationResultForSharing */
|
||||||
|
|
|
@ -44,6 +44,7 @@ const ArrayQueue = require("./util/ArrayQueue");
|
||||||
* @callback RunWithDependenciesHandler
|
* @callback RunWithDependenciesHandler
|
||||||
* @param {Compiler} compiler
|
* @param {Compiler} compiler
|
||||||
* @param {Callback<MultiStats>} callback
|
* @param {Callback<MultiStats>} callback
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -308,13 +308,13 @@ class NormalModuleFactory extends ModuleFactory {
|
||||||
module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
|
module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
|
||||||
/** @type {HookMap<SyncBailHook<[ParserOptions], Parser | void>>} */
|
/** @type {HookMap<SyncBailHook<[ParserOptions], Parser | void>>} */
|
||||||
createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
|
createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
|
||||||
/** @type {HookMap<SyncBailHook<[TODO, ParserOptions], void>>} */
|
/** @type {HookMap<SyncBailHook<[EXPECTED_ANY, ParserOptions], void>>} */
|
||||||
parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
|
parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
|
||||||
/** @type {HookMap<SyncBailHook<[GeneratorOptions], Generator | void>>} */
|
/** @type {HookMap<SyncBailHook<[GeneratorOptions], Generator | void>>} */
|
||||||
createGenerator: new HookMap(
|
createGenerator: new HookMap(
|
||||||
() => new SyncBailHook(["generatorOptions"])
|
() => new SyncBailHook(["generatorOptions"])
|
||||||
),
|
),
|
||||||
/** @type {HookMap<SyncBailHook<[TODO, GeneratorOptions], void>>} */
|
/** @type {HookMap<SyncBailHook<[EXPECTED_ANY, GeneratorOptions], void>>} */
|
||||||
generator: new HookMap(
|
generator: new HookMap(
|
||||||
() => new SyncHook(["generator", "generatorOptions"])
|
() => new SyncHook(["generator", "generatorOptions"])
|
||||||
),
|
),
|
||||||
|
|
|
@ -144,6 +144,9 @@ class Profiler {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Promise<{ profile: { startTime: number, endTime: number } }>} profile result
|
||||||
|
*/
|
||||||
stopProfiling() {
|
stopProfiling() {
|
||||||
return this.sendCommand("Profiler.stop").then(({ profile }) => {
|
return this.sendCommand("Profiler.stop").then(({ profile }) => {
|
||||||
const hrtime = process.hrtime();
|
const hrtime = process.hrtime();
|
||||||
|
@ -280,7 +283,10 @@ class ProfilingPlugin {
|
||||||
(hookName)
|
(hookName)
|
||||||
];
|
];
|
||||||
if (hook) {
|
if (hook) {
|
||||||
hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName));
|
hook.intercept(
|
||||||
|
/** @type {EXPECTED_ANY} */
|
||||||
|
(makeInterceptorFor("Resolver", tracer)(hookName))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,9 +473,10 @@ const interceptAllCssModulesPluginHooks = (compilation, tracer) => {
|
||||||
/** @typedef {(...args: EXPECTED_ANY[]) => EXPECTED_ANY | Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} PluginFunction */
|
/** @typedef {(...args: EXPECTED_ANY[]) => EXPECTED_ANY | Promise<(...args: EXPECTED_ANY[]) => EXPECTED_ANY>} PluginFunction */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @template T
|
||||||
* @param {string} instance instance
|
* @param {string} instance instance
|
||||||
* @param {Trace} tracer tracer
|
* @param {Trace} tracer tracer
|
||||||
* @returns {(hookName: string) => TODO} interceptor
|
* @returns {(hookName: string) => HookInterceptor<EXPECTED_ANY, EXPECTED_ANY>} interceptor
|
||||||
*/
|
*/
|
||||||
const makeInterceptorFor = (instance, tracer) => (hookName) => ({
|
const makeInterceptorFor = (instance, tracer) => (hookName) => ({
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,6 +39,12 @@ const RequireResolveHeaderDependency = require("./RequireResolveHeaderDependency
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ImportSource} ImportSource */
|
/** @typedef {import("../javascript/JavascriptParser").ImportSource} ImportSource */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {object} CommonJsImportSettings
|
||||||
|
* @property {string=} name
|
||||||
|
* @property {string} context
|
||||||
|
*/
|
||||||
|
|
||||||
const createRequireSpecifierTag = Symbol("createRequire");
|
const createRequireSpecifierTag = Symbol("createRequire");
|
||||||
const createdRequireIdentifierTag = Symbol("createRequire()");
|
const createdRequireIdentifierTag = Symbol("createRequire()");
|
||||||
|
|
||||||
|
@ -58,10 +64,11 @@ class CommonJsImportsParserPlugin {
|
||||||
*/
|
*/
|
||||||
apply(parser) {
|
apply(parser) {
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
const getContext = () => {
|
const getContext = () => {
|
||||||
if (parser.currentTagData) {
|
if (parser.currentTagData) {
|
||||||
const { context } = parser.currentTagData;
|
const { context } =
|
||||||
|
/** @type {CommonJsImportSettings} */
|
||||||
|
(parser.currentTagData);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,7 @@ class CommonJsRequireContextDependency extends ContextDependency {
|
||||||
* @param {Range} range location in source code
|
* @param {Range} range location in source code
|
||||||
* @param {Range | undefined} valueRange location of the require call
|
* @param {Range | undefined} valueRange location of the require call
|
||||||
* @param {boolean | string } inShorthand true or name
|
* @param {boolean | string } inShorthand true or name
|
||||||
* @param {string} context context
|
* @param {string=} context context
|
||||||
*/
|
*/
|
||||||
constructor(options, range, valueRange, inShorthand, context) {
|
constructor(options, range, valueRange, inShorthand, context) {
|
||||||
super(options, context);
|
super(options, context);
|
||||||
|
|
|
@ -10,6 +10,7 @@ const DependencyTemplate = require("../DependencyTemplate");
|
||||||
const makeSerializable = require("../util/makeSerializable");
|
const makeSerializable = require("../util/makeSerializable");
|
||||||
const memoize = require("../util/memoize");
|
const memoize = require("../util/memoize");
|
||||||
|
|
||||||
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */
|
/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */
|
||||||
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
/** @typedef {import("../Dependency").TRANSITIVE} TRANSITIVE */
|
||||||
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
||||||
|
@ -23,6 +24,8 @@ const getCriticalDependencyWarning = memoize(() =>
|
||||||
|
|
||||||
/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */
|
/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */
|
||||||
|
|
||||||
|
/** @typedef {{ value: string, range: Range }[]} Replaces */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {RegExp | false | null | undefined} r regexp
|
* @param {RegExp | false | null | undefined} r regexp
|
||||||
* @returns {string} stringified regexp
|
* @returns {string} stringified regexp
|
||||||
|
@ -52,12 +55,15 @@ class ContextDependency extends Dependency {
|
||||||
this.hadGlobalOrStickyRegExp = true;
|
this.hadGlobalOrStickyRegExp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {string | undefined} */
|
||||||
this.request = undefined;
|
this.request = undefined;
|
||||||
|
/** @type {Range | undefined} */
|
||||||
this.range = undefined;
|
this.range = undefined;
|
||||||
|
/** @type {Range | undefined} */
|
||||||
this.valueRange = undefined;
|
this.valueRange = undefined;
|
||||||
/** @type {boolean | string | undefined} */
|
/** @type {boolean | string | undefined} */
|
||||||
this.inShorthand = undefined;
|
this.inShorthand = undefined;
|
||||||
// TODO refactor this
|
/** @type {Replaces | undefined} */
|
||||||
this.replaces = undefined;
|
this.replaces = undefined;
|
||||||
this._requestContext = context;
|
this._requestContext = context;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +148,6 @@ class ContextDependency extends Dependency {
|
||||||
write(this._requestContext);
|
write(this._requestContext);
|
||||||
write(this.range);
|
write(this.range);
|
||||||
write(this.valueRange);
|
write(this.valueRange);
|
||||||
write(this.prepend);
|
|
||||||
write(this.replaces);
|
write(this.replaces);
|
||||||
|
|
||||||
super.serialize(context);
|
super.serialize(context);
|
||||||
|
@ -162,7 +167,6 @@ class ContextDependency extends Dependency {
|
||||||
this._requestContext = read();
|
this._requestContext = read();
|
||||||
this.range = read();
|
this.range = read();
|
||||||
this.valueRange = read();
|
this.valueRange = read();
|
||||||
this.prepend = read();
|
|
||||||
this.replaces = read();
|
this.replaces = read();
|
||||||
|
|
||||||
super.deserialize(context);
|
super.deserialize(context);
|
||||||
|
|
|
@ -15,6 +15,7 @@ const { parseResource } = require("../util/identifier");
|
||||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("./ContextDependency")} ContextDependency */
|
/** @typedef {import("./ContextDependency")} ContextDependency */
|
||||||
/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */
|
/** @typedef {import("./ContextDependency").ContextDependencyOptions} ContextDependencyOptions */
|
||||||
|
/** @typedef {import("./ContextDependency").Replaces} Replaces */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escapes regular expression metacharacters
|
* Escapes regular expression metacharacters
|
||||||
|
@ -118,7 +119,7 @@ module.exports.create = (
|
||||||
);
|
);
|
||||||
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
|
||||||
|
|
||||||
/** @type {{ value: string, range: Range }[]} */
|
/** @type {Replaces} */
|
||||||
const replaces = [];
|
const replaces = [];
|
||||||
const parts = /** @type {BasicEvaluatedExpression[]} */ (param.parts);
|
const parts = /** @type {BasicEvaluatedExpression[]} */ (param.parts);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
const ContextDependency = require("./ContextDependency");
|
const ContextDependency = require("./ContextDependency");
|
||||||
|
|
||||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||||
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("../Dependency")} Dependency */
|
/** @typedef {import("../Dependency")} Dependency */
|
||||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||||
|
|
||||||
|
@ -28,11 +29,13 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
|
||||||
const moduleExports = runtimeTemplate.moduleExports({
|
const moduleExports = runtimeTemplate.moduleExports({
|
||||||
module,
|
module,
|
||||||
chunkGraph,
|
chunkGraph,
|
||||||
request: dep.request,
|
request: /** @type {string} */ (dep.request),
|
||||||
weak: dep.weak,
|
weak: dep.weak,
|
||||||
runtimeRequirements
|
runtimeRequirements
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const range = /** @type {Range} */ (dep.range);
|
||||||
|
|
||||||
if (module) {
|
if (module) {
|
||||||
if (dep.valueRange) {
|
if (dep.valueRange) {
|
||||||
if (Array.isArray(dep.replaces)) {
|
if (Array.isArray(dep.replaces)) {
|
||||||
|
@ -41,21 +44,18 @@ class ContextDependencyTemplateAsId extends ContextDependency.Template {
|
||||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
|
||||||
|
source.replace(dep.valueRange[1], range[1] - 1, ")");
|
||||||
source.replace(
|
source.replace(
|
||||||
dep.range[0],
|
range[0],
|
||||||
dep.valueRange[0] - 1,
|
dep.valueRange[0] - 1,
|
||||||
`${moduleExports}.resolve(`
|
`${moduleExports}.resolve(`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
source.replace(
|
source.replace(range[0], range[1] - 1, `${moduleExports}.resolve`);
|
||||||
dep.range[0],
|
|
||||||
dep.range[1] - 1,
|
|
||||||
`${moduleExports}.resolve`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
source.replace(range[0], range[1] - 1, moduleExports);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
const ContextDependency = require("./ContextDependency");
|
const ContextDependency = require("./ContextDependency");
|
||||||
|
|
||||||
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
||||||
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("../Dependency")} Dependency */
|
/** @typedef {import("../Dependency")} Dependency */
|
||||||
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
|
||||||
|
|
||||||
|
@ -27,13 +28,16 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template
|
||||||
let moduleExports = runtimeTemplate.moduleExports({
|
let moduleExports = runtimeTemplate.moduleExports({
|
||||||
module: moduleGraph.getModule(dep),
|
module: moduleGraph.getModule(dep),
|
||||||
chunkGraph,
|
chunkGraph,
|
||||||
request: dep.request,
|
request: /** @type {string} */ (dep.request),
|
||||||
runtimeRequirements
|
runtimeRequirements
|
||||||
});
|
});
|
||||||
|
|
||||||
if (dep.inShorthand) {
|
if (dep.inShorthand) {
|
||||||
moduleExports = `${dep.inShorthand}: ${moduleExports}`;
|
moduleExports = `${dep.inShorthand}: ${moduleExports}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const range = /** @type {Range} */ (dep.range);
|
||||||
|
|
||||||
if (moduleGraph.getModule(dep)) {
|
if (moduleGraph.getModule(dep)) {
|
||||||
if (dep.valueRange) {
|
if (dep.valueRange) {
|
||||||
if (Array.isArray(dep.replaces)) {
|
if (Array.isArray(dep.replaces)) {
|
||||||
|
@ -42,17 +46,13 @@ class ContextDependencyTemplateAsRequireCall extends ContextDependency.Template
|
||||||
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
source.replace(rep.range[0], rep.range[1] - 1, rep.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source.replace(dep.valueRange[1], dep.range[1] - 1, ")");
|
source.replace(dep.valueRange[1], range[1] - 1, ")");
|
||||||
source.replace(
|
source.replace(range[0], dep.valueRange[0] - 1, `${moduleExports}(`);
|
||||||
dep.range[0],
|
|
||||||
dep.valueRange[0] - 1,
|
|
||||||
`${moduleExports}(`
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
source.replace(range[0], range[1] - 1, moduleExports);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
source.replace(dep.range[0], dep.range[1] - 1, moduleExports);
|
source.replace(range[0], range[1] - 1, moduleExports);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class HarmonyEvaluatedImportSpecifierDependency extends HarmonyImportSpecifierDe
|
||||||
* @param {string[]} ids ids
|
* @param {string[]} ids ids
|
||||||
* @param {string} name name
|
* @param {string} name name
|
||||||
* @param {Range} range location in source code
|
* @param {Range} range location in source code
|
||||||
* @param {ImportAttributes} attributes import assertions
|
* @param {ImportAttributes | undefined} attributes import assertions
|
||||||
* @param {string} operator operator
|
* @param {string} operator operator
|
||||||
*/
|
*/
|
||||||
constructor(request, sourceOrder, ids, name, range, attributes, operator) {
|
constructor(request, sourceOrder, ids, name, range, attributes, operator) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDepe
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ClassDeclaration} ClassDeclaration */
|
/** @typedef {import("../javascript/JavascriptParser").ClassDeclaration} ClassDeclaration */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").FunctionDeclaration} FunctionDeclaration */
|
/** @typedef {import("../javascript/JavascriptParser").FunctionDeclaration} FunctionDeclaration */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
|
/** @typedef {import("./HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */
|
||||||
|
|
||||||
const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency;
|
const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency;
|
||||||
|
|
||||||
|
@ -156,7 +157,9 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
||||||
parser.hooks.exportSpecifier.tap(
|
parser.hooks.exportSpecifier.tap(
|
||||||
PLUGIN_NAME,
|
PLUGIN_NAME,
|
||||||
(statement, id, name, idx) => {
|
(statement, id, name, idx) => {
|
||||||
const settings = parser.getTagData(id, harmonySpecifierTag);
|
const settings =
|
||||||
|
/** @type {HarmonySettings} */
|
||||||
|
(parser.getTagData(id, harmonySpecifierTag));
|
||||||
const harmonyNamedExports = (parser.state.harmonyNamedExports =
|
const harmonyNamedExports = (parser.state.harmonyNamedExports =
|
||||||
parser.state.harmonyNamedExports || new Set());
|
parser.state.harmonyNamedExports || new Set());
|
||||||
harmonyNamedExports.add(name);
|
harmonyNamedExports.add(name);
|
||||||
|
|
|
@ -24,25 +24,15 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
||||||
|
|
||||||
/** @typedef {import("estree").Expression} Expression */
|
/** @typedef {import("estree").Expression} Expression */
|
||||||
/** @typedef {import("estree").Identifier} Identifier */
|
/** @typedef {import("estree").Identifier} Identifier */
|
||||||
/** @typedef {import("estree").Literal} Literal */
|
|
||||||
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
||||||
/** @typedef {import("estree").ObjectExpression} ObjectExpression */
|
|
||||||
/** @typedef {import("estree").Property} Property */
|
|
||||||
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
||||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||||
/** @typedef {import("../javascript/BasicEvaluatedExpression")} BasicEvaluatedExpression */
|
|
||||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").DestructuringAssignmentProperty} DestructuringAssignmentProperty */
|
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ExportAllDeclaration} ExportAllDeclaration */
|
/** @typedef {import("../javascript/JavascriptParser").ExportAllDeclaration} ExportAllDeclaration */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ExportNamedDeclaration} ExportNamedDeclaration */
|
/** @typedef {import("../javascript/JavascriptParser").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ImportDeclaration} ImportDeclaration */
|
/** @typedef {import("../javascript/JavascriptParser").ImportDeclaration} ImportDeclaration */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
|
|
||||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
/** @typedef {import("../javascript/JavascriptParser").TagData} TagData */
|
|
||||||
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
|
||||||
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
|
||||||
/** @typedef {import("./HarmonyImportDependency")} HarmonyImportDependency */
|
|
||||||
|
|
||||||
const harmonySpecifierTag = Symbol("harmony import");
|
const harmonySpecifierTag = Symbol("harmony import");
|
||||||
|
|
||||||
|
@ -158,14 +148,18 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
||||||
const defer = this.deferImport
|
const defer = this.deferImport
|
||||||
? getImportMode(parser, statement).defer
|
? getImportMode(parser, statement).defer
|
||||||
: false;
|
: false;
|
||||||
parser.tagVariable(name, harmonySpecifierTag, {
|
parser.tagVariable(
|
||||||
name,
|
name,
|
||||||
source,
|
harmonySpecifierTag,
|
||||||
ids,
|
/** @type {HarmonySettings} */ ({
|
||||||
sourceOrder: parser.state.lastHarmonyImportOrder,
|
name,
|
||||||
attributes: getImportAttributes(statement),
|
source,
|
||||||
defer
|
ids,
|
||||||
});
|
sourceOrder: parser.state.lastHarmonyImportOrder,
|
||||||
|
attributes: getImportAttributes(statement),
|
||||||
|
defer
|
||||||
|
})
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -191,7 +185,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const settings =
|
const settings =
|
||||||
/** @type {TagData} */
|
/** @type {HarmonySettings} */
|
||||||
(rootInfo.tagInfo.data);
|
(rootInfo.tagInfo.data);
|
||||||
const members =
|
const members =
|
||||||
/** @type {(() => string[])} */
|
/** @type {(() => string[])} */
|
||||||
|
|
|
@ -23,6 +23,7 @@ const LoaderImportDependency = require("./LoaderImportDependency");
|
||||||
* @callback ImportModuleCallback
|
* @callback ImportModuleCallback
|
||||||
* @param {(Error | null)=} err error object
|
* @param {(Error | null)=} err error object
|
||||||
* @param {ExecuteModuleExports=} exports exports of the evaluated module
|
* @param {ExecuteModuleExports=} exports exports of the evaluated module
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,6 +36,8 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||||
/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifier */
|
/** @typedef {import("estree").PrivateIdentifier} PrivateIdentifier */
|
||||||
/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */
|
/** @typedef {import("estree").PropertyDefinition} PropertyDefinition */
|
||||||
/** @typedef {import("estree").Expression} Expression */
|
/** @typedef {import("estree").Expression} Expression */
|
||||||
|
/** @typedef {import("estree").ImportAttribute} ImportAttribute */
|
||||||
|
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
||||||
/** @typedef {import("estree").Identifier} Identifier */
|
/** @typedef {import("estree").Identifier} Identifier */
|
||||||
/** @typedef {import("estree").VariableDeclaration} VariableDeclaration */
|
/** @typedef {import("estree").VariableDeclaration} VariableDeclaration */
|
||||||
/** @typedef {import("estree").IfStatement} IfStatement */
|
/** @typedef {import("estree").IfStatement} IfStatement */
|
||||||
|
@ -74,6 +76,8 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||||
/** @typedef {import("estree").WhileStatement} WhileStatement */
|
/** @typedef {import("estree").WhileStatement} WhileStatement */
|
||||||
/** @typedef {import("estree").ArrowFunctionExpression} ArrowFunctionExpression */
|
/** @typedef {import("estree").ArrowFunctionExpression} ArrowFunctionExpression */
|
||||||
/** @typedef {import("estree").ExpressionStatement} ExpressionStatement */
|
/** @typedef {import("estree").ExpressionStatement} ExpressionStatement */
|
||||||
|
/** @typedef {import("estree").ExportAllDeclaration} ExportAllDeclaration */
|
||||||
|
/** @typedef {import("estree").ExportNamedDeclaration} ExportNamedDeclaration */
|
||||||
/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */
|
/** @typedef {import("estree").FunctionDeclaration} FunctionDeclaration */
|
||||||
/** @typedef {import("estree").DoWhileStatement} DoWhileStatement */
|
/** @typedef {import("estree").DoWhileStatement} DoWhileStatement */
|
||||||
/** @typedef {import("estree").TryStatement} TryStatement */
|
/** @typedef {import("estree").TryStatement} TryStatement */
|
||||||
|
@ -87,6 +91,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||||
/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpression */
|
/** @typedef {import("estree").TaggedTemplateExpression} TaggedTemplateExpression */
|
||||||
/** @typedef {import("estree").TemplateLiteral} TemplateLiteral */
|
/** @typedef {import("estree").TemplateLiteral} TemplateLiteral */
|
||||||
/** @typedef {import("estree").AssignmentProperty} AssignmentProperty */
|
/** @typedef {import("estree").AssignmentProperty} AssignmentProperty */
|
||||||
|
/** @typedef {import("estree").ModuleDeclaration} ModuleDeclaration */
|
||||||
/** @typedef {import("estree").MaybeNamedFunctionDeclaration} MaybeNamedFunctionDeclaration */
|
/** @typedef {import("estree").MaybeNamedFunctionDeclaration} MaybeNamedFunctionDeclaration */
|
||||||
/** @typedef {import("estree").MaybeNamedClassDeclaration} MaybeNamedClassDeclaration */
|
/** @typedef {import("estree").MaybeNamedClassDeclaration} MaybeNamedClassDeclaration */
|
||||||
/**
|
/**
|
||||||
|
@ -105,12 +110,7 @@ const BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
||||||
/** @typedef {Set<DestructuringAssignmentProperty>} DestructuringAssignmentProperties */
|
/** @typedef {Set<DestructuringAssignmentProperty>} DestructuringAssignmentProperties */
|
||||||
|
|
||||||
// TODO remove cast when @types/estree has been updated to import assertions
|
// 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?: ImportAttribute[], phase?: "defer" }} ImportDeclaration */
|
|
||||||
/** @typedef {import("estree").ExportNamedDeclaration & { attributes?: ImportAttribute[] }} ExportNamedDeclaration */
|
|
||||||
/** @typedef {import("estree").ExportAllDeclaration & { attributes?: ImportAttribute[] }} ExportAllDeclaration */
|
|
||||||
/** @typedef {import("estree").ImportExpression & { options?: Expression | null, phase?: "defer" }} ImportExpression */
|
/** @typedef {import("estree").ImportExpression & { options?: Expression | null, phase?: "defer" }} ImportExpression */
|
||||||
/** @typedef {ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration} ModuleDeclaration */
|
|
||||||
|
|
||||||
/** @type {string[]} */
|
/** @type {string[]} */
|
||||||
const EMPTY_ARRAY = [];
|
const EMPTY_ARRAY = [];
|
||||||
|
@ -304,7 +304,15 @@ class VariableInfo {
|
||||||
/** @typedef {Omit<AcornOptions, "sourceType" | "ecmaVersion"> & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */
|
/** @typedef {Omit<AcornOptions, "sourceType" | "ecmaVersion"> & { sourceType: "module" | "script" | "auto", ecmaVersion?: AcornOptions["ecmaVersion"] }} ParseOptions */
|
||||||
|
|
||||||
/** @typedef {symbol} Tag */
|
/** @typedef {symbol} Tag */
|
||||||
/** @typedef {Record<string, TODO>} TagData */
|
|
||||||
|
/** @typedef {import("../dependencies/HarmonyImportDependencyParserPlugin").HarmonySettings} HarmonySettings */
|
||||||
|
/** @typedef {import("../dependencies/ImportParserPlugin").ImportSettings} ImportSettings */
|
||||||
|
/** @typedef {import("../dependencies/CommonJsImportsParserPlugin").CommonJsImportSettings} CommonJsImportSettings */
|
||||||
|
/** @typedef {import("../CompatibilityPlugin").CompatibilitySettings} CompatibilitySettings */
|
||||||
|
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
||||||
|
|
||||||
|
/** @typedef {HarmonySettings | ImportSettings | CommonJsImportSettings | TopLevelSymbol | CompatibilitySettings} KnownTagData */
|
||||||
|
/** @typedef {KnownTagData & Record<string, EXPECTED_ANY>} TagData */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} TagInfo
|
* @typedef {object} TagInfo
|
||||||
|
@ -619,9 +627,9 @@ class JavascriptParser extends Parser {
|
||||||
});
|
});
|
||||||
this.sourceType = sourceType;
|
this.sourceType = sourceType;
|
||||||
/** @type {ScopeInfo} */
|
/** @type {ScopeInfo} */
|
||||||
this.scope = /** @type {TODO} */ (undefined);
|
this.scope = /** @type {EXPECTED_ANY} */ (undefined);
|
||||||
/** @type {ParserState} */
|
/** @type {ParserState} */
|
||||||
this.state = /** @type {TODO} */ (undefined);
|
this.state = /** @type {EXPECTED_ANY} */ (undefined);
|
||||||
/** @type {Comment[] | undefined} */
|
/** @type {Comment[] | undefined} */
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
/** @type {Set<number> | undefined} */
|
/** @type {Set<number> | undefined} */
|
||||||
|
@ -4098,7 +4106,7 @@ class JavascriptParser extends Parser {
|
||||||
* @param {HookMap<SyncBailHook<T, R>>} hookMap hooks the should be called
|
* @param {HookMap<SyncBailHook<T, R>>} hookMap hooks the should be called
|
||||||
* @param {ExportedVariableInfo} info variable info
|
* @param {ExportedVariableInfo} info variable info
|
||||||
* @param {((name: string) => R | undefined) | undefined} fallback callback when variable in not handled by hooks
|
* @param {((name: string) => R | undefined) | undefined} fallback callback when variable in not handled by hooks
|
||||||
* @param {((result?: string) => TODO) | undefined} defined callback when variable is defined
|
* @param {((result?: string) => R | undefined) | undefined} defined callback when variable is defined
|
||||||
* @param {AsArray<T>} args args for the hook
|
* @param {AsArray<T>} args args for the hook
|
||||||
* @returns {R | undefined} result of hook
|
* @returns {R | undefined} result of hook
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@ const JavascriptParser = require("../javascript/JavascriptParser");
|
||||||
* @property {Map<TopLevelSymbol, Set<UsageCallback>>} usageCallbackMap
|
* @property {Map<TopLevelSymbol, Set<UsageCallback>>} usageCallbackMap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {false|StateObject} State */
|
/** @typedef {false | StateObject} State */
|
||||||
|
|
||||||
class TopLevelSymbol {
|
class TopLevelSymbol {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
const { SyncHook } = require("tapable");
|
const { SyncHook } = require("tapable");
|
||||||
|
|
||||||
|
/** @typedef {import("enhanced-resolve").ResolveRequest} ResolveRequest */
|
||||||
/** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */
|
/** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */
|
||||||
/** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */
|
/** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */
|
||||||
/** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
|
/** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
|
||||||
|
@ -40,7 +41,7 @@ const { SyncHook } = require("tapable");
|
||||||
* @property {ImportAttributes=} assertions
|
* @property {ImportAttributes=} assertions
|
||||||
* @property {string=} mimetype
|
* @property {string=} mimetype
|
||||||
* @property {string} dependency
|
* @property {string} dependency
|
||||||
* @property {Record<string, EXPECTED_ANY>=} descriptionData
|
* @property {ResolveRequest["descriptionFileData"]=} descriptionData
|
||||||
* @property {string=} compiler
|
* @property {string=} compiler
|
||||||
* @property {string} issuer
|
* @property {string} issuer
|
||||||
* @property {string} issuerLayer
|
* @property {string} issuerLayer
|
||||||
|
@ -128,7 +129,7 @@ class RuleSetCompiler {
|
||||||
for (const condition of rule.conditions) {
|
for (const condition of rule.conditions) {
|
||||||
const p = condition.property;
|
const p = condition.property;
|
||||||
if (Array.isArray(p)) {
|
if (Array.isArray(p)) {
|
||||||
/** @type {EffectData | EffectData[keyof EffectData] | undefined} */
|
/** @type {EXPECTED_ANY} */
|
||||||
let current = data;
|
let current = data;
|
||||||
for (const subProperty of p) {
|
for (const subProperty of p) {
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -112,9 +112,6 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {KnownStatsAsset & Record<string, EXPECTED_ANY>} StatsAsset */
|
/** @typedef {KnownStatsAsset & Record<string, EXPECTED_ANY>} StatsAsset */
|
||||||
/** @typedef {ChunkId} KnownStatsAssetChunk */
|
|
||||||
/** @typedef {ChunkName} KnownStatsAssetChunkName */
|
|
||||||
/** @typedef {string} KnownStatsAssetChunkIdHint */
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} KnownStatsAsset
|
* @typedef {object} KnownStatsAsset
|
||||||
* @property {string} type
|
* @property {string} type
|
||||||
|
@ -125,12 +122,12 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {boolean} comparedForEmit
|
* @property {boolean} comparedForEmit
|
||||||
* @property {boolean} cached
|
* @property {boolean} cached
|
||||||
* @property {StatsAsset[]=} related
|
* @property {StatsAsset[]=} related
|
||||||
* @property {KnownStatsAssetChunk[]=} chunks
|
* @property {ChunkId[]=} chunks
|
||||||
* @property {KnownStatsAssetChunkName[]=} chunkNames
|
* @property {ChunkName[]=} chunkNames
|
||||||
* @property {KnownStatsAssetChunkIdHint[]=} chunkIdHints
|
* @property {string[]=} chunkIdHints
|
||||||
* @property {KnownStatsAssetChunk[]=} auxiliaryChunks
|
* @property {ChunkId[]=} auxiliaryChunks
|
||||||
* @property {KnownStatsAssetChunkName[]=} auxiliaryChunkNames
|
* @property {ChunkName[]=} auxiliaryChunkNames
|
||||||
* @property {KnownStatsAssetChunkIdHint[]=} auxiliaryChunkIdHints
|
* @property {string[]=} auxiliaryChunkIdHints
|
||||||
* @property {number=} filteredRelated
|
* @property {number=} filteredRelated
|
||||||
* @property {boolean=} isOverSizeLimit
|
* @property {boolean=} isOverSizeLimit
|
||||||
*/
|
*/
|
||||||
|
@ -138,7 +135,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
/** @typedef {KnownStatsChunkGroup & Record<string, EXPECTED_ANY>} StatsChunkGroup */
|
/** @typedef {KnownStatsChunkGroup & Record<string, EXPECTED_ANY>} StatsChunkGroup */
|
||||||
/**
|
/**
|
||||||
* @typedef {object} KnownStatsChunkGroup
|
* @typedef {object} KnownStatsChunkGroup
|
||||||
* @property {(string | null)=} name
|
* @property {ChunkName=} name
|
||||||
* @property {(string | number)[]=} chunks
|
* @property {(string | number)[]=} chunks
|
||||||
* @property {({ name: string, size?: number })[]=} assets
|
* @property {({ name: string, size?: number })[]=} assets
|
||||||
* @property {number=} filteredAssets
|
* @property {number=} filteredAssets
|
||||||
|
@ -146,8 +143,8 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {({ name: string, size?: number })[]=} auxiliaryAssets
|
* @property {({ name: string, size?: number })[]=} auxiliaryAssets
|
||||||
* @property {number=} filteredAuxiliaryAssets
|
* @property {number=} filteredAuxiliaryAssets
|
||||||
* @property {number=} auxiliaryAssetsSize
|
* @property {number=} auxiliaryAssetsSize
|
||||||
* @property {{ [x: string]: StatsChunkGroup[] }=} children
|
* @property {Record<string, StatsChunkGroup[]>=} children
|
||||||
* @property {{ [x: string]: string[] }=} childAssets
|
* @property {Record<string, string[]>=} childAssets
|
||||||
* @property {boolean=} isOverSizeLimit
|
* @property {boolean=} isOverSizeLimit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -166,7 +163,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {number=} index2
|
* @property {number=} index2
|
||||||
* @property {number=} postOrderIndex
|
* @property {number=} postOrderIndex
|
||||||
* @property {number=} size
|
* @property {number=} size
|
||||||
* @property {{ [x: string]: number }=} sizes
|
* @property {Record<string, number>=} sizes
|
||||||
* @property {boolean=} cacheable
|
* @property {boolean=} cacheable
|
||||||
* @property {boolean=} built
|
* @property {boolean=} built
|
||||||
* @property {boolean=} codeGenerated
|
* @property {boolean=} codeGenerated
|
||||||
|
@ -216,7 +213,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @typedef {object} KnownStatsModuleIssuer
|
* @typedef {object} KnownStatsModuleIssuer
|
||||||
* @property {string} identifier
|
* @property {string} identifier
|
||||||
* @property {string} name
|
* @property {string} name
|
||||||
* @property {(string|number)=} id
|
* @property {ModuleId=} id
|
||||||
* @property {StatsProfile} profile
|
* @property {StatsProfile} profile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -233,8 +230,8 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {string | null} explanation
|
* @property {string | null} explanation
|
||||||
* @property {string | null} userRequest
|
* @property {string | null} userRequest
|
||||||
* @property {(string | null)=} loc
|
* @property {(string | null)=} loc
|
||||||
* @property {(string | number | null)=} moduleId
|
* @property {ModuleId | null=} moduleId
|
||||||
* @property {(string | number | null)=} resolvedModuleId
|
* @property {ModuleId | null=} resolvedModuleId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {KnownStatsChunk & Record<string, EXPECTED_ANY>} StatsChunk */
|
/** @typedef {KnownStatsChunk & Record<string, EXPECTED_ANY>} StatsChunk */
|
||||||
|
@ -254,10 +251,10 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {string[]} auxiliaryFiles
|
* @property {string[]} auxiliaryFiles
|
||||||
* @property {string} hash
|
* @property {string} hash
|
||||||
* @property {Record<string, ChunkId[]>} childrenByOrder
|
* @property {Record<string, ChunkId[]>} childrenByOrder
|
||||||
* @property {(string|number)=} id
|
* @property {ChunkId=} id
|
||||||
* @property {(string|number)[]=} siblings
|
* @property {ChunkId[]=} siblings
|
||||||
* @property {(string|number)[]=} parents
|
* @property {ChunkId[]=} parents
|
||||||
* @property {(string|number)[]=} children
|
* @property {ChunkId[]=} children
|
||||||
* @property {StatsModule[]=} modules
|
* @property {StatsModule[]=} modules
|
||||||
* @property {number=} filteredModules
|
* @property {number=} filteredModules
|
||||||
* @property {StatsChunkOrigin[]=} origins
|
* @property {StatsChunkOrigin[]=} origins
|
||||||
|
@ -282,8 +279,8 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {string=} moduleIdentifier
|
* @property {string=} moduleIdentifier
|
||||||
* @property {string=} moduleName
|
* @property {string=} moduleName
|
||||||
* @property {StatsModuleTraceDependency[]=} dependencies
|
* @property {StatsModuleTraceDependency[]=} dependencies
|
||||||
* @property {(string|number)=} originId
|
* @property {ModuleId=} originId
|
||||||
* @property {(string|number)=} moduleId
|
* @property {ModuleId=} moduleId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {KnownStatsModuleTraceDependency & Record<string, EXPECTED_ANY>} StatsModuleTraceDependency */
|
/** @typedef {KnownStatsModuleTraceDependency & Record<string, EXPECTED_ANY>} StatsModuleTraceDependency */
|
||||||
|
@ -304,7 +301,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
||||||
* @property {string=} moduleName
|
* @property {string=} moduleName
|
||||||
* @property {string=} loc
|
* @property {string=} loc
|
||||||
* @property {ChunkId=} chunkId
|
* @property {ChunkId=} chunkId
|
||||||
* @property {string|number=} moduleId
|
* @property {ModuleId=} moduleId
|
||||||
* @property {StatsModuleTraceItem[]=} moduleTrace
|
* @property {StatsModuleTraceItem[]=} moduleTrace
|
||||||
* @property {string=} details
|
* @property {string=} details
|
||||||
* @property {string=} stack
|
* @property {string=} stack
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkId} ChunkId */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkId} ChunkId */
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkName} ChunkName */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkName} ChunkName */
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAsset} KnownStatsAsset */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAsset} KnownStatsAsset */
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunk} KnownStatsAssetChunk */
|
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunkIdHint} KnownStatsAssetChunkIdHint */
|
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunkName} KnownStatsAssetChunkName */
|
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunk} KnownStatsChunk */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunk} KnownStatsChunk */
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkGroup} KnownStatsChunkGroup */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkGroup} KnownStatsChunkGroup */
|
||||||
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkOrigin} KnownStatsChunkOrigin */
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkOrigin} KnownStatsChunkOrigin */
|
||||||
|
@ -412,9 +409,9 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
||||||
* Printers<KnownStatsAsset["info"], "asset.info"> &
|
* Printers<KnownStatsAsset["info"], "asset.info"> &
|
||||||
* Exclamation<KnownStatsAsset, "asset.separator", "asset"> &
|
* Exclamation<KnownStatsAsset, "asset.separator", "asset"> &
|
||||||
* { ["asset.filteredChildren"]?: SimplePrinter<number, "asset"> } &
|
* { ["asset.filteredChildren"]?: SimplePrinter<number, "asset"> } &
|
||||||
* { assetChunk?: SimplePrinter<KnownStatsAssetChunk, "asset"> } &
|
* { assetChunk?: SimplePrinter<ChunkId, "asset"> } &
|
||||||
* { assetChunkName?: SimplePrinter<KnownStatsAssetChunkName, "asset"> } &
|
* { assetChunkName?: SimplePrinter<ChunkName, "asset"> } &
|
||||||
* { assetChunkIdHint?: SimplePrinter<KnownStatsAssetChunkIdHint, "asset"> }} AssetSimplePrinters
|
* { assetChunkIdHint?: SimplePrinter<string, "asset"> }} AssetSimplePrinters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @type {AssetSimplePrinters} */
|
/** @type {AssetSimplePrinters} */
|
||||||
|
@ -464,7 +461,6 @@ const ASSET_SIMPLE_PRINTERS = {
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|
||||||
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
||||||
|
|
||||||
assetChunkName: (name) => name || undefined,
|
assetChunkName: (name) => name || undefined,
|
||||||
assetChunkIdHint: (name) => name || undefined
|
assetChunkIdHint: (name) => name || undefined
|
||||||
};
|
};
|
||||||
|
@ -1454,7 +1450,12 @@ const AVAILABLE_COLORS = {
|
||||||
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
|
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {{ [Key in keyof KnownStatsPrinterFormatters]: (value: Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>[0], options: Required<KnownStatsPrinterColorFunctions> & StatsPrinterContextWithExtra, ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>>) => string }} AvailableFormats */
|
/**
|
||||||
|
* @template {(...args: EXPECTED_ANY[]) => EXPECTED_ANY} T
|
||||||
|
* @typedef {T extends (firstArg: EXPECTED_ANY, ...rest: infer R) => EXPECTED_ANY ? R : never} TailParameters
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @typedef {{ [Key in keyof KnownStatsPrinterFormatters]: (value: Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>[0], options: Required<KnownStatsPrinterColorFunctions> & StatsPrinterContextWithExtra, ...args: TailParameters<NonNullable<KnownStatsPrinterFormatters[Key]>>) => string }} AvailableFormats */
|
||||||
|
|
||||||
/** @type {AvailableFormats} */
|
/** @type {AvailableFormats} */
|
||||||
const AVAILABLE_FORMATS = {
|
const AVAILABLE_FORMATS = {
|
||||||
|
@ -1630,16 +1631,14 @@ class DefaultStatsPrinterPlugin {
|
||||||
context[color] = (str) => str;
|
context[color] = (str) => str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const _format of Object.keys(AVAILABLE_FORMATS)) {
|
for (const format of /** @type {(keyof KnownStatsPrinterFormatters)[]} */ (
|
||||||
const format =
|
Object.keys(AVAILABLE_FORMATS)
|
||||||
/** @type {keyof KnownStatsPrinterFormatters} */
|
)) {
|
||||||
(_format);
|
|
||||||
|
|
||||||
context[format] =
|
context[format] =
|
||||||
/** @type {(content: Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>[0], ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>>) => string} */
|
/** @type {(content: Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>[0], ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>>) => string} */
|
||||||
(content, ...args) =>
|
(content, ...args) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(AVAILABLE_FORMATS)[format](
|
(AVAILABLE_FORMATS[format])(
|
||||||
content,
|
content,
|
||||||
/** @type {StatsPrinterContext & Required<KnownStatsPrinterColorFunctions>} */
|
/** @type {StatsPrinterContext & Required<KnownStatsPrinterColorFunctions>} */
|
||||||
(context),
|
(context),
|
||||||
|
@ -1649,15 +1648,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
context.timeReference = compilation.time;
|
context.timeReference = compilation.time;
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const key of Object.keys(COMPILATION_SIMPLE_PRINTERS)) {
|
for (const key of /** @type {(keyof CompilationSimplePrinters)[]} */ (
|
||||||
|
Object.keys(COMPILATION_SIMPLE_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(
|
(COMPILATION_SIMPLE_PRINTERS)[key](
|
||||||
COMPILATION_SIMPLE_PRINTERS[
|
|
||||||
/** @type {keyof CompilationSimplePrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"compilation">} */
|
/** @type {DefineStatsPrinterContext<"compilation">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1666,15 +1662,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(ASSET_SIMPLE_PRINTERS)) {
|
for (const key of /** @type {(keyof AssetSimplePrinters)[]} */ (
|
||||||
|
Object.keys(ASSET_SIMPLE_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {NonNullable<AssetSimplePrinters[keyof AssetSimplePrinters]>} */
|
/** @type {NonNullable<AssetSimplePrinters[keyof AssetSimplePrinters]>} */
|
||||||
(
|
(ASSET_SIMPLE_PRINTERS[key])(
|
||||||
ASSET_SIMPLE_PRINTERS[
|
|
||||||
/** @type {keyof AssetSimplePrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"asset" | "asset.info">} */
|
/** @type {DefineStatsPrinterContext<"asset" | "asset.info">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1683,15 +1676,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_SIMPLE_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleSimplePrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_SIMPLE_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(
|
(MODULE_SIMPLE_PRINTERS)[key](
|
||||||
MODULE_SIMPLE_PRINTERS[
|
|
||||||
/** @type {keyof ModuleSimplePrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"module">} */
|
/** @type {DefineStatsPrinterContext<"module">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1700,15 +1690,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_ISSUER_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleIssuerPrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_ISSUER_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {NonNullable<ModuleIssuerPrinters[keyof ModuleIssuerPrinters]>} */
|
/** @type {NonNullable<ModuleIssuerPrinters[keyof ModuleIssuerPrinters]>} */
|
||||||
(
|
(MODULE_ISSUER_PRINTERS[key])(
|
||||||
MODULE_ISSUER_PRINTERS[
|
|
||||||
/** @type {keyof ModuleIssuerPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"moduleIssuer">} */
|
/** @type {DefineStatsPrinterContext<"moduleIssuer">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1717,15 +1704,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_REASON_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleReasonsPrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_REASON_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(
|
(MODULE_REASON_PRINTERS)[key](
|
||||||
MODULE_REASON_PRINTERS[
|
|
||||||
/** @type {keyof ModuleReasonsPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"moduleReason">} */
|
/** @type {DefineStatsPrinterContext<"moduleReason">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1734,15 +1718,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_PROFILE_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleProfilePrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_PROFILE_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {NonNullable<ModuleProfilePrinters[keyof ModuleProfilePrinters]>} */
|
/** @type {NonNullable<ModuleProfilePrinters[keyof ModuleProfilePrinters]>} */
|
||||||
(
|
(MODULE_PROFILE_PRINTERS[key])(
|
||||||
MODULE_PROFILE_PRINTERS[
|
|
||||||
/** @type {keyof ModuleProfilePrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"profile">} */
|
/** @type {DefineStatsPrinterContext<"profile">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1751,15 +1732,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(CHUNK_GROUP_PRINTERS)) {
|
for (const key of /** @type {(keyof ChunkGroupPrinters)[]} */ (
|
||||||
|
Object.keys(CHUNK_GROUP_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(
|
(CHUNK_GROUP_PRINTERS)[key](
|
||||||
CHUNK_GROUP_PRINTERS[
|
|
||||||
/** @type {keyof ChunkGroupPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"chunkGroupKind" | "chunkGroup">} */
|
/** @type {DefineStatsPrinterContext<"chunkGroupKind" | "chunkGroup">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1768,10 +1746,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(CHUNK_PRINTERS)) {
|
for (const key of /** @type {(keyof ChunkPrinters)[]} */ (
|
||||||
|
Object.keys(CHUNK_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(CHUNK_PRINTERS[/** @type {keyof ChunkPrinters} */ (key)])(
|
(CHUNK_PRINTERS)[key](
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"chunk">} */
|
/** @type {DefineStatsPrinterContext<"chunk">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1780,10 +1760,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(ERROR_PRINTERS)) {
|
for (const key of /** @type {(keyof ErrorPrinters)[]} */ (
|
||||||
|
Object.keys(ERROR_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(ERROR_PRINTERS[/** @type {keyof ErrorPrinters} */ (key)])(
|
(ERROR_PRINTERS)[key](
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"error">} */
|
/** @type {DefineStatsPrinterContext<"error">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1792,15 +1774,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(LOG_ENTRY_PRINTERS)) {
|
for (const key of /** @type {(keyof LogEntryPrinters)[]} */ (
|
||||||
|
Object.keys(LOG_ENTRY_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {TODO} */
|
/** @type {EXPECTED_ANY} */
|
||||||
(
|
(LOG_ENTRY_PRINTERS)[key](
|
||||||
LOG_ENTRY_PRINTERS[
|
|
||||||
/** @type {keyof LogEntryPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"logging">} */
|
/** @type {DefineStatsPrinterContext<"logging">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1809,15 +1788,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_TRACE_DEPENDENCY_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleTraceDependencyPrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_TRACE_DEPENDENCY_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {NonNullable<ModuleTraceDependencyPrinters[keyof ModuleTraceDependencyPrinters]>} */
|
/** @type {NonNullable<ModuleTraceDependencyPrinters[keyof ModuleTraceDependencyPrinters]>} */
|
||||||
(
|
(MODULE_TRACE_DEPENDENCY_PRINTERS[key])(
|
||||||
MODULE_TRACE_DEPENDENCY_PRINTERS[
|
|
||||||
/** @type {keyof ModuleTraceDependencyPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"moduleTraceDependency">} */
|
/** @type {DefineStatsPrinterContext<"moduleTraceDependency">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
@ -1826,15 +1802,12 @@ class DefaultStatsPrinterPlugin {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(MODULE_TRACE_ITEM_PRINTERS)) {
|
for (const key of /** @type {(keyof ModuleTraceItemPrinters)[]} */ (
|
||||||
|
Object.keys(MODULE_TRACE_ITEM_PRINTERS)
|
||||||
|
)) {
|
||||||
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
||||||
/** @type {NonNullable<ModuleTraceItemPrinters[keyof ModuleTraceItemPrinters]>} */
|
/** @type {NonNullable<ModuleTraceItemPrinters[keyof ModuleTraceItemPrinters]>} */
|
||||||
(
|
(MODULE_TRACE_ITEM_PRINTERS[key])(
|
||||||
MODULE_TRACE_ITEM_PRINTERS[
|
|
||||||
/** @type {keyof ModuleTraceItemPrinters} */
|
|
||||||
(key)
|
|
||||||
]
|
|
||||||
)(
|
|
||||||
obj,
|
obj,
|
||||||
/** @type {DefineStatsPrinterContext<"moduleTraceItem">} */
|
/** @type {DefineStatsPrinterContext<"moduleTraceItem">} */
|
||||||
(ctx),
|
(ctx),
|
||||||
|
|
|
@ -70,10 +70,10 @@ const smartGrouping = require("../util/smartGrouping");
|
||||||
* @typedef {T extends ChunkGroupInfoWithName[] ? Record<string, StatsObject<ChunkGroupInfoWithName, F>> : T extends (infer V)[] ? StatsObject<V, F>[] : StatsObject<T, F>} CreatedObject
|
* @typedef {T extends ChunkGroupInfoWithName[] ? Record<string, StatsObject<ChunkGroupInfoWithName, F>> : T extends (infer V)[] ? StatsObject<V, F>[] : StatsObject<T, F>} CreatedObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {TODO} ObjectForExtract */
|
/** @typedef {EXPECTED_ANY} ObjectForExtract */
|
||||||
/** @typedef {TODO} FactoryData */
|
/** @typedef {EXPECTED_ANY} FactoryData */
|
||||||
/** @typedef {TODO} FactoryDataItem */
|
/** @typedef {EXPECTED_ANY} FactoryDataItem */
|
||||||
/** @typedef {TODO} Result */
|
/** @typedef {EXPECTED_ANY} Result */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} StatsFactoryHooks
|
* @typedef {object} StatsFactoryHooks
|
||||||
|
|
|
@ -24,7 +24,6 @@ const InnerGraph = require("../optimize/InnerGraph");
|
||||||
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
||||||
/** @typedef {import("../NormalModule")} NormalModule */
|
/** @typedef {import("../NormalModule")} NormalModule */
|
||||||
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
||||||
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
|
||||||
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
||||||
|
|
||||||
const PLUGIN_NAME = "URLParserPlugin";
|
const PLUGIN_NAME = "URLParserPlugin";
|
||||||
|
@ -36,7 +35,7 @@ const PLUGIN_NAME = "URLParserPlugin";
|
||||||
const getUrl = (module) => pathToFileURL(module.resource);
|
const getUrl = (module) => pathToFileURL(module.resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Parser} parser parser parser
|
* @param {JavascriptParser} parser parser parser
|
||||||
* @param {MemberExpression} arg arg
|
* @param {MemberExpression} arg arg
|
||||||
* @returns {boolean} true when it is `meta.url`, otherwise false
|
* @returns {boolean} true when it is `meta.url`, otherwise false
|
||||||
*/
|
*/
|
||||||
|
@ -63,7 +62,7 @@ const getEvaluatedExprCache = new WeakMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {NewExpressionNode} expr expression
|
* @param {NewExpressionNode} expr expression
|
||||||
* @param {Parser} parser parser parser
|
* @param {JavascriptParser} parser parser parser
|
||||||
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
|
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
|
||||||
*/
|
*/
|
||||||
const getEvaluatedExpr = (expr, parser) => {
|
const getEvaluatedExpr = (expr, parser) => {
|
||||||
|
|
|
@ -92,7 +92,7 @@ const cachedSetProperty = (obj, property, value) => {
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {object} ObjectParsedPropertyEntry
|
* @typedef {object} ObjectParsedPropertyEntry
|
||||||
* @property {T[keyof T] | undefined} base base value
|
* @property {T[keyof T] | undefined} base base value
|
||||||
* @property {string | undefined} byProperty the name of the selector property
|
* @property {`by${string}` | undefined} byProperty the name of the selector property
|
||||||
* @property {ByValues | undefined} byValues value depending on selector property, merged with base
|
* @property {ByValues | undefined} byValues value depending on selector property, merged with base
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ const cachedSetProperty = (obj, property, value) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {object} T
|
* @template {object} T
|
||||||
* @typedef {{ byProperty: string, fn: DynamicFunction }} ParsedObjectDynamic
|
* @typedef {{ byProperty: `by${string}`, fn: DynamicFunction }} ParsedObjectDynamic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +169,7 @@ const parseObject = (obj) => {
|
||||||
for (const key of Object.keys(obj)) {
|
for (const key of Object.keys(obj)) {
|
||||||
const entry = getInfo(/** @type {keyof T} */ (key));
|
const entry = getInfo(/** @type {keyof T} */ (key));
|
||||||
if (entry.byProperty === undefined) {
|
if (entry.byProperty === undefined) {
|
||||||
entry.byProperty = byProperty;
|
entry.byProperty = /** @type {`by${string}`} */ (byProperty);
|
||||||
entry.byValues = new Map();
|
entry.byValues = new Map();
|
||||||
} else if (entry.byProperty !== byProperty) {
|
} else if (entry.byProperty !== byProperty) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -196,7 +196,7 @@ const parseObject = (obj) => {
|
||||||
} else if (typeof byObj === "function") {
|
} else if (typeof byObj === "function") {
|
||||||
if (dynamicInfo === undefined) {
|
if (dynamicInfo === undefined) {
|
||||||
dynamicInfo = {
|
dynamicInfo = {
|
||||||
byProperty: key,
|
byProperty: /** @type {`by${string}`} */ (key),
|
||||||
fn: byObj
|
fn: byObj
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -222,17 +222,16 @@ const parseObject = (obj) => {
|
||||||
/**
|
/**
|
||||||
* @template {object} T
|
* @template {object} T
|
||||||
* @param {ParsedObjectStatic<T>} info static properties (key is property name)
|
* @param {ParsedObjectStatic<T>} info static properties (key is property name)
|
||||||
* @param {{ byProperty: string, fn: DynamicFunction } | undefined} dynamicInfo dynamic part
|
* @param {{ byProperty: `by${string}`, fn: DynamicFunction } | undefined} dynamicInfo dynamic part
|
||||||
* @returns {T} the object
|
* @returns {T} the object
|
||||||
*/
|
*/
|
||||||
const serializeObject = (info, dynamicInfo) => {
|
const serializeObject = (info, dynamicInfo) => {
|
||||||
const obj = /** @type {T} */ ({});
|
const obj = /** @type {EXPECTED_ANY} */ ({});
|
||||||
// Setup byProperty structure
|
// Setup byProperty structure
|
||||||
for (const entry of info.values()) {
|
for (const entry of info.values()) {
|
||||||
if (entry.byProperty !== undefined) {
|
if (entry.byProperty !== undefined) {
|
||||||
const byProperty = /** @type {keyof T} */ (entry.byProperty);
|
const byProperty = entry.byProperty;
|
||||||
const byObj = (obj[byProperty] =
|
const byObj = (obj[byProperty] = obj[byProperty] || {});
|
||||||
obj[byProperty] || /** @type {TODO} */ ({}));
|
|
||||||
for (const byValue of /** @type {ByValues} */ (entry.byValues).keys()) {
|
for (const byValue of /** @type {ByValues} */ (entry.byValues).keys()) {
|
||||||
byObj[byValue] = byObj[byValue] || {};
|
byObj[byValue] = byObj[byValue] || {};
|
||||||
}
|
}
|
||||||
|
@ -240,13 +239,12 @@ const serializeObject = (info, dynamicInfo) => {
|
||||||
}
|
}
|
||||||
for (const [key, entry] of info) {
|
for (const [key, entry] of info) {
|
||||||
if (entry.base !== undefined) {
|
if (entry.base !== undefined) {
|
||||||
obj[/** @type {keyof T} */ (key)] = entry.base;
|
obj[key] = entry.base;
|
||||||
}
|
}
|
||||||
// Fill byProperty structure
|
// Fill byProperty structure
|
||||||
if (entry.byProperty !== undefined) {
|
if (entry.byProperty !== undefined) {
|
||||||
const byProperty = /** @type {keyof T} */ (entry.byProperty);
|
const byProperty = entry.byProperty;
|
||||||
const byObj = (obj[byProperty] =
|
const byObj = (obj[byProperty] = obj[byProperty] || {});
|
||||||
obj[byProperty] || /** @type {TODO} */ ({}));
|
|
||||||
for (const byValue of Object.keys(byObj)) {
|
for (const byValue of Object.keys(byObj)) {
|
||||||
const value = getFromByValues(
|
const value = getFromByValues(
|
||||||
/** @type {ByValues} */
|
/** @type {ByValues} */
|
||||||
|
@ -258,8 +256,7 @@ const serializeObject = (info, dynamicInfo) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dynamicInfo !== undefined) {
|
if (dynamicInfo !== undefined) {
|
||||||
/** @type {TODO} */
|
obj[dynamicInfo.byProperty] = dynamicInfo.fn;
|
||||||
(obj)[dynamicInfo.byProperty] = dynamicInfo.fn;
|
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
@ -384,7 +381,7 @@ const _cleverMerge = (first, second, internalCaching = false) => {
|
||||||
* @param {ObjectParsedPropertyEntry<T>} firstEntry a
|
* @param {ObjectParsedPropertyEntry<T>} firstEntry a
|
||||||
* @param {ObjectParsedPropertyEntry<O>} secondEntry b
|
* @param {ObjectParsedPropertyEntry<O>} secondEntry b
|
||||||
* @param {boolean} internalCaching should parsing of objects and nested merges be cached
|
* @param {boolean} internalCaching should parsing of objects and nested merges be cached
|
||||||
* @returns {ObjectParsedPropertyEntry<TODO>} new entry
|
* @returns {ObjectParsedPropertyEntry<T> | ObjectParsedPropertyEntry<O> | ObjectParsedPropertyEntry<T & O>} new entry
|
||||||
*/
|
*/
|
||||||
const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
|
const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
|
||||||
switch (getValueType(secondEntry.base)) {
|
switch (getValueType(secondEntry.base)) {
|
||||||
|
@ -479,7 +476,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
|
||||||
if (!secondEntry.byProperty) {
|
if (!secondEntry.byProperty) {
|
||||||
// = first.base + (first.byProperty + second.base)
|
// = first.base + (first.byProperty + second.base)
|
||||||
return {
|
return {
|
||||||
base: newBase,
|
base: /** @type {T[keyof T] & O[keyof O]} */ (newBase),
|
||||||
byProperty: firstEntry.byProperty,
|
byProperty: firstEntry.byProperty,
|
||||||
byValues: intermediateByValues
|
byValues: intermediateByValues
|
||||||
};
|
};
|
||||||
|
@ -499,7 +496,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
base: newBase,
|
base: /** @type {T[keyof T] & O[keyof O]} */ (newBase),
|
||||||
byProperty: firstEntry.byProperty,
|
byProperty: firstEntry.byProperty,
|
||||||
byValues: newByValues
|
byValues: newByValues
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,38 +75,37 @@ const DISABLED_METHODS = [
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
* @typedef {Set<T> & {[Symbol.isConcatSpreadable]?: boolean} & { push?: (...items: T[]) => void } & { [P in DISABLED_METHODS_NAMES]?: () => void } & { [P in COPY_METHODS_NAMES]?: () => TODO }} SetWithDeprecatedArrayMethods
|
* @typedef {Set<T> & { [Symbol.isConcatSpreadable]: boolean } & { push: (...items: T[]) => void, length?: number } & { [P in DISABLED_METHODS_NAMES]: () => void } & { [P in COPY_METHODS_NAMES]: P extends keyof Array<T> ? () => Pick<Array<T>, P> : never }} SetWithDeprecatedArrayMethods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template T
|
||||||
* @param {SetWithDeprecatedArrayMethods<T>} set new set
|
* @param {Set<T>} set new set
|
||||||
* @param {string} name property name
|
* @param {string} name property name
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
module.exports.arrayToSetDeprecation = (set, name) => {
|
module.exports.arrayToSetDeprecation = (set, name) => {
|
||||||
for (const method of COPY_METHODS) {
|
for (const method of COPY_METHODS) {
|
||||||
if (set[method]) continue;
|
if (/** @type {SetWithDeprecatedArrayMethods<T>} */ (set)[method]) continue;
|
||||||
const d = createDeprecation(
|
const d = createDeprecation(
|
||||||
`${name} was changed from Array to Set (using Array method '${method}' is deprecated)`,
|
`${name} was changed from Array to Set (using Array method '${method}' is deprecated)`,
|
||||||
"ARRAY_TO_SET"
|
"ARRAY_TO_SET"
|
||||||
);
|
);
|
||||||
/**
|
/** @type {EXPECTED_ANY} */
|
||||||
* @deprecated
|
(set)[method] =
|
||||||
* @this {Set<T>}
|
// eslint-disable-next-line func-names
|
||||||
* @returns {number} count
|
function () {
|
||||||
*/
|
d();
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line unicorn/prefer-spread
|
||||||
set[method] = function () {
|
const array = Array.from(this);
|
||||||
d();
|
return Array.prototype[
|
||||||
// eslint-disable-next-line unicorn/prefer-spread
|
/** @type {keyof COPY_METHODS} */ (method)
|
||||||
const array = Array.from(this);
|
].apply(
|
||||||
return Array.prototype[/** @type {keyof COPY_METHODS} */ (method)].apply(
|
array,
|
||||||
array,
|
// eslint-disable-next-line prefer-rest-params
|
||||||
// eslint-disable-next-line prefer-rest-params
|
arguments
|
||||||
arguments
|
);
|
||||||
);
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
const dPush = createDeprecation(
|
const dPush = createDeprecation(
|
||||||
`${name} was changed from Array to Set (using Array method 'push' is deprecated)`,
|
`${name} was changed from Array to Set (using Array method 'push' is deprecated)`,
|
||||||
|
@ -120,12 +119,8 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
||||||
`${name} was changed from Array to Set (indexing Array is deprecated)`,
|
`${name} was changed from Array to Set (indexing Array is deprecated)`,
|
||||||
"ARRAY_TO_SET_INDEXER"
|
"ARRAY_TO_SET_INDEXER"
|
||||||
);
|
);
|
||||||
/**
|
/** @type {SetWithDeprecatedArrayMethods<T>} */
|
||||||
* @deprecated
|
(set).push = function push() {
|
||||||
* @this {Set<T>}
|
|
||||||
* @returns {number} count
|
|
||||||
*/
|
|
||||||
set.push = function push() {
|
|
||||||
dPush();
|
dPush();
|
||||||
// eslint-disable-next-line prefer-rest-params, unicorn/prefer-spread
|
// eslint-disable-next-line prefer-rest-params, unicorn/prefer-spread
|
||||||
for (const item of Array.from(arguments)) {
|
for (const item of Array.from(arguments)) {
|
||||||
|
@ -134,9 +129,10 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
||||||
return this.size;
|
return this.size;
|
||||||
};
|
};
|
||||||
for (const method of DISABLED_METHODS) {
|
for (const method of DISABLED_METHODS) {
|
||||||
if (set[method]) continue;
|
if (/** @type {SetWithDeprecatedArrayMethods<T>} */ (set)[method]) continue;
|
||||||
|
|
||||||
set[method] = () => {
|
/** @type {SetWithDeprecatedArrayMethods<T>} */
|
||||||
|
(set)[method] = () => {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${name} was changed from Array to Set (using Array method '${method}' is not possible)`
|
`${name} was changed from Array to Set (using Array method '${method}' is not possible)`
|
||||||
);
|
);
|
||||||
|
@ -191,7 +187,8 @@ module.exports.arrayToSetDeprecation = (set, name) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
set[Symbol.isConcatSpreadable] = true;
|
/** @type {SetWithDeprecatedArrayMethods<T>} */
|
||||||
|
(set)[Symbol.isConcatSpreadable] = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,7 +211,8 @@ module.exports.createArrayToSetDeprecationSet = (name) => {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
module.exports.arrayToSetDeprecation(
|
module.exports.arrayToSetDeprecation(
|
||||||
SetDeprecatedArray.prototype,
|
/** @type {SetWithDeprecatedArrayMethods<T>} */
|
||||||
|
(SetDeprecatedArray.prototype),
|
||||||
name
|
name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@ const acornParser = acorn.Parser;
|
||||||
|
|
||||||
/** @type {import("../../../../").LoaderDefinition} */
|
/** @type {import("../../../../").LoaderDefinition} */
|
||||||
module.exports = function (source) {
|
module.exports = function (source) {
|
||||||
/** @type {TODO} */
|
/** @type {acorn.Comment[]} */
|
||||||
const comments = [];
|
const comments = [];
|
||||||
|
|
||||||
const semicolons = new Set();
|
const semicolons = new Set();
|
||||||
|
//@ts-ignore
|
||||||
const ast = acornParser.parse(source, {
|
const ast = acornParser.parse(source, {
|
||||||
ranges: true,
|
ranges: true,
|
||||||
locations: true,
|
locations: true,
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
const load = id => import(`app/${id}?query#hash`);
|
||||||
|
|
||||||
|
|
||||||
|
it("show override request", async () => {
|
||||||
|
expect((await load("a")).default).toBe("override/a");
|
||||||
|
});
|
|
@ -0,0 +1 @@
|
||||||
|
export default "foo/a";
|
|
@ -0,0 +1 @@
|
||||||
|
export default "main/a";
|
|
@ -0,0 +1 @@
|
||||||
|
export default "override/a";
|
|
@ -0,0 +1,14 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const webpack = require("../../../../");
|
||||||
|
|
||||||
|
/** @type {import("../../../../").Configuration} */
|
||||||
|
module.exports = {
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
app: [path.join(__dirname, "src/main"), path.join(__dirname, "src/foo")]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [new webpack.ContextReplacementPlugin(/main/, "../override")]
|
||||||
|
};
|
|
@ -0,0 +1,6 @@
|
||||||
|
const load = id => import(`app/${id}?query#hash`);
|
||||||
|
|
||||||
|
|
||||||
|
it("show override request", async () => {
|
||||||
|
expect((await load("a")).default).toBe("override/a");
|
||||||
|
});
|
|
@ -0,0 +1 @@
|
||||||
|
export default "foo/a";
|
|
@ -0,0 +1 @@
|
||||||
|
export default "main/a";
|
|
@ -0,0 +1 @@
|
||||||
|
export default "override/a";
|
|
@ -0,0 +1,20 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const webpack = require("../../../../");
|
||||||
|
|
||||||
|
/** @type {import("../../../../").Configuration} */
|
||||||
|
module.exports = {
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
app: [path.join(__dirname, "src/main"), path.join(__dirname, "src/foo")]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.ContextReplacementPlugin(/main/, (context) => {
|
||||||
|
Object.assign(context, {
|
||||||
|
resource: ["../override"] // resolved relatively
|
||||||
|
});
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
|
@ -1,5 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/** @typedef {import("../../../../").Compiler} Compiler */
|
||||||
|
|
||||||
const DefinePlugin = require("../../../../").DefinePlugin;
|
const DefinePlugin = require("../../../../").DefinePlugin;
|
||||||
|
|
||||||
const nullValue = null;
|
const nullValue = null;
|
||||||
|
@ -16,19 +18,15 @@ class FailPlugin {
|
||||||
|
|
||||||
class TestChildCompilationPlugin {
|
class TestChildCompilationPlugin {
|
||||||
/**
|
/**
|
||||||
* @param {TODO} compiler compiler
|
* @param {Compiler} compiler compiler
|
||||||
*/
|
*/
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.hooks.make.tapAsync(
|
compiler.hooks.make.tapAsync(
|
||||||
"TestChildCompilationFailurePlugin",
|
"TestChildCompilationFailurePlugin",
|
||||||
/**
|
|
||||||
* @param {TODO} compilation compilation
|
|
||||||
* @param {TODO} cb cb
|
|
||||||
*/
|
|
||||||
(compilation, cb) => {
|
(compilation, cb) => {
|
||||||
const child = compilation.createChildCompiler(
|
const child = compilation.createChildCompiler(
|
||||||
"name",
|
"name",
|
||||||
compiler.outputOptions,
|
compilation.outputOptions,
|
||||||
[
|
[
|
||||||
undefinedValue && new FailPlugin(),
|
undefinedValue && new FailPlugin(),
|
||||||
nullValue && new FailPlugin(),
|
nullValue && new FailPlugin(),
|
||||||
|
@ -38,7 +36,9 @@ class TestChildCompilationPlugin {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
child.runAsChild(cb);
|
child.runAsChild((err) => {
|
||||||
|
cb(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import {
|
||||||
AssignmentPattern,
|
AssignmentPattern,
|
||||||
AssignmentProperty,
|
AssignmentProperty,
|
||||||
AwaitExpression,
|
AwaitExpression,
|
||||||
BaseNode,
|
|
||||||
BigIntLiteral,
|
BigIntLiteral,
|
||||||
BinaryExpression,
|
BinaryExpression,
|
||||||
BlockStatement,
|
BlockStatement,
|
||||||
|
@ -32,9 +31,9 @@ import {
|
||||||
Directive,
|
Directive,
|
||||||
DoWhileStatement,
|
DoWhileStatement,
|
||||||
EmptyStatement,
|
EmptyStatement,
|
||||||
ExportAllDeclaration as ExportAllDeclarationImport,
|
ExportAllDeclaration,
|
||||||
ExportDefaultDeclaration,
|
ExportDefaultDeclaration,
|
||||||
ExportNamedDeclaration as ExportNamedDeclarationImport,
|
ExportNamedDeclaration,
|
||||||
ExportSpecifier,
|
ExportSpecifier,
|
||||||
ExpressionStatement,
|
ExpressionStatement,
|
||||||
ForInStatement,
|
ForInStatement,
|
||||||
|
@ -44,7 +43,7 @@ import {
|
||||||
FunctionExpression,
|
FunctionExpression,
|
||||||
Identifier,
|
Identifier,
|
||||||
IfStatement,
|
IfStatement,
|
||||||
ImportDeclaration as ImportDeclarationImport,
|
ImportDeclaration,
|
||||||
ImportDefaultSpecifier,
|
ImportDefaultSpecifier,
|
||||||
ImportExpression as ImportExpressionImport,
|
ImportExpression as ImportExpressionImport,
|
||||||
ImportNamespaceSpecifier,
|
ImportNamespaceSpecifier,
|
||||||
|
@ -196,7 +195,7 @@ declare interface AdditionalData {
|
||||||
}
|
}
|
||||||
type AfterContextResolveData = ContextResolveData &
|
type AfterContextResolveData = ContextResolveData &
|
||||||
ContextOptions & {
|
ContextOptions & {
|
||||||
resource: any;
|
resource: string | string[];
|
||||||
resourceQuery?: string;
|
resourceQuery?: string;
|
||||||
resourceFragment?: string;
|
resourceFragment?: string;
|
||||||
resolveDependencies: (
|
resolveDependencies: (
|
||||||
|
@ -205,7 +204,7 @@ type AfterContextResolveData = ContextResolveData &
|
||||||
callback: (
|
callback: (
|
||||||
err: null | Error,
|
err: null | Error,
|
||||||
dependencies?: ContextElementDependency[]
|
dependencies?: ContextElementDependency[]
|
||||||
) => any
|
) => void
|
||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
declare class AggressiveMergingPlugin {
|
declare class AggressiveMergingPlugin {
|
||||||
|
@ -623,9 +622,9 @@ declare abstract class BasicEvaluatedExpression {
|
||||||
getMemberRanges?: () => [number, number][];
|
getMemberRanges?: () => [number, number][];
|
||||||
expression?:
|
expression?:
|
||||||
| Program
|
| Program
|
||||||
| ImportDeclarationImport
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationImport
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationImport
|
| ExportAllDeclaration
|
||||||
| ImportExpressionImport
|
| ImportExpressionImport
|
||||||
| UnaryExpression
|
| UnaryExpression
|
||||||
| ArrayExpression
|
| ArrayExpression
|
||||||
|
@ -854,9 +853,9 @@ declare abstract class BasicEvaluatedExpression {
|
||||||
setExpression(
|
setExpression(
|
||||||
expression?:
|
expression?:
|
||||||
| Program
|
| Program
|
||||||
| ImportDeclarationImport
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationImport
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationImport
|
| ExportAllDeclaration
|
||||||
| ImportExpressionImport
|
| ImportExpressionImport
|
||||||
| UnaryExpression
|
| UnaryExpression
|
||||||
| ArrayExpression
|
| ArrayExpression
|
||||||
|
@ -2037,6 +2036,10 @@ declare interface ColorsOptions {
|
||||||
*/
|
*/
|
||||||
useColor?: boolean;
|
useColor?: boolean;
|
||||||
}
|
}
|
||||||
|
declare interface CommonJsImportSettings {
|
||||||
|
name?: string;
|
||||||
|
context: string;
|
||||||
|
}
|
||||||
declare interface Comparator<T> {
|
declare interface Comparator<T> {
|
||||||
(a: T, b: T): 0 | 1 | -1;
|
(a: T, b: T): 0 | 1 | -1;
|
||||||
}
|
}
|
||||||
|
@ -2044,6 +2047,15 @@ declare class CompatSource extends Source {
|
||||||
constructor(sourceLike: SourceLike);
|
constructor(sourceLike: SourceLike);
|
||||||
static from(sourceLike: SourceLike): Source;
|
static from(sourceLike: SourceLike): Source;
|
||||||
}
|
}
|
||||||
|
declare interface CompatibilitySettings {
|
||||||
|
name: string;
|
||||||
|
declaration: CompatibilitySettingsDeclaration;
|
||||||
|
}
|
||||||
|
declare interface CompatibilitySettingsDeclaration {
|
||||||
|
updated: boolean;
|
||||||
|
loc: DependencyLocation;
|
||||||
|
range: [number, number];
|
||||||
|
}
|
||||||
declare class Compilation {
|
declare class Compilation {
|
||||||
/**
|
/**
|
||||||
* Creates an instance of Compilation.
|
* Creates an instance of Compilation.
|
||||||
|
@ -2748,7 +2760,7 @@ declare class Compiler {
|
||||||
err: null | Error,
|
err: null | Error,
|
||||||
entries?: Chunk[],
|
entries?: Chunk[],
|
||||||
compilation?: Compilation
|
compilation?: Compilation
|
||||||
) => any
|
) => void
|
||||||
): void;
|
): void;
|
||||||
purgeInputFileSystem(): void;
|
purgeInputFileSystem(): void;
|
||||||
emitAssets(
|
emitAssets(
|
||||||
|
@ -3320,12 +3332,11 @@ declare abstract class ContextDependency extends Dependency {
|
||||||
userRequest: string;
|
userRequest: string;
|
||||||
critical?: string | false;
|
critical?: string | false;
|
||||||
hadGlobalOrStickyRegExp: boolean;
|
hadGlobalOrStickyRegExp: boolean;
|
||||||
request: any;
|
request?: string;
|
||||||
range: any;
|
range?: [number, number];
|
||||||
valueRange: any;
|
valueRange?: [number, number];
|
||||||
inShorthand?: string | boolean;
|
inShorthand?: string | boolean;
|
||||||
replaces: any;
|
replaces?: { value: string; range: [number, number] }[];
|
||||||
prepend: any;
|
|
||||||
}
|
}
|
||||||
type ContextDependencyOptions = ContextOptions & { request: string };
|
type ContextDependencyOptions = ContextOptions & { request: string };
|
||||||
declare abstract class ContextElementDependency extends ModuleDependency {
|
declare abstract class ContextElementDependency extends ModuleDependency {
|
||||||
|
@ -3390,7 +3401,7 @@ declare abstract class ContextModuleFactory extends ModuleFactory {
|
||||||
callback: (
|
callback: (
|
||||||
err: null | Error,
|
err: null | Error,
|
||||||
dependencies?: ContextElementDependency[]
|
dependencies?: ContextElementDependency[]
|
||||||
) => any
|
) => void
|
||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
type ContextModuleOptions = ContextOptions & ContextModuleOptionsExtras;
|
type ContextModuleOptions = ContextOptions & ContextModuleOptionsExtras;
|
||||||
|
@ -4342,7 +4353,7 @@ declare interface EffectData {
|
||||||
assertions?: ImportAttributes;
|
assertions?: ImportAttributes;
|
||||||
mimetype?: string;
|
mimetype?: string;
|
||||||
dependency: string;
|
dependency: string;
|
||||||
descriptionData?: Record<string, any>;
|
descriptionData?: JsonObjectTypes;
|
||||||
compiler?: string;
|
compiler?: string;
|
||||||
issuer: string;
|
issuer: string;
|
||||||
issuerLayer: string;
|
issuerLayer: string;
|
||||||
|
@ -4943,9 +4954,6 @@ declare interface ExperimentsNormalizedExtra {
|
||||||
*/
|
*/
|
||||||
lazyCompilation?: false | LazyCompilationOptions;
|
lazyCompilation?: false | LazyCompilationOptions;
|
||||||
}
|
}
|
||||||
type ExportAllDeclarationJavascriptParser = ExportAllDeclarationImport & {
|
|
||||||
attributes?: ImportAttribute[];
|
|
||||||
};
|
|
||||||
declare abstract class ExportInfo {
|
declare abstract class ExportInfo {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
@ -5045,9 +5053,6 @@ declare abstract class ExportInfo {
|
||||||
| "not provided";
|
| "not provided";
|
||||||
getRenameInfo(): string;
|
getRenameInfo(): string;
|
||||||
}
|
}
|
||||||
type ExportNamedDeclarationJavascriptParser = ExportNamedDeclarationImport & {
|
|
||||||
attributes?: ImportAttribute[];
|
|
||||||
};
|
|
||||||
type ExportPresenceMode = false | 0 | 1 | 2 | 3;
|
type ExportPresenceMode = false | 0 | 1 | 2 | 3;
|
||||||
declare interface ExportSpec {
|
declare interface ExportSpec {
|
||||||
/**
|
/**
|
||||||
|
@ -6120,6 +6125,15 @@ declare class HarmonyImportDependencyTemplate extends DependencyTemplate {
|
||||||
referencedModule: Module
|
referencedModule: Module
|
||||||
): undefined | string | boolean | SortableSet<string>;
|
): undefined | string | boolean | SortableSet<string>;
|
||||||
}
|
}
|
||||||
|
declare interface HarmonySettings {
|
||||||
|
ids: string[];
|
||||||
|
source: string;
|
||||||
|
sourceOrder: number;
|
||||||
|
name: string;
|
||||||
|
await: boolean;
|
||||||
|
attributes?: ImportAttributes;
|
||||||
|
defer?: boolean;
|
||||||
|
}
|
||||||
declare class Hash {
|
declare class Hash {
|
||||||
constructor();
|
constructor();
|
||||||
|
|
||||||
|
@ -6341,16 +6355,7 @@ type IgnorePluginOptions =
|
||||||
*/
|
*/
|
||||||
checkResource: (resource: string, context: string) => boolean;
|
checkResource: (resource: string, context: string) => boolean;
|
||||||
};
|
};
|
||||||
type ImportAttribute = BaseNode & {
|
|
||||||
type: "ImportAttribute";
|
|
||||||
key: Identifier | SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
||||||
value: Literal;
|
|
||||||
};
|
|
||||||
type ImportAttributes = Record<string, string> & {};
|
type ImportAttributes = Record<string, string> & {};
|
||||||
type ImportDeclarationJavascriptParser = ImportDeclarationImport & {
|
|
||||||
attributes?: ImportAttribute[];
|
|
||||||
phase?: "defer";
|
|
||||||
};
|
|
||||||
declare interface ImportDependencyMeta {
|
declare interface ImportDependencyMeta {
|
||||||
attributes?: ImportAttributes;
|
attributes?: ImportAttributes;
|
||||||
externalType?: "import" | "module";
|
externalType?: "import" | "module";
|
||||||
|
@ -6403,6 +6408,10 @@ declare interface ImportModuleOptions {
|
||||||
*/
|
*/
|
||||||
baseUri?: string;
|
baseUri?: string;
|
||||||
}
|
}
|
||||||
|
declare interface ImportSettings {
|
||||||
|
references: string[][];
|
||||||
|
expression: ImportExpressionJavascriptParser;
|
||||||
|
}
|
||||||
type ImportSource =
|
type ImportSource =
|
||||||
| undefined
|
| undefined
|
||||||
| null
|
| null
|
||||||
|
@ -6765,9 +6774,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
>;
|
>;
|
||||||
preStatement: SyncBailHook<
|
preStatement: SyncBailHook<
|
||||||
[
|
[
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -6798,9 +6807,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
>;
|
>;
|
||||||
blockPreStatement: SyncBailHook<
|
blockPreStatement: SyncBailHook<
|
||||||
[
|
[
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -6831,9 +6840,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
>;
|
>;
|
||||||
statement: SyncBailHook<
|
statement: SyncBailHook<
|
||||||
[
|
[
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -6886,33 +6895,24 @@ declare class JavascriptParser extends ParserClass {
|
||||||
boolean | void
|
boolean | void
|
||||||
>;
|
>;
|
||||||
label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
|
label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
|
||||||
import: SyncBailHook<
|
import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
|
||||||
[ImportDeclarationJavascriptParser, ImportSource],
|
|
||||||
boolean | void
|
|
||||||
>;
|
|
||||||
importSpecifier: SyncBailHook<
|
importSpecifier: SyncBailHook<
|
||||||
[ImportDeclarationJavascriptParser, ImportSource, null | string, string],
|
[ImportDeclaration, ImportSource, null | string, string],
|
||||||
boolean | void
|
boolean | void
|
||||||
>;
|
>;
|
||||||
export: SyncBailHook<
|
export: SyncBailHook<
|
||||||
[ExportNamedDeclarationJavascriptParser | ExportDefaultDeclaration],
|
[ExportNamedDeclaration | ExportDefaultDeclaration],
|
||||||
boolean | void
|
boolean | void
|
||||||
>;
|
>;
|
||||||
exportImport: SyncBailHook<
|
exportImport: SyncBailHook<
|
||||||
[
|
[ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
|
||||||
(
|
|
||||||
| ExportNamedDeclarationJavascriptParser
|
|
||||||
| ExportAllDeclarationJavascriptParser
|
|
||||||
),
|
|
||||||
ImportSource
|
|
||||||
],
|
|
||||||
boolean | void
|
boolean | void
|
||||||
>;
|
>;
|
||||||
exportDeclaration: SyncBailHook<
|
exportDeclaration: SyncBailHook<
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| ExportDefaultDeclaration
|
| ExportDefaultDeclaration
|
||||||
),
|
),
|
||||||
Declaration
|
Declaration
|
||||||
|
@ -6959,8 +6959,8 @@ declare class JavascriptParser extends ParserClass {
|
||||||
exportSpecifier: SyncBailHook<
|
exportSpecifier: SyncBailHook<
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| ExportDefaultDeclaration
|
| ExportDefaultDeclaration
|
||||||
),
|
),
|
||||||
string,
|
string,
|
||||||
|
@ -6971,10 +6971,7 @@ declare class JavascriptParser extends ParserClass {
|
||||||
>;
|
>;
|
||||||
exportImportSpecifier: SyncBailHook<
|
exportImportSpecifier: SyncBailHook<
|
||||||
[
|
[
|
||||||
(
|
ExportNamedDeclaration | ExportAllDeclaration,
|
||||||
| ExportNamedDeclarationJavascriptParser
|
|
||||||
| ExportAllDeclarationJavascriptParser
|
|
||||||
),
|
|
||||||
ImportSource,
|
ImportSource,
|
||||||
null | string,
|
null | string,
|
||||||
null | string,
|
null | string,
|
||||||
|
@ -7099,9 +7096,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
semicolons?: Set<number>;
|
semicolons?: Set<number>;
|
||||||
statementPath?: StatementPathItem[];
|
statementPath?: StatementPathItem[];
|
||||||
prevStatement?:
|
prevStatement?:
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| ImportExpressionImport
|
| ImportExpressionImport
|
||||||
| UnaryExpression
|
| UnaryExpression
|
||||||
| ArrayExpression
|
| ArrayExpression
|
||||||
|
@ -7158,7 +7155,12 @@ declare class JavascriptParser extends ParserClass {
|
||||||
Expression,
|
Expression,
|
||||||
Set<DestructuringAssignmentProperty>
|
Set<DestructuringAssignmentProperty>
|
||||||
>;
|
>;
|
||||||
currentTagData?: TagData;
|
currentTagData?:
|
||||||
|
| (TopLevelSymbol & Record<string, any>)
|
||||||
|
| (HarmonySettings & Record<string, any>)
|
||||||
|
| (ImportSettings & Record<string, any>)
|
||||||
|
| (CommonJsImportSettings & Record<string, any>)
|
||||||
|
| (CompatibilitySettings & Record<string, any>);
|
||||||
magicCommentContext: Context;
|
magicCommentContext: Context;
|
||||||
destructuringAssignmentPropertiesFor(
|
destructuringAssignmentPropertiesFor(
|
||||||
node: Expression
|
node: Expression
|
||||||
|
@ -7203,9 +7205,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
*/
|
*/
|
||||||
modulePreWalkStatements(
|
modulePreWalkStatements(
|
||||||
statements: (
|
statements: (
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ClassDeclaration
|
| ClassDeclaration
|
||||||
|
@ -7237,9 +7239,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
*/
|
*/
|
||||||
preWalkStatements(
|
preWalkStatements(
|
||||||
statements: (
|
statements: (
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ClassDeclaration
|
| ClassDeclaration
|
||||||
|
@ -7271,9 +7273,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
*/
|
*/
|
||||||
blockPreWalkStatements(
|
blockPreWalkStatements(
|
||||||
statements: (
|
statements: (
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ClassDeclaration
|
| ClassDeclaration
|
||||||
|
@ -7305,9 +7307,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
*/
|
*/
|
||||||
walkStatements(
|
walkStatements(
|
||||||
statements: (
|
statements: (
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ClassDeclaration
|
| ClassDeclaration
|
||||||
|
@ -7339,9 +7341,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
*/
|
*/
|
||||||
preWalkStatement(
|
preWalkStatement(
|
||||||
statement:
|
statement:
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -7370,9 +7372,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
): void;
|
): void;
|
||||||
blockPreWalkStatement(
|
blockPreWalkStatement(
|
||||||
statement:
|
statement:
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -7401,9 +7403,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
): void;
|
): void;
|
||||||
walkStatement(
|
walkStatement(
|
||||||
statement:
|
statement:
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| MaybeNamedFunctionDeclaration
|
| MaybeNamedFunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
|
@ -7503,29 +7505,19 @@ declare class JavascriptParser extends ParserClass {
|
||||||
| ThisExpression
|
| ThisExpression
|
||||||
| UpdateExpression
|
| UpdateExpression
|
||||||
| YieldExpression;
|
| YieldExpression;
|
||||||
modulePreWalkImportDeclaration(
|
modulePreWalkImportDeclaration(statement: ImportDeclaration): void;
|
||||||
statement: ImportDeclarationJavascriptParser
|
|
||||||
): void;
|
|
||||||
enterDeclaration(
|
enterDeclaration(
|
||||||
declaration: Declaration,
|
declaration: Declaration,
|
||||||
onIdent: (ident: string, identifier: Identifier) => void
|
onIdent: (ident: string, identifier: Identifier) => void
|
||||||
): void;
|
): void;
|
||||||
modulePreWalkExportNamedDeclaration(
|
modulePreWalkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
|
||||||
statement: ExportNamedDeclarationJavascriptParser
|
blockPreWalkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
|
||||||
): void;
|
walkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
|
||||||
blockPreWalkExportNamedDeclaration(
|
|
||||||
statement: ExportNamedDeclarationJavascriptParser
|
|
||||||
): void;
|
|
||||||
walkExportNamedDeclaration(
|
|
||||||
statement: ExportNamedDeclarationJavascriptParser
|
|
||||||
): void;
|
|
||||||
blockPreWalkExportDefaultDeclaration(
|
blockPreWalkExportDefaultDeclaration(
|
||||||
statement: ExportDefaultDeclaration
|
statement: ExportDefaultDeclaration
|
||||||
): void;
|
): void;
|
||||||
walkExportDefaultDeclaration(statement: ExportDefaultDeclaration): void;
|
walkExportDefaultDeclaration(statement: ExportDefaultDeclaration): void;
|
||||||
modulePreWalkExportAllDeclaration(
|
modulePreWalkExportAllDeclaration(statement: ExportAllDeclaration): void;
|
||||||
statement: ExportAllDeclarationJavascriptParser
|
|
||||||
): void;
|
|
||||||
preWalkVariableDeclaration(statement: VariableDeclaration): void;
|
preWalkVariableDeclaration(statement: VariableDeclaration): void;
|
||||||
blockPreWalkVariableDeclaration(statement: VariableDeclaration): void;
|
blockPreWalkVariableDeclaration(statement: VariableDeclaration): void;
|
||||||
preWalkVariableDeclarator(declarator: VariableDeclarator): void;
|
preWalkVariableDeclarator(declarator: VariableDeclarator): void;
|
||||||
|
@ -7735,7 +7727,7 @@ declare class JavascriptParser extends ParserClass {
|
||||||
hookMap: HookMap<SyncBailHook<T, R>>,
|
hookMap: HookMap<SyncBailHook<T, R>>,
|
||||||
info: ExportedVariableInfo,
|
info: ExportedVariableInfo,
|
||||||
fallback: undefined | ((name: string) => undefined | R),
|
fallback: undefined | ((name: string) => undefined | R),
|
||||||
defined: undefined | ((result?: string) => any),
|
defined: undefined | ((result?: string) => undefined | R),
|
||||||
...args: AsArray<T>
|
...args: AsArray<T>
|
||||||
): undefined | R;
|
): undefined | R;
|
||||||
callHooksForNameWithFallback<T, R>(
|
callHooksForNameWithFallback<T, R>(
|
||||||
|
@ -7775,9 +7767,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
inBlockScope(fn: () => void, inExecutedPath?: boolean): void;
|
inBlockScope(fn: () => void, inExecutedPath?: boolean): void;
|
||||||
detectMode(
|
detectMode(
|
||||||
statements: (
|
statements: (
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| FunctionDeclaration
|
| FunctionDeclaration
|
||||||
| VariableDeclaration
|
| VariableDeclaration
|
||||||
| ClassDeclaration
|
| ClassDeclaration
|
||||||
|
@ -7928,11 +7920,25 @@ declare class JavascriptParser extends ParserClass {
|
||||||
setAsiPosition(pos: number): void;
|
setAsiPosition(pos: number): void;
|
||||||
unsetAsiPosition(pos: number): void;
|
unsetAsiPosition(pos: number): void;
|
||||||
isStatementLevelExpression(expr: Expression): boolean;
|
isStatementLevelExpression(expr: Expression): boolean;
|
||||||
getTagData(name: string, tag: symbol): undefined | TagData;
|
getTagData(
|
||||||
|
name: string,
|
||||||
|
tag: symbol
|
||||||
|
):
|
||||||
|
| undefined
|
||||||
|
| (TopLevelSymbol & Record<string, any>)
|
||||||
|
| (HarmonySettings & Record<string, any>)
|
||||||
|
| (ImportSettings & Record<string, any>)
|
||||||
|
| (CommonJsImportSettings & Record<string, any>)
|
||||||
|
| (CompatibilitySettings & Record<string, any>);
|
||||||
tagVariable(
|
tagVariable(
|
||||||
name: string,
|
name: string,
|
||||||
tag: symbol,
|
tag: symbol,
|
||||||
data?: TagData,
|
data?:
|
||||||
|
| (TopLevelSymbol & Record<string, any>)
|
||||||
|
| (HarmonySettings & Record<string, any>)
|
||||||
|
| (ImportSettings & Record<string, any>)
|
||||||
|
| (CommonJsImportSettings & Record<string, any>)
|
||||||
|
| (CompatibilitySettings & Record<string, any>),
|
||||||
flags?: 0 | 1 | 2 | 4
|
flags?: 0 | 1 | 2 | 4
|
||||||
): void;
|
): void;
|
||||||
defineVariable(name: string): void;
|
defineVariable(name: string): void;
|
||||||
|
@ -8071,9 +8077,9 @@ declare class JavascriptParser extends ParserClass {
|
||||||
}>;
|
}>;
|
||||||
static getImportAttributes: (
|
static getImportAttributes: (
|
||||||
node:
|
node:
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| ImportExpressionJavascriptParser
|
| ImportExpressionJavascriptParser
|
||||||
) => undefined | ImportAttributes;
|
) => undefined | ImportAttributes;
|
||||||
}
|
}
|
||||||
|
@ -8718,9 +8724,9 @@ declare interface KnownStatsChunk {
|
||||||
hash: string;
|
hash: string;
|
||||||
childrenByOrder: Record<string, ChunkId[]>;
|
childrenByOrder: Record<string, ChunkId[]>;
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
siblings?: (string | number)[];
|
siblings?: ChunkId[];
|
||||||
parents?: (string | number)[];
|
parents?: ChunkId[];
|
||||||
children?: (string | number)[];
|
children?: ChunkId[];
|
||||||
modules?: StatsModule[];
|
modules?: StatsModule[];
|
||||||
filteredModules?: number;
|
filteredModules?: number;
|
||||||
origins?: StatsChunkOrigin[];
|
origins?: StatsChunkOrigin[];
|
||||||
|
@ -8734,8 +8740,8 @@ declare interface KnownStatsChunkGroup {
|
||||||
auxiliaryAssets?: { name: string; size?: number }[];
|
auxiliaryAssets?: { name: string; size?: number }[];
|
||||||
filteredAuxiliaryAssets?: number;
|
filteredAuxiliaryAssets?: number;
|
||||||
auxiliaryAssetsSize?: number;
|
auxiliaryAssetsSize?: number;
|
||||||
children?: { [index: string]: StatsChunkGroup[] };
|
children?: Record<string, StatsChunkGroup[]>;
|
||||||
childAssets?: { [index: string]: string[] };
|
childAssets?: Record<string, string[]>;
|
||||||
isOverSizeLimit?: boolean;
|
isOverSizeLimit?: boolean;
|
||||||
}
|
}
|
||||||
declare interface KnownStatsChunkOrigin {
|
declare interface KnownStatsChunkOrigin {
|
||||||
|
@ -8827,7 +8833,7 @@ declare interface KnownStatsModule {
|
||||||
index2?: number;
|
index2?: number;
|
||||||
postOrderIndex?: number;
|
postOrderIndex?: number;
|
||||||
size?: number;
|
size?: number;
|
||||||
sizes?: { [index: string]: number };
|
sizes?: Record<string, number>;
|
||||||
cacheable?: boolean;
|
cacheable?: boolean;
|
||||||
built?: boolean;
|
built?: boolean;
|
||||||
codeGenerated?: boolean;
|
codeGenerated?: boolean;
|
||||||
|
@ -9295,7 +9301,6 @@ declare interface LimitChunkCountPluginOptions {
|
||||||
*/
|
*/
|
||||||
maxChunks: number;
|
maxChunks: number;
|
||||||
}
|
}
|
||||||
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
||||||
declare interface LoadScriptCompilationHooks {
|
declare interface LoadScriptCompilationHooks {
|
||||||
createScript: SyncWaterfallHook<[string, Chunk], string>;
|
createScript: SyncWaterfallHook<[string, Chunk], string>;
|
||||||
}
|
}
|
||||||
|
@ -9432,7 +9437,7 @@ declare interface LoaderPluginLoaderContext {
|
||||||
importModule(
|
importModule(
|
||||||
request: string,
|
request: string,
|
||||||
options: undefined | ImportModuleOptions,
|
options: undefined | ImportModuleOptions,
|
||||||
callback: (err?: null | Error, exports?: any) => any
|
callback: (err?: null | Error, exports?: any) => void
|
||||||
): void;
|
): void;
|
||||||
importModule(request: string, options?: ImportModuleOptions): Promise<any>;
|
importModule(request: string, options?: ImportModuleOptions): Promise<any>;
|
||||||
}
|
}
|
||||||
|
@ -10871,7 +10876,7 @@ declare class MultiCompiler {
|
||||||
fn: (
|
fn: (
|
||||||
compiler: Compiler,
|
compiler: Compiler,
|
||||||
callback: CallbackWebpackFunction_2<MultiStats, void>
|
callback: CallbackWebpackFunction_2<MultiStats, void>
|
||||||
) => any,
|
) => void,
|
||||||
callback: CallbackWebpackFunction_2<Stats[], void>
|
callback: CallbackWebpackFunction_2<Stats[], void>
|
||||||
): void;
|
): void;
|
||||||
watch(
|
watch(
|
||||||
|
@ -13162,7 +13167,7 @@ declare class Profiler {
|
||||||
startProfiling(): Promise<void> | Promise<[any, any, any]>;
|
startProfiling(): Promise<void> | Promise<[any, any, any]>;
|
||||||
sendCommand(method: string, params?: object): Promise<any>;
|
sendCommand(method: string, params?: object): Promise<any>;
|
||||||
destroy(): Promise<void>;
|
destroy(): Promise<void>;
|
||||||
stopProfiling(): Promise<{ profile: any }>;
|
stopProfiling(): Promise<{ profile: { startTime: number; endTime: number } }>;
|
||||||
}
|
}
|
||||||
declare class ProfilingPlugin {
|
declare class ProfilingPlugin {
|
||||||
constructor(options?: ProfilingPluginOptions);
|
constructor(options?: ProfilingPluginOptions);
|
||||||
|
@ -16726,9 +16731,9 @@ type Statement =
|
||||||
| ForInStatement
|
| ForInStatement
|
||||||
| ForOfStatement;
|
| ForOfStatement;
|
||||||
type StatementPathItem =
|
type StatementPathItem =
|
||||||
| ImportDeclarationJavascriptParser
|
| ImportDeclaration
|
||||||
| ExportNamedDeclarationJavascriptParser
|
| ExportNamedDeclaration
|
||||||
| ExportAllDeclarationJavascriptParser
|
| ExportAllDeclaration
|
||||||
| ImportExpressionImport
|
| ImportExpressionImport
|
||||||
| UnaryExpression
|
| UnaryExpression
|
||||||
| ArrayExpression
|
| ArrayExpression
|
||||||
|
@ -17425,12 +17430,14 @@ declare interface SyntheticDependencyLocation {
|
||||||
declare const TOMBSTONE: unique symbol;
|
declare const TOMBSTONE: unique symbol;
|
||||||
declare const TRANSITIVE: unique symbol;
|
declare const TRANSITIVE: unique symbol;
|
||||||
declare const TRANSITIVE_ONLY: unique symbol;
|
declare const TRANSITIVE_ONLY: unique symbol;
|
||||||
declare interface TagData {
|
|
||||||
[index: string]: any;
|
|
||||||
}
|
|
||||||
declare interface TagInfo {
|
declare interface TagInfo {
|
||||||
tag: symbol;
|
tag: symbol;
|
||||||
data?: TagData;
|
data?:
|
||||||
|
| (TopLevelSymbol & Record<string, any>)
|
||||||
|
| (HarmonySettings & Record<string, any>)
|
||||||
|
| (ImportSettings & Record<string, any>)
|
||||||
|
| (CommonJsImportSettings & Record<string, any>)
|
||||||
|
| (CompatibilitySettings & Record<string, any>);
|
||||||
next?: TagInfo;
|
next?: TagInfo;
|
||||||
}
|
}
|
||||||
declare interface TargetItemWithConnection {
|
declare interface TargetItemWithConnection {
|
||||||
|
|
Loading…
Reference in New Issue