diff --git a/package-lock.json b/package-lock.json index c7925f89e..6336fb2a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,42 +5,66 @@ "requires": true, "dependencies": { "@angular/common": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/@angular/common/-/common-5.2.9.tgz", - "integrity": "sha512-g2hPcI0fnT4TV+Fd+1IohjuqBxPvxwyH9IzTn8PkU9X2M+F6cHCUvHxL1sWI2sF8pYcaHzVjq9WClym10X36Lg==", + "version": "6.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-6.0.0-rc.2.tgz", + "integrity": "sha512-F0eR3xReT5OUkkojMiGy7+AL1fBMBpTj0GmIFmsYJOOGHru0UorNetmQlYT7GUCxraClHpcDRlnmguoP0GZyGg==", "dev": true, "requires": { - "tslib": "1.8.1" + "tslib": "1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + } } }, "@angular/compiler": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-5.2.9.tgz", - "integrity": "sha512-mN+ofInk8y/tk2TCJZx8RrGdOKdrfunoCair7tfDy4XoQJE90waGfaYWo07hYU+UYwLhrg19m2Czy6rIDciUJA==", + "version": "6.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-6.0.0-rc.2.tgz", + "integrity": "sha512-t/6thZ+AIJd59LK1Co2N0CtvPX/gQMLhgZ3tFpHOWbvyj/BOJ17dgtEnYGSB1spcnKXNAr+N8XECup0zNj/VWg==", "dev": true, "requires": { - "tslib": "1.8.1" + "tslib": "1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + } } }, "@angular/compiler-cli": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-5.2.9.tgz", - "integrity": "sha512-LAEpL/6PAev3zwTow/43Atzv9AtKLAiLoS285X3EV1f80yQpYAmFRrPUtDlrIZdhZHBBv7CxnyCVpOLU3T8ohw==", + "version": "6.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-6.0.0-rc.2.tgz", + "integrity": "sha512-Qcoh75Ru3p9STahonKaegp0r8s/R5MV9DoBgsBGDM9Y/b1+GkpYBQEcsh5iyHJh1OlTmLMrAXh+eqwofI2xyaQ==", "dev": true, "requires": { "chokidar": "1.7.0", "minimist": "1.2.0", "reflect-metadata": "0.1.12", - "tsickle": "0.27.2" + "tsickle": "0.27.5" } }, "@angular/core": { - "version": "5.2.9", - "resolved": "https://registry.npmjs.org/@angular/core/-/core-5.2.9.tgz", - "integrity": "sha512-cvHBJGtasrIoARvbLFyHaOsiWKVwMNrrSTZLwrlyHP8oYzkDrE0qKGer6QCqyKt+51hF53cgWEffGzM/u/0wYg==", + "version": "6.0.0-rc.2", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-6.0.0-rc.2.tgz", + "integrity": "sha512-cnF0rw2NPV+hxYyJmuwu8C6iTVUnyOuM9WgjGGa2Ti2HBYk1vCT5HTgIB5GkX99fntAhVohcBeRpxHKCedy6SQ==", "dev": true, "requires": { - "tslib": "1.8.1" + "tslib": "1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + } } }, "@babel/code-frame": { @@ -11322,12 +11346,20 @@ } }, "rxjs": { - "version": "5.5.8", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.8.tgz", - "integrity": "sha512-Bz7qou7VAIoGiglJZbzbXa4vpX5BmTTN2Dj/se6+SwADtw4SihqBIiEa7VmTXJ8pynvq0iFr5Gx9VLyye1rIxQ==", + "version": "6.0.0-smoosh.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.0.0-smoosh.2.tgz", + "integrity": "sha512-IAickSl7xhGOHhhZp7XhhyIpHUm1QvHMMPQVAusotHiwE8szw4ntHVbouj0CiB5IMe4jep1dzsTNcvj2YUIP+w==", "dev": true, "requires": { - "symbol-observable": "1.0.1" + "tslib": "1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + } } }, "safe-buffer": { @@ -12479,12 +12511,6 @@ "upper-case": "1.1.3" } }, - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", - "dev": true - }, "symbol-tree": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", @@ -13362,9 +13388,9 @@ } }, "tsickle": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.27.2.tgz", - "integrity": "sha512-KW+ZgY0t2cq2Qib1sfdgMiRnk+cr3brUtzZoVWjv+Ot3jNxVorFBUH+6In6hl8Dg7BI2AAFf69NHkwvZNMSFwA==", + "version": "0.27.5", + "resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.27.5.tgz", + "integrity": "sha512-NP+CjM1EXza/M8mOXBLH3vkFEJiu1zfEAlC5WdJxHPn8l96QPz5eooP6uAgYtw1CcKfuSyIiheNUdKxtDWCNeg==", "dev": true, "requires": { "minimist": "1.2.0", diff --git a/package.json b/package.json index 5a768c583..1f3f2d4f3 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,10 @@ "shipit": "npm run build && npm run readmes && npm run npmpub" }, "devDependencies": { - "@angular/common": "^5.2.9", - "@angular/compiler": "^5.2.9", - "@angular/compiler-cli": "^5.2.9", - "@angular/core": "^5.2.9", + "@angular/common": "^6.0.0-rc.2", + "@angular/compiler": "^6.0.0-rc.2", + "@angular/compiler-cli": "^6.0.0-rc.2", + "@angular/core": "^6.0.0-rc.2", "@types/cordova": "0.0.34", "@types/fs-extra": "^5.0.1", "@types/jest": "^22.2.2", @@ -56,7 +56,7 @@ "minimist": "1.2.0", "nodemon": "^1.17.3", "rimraf": "^2.6.2", - "rxjs": "^5.5.8", + "rxjs": "^6.0.0-rc.1", "string-replace-webpack-plugin": "^0.1.3", "ts-jest": "^22.4.2", "ts-node": "^4.1.0", diff --git a/src/@ionic-native/core/decorators/common.spec.ts b/src/@ionic-native/core/decorators/common.spec.ts index 8638174bb..209915b45 100644 --- a/src/@ionic-native/core/decorators/common.spec.ts +++ b/src/@ionic-native/core/decorators/common.spec.ts @@ -1,5 +1,5 @@ import { callCordovaPlugin, wrapInstance, wrapPromise } from './common'; -import 'rxjs/add/observable/of'; +import { of } from 'rxjs'; declare const window: any; @@ -33,14 +33,16 @@ class MockCordovaPlugin { static ping = jest.fn((arg: string) => 'pong'); ping = jest.fn((arg: string) => 'pong'); - static pingAsync = jest.fn((arg: string, success: Function, error: Function) => success('pong')); - pingAsync = jest.fn((arg: string, success: Function, error: Function) => success('pong')); + static pingAsync = jest.fn( + (arg: string, success: Function, error: Function) => success('pong') + ); + pingAsync = jest.fn((arg: string, success: Function, error: Function) => + success('pong') + ); } describe('Common decorator functions', () => { - - let plugin: MockPlugin, - instancePluginObject: MockInstancePluginObject; + let plugin: MockPlugin, instancePluginObject: MockInstancePluginObject; beforeAll(() => { window.mockPlugin = MockCordovaPlugin; @@ -73,15 +75,17 @@ describe('Common decorator functions', () => { test('original method should have received args', () => { expect(MockCordovaPlugin.pingAsync.mock.calls[0][0]).toBe('pingpong'); - expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][1]).toBe('function'); - expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][2]).toBe('function'); + expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][1]).toBe( + 'function' + ); + expect(typeof MockCordovaPlugin.pingAsync.mock.calls[0][2]).toBe( + 'function' + ); }); }); describe('wrapObservable', () => { - test('should return an observable that emits a value', async () => { - - }); + test('should return an observable that emits a value', async () => {}); test('original method should have been called', () => {}); @@ -93,8 +97,7 @@ describe('Common decorator functions', () => { }); describe('callInstance', () => { - test('should call an instance method', async () => { - }); + test('should call an instance method', async () => {}); test('original method should have been called', () => { // expect(instancePluginObject._pluginInstance.ping.mock.calls.length).toBe(1); @@ -104,5 +107,4 @@ describe('Common decorator functions', () => { // expect(instancePluginObject._pluginInstance.ping.mock.calls[0][0]).toBe('pingpong'); }); }); - }); diff --git a/src/@ionic-native/core/decorators/common.ts b/src/@ionic-native/core/decorators/common.ts index 5ab6ee9b3..16bac80b3 100644 --- a/src/@ionic-native/core/decorators/common.ts +++ b/src/@ionic-native/core/decorators/common.ts @@ -1,7 +1,5 @@ -import 'rxjs/add/observable/fromEvent'; - import * as _ from 'lodash'; -import { Observable } from 'rxjs/Observable'; +import { Observable, fromEvent } from 'rxjs'; import { CordovaOptions } from './interfaces'; @@ -175,7 +173,7 @@ function wrapEventObservable(event: string, element: any): Observable { } else { element = window; } - return Observable.fromEvent(element, event); + return fromEvent(element, event); } /** @@ -288,7 +286,7 @@ export function setIndex( }; const setErrorIndex = () => { - // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour. + // We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behavior. if (opts.errorIndex > args.length) { args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index } else { diff --git a/src/@ionic-native/core/decorators/cordova-function-override.ts b/src/@ionic-native/core/decorators/cordova-function-override.ts index 54bb3bc1b..9e68af3e4 100644 --- a/src/@ionic-native/core/decorators/cordova-function-override.ts +++ b/src/@ionic-native/core/decorators/cordova-function-override.ts @@ -1,23 +1,25 @@ import { checkAvailability, getPlugin } from './common'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; function overrideFunction(pluginObj: any, methodName: string): Observable { return new Observable(observer => { - const availabilityCheck = checkAvailability(pluginObj, methodName); if (availabilityCheck === true) { const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef()); pluginInstance[methodName] = observer.next.bind(observer); - return () => pluginInstance[methodName] = () => { }; + return () => (pluginInstance[methodName] = () => {}); } else { observer.error(availabilityCheck); observer.complete(); } - }); } -export function cordovaFunctionOverride(pluginObj: any, methodName: string, args: IArguments | Array = []) { +export function cordovaFunctionOverride( + pluginObj: any, + methodName: string, + args: IArguments | Array = [] +) { return overrideFunction(pluginObj, methodName); }