File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export class Command {
101
101
options . commandType = 'info'
102
102
return options
103
103
}
104
-
104
+
105
105
// Resolve inputFile and inputFileType
106
106
options . commandType = 'bundle'
107
107
options . inFile = resolve ( next )
@@ -191,7 +191,7 @@ export class Command {
191
191
options . errorText = `expected <global>=<module> pair for --importAs.`
192
192
return options
193
193
}
194
- const pattern = / ( [ a - z A - Z 0 - 9 ] + ) = ( [ a - z A - Z 0 - 9 ] + ) /
194
+ const pattern = / ( [ a - z A - Z 0 - 9 - _ $ ] + ) = ( [ a - z A - Z 0 - 9 - _ $ ] + ) /
195
195
const match = next . match ( pattern )
196
196
if ( ! match ) {
197
197
options . commandType = 'error'
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ THE SOFTWARE.
27
27
---------------------------------------------------------------------------*/
28
28
29
29
export { TypeScriptConfiguration } from './config'
30
+ export { TypeScriptCompilerError } from './typescript'
30
31
export { TypeScriptOptions } from './typescript'
31
32
export { TypeScript } from './typescript'
32
33
export { Watcher } from './watcher'
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ import { readFileSync } from 'fs'
47
47
//
48
48
// --------------------------------------------------------------------------
49
49
50
+ export class TypeScriptCompilerError extends Error {
51
+ constructor ( public exitcode : number ) {
52
+ super ( `TypeScript ended with exit code ${ exitcode } ` )
53
+ }
54
+ }
55
+
50
56
export type ESTarget = 'unknown' | 'es3' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'esnext'
51
57
52
58
export interface TypeScriptOptions {
@@ -110,7 +116,7 @@ export class TypeScript {
110
116
if ( exitcode === 0 ) {
111
117
return resolve ( exitcode )
112
118
}
113
- reject ( new Error ( ` exitcode ${ exitcode } ` ) )
119
+ reject ( new TypeScriptCompilerError ( exitcode ) )
114
120
} )
115
121
} )
116
122
}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import { TypeScriptConfiguration } from './compiler/index'
30
30
import { Command , CommandOptions } from './command/index'
31
31
import { Bundler , BundlerOptions } from './bundler/index'
32
32
import { TypeScript , TypeScriptOptions } from './compiler/index'
33
+ import { TypeScriptCompilerError } from './compiler/index'
33
34
import { writeFileSync } from 'fs'
34
35
35
36
/** Writes usage information */
@@ -137,7 +138,7 @@ async function bundle(commandOptions: CommandOptions) {
137
138
} )
138
139
} catch ( error ) {
139
140
fatal ( error . message )
140
- process . exit ( 2 )
141
+ process . exit ( ( error as TypeScriptCompilerError ) . exitcode )
141
142
}
142
143
}
143
144
You can’t perform that action at this time.
0 commit comments