X Tutup
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: 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])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this test now test that we don't have source mapping at all?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, before we did ts -> es6 -> es5 in two shots, and didn't properly merge the sourcemaps for the two jumps. So in the test we had to decode twice (once per transpilation).

Now, we have a direct ts -> es5, so we just need to read in one source map and compare with the original. Notice we read the expected line from modules/examples/src/sourcemap/index.ts

.toMatch(/throw new BaseException\(\'Sourcemap test\'\)/);
});
});
Expand Down
1 change: 1 addition & 0 deletions tools/broccoli/broccoli-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
this.tsOpts = Object.create(options);
this.tsOpts.outDir = this.cachePath;
this.tsOpts.target = (<any>ts).ScriptTarget[options.target];
this.tsOpts.module = (<any>ts).ModuleKind[options.module];
this.tsOpts.experimentalDecorators = true;
this.rootFilePaths = options.rootFilePaths ? options.rootFilePaths.splice(0) : [];
this.tsServiceHost = new CustomLanguageServiceHost(this.tsOpts, this.rootFilePaths,
Expand Down
56 changes: 0 additions & 56 deletions tools/broccoli/traceur/index.ts

This file was deleted.

32 changes: 23 additions & 9 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 @@ -84,6 +84,12 @@ module.exports = function makeBrowserTree(options, destinationPath) {
destDir: '/'
});

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

var scriptPathPatternReplacement = {
match: '@@FILENAME_NO_EXT',
replacement: function(replacement, relativePath) {
Expand All @@ -109,14 +115,22 @@ module.exports = function makeBrowserTree(options, destinationPath) {
target: 'ES6'
});

// Call Traceur to lower the ES6 build tree to ES5
var es5Tree = transpileWithTraceur(es6Tree, {
destExtension: '.js',
destSourceMapExtension: '.js.map',
traceurOptions: {modules: 'instantiate', sourceMaps: true}
// 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: '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 @@ -130,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
2 changes: 1 addition & 1 deletion tools/broccoli/trees/node_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function makeNodeTree(destinationPath) {
experimentalDecorators: true,
declaration: false,
mapRoot: '', /* force sourcemaps to use relative path */
module: 'commonjs',
module: 'CommonJS',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, picked it up from Ian. I believe TS normalizes the string. It would complain if it receives a module format it doesn't recognize. Will revert.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I was wrong, since we don't go through the CLI interface we have to pass a string that is a key in the following const enum https://github.com/Microsoft/TypeScript/blob/master/lib/typescript.d.ts#L1344

noEmitOnError: true,
rootDir: '.',
rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'],
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
X Tutup