Skip to content

Commit b5062db

Browse files
authored
Merge pull request #410 from johnnyreilly/master
remove arrify dependency
2 parents ba72e7e + 3a9cd2b commit b5062db

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
},
2929
"homepage": "https://github.com/TypeStrong/ts-loader",
3030
"dependencies": {
31-
"arrify": "^1.0.0",
3231
"colors": "^1.0.3",
3332
"enhanced-resolve": "^0.9.0",
3433
"loader-utils": "^0.2.6",

src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path = require('path');
22
import loaderUtils = require('loader-utils');
33
import objectAssign = require('object-assign');
4-
import arrify = require('arrify');
54
require('colors');
65

76
import instances = require('./instances');
@@ -65,7 +64,7 @@ function makeOptions(loader: interfaces.Webpack) {
6564
appendTsSuffixTo: [],
6665
entryFileIsJs: false,
6766
}, configFileOptions, queryOptions);
68-
options.ignoreDiagnostics = arrify(options.ignoreDiagnostics).map(Number);
67+
options.ignoreDiagnostics = utils.arrify(options.ignoreDiagnostics).map(Number);
6968
options.logLevel = options.logLevel.toUpperCase();
7069

7170
// differentiate the TypeScript instance based on the webpack instance

src/typings/arrify/arrify.d.ts

-5
This file was deleted.

src/utils.ts

+8
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,11 @@ export function collectAllDependencies(
131131
}
132132
return Object.keys(result);
133133
}
134+
135+
export function arrify<T>(val: T | T[]) {
136+
if (val === null || val === undefined) {
137+
return [];
138+
}
139+
140+
return Array.isArray(val) ? val : [val];
141+
};

test/comparison-tests/nodeModulesMeaningfulErrorWhenImportingTs/expectedOutput-2.0/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Module build failed: Error: Typescript emitted no output for node_modules\a\inde
88
You should not need to recompile .ts files in node_modules.
99
Please contact the package author to advise them to use --declaration --outDir.
1010
More https://github.com/Microsoft/TypeScript/issues/12358
11-
at Object.loader (dist\index.js:30:15)
11+
at Object.loader (dist\index.js:29:15)
1212
@ ./.test/nodeModulesMeaningfulErrorWhenImportingTs/app.ts 2:8-20

test/comparison-tests/nodeModulesMeaningfulErrorWhenImportingTs/expectedOutput-2.1/output.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Module build failed: Error: Typescript emitted no output for node_modules\a\inde
88
You should not need to recompile .ts files in node_modules.
99
Please contact the package author to advise them to use --declaration --outDir.
1010
More https://github.com/Microsoft/TypeScript/issues/12358
11-
at Object.loader (dist\index.js:30:15)
11+
at Object.loader (dist\index.js:29:15)
1212
@ ./.test/nodeModulesMeaningfulErrorWhenImportingTs/app.ts 2:8-20

0 commit comments

Comments
 (0)