Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types support #318

Merged
merged 5 commits into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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