Skip to content

Commit

Permalink
Merge pull request #16957 from webpack/chore-update-typescript
Browse files Browse the repository at this point in the history
chore(deps): update typescript to v5
  • Loading branch information
TheLarkInn committed Apr 22, 2023
2 parents 19a123d + 94b5945 commit 9c70c6c
Show file tree
Hide file tree
Showing 81 changed files with 618 additions and 21 deletions.
8 changes: 8 additions & 0 deletions lib/AsyncDependenciesBlock.js
Expand Up @@ -15,6 +15,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */

class AsyncDependenciesBlock extends DependenciesBlock {
Expand Down Expand Up @@ -71,6 +73,9 @@ class AsyncDependenciesBlock extends DependenciesBlock {
super.updateHash(hash, context);
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.groupOptions);
Expand All @@ -79,6 +84,9 @@ class AsyncDependenciesBlock extends DependenciesBlock {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.groupOptions = read();
Expand Down
8 changes: 8 additions & 0 deletions lib/ContextModule.js
Expand Up @@ -43,6 +43,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @template T @typedef {import("./util/LazySet")<T>} LazySet<T> */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */

Expand Down Expand Up @@ -1151,13 +1153,19 @@ module.exports = webpackEmptyAsyncContext;`;
return size;
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this._identifier);
write(this._forceBuild);
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this._identifier = read();
Expand Down
5 changes: 5 additions & 0 deletions lib/DelegatedModule.js
Expand Up @@ -30,6 +30,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./dependencies/ModuleDependency")} ModuleDependency */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */

Expand Down Expand Up @@ -186,6 +188,9 @@ class DelegatedModule extends Module {
super.updateHash(hash, context);
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
// constructor
Expand Down
8 changes: 8 additions & 0 deletions lib/DependenciesBlock.js
Expand Up @@ -12,6 +12,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./ChunkGroup")} ChunkGroup */
/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */

/** @typedef {(d: Dependency) => boolean} DependencyFilterFunction */
Expand Down Expand Up @@ -88,11 +90,17 @@ class DependenciesBlock {
}
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.dependencies);
write(this.blocks);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this.dependencies = read();
this.blocks = read();
Expand Down
8 changes: 8 additions & 0 deletions lib/Dependency.js
Expand Up @@ -17,6 +17,8 @@ const memoize = require("./util/memoize");
/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */

Expand Down Expand Up @@ -292,6 +294,9 @@ class Dependency {
return getIgnoredModule();
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this.weak);
write(this.optional);
Expand All @@ -303,6 +308,9 @@ class Dependency {
write(this._locN);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this.weak = read();
this.optional = read();
Expand Down
8 changes: 8 additions & 0 deletions lib/DllModule.js
Expand Up @@ -25,6 +25,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */

Expand Down Expand Up @@ -122,11 +124,17 @@ class DllModule extends Module {
super.updateHash(hash, context);
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
context.write(this.name);
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
this.name = context.read();
super.deserialize(context);
Expand Down
3 changes: 3 additions & 0 deletions lib/ExportsInfo.js
Expand Up @@ -752,6 +752,9 @@ class ExportsInfo {
);
}

/**
* @param {{ otherProvided: any, otherCanMangleProvide: any, otherTerminalBinding: any, exports: any }} data data
*/
restoreProvided({
otherProvided,
otherCanMangleProvide,
Expand Down
8 changes: 8 additions & 0 deletions lib/ExternalModule.js
Expand Up @@ -39,6 +39,8 @@ const { register } = require("./util/serialization");
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {typeof import("./util/Hash")} HashConstructor */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
Expand Down Expand Up @@ -733,6 +735,9 @@ class ExternalModule extends Module {
super.updateHash(hash, context);
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;

Expand All @@ -743,6 +748,9 @@ class ExternalModule extends Module {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;

Expand Down
8 changes: 8 additions & 0 deletions lib/FileSystemInfo.js
Expand Up @@ -18,6 +18,8 @@ const processAsyncTree = require("./util/processAsyncTree");

/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./logging/Logger").Logger} Logger */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {typeof import("./util/Hash")} Hash */
/** @typedef {import("./util/fs").IStats} IStats */
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
Expand Down Expand Up @@ -378,6 +380,9 @@ class Snapshot {
this.children.add(child);
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize({ write }) {
write(this._flags);
if (this.hasStartTime()) write(this.startTime);
Expand All @@ -395,6 +400,9 @@ class Snapshot {
if (this.hasChildren()) write(this.children);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize({ read }) {
this._flags = read();
if (this.hasStartTime()) this.startTime = read();
Expand Down
8 changes: 8 additions & 0 deletions lib/Module.js
Expand Up @@ -33,6 +33,8 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
/** @template T @typedef {import("./util/LazySet")<T>} LazySet<T> */
/** @template T @typedef {import("./util/SortableSet")<T>} SortableSet<T> */
Expand Down Expand Up @@ -976,6 +978,9 @@ class Module extends DependenciesBlock {
buildDependencies
) {}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;
write(this.type);
Expand All @@ -1002,6 +1007,9 @@ class Module extends DependenciesBlock {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;
this.type = read();
Expand Down
9 changes: 9 additions & 0 deletions lib/ModuleBuildError.js
Expand Up @@ -9,6 +9,9 @@ const { cutOffLoaderExecution } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");

/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

class ModuleBuildError extends WebpackError {
/**
* @param {string | Error&any} err error thrown
Expand Down Expand Up @@ -55,6 +58,9 @@ class ModuleBuildError extends WebpackError {
this.error = err;
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;

Expand All @@ -63,6 +69,9 @@ class ModuleBuildError extends WebpackError {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;

Expand Down
9 changes: 9 additions & 0 deletions lib/ModuleError.js
Expand Up @@ -9,6 +9,9 @@ const { cleanUp } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");

/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

class ModuleError extends WebpackError {
/**
* @param {Error} err error thrown
Expand Down Expand Up @@ -39,6 +42,9 @@ class ModuleError extends WebpackError {
: undefined;
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;

Expand All @@ -47,6 +53,9 @@ class ModuleError extends WebpackError {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;

Expand Down
9 changes: 9 additions & 0 deletions lib/ModuleParseError.js
Expand Up @@ -8,6 +8,9 @@
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");

/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

const WASM_HEADER = Buffer.from([0x00, 0x61, 0x73, 0x6d]);

class ModuleParseError extends WebpackError {
Expand Down Expand Up @@ -87,6 +90,9 @@ class ModuleParseError extends WebpackError {
this.error = err;
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;

Expand All @@ -95,6 +101,9 @@ class ModuleParseError extends WebpackError {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;

Expand Down
9 changes: 9 additions & 0 deletions lib/ModuleWarning.js
Expand Up @@ -9,6 +9,9 @@ const { cleanUp } = require("./ErrorHelpers");
const WebpackError = require("./WebpackError");
const makeSerializable = require("./util/makeSerializable");

/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */

class ModuleWarning extends WebpackError {
/**
* @param {Error} warning error thrown
Expand Down Expand Up @@ -39,6 +42,9 @@ class ModuleWarning extends WebpackError {
: undefined;
}

/**
* @param {ObjectSerializerContext} context context
*/
serialize(context) {
const { write } = context;

Expand All @@ -47,6 +53,9 @@ class ModuleWarning extends WebpackError {
super.serialize(context);
}

/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context) {
const { read } = context;

Expand Down

0 comments on commit 9c70c6c

Please sign in to comment.