You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Releases
2
2
3
3
## Next
4
+
* Upgraded to TypeScript 1.6.2 (thanks to @vp2177 and @JoshuaKGoldberg for sending early PRs, and for @awjreynolds, @Zjaaspoer, @DrColossos, @ravishivt, @logankd, and @Gouigouix for early encouragement.)
4
5
5
6
## v5.0.1 (2015-10-08)
6
7
* FIX: 'htmlOutputTemplate' was not handled. Thanks for the PR, @rolego (#291).
Copy file name to clipboardExpand all lines: README.md
+131-8Lines changed: 131 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ Grunt-ts is an npm package that handles TypeScript compilation work in GruntJS b
8
8
9
9
### Latest Changes
10
10
Latest release is `5.0.1`, which includes `tsconfig.json` support and TypeScript 1.5, among many other improvements.
11
+
Current beta release is `5.1.0-beta.1`, which includes TypeScript 1.6 support and some bug fixes.
11
12
12
13
[Full changelog is here](CHANGELOG.md).
13
14
@@ -61,22 +62,26 @@ Grunt-ts provides explicit support for most `tsc` switches. Any arbitrary switc
61
62
|:----:|:----:|:-----|
62
63
|--declaration|[declaration](#declaration)|Generates a `.d.ts` definitions file for compiled TypeScript files|
63
64
|--emitDecoratorMetadata|[emitDecoratorMetadata](#emitdecoratormetadata)|Emit metadata for type/parameter decorators.|
65
+
|--experimentalAsyncFunctions|[experimentalAsyncFunctions](#experimentalasyncfunctions)|Enables experimental support for ES7 async functions|
64
66
|--experimentalDecorators|[experimentalDecorators](#experimentaldecorators)|Enables experimental support for ES7 decorators|
65
67
|--inlineSourceMap|[inlineSourceMap](#inlinesourcemap)|Emit a single file that includes source maps instead of emitting a separate `.js.map` file.|
66
68
|--inlineSources|[inlineSources](#inlinesources)|Emit the TypeScript source alongside the sourcemaps within a single file; requires `--inlineSourceMap` to be set.|
67
69
|--isolatedModules|[isolatedModules](#isolatedmodules)|Ensures that the output is safe to only emit single files by making cases that break single-file transpilation an error|
70
+
|--jsx|[jsx](#jsx)|Specifies the JSX code generation style: 'preserve' or 'react'|
68
71
|--mapRoot LOCATION|[mapRoot](#maproot)|Specifies the location where debugger should locate map files instead of generated locations.|
69
72
|--module KIND|[module](#module)|Specify module style for code generation|
|--sourceRoot LOCATION|[sourceRoot](#sourceroot)|Specifies the location where debugger should locate TypeScript files instead of source locations.|
82
87
|--suppressImplicitAnyIndexErrors|[suppressImplicitAnyIndexErrors](#suppressimplicitanyindexerrors)|Specifies the location where debugger should locate TypeScript files instead of source locations.|
@@ -87,29 +92,35 @@ For file ordering, look at [JavaScript Generation](#javascript-generation).
87
92
88
93
## grunt-ts gruntfile.js options
89
94
90
-
|property|where to define|description|
95
+
|grunt-ts property|where to define|description|
91
96
|:----|:----|:-----|
92
97
|[additionalFlags](#additionalflags)|option|`string` - allows passing arbitrary strings to the compiler. This is intended to enable compatibility with features not supported directly by grunt-ts.|
93
98
|[comments](#comments)|option|`true`, `false` (default) - include comments in emitted JS.|
|[compiler](#compiler)|option|`string` - path to custom compiler|
96
101
|[declaration](#declaration)|option|`true`, `false` (default) - indicates that definition files should be emitted.|
97
102
|[emitDecoratorMetadata](#emitdecoratormetadata)|option|`true`, `false` (default) - set to true to emit metadata for ES7 decorators (will enable experimentalDecorators)|
103
+
|[experimentalAsyncFunctions](#experimentalasyncfunctions)|option|`true`, `false` (default) - set to true to enable support for ES7 async functions (in ES6 mode only)|
98
104
|[experimentalDecorators](#experimentaldecorators)|option|`true`, `false` (default) - set to true to enable support for ES7 decorators|
99
-
|[failOnTypeErrors](#failontypeerrors)|option|`true` (default), `false` - fail Grunt pipeline if there is a type error|
105
+
|[failOnTypeErrors](#failontypeerrors)|option|`true` (default), `false` - fail Grunt pipeline if there is a type error. (See also [noEmitOnError](#noemithelpers))|
100
106
|[fast](#fast)|option|`'watch'` (default), `'always'`, `'never'` - how to decide on a "fast" grunt-ts compile.|
101
107
|[files](#files)|target|Sets of files to compile and optional output destination|
102
108
|[html](#html)|target|`string` or `string[]` - glob to HTML templates|
103
109
|[htmlModuleTemplate](#htmlmoduletemplate)|option|`string` - HTML template namespace|
110
+
|[htmlOutDir](#htmloutdir)|option|`string` - Sets a root for output of transformed-to-TypeScript HTML files|
111
+
|[htmlOutDirFlatten](#htmloutdirflatten)|option|`true`, `false` (default) - Will flatten the transformed HTML files to a single folder|
104
112
|[htmlVarTemplate](#htmlvartemplate)|option|`string` - HTML property name|
105
113
|[inlineSourceMap](#inlinesourcemap)|option|`true`, `false` (default) Emit a single file that includes source maps instead of emitting a separate `.js.map` file; If enabled, will automatically enable `sourceMap`.|
106
114
|[inlineSources](#inlinesources)|option|`true`, `false` (default) Emit the TypeScript source alongside the sourcemaps within a single file; If enabled, will automatically enable `inlineSourceMap` and `sourceMap`.|
107
115
|[isolatedModules](#isolatedmodules)|option|`true`, `false` (default) Ensures that the output is safe to only emit single files by making cases that break single-file transpilation an error.|
116
+
|[jsx](#jsx)|option|`'preserve'`, `'react'`, (TypeScript default is `'react'`). If `'preserve'`, TypeScript will emit `.jsx`; if `'react'`, TypeScript will transpile and emit `.js` files.|
108
117
|[mapRoot](#maproot)|option|`string` - root for referencing `.js.map` files in JS|
109
118
|[module](#module)|option|default to be nothing, If you want to set it you set it to either `'amd'` or `'commonjs'`|
119
+
|[moduleResolution](#moduleresolution)|option|`'classic'` or `'node'`. This was introduced in TypeScript 1.6. The default is `'node'` if not passed. [More details here](https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#adjustments-in-module-resolution-logic).|
110
120
|[newLine](#newline)|option|`CRLF`, `LF`, `` (default) - If passed with a value, TypeScript will use the specified line endings. Also affects grunt-ts transforms.|
111
121
|[noEmit](#noemit)|option|`true`, `false` (default) - If passed as `true`, TypeScript will not emit even if it compiles cleanly|
112
122
|[noEmitHelpers](#noemithelpers)|option|`true`, `false` (default) - If passed as `true`, TypeScript will not generate custom helper functions like `__extends` in compiled output|
123
+
|[noEmitOnError](#noemithelpers)|option|`true`, `false` (default) - If passed as `true`, TypeScript will not emit JS if there is an error (see also [failOnTypeErrors](#failontypeerrors))|
113
124
|[noImplicitAny](#noimplicitany)|option|`true`, `false` (default) - enable for stricter type checking|
114
125
|[noResolve](#noresolve)|option|`true`, `false` (default) - for deprecated version of TypeScript|
115
126
|[options](#grunt-ts-target-options)|target||
@@ -118,6 +129,7 @@ For file ordering, look at [JavaScript Generation](#javascript-generation).
118
129
|[preserveConstEnums](#preserveconstenums)|option|`true`, `false` (default) - If true, const enums will be kept as enums in the emitted JS.|
119
130
|[reference](#reference)|target|`string` - tells grunt-ts which file to use for maintaining references|
120
131
|[removeComments](#removecomments)|option|`true` (default), `false` - removes comments in emitted JS|
132
+
|[rootDir](#rootdir)|option|`string` - Allows override of common root folder calculated by `--outDir`.|
121
133
|[sourceRoot](#sourceroot)|option|`string` - root for referencing TS files in `.js.map`|
122
134
|[sourceMap](#sourcemap)|option|`true` (default), `false` - indicates if source maps should be generated (`.js.map`)|
123
135
|[suppressImplicitAnyIndexErrors](#suppressimplicitanyindexerrors)|option|`false` (default), `true` - indicates if TypeScript should allow access to properties of an object by string indexer when `--noImplicitAny` is active, even if TypeScript doesn't know about them.|
@@ -127,6 +139,7 @@ For file ordering, look at [JavaScript Generation](#javascript-generation).
127
139
|[verbose](#verbose)|option|`true`, `false` (default) - logs `tsc` command-line options to console|
128
140
|[vs](#vs)|target|`string` referencing a `.csproj` or `.vbproj` file or, `{}` (object) (see [Visual Studio Projects](#vs) for details)|
129
141
|[watch](#watch)|target|`string` - will watch for changes in the specified directory or below|
142
+
|**something else**||Don't see the switch you're looking for? Check out [additionalFlags](#additionalflags)|
130
143
131
144
Note: In the above chart, if "where to define" is "target", the property must be defined on a target or on the `ts` object directly. If "where to define" is "options", then the property must be defined on an `options` object on `ts` or on a target under `ts`.
132
145
@@ -507,6 +520,25 @@ grunt.initConfig({
507
520
});
508
521
````
509
522
523
+
#### experimentalAsyncFunctions
524
+
525
+
````javascript
526
+
true|false (default)
527
+
````
528
+
529
+
Enable support for experimental ES7 async functionality. This is only available in TypeScript 1.6 and higher in 'es6' mode.
530
+
531
+
````javascript
532
+
grunt.initConfig({
533
+
ts: {
534
+
options: {
535
+
experimentalAsyncFunctions:true,
536
+
target:'es6'
537
+
}
538
+
}
539
+
});
540
+
````
541
+
510
542
#### experimentalDecorators
511
543
512
544
````javascript
@@ -606,15 +638,51 @@ grunt.initConfig({
606
638
});
607
639
````
608
640
641
+
#### htmlOutDir
642
+
643
+
Sets a root for output of transformed-to-TypeScript HTML files. See detailed explanation of [grunt-ts HTML template support](/docs/html2ts.md).
644
+
645
+
````javascript
646
+
//Note: incomplete - combine with html and src/files/etc.
647
+
grunt.initConfig({
648
+
ts: {
649
+
default: {
650
+
options: {
651
+
htmlOutDir:'generatedHtml'
652
+
}
653
+
}
654
+
}
655
+
});
656
+
````
657
+
658
+
### htmlOutDirFlatten
659
+
660
+
Will flatten the transformed HTML files to a single folder. See detailed explanation of [grunt-ts HTML template support](/docs/html2ts.md).
661
+
662
+
````javascript
663
+
//Note: incomplete - combine with html and src/files/etc.
664
+
grunt.initConfig({
665
+
ts: {
666
+
default: {
667
+
options: {
668
+
htmlOutDir:'generatedHtml',
669
+
htmlOutDirFlatten:true
670
+
}
671
+
}
672
+
}
673
+
});
674
+
````
675
+
676
+
609
677
#### htmlOutputTemplate
610
678
611
679
Grunt-ts supports compilation of `.html` file content to TypeScript variables which is explained in detail [here](/docs/html2ts.md). The `htmlOutputTemplate` target property allows the developer to override the internally defined output template to a custom one, useful if one would like to define the HTML output as an external modules, for example.
612
-
Three variables can be used in this template, namely:
613
680
681
+
Three variables can be used in the template, namely:
614
682
615
-
* "<%= modulename %>" - This variable will be interpolated with the value of the htmlModuleTemplate option
616
-
* "<%= varname %>" - This variable will be interpolated with the value of the htmlVarTemplate option
617
-
* "<%= content %>" - This variable will be interpolated with the content of the HTML file
683
+
* "<%= modulename %>" - This variable will be replaced with the value of the `htmlModuleTemplate` option.
684
+
* "<%= varname %>" - This variable will be replaced with the value of the `htmlVarTemplate` option.
685
+
* "<%= content %>" - This variable will be replaced with the content of the HTML file.
618
686
619
687
````javascript
620
688
//Note: Outputs an external module
@@ -630,7 +698,6 @@ grunt.initConfig({
630
698
export var <%= varname %> = \'<%= content %>\';\n\
631
699
}\n'
632
700
}
633
-
634
701
}
635
702
}
636
703
});
@@ -697,6 +764,24 @@ grunt.initConfig({
697
764
});
698
765
````
699
766
767
+
#### jsx
768
+
769
+
````javascript
770
+
`'react'` (default) |`'preserve'`
771
+
````
772
+
773
+
Specify the JSX code generation style. Documentation is here: [TypeScript Wiki - JSX](https://github.com/Microsoft/TypeScript/wiki/JSX).
774
+
775
+
````javascript
776
+
grunt.initConfig({
777
+
ts: {
778
+
options: {
779
+
jsx:'preserve'
780
+
}
781
+
}
782
+
});
783
+
````
784
+
700
785
701
786
#### mapRoot
702
787
@@ -735,6 +820,26 @@ grunt.initConfig({
735
820
});
736
821
````
737
822
823
+
#### moduleResolution
824
+
825
+
````javascript
826
+
"node" (default) |"classic"
827
+
````
828
+
829
+
New in TypeScript 1.6. TypeScript is gaining support for resolving definition files using rules similar to common JavaScript module loaders. The first new one is support for CommonJS used by NodeJS, which is why this parameter is called `"node"` The `"node"` setting performs an extra check to see if a definition file exists in the `node_modules/modulename` folder if a TypeScript definition can't be found for an imported module. if this is not desired, set this setting to "classic".
830
+
831
+
````javascript
832
+
grunt.initConfig({
833
+
ts: {
834
+
default: {
835
+
options: {
836
+
moduleResolution:"classic"
837
+
}
838
+
}
839
+
}
840
+
});
841
+
````
842
+
738
843
#### newLine
739
844
740
845
````javascript
@@ -891,6 +996,24 @@ grunt.initConfig({
891
996
});
892
997
````
893
998
999
+
#### rootDir
1000
+
1001
+
````javascript
1002
+
string
1003
+
````
1004
+
1005
+
Affects the creation of folders inside the `outDir` location. `rootDir` allows manually specifying the desired common root folder when used in combination with `outDir`. Otherwise, TypeScript attempts to calculate this automatically.
0 commit comments