Skip to content

Commit

Permalink
Merge pull request #318 from johnnyreilly/master
Browse files Browse the repository at this point in the history
Add types support
  • Loading branch information
johnnyreilly committed Oct 16, 2016
2 parents 72338f6 + 8f5fc04 commit 8de8997
Show file tree
Hide file tree
Showing 24 changed files with 804 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.9.2

- [Added support for @types](https://github.com/TypeStrong/ts-loader/pull/318) (#247)

## v0.9.1

- [Normalize dependency graph paths - Fix broken dependencies on Windows ](https://github.com/TypeStrong/ts-loader/pull/286)
Expand Down
11 changes: 11 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,18 @@ function ensureTypeScriptInstance(loaderOptions: LoaderOptions, loader: any): {

return compiler.ScriptSnapshot.fromString(file.text);
},
/**
* getDirectories is also required for full import and type reference completions.
* Without it defined, certain completions will not be provided
*/
getDirectories: typescript.sys ? (<any>typescript.sys).getDirectories : undefined,

/**
* For @types expansion, these two functions are needed.
*/
directoryExists: typescript.sys ? (<any>typescript.sys).directoryExists : undefined,
getCurrentDirectory: () => process.cwd(),

getCompilationSettings: () => compilerOptions,
getDefaultLibFileName: options => compiler.getDefaultLibFilePath(options),
getNewLine: () => newLine,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-loader",
"version": "0.9.1",
"version": "0.9.2",
"description": "TypeScript loader for webpack",
"main": "index.js",
"scripts": {
Expand Down
55 changes: 55 additions & 0 deletions test/execution-tests/2.0.3_typesResolution/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable no-var, strict */
'use strict';
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');

module.exports = function(config) {
config.set({
browsers: [ 'PhantomJS' ],

files: [
// This loads all the tests
'main.js'
],

port: 9876,

frameworks: [ 'jasmine' ],

logLevel: config.LOG_INFO, //config.LOG_DEBUG

preprocessors: {
'main.js': [ 'webpack', 'sourcemap' ]
},

webpack: {
devtool: 'inline-source-map',
debug: true,
module: {
loaders: webpackConfig.module.loaders
},
resolve: webpackConfig.resolve,

// for test harness purposes only, you would not need this in a normal project
resolveLoader: webpackConfig.resolveLoader
},

webpackMiddleware: {
quiet: true,
stats: {
colors: true
}
},

// reporter options
mochaReporter: {
colors: {
success: 'bgGreen',
info: 'cyan',
warning: 'bgBlue',
error: 'bgRed'
}
}
});
};
2 changes: 2 additions & 0 deletions test/execution-tests/2.0.3_typesResolution/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const testsContext = require.context('./', true, /\.tests\.ts(x?)$/);
testsContext.keys().forEach(testsContext);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8de8997

Please sign in to comment.