ts-loader
Advanced tools
Comparing version 9.2.1 to 9.2.2
# Changelog | ||
## v9.2.2 | ||
* [Start consuming webpack loader types](https://github.com/TypeStrong/ts-loader/issues/1325) - thanks @johnnyreilly | ||
* [Add webpack minimum version in peerDependencies](https://github.com/TypeStrong/ts-loader/issues/1324) - thanks @afdev82 | ||
## v9.2.1 | ||
@@ -4,0 +9,0 @@ |
import { Chalk } from 'chalk'; | ||
import type * as typescript from 'typescript'; | ||
import * as webpack from 'webpack'; | ||
import { LoaderOptions, WebpackLoaderContext } from './interfaces'; | ||
import { LoaderOptions } from './interfaces'; | ||
import * as logger from './logger'; | ||
@@ -10,3 +10,3 @@ interface ConfigFile { | ||
} | ||
export declare function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: WebpackLoaderContext, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): { | ||
export declare function getConfigFile(compiler: typeof typescript, colors: Chalk, loader: webpack.LoaderContext<LoaderOptions>, loaderOptions: LoaderOptions, compilerCompatible: boolean, log: logger.Logger, compilerDetailsLogMessage: string): { | ||
configFilePath: string | undefined; | ||
@@ -13,0 +13,0 @@ configFile: ConfigFile; |
@@ -1,6 +0,7 @@ | ||
import { LoaderOptions, WebpackLoaderContext } from './interfaces'; | ||
import type * as webpack from 'webpack'; | ||
import { LoaderOptions } from './interfaces'; | ||
/** | ||
* The entry point for ts-loader | ||
*/ | ||
declare function loader(this: WebpackLoaderContext, contents: string): void; | ||
declare function loader(this: webpack.LoaderContext<LoaderOptions>, contents: string): void; | ||
export = loader; | ||
@@ -7,0 +8,0 @@ /** |
@@ -91,3 +91,3 @@ "use strict"; | ||
function getLoaderOptions(loaderContext) { | ||
const loaderOptions = loaderContext.getOptions(undefined); | ||
const loaderOptions = loaderContext.getOptions(); | ||
// If no instance name is given in the options, use the hash of the loader options | ||
@@ -94,0 +94,0 @@ // In this way, if different options are given the instances will be different |
import * as webpack from 'webpack'; | ||
import { TSInstance } from './interfaces'; | ||
export declare function getTSInstanceFromCache(key: webpack.Compiler, name: string): TSInstance | undefined; | ||
export declare function setTSInstanceInCache(key: webpack.Compiler, name: string, instance: TSInstance): void; | ||
export declare function setTSInstanceInCache(key: webpack.Compiler | undefined, name: string, instance: TSInstance): void; | ||
//# sourceMappingURL=instance-cache.d.ts.map |
import type * as typescript from 'typescript'; | ||
import * as webpack from 'webpack'; | ||
import { LoaderOptions, TSInstance, WebpackLoaderContext } from './interfaces'; | ||
import { LoaderOptions, TSInstance } from './interfaces'; | ||
/** | ||
@@ -11,9 +11,9 @@ * The loader is executed once for each file seen by webpack. However, we need to keep | ||
*/ | ||
export declare function getTypeScriptInstance(loaderOptions: LoaderOptions, loader: WebpackLoaderContext): { | ||
export declare function getTypeScriptInstance(loaderOptions: LoaderOptions, loader: webpack.LoaderContext<LoaderOptions>): { | ||
instance?: TSInstance; | ||
error?: webpack.WebpackError; | ||
}; | ||
export declare function initializeInstance(loader: WebpackLoaderContext, instance: TSInstance): void; | ||
export declare function reportTranspileErrors(instance: TSInstance, loader: WebpackLoaderContext): void; | ||
export declare function buildSolutionReferences(instance: TSInstance, loader: WebpackLoaderContext): void; | ||
export declare function initializeInstance(loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance): void; | ||
export declare function reportTranspileErrors(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): void; | ||
export declare function buildSolutionReferences(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): void; | ||
export declare function forEachResolvedProjectReference<T>(resolvedProjectReferences: readonly (typescript.ResolvedProjectReference | undefined)[] | undefined, cb: (resolvedProjectReference: typescript.ResolvedProjectReference) => T | undefined): T | undefined; | ||
@@ -20,0 +20,0 @@ export declare function getOutputFileNames(instance: TSInstance, configFile: typescript.ParsedCommandLine, inputFileName: string): string[]; |
@@ -1,7 +0,4 @@ | ||
/// <reference types="node" /> | ||
import type * as typescript from 'typescript'; | ||
import { Chalk } from 'chalk'; | ||
import * as logger from './logger'; | ||
import type * as webpack from 'webpack'; | ||
import type * as enhancedResolve from 'enhanced-resolve'; | ||
export interface ErrorInfo { | ||
@@ -234,156 +231,3 @@ code: number; | ||
export declare type Severity = 'error' | 'warning'; | ||
export declare type WebpackLoaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: string | any) => void; | ||
/** based on https://github.com/webpack/webpack/pull/13164#issuecomment-821357676 */ | ||
export interface WebpackLoaderContext { | ||
version: number; | ||
/** | ||
* Hacky access to the Compilation object of webpack. | ||
*/ | ||
_compilation: webpack.Compilation; | ||
/** | ||
* Hacky access to the Compiler object of webpack. | ||
*/ | ||
_compiler: webpack.Compiler; | ||
/** | ||
* Hacky access to the Module object being loaded. | ||
*/ | ||
_module: webpack.NormalModule; | ||
addBuildDependency(dep: string): void; | ||
/** | ||
* Add a directory as dependency of the loader result. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L305 | ||
*/ | ||
addContextDependency(context: string): void; | ||
/** | ||
* Adds a file as dependency of the loader result in order to make them watchable. | ||
* For example, html-loader uses this technique as it finds src and src-set attributes. | ||
* Then, it sets the url's for those attributes as dependencies of the html file that is parsed. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L302 | ||
*/ | ||
addDependency(file: string): void; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L308 */ | ||
addMissingDependency(context: string): void; | ||
/** | ||
* Make this loader async. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L108 | ||
*/ | ||
async(): WebpackLoaderCallback | undefined; | ||
/** | ||
* Make this loader result cacheable. By default it's not cacheable. | ||
* A cacheable loader must have a deterministic result, when inputs and dependencies haven't changed. | ||
* This means the loader shouldn't have other dependencies than specified with this.addDependency. | ||
* Most loaders are deterministic and cacheable. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L297 | ||
*/ | ||
cacheable(flag?: boolean): void; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L116 */ | ||
callback(): void; | ||
/** | ||
* Remove all dependencies of the loader result. Even initial dependencies and these of other loaders. Consider using pitch. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L320 | ||
*/ | ||
clearDependencies(): void; | ||
/** | ||
* The directory of the module. Can be used as context for resolving other stuff. | ||
* eg '/workspaces/ts-loader/examples/vanilla/src' | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L289 | ||
*/ | ||
context: string; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L358 */ | ||
readonly currentRequest: string; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L381 */ | ||
readonly data: any; | ||
/** | ||
* alias of addDependency | ||
* Adds a file as dependency of the loader result in order to make them watchable. | ||
* For example, html-loader uses this technique as it finds src and src-set attributes. | ||
* Then, it sets the url's for those attributes as dependencies of the html file that is parsed. | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L302 | ||
*/ | ||
dependency(file: string): void; | ||
/** | ||
* https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L520 | ||
*/ | ||
emitError(error: Error | string): void; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L562 */ | ||
emitFile(name: string, content: string, sourceMap: string, assetInfo: webpack.AssetInfo): void; | ||
/** | ||
* https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L510 | ||
*/ | ||
emitWarning(warning: Error | string): void; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L590 */ | ||
fs: enhancedResolve.CachedInputFileSystem; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L314 */ | ||
getContextDependencies(): string[]; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L311 */ | ||
getDependencies(): string[]; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L530 */ | ||
getLogger(name: string): webpack.Compilation['logger']; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L317 */ | ||
getMissingDependencies(): string[]; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L472 */ | ||
getOptions(schema: any): any; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L541 */ | ||
getResolve(options: webpack.Configuration): any; | ||
/** | ||
* The index in the loaders array of the current loader. | ||
* In the example: in loader1: 0, in loader2: 1 | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L290 | ||
*/ | ||
loaderIndex: number; | ||
/** | ||
* Resolves the given request to a module, applies all configured loaders and calls | ||
* back with the generated source, the sourceMap and the module instance (usually an | ||
* instance of NormalModule). Use this function if you need to know the source code | ||
* of another module to generate the result. | ||
*/ | ||
loadModule(request: string, callback: (err: Error | null, source: string, sourceMap: any, module: webpack.Module) => void): void; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L586 */ | ||
mode: 'development' | 'production' | 'none'; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L366 */ | ||
readonly previousRequest: any; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L374 */ | ||
readonly query: any; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L348 */ | ||
readonly remainingRequest: any; | ||
/** https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L340 */ | ||
readonly request: any; | ||
/** https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L538 */ | ||
resolve(context: string, request: any, callback: any): any; | ||
/** | ||
* Starting with webpack 4, the formerly `this.options.context` is provided as `this.rootContext`. | ||
* https://github.com/webpack/webpack/blob/49890b77aae455b3204c17fdbed78eeb47bc1d98/lib/NormalModule.js#L583 | ||
*/ | ||
rootContext: string; | ||
/** | ||
* An array of all the loaders. It is writeable in the pitch phase. | ||
* loaders = [{request: string, path: string, query: string, module: function}] | ||
* | ||
* In the example: | ||
* [ | ||
* { request: "/abc/loader1.js?xyz", | ||
* path: "/abc/loader1.js", | ||
* query: "?xyz", | ||
* module: [Function] | ||
* }, | ||
* { request: "/abc/node_modules/loader2/index.js", | ||
* path: "/abc/node_modules/loader2/index.js", | ||
* query: "", | ||
* module: [Function] | ||
* } | ||
* ] | ||
* | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L291 | ||
* https://github.com/webpack/loader-runner/blob/6221befd031563e130f59d171e732950ee4402c6/lib/LoaderRunner.js#L46 | ||
*/ | ||
loaders: { | ||
request: string; | ||
}[]; | ||
/** | ||
* The resource file. | ||
* In the example: "/abc/resource.js" | ||
*/ | ||
resourcePath: string; | ||
} | ||
export {}; | ||
//# sourceMappingURL=interfaces.d.ts.map |
import type * as typescript from 'typescript'; | ||
import * as webpack from 'webpack'; | ||
import { FilePathKey, ServiceHostWhichMayBeCacheable, SolutionBuilderWithWatchHost, TSInstance, WatchHost, WebpackLoaderContext } from './interfaces'; | ||
import { FilePathKey, LoaderOptions, ServiceHostWhichMayBeCacheable, SolutionBuilderWithWatchHost, TSInstance, WatchHost } from './interfaces'; | ||
/** | ||
* Create the TypeScript language service | ||
*/ | ||
export declare function makeServicesHost(scriptRegex: RegExp, loader: WebpackLoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): ServiceHostWhichMayBeCacheable; | ||
export declare function makeServicesHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): ServiceHostWhichMayBeCacheable; | ||
export declare function updateFileWithText(instance: TSInstance, key: FilePathKey, filePath: string, text: (nFilePath: string) => string): void; | ||
@@ -12,8 +12,8 @@ /** | ||
*/ | ||
export declare function makeWatchHost(scriptRegex: RegExp, loader: WebpackLoaderContext, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): WatchHost; | ||
export declare function makeWatchHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance, projectReferences?: ReadonlyArray<typescript.ProjectReference>): WatchHost; | ||
/** | ||
* Create the TypeScript Watch host | ||
*/ | ||
export declare function makeSolutionBuilderHost(scriptRegex: RegExp, loader: WebpackLoaderContext, instance: TSInstance): SolutionBuilderWithWatchHost; | ||
export declare function makeSolutionBuilderHost(scriptRegex: RegExp, loader: webpack.LoaderContext<LoaderOptions>, instance: TSInstance): SolutionBuilderWithWatchHost; | ||
export declare function getSolutionErrors(instance: TSInstance, context: string): webpack.WebpackError[]; | ||
//# sourceMappingURL=servicesHost.d.ts.map |
import * as webpack from 'webpack'; | ||
import { TSInstance, WebpackLoaderContext } from './interfaces'; | ||
import { LoaderOptions, TSInstance } from './interfaces'; | ||
/** | ||
* Make function which will manually update changed files | ||
*/ | ||
export declare function makeWatchRun(instance: TSInstance, loader: WebpackLoaderContext): (compiler: webpack.Compiler, callback: (err?: Error | undefined) => void) => void; | ||
export declare function makeWatchRun(instance: TSInstance, loader: webpack.LoaderContext<LoaderOptions>): (compiler: webpack.Compiler, callback: (err?: Error | undefined) => void) => void; | ||
//# sourceMappingURL=watch-run.d.ts.map |
{ | ||
"name": "ts-loader", | ||
"version": "9.2.1", | ||
"version": "9.2.2", | ||
"description": "TypeScript loader for webpack", | ||
@@ -102,4 +102,4 @@ "main": "index.js", | ||
"typescript": "*", | ||
"webpack": "*" | ||
"webpack": "^5.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
247024
3028