mirror of https://github.com/webpack/webpack.git
add types to Module
This commit is contained in:
parent
2adf5c2b0d
commit
8de3b9bd22
|
|
@ -11,6 +11,10 @@ const ModuleReason = require("./ModuleReason");
|
|||
const SortableSet = require("./util/SortableSet");
|
||||
const Template = require("./Template");
|
||||
|
||||
/** @typedef {typeof import("./Chunk")} Chunk */
|
||||
|
||||
/** @typedef {typeof import("./RequestShortener")} RequestShortener */
|
||||
|
||||
const EMPTY_RESOLVE_OPTIONS = {};
|
||||
|
||||
let debugId = 1000;
|
||||
|
|
@ -23,51 +27,79 @@ const sortByDebugId = (a, b) => {
|
|||
return a.debugId - b.debugId;
|
||||
};
|
||||
|
||||
/** @typedef {(requestShortener: RequestShortener) => string} OptimizationBailoutFunction */
|
||||
|
||||
class Module extends DependenciesBlock {
|
||||
constructor(type, context = null) {
|
||||
super();
|
||||
/** @type {string} */
|
||||
this.type = type;
|
||||
/** @type {string} */
|
||||
this.context = context;
|
||||
|
||||
// Unique Id
|
||||
/** @type {number} */
|
||||
this.debugId = debugId++;
|
||||
|
||||
// Hash
|
||||
/** @type {string} */
|
||||
this.hash = undefined;
|
||||
/** @type {string} */
|
||||
this.renderedHash = undefined;
|
||||
|
||||
// Info from Factory
|
||||
/** @type {object} */
|
||||
this.resolveOptions = EMPTY_RESOLVE_OPTIONS;
|
||||
/** @type {object} */
|
||||
this.factoryMeta = {};
|
||||
|
||||
// Info from Build
|
||||
/** @type {Error[]} */
|
||||
this.warnings = [];
|
||||
/** @type {Error[]} */
|
||||
this.errors = [];
|
||||
/** @type {object} */
|
||||
this.buildMeta = undefined;
|
||||
/** @type {object} */
|
||||
this.buildInfo = undefined;
|
||||
|
||||
// Graph (per Compilation)
|
||||
/** @type {ModuleReason[]} */
|
||||
this.reasons = [];
|
||||
/** @type {SortableSet} */
|
||||
this._chunks = new SortableSet(undefined, sortById);
|
||||
|
||||
// Info from Compilation (per Compilation)
|
||||
/** @type {number | string} */
|
||||
this.id = null;
|
||||
/** @type {number} */
|
||||
this.index = null;
|
||||
/** @type {number} */
|
||||
this.index2 = null;
|
||||
/** @type {number} */
|
||||
this.depth = null;
|
||||
/** @type {Module} */
|
||||
this.issuer = null;
|
||||
/** @type {undefined | object} */
|
||||
this.profile = undefined;
|
||||
/** @type {boolean} */
|
||||
this.prefetched = false;
|
||||
/** @type {boolean} */
|
||||
this.built = false;
|
||||
|
||||
// Info from Optimization (per Compilation)
|
||||
/** @type {null | boolean} */
|
||||
this.used = null;
|
||||
/** @type {false | true | string[]} */
|
||||
this.usedExports = null;
|
||||
/** @type {(string | OptimizationBailoutFunction)[]} */
|
||||
this.optimizationBailout = [];
|
||||
|
||||
// delayed operations
|
||||
/** @type {undefined | {oldChunk: Chunk, newChunks: Chunk[]}[] } */
|
||||
this._rewriteChunkInReasons = undefined;
|
||||
|
||||
/** @type {boolean} */
|
||||
this.useSourceMap = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue