Skip to content

Commit 097501e

Browse files
author
Nedyalko Nikolov
authored
Merge pull request NativeScript#590 from NativeScript/nnikolov/Es6Ready
Revert for Es6 modules with only code changes.
2 parents 3d2a063 + fbbbdf7 commit 097501e

33 files changed

+94
-128
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ tags
1313
!/nativescript-angular/postinstall.js
1414
!/nativescript-angular/hooks/**/*.js
1515
!/nativescript-angular/gulpfile.js
16-
!/nativescript-angular/rollup.config.js
17-
!/nativescript-angular/rollup-entry.js
1816
!/nativescript-angular/zone-js/**/*.js
1917

2018
.tscache

nativescript-angular/global.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es6.d.ts" />
1+
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" />

nativescript-angular/index.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,15 @@ export * from "./renderer";
1616
export * from "./view-util";
1717
export * from "./animation-driver";
1818
export * from "./resource-loader";
19-
export * from "./element-registry";
19+
export {
20+
ViewResolver,
21+
TEMPLATE,
22+
ViewClass,
23+
ViewClassMeta,
24+
registerElement,
25+
getViewClass,
26+
getViewMeta,
27+
isKnownView,
28+
TemplateView
29+
} from "./element-registry";
2030
export * from "./value-accessors/base-value-accessor";

nativescript-angular/initial-imports.js

-2
This file was deleted.

nativescript-angular/package.json

+5-10
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"private": true,
33
"name": "nativescript-angular",
44
"version": "1.3.0",
5-
"main": "bundle.all.js",
6-
"module": "index.js",
7-
"typings": "index.d.ts",
85
"description": "An Angular 2 renderer that lets you build mobile apps with NativeScript.",
96
"homepage": "http://www.telerik.com",
107
"bugs": "http://www.telerik.com",
@@ -21,10 +18,10 @@
2118
"postinstall": "node postinstall.js",
2219
"ngc": "ngc -p tsconfig.json",
2320
"tsc": "tsc -p tsconfig.json",
24-
"prepublish": "npm run tsc && rollup -c && npm run ngc"
21+
"prepublish": "npm run tsc && npm run ngc"
2522
},
2623
"dependencies": {
27-
"nativescript-intl": "~0.0.5",
24+
"nativescript-intl": "~0.0.8",
2825
"@angular/core": "~2.2.1",
2926
"@angular/common": "~2.2.1",
3027
"@angular/compiler": "~2.2.1",
@@ -38,18 +35,16 @@
3835
"parse5": "1.3.2",
3936
"punycode": "1.3.2",
4037
"querystring": "0.2.0",
41-
"rxjs": "5.0.0-beta.12",
4238
"url": "0.10.3"
4339
},
4440
"devDependencies": {
45-
"tns-core-modules": ">=2.5.0 || >=2.5.0-2016",
46-
"zone.js": "^0.6.21",
4741
"typescript": "~2.0.10",
4842
"tslint": "~4.0.1",
4943
"codelyzer": "^2.0.0-beta.1",
5044
"@angular/compiler-cli": "~2.2.1",
51-
"rollup": "^0.36.3",
52-
"rollup-plugin-multi-entry": "^2.0.1"
45+
"codelyzer": "^2.0.0-beta.1",
46+
"tns-core-modules": ">=2.5.0 || >=2.5.0-2016",
47+
"zone.js": "^0.6.21"
5348
},
5449
"nativescript": {}
5550
}

nativescript-angular/rollup-entry.js

-12
This file was deleted.

nativescript-angular/rollup.config.js

-22
This file was deleted.

nativescript-angular/router.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ import { NSLocationStrategy, LocationState } from "./router/ns-location-strategy
88
import { NativescriptPlatformLocation } from "./router/ns-platform-location";
99
import { RouterExtensions } from "./router/router-extensions";
1010
import { NativeScriptModule } from "./nativescript.module";
11-
export { NSModuleFactoryLoader } from "./router/ns-module-factory-loader";
1211

1312
export { PageRoute } from "./router/page-router-outlet";
1413
export { RouterExtensions } from "./router/router-extensions";
15-
export { NSLocationStrategy } from "./router/ns-location-strategy";
14+
export { NSModuleFactoryLoader } from "./router/ns-module-factory-loader";
1615
export type LocationState = LocationState;
1716

1817
@NgModule({

nativescript-angular/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
4-
"module": "es6",
3+
"target": "es5",
4+
"module": "commonjs",
55
"moduleResolution": "node",
66
"sourceMap": true,
77
"emitDecoratorMetadata": true,

nativescript-angular/view-util.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const IOS_PREFX: string = ":ios:";
2222
const ANDROID_PREFX: string = ":android:";
2323
const whiteSpaceSplitter = /\s+/;
2424

25+
export type ViewExtensions = ViewExtensions;
26+
export type NgView = NgView;
2527
export type NgLayoutBase = LayoutBase & ViewExtensions;
2628
export type NgContentView = ContentView & ViewExtensions;
2729
export type BeforeAttachAction = (view: View) => void;

ng-sample/app/app.ts

+25-33
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,15 @@
66
//profiling.start("application-start");
77

88
// "nativescript-angular/application" import should be first in order to load some required settings (like globals and reflect-metadata)
9-
import {
10-
NativeScriptModule,
11-
platformNativeScriptDynamic,
12-
NativeScriptRouterModule,
13-
NativeScriptFormsModule,
14-
NativeScriptHttpModule,
15-
routerTraceCategory,
16-
rendererTraceCategory,
17-
listViewTraceCategory,
18-
PAGE_FACTORY,
19-
PageFactory,
20-
PageFactoryOptions,
21-
onAfterLivesync,
22-
onBeforeLivesync
23-
} from "nativescript-angular";
9+
import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform";
10+
import { onAfterLivesync, onBeforeLivesync } from "nativescript-angular/platform-common";
2411
import { NgModule } from "@angular/core";
2512
import { Router } from "@angular/router";
13+
import { NativeScriptRouterModule } from "nativescript-angular/router";
14+
import { NativeScriptFormsModule } from "nativescript-angular/forms";
15+
import { NativeScriptHttpModule } from "nativescript-angular/http";
16+
import { rendererTraceCategory, routerTraceCategory, listViewTraceCategory } from "nativescript-angular/trace";
17+
import { PAGE_FACTORY, PageFactory, PageFactoryOptions } from "nativescript-angular/platform-providers";
2618
import { Page } from "ui/page";
2719
import { Color } from "color";
2820
import { setCategories, enable } from "trace";
@@ -146,24 +138,24 @@ platformNativeScriptDynamic().bootstrapModule(makeExampleModule(RendererTest));
146138
// platformNativeScriptDynamic().bootstrapModule(makeExampleModule(AnimationEnterLeaveTest));
147139

148140
//Livesync test
149-
//var cachedUrl: string;
150-
//onBeforeLivesync.subscribe((moduleRef) => {
151-
// console.log("------- onBeforeLivesync");
152-
// if (moduleRef) {
153-
// const router = <Router>moduleRef.injector.get(Router);
154-
// cachedUrl = router.url;
155-
// console.log("------- Caching URL: " + cachedUrl);
156-
// }
157-
//});
158-
//
159-
//onAfterLivesync.subscribe((moduleRef) => {
160-
// console.log("------- onAfterLivesync cachedUrl:");
161-
// const router = <Router>moduleRef.injector.get(Router);
162-
// router.events.subscribe(e => console.log(e.toString()));
163-
// if (router && cachedUrl) {
164-
// setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0);
165-
// }
166-
//});
141+
var cachedUrl: string;
142+
onBeforeLivesync.subscribe((moduleRef) => {
143+
console.log("------- onBeforeLivesync");
144+
if (moduleRef) {
145+
const router = <Router>moduleRef.injector.get(Router);
146+
cachedUrl = router.url;
147+
console.log("------- Caching URL: " + cachedUrl);
148+
}
149+
});
150+
151+
onAfterLivesync.subscribe((moduleRef) => {
152+
console.log("------- onAfterLivesync cachedUrl:");
153+
const router = <Router>moduleRef.injector.get(Router);
154+
router.events.subscribe(e => console.log(e.toString()));
155+
if (router && cachedUrl) {
156+
setTimeout(() => { router.navigateByUrl(cachedUrl); }, 0);
157+
}
158+
});
167159

168160
//platformNativeScriptDynamic().bootstrapModule(makeExampleModule(LivesyncApp));
169161
console.log("APP RESTART");

ng-sample/app/examples/renderer-test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {Component, Directive, Host, ElementRef, Input} from "@angular/core";
2-
import {Observable} from "data/observable";
3-
import { TextValueAccessor, CheckedValueAccessor } from "nativescript-angular";
1+
import {Component, Directive, Host, ElementRef, Input} from '@angular/core';
2+
import {Observable} from 'data/observable';
3+
import {TextValueAccessor} from 'nativescript-angular/value-accessors/text-value-accessor';
4+
import {CheckedValueAccessor} from 'nativescript-angular/value-accessors/checked-value-accessor';
45

56
@Component({
67
moduleId: module.id,

ng-sample/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"module": "commonjs",
44
"moduleResolution": "node",
55
"target": "es5",
6+
"inlineSourceMap": true,
67
"experimentalDecorators": true,
78
"removeComments": false,
89
"emitDecoratorMetadata": true,

tests/app/lazy-loaded.module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NgModule } from '@angular/core';
2-
import { NativeScriptModule, NativeScriptRouterModule } from "nativescript-angular";
2+
import { NativeScriptModule } from "nativescript-angular";
3+
import { NativeScriptRouterModule } from "nativescript-angular/router";
34

45
import { SecondComponent } from './second.component';
56

tests/app/main.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
import {
2-
NativeScriptModule,
3-
platformNativeScriptDynamic,
4-
rendererTraceCategory,
5-
routerTraceCategory,
6-
NativeScriptRouterModule,
7-
NativeScriptFormsModule,
8-
NSModuleFactoryLoader,
9-
APP_ROOT_VIEW
10-
} from "nativescript-angular";
1+
// "nativescript-angular/platform" import should be first in order to load some required settings (like globals and reflect-metadata)
2+
import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform";
3+
import { NativeScriptRouterModule, NSModuleFactoryLoader } from "nativescript-angular/router";
4+
import { NativeScriptFormsModule } from "nativescript-angular/forms";
115
import { AppComponent } from "./app.component";
126
import { GestureComponent } from "./snippets/gestures.component";
137
import { LayoutsComponent } from "./snippets/layouts.component";
148
import { IconFontComponent } from "./snippets/icon-font.component";
9+
import { APP_ROOT_VIEW } from "nativescript-angular/platform-providers";
1510
import { Page } from "ui/page";
1611
import { StackLayout } from "ui/layouts/stack-layout";
1712

@@ -29,6 +24,8 @@ import { OpaqueToken, NgModule, NgModuleFactoryLoader } from "@angular/core";
2924
import { PageNavigationApp } from "./snippets/navigation/page-outlet";
3025
import { NavigationApp } from "./snippets/navigation/router-outlet";
3126

27+
import { rendererTraceCategory, routerTraceCategory } from "nativescript-angular/trace";
28+
3229
import { BehaviorSubject } from "rxjs";
3330

3431
import trace = require("trace");

tests/app/snippets/navigation/config-snippets.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const routes = [
1414
// << router-config
1515

1616
// >> router-provider
17-
import { NativeScriptRouterModule } from "nativescript-angular";
17+
import { NativeScriptRouterModule } from "nativescript-angular/router";
1818

1919
@NgModule({
2020
bootstrap: [GroceriesApp],
@@ -27,7 +27,7 @@ export class GroceriesAppModule { }
2727
// << router-provider
2828

2929
// >> router-bootstrap
30-
import { platformNativeScriptDynamic } from "nativescript-angular";
30+
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
3131
// >> (hide)
3232
function start_snippet() {
3333
// << (hide)

tests/app/snippets/navigation/page-outlet.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { TestApp, registerTestApp } from "../../tests/test-app";
22
import { ApplicationRef } from '@angular/core';
33
import { Router, NavigationStart, NavigationEnd } from "@angular/router";
44
// >> page-outlet-example
5-
import { platformNativeScriptDynamic, NativeScriptModule, NativeScriptRouterModule } from "nativescript-angular";
5+
import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";
66
import { Component, NgModule } from '@angular/core';
7+
import { NativeScriptRouterModule } from "nativescript-angular/router";
78
import { routes } from "./app.routes";
89
import { FirstComponent, SecondComponent } from "./navigation-common";
910

tests/app/snippets/navigation/route-params.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MyComponent {
1111

1212

1313
// >> router-params-page-route
14-
import { PageRoute } from "nativescript-angular";
14+
import { PageRoute } from "nativescript-angular/router";
1515
class MyPageComponent {
1616
id: number;
1717
constructor(private pageRoute: PageRoute) {

tests/app/snippets/navigation/router-extensions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from "@angular/core";
2-
import { RouterExtensions } from 'nativescript-angular';
2+
import { RouterExtensions } from 'nativescript-angular/router';
33

44
@Component({
55
// ...

tests/app/snippets/navigation/router-outlet.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {TestApp, registerTestApp} from "../../tests/test-app";
22
import { ApplicationRef } from '@angular/core';
33
// >> router-outlet-example
44
import { Component, NgModule } from '@angular/core';
5-
import { platformNativeScriptDynamic, NativeScriptRouterModule } from "nativescript-angular";
5+
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
6+
import { NativeScriptRouterModule } from "nativescript-angular/router";
67
import { Router, NavigationStart, NavigationEnd } from '@angular/router';
78
import { routes } from "./app.routes";
89
import {FirstComponent, SecondComponent} from "./navigation-common";

tests/app/tests/detached-loader-tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {Red} from "color/known-colors";
77
import {dumpView} from "./test-utils";
88
import {LayoutBase} from "ui/layouts/layout-base";
99
import {StackLayout} from "ui/layouts/stack-layout";
10-
import {DetachedLoader} from "nativescript-angular";
10+
import {DetachedLoader} from "nativescript-angular/common/detached-loader";
1111

1212
@Component({
1313
template: `<StackLayout><Label text="COMPONENT"></Label></StackLayout>`

tests/app/tests/http.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {ReflectiveInjector} from '@angular/core';
88
import {BaseRequestOptions, ConnectionBackend, Http, Response, ResponseOptions} from '@angular/http';
99
import 'rxjs/add/operator/map';
1010
import {MockBackend} from '@angular/http/testing';
11-
import { NSHttp, NSFileSystem } from "nativescript-angular";
11+
import {NSHttp} from "nativescript-angular/http/ns-http";
12+
import {NSFileSystem} from "nativescript-angular/file-system/ns-file-system";
1213
import {NSFileSystemMock, FileResponses} from './mocks/ns-file-system.mock';
1314

1415
describe("Http", () => {

tests/app/tests/modal-dialog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TestApp } from "./test-app";
44
import { Component, ViewContainerRef } from "@angular/core";
55
import { Page } from "ui/page";
66
import { topmost } from "ui/frame";
7-
import { ModalDialogParams, ModalDialogService } from "nativescript-angular";
7+
import { ModalDialogParams, ModalDialogService } from "nativescript-angular/directives/dialogs";
88

99
import { device, platformNames } from "platform";
1010
const CLOSE_WAIT = (device.os === platformNames.ios) ? 1000 : 0;

tests/app/tests/ns-location-strategy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//make sure you import mocha-config before @angular/core
22
import {assert} from "./test-config";
3-
import {NSLocationStrategy, LocationState} from "nativescript-angular";
3+
import {NSLocationStrategy, LocationState} from "nativescript-angular/router/ns-location-strategy";
44
import {Frame, BackstackEntry, NavigationEntry} from "ui/frame";
55
import {Page} from "ui/page";
66
import {View} from "ui/core/view";

tests/app/tests/platform-filter-components.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { assert } from "./test-config";
33
import { Component, ElementRef } from "@angular/core";
44
import { dumpView, createDevice } from "./test-utils";
55
import { TestApp } from "./test-app";
6-
import { DEVICE } from "nativescript-angular";
6+
import { DEVICE } from "nativescript-angular/platform-providers";
77
import { platformNames } from "platform";
88

99
@Component({

tests/app/tests/property-sets.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//make sure you import mocha-config before @angular/core
22
import {assert} from "./test-config";
33
import {View} from "ui/core/view";
4-
import {ViewUtil, NgView, ViewExtensions, ViewClassMeta} from "nativescript-angular";
4+
import {ViewUtil} from "nativescript-angular/view-util";
5+
import {NgView, ViewExtensions, ViewClassMeta} from "nativescript-angular/element-registry";
56
import {Red} from "color/known-colors";
67
import {device, platformNames} from "platform";
78
import {createDevice} from "./test-utils";

tests/app/tests/renderer-tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { LayoutBase } from "ui/layouts/layout-base";
99
import { StackLayout } from "ui/layouts/stack-layout";
1010
import { ContentView } from "ui/content-view";
1111
import { Button } from "ui/button";
12-
import { NgView } from "nativescript-angular";
12+
import { NgView } from "nativescript-angular/element-registry";
1313

1414
@Component({
1515
template: `<StackLayout><Label text="Layout"></Label></StackLayout>`

0 commit comments

Comments
 (0)