Skip to content

Commit

Permalink
fix(build): switch to cjs output for es5.
Browse files Browse the repository at this point in the history
System output does not work at the current versions of TS and
system.js. Will revisit after upgrading TS.

Removes unused traceur tooling.

Closes #3974
  • Loading branch information
rkirov committed Sep 4, 2015
1 parent b025f94 commit e9ad100
Show file tree
Hide file tree
Showing 39 changed files with 25 additions and 1,243 deletions.
2 changes: 0 additions & 2 deletions docs/docs-package/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('../../tools/transpiler/index.js').init();

var Package = require('dgeni').Package;
var jsdocPackage = require('dgeni-packages/jsdoc');
var nunjucksPackage = require('dgeni-packages/nunjucks');
Expand Down
2 changes: 0 additions & 2 deletions docs/typescript-package/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('../../tools/transpiler/index.js').init();

var basePackage = require('dgeni-packages/base');
var Package = require('dgeni').Package;
var path = require('canonical-path');
Expand Down
1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var licenseWrap = require('./tools/build/licensewrap');

var watch = require('./tools/build/watch');

var transpile = require('./tools/build/transpile');
var pubget = require('./tools/build/pubget');
var linknodemodules = require('./tools/build/linknodemodules');
var pubbuild = require('./tools/build/pubbuild');
Expand Down
15 changes: 7 additions & 8 deletions karma-js.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ module.exports = function(config) {
'node_modules/reflect-metadata/Reflect.js',
'tools/build/file2modulename.js',
'test-main.js',
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false}
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false}
],

exclude: [
'dist/js/dev/es5/**/e2e_test/**',
'dist/js/dev/es5/rtts_assert/**',
'dist/angular1_router.js'
],

Expand All @@ -40,11 +41,11 @@ module.exports = function(config) {
startConnect: false,
recordVideo: false,
recordScreenshots: false,
options: {
'selenium-version': '2.45.0',
'command-timeout': 600,
'idle-timeout': 600,
'max-duration': 5400
options: {
'selenium-version': '2.45.0',
'command-timeout': 600,
'idle-timeout': 600,
'max-duration': 5400
}
},

Expand All @@ -62,5 +63,3 @@ module.exports = function(config) {
config.transports = ['xhr-polling'];
}
};


7 changes: 6 additions & 1 deletion modules/angular2/test/compiler/eval_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export function evalModule(moduleSource: string, moduleImports: string[][], args
var modName = sourceImport[0];
var modAlias = sourceImport[1];
importModuleNames.push(modName);
moduleSourceWithImports.push(`var ${modAlias} = require('${modName}');`);
// Note: After transpilation to commonJS and loading this file in a browser
// using SystemJS, the loader might get confused by the presence of require,
// and attempt to load "+ modName +.js" !?!
// A simple string concat manages to prevent that, but that is one compiler
// optimaztion away from breaking again. Proceed with caution!
moduleSourceWithImports.push(`var ${modAlias} = require` + `('${modName}');`);
});
moduleSourceWithImports.push(moduleSource);

Expand Down
23 changes: 0 additions & 23 deletions modules/angular2_material/src/components/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,3 @@ export class MdInput {
ObservableWrapper.callNext(this.mdFocusChange, hasFocus);
}
}

/*
@Directive({
selector: 'md-input-container textarea',
events: ['mdChange', 'mdFocusChange'],
hostProperties: {
'yes': 'class.md-input'
},
hostListeners: {
'input': 'updateValue($event)',
'focus': 'setHasFocus(true)',
'blur': 'setHasFocus(false)'
}
})
export class MdTextarea extends MdInput {
constructor(
@Attribute('value') value: string,
@SkipSelf() @Host() container: MdInputContainer,
@Attribute('id') id: string) {
super(value, container, id);
}
}
*/
2 changes: 1 addition & 1 deletion modules/benchmarks_external/src/tree/react/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tree benchmark in React
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
import React from './react.min';
import * as React from './react.min';

var TreeComponent = React.createClass({
displayName: 'TreeComponent',
Expand Down
4 changes: 2 additions & 2 deletions modules/benchmarks_external/src/tree/react/react.min.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare var React: any;
export default React;
export var createElement: Function;
export var render: Function;
7 changes: 1 addition & 6 deletions modules/examples/e2e_test/sourcemap/sourcemap_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,10 @@ describe('sourcemaps', function() {

var originalPosition = decoder.originalPositionFor({line: errorLine, column: errorColumn});

var finalMapData = fs.readFileSync('dist/js/prod/es6/examples/src/sourcemap/index.js.map');
var finalDecoder = new sourceMap.SourceMapConsumer(JSON.parse(finalMapData));

var finalPosition = finalDecoder.originalPositionFor(originalPosition);

var sourceCodeLines =
fs.readFileSync('modules/examples/src/sourcemap/index.ts', {encoding: 'UTF-8'})
.split('\n');
expect(sourceCodeLines[finalPosition.line - 1])
expect(sourceCodeLines[originalPosition.line - 1])
.toMatch(/throw new BaseException\(\'Sourcemap test\'\)/);
});
});
Expand Down
56 changes: 0 additions & 56 deletions tools/broccoli/traceur/index.ts

This file was deleted.

19 changes: 8 additions & 11 deletions tools/broccoli/trees/browser_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

var Funnel = require('broccoli-funnel');
var htmlReplace = require('../html-replace');
var jsReplace = require("../js-replace");
var jsReplace = require('../js-replace');
var path = require('path');
var stew = require('broccoli-stew');
var traceur = require('traceur');

import compileWithTypescript from '../broccoli-typescript';
import destCopy from '../broccoli-dest-copy';
import flatten from '../broccoli-flatten';
import mergeTrees from '../broccoli-merge-trees';
import replace from '../broccoli-replace';
import {default as transpileWithTraceur, TRACEUR_RUNTIME_PATH} from '../traceur/index';


var projectRootDir = path.normalize(path.join(__dirname, '..', '..', '..', '..'));
Expand Down Expand Up @@ -83,13 +83,10 @@ module.exports = function makeBrowserTree(options, destinationPath) {
],
destDir: '/'
});

var es5ModulesTree = new Funnel('modules', {
include: ['**/**'],
exclude: [
'**/*.cjs',
'benchmarks/e2e_test/**'
],
exclude: ['**/*.cjs', 'angular1_router/**', 'benchmarks/e2e_test/**'],
destDir: '/'
});

Expand Down Expand Up @@ -117,23 +114,23 @@ module.exports = function makeBrowserTree(options, destinationPath) {
sourceRoot: '.',
target: 'ES6'
});

// Use TypeScript to transpile the *.ts files to ES5
var es5Tree = compileWithTypescript(es5ModulesTree, {
allowNonTsExtensions: false,
declaration: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
mapRoot: '', // force sourcemaps to use relative path
module: 'System',
module: 'CommonJS',
noEmitOnError: false,
rootDir: '.',
sourceMap: true,
sourceRoot: '.',
target: 'ES5'
});

// Now we add a few more files to the es6 tree that Traceur should not see
// Now we add a few more files to the es6 tree that the es5 tree should not see
['angular2', 'rtts_assert'].forEach(function(destDir) {
var extras = new Funnel('tools/build', {files: ['es5build.js'], destDir: destDir});
es6Tree = mergeTrees([es6Tree, extras]);
Expand All @@ -147,7 +144,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
'node_modules/rx/dist/rx.js',
'node_modules/base64-js/lib/b64.js',
'node_modules/reflect-metadata/Reflect.js',
path.relative(projectRootDir, TRACEUR_RUNTIME_PATH)
path.relative(projectRootDir, traceur.RUNTIME_PATH)
]
}));

Expand Down
16 changes: 0 additions & 16 deletions tools/build/transpile.js

This file was deleted.

62 changes: 0 additions & 62 deletions tools/transpiler/gulp-traceur.js

This file was deleted.

Loading

0 comments on commit e9ad100

Please sign in to comment.