refactor(build): simplify and modularize
simplify: - use same html file for dart and JS - build benchmarks automatically when doing `gulp build` - centralize configuration modularize: - move all build tasks into separate node.js modules under `tools/build`. changes: - the `build` folder is now the `dist` folder Closes #284
This commit is contained in:
@ -12,3 +12,6 @@ dependencies:
|
||||
path: ../core
|
||||
change_detection:
|
||||
path: ../change_detection
|
||||
benchpress:
|
||||
path: ../benchpress
|
||||
browser: '>=0.10.0 <0.11.0'
|
||||
|
@ -1,8 +0,0 @@
|
||||
library benchmark;
|
||||
|
||||
import './change_detection_benchmark.dart' as cdb;
|
||||
import 'dart:js' as js;
|
||||
|
||||
main () {
|
||||
cdb.run();
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
System.import('benchmarks/change_detection/change_detection_benchmark').then(function (bm) {
|
||||
bm.run();
|
||||
}, console.log.bind(console));
|
@ -1,11 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{src: '/js/traceur-runtime.js'},
|
||||
{src: '/js/es6-module-loader-sans-promises.src.js'},
|
||||
{src: '/js/extension-register.js'},
|
||||
{src: 'register_system.js'},
|
||||
{src: 'benchmark.js'}
|
||||
]
|
||||
});
|
||||
};
|
@ -3,7 +3,7 @@ import {Parser} from 'change_detection/parser/parser';
|
||||
import {Lexer} from 'change_detection/parser/lexer';
|
||||
import {reflector} from 'reflection/reflection';
|
||||
import {isPresent} from 'facade/lang';
|
||||
import {benchmark, benchmarkStep} from '../benchpress';
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
import {
|
||||
ChangeDetector,
|
||||
@ -153,7 +153,7 @@ function setUpChangeDetection() {
|
||||
return new ChangeDetector(parentRange);
|
||||
}
|
||||
|
||||
export function run () {
|
||||
export function main () {
|
||||
setUpReflector();
|
||||
|
||||
benchmark(`Baseline`, function () {
|
||||
|
@ -0,0 +1 @@
|
||||
$SCRIPTS$
|
1
modules/benchmarks/src/change_detection/main.js
Normal file
1
modules/benchmarks/src/change_detection/main.js
Normal file
@ -0,0 +1 @@
|
||||
export {main} from './change_detection_benchmark';
|
@ -1,11 +0,0 @@
|
||||
System.paths = {
|
||||
'core/*': '/js/core/lib/*.js',
|
||||
'change_detection/*': '/js/change_detection/lib/*.js',
|
||||
'facade/*': '/js/facade/lib/*.js',
|
||||
'di/*': '/js/di/lib/*.js',
|
||||
'rtts_assert/*': '/js/rtts_assert/lib/*.js',
|
||||
'test_lib/*': '/js/test_lib/lib/*.js',
|
||||
'benchmarks/*': '/js/benchmarks/lib/*.js',
|
||||
'reflection/*': '/js/reflection/lib/*.js'
|
||||
};
|
||||
register(System);
|
@ -1,9 +0,0 @@
|
||||
library compiler_benchmark;
|
||||
|
||||
import './selector_benchmark.dart' as sbm;
|
||||
import './compiler_benchmark.dart' as cbm;
|
||||
|
||||
main () {
|
||||
sbm.main();
|
||||
cbm.main();
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
Promise.all([
|
||||
System.import('benchmarks/compiler/selector_benchmark'),
|
||||
System.import('benchmarks/compiler/compiler_benchmark')
|
||||
]).then(function (benchmarks) {
|
||||
benchmarks.forEach(function(bm) {
|
||||
bm.main();
|
||||
});
|
||||
}, console.log.bind(console));
|
@ -1,11 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{src: '/js/traceur-runtime.js'},
|
||||
{src: '/js/es6-module-loader-sans-promises.src.js'},
|
||||
{src: '/js/extension-register.js'},
|
||||
{src: 'register_system.js'},
|
||||
{src: 'benchmark.js'}
|
||||
]
|
||||
});
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
import {benchmark, benchmarkStep} from '../benchpress';
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
import {DOM, document} from 'facade/dom';
|
||||
import {isBlank} from 'facade/lang';
|
||||
import {isBlank, Type} from 'facade/lang';
|
||||
import {MapWrapper} from 'facade/collection';
|
||||
import {AnnotatedType} from 'core/compiler/annotated_type';
|
||||
|
||||
@ -61,7 +61,7 @@ function setup() {
|
||||
});
|
||||
|
||||
reflector.registerGetters({
|
||||
"inter0": (a) => a.inter0, "inter1": (a) => a.inter1,
|
||||
"inter0": (a) => a.inter0, "inter1": (a) => a.inter1,
|
||||
"inter2": (a) => a.inter2, "inter3": (a) => a.inter3, "inter4": (a) => a.inter4,
|
||||
|
||||
"value0": (a) => a.value0, "value1": (a) => a.value1,
|
||||
@ -111,7 +111,7 @@ export function main() {
|
||||
benchmark(`instantiate 5*${COUNT} element with bindings`, function() {
|
||||
var template = loadTemplate('templateWithBindings', COUNT);
|
||||
var protoView = compiler.compileWithCache(null, annotatedComponent, template);
|
||||
var rootRecordRange = new ProtoRecordRange().instantiate(null, new Object());
|
||||
var rootRecordRange = new ProtoRecordRange().instantiate(null, null);
|
||||
|
||||
benchmarkStep('run', function() {
|
||||
var view = protoView.instantiate(null, null, null);
|
||||
|
@ -1,3 +1,5 @@
|
||||
$SCRIPTS$
|
||||
|
||||
<template id="templateNoBindings">
|
||||
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
|
||||
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
|
||||
|
7
modules/benchmarks/src/compiler/main.js
Normal file
7
modules/benchmarks/src/compiler/main.js
Normal file
@ -0,0 +1,7 @@
|
||||
import * as sbm from './selector_benchmark';
|
||||
import * as cbm from './compiler_benchmark';
|
||||
|
||||
export function main() {
|
||||
sbm.main();
|
||||
cbm.main();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
System.paths = {
|
||||
'core/*': '/js/core/lib/*.js',
|
||||
'change_detection/*': '/js/change_detection/lib/*.js',
|
||||
'facade/*': '/js/facade/lib/*.js',
|
||||
'di/*': '/js/di/lib/*.js',
|
||||
'rtts_assert/*': '/js/rtts_assert/lib/*.js',
|
||||
'test_lib/*': '/js/test_lib/lib/*.js',
|
||||
'benchmarks/*': '/js/benchmarks/lib/*.js',
|
||||
'reflection/*': '/js/reflection/lib/*.js'
|
||||
};
|
||||
register(System);
|
@ -1,4 +1,4 @@
|
||||
import {benchmark, benchmarkStep} from '../benchpress';
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
import {SelectorMatcher} from "core/compiler/selector";
|
||||
import {CssSelector} from "core/compiler/selector";
|
||||
|
@ -1,11 +0,0 @@
|
||||
library injector_get_benchmark;
|
||||
|
||||
import './injector_instantiate_benchmark.dart' as b;
|
||||
import 'dart:js' as js;
|
||||
|
||||
main () {
|
||||
js.context['benchmarkSteps'].add(new js.JsObject.jsify({
|
||||
"name": "Injector.instantiate",
|
||||
"fn": new js.JsFunction.withThis((_) => b.run())
|
||||
}));
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
System.import('benchmarks/di/injector_get_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'Injector.get (token)', fn: bm.run});
|
||||
}, console.log.bind(console));
|
||||
|
||||
System.import('benchmarks/di/injector_get_by_key_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'Injector.get (key)', fn: bm.run});
|
||||
}, console.log.bind(console));
|
||||
|
||||
System.import('benchmarks/di/injector_get_child_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'Injector.get (grand x 5 child)', fn: bm.run});
|
||||
}, console.log.bind(console));
|
||||
|
||||
System.import('benchmarks/di/injector_instantiate_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'Injector.instantiate', fn: bm.run});
|
||||
}, console.log.bind(console));
|
@ -1,11 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{src: '/js/traceur-runtime.js'},
|
||||
{src: '/js/es6-module-loader-sans-promises.src.js'},
|
||||
{src: '/js/extension-register.js'},
|
||||
{src: 'register_system.js'},
|
||||
{src: 'benchmark.js'}
|
||||
]
|
||||
});
|
||||
};
|
@ -0,0 +1 @@
|
||||
$SCRIPTS$
|
24
modules/benchmarks/src/di/main.js
Normal file
24
modules/benchmarks/src/di/main.js
Normal file
@ -0,0 +1,24 @@
|
||||
import * as injector_get_benchmark from './injector_get_benchmark';
|
||||
import * as injector_get_by_key_benchmark from './injector_get_by_key_benchmark';
|
||||
import * as injector_get_child_benchmark from './injector_get_child_benchmark';
|
||||
import * as injector_instantiate_benchmark from './injector_instantiate_benchmark';
|
||||
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
export function main() {
|
||||
benchmark(`Injector.get (token)`, function() {
|
||||
benchmarkStep('run', injector_get_benchmark.run);
|
||||
});
|
||||
|
||||
benchmark(`Injector.get (key)`, function() {
|
||||
benchmarkStep('run', injector_get_by_key_benchmark.run);
|
||||
});
|
||||
|
||||
benchmark(`Injector.get (grand x 5 child)`, function() {
|
||||
benchmarkStep('run', injector_get_child_benchmark.run);
|
||||
});
|
||||
|
||||
benchmark(`Injector.instantiate`, function() {
|
||||
benchmarkStep('run', injector_instantiate_benchmark.run);
|
||||
});
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
System.paths = {
|
||||
'core/*': '/js/core/lib/*.js',
|
||||
'change_detection/*': '/js/change_detection/lib/*.js',
|
||||
'facade/*': '/js/facade/lib/*.js',
|
||||
'di/*': '/js/di/lib/*.js',
|
||||
'rtts_assert/*': '/js/rtts_assert/lib/*.js',
|
||||
'test_lib/*': '/js/test_lib/lib/*.js',
|
||||
'benchmarks/*': '/js/benchmarks/lib/*.js',
|
||||
'reflection/*': '/js/reflection/lib/*.js'
|
||||
};
|
||||
register(System);
|
@ -1,23 +0,0 @@
|
||||
library element_injector_benchmark;
|
||||
|
||||
import './instantiate_benchmark.dart' as ib;
|
||||
import './instantiate_benchmark_codegen.dart' as ibc;
|
||||
import './instantiate_directive_benchmark.dart' as idb;
|
||||
import 'dart:js' as js;
|
||||
|
||||
main () {
|
||||
js.context['benchmarkSteps'].add(new js.JsObject.jsify({
|
||||
"name": "ElementInjector.instantiate + instantiateDirectives",
|
||||
"fn": new js.JsFunction.withThis((_) => ib.run())
|
||||
}));
|
||||
|
||||
js.context['benchmarkSteps'].add(new js.JsObject.jsify({
|
||||
"name": "ElementInjector.instantiateDirectives",
|
||||
"fn": new js.JsFunction.withThis((_) => idb.run())
|
||||
}));
|
||||
|
||||
js.context['benchmarkSteps'].add(new js.JsObject.jsify({
|
||||
"name": "ElementInjector.instantiate + instantiateDirectives (codegen)",
|
||||
"fn": new js.JsFunction.withThis((_) => ibc.run())
|
||||
}));
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
System.import('benchmarks/element_injector/instantiate_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'ElementInjector.instantiate + instantiateDirectives', fn: bm.run});
|
||||
}, console.log.bind(console));
|
||||
|
||||
System.import('benchmarks/element_injector/instantiate_directive_benchmark').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'ElementInjector.instantiateDirectives', fn: bm.run});
|
||||
}, console.log.bind(console));
|
||||
|
||||
System.import('benchmarks/element_injector/instantiate_benchmark_codegen').then(function (bm) {
|
||||
window.benchmarkSteps.push({name: 'ElementInjector.instantiate + instantiateDirectives (codegen)', fn: bm.run});
|
||||
}, console.log.bind(console));
|
@ -1,11 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{src: '/js/traceur-runtime.js'},
|
||||
{src: '/js/es6-module-loader-sans-promises.src.js'},
|
||||
{src: '/js/extension-register.js'},
|
||||
{src: 'register_system.js'},
|
||||
{src: 'benchmark.js'}
|
||||
]
|
||||
});
|
||||
};
|
@ -0,0 +1 @@
|
||||
$SCRIPTS$
|
19
modules/benchmarks/src/element_injector/main.js
Normal file
19
modules/benchmarks/src/element_injector/main.js
Normal file
@ -0,0 +1,19 @@
|
||||
import * as instantiate_benchmark from './instantiate_benchmark';
|
||||
import * as instantiate_directive_benchmark from './instantiate_directive_benchmark';
|
||||
import * as instantiate_benchmark_codegen from './instantiate_benchmark_codegen';
|
||||
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
export function main() {
|
||||
benchmark(`ElementInjector.instantiate + instantiateDirectives`, function() {
|
||||
benchmarkStep('run', instantiate_benchmark.run);
|
||||
});
|
||||
|
||||
benchmark(`ElementInjector.instantiateDirectives`, function() {
|
||||
benchmarkStep('run', instantiate_directive_benchmark.run);
|
||||
});
|
||||
|
||||
benchmark(`ElementInjector.instantiate + instantiateDirectives (codegen)`, function() {
|
||||
benchmarkStep('run', instantiate_benchmark_codegen.run);
|
||||
});
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
System.paths = {
|
||||
'core/*': '/js/core/lib/*.js',
|
||||
'change_detection/*': '/js/change_detection/lib/*.js',
|
||||
'facade/*': '/js/facade/lib/*.js',
|
||||
'di/*': '/js/di/lib/*.js',
|
||||
'rtts_assert/*': '/js/rtts_assert/lib/*.js',
|
||||
'test_lib/*': '/js/test_lib/lib/*.js',
|
||||
'benchmarks/*': '/js/benchmarks/lib/*.js',
|
||||
'reflection/*': '/js/reflection/lib/*.js'
|
||||
};
|
||||
register(System);
|
@ -3,3 +3,5 @@ environment:
|
||||
sdk: '>=1.4.0'
|
||||
dependencies:
|
||||
angular: ">=1.0.0 <2.0.0"
|
||||
benchpress:
|
||||
path: ../benchpress
|
||||
|
@ -1,63 +0,0 @@
|
||||
library benchmarks.benchpress;
|
||||
|
||||
import 'dart:js' as js;
|
||||
import 'dart:html';
|
||||
import 'dart:async';
|
||||
|
||||
// TODO: move the functionality of this module into benchpress and replace this
|
||||
// file with a Dart wrapper!
|
||||
|
||||
var _benchmarkNames = [];
|
||||
|
||||
_benchmarkId(index) {
|
||||
return "benchmark${index}";
|
||||
}
|
||||
|
||||
_useBenchmark(index) {
|
||||
var search = window.location.search;
|
||||
if (search.length > 0) {
|
||||
search = search.substring(1);
|
||||
}
|
||||
if (search.length > 0) {
|
||||
return search == _benchmarkId(index);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_onLoad(callback) {
|
||||
var isReady = document.readyState == 'complete';
|
||||
if (isReady) {
|
||||
Timer.run(callback);
|
||||
} else {
|
||||
window.addEventListener('load', (event) => callback(), false);
|
||||
}
|
||||
}
|
||||
|
||||
_createBenchmarkMenu() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHtml += '<h1>Benchmarks:</h1><a class="btn btn-default" href="?">All</a>';
|
||||
for (var i=0; i<_benchmarkNames.length; i++) {
|
||||
var activeClass = _useBenchmark(i) ? 'active' : '';
|
||||
div.innerHtml += '<a class="btn btn-default ${activeClass}" href="?${_benchmarkId(i)}">${_benchmarkNames[i]}</a>';
|
||||
}
|
||||
document.body.insertBefore(div, document.body.childNodes[0]);
|
||||
}
|
||||
|
||||
benchmark(name, stepsCreationCallback) {
|
||||
_benchmarkNames.add(name);
|
||||
if (_benchmarkNames.length == 2) {
|
||||
_onLoad(_createBenchmarkMenu);
|
||||
}
|
||||
if (_useBenchmark(_benchmarkNames.length-1)) {
|
||||
stepsCreationCallback();
|
||||
}
|
||||
}
|
||||
|
||||
benchmarkStep(name, callback) {
|
||||
var benchmarkName = _benchmarkNames[_benchmarkNames.length-1];
|
||||
js.context['benchmarkSteps'].add(new js.JsObject.jsify({
|
||||
"name": benchmarkName + '#' + name,
|
||||
"fn": new js.JsFunction.withThis((_) => callback())
|
||||
}));
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
// TODO: move the functionality of this module into benchpress itself!
|
||||
|
||||
var benchmarkNames = [];
|
||||
|
||||
function benchmarkId(index) {
|
||||
return 'benchmark' + index;
|
||||
}
|
||||
|
||||
function useBenchmark(index) {
|
||||
var search = window.location.search;
|
||||
if (search.length > 0) {
|
||||
search = search.substring(1);
|
||||
}
|
||||
if (search.length > 0) {
|
||||
return search == benchmarkId(index);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function onLoad(callback) {
|
||||
var isReady = document.readyState === 'complete';
|
||||
if (isReady) {
|
||||
window.setTimeout(callback);
|
||||
} else {
|
||||
window.addEventListener('load', callback, false);
|
||||
}
|
||||
}
|
||||
|
||||
function createBenchmarkMenu() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML += '<h1>Benchmarks:</h1><a class="btn btn-default" href="?">All</a>';
|
||||
for (var i=0; i<benchmarkNames.length; i++) {
|
||||
var activeClass = useBenchmark(i) ? 'active' : '';
|
||||
div.innerHTML += ('<a class="btn btn-default '+activeClass+'" href="?'+benchmarkId(i)+'">'+benchmarkNames[i]+'</a>');
|
||||
}
|
||||
document.body.insertBefore(div, document.body.childNodes[0]);
|
||||
}
|
||||
|
||||
export function benchmark(name, stepsCreationCallback) {
|
||||
benchmarkNames.push(name);
|
||||
if (benchmarkNames.length === 2) {
|
||||
onLoad(createBenchmarkMenu);
|
||||
}
|
||||
if (useBenchmark(benchmarkNames.length-1)) {
|
||||
stepsCreationCallback();
|
||||
}
|
||||
}
|
||||
|
||||
export function benchmarkStep(name, callback) {
|
||||
var benchmarkName = benchmarkNames[benchmarkNames.length-1];
|
||||
window.benchmarkSteps.push({
|
||||
name: benchmarkName + '#' + name, fn: callback
|
||||
});
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
Promise.all([
|
||||
System.import('benchmarks_external/compiler/compiler_benchmark_ng13')
|
||||
]).then(function (benchmarks) {
|
||||
benchmarks.forEach(function(bm) {
|
||||
bm.main();
|
||||
});
|
||||
}, console.log.bind(console));
|
@ -1,12 +0,0 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{src: '/js/traceur-runtime.js'},
|
||||
{src: '/js/es6-module-loader-sans-promises.src.js'},
|
||||
{src: '/js/extension-register.js'},
|
||||
{src: 'register_system.js'},
|
||||
{src: 'https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.js'},
|
||||
{src: 'benchmark.js'}
|
||||
]
|
||||
});
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
import 'package:angular/angular.dart';
|
||||
import 'package:angular/application_factory_static.dart';
|
||||
import '../benchpress.dart';
|
||||
import 'package:benchpress/benchpress.dart';
|
||||
import 'dart:html';
|
||||
|
||||
var COUNT = 30;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {benchmark, benchmarkStep} from '../benchpress';
|
||||
import {benchmark, benchmarkStep} from 'benchpress/benchpress';
|
||||
|
||||
var COUNT = 30;
|
||||
var $compile;
|
||||
|
1
modules/benchmarks_external/src/compiler/main.es6
Normal file
1
modules/benchmarks_external/src/compiler/main.es6
Normal file
@ -0,0 +1 @@
|
||||
export {main} from './compiler_benchmark_ng13';
|
@ -1,3 +1,5 @@
|
||||
$SCRIPTS$
|
||||
|
||||
<template id="templateNoBindings">
|
||||
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
|
||||
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
|
||||
|
@ -1,11 +0,0 @@
|
||||
System.paths = {
|
||||
'core/*': '/js/core/lib/*.js',
|
||||
'change_detection/*': '/js/change_detection/lib/*.js',
|
||||
'facade/*': '/js/facade/lib/*.js',
|
||||
'di/*': '/js/di/lib/*.js',
|
||||
'rtts_assert/*': '/js/rtts_assert/lib/*.js',
|
||||
'test_lib/*': '/js/test_lib/lib/*.js',
|
||||
'benchmarks_external/*': '/js/benchmarks_external/lib/*.js',
|
||||
'reflection/*': '/js/reflection/lib/*.js'
|
||||
};
|
||||
register(System);
|
4
modules/benchpress/pubspec.yaml
Normal file
4
modules/benchpress/pubspec.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
name: benchpress
|
||||
environment:
|
||||
sdk: '>=1.4.0'
|
||||
dependencies:
|
@ -1,23 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<title>Hello Angular 2.0 (JS)</title>
|
||||
<title>Hello Angular 2.0 (Reflection)</title>
|
||||
<body>
|
||||
<hello-app>
|
||||
Loading...
|
||||
</hello-app>
|
||||
|
||||
<script src="../../../traceur-runtime.js"></script>
|
||||
<script src="../../../rtts_assert/lib/rtts_assert.js"></script>
|
||||
<script src="../../../es6-module-loader-sans-promises.src.js"></script>
|
||||
<script src="../../../system.src.js"></script>
|
||||
<script src="../../../extension-register.js"></script>
|
||||
|
||||
<script src="main.js"></script>
|
||||
$SCRIPTS$
|
||||
</body>
|
||||
</html>
|
||||
<!-- to run do:
|
||||
1) gulp build
|
||||
2) gulp serve
|
||||
3) open localhost:8000/js/examples/lib/hello_world/ in chrome.
|
||||
TODO(rado): merge with Darts's index.html in ../../web/
|
||||
-->
|
||||
|
11
modules/examples/src/hello_world/index_static.html
Normal file
11
modules/examples/src/hello_world/index_static.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<title>Hello Angular 2.0 (Static)</title>
|
||||
<body>
|
||||
<hello-app>
|
||||
Loading...
|
||||
</hello-app>
|
||||
|
||||
$SCRIPTS$
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,4 @@
|
||||
import * as app from './app';
|
||||
import * as app from './index';
|
||||
|
||||
import {Component, Decorator, TemplateConfig, NgElement} from 'core/core';
|
||||
import {Parser} from 'change_detection/parser/parser';
|
@ -1,23 +0,0 @@
|
||||
register(System);
|
||||
|
||||
System.baseURL = '../../../';
|
||||
|
||||
// So that we can import packages like `core/foo`, instead of `core/lib/foo`.
|
||||
System.paths = {
|
||||
'core/*': './core/lib/*.js',
|
||||
'change_detection/*': './change_detection/lib/*.js',
|
||||
'facade/*': './facade/lib/*.js',
|
||||
'di/*': './di/lib/*.js',
|
||||
'reflection/*': './reflection/lib/*.js',
|
||||
'rtts_assert/*': './rtts_assert/lib/*.js',
|
||||
'examples/*': './examples/lib/*.js'
|
||||
};
|
||||
|
||||
|
||||
|
||||
// TODO(rado): templatize and make reusable for all examples
|
||||
System.import('examples/hello_world/app').then(function(m) {
|
||||
m.main();
|
||||
}, function(e) {
|
||||
console.error(e.stack || e);
|
||||
});
|
@ -1,20 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello Angular 2.0 (Dart)</title>
|
||||
<script type="application/dart" src="main.dart"></script>
|
||||
<script src="packages/browser/dart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<hello-app>
|
||||
Loading...
|
||||
</hello-app>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- to run do:
|
||||
1) gulp build
|
||||
2) gulp examples/pub.serve
|
||||
3) open localhost:8080 in dartium or chrome.
|
||||
TODO(rado): merge with JS's index.html in ../src/hello_world/
|
||||
-->
|
@ -1,20 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hello Angular 2.0 (Dart Static)</title>
|
||||
<script type="application/dart" src="main_static.dart"></script>
|
||||
<script src="packages/browser/dart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<hello-app>
|
||||
Loading...
|
||||
</hello-app>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- to run do:
|
||||
1) gulp build
|
||||
2) gulp examples/pub.serve
|
||||
3) open localhost:8080/index_static.html in dartium or chrome.
|
||||
TODO(rado): merge with JS's index.html in ../src/hello_world/
|
||||
-->
|
@ -1,11 +0,0 @@
|
||||
import 'package:examples/hello_world/app.dart' as HelloWorldApp;
|
||||
import 'package:reflection/reflection_capabilities.dart';
|
||||
import 'package:reflection/reflection.dart';
|
||||
|
||||
// TODO(rado): templatize and make reusable for all examples.
|
||||
main() {
|
||||
// enable mirrors and reflection.
|
||||
// see static_app.js for an example of a static app.
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
HelloWorldApp.main();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
import 'packages/examples/hello_world/static_app.dart' as HelloWorldApp;
|
||||
|
||||
// TODO(rado): templatize and make reusable for all examples.
|
||||
main() => HelloWorldApp.main();
|
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* This is a special facade used to bootstrap JS automatically.
|
||||
* (In contrast to door wheere the user needs to explicitly call into angular.)
|
||||
* This file is appened to AngularJS and needs to be written in ES5.
|
||||
*/
|
||||
(function(window, document) {
|
||||
document.addEventListener('DOMContentLoaded', bootstrap, false);
|
||||
function bootstrap() {
|
||||
// TODO(misko): load application factory from the module system.
|
||||
applicationFactory().run();
|
||||
}
|
||||
})(window, document);
|
Reference in New Issue
Block a user