Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Commit

Permalink
feat(*): add sourceRoot support
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Panferov committed Nov 24, 2015
1 parent 958a7a6 commit bddf79c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
"grunt-shell": "^1.1.2",
"grunt-ts": "^3.0.0",
"load-grunt-tasks": "^0.6.0",
"typescript": "^1.8.0-dev.20151119"
"typescript": "^1.8.0-dev.20151123"
}
}
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require('babel-polyfill');

import * as Promise from 'bluebird';
import * as _ from 'lodash';
import * as path from 'path';

import { ICompilerOptions } from './host';
import { createResolver } from './deps';
Expand Down Expand Up @@ -154,7 +155,12 @@ async function compiler(webpack: IWebPack, text: string): Promise<void> {
let resultSourceMap = transformation.map;

if (resultSourceMap) {
resultSourceMap.sources = [ fileName ];
let sourcePath = path.relative(
instance.options.sourceRoot,
loaderUtils.getRemainingRequest(webpack)
);

resultSourceMap.sources = [ sourcePath ];
resultSourceMap.file = fileName;
resultSourceMap.sourcesContent = [ text ];
}
Expand Down
3 changes: 2 additions & 1 deletion src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export function ensureInstance(webpack: IWebPack, options: ICompilerOptions, ins
doTypeCheck: true,
sourceMap: true,
verbose: false,
noLib: false
noLib: false,
sourceRoot: process.cwd()
});

options = _.omit(options, 'outDir') as any;
Expand Down

0 comments on commit bddf79c

Please sign in to comment.