From 80370ed85c61c83c910aa1cfd1c356ce15159f90 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Wed, 20 Apr 2022 07:05:37 +0100 Subject: [PATCH 1/3] compile against 4.6.3 --- package.json | 2 +- src/instances.ts | 1 + src/interfaces.ts | 3 ++- yarn.lock | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4b00904bf..a1e2866a6 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "mocha": "^6.0.0", "prettier": "^2.0.5", "rimraf": "^2.6.2", - "typescript": "^4.0.0", + "typescript": "^4.6.3", "webpack": "^4.5.0", "webpack-cli": "^3.1.1" }, diff --git a/src/instances.ts b/src/instances.ts index aaa36b792..b92e2f9ca 100644 --- a/src/instances.ts +++ b/src/instances.ts @@ -378,6 +378,7 @@ export function initializeInstance( } else if (typeof customerTransformers === 'string') { try { customerTransformers = require(customerTransformers); + // eslint-disable-next-line prettier/prettier } catch (err) { throw new Error( `Failed to load customTransformers from "${instance.loaderOptions.getCustomTransformers}": ${err.message}` diff --git a/src/interfaces.ts b/src/interfaces.ts index 6fec20479..6d9cc06d7 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -198,6 +198,7 @@ interface PerModuleNameCache { result: typescript.ResolvedModuleWithFailedLookupLocations ): void; } + export interface ModuleResolutionCache extends typescript.ModuleResolutionCache { directoryToModuleNameMap: CacheWithRedirects< @@ -206,8 +207,8 @@ export interface ModuleResolutionCache moduleNameToDirectoryMap: CacheWithRedirects; clear(): void; update(compilerOptions: typescript.CompilerOptions): void; - getPackageJsonInfoCache?(): any; } + // Until the API has been released and ts-loader is built against a version of TypeScript that contains it - see https://github.com/microsoft/TypeScript/blob/74993a2a64bb2e423b40204bb54ff749cdd4ef54/src/compiler/moduleNameResolver.ts#L458 export interface TypeReferenceDirectiveResolutionCache { getOrCreateCacheForDirectory( diff --git a/yarn.lock b/yarn.lock index ea6e337a9..f078dd007 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6267,10 +6267,10 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9" - integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ== +typescript@^4.6.3: + version "4.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c" + integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== uglify-js@3.3.x: version "3.3.9" From db1815220c6ac186f4609c3ed48748edc4a125b2 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Wed, 20 Apr 2022 07:12:01 +0100 Subject: [PATCH 2/3] any From 5e71dfe8cd2580a6d59ffa43db0df2ff504de368 Mon Sep 17 00:00:00 2001 From: johnnyreilly Date: Wed, 20 Apr 2022 07:15:21 +0100 Subject: [PATCH 3/3] prettier --- src/instances.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/instances.ts b/src/instances.ts index b92e2f9ca..914888edb 100644 --- a/src/instances.ts +++ b/src/instances.ts @@ -378,10 +378,11 @@ export function initializeInstance( } else if (typeof customerTransformers === 'string') { try { customerTransformers = require(customerTransformers); - // eslint-disable-next-line prettier/prettier } catch (err) { throw new Error( - `Failed to load customTransformers from "${instance.loaderOptions.getCustomTransformers}": ${err.message}` + `Failed to load customTransformers from "${ + instance.loaderOptions.getCustomTransformers + }": ${err instanceof Error ? err.message : ''}` ); }