@@ -36,7 +36,8 @@ module.exports = function makeNodeTree(destinationPath) {
3636 allowNonTsExtensions : false ,
3737 emitDecoratorMetadata : true ,
3838 experimentalDecorators : true ,
39- declaration : false ,
39+ declaration : true ,
40+ stripInternal : true ,
4041 mapRoot : '' , /* force sourcemaps to use relative path */
4142 module : 'CommonJS' ,
4243 moduleResolution : 1 /* classic */ ,
@@ -77,7 +78,10 @@ module.exports = function makeNodeTree(destinationPath) {
7778 packageJsons =
7879 renderLodashTemplate ( packageJsons , { context : { 'packageJson' : COMMON_PACKAGE_JSON } } ) ;
7980
80- var nodeTree = mergeTrees ( [ typescriptTree , docs , packageJsons ] ) ;
81+ var typingsTree = new Funnel (
82+ 'modules' ,
83+ { include : [ 'angular2/typings/**/*.d.ts' , 'angular2/manual_typings/*.d.ts' ] , destDir : '/' } ) ;
84+ var nodeTree = mergeTrees ( [ typescriptTree , docs , packageJsons , typingsTree ] ) ;
8185
8286 // Transform all tests to make them runnable in node
8387 nodeTree = replace ( nodeTree , {
@@ -101,5 +105,21 @@ module.exports = function makeNodeTree(destinationPath) {
101105 patterns : [ { match : / ^ / , replacement : function ( ) { return `'use strict';` } } ]
102106 } ) ;
103107
108+ // Add a line to the end of our top-level .d.ts file.
109+ // This HACK for transitive typings is a workaround for
110+ // https://github.com/Microsoft/TypeScript/issues/5097
111+ //
112+ // This allows users to get our top-level dependencies like es6-shim.d.ts
113+ // to appear when they compile against angular2.
114+ //
115+ // This carries the risk that the user brings their own copy of that file
116+ // (or any other symbols exported here) and they will get a compiler error
117+ // because of the duplicate definitions.
118+ // TODO(alexeagle): remove this when typescript releases a fix
119+ nodeTree = replace ( nodeTree , {
120+ files : [ 'angular2/angular2.d.ts' ] ,
121+ patterns : [ { match : / $ / , replacement : 'import "./manual_typings/globals.d.ts";\n' } ]
122+ } ) ;
123+
104124 return destCopy ( nodeTree , destinationPath ) ;
105125} ;
0 commit comments