Merge pull request #12061 from webpack/deps/typescript

upgrade typescript major version
This commit is contained in:
Tobias Koppers 2020-11-30 11:02:43 +01:00 committed by GitHub
commit 165fa87a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 508 additions and 955 deletions

View File

@ -76,14 +76,17 @@ class WebpackOptionsApply extends OptionsApply {
new NodeTargetPlugin().apply(compiler); new NodeTargetPlugin().apply(compiler);
} }
if (options.externalsPresets.electronMain) { if (options.externalsPresets.electronMain) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("main").apply(compiler); new ElectronTargetPlugin("main").apply(compiler);
} }
if (options.externalsPresets.electronPreload) { if (options.externalsPresets.electronPreload) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("preload").apply(compiler); new ElectronTargetPlugin("preload").apply(compiler);
} }
if (options.externalsPresets.electronRenderer) { if (options.externalsPresets.electronRenderer) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin("renderer").apply(compiler); new ElectronTargetPlugin("renderer").apply(compiler);
} }
@ -93,17 +96,21 @@ class WebpackOptionsApply extends OptionsApply {
!options.externalsPresets.electronPreload && !options.externalsPresets.electronPreload &&
!options.externalsPresets.electronRenderer !options.externalsPresets.electronRenderer
) { ) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin"); const ElectronTargetPlugin = require("./electron/ElectronTargetPlugin");
new ElectronTargetPlugin().apply(compiler); new ElectronTargetPlugin().apply(compiler);
} }
if (options.externalsPresets.nwjs) { if (options.externalsPresets.nwjs) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin"); const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("commonjs", "nw.gui").apply(compiler); new ExternalsPlugin("commonjs", "nw.gui").apply(compiler);
} }
if (options.externalsPresets.webAsync) { if (options.externalsPresets.webAsync) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin"); const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("import", /^(https?:\/\/|std:)/).apply(compiler); new ExternalsPlugin("import", /^(https?:\/\/|std:)/).apply(compiler);
} else if (options.externalsPresets.web) { } else if (options.externalsPresets.web) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin"); const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin("module", /^(https?:\/\/|std:)/).apply(compiler); new ExternalsPlugin("module", /^(https?:\/\/|std:)/).apply(compiler);
} }
@ -155,6 +162,7 @@ class WebpackOptionsApply extends OptionsApply {
} }
if (options.externals) { if (options.externals) {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const ExternalsPlugin = require("./ExternalsPlugin"); const ExternalsPlugin = require("./ExternalsPlugin");
new ExternalsPlugin(options.externalsType, options.externals).apply( new ExternalsPlugin(options.externalsType, options.externals).apply(
compiler compiler
@ -420,6 +428,7 @@ class WebpackOptionsApply extends OptionsApply {
break; break;
} }
case "size": { case "size": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin"); const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin");
new OccurrenceChunkIdsPlugin({ new OccurrenceChunkIdsPlugin({
prioritiseInitial: true prioritiseInitial: true
@ -427,6 +436,7 @@ class WebpackOptionsApply extends OptionsApply {
break; break;
} }
case "total-size": { case "total-size": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin"); const OccurrenceChunkIdsPlugin = require("./ids/OccurrenceChunkIdsPlugin");
new OccurrenceChunkIdsPlugin({ new OccurrenceChunkIdsPlugin({
prioritiseInitial: false prioritiseInitial: false
@ -478,6 +488,7 @@ class WebpackOptionsApply extends OptionsApply {
const cacheOptions = options.cache; const cacheOptions = options.cache;
switch (cacheOptions.type) { switch (cacheOptions.type) {
case "memory": { case "memory": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const MemoryCachePlugin = require("./cache/MemoryCachePlugin"); const MemoryCachePlugin = require("./cache/MemoryCachePlugin");
new MemoryCachePlugin().apply(compiler); new MemoryCachePlugin().apply(compiler);
break; break;
@ -488,6 +499,7 @@ class WebpackOptionsApply extends OptionsApply {
const list = cacheOptions.buildDependencies[key]; const list = cacheOptions.buildDependencies[key];
new AddBuildDependenciesPlugin(list).apply(compiler); new AddBuildDependenciesPlugin(list).apply(compiler);
} }
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const MemoryCachePlugin = require("./cache/MemoryCachePlugin"); const MemoryCachePlugin = require("./cache/MemoryCachePlugin");
new MemoryCachePlugin().apply(compiler); new MemoryCachePlugin().apply(compiler);
switch (cacheOptions.store) { switch (cacheOptions.store) {

View File

@ -13,7 +13,6 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
/** @typedef {import("../ChunkGraph")} ChunkGraph */ /** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */ /** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */ /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
/** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */ /** @typedef {import("../Dependency").UpdateHashContext} UpdateHashContext */

View File

@ -81,6 +81,7 @@ class EnableChunkLoadingPlugin {
break; break;
} }
case "require": { case "require": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin"); const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin");
new CommonJsChunkLoadingPlugin({ new CommonJsChunkLoadingPlugin({
asyncChunkLoading: false asyncChunkLoading: false
@ -88,6 +89,7 @@ class EnableChunkLoadingPlugin {
break; break;
} }
case "async-node": { case "async-node": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin"); const CommonJsChunkLoadingPlugin = require("../node/CommonJsChunkLoadingPlugin");
new CommonJsChunkLoadingPlugin({ new CommonJsChunkLoadingPlugin({
asyncChunkLoading: true asyncChunkLoading: true

View File

@ -76,6 +76,7 @@ class EnableLibraryPlugin {
}).apply(compiler); }).apply(compiler);
switch (type) { switch (type) {
case "var": { case "var": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -86,6 +87,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "assign": { case "assign": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -96,6 +98,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "this": { case "this": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -106,6 +109,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "window": { case "window": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -116,6 +120,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "self": { case "self": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -126,6 +131,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "global": { case "global": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -136,6 +142,7 @@ class EnableLibraryPlugin {
break; break;
} }
case "commonjs": { case "commonjs": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,
@ -147,6 +154,7 @@ class EnableLibraryPlugin {
} }
case "commonjs2": case "commonjs2":
case "commonjs-module": { case "commonjs-module": {
//@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697
const AssignLibraryPlugin = require("./AssignLibraryPlugin"); const AssignLibraryPlugin = require("./AssignLibraryPlugin");
new AssignLibraryPlugin({ new AssignLibraryPlugin({
type, type,

View File

@ -308,10 +308,11 @@ register(
register( register(
ValidationError, ValidationError,
CURRENT_MODULE, CURRENT_MODULE,
"schema-util/ValidationError", "schema-utils/ValidationError",
new (class ValidationErrorSerializer { new (class ValidationErrorSerializer {
// TODO error should be ValidationError, but this fails the type checks
/** /**
* @param {ValidationError} error the source map source to be serialized * @param {TODO} error the source map source to be serialized
* @param {WebpackObjectSerializerContext} context context * @param {WebpackObjectSerializerContext} context context
* @returns {void} * @returns {void}
*/ */
@ -327,7 +328,7 @@ register(
/** /**
* @param {ObjectDeserializerContext} context context * @param {ObjectDeserializerContext} context context
* @returns {ValidationError} error * @returns {TODO} error
*/ */
deserialize({ read }) { deserialize({ read }) {
return new ValidationError(read(), read(), read()); return new ValidationError(read(), read(), read());

View File

@ -94,7 +94,7 @@
"toml": "^3.0.0", "toml": "^3.0.0",
"tooling": "webpack/tooling#v1.10.0", "tooling": "webpack/tooling#v1.10.0",
"ts-loader": "^8.0.2", "ts-loader": "^8.0.2",
"typescript": "^3.9.7", "typescript": "^4.2.0-dev.20201130",
"url-loader": "^4.1.0", "url-loader": "^4.1.0",
"wast-loader": "^1.9.0", "wast-loader": "^1.9.0",
"webassembly-feature": "1.3.0", "webassembly-feature": "1.3.0",

View File

@ -1,4 +1,8 @@
const { HttpUriPlugin } = require("../../../../").experiments.schemes; const {
experiments: {
schemes: { HttpUriPlugin }
}
} = require("../../../../");
const ServerPlugin = require("./server"); const ServerPlugin = require("./server");
/** @type {import("../../../../").Configuration} */ /** @type {import("../../../../").Configuration} */

View File

@ -1,4 +1,8 @@
const { HttpsUriPlugin } = require("../../../../").experiments.schemes; const {
experiments: {
schemes: { HttpsUriPlugin }
}
} = require("../../../../");
/** @type {import("../../../../").Configuration} */ /** @type {import("../../../../").Configuration} */
module.exports = { module.exports = {

1411
types.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@ -6472,10 +6472,10 @@ typedarray-to-buffer@^3.1.5:
dependencies: dependencies:
is-typedarray "^1.0.0" is-typedarray "^1.0.0"
typescript@^3.9.7: typescript@^4.2.0-dev.20201130:
version "3.9.7" version "4.2.0-dev.20201130"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.0-dev.20201130.tgz#13339af4dfd23070dcd16f28e590efe541c766c4"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== integrity sha512-oMboCGPKWDJ8BFmmanPAWw3LUGlEXSkkF+MbuHu97i1iF7K4z4zjmnodoD3Dilqs2IMuVDmWBIkmget9xMrpTw==
uglify-js@^3.1.4: uglify-js@^3.1.4:
version "3.10.1" version "3.10.1"