ts-loader
Advanced tools
Comparing version 9.2.6 to 9.2.7
# Changelog | ||
## v9.2.7 | ||
* [cater for change in resolveTypeReferenceDirective API in TypeScript 4.7](https://github.com/TypeStrong/ts-loader/pull/1422) [#1421] - thanks @johnny_reilly and @cspotcode for inspiration in ts-node work here: https://github.com/TypeStrong/ts-node/pull/1648 | ||
## v9.2.6 | ||
* [Docs fix for thread-loader / history](https://github.com/TypeStrong/ts-loader/pull/1377) - thanks @johnnyreilly | ||
## v9.2.5 | ||
@@ -4,0 +12,0 @@ |
@@ -224,4 +224,14 @@ import type * as typescript from 'typescript'; | ||
} | ||
export interface TSCommon { | ||
resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: typescript.CompilerOptions, host: typescript.ModuleResolutionHost, redirectedReference?: typescript.ResolvedProjectReference, cache?: typescript.TypeReferenceDirectiveResolutionCache, resolutionMode?: typescript.SourceFile['impliedNodeFormat']): typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations; | ||
} | ||
/** | ||
* Compiler APIs we use that are marked internal and not included in TypeScript's public API declarations | ||
* @internal | ||
*/ | ||
export interface TSInternal { | ||
getModeForFileReference?: (ref: typescript.FileReference | string, containingFileMode: typescript.SourceFile['impliedNodeFormat']) => typescript.SourceFile['impliedNodeFormat']; | ||
} | ||
export declare type Severity = 'error' | 'warning'; | ||
export {}; | ||
//# sourceMappingURL=interfaces.d.ts.map |
@@ -128,3 +128,4 @@ "use strict"; | ||
const resolveTypeReferenceDirective = makeResolveTypeReferenceDirective(compiler, compilerOptions, moduleResolutionHost, customResolveTypeReferenceDirective, instance); | ||
const resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile, redirectedReference) => typeDirectiveNames.map(directive => resolveTypeReferenceDirective(directive, containingFile, redirectedReference).resolvedTypeReferenceDirective); | ||
const resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode // new impliedNodeFormat is accepted by compilerHost | ||
) => typeDirectiveNames.map(directive => resolveTypeReferenceDirective(directive, containingFile, options, redirectedReference, containingFileMode).resolvedTypeReferenceDirective); | ||
return { | ||
@@ -241,3 +242,3 @@ resolveTypeReferenceDirectives, | ||
function makeWatchHost(scriptRegex, loader, instance, projectReferences) { | ||
const { compiler, compilerOptions, files, otherFiles, filePathKeyMapper, } = instance; | ||
const { compiler, compilerOptions, files, otherFiles, filePathKeyMapper } = instance; | ||
const { watchFile, watchDirectory, invokeFileWatcher } = createWatchFactory(filePathKeyMapper, compiler); | ||
@@ -709,11 +710,21 @@ const { moduleResolutionHost, resolveModuleNames, resolveTypeReferenceDirectives, } = makeResolversAndModuleResolutionHost(scriptRegex, loader, instance, fileName => files.has(filePathKeyMapper(fileName)) || | ||
// Until the api is published | ||
if (compiler.createTypeReferenceDirectiveResolutionCache && | ||
if (compiler.createTypeReferenceDirectiveResolutionCache !== undefined && | ||
!instance.typeReferenceResolutionCache) { | ||
instance.typeReferenceResolutionCache = compiler.createTypeReferenceDirectiveResolutionCache(moduleResolutionHost.getCurrentDirectory(), createGetCanonicalFileName(instance), instance.compilerOptions, (_b = (_a = instance.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.call(_a)); | ||
instance.typeReferenceResolutionCache = | ||
compiler.createTypeReferenceDirectiveResolutionCache(moduleResolutionHost.getCurrentDirectory(), createGetCanonicalFileName(instance), instance.compilerOptions, (_b = (_a = instance.moduleResolutionCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.call(_a)); | ||
} | ||
return (directive, containingFile, redirectedReference) => | ||
// Until the api is published | ||
compiler.resolveTypeReferenceDirective(directive, containingFile, compilerOptions, moduleResolutionHost, redirectedReference, instance.typeReferenceResolutionCache); | ||
return (typeDirectiveName, containingFile, options, redirectedReference, containingFileMode) => { | ||
// Copy-pasted from https://github.com/TypeStrong/ts-node/blob/9f789d0d91c6eba30ac7f7aad45194a23b44f159/src/resolver-functions.ts#L139 | ||
const nameIsString = typeof typeDirectiveName === 'string'; | ||
const mode = nameIsString | ||
? undefined | ||
: compiler.getModeForFileReference(typeDirectiveName, containingFileMode); | ||
const strName = nameIsString | ||
? typeDirectiveName | ||
: typeDirectiveName.fileName.toLowerCase(); | ||
return compiler.resolveTypeReferenceDirective(strName, containingFile, options, moduleResolutionHost, redirectedReference, undefined, mode); | ||
}; | ||
} | ||
return (directive, containingFile) => customResolveTypeReferenceDirective(directive, containingFile, compilerOptions, moduleResolutionHost, compiler.resolveTypeReferenceDirective); | ||
return (directive, containingFile) => customResolveTypeReferenceDirective(directive, // unsure whether we should evolve this further | ||
containingFile, compilerOptions, moduleResolutionHost, compiler.resolveTypeReferenceDirective); | ||
} | ||
@@ -720,0 +731,0 @@ function isJsImplementationOfTypings(resolvedModule, tsResolution) { |
{ | ||
"name": "ts-loader", | ||
"version": "9.2.6", | ||
"version": "9.2.7", | ||
"description": "TypeScript loader for webpack", | ||
@@ -96,3 +96,3 @@ "main": "index.js", | ||
"rimraf": "^2.6.2", | ||
"typescript": "^4.3.2", | ||
"typescript": "^4.5.2", | ||
"webpack": "^5.20.0", | ||
@@ -99,0 +99,0 @@ "webpack-cli": "^4.5.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
249432
3050
52