Skip to content

Commit 2c9e6ba

Browse files
authored
Merge branch 'master' into master
2 parents b9bdb14 + 1f01634 commit 2c9e6ba

File tree

10 files changed

+84
-112
lines changed

10 files changed

+84
-112
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- [Meteor Blog](https://info.meteor.com/blog)
2929
- [Official Meteor guide for best practices](http://guide.meteor.com/)
3030
- [Awesome Meteor](https://github.com/Urigo/awesome-meteor) - Curated, community driven list of Meteor resources
31-
- Starters - [Angular2-Meteor Base](https://github.com/bsliran/angular2-meteor-base), [angular1-meteor Yeoman generator](https://github.com/ndxbxrme/generator-angular-meteor)
31+
- Starters - [Angular-Meteor Base](https://github.com/Urigo/angular-meteor-base), [angular1-meteor Yeoman generator](https://github.com/ndxbxrme/generator-angular-meteor)
3232
- Track Roadmap here: [angular-meteor milestones](https://github.com/Urigo/angular-meteor/milestones), [Meteor issues related to Angular](https://github.com/meteor/meteor/labels/Project%3AAngular)
3333

3434
## Usage
@@ -41,17 +41,15 @@ If you are new to Angular and/or Meteor but want to learn them quickly,
4141
please check out our 14-steps Angular-Meteor [tutorial](https://angular-meteor.com/tutorials/whatsapp2-tutorial).
4242

4343
## Quick Start Using Angular-Meteor
44-
```
45-
$ meteor create --example angular2-boilerplate myApp
44+
45+
```bash
46+
$ git clone https://github.com/Urigo/angular-meteor-base myApp
4647
$ cd myApp
4748
$ meteor npm install
4849
```
4950

50-
> Alternatively, use your web browser to access the link:
51-
> https://github.com/Urigo/angular2-meteor-base
52-
> Download the template application, and unzip the files inside.
53-
5451
Then run:
52+
5553
```
5654
$ meteor
5755
```

atmosphere-packages/angular-compilers/plugin/register.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ if(process.env.BLAZE){
2020

2121
let aot = ((process.env.NODE_ENV == 'production') && (process.env.AOT != '0')) || process.env.AOT == '1';
2222
let rollup = (process.env.ROLLUP == '1');
23-
23+
let compiler, compilerCli;
2424
try{
2525
if(aot){
26-
require('@angular/compiler');
27-
require('@angular/compiler-cli');
26+
compiler = require('@angular/compiler');
27+
compilerCli = require('@angular/compiler-cli');
2828
}
2929
}catch(e){
3030
console.log('@angular/compiler and @angular/compiler-cli must be installed for AOT compilation!');
@@ -40,7 +40,9 @@ Plugin.registerCompiler({
4040
filenames: ['tsconfig.json']
4141
}, () => new AngularTsCompiler({
4242
aot,
43-
rollup
43+
rollup,
44+
compiler,
45+
compilerCli
4446
}));
4547
Plugin.registerCompiler({
4648
extensions: [templateExtension]

atmosphere-packages/angular-typescript-compiler/index.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ import {
2828

2929
// using: regex, capture groups, and capture group variables.
3030

31-
32-
const TEMPLATE_URL_REGEX = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*([,}]))/gm;
33-
const STYLES_URLS_REGEX = /styleUrls *:(\s*\[[^\]]*?\])/g;
3431
const LOAD_CHILDREN_REGEX = /loadChildren\s*:(\s*['"`](.*?)['"`]\s*([,}]))/gm;
3532
const STRING_REGEX = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
3633

@@ -66,12 +63,12 @@ const ngcOptions = {
6663
};
6764

6865
export class AngularTsCompiler {
69-
constructor({aot, rollup}){
66+
constructor({aot, rollup, compiler, compilerCli}){
7067
this.isAot = aot;
7168
this.isRollup = rollup;
7269
if(this.isAot){
73-
this.compiler = require('@angular/compiler');
74-
this.compilerCli = require ('@angular/compiler-cli');
70+
this.compiler = compiler;
71+
this.compilerCli = compilerCli;
7572
}
7673

7774
}
@@ -92,7 +89,6 @@ export class AngularTsCompiler {
9289

9390
if (fakeLoaderCode){
9491
newSource = fakeLoaderCode + '\n' + newSource;
95-
console.log(newSource);
9692
}
9793

9894
return newSource;
@@ -103,15 +99,19 @@ export class AngularTsCompiler {
10399

104100
return code.replace(LOAD_CHILDREN_REGEX,
105101
(match, url) => {
106-
url = url.split('\'').join('').split('"').join('').split(',').join('');
102+
url = url.split('\'').join('').split('"').join('').split(',').join('').split('}').join('');
107103
const urlArr = url.split('#');
108104
let modulePath = urlArr[0].trim();
109105
let moduleName = urlArr[1].trim();
110106
if(this.isAot){
111107
modulePath += '.ngfactory';
112108
moduleName += 'NgFactory';
113109
}
114-
return `loadChildren: () => module.dynamicImport('${modulePath}').then(allModule => allModule['${moduleName}']),`;
110+
let finalReplacement = `loadChildren: () => module.dynamicImport('${modulePath}').then(allModule => allModule['${moduleName}']),`;
111+
if(curlyBracesAtTheEnd){
112+
finalReplacement += '}'
113+
}
114+
return finalReplacement;
115115
});
116116

117117
}
@@ -121,13 +121,8 @@ export class AngularTsCompiler {
121121
(match, quote, url) => `'${(firstSlash ? '/' : '~/../') + path.join(basePath, url)}'`)
122122
.replace(/\\/g, '/');
123123
}
124-
fixResourceUrls(source, basePath) {
125-
const newSource = source
126-
.replace(TEMPLATE_URL_REGEX,
127-
(match, url) => `templateUrl:${this.replaceStringsWithFullUrls(basePath, url, false)}`)
128-
.replace(STYLES_URLS_REGEX,
129-
(match, urls) => `styleUrls:${this.replaceStringsWithFullUrls(basePath, urls, false)}`);
130-
return newSource;
124+
addModuleIdForComponent(code){
125+
return code.replace('Component({', 'Component({ moduleId: module.id,');
131126
}
132127
processFilesForTarget(inputFiles) {
133128
const filesMap = new Map();
@@ -253,7 +248,7 @@ export class AngularTsCompiler {
253248
}
254249
const basePath = inputFile.getPathInPackage().replace(inputFile.getBasename(), '');
255250
if (!this.isAot) {
256-
code = this.fixResourceUrls(code, basePath)
251+
code = this.addModuleIdForComponent(code, basePath)
257252
}
258253
code = code.split('require("node_modules/').join('require("');
259254
if(this.isRollup){

examples/MeteorCLI/all-in-one/.meteor/versions

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
2-
angular-compilers@0.2.9_3
3-
angular-html-compiler@0.2.9
4-
angular-scss-compiler@0.2.9_1
5-
angular-typescript-compiler@0.2.9_6
2+
angular-compilers@0.3.1_2
3+
angular-html-compiler@0.3.1_2
4+
angular-scss-compiler@0.3.1_2
5+
angular-typescript-compiler@0.3.1_2
66
77
88
@@ -32,8 +32,6 @@ [email protected]
3232
3333
3434
35-
36-
3735
3836
3937
@@ -54,9 +52,6 @@ [email protected]
5452
5553
5654
57-
58-
59-
6055
6156
6257
Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
1-
import { Component, OnInit, OnDestroy } from '@angular/core';
2-
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
3-
import { Title } from '@angular/platform-browser';
4-
5-
import { Subscription } from 'rxjs/Subscription';
1+
import { Component } from '@angular/core';
62

73
@Component({
84
selector: 'app',
95
templateUrl: 'app.html'
106
})
11-
export class AppComponent implements OnInit, OnDestroy {
12-
//Dynamic title change along with router
13-
private titleChangeSubscription: Subscription;
14-
constructor(
15-
private router: Router,
16-
private activatedRoute: ActivatedRoute,
17-
private titleService: Title
18-
) { }
19-
ngOnInit() {
20-
this.titleChangeSubscription =
21-
this.router.events
22-
.filter((event) => event instanceof NavigationEnd)
23-
.map(() => this.activatedRoute)
24-
.map((route) => {
25-
while (route.firstChild) route = route.firstChild;
26-
return route;
27-
})
28-
.filter((route) => route.outlet === 'primary')
29-
.mergeMap((route) => route.data)
30-
.subscribe((event) => this.titleService.setTitle(event['title']));
31-
}
32-
ngOnDestroy() {
33-
this.titleChangeSubscription.unsubscribe();
34-
}
35-
}
7+
export class AppComponent {}

examples/MeteorCLI/all-in-one/imports/app/app.module.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,11 @@ import { PageNotFoundComponent } from './page-not-found/page-not-found.component
2020
RouterModule.forRoot([
2121
{
2222
path: 'todoList',
23-
component: TodoListComponent,
24-
data: {
25-
title: 'Todo List'
26-
}
23+
component: TodoListComponent
2724
},
2825
{
2926
path: 'todoAdd',
30-
loadChildren: './todo-add/todo-add.module#TodoAddModule',
31-
data: {
32-
title: 'Add Todo'
33-
}
27+
loadChildren: './todo-add/todo-add.module#TodoAddModule'
3428
},
3529
// Home Page
3630
{
@@ -41,10 +35,7 @@ import { PageNotFoundComponent } from './page-not-found/page-not-found.component
4135
// 404 Page
4236
{
4337
path: '**',
44-
component: PageNotFoundComponent,
45-
data: {
46-
title: '404 Page Not Found'
47-
}
38+
component: PageNotFoundComponent
4839
}
4940
])
5041
],

examples/MeteorCLI/all-in-one/imports/app/todo-list/todo-list.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ export class TodoListComponent implements OnInit, OnDestroy {
2020
this.todos = Todos.find();
2121
// Subscribe and connect it to Angular's change detection system
2222
// while running on client
23-
if (Meteor.isClient)
23+
if (Meteor.isClient){
2424
this.todoListSubscription = MeteorObservable.subscribe('todoList').subscribe();
25+
}
2526
}
2627
ngOnDestroy() {
27-
if (this.todoListSubscription)
28+
if (this.todoListSubscription){
2829
this.todoListSubscription.unsubscribe();
30+
}
2931
}
3032
removeTodo(_id: string) {
3133
Meteor.call('removeTodo', _id);

examples/MeteorCLI/all-in-one/package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/MeteorCLI/all-in-one/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"@angular/platform-server": "^5.2.9",
1818
"@angular/router": "^5.2.9",
1919
"@babel/runtime": "^7.0.0-beta.42",
20-
"core-js": "^2.5.3",
20+
"core-js": "^2.5.4",
2121
"meteor-node-stubs": "~0.3.3",
2222
"meteor-rxjs": "^0.4.10",
23-
"rxjs": "^5.5.7",
24-
"zone.js": "^0.8.20"
23+
"rxjs": "^5.5.8",
24+
"zone.js": "^0.8.21"
2525
},
2626
"devDependencies": {
2727
"@angular/compiler-cli": "^5.2.9",
@@ -31,7 +31,7 @@
3131
"@types/sinon": "^4.1.0",
3232
"chai": "^4.1.2",
3333
"phantomjs-prebuilt": "^2.1.16",
34-
"sinon": "^4.1.3",
35-
"typescript": "^2.7.2"
34+
"sinon": "^4.5.0",
35+
"typescript": "^2.8.1"
3636
}
3737
}

0 commit comments

Comments
 (0)