Produce .d.ts files from our typescript compilation.
Deliver them into our npm module output so users can consume them directly. Fixes #3082
This commit is contained in:
@ -118,6 +118,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||
mapRoot: '', // force sourcemaps to use relative path
|
||||
noEmitOnError: false,
|
||||
rootDir: '.',
|
||||
rootFilePaths: ['angular2/manual_typings/globals-es6.d.ts'],
|
||||
sourceMap: true,
|
||||
sourceRoot: '.',
|
||||
target: 'ES6'
|
||||
@ -126,7 +127,8 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||
// Use TypeScript to transpile the *.ts files to ES5
|
||||
var typescriptOptions = {
|
||||
allowNonTsExtensions: false,
|
||||
declaration: false,
|
||||
declaration: true,
|
||||
stripInternal: true,
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
mapRoot: '', // force sourcemaps to use relative path
|
||||
@ -134,6 +136,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||
moduleResolution: 1 /* classic */,
|
||||
noEmitOnError: true,
|
||||
rootDir: '.',
|
||||
rootFilePaths: ['angular2/manual_typings/globals.d.ts'],
|
||||
sourceMap: true,
|
||||
sourceRoot: '.',
|
||||
target: 'ES5'
|
||||
@ -228,8 +231,29 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||
|
||||
htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);
|
||||
|
||||
es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules]);
|
||||
es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules]);
|
||||
var typingsTree = new Funnel('modules', {
|
||||
include: ['angular2/typings/**/*.d.ts',
|
||||
'angular2/manual_typings/*.d.ts'],
|
||||
destDir: '/'});
|
||||
|
||||
// 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
|
||||
es5Tree = replace(es5Tree, {
|
||||
files: ['angular2/angular2.d.ts'],
|
||||
patterns: [{match: /$/, replacement: 'import "./manual_typings/globals.d.ts";\n'}]
|
||||
});
|
||||
|
||||
es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules, typingsTree]);
|
||||
es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules, typingsTree]);
|
||||
|
||||
var mergedTree = mergeTrees([stew.mv(es6Tree, '/es6'), stew.mv(es5Tree, '/es5')]);
|
||||
|
||||
|
@ -41,7 +41,7 @@ module.exports = function makeNodeTree(destinationPath) {
|
||||
moduleResolution: 1 /* classic */,
|
||||
noEmitOnError: true,
|
||||
rootDir: '.',
|
||||
rootFilePaths: ['angular2/manual_typings/globals.d.ts'],
|
||||
rootFilePaths: ['angular2/manual_typings/globals.d.ts', 'angular2/typings/es6-shim/es6-shim.d.ts'],
|
||||
sourceMap: true,
|
||||
sourceRoot: '.',
|
||||
target: 'ES5'
|
||||
|
Reference in New Issue
Block a user