Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 84bc54a

Browse files
carl09sebholstein
authored andcommitted
feat(*): support angular2.0.0-rc.1
closes #339
1 parent 3cda0ba commit 84bc54a

17 files changed

Lines changed: 119 additions & 71 deletions

gulp/bundle.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ const bundleConfig = {
99
defaultJSExtensions: true,
1010
paths: {
1111
'angular2-google-maps/*': '*',
12-
'angular2/*': './node_modules/angular2/*',
12+
'@angular/*': './node_modules/@angular/*',
1313
'rxjs/*': './node_modules/rxjs/*',
1414
},
15+
packages: {
16+
'@angular/core': { main: 'index.js', defaultExtension: 'js' },
17+
'@angular/common': { main: 'index.js', defaultExtension: 'js' },
18+
'@angular/compiler': { main: 'index.js', defaultExtension: 'js' },
19+
},
20+
map: {
21+
'@angular': '@angular',
22+
},
1523
};
1624

1725
function bundle(moduleName, moduleBundleName, minify, done) {
@@ -23,7 +31,7 @@ function bundle(moduleName, moduleBundleName, minify, done) {
2331
builder.config(bundleConfig);
2432
const outputFile = path.join(config.PATHS.dist.bundles, moduleBundleName + (minify ? '.min' : '') + '.js');
2533
// todo: newest systemjs-builder version requires to explicitly exclude .d.ts files - probably a systemjs-builder bug.
26-
const bundlePromise = builder.bundle(moduleName + ' - angular2/*.ts - angular2/*.js - rxjs/*.ts - rxjs/*.js', outputFile, outputConfig);
34+
const bundlePromise = builder.bundle(moduleName + ' - @angular/core/*.ts - @angular/core/*.js - rxjs/*.ts - rxjs/*.js', outputFile, outputConfig);
2735

2836
if (!minify) {
2937
bundlePromise.then(() => {

karma-systemjs-config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
(function (global) {
2+
var map = {
3+
'rxjs': 'base/node_modules/rxjs',
4+
'@angular': 'base/node_modules/@angular'
5+
};
6+
var packages = {
7+
'rxjs': { defaultExtension: 'js' },
8+
};
9+
var packageNames = [
10+
'@angular/common',
11+
'@angular/compiler',
12+
'@angular/core',
13+
'@angular/platform-browser',
14+
'@angular/platform-browser-dynamic'
15+
];
16+
packageNames.forEach(function (pkgName) {
17+
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
18+
});
19+
var config = {
20+
map: map,
21+
packages: packages
22+
};
23+
if (global.filterSystemConfig) {
24+
global.filterSystemConfig(config);
25+
}
26+
System.config(config);
27+
})(this);

karma-test-shim.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ System.config({
1818
}
1919
});
2020

21-
System.import('angular2/platform/browser').then(function(browser) {
22-
browser.BrowserDomAdapter.makeCurrent();
21+
//loading systemjs for angular to use in tests
22+
System.import('base/karma-systemjs-config.js').then(function() {
23+
return Promise.all([
24+
System.import('@angular/core/testing'),
25+
System.import('@angular/platform-browser-dynamic/testing')
26+
]).then(function (providers) {
27+
var testing = providers[0];
28+
var testingBrowser = providers[1];
29+
30+
testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
31+
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
32+
});
2333
}).then(function() {
2434
return Promise.all(
2535
Object.keys(window.__karma__.files) // All files served by Karma.

karma.conf.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ module.exports = function(config) {
1414
},
1515
files: [
1616
{pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true},
17-
{pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true},
17+
{pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: true},
18+
//Needed for async testsing {https://github.com/angular/angular/issues/8232}
19+
{pattern: 'node_modules/zone.js/dist/async-test.js', included: true, watched: true},
20+
{pattern: 'node_modules/reflect-metadata/Reflect.js', included: true, watched: true},
21+
{pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: false },
1822
{pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true},
19-
{pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true},
20-
{pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true},
21-
{pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true},
22-
{pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true},
23-
{pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true},
24-
23+
24+
{pattern: 'karma-systemjs-config.js', included: true, watched: true},
25+
26+
{pattern: 'node_modules/rxjs/**/*', included: false, watched: false},
27+
{pattern: 'node_modules/@angular/common/**/*', included: false, watched: false},
28+
{pattern: 'node_modules/@angular/core/**/*', included: false, watched: false},
29+
{pattern: 'node_modules/@angular/platform-browser/**/*', included: false, watched: false},
30+
{pattern: 'node_modules/@angular/compiler/**/*', included: false, watched: false},
31+
{pattern: 'node_modules/@angular/platform-browser-dynamic/**/*', included: false, watched: false},
32+
2533
{pattern: 'karma-test-shim.js', included: true, watched: true},
2634

2735
// paths loaded via module imports
@@ -45,7 +53,6 @@ module.exports = function(config) {
4553
'/base/src/': '/base/dist/',
4654
'/base/test-built/src': '/base/dist'
4755
},
48-
4956
reporters: ['progress'],
5057
port: 9876,
5158
colors: true,

package.json

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222
},
2323
"homepage": "https://github.com/SebastianM/angular2-google-maps#readme",
2424
"dependencies": {
25-
"angular2": "^2.0.0-beta.11",
26-
"es6-promise": "^3.0.2",
25+
"@angular/common": "2.0.0-rc.1",
26+
"@angular/compiler": "2.0.0-rc.1",
27+
"@angular/core": "2.0.0-rc.1",
28+
"@angular/platform-browser": "2.0.0-rc.1",
29+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
30+
"es6-promise": "^3.1.2",
2731
"es6-shim": "^0.35.0",
28-
"reflect-metadata": "0.1.2",
29-
"rxjs": "5.0.0-beta.2",
30-
"zone.js": "^0.6.4"
32+
"reflect-metadata": "0.1.3",
33+
"rxjs": "5.0.0-beta.6",
34+
"zone.js": "^0.6.12"
3135
},
3236
"devDependencies": {
3337
"babel-eslint": "4.1.8",
@@ -56,21 +60,26 @@
5660
"replace": "0.3.0",
5761
"require-dir": "0.3.0",
5862
"run-sequence": "1.1.5",
59-
"systemjs": "0.19.23",
60-
"systemjs-builder": "0.15.13",
63+
"systemjs": "0.19.27",
64+
"systemjs-builder": "0.15.16",
6165
"tslint": "3.6.0",
6266
"typescript": "1.8.9",
63-
"typings": "0.7.7"
67+
"typings": "0.7.7",
68+
"watchify": "^3.7.0"
6469
},
6570
"jspm": {
6671
"jspmNodeConversion": false,
6772
"dependencies": {
68-
"angular2": "^2.0.0-beta.11",
69-
"es6-promise": "^3.0.2",
73+
"@angular/common": "2.0.0-rc.1",
74+
"@angular/compiler": "2.0.0-rc.1",
75+
"@angular/core": "2.0.0-rc.1",
76+
"@angular/platform-browser": "2.0.0-rc.1",
77+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
78+
"es6-promise": "^3.1.2",
7079
"es6-shim": "^0.35.0",
71-
"reflect-metadata": "0.1.2",
72-
"rxjs": "5.0.0-beta.2",
73-
"zone.js": "^0.6.4"
80+
"reflect-metadata": "0.1.3",
81+
"rxjs": "5.0.0-beta.6",
82+
"zone.js": "^0.6.12"
7483
}
7584
}
7685
}

src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Provider} from 'angular2/core';
1+
import {Provider} from '@angular/core';
22

33
import {MapsAPILoader} from './services/maps-api-loader/maps-api-loader';
44
import {LazyMapsAPILoader} from './services/maps-api-loader/lazy-maps-api-loader';

src/directives/google-map-info-window.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, SimpleChange, OnDestroy, OnChanges, ElementRef} from 'angular2/core';
1+
import {Component, SimpleChange, OnDestroy, OnChanges, ElementRef} from '@angular/core';
22
import {InfoWindowManager} from '../services/info-window-manager';
33
import {SebmGoogleMapMarker} from './google-map-marker';
44

@@ -36,8 +36,7 @@ let infoWindowId = 0;
3636
@Component({
3737
selector: 'sebm-google-map-info-window',
3838
inputs: ['latitude', 'longitude', 'disableAutoPan'],
39-
template: `
40-
<div class='sebm-google-map-info-window-content'>
39+
template: `<div class='sebm-google-map-info-window-content'>
4140
<ng-content></ng-content>
4241
</div>
4342
`

src/directives/google-map-marker.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import {
2-
Directive,
3-
SimpleChange,
4-
OnDestroy,
5-
OnChanges,
6-
EventEmitter,
7-
ContentChild,
8-
AfterContentInit
9-
} from 'angular2/core';
1+
import {Directive, SimpleChange, OnDestroy, OnChanges, EventEmitter, ContentChild, AfterContentInit} from '@angular/core';
102
import {MarkerManager} from '../services/marker-manager';
113
import {SebmGoogleMapInfoWindow} from './google-map-info-window';
124
import {MouseEvent} from '../events';

src/directives/google-map.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChange} from 'angular2/core';
1+
import {Component, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChange} from '@angular/core';
22
import {GoogleMapsAPIWrapper} from '../services/google-maps-api-wrapper';
33
import {MarkerManager} from '../services/marker-manager';
44
import {InfoWindowManager} from '../services/info-window-manager';
@@ -194,7 +194,7 @@ export class SebmGoogleMap implements OnChanges,
194194
/**
195195
* Sets the zoom level of the map. The default value is `8`.
196196
*/
197-
set zoom(value: number | string) {
197+
set zoom(value: number|string) {
198198
this._zoom = this._convertToDecimal(value, 8);
199199
if (typeof this._zoom === 'number') {
200200
this._mapsWrapper.setZoom(this._zoom);
@@ -204,20 +204,20 @@ export class SebmGoogleMap implements OnChanges,
204204
/**
205205
* The longitude that sets the center of the map.
206206
*/
207-
set longitude(value: number | string) {
207+
set longitude(value: number|string) {
208208
this._longitude = this._convertToDecimal(value);
209209
this._updateCenter();
210210
}
211211

212212
/**
213213
* The latitude that sets the center of the map.
214214
*/
215-
set latitude(value: number | string) {
215+
set latitude(value: number|string) {
216216
this._latitude = this._convertToDecimal(value);
217217
this._updateCenter();
218218
}
219219

220-
private _convertToDecimal(value: string | number, defaultValue: number = null): number {
220+
private _convertToDecimal(value: string|number, defaultValue: number = null): number {
221221
if (typeof value === 'string') {
222222
return parseFloat(value);
223223
} else if (typeof value === 'number') {
@@ -259,8 +259,8 @@ export class SebmGoogleMap implements OnChanges,
259259
type Event = {name: string, emitter: Emitter};
260260

261261
const events: Event[] = [
262-
{name: 'click', emitter: this.mapClick}, {name: 'rightclick', emitter: this.mapRightClick},
263-
{name: 'dblclick', emitter: this.mapDblClick}
262+
{name: 'click', emitter: this.mapClick},
263+
{name: 'rightclick', emitter: this.mapRightClick},
264264
];
265265

266266
events.forEach((e: Event) => {

src/services.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@ export {NoOpMapsAPILoader} from './services/maps-api-loader/noop-maps-api-loader
33
export {GoogleMapsAPIWrapper} from './services/google-maps-api-wrapper';
44
export {MarkerManager} from './services/marker-manager';
55
export {InfoWindowManager} from './services/info-window-manager';
6-
export {
7-
LazyMapsAPILoader,
8-
LazyMapsAPILoaderConfig,
9-
GoogleMapsScriptProtocol
10-
} from './services/maps-api-loader/lazy-maps-api-loader';
6+
export {LazyMapsAPILoader, LazyMapsAPILoaderConfig, GoogleMapsScriptProtocol} from './services/maps-api-loader/lazy-maps-api-loader';

0 commit comments

Comments
 (0)