Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ gulp.task('test.typings', ['!pre.test.typings'], function() {
var tmpdir = path.join(os.tmpdir(), 'test.typings', new Date().getTime().toString());
gulp.task('!pre.test.typings.layoutNodeModule', function() {
return gulp
.src(['dist/js/dev/es5/angular2/**/*'], {base: 'dist/js/dev/es5'})
.src(['dist/js/cjs/angular2/**/*'], {base: 'dist/js/cjs'})
.pipe(gulp.dest(path.join(tmpdir, 'node_modules')));
});
gulp.task('!pre.test.typings.copyTypingsSpec', function() {
Expand Down
24 changes: 22 additions & 2 deletions tools/broccoli/trees/node_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = function makeNodeTree(destinationPath) {
allowNonTsExtensions: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
declaration: false,
declaration: true,
stripInternal: true,
mapRoot: '', /* force sourcemaps to use relative path */
module: 'CommonJS',
moduleResolution: 1 /* classic */,
Expand Down Expand Up @@ -77,7 +78,10 @@ module.exports = function makeNodeTree(destinationPath) {
packageJsons =
renderLodashTemplate(packageJsons, {context: {'packageJson': COMMON_PACKAGE_JSON}});

var nodeTree = mergeTrees([typescriptTree, docs, packageJsons]);
var typingsTree = new Funnel(
'modules',
{include: ['angular2/typings/**/*.d.ts', 'angular2/manual_typings/*.d.ts'], destDir: '/'});
var nodeTree = mergeTrees([typescriptTree, docs, packageJsons, typingsTree]);

// Transform all tests to make them runnable in node
nodeTree = replace(nodeTree, {
Expand All @@ -101,5 +105,21 @@ module.exports = function makeNodeTree(destinationPath) {
patterns: [{match: /^/, replacement: function() { return `'use strict';` }}]
});

// Add a line to the end of our top-level .d.ts file.
// This HACK for transitive typings is a workaround for
// https://github.com/Microsoft/TypeScript/issues/5097
//
// This allows users to get our top-level dependencies like es6-shim.d.ts
// to appear when they compile against angular2.
//
// This carries the risk that the user brings their own copy of that file
// (or any other symbols exported here) and they will get a compiler error
// because of the duplicate definitions.
// TODO(alexeagle): remove this when typescript releases a fix
nodeTree = replace(nodeTree, {
files: ['angular2/angular2.d.ts'],
patterns: [{match: /$/, replacement: 'import "./manual_typings/globals.d.ts";\n'}]
});

return destCopy(nodeTree, destinationPath);
};