awesome-typescript-loader
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="3.0.3"></a> | ||
## [3.0.3](https://github.com/s-panferov/awesome-typescript-loader/compare/v3.0.2...v3.0.3) (2017-02-06) | ||
### Bug Fixes | ||
* allow to pass `context` to PathPlugin, basic tests ([207b164](https://github.com/s-panferov/awesome-typescript-loader/commit/207b164)) | ||
<a name="3.0.2"></a> | ||
@@ -7,0 +17,0 @@ ## [3.0.2](https://github.com/s-panferov/awesome-typescript-loader/compare/v3.0.1...v3.0.2) (2017-02-05) |
@@ -1,8 +0,8 @@ | ||
import { PathsPlugin } from './paths-plugin'; | ||
import { PathPlugin } from './paths-plugin'; | ||
import { CheckerPlugin as _CheckerPlugin } from './watch-mode'; | ||
declare function loader(text: any): void; | ||
declare namespace loader { | ||
const TsConfigPathsPlugin: typeof PathsPlugin; | ||
const TsConfigPathsPlugin: typeof PathPlugin; | ||
const CheckerPlugin: typeof _CheckerPlugin; | ||
} | ||
export = loader; |
@@ -20,3 +20,3 @@ "use strict"; | ||
(function (loader) { | ||
loader.TsConfigPathsPlugin = paths_plugin_1.PathsPlugin; | ||
loader.TsConfigPathsPlugin = paths_plugin_1.PathPlugin; | ||
loader.CheckerPlugin = watch_mode_1.CheckerPlugin; | ||
@@ -23,0 +23,0 @@ })(loader || (loader = {})); |
@@ -35,3 +35,3 @@ "use strict"; | ||
var watching = isWatching(rootCompiler); | ||
var context = rootCompiler.context; | ||
var context = process.cwd(); | ||
var compilerInfo = setupTs(query.compiler); | ||
@@ -38,0 +38,0 @@ var tsImpl = compilerInfo.tsImpl; |
@@ -29,3 +29,6 @@ import { LoaderConfig } from './interfaces'; | ||
} | ||
export declare class PathsPlugin implements ResolverPlugin { | ||
export interface PathPluginOptions { | ||
context?: string; | ||
} | ||
export declare class PathPlugin implements ResolverPlugin { | ||
source: string; | ||
@@ -39,5 +42,5 @@ target: string; | ||
absoluteBaseUrl: string; | ||
constructor(config?: LoaderConfig & ts.CompilerOptions); | ||
constructor(config?: LoaderConfig & ts.CompilerOptions & PathPluginOptions); | ||
apply(resolver: Resolver): void; | ||
createPlugin(resolver: Resolver, mapping: Mapping): (request: any, callback: any) => any; | ||
} |
@@ -11,4 +11,4 @@ "use strict"; | ||
} | ||
var PathsPlugin = (function () { | ||
function PathsPlugin(config) { | ||
var PathPlugin = (function () { | ||
function PathPlugin(config) { | ||
if (config === void 0) { config = {}; } | ||
@@ -19,3 +19,4 @@ var _this = this; | ||
this.ts = instance_1.setupTs(config.compiler).tsImpl; | ||
var _a = instance_1.readConfigFile(process.cwd(), config, {}, this.ts), configFilePath = _a.configFilePath, compilerConfig = _a.compilerConfig; | ||
var context = config.context || process.cwd(); | ||
var _a = instance_1.readConfigFile(context, config, {}, this.ts), configFilePath = _a.configFilePath, compilerConfig = _a.compilerConfig; | ||
this.options = compilerConfig.options; | ||
@@ -49,3 +50,3 @@ this.configFilePath = configFilePath; | ||
} | ||
PathsPlugin.prototype.apply = function (resolver) { | ||
PathPlugin.prototype.apply = function (resolver) { | ||
var _this = this; | ||
@@ -60,3 +61,3 @@ var _a = this, baseUrl = _a.baseUrl, mappings = _a.mappings; | ||
}; | ||
PathsPlugin.prototype.createPlugin = function (resolver, mapping) { | ||
PathPlugin.prototype.createPlugin = function (resolver, mapping) { | ||
var _this = this; | ||
@@ -90,5 +91,5 @@ return function (request, callback) { | ||
}; | ||
return PathsPlugin; | ||
return PathPlugin; | ||
}()); | ||
exports.PathsPlugin = PathsPlugin; | ||
exports.PathPlugin = PathPlugin; | ||
//# sourceMappingURL=paths-plugin.js.map |
{ | ||
"name": "awesome-typescript-loader", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Awesome TS loader for webpack", | ||
@@ -5,0 +5,0 @@ "main": "dist/entry.js", |
@@ -68,3 +68,3 @@ import * as path from 'path'; | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', '.jsx'], | ||
extensions: ['.ts', '.tsx', '.js', '.jsx'] | ||
}, | ||
@@ -240,6 +240,10 @@ module: { | ||
export function tsconfig(compilerOptions?: any, config?: any) { | ||
export function tsconfig( | ||
compilerOptions?: any, | ||
config?: any | ||
) { | ||
const res = _.merge({ | ||
compilerOptions: _.merge({ | ||
target: 'es6' | ||
target: 'es6', | ||
moduleResolution: 'node' | ||
}, compilerOptions) | ||
@@ -276,3 +280,3 @@ }, config); | ||
export function compile(config?): Promise<any> { | ||
export function compile(config): Promise<any> { | ||
return new Promise((resolve, reject) => { | ||
@@ -279,0 +283,0 @@ const compiler = webpack(config); |
@@ -7,3 +7,3 @@ import * as _ from 'lodash'; | ||
import { QueryOptions, Loader, ensureInstance, Instance, getRootCompiler } from './instance'; | ||
import { PathsPlugin } from './paths-plugin'; | ||
import { PathPlugin } from './paths-plugin'; | ||
import { CheckerPlugin as _CheckerPlugin } from './watch-mode'; | ||
@@ -23,3 +23,3 @@ | ||
namespace loader { | ||
export const TsConfigPathsPlugin = PathsPlugin; | ||
export const TsConfigPathsPlugin = PathPlugin; | ||
export const CheckerPlugin = _CheckerPlugin; | ||
@@ -26,0 +26,0 @@ } |
@@ -88,8 +88,13 @@ import * as fs from 'fs'; | ||
const watching = isWatching(rootCompiler); | ||
const context = process.cwd(); | ||
const context = rootCompiler.context; | ||
let compilerInfo = setupTs(query.compiler); | ||
let { tsImpl } = compilerInfo; | ||
let { configFilePath, compilerConfig, loaderConfig } = readConfigFile(context, query, options, tsImpl); | ||
let { configFilePath, compilerConfig, loaderConfig } = readConfigFile( | ||
context, | ||
query, | ||
options, | ||
tsImpl | ||
); | ||
@@ -96,0 +101,0 @@ applyDefaults( |
@@ -53,3 +53,7 @@ import { setupTs, readConfigFile } from './instance'; | ||
export class PathsPlugin implements ResolverPlugin { | ||
export interface PathPluginOptions { | ||
context?: string; | ||
} | ||
export class PathPlugin implements ResolverPlugin { | ||
source: string; | ||
@@ -65,3 +69,3 @@ target: string; | ||
constructor(config: LoaderConfig & ts.CompilerOptions = {} as any) { | ||
constructor(config: LoaderConfig & ts.CompilerOptions & PathPluginOptions = {} as any) { | ||
this.source = 'described-resolve'; | ||
@@ -72,3 +76,5 @@ this.target = 'resolve'; | ||
let { configFilePath, compilerConfig } = readConfigFile(process.cwd(), config, {}, this.ts); | ||
let context = config.context || process.cwd(); | ||
let { configFilePath, compilerConfig } = readConfigFile(context, config, {}, this.ts); | ||
this.options = compilerConfig.options; | ||
@@ -75,0 +81,0 @@ this.configFilePath = configFilePath; |
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
319671
78
4040