| | |
| | | /** @typedef {import("./logging/Logger").Logger} Logger */ |
| | | /** @typedef {import("./util/fs").TimeInfoEntries} TimeInfoEntries */ |
| | | /** @typedef {import("./util/fs").WatchFileSystem} WatchFileSystem */ |
| | | /** @typedef {import("./util/fs").Watcher} Watcher */ |
| | | |
| | | /** |
| | | * Defines the callback type used by this module. |
| | | * @template T |
| | | * @template [R=void] |
| | | * @typedef {import("./webpack").Callback<T, R>} Callback |
| | |
| | | |
| | | class Watching { |
| | | /** |
| | | * Creates an instance of Watching. |
| | | * @param {Compiler} compiler the compiler |
| | | * @param {WatchOptions} watchOptions options |
| | | * @param {Callback<Stats>} handler completion handler |
| | | */ |
| | | constructor(compiler, watchOptions, handler) { |
| | | /** @type {null | number} */ |
| | | this.startTime = null; |
| | | this.invalid = false; |
| | | /** @type {Callback<Stats>} */ |
| | | this.handler = handler; |
| | | /** @type {ErrorCallback[]} */ |
| | | this.callbacks = []; |
| | |
| | | this._initial = true; |
| | | this._invalidReported = true; |
| | | this._needRecords = true; |
| | | /** @type {undefined | null | Watcher} */ |
| | | this.watcher = undefined; |
| | | /** @type {undefined | null | Watcher} */ |
| | | this.pausedWatcher = undefined; |
| | | /** @type {CollectedFiles | undefined} */ |
| | | this._collectedChangedFiles = undefined; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Merge with collected. |
| | | * @param {ReadonlySet<string> | undefined | null} changedFiles changed files |
| | | * @param {ReadonlySet<string> | undefined | null} removedFiles removed files |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided file time info entries. |
| | | * @param {TimeInfoEntries=} fileTimeInfoEntries info for files |
| | | * @param {TimeInfoEntries=} contextTimeInfoEntries info for directories |
| | | * @param {ReadonlySet<string>=} changedFiles changed files |
| | |
| | | this.compiler.hooks.watchRun.callAsync(this.compiler, (err) => { |
| | | if (err) return this._done(err); |
| | | /** |
| | | * Processes the provided err. |
| | | * @param {Error | null} err error |
| | | * @param {Compilation=} _compilation compilation |
| | | * @returns {void} |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the compilation stats. |
| | | * @param {Compilation} compilation the compilation |
| | | * @returns {Stats} the compilation stats |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided err. |
| | | * @param {(Error | null)=} err an optional error |
| | | * @param {Compilation=} compilation the compilation |
| | | * @returns {void} |
| | |
| | | let stats; |
| | | |
| | | /** |
| | | * Processes the provided err. |
| | | * @param {Error} err error |
| | | * @param {ErrorCallback[]=} cbs callbacks |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided file. |
| | | * @param {Iterable<string>} files watched files |
| | | * @param {Iterable<string>} dirs watched directories |
| | | * @param {Iterable<string>} missing watched existence entries |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided error callback. |
| | | * @param {ErrorCallback=} callback signals when the build has completed again |
| | | * @returns {void} |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided file time info entries. |
| | | * @param {TimeInfoEntries=} fileTimeInfoEntries info for files |
| | | * @param {TimeInfoEntries=} contextTimeInfoEntries info for directories |
| | | * @param {ReadonlySet<string>=} changedFiles changed files |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided error callback. |
| | | * @param {ErrorCallback} callback signals when the watcher is closed |
| | | * @returns {void} |
| | | */ |
| | |
| | | return; |
| | | } |
| | | /** |
| | | * Processes the provided err. |
| | | * @param {WebpackError | null} err error if any |
| | | * @param {Compilation=} compilation compilation if any |
| | | */ |
| | |
| | | this.compiler.contextTimestamps = undefined; |
| | | this.compiler.fsStartTime = undefined; |
| | | /** |
| | | * Processes the provided err. |
| | | * @param {WebpackError | null} err error if any |
| | | */ |
| | | const shutdown = (err) => { |