feat: refactoring project
This commit is contained in:
14
node_modules/webpack/lib/CodeGenerationResults.js
generated
vendored
14
node_modules/webpack/lib/CodeGenerationResults.js
generated
vendored
@@ -13,6 +13,7 @@ const { runtimeToString, RuntimeSpecMap } = require("./util/runtime");
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("./Module")} Module */
|
||||
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
|
||||
/** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
||||
/** @typedef {typeof import("./util/Hash")} Hash */
|
||||
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
|
||||
@@ -53,9 +54,9 @@ class CodeGenerationResults {
|
||||
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
|
||||
);
|
||||
}
|
||||
return first(results);
|
||||
return /** @type {CodeGenerationResult} */ (first(results));
|
||||
}
|
||||
return entry.values().next().value;
|
||||
return /** @type {CodeGenerationResult} */ (entry.values().next().value);
|
||||
}
|
||||
const result = entry.get(runtime);
|
||||
if (result === undefined) {
|
||||
@@ -86,9 +87,8 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||
} else if (entry.size > 1) {
|
||||
const results = new Set(entry.values());
|
||||
return results.size === 1;
|
||||
} else {
|
||||
return entry.size === 1;
|
||||
}
|
||||
return entry.size === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,13 +98,15 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
|
||||
* @returns {Source} a source
|
||||
*/
|
||||
getSource(module, runtime, sourceType) {
|
||||
return this.get(module, runtime).sources.get(sourceType);
|
||||
return /** @type {Source} */ (
|
||||
this.get(module, runtime).sources.get(sourceType)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Module} module the module
|
||||
* @param {RuntimeSpec} runtime runtime(s)
|
||||
* @returns {ReadonlySet<string>} runtime requirements
|
||||
* @returns {ReadOnlyRuntimeRequirements | null} runtime requirements
|
||||
*/
|
||||
getRuntimeRequirements(module, runtime) {
|
||||
return this.get(module, runtime).runtimeRequirements;
|
||||
|
||||
Reference in New Issue
Block a user