@@ -9,6 +9,8 @@ var COFFEE_REQUIREJS_TEMPLATE_PATH = path.join(__dirname, '/../../requirejs.conf
99var COFFEE_REGEXP = / \. c o f f e e $ /
1010var LIVE_TEMPLATE_PATH = path . join ( __dirname , '/../../config.tpl.ls' )
1111var LIVE_REGEXP = / \. l s $ /
12+ var TYPE_TEMPLATE_PATH = path . join ( __dirname , '/../../config.tpl.ts' )
13+ var TYPE_REGEXP = / \. t s $ /
1214
1315var isCoffeeFile = function ( filename ) {
1416 return COFFEE_REGEXP . test ( filename )
@@ -18,6 +20,10 @@ var isLiveFile = function (filename) {
1820 return LIVE_REGEXP . test ( filename )
1921}
2022
23+ var isTypeFile = function ( filename ) {
24+ return TYPE_REGEXP . test ( filename )
25+ }
26+
2127var JavaScriptFormatter = function ( ) {
2228 var quote = function ( value ) {
2329 return "'" + value + "'"
@@ -114,9 +120,16 @@ var LiveFormatter = function () {
114120 this . TEMPLATE_FILE_PATH = LIVE_TEMPLATE_PATH
115121}
116122
123+ var TypeFormatter = function ( ) {
124+ JavaScriptFormatter . call ( this )
125+
126+ this . TEMPLATE_FILE_PATH = TYPE_TEMPLATE_PATH
127+ }
128+
117129exports . JavaScript = JavaScriptFormatter
118130exports . Coffee = CoffeeFormatter
119131exports . Live = LiveFormatter
132+ exports . Type = TypeFormatter
120133
121134exports . createForPath = function ( path ) {
122135 if ( isCoffeeFile ( path ) ) {
@@ -127,5 +140,9 @@ exports.createForPath = function (path) {
127140 return new LiveFormatter ( )
128141 }
129142
143+ if ( isTypeFile ( path ) ) {
144+ return new TypeFormatter ( )
145+ }
146+
130147 return new JavaScriptFormatter ( )
131148}
0 commit comments