Skip to content

Commit add1004

Browse files
committed
Rename "additionalFiles" to just "files" in preparation for tsconfig.json support. (#9)
1 parent 3adb457 commit add1004

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Specify whether or not TypeScript will allow inferring the `any` type.
6262
Allows use of TypeScript compilers other than the official one. Should be
6363
set to the NPM name of the compiler.
6464

65-
##### additionalFiles *(array of string) (default=[])*
65+
##### files *(array of string) (default=[])*
6666

6767
Allows additional files to be manually passed to the TypeScript compiler.
6868
For example, if you want to make a declaration file available without

index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface Options {
2727
noImplicitAny: boolean;
2828
target: string;
2929
module: string;
30-
additionalFiles: string[];
30+
files: string[];
3131
}
3232

3333
interface TSFile {
@@ -78,8 +78,8 @@ function ensureTypeScriptInstance(options: Options, loader: any): TSInstance {
7878
var instance = instances[options.instance];
7979
files = instance.files;
8080

81-
options.additionalFiles.forEach(filePath => {
82-
if (!Object.prototype.hasOwnProperty.call(options.additionalFiles, filePath)) {
81+
options.files.forEach(filePath => {
82+
if (!Object.prototype.hasOwnProperty.call(options.files, filePath)) {
8383
files[filePath] = {
8484
text: fs.readFileSync(filePath, 'utf-8'),
8585
version: 0
@@ -113,9 +113,9 @@ function ensureTypeScriptInstance(options: Options, loader: any): TSInstance {
113113
noImplicitAny: !!options.noImplicitAny
114114
}
115115

116-
options.additionalFiles.push(path.join(path.dirname(require.resolve('typescript')), libFileName));
116+
options.files.push(path.join(path.dirname(require.resolve('typescript')), libFileName));
117117

118-
options.additionalFiles.forEach(filePath => {
118+
options.files.forEach(filePath => {
119119
files[filePath] = {
120120
text: fs.readFileSync(filePath, 'utf-8'),
121121
version: 0
@@ -186,10 +186,10 @@ function loader(contents) {
186186
instance: 'default',
187187
compiler: 'typescript',
188188
sourceMap: false,
189-
additionalFiles: []
189+
files: []
190190
}, options);
191191

192-
options.additionalFiles = options.additionalFiles.map(filePath => path.resolve(this.context, filePath));
192+
options.files = options.files.map(filePath => path.resolve(this.context, filePath));
193193

194194
var instance = ensureTypeScriptInstance(options, this);
195195

File renamed without changes.

test/additionalFiles/webpack.config.js renamed to test/files/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var path = require('path')
22

33
var tsLoaderOptions = {
4-
instance: 'additionalFiles',
5-
additionalFiles: [
4+
instance: 'files',
5+
files: [
66
path.join(__dirname, "./lib/externalLib.d.ts")
77
]
88
}

test/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function assertModuleCount(stats, expectedNumberOfModules) {
3030
assert.equal(statsJson.modules.length, expectedNumberOfModules, 'wrong number of modules found')
3131
}
3232

33-
describe('additionalFiles', function() {
33+
describe('files', function() {
3434
it('should not error', function(done) {
35-
webpack(require('./additionalFiles/webpack.config')).run(function(err, stats) {
35+
webpack(require('./files/webpack.config')).run(function(err, stats) {
3636
if (!handleErrors(err, stats, done)) {
3737
done()
3838
}

0 commit comments

Comments
 (0)