Enhance refactor commands with controller-aware Route() updates and fix code quality violations

Add semantic token highlighting for 'that' variable and comment file references in VS Code extension
Add Phone_Text_Input and Currency_Input components with formatting utilities
Implement client widgets, form standardization, and soft delete functionality
Add modal scroll lock and update documentation
Implement comprehensive modal system with form integration and validation
Fix modal component instantiation using jQuery plugin API
Implement modal system with responsive sizing, queuing, and validation support
Implement form submission with validation, error handling, and loading states
Implement country/state selectors with dynamic data loading and Bootstrap styling
Revert Rsx::Route() highlighting in Blade/PHP files
Target specific PHP scopes for Rsx::Route() highlighting in Blade
Expand injection selector for Rsx::Route() highlighting
Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls
Update jqhtml packages to v2.2.165
Add bundle path validation for common mistakes (development mode only)
Create Ajax_Select_Input widget and Rsx_Reference_Data controller
Create Country_Select_Input widget with default country support
Initialize Tom Select on Select_Input widgets
Add Tom Select bundle for enhanced select dropdowns
Implement ISO 3166 geographic data system for country/region selection
Implement widget-based form system with disabled state support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-30 06:21:56 +00:00
parent e678b987c2
commit f6ac36c632
5683 changed files with 5854736 additions and 22329 deletions

View File

@@ -86,12 +86,14 @@ const { isSourceEqual } = require("./util/source");
/** @template T @typedef {import("tapable").AsArray<T>} AsArray<T> */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
/** @typedef {import("../declarations/WebpackOptions").HashFunction} HashFunction */
/** @typedef {import("../declarations/WebpackOptions").HashDigest} HashDigest */
/** @typedef {import("../declarations/WebpackOptions").HashDigestLength} HashDigestLength */
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
/** @typedef {import("../declarations/WebpackOptions").Plugins} Plugins */
/** @typedef {import("./config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptions */
/** @typedef {import("./config/defaults").OutputNormalizedWithDefaults} OutputOptionsWithDefaults */
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Cache")} Cache */
/** @typedef {import("./CacheFacade")} CacheFacade */
@@ -106,9 +108,9 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {import("./Compiler").Records} Records */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
/** @typedef {import("./Dependency").ReferencedExports} ReferencedExports */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module").NameForCondition} NameForCondition */
/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./Module").ValueCacheVersions} ValueCacheVersions */
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
@@ -132,13 +134,13 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("../declarations/WebpackOptions").HashFunction} HashFunction */
/**
* @template T
* @typedef {import("./util/deprecation").FakeHook<T>} FakeHook<T>
*/
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/**
* @callback Callback
* @param {(WebpackError | null)=} err
@@ -147,33 +149,33 @@ const { isSourceEqual } = require("./util/source");
/**
* @callback ModuleCallback
* @param {(WebpackError | null)=} err
* @param {(Module | null)=} result
* @param {WebpackError | null=} err
* @param {Module | null=} result
* @returns {void}
*/
/**
* @callback ModuleFactoryResultCallback
* @param {(WebpackError | null)=} err
* @param {ModuleFactoryResult=} result
* @param {WebpackError | null=} err
* @param {ModuleFactoryResult | null=} result
* @returns {void}
*/
/**
* @callback ModuleOrFactoryResultCallback
* @param {(WebpackError | null)=} err
* @param {Module | ModuleFactoryResult=} result
* @callback ModuleOrModuleFactoryResultCallback
* @param {WebpackError | null=} err
* @param {Module | ModuleFactoryResult | null=} result
* @returns {void}
*/
/**
* @callback ExecuteModuleCallback
* @param {WebpackError | null} err
* @param {ExecuteModuleResult=} result
* @param {WebpackError | null=} err
* @param {ExecuteModuleResult | null=} result
* @returns {void}
*/
/** @typedef {new (...args: EXPECTED_ANY[]) => Dependency} DepConstructor */
/** @typedef {new (...args: EXPECTED_ANY[]) => Dependency} DependencyConstructor */
/** @typedef {Record<string, Source>} CompilationAssets */
@@ -190,6 +192,8 @@ const { isSourceEqual } = require("./util/source");
* @property {AsyncDependenciesBlock[]} blocks
*/
/** @typedef {Set<Chunk>} Chunks */
/**
* @typedef {object} ChunkPathData
* @property {string | number} id
@@ -244,7 +248,6 @@ const { isSourceEqual } = require("./util/source");
* @typedef {object} ExecuteModuleArgument
* @property {Module} module
* @property {ExecuteModuleObject=} moduleObject
* @property {TODO} preparedInfo
* @property {CodeGenerationResult} codeGenerationResult
*/
@@ -479,7 +482,7 @@ const unsafeCacheDependencies = new WeakMap();
/** @type {WeakMap<ModuleWithRestoreFromUnsafeCache, UnsafeCacheData>} */
const unsafeCacheData = new WeakMap();
/** @typedef {{ id: ModuleId, modules?: Map<Module, string | number | undefined>, blocks?: (string | number | null)[] }} References */
/** @typedef {{ id: ModuleId, modules?: Map<Module, ModuleId>, blocks?: (ChunkId | null)[] }} References */
/** @typedef {Map<Module, WeakTupleMap<EXPECTED_ANY[], EXPECTED_ANY>>} ModuleMemCaches */
class Compilation {
@@ -492,7 +495,7 @@ class Compilation {
this._backCompat = compiler._backCompat;
const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this);
/** @typedef {{ additionalAssets?: true | TODO }} ProcessAssetsAdditionalOptions */
/** @typedef {{ additionalAssets?: boolean | ((assets: CompilationAssets) => void) }} ProcessAssetsAdditionalOptions */
/** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */
const processAssetsHook = new AsyncSeriesHook(["assets"]);
@@ -718,7 +721,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
processAssetsHook.tapAsync(
getOptions(options),
(assets, callback) =>
/** @type {TODO} */ (fn)(...getArgs(), callback)
/** @type {EXPECTED_ANY} */ (fn)(...getArgs(), callback)
);
},
/** @type {AsyncSeriesHook<T>["tapPromise"]} */
@@ -751,7 +754,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {SyncHook<[Dependency, EntryOptions, Module]>} */
succeedEntry: new SyncHook(["entry", "options", "module"]),
/** @type {SyncWaterfallHook<[(string[] | ReferencedExport)[], Dependency, RuntimeSpec]>} */
/** @type {SyncWaterfallHook<[ReferencedExports, Dependency, RuntimeSpec]>} */
dependencyReferencedExports: new SyncWaterfallHook([
"referencedExports",
"dependency",
@@ -811,33 +814,33 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {SyncBailHook<[], boolean | void>} */
shouldRecord: new SyncBailHook([]),
/** @type {SyncHook<[Chunk, Set<string>, RuntimeRequirementsContext]>} */
/** @type {SyncHook<[Chunk, RuntimeRequirements, RuntimeRequirementsContext]>} */
additionalChunkRuntimeRequirements: new SyncHook([
"chunk",
"runtimeRequirements",
"context"
]),
/** @type {HookMap<SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext], void>>} */
/** @type {HookMap<SyncBailHook<[Chunk, RuntimeRequirements, RuntimeRequirementsContext], void>>} */
runtimeRequirementInChunk: new HookMap(
() => new SyncBailHook(["chunk", "runtimeRequirements", "context"])
),
/** @type {SyncHook<[Module, Set<string>, RuntimeRequirementsContext]>} */
/** @type {SyncHook<[Module, RuntimeRequirements, RuntimeRequirementsContext]>} */
additionalModuleRuntimeRequirements: new SyncHook([
"module",
"runtimeRequirements",
"context"
]),
/** @type {HookMap<SyncBailHook<[Module, Set<string>, RuntimeRequirementsContext], void>>} */
/** @type {HookMap<SyncBailHook<[Module, RuntimeRequirements, RuntimeRequirementsContext], void>>} */
runtimeRequirementInModule: new HookMap(
() => new SyncBailHook(["module", "runtimeRequirements", "context"])
),
/** @type {SyncHook<[Chunk, Set<string>, RuntimeRequirementsContext]>} */
/** @type {SyncHook<[Chunk, RuntimeRequirements, RuntimeRequirementsContext]>} */
additionalTreeRuntimeRequirements: new SyncHook([
"chunk",
"runtimeRequirements",
"context"
]),
/** @type {HookMap<SyncBailHook<[Chunk, Set<string>, RuntimeRequirementsContext], void>>} */
/** @type {HookMap<SyncBailHook<[Chunk, RuntimeRequirements, RuntimeRequirementsContext], void>>} */
runtimeRequirementInTree: new HookMap(
() => new SyncBailHook(["chunk", "runtimeRequirements", "context"])
),
@@ -910,7 +913,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
// TODO webpack 6 remove
/** @deprecated */
additionalChunkAssets:
/** @type {FakeHook<Pick<AsyncSeriesHook<[Set<Chunk>]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
/** @type {FakeHook<Pick<AsyncSeriesHook<[Chunks]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
(
createProcessAssetsHook(
"additionalChunkAssets",
@@ -934,7 +937,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
// TODO webpack 6 remove
/** @deprecated */
optimizeChunkAssets:
/** @type {FakeHook<Pick<AsyncSeriesHook<[Set<Chunk>]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
/** @type {FakeHook<Pick<AsyncSeriesHook<[Chunks]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
(
createProcessAssetsHook(
"optimizeChunkAssets",
@@ -946,7 +949,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
// TODO webpack 6 remove
/** @deprecated */
afterOptimizeChunkAssets:
/** @type {FakeHook<Pick<AsyncSeriesHook<[Set<Chunk>]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
/** @type {FakeHook<Pick<AsyncSeriesHook<[Chunks]>, "tap" | "tapAsync" | "tapPromise" | "name">>} */
(
createProcessAssetsHook(
"afterOptimizeChunkAssets",
@@ -1057,7 +1060,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
const options = /** @type {WebpackOptions} */ (compiler.options);
this.options = options;
this.outputOptions = options && options.output;
this.outputOptions =
/** @type {OutputOptionsWithDefaults} */
(options && options.output);
/** @type {boolean} */
this.bail = (options && options.bail) || false;
/** @type {boolean} */
@@ -1082,11 +1087,15 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.moduleMemCaches = undefined;
/** @type {ModuleMemCaches | undefined} */
this.moduleMemCaches2 = undefined;
/** @type {ModuleGraph} */
this.moduleGraph = new ModuleGraph();
/** @type {ChunkGraph} */
this.chunkGraph = /** @type {TODO} */ (undefined);
/** @type {CodeGenerationResults} */
this.codeGenerationResults = /** @type {TODO} */ (undefined);
this.chunkGraph = new ChunkGraph(
this.moduleGraph,
this.outputOptions.hashFunction
);
/** @type {CodeGenerationResults | undefined} */
this.codeGenerationResults = undefined;
/** @type {AsyncQueue<Module, Module, Module>} */
this.processDependenciesQueue = new AsyncQueue({
@@ -1142,7 +1151,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.entrypoints = new Map();
/** @type {Entrypoint[]} */
this.asyncEntrypoints = [];
/** @type {Set<Chunk>} */
/** @type {Chunks} */
this.chunks = new Set();
/** @type {ChunkGroup[]} */
this.chunkGroups = [];
@@ -1179,7 +1188,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.children = [];
/** @type {Map<string, LogEntry[]>} */
this.logging = new Map();
/** @type {Map<DepConstructor, ModuleFactory>} */
/** @type {Map<DependencyConstructor, ModuleFactory>} */
this.dependencyFactories = new Map();
/** @type {DependencyTemplates} */
this.dependencyTemplates = new DependencyTemplates(
@@ -1187,7 +1196,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
);
/** @type {Record<string, number>} */
this.childrenCounters = {};
/** @type {Set<number|string> | null} */
/** @type {Set<number> | null} */
this.usedChunkIds = null;
/** @type {Set<number> | null} */
this.usedModuleIds = null;
@@ -1624,7 +1633,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
* @returns {void}
*/
_processModuleDependencies(module, callback) {
/** @type {Array<{factory: ModuleFactory, dependencies: Dependency[], context: string|undefined, originModule: Module|null}>} */
/** @type {{ factory: ModuleFactory, dependencies: Dependency[], context: string | undefined, originModule: Module | null }[]} */
const sortedDependencies = [];
/** @type {DependenciesBlock} */
@@ -1632,7 +1641,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {Map<ModuleFactory, Map<string, Dependency[]>>} */
let dependencies;
/** @type {DepConstructor} */
/** @type {DependencyConstructor} */
let factoryCacheKey;
/** @type {ModuleFactory} */
let factoryCacheKey2;
@@ -1815,7 +1824,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
const resourceIdent = dep.getResourceIdentifier();
if (resourceIdent !== undefined && resourceIdent !== null) {
const category = dep.category;
const constructor = /** @type {DepConstructor} */ (dep.constructor);
const constructor =
/** @type {DependencyConstructor} */
(dep.constructor);
if (factoryCacheKey === constructor) {
// Fast path 1: same constructor as prev item
if (listCacheKey1 === category && listCacheKey2 === resourceIdent) {
@@ -1950,6 +1961,116 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
moduleGraph.setResolvedModule(originModule, dependency, module);
}
/**
* @param {FactorizeModuleOptions} options options
* @param {ModuleOrModuleFactoryResultCallback} callback callback
* @returns {void}
*/
_factorizeModule(
{
currentProfile,
factory,
dependencies,
originModule,
factoryResult,
contextInfo,
context
},
callback
) {
if (currentProfile !== undefined) {
currentProfile.markFactoryStart();
}
factory.create(
{
contextInfo: {
issuer: originModule
? /** @type {NameForCondition} */ (originModule.nameForCondition())
: "",
issuerLayer: originModule ? originModule.layer : null,
compiler: this.compiler.name,
...contextInfo
},
resolveOptions: originModule ? originModule.resolveOptions : undefined,
context:
context ||
(originModule
? /** @type {string} */ (originModule.context)
: this.compiler.context),
dependencies
},
(err, result) => {
if (result) {
// TODO webpack 6: remove
// For backward-compat
if (result.module === undefined && result instanceof Module) {
result = {
module: result
};
}
if (!factoryResult) {
const {
fileDependencies,
contextDependencies,
missingDependencies
} = result;
if (fileDependencies) {
this.fileDependencies.addAll(fileDependencies);
}
if (contextDependencies) {
this.contextDependencies.addAll(contextDependencies);
}
if (missingDependencies) {
this.missingDependencies.addAll(missingDependencies);
}
}
}
if (err) {
const notFoundError = new ModuleNotFoundError(
originModule,
err,
/** @type {DependencyLocation} */
(dependencies.map((d) => d.loc).find(Boolean))
);
return callback(notFoundError, factoryResult ? result : undefined);
}
if (!result) {
return callback();
}
if (currentProfile !== undefined) {
currentProfile.markFactoryEnd();
}
callback(null, factoryResult ? result : result.module);
}
);
}
/**
* @overload
* @param {FactorizeModuleOptions & { factoryResult?: false }} options options
* @param {ModuleCallback} callback callback
* @returns {void}
*/
/**
* @overload
* @param {FactorizeModuleOptions & { factoryResult: true }} options options
* @param {ModuleFactoryResultCallback} callback callback
* @returns {void}
*/
/**
* @param {FactorizeModuleOptions & { factoryResult?: false } | FactorizeModuleOptions & { factoryResult: true }} options options
* @param {ModuleCallback | ModuleFactoryResultCallback} callback callback
*/
factorizeModule(options, callback) {
this.factorizeQueue.add(
options,
/** @type {ModuleOrModuleFactoryResultCallback} */
(callback)
);
}
/**
* @typedef {object} HandleModuleCreationOptions
* @property {ModuleFactory} factory
@@ -2197,92 +2318,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
});
}
/**
* @param {FactorizeModuleOptions} options options object
* @param {ModuleOrFactoryResultCallback} callback callback
* @returns {void}
*/
_factorizeModule(
{
currentProfile,
factory,
dependencies,
originModule,
factoryResult,
contextInfo,
context
},
callback
) {
if (currentProfile !== undefined) {
currentProfile.markFactoryStart();
}
factory.create(
{
contextInfo: {
issuer: originModule
? /** @type {string} */ (originModule.nameForCondition())
: "",
issuerLayer: originModule ? originModule.layer : null,
compiler: /** @type {string} */ (this.compiler.name),
...contextInfo
},
resolveOptions: originModule ? originModule.resolveOptions : undefined,
context:
context ||
(originModule
? /** @type {string} */ (originModule.context)
: /** @type {string} */ (this.compiler.context)),
dependencies
},
(err, result) => {
if (result) {
// TODO webpack 6: remove
// For backward-compat
if (result.module === undefined && result instanceof Module) {
result = {
module: result
};
}
if (!factoryResult) {
const {
fileDependencies,
contextDependencies,
missingDependencies
} = result;
if (fileDependencies) {
this.fileDependencies.addAll(fileDependencies);
}
if (contextDependencies) {
this.contextDependencies.addAll(contextDependencies);
}
if (missingDependencies) {
this.missingDependencies.addAll(missingDependencies);
}
}
}
if (err) {
const notFoundError = new ModuleNotFoundError(
originModule,
err,
/** @type {DependencyLocation} */
(dependencies.map((d) => d.loc).find(Boolean))
);
return callback(notFoundError, factoryResult ? result : undefined);
}
if (!result) {
return callback();
}
if (currentProfile !== undefined) {
currentProfile.markFactoryEnd();
}
callback(null, factoryResult ? result : result.module);
}
);
}
/**
* @param {string} context context string path
* @param {Dependency} dependency dependency used to create Module chain
@@ -2311,7 +2346,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
new WebpackError("Parameter 'dependency' must be a Dependency")
);
}
const Dep = /** @type {DepConstructor} */ (dependency.constructor);
const Dep =
/** @type {DependencyConstructor} */
(dependency.constructor);
const moduleFactory = this.dependencyFactories.get(Dep);
if (!moduleFactory) {
return callback(
@@ -2409,8 +2446,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
);
} else {
entryData[target].push(entry);
for (const _key of Object.keys(options)) {
const key = /** @type {keyof EntryOptions} */ (_key);
for (const key_ of Object.keys(options)) {
const key = /** @type {keyof EntryOptions} */ (key_);
if (options[key] === undefined) continue;
if (entryData.options[key] === options[key]) continue;
if (
@@ -2421,10 +2458,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
continue;
}
if (entryData.options[key] === undefined) {
/** @type {TODO} */
(entryData.options)[key] =
/** @type {NonNullable<EntryOptions[keyof EntryOptions]>} */
(options[key]);
/** @type {EntryOptions[keyof EntryOptions]} */
(entryData.options[key]) = options[key];
} else {
return callback(
new WebpackError(
@@ -2629,8 +2664,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
}
/**
* @param {readonly ModuleGraphConnection[]} connections connections
* @returns {symbol|boolean} result
* @param {Readonly<ModuleGraphConnection[]>} connections connections
* @returns {symbol | boolean} result
*/
const reduceAffectType = (connections) => {
let affected = false;
@@ -2714,9 +2749,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
*/
const computeReferences = (module) => {
const id = /** @type {ModuleId} */ (chunkGraph.getModuleId(module));
/** @type {Map<Module, string | number | undefined> | undefined} */
/** @type {Map<Module, ModuleId> | undefined} */
let modules;
/** @type {(string | number | null)[] | undefined} */
/** @type {(ChunkId | null)[] | undefined} */
let blocks;
const outgoing = moduleGraph.getOutgoingConnectionsByModule(module);
if (outgoing !== undefined) {
@@ -3097,15 +3132,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
this.addModuleQueue.clear();
return callback(err);
};
const chunkGraph = new ChunkGraph(
this.moduleGraph,
this.outputOptions.hashFunction
);
this.chunkGraph = chunkGraph;
if (this._backCompat) {
for (const module of this.modules) {
ChunkGraph.setChunkGraphForModule(module, chunkGraph);
ChunkGraph.setChunkGraphForModule(module, this.chunkGraph);
}
}
@@ -3150,7 +3180,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
const module = this.moduleGraph.getModule(dep);
if (module) {
chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
this.chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
entryModules.add(module);
const modulesList = chunkGraphInit.get(entrypoint);
if (modulesList === undefined) {
@@ -3549,7 +3579,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
let statModulesGenerated = 0;
const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } =
this;
const results = this.codeGenerationResults;
const results =
/** @type {CodeGenerationResults} */
(this.codeGenerationResults);
/** @type {WebpackError[]} */
const errors = [];
/** @type {NotCodeGeneratedModules | undefined} */
@@ -3560,8 +3592,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
let delayedModules = new Set();
asyncLib.eachLimit(
jobs,
/** @type {number} */
(this.options.parallelism),
this.options.parallelism,
(job, callback) => {
const { module } = job;
const { codeGenerationDependencies } = module;
@@ -3745,7 +3776,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
chunkGraph = this.chunkGraph,
modules = this.modules,
chunks = this.chunks,
codeGenerationResults = this.codeGenerationResults,
codeGenerationResults = /** @type {CodeGenerationResults} */ (
this.codeGenerationResults
),
chunkGraphEntries = this._getChunkGraphEntries()
} = {}) {
const context = { chunkGraph, codeGenerationResults };
@@ -3825,6 +3858,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.logger.time("runtime requirements.chunks");
for (const chunk of chunks) {
/** @type {RuntimeRequirements} */
const set = new Set();
for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements(
@@ -3845,6 +3879,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
this.logger.time("runtime requirements.entries");
for (const treeEntry of chunkGraphEntries) {
/** @type {RuntimeRequirements} */
const set = new Set();
for (const chunk of treeEntry.getAllReferencedChunks()) {
const runtimeRequirements =
@@ -3984,12 +4019,10 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
if (name) {
const entrypoint = this.namedChunkGroups.get(name);
if (entrypoint instanceof Entrypoint) {
if (entrypoint !== undefined) {
if (module) {
entrypoint.addOrigin(module, loc, request);
}
return entrypoint;
if (module) {
entrypoint.addOrigin(module, loc, request);
}
return entrypoint;
} else if (entrypoint) {
throw new Error(
`Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name`
@@ -4112,7 +4145,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
/**
* @param {Dependency} dependency the dependency
* @param {RuntimeSpec} runtime the runtime
* @returns {(string[] | ReferencedExport)[]} referenced exports
* @returns {ReferencedExports} referenced exports
*/
getDependencyReferencedExports(dependency, runtime) {
const referencedExports = dependency.getReferencedExports(
@@ -4320,10 +4353,10 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
* @param {Module} module module
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {RuntimeSpec} runtime runtime
* @param {OutputOptions["hashFunction"]} hashFunction hash function
* @param {HashFunction} hashFunction hash function
* @param {RuntimeTemplate} runtimeTemplate runtime template
* @param {OutputOptions["hashDigest"]} hashDigest hash digest
* @param {OutputOptions["hashDigestLength"]} hashDigestLength hash digest length
* @param {HashDigest} hashDigest hash digest
* @param {HashDigestLength} hashDigestLength hash digest length
* @param {WebpackError[]} errors errors
* @returns {string} module hash digest
*/
@@ -4339,13 +4372,13 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
) {
let moduleHashDigest;
try {
const moduleHash = createHash(/** @type {HashFunction} */ (hashFunction));
const moduleHash = createHash(hashFunction);
module.updateHash(moduleHash, {
chunkGraph,
runtime,
runtimeTemplate
});
moduleHashDigest = /** @type {string} */ (moduleHash.digest(hashDigest));
moduleHashDigest = moduleHash.digest(hashDigest);
} catch (err) {
errors.push(new ModuleHashingError(module, /** @type {Error} */ (err)));
moduleHashDigest = "XXXXXX";
@@ -4367,7 +4400,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
const hashFunction = outputOptions.hashFunction;
const hashDigest = outputOptions.hashDigest;
const hashDigestLength = outputOptions.hashDigestLength;
const hash = createHash(/** @type {HashFunction} */ (hashFunction));
const hash = createHash(hashFunction);
if (outputOptions.hashSalt) {
hash.update(outputOptions.hashSalt);
}
@@ -4555,22 +4588,20 @@ This prevents using hashes of each other and should be avoided.`);
this.logger.timeAggregate("hashing: hash runtime modules");
try {
this.logger.time("hashing: hash chunks");
const chunkHash = createHash(
/** @type {HashFunction} */ (hashFunction)
);
const chunkHash = createHash(hashFunction);
if (outputOptions.hashSalt) {
chunkHash.update(outputOptions.hashSalt);
}
chunk.updateHash(chunkHash, chunkGraph);
this.hooks.chunkHash.call(chunk, chunkHash, {
chunkGraph,
codeGenerationResults: this.codeGenerationResults,
codeGenerationResults:
/** @type {CodeGenerationResults} */
(this.codeGenerationResults),
moduleGraph: this.moduleGraph,
runtimeTemplate: this.runtimeTemplate
});
const chunkHashDigest = /** @type {string} */ (
chunkHash.digest(hashDigest)
);
const chunkHashDigest = chunkHash.digest(hashDigest);
hash.update(chunkHashDigest);
chunk.hash = chunkHashDigest;
chunk.renderedHash = chunk.hash.slice(0, hashDigestLength);
@@ -4604,7 +4635,7 @@ This prevents using hashes of each other and should be avoided.`);
this.logger.timeAggregateEnd("hashing: hash chunks");
this.logger.time("hashing: hash digest");
this.hooks.fullHash.call(hash);
this.fullHash = /** @type {string} */ (hash.digest(hashDigest));
this.fullHash = hash.digest(hashDigest);
this.hash = this.fullHash.slice(0, hashDigestLength);
this.logger.timeEnd("hashing: hash digest");
@@ -4613,17 +4644,13 @@ This prevents using hashes of each other and should be avoided.`);
for (const module of /** @type {Iterable<RuntimeModule>} */ (
chunkGraph.getChunkFullHashModulesIterable(chunk)
)) {
const moduleHash = createHash(
/** @type {HashFunction} */ (hashFunction)
);
const moduleHash = createHash(hashFunction);
module.updateHash(moduleHash, {
chunkGraph,
runtime: chunk.runtime,
runtimeTemplate
});
const moduleHashDigest = /** @type {string} */ (
moduleHash.digest(hashDigest)
);
const moduleHashDigest = moduleHash.digest(hashDigest);
const oldHash = chunkGraph.getModuleHash(module, chunk.runtime);
chunkGraph.setModuleHashes(
module,
@@ -4637,12 +4664,10 @@ This prevents using hashes of each other and should be avoided.`);
(codeGenerationJobsMap.get(oldHash)).get(module)
).hash = moduleHashDigest;
}
const chunkHash = createHash(/** @type {HashFunction} */ (hashFunction));
const chunkHash = createHash(hashFunction);
chunkHash.update(chunk.hash);
chunkHash.update(this.hash);
const chunkHashDigest =
/** @type {string} */
(chunkHash.digest(hashDigest));
const chunkHashDigest = chunkHash.digest(hashDigest);
chunk.hash = chunkHashDigest;
chunk.renderedHash = chunk.hash.slice(0, hashDigestLength);
this.hooks.contentHash.call(chunk);
@@ -4980,7 +5005,9 @@ This prevents using hashes of each other and should be avoided.`);
hash: /** @type {string} */ (this.hash),
fullHash: /** @type {string} */ (this.fullHash),
outputOptions,
codeGenerationResults: this.codeGenerationResults,
codeGenerationResults:
/** @type {CodeGenerationResults} */
(this.codeGenerationResults),
moduleTemplates: this.moduleTemplates,
dependencyTemplates: this.dependencyTemplates,
chunkGraph: this.chunkGraph,
@@ -5193,7 +5220,7 @@ This prevents using hashes of each other and should be avoided.`);
* from parent (or top level compiler) and creates a child Compilation
* @param {string} name name of the child compiler
* @param {Partial<OutputOptions>=} outputOptions // Need to convert config schema to types for this
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>=} plugins webpack plugins that will be applied
* @param {Plugins=} plugins webpack plugins that will be applied
* @returns {Compiler} creates a child Compiler instance
*/
createChildCompiler(name, outputOptions, plugins) {
@@ -5408,7 +5435,6 @@ This prevents using hashes of each other and should be avoided.`);
const moduleArgument = {
module,
codeGenerationResult,
preparedInfo: undefined,
moduleObject: undefined
};
moduleArgumentsMap.set(module, moduleArgument);
@@ -5584,7 +5610,7 @@ This prevents using hashes of each other and should be avoided.`);
checkConstraints() {
const chunkGraph = this.chunkGraph;
/** @type {Set<number|string>} */
/** @type {Set<ModuleId>} */
const usedIds = new Set();
for (const module of this.modules) {
@@ -5639,19 +5665,6 @@ This prevents using hashes of each other and should be avoided.`);
* @returns {void}
*/
// Workaround for typescript as it doesn't support function overloading in jsdoc within a class
/* eslint-disable jsdoc/require-asterisk-prefix */
Compilation.prototype.factorizeModule = /**
@type {{
(options: FactorizeModuleOptions & { factoryResult?: false }, callback: ModuleCallback): void;
(options: FactorizeModuleOptions & { factoryResult: true }, callback: ModuleFactoryResultCallback): void;
}} */ (
function factorizeModule(options, callback) {
this.factorizeQueue.add(options, /** @type {TODO} */ (callback));
}
);
/* eslint-enable jsdoc/require-asterisk-prefix */
// Hide from typescript
const compilationPrototype = Compilation.prototype;