Skip to content

Commit a881f09

Browse files
committed
chore(typings): don't expose es6-shim typing.
Also clean up unused typings generation; we publish the node tree, not browser tree. Fixes angular#4882 Closes angular#4928
1 parent 137549d commit a881f09

2 files changed

Lines changed: 11 additions & 35 deletions

File tree

‎tools/broccoli/trees/browser_tree.ts‎

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
127127

128128
// Use TypeScript to transpile the *.ts files to ES5
129129
var typescriptOptions = {
130-
declaration: true,
131-
stripInternal: true,
130+
declaration: false,
132131
emitDecoratorMetadata: true,
133132
experimentalDecorators: true,
134133
mapRoot: '', // force sourcemaps to use relative path
@@ -231,28 +230,8 @@ module.exports = function makeBrowserTree(options, destinationPath) {
231230

232231
htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);
233232

234-
var typingsTree = new Funnel(
235-
'modules',
236-
{include: ['angular2/typings/**/*.d.ts', 'angular2/manual_typings/*.d.ts'], destDir: '/'});
237-
238-
// Add a line to the end of our top-level .d.ts file.
239-
// This HACK for transitive typings is a workaround for
240-
// https://github.com/Microsoft/TypeScript/issues/5097
241-
//
242-
// This allows users to get our top-level dependencies like es6-shim.d.ts
243-
// to appear when they compile against angular2.
244-
//
245-
// This carries the risk that the user brings their own copy of that file
246-
// (or any other symbols exported here) and they will get a compiler error
247-
// because of the duplicate definitions.
248-
// TODO(alexeagle): remove this when typescript releases a fix
249-
es5Tree = replace(es5Tree, {
250-
files: ['angular2/angular2.d.ts'],
251-
patterns: [{match: /$/, replacement: 'import "./manual_typings/globals.d.ts";\n'}]
252-
});
253-
254-
es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules, typingsTree]);
255-
es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules, typingsTree]);
233+
es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules]);
234+
es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules]);
256235

257236
var mergedTree = mergeTrees([stew.mv(es6Tree, '/es6'), stew.mv(es5Tree, '/es5')]);
258237

‎tools/broccoli/trees/node_tree.ts‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,24 @@ module.exports = function makeNodeTree(destinationPath) {
8888
patterns: [
8989
{
9090
match: /^/,
91-
replacement: function() {
92-
return `var parse5Adapter = require('angular2/src/core/dom/parse5_adapter');\n\r
93-
parse5Adapter.Parse5DomAdapter.makeCurrent();`;
94-
}
91+
replacement:
92+
() => `var parse5Adapter = require('angular2/src/core/dom/parse5_adapter');\r\n` +
93+
`parse5Adapter.Parse5DomAdapter.makeCurrent();`
9594
},
96-
{match: /$/, replacement: function(_, relativePath) { return "\r\n main(); \n\r"; }}
95+
{match: /$/, replacement: (_, relativePath) => "\r\n main(); \r\n"}
9796
]
9897
});
9998

10099
// Prepend 'use strict' directive to all JS files.
101100
// See https://github.com/Microsoft/TypeScript/issues/3576
102-
nodeTree = replace(nodeTree, {
103-
files: ['**/*.js'],
104-
patterns: [{match: /^/, replacement: function() { return `'use strict';` }}]
105-
});
101+
nodeTree = replace(
102+
nodeTree, {files: ['**/*.js'], patterns: [{match: /^/, replacement: () => `'use strict';`}]});
106103

107104
// Add a line to the end of our top-level .d.ts file.
108105
// This HACK for transitive typings is a workaround for
109106
// https://github.com/Microsoft/TypeScript/issues/5097
110107
//
111-
// This allows users to get our top-level dependencies like es6-shim.d.ts
108+
// This allows users to get our top-level dependencies like zone.d.ts
112109
// to appear when they compile against angular2.
113110
//
114111
// This carries the risk that the user brings their own copy of that file
@@ -117,7 +114,7 @@ module.exports = function makeNodeTree(destinationPath) {
117114
// TODO(alexeagle): remove this when typescript releases a fix
118115
nodeTree = replace(nodeTree, {
119116
files: ['angular2/angular2.d.ts'],
120-
patterns: [{match: /$/, replacement: 'import "./manual_typings/globals.d.ts";\n'}]
117+
patterns: [{match: /$/, replacement: 'import "./manual_typings/globals-es6.d.ts";\r\n'}]
121118
});
122119

123120
return destCopy(nodeTree, destinationPath);

0 commit comments

Comments
 (0)