@capacitor/geolocation 6.1.0 → 7.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorGeolocation.podspec +1 -1
- package/Package.swift +2 -2
- package/README.md +1 -1
- package/android/build.gradle +10 -10
- package/dist/plugin.cjs.js +2 -4
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -4
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/GeolocationPlugin/GeolocationPlugin.swift +8 -6
- package/package.json +10 -10
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'geolocation/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target
|
|
14
|
+
s.ios.deployment_target = '14.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
CHANGED
|
@@ -3,14 +3,14 @@ import PackageDescription
|
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
5
|
name: "CapacitorGeolocation",
|
|
6
|
-
platforms: [.iOS(.
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "CapacitorGeolocation",
|
|
10
10
|
targets: ["GeolocationPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git",
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Read about [Setting Permissions](https://capacitorjs.com/docs/android/configurat
|
|
|
36
36
|
|
|
37
37
|
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
|
38
38
|
|
|
39
|
-
- `playServicesLocationVersion` version of `com.google.android.gms:play-services-location` (default: `21.
|
|
39
|
+
- `playServicesLocationVersion` version of `com.google.android.gms:play-services-location` (default: `21.3.0`)
|
|
40
40
|
|
|
41
41
|
## Example
|
|
42
42
|
|
package/android/build.gradle
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
capacitorVersion = System.getenv('CAPACITOR_VERSION')
|
|
3
3
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
4
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
5
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1
|
|
6
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
7
|
-
playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '21.
|
|
4
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
5
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
6
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
7
|
+
playServicesLocationVersion = project.hasProperty('playServicesLocationVersion') ? rootProject.ext.playServicesLocationVersion : '21.3.0'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
buildscript {
|
|
@@ -16,7 +16,7 @@ buildscript {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
dependencies {
|
|
19
|
-
classpath 'com.android.tools.build:gradle:8.2
|
|
19
|
+
classpath 'com.android.tools.build:gradle:8.7.2'
|
|
20
20
|
if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
|
21
21
|
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
|
|
22
22
|
}
|
|
@@ -32,10 +32,10 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
|
|
|
32
32
|
|
|
33
33
|
android {
|
|
34
34
|
namespace "com.capacitorjs.plugins.geolocation"
|
|
35
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
35
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
36
36
|
defaultConfig {
|
|
37
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
38
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
37
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
38
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
39
39
|
versionCode 1
|
|
40
40
|
versionName "1.0"
|
|
41
41
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -50,8 +50,8 @@ android {
|
|
|
50
50
|
abortOnError false
|
|
51
51
|
}
|
|
52
52
|
compileOptions {
|
|
53
|
-
sourceCompatibility JavaVersion.
|
|
54
|
-
targetCompatibility JavaVersion.
|
|
53
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
54
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
55
55
|
}
|
|
56
56
|
publishing {
|
|
57
57
|
singleVariant("release")
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@capacitor/core');
|
|
6
4
|
|
|
7
5
|
const Geolocation$1 = core.registerPlugin('Geolocation', {
|
|
@@ -46,8 +44,8 @@ const Geolocation = new GeolocationWeb();
|
|
|
46
44
|
|
|
47
45
|
var web = /*#__PURE__*/Object.freeze({
|
|
48
46
|
__proto__: null,
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
Geolocation: Geolocation,
|
|
48
|
+
GeolocationWeb: GeolocationWeb
|
|
51
49
|
});
|
|
52
50
|
|
|
53
51
|
exports.Geolocation = Geolocation$1;
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAChE,CAAC;;ACFM,MAAM,cAAc,SA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AACxE,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,+CAA+C,CAAC;AACnF;AACA,QAAQ,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC;AACpE,YAAY,IAAI,EAAE,aAAa;AAC/B,SAAS,CAAC;AACV,QAAQ,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,KAAK,EAAE;AAC/E;AACA,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D;AACA;AACA,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -43,14 +43,12 @@ var capacitorGeolocation = (function (exports, core) {
|
|
|
43
43
|
|
|
44
44
|
var web = /*#__PURE__*/Object.freeze({
|
|
45
45
|
__proto__: null,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
Geolocation: Geolocation,
|
|
47
|
+
GeolocationWeb: GeolocationWeb
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
exports.Geolocation = Geolocation$1;
|
|
51
51
|
|
|
52
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
53
|
-
|
|
54
52
|
return exports;
|
|
55
53
|
|
|
56
54
|
})({}, capacitorExports);
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAC5D,gBAAgB,OAAO,CAAC,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Geolocation = registerPlugin('Geolocation', {\n web: () => import('./web').then(m => new m.GeolocationWeb()),\n});\nexport * from './definitions';\nexport { Geolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class GeolocationWeb extends WebPlugin {\n async getCurrentPosition(options) {\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(pos => {\n resolve(pos);\n }, err => {\n reject(err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0 }, options));\n });\n }\n async watchPosition(options, callback) {\n const id = navigator.geolocation.watchPosition(pos => {\n callback(pos);\n }, err => {\n callback(null, err);\n }, Object.assign({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, minimumUpdateInterval: 5000 }, options));\n return `${id}`;\n }\n async clearWatch(options) {\n window.navigator.geolocation.clearWatch(parseInt(options.id, 10));\n }\n async checkPermissions() {\n if (typeof navigator === 'undefined' || !navigator.permissions) {\n throw this.unavailable('Permissions API not available in this browser');\n }\n const permission = await window.navigator.permissions.query({\n name: 'geolocation',\n });\n return { location: permission.state, coarseLocation: permission.state };\n }\n async requestPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\nconst Geolocation = new GeolocationWeb();\nexport { Geolocation };\n//# sourceMappingURL=web.js.map"],"names":["Geolocation","registerPlugin","WebPlugin"],"mappings":";;;AACK,UAACA,aAAW,GAAGC,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;IAChD,YAAY,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAC5D,gBAAgB,OAAO,CAAC,GAAG,CAAC;IAC5B,aAAa,EAAE,GAAG,IAAI;IACtB,gBAAgB,MAAM,CAAC,GAAG,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,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,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D;IACA;IACA,MAAM,WAAW,GAAG,IAAI,cAAc,EAAE;;;;;;;;;;;;;;;;"}
|
|
@@ -38,7 +38,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
|
|
|
38
38
|
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if
|
|
41
|
+
if self.locationManager.authorizationStatus == .notDetermined {
|
|
42
42
|
self.locationManager.requestWhenInUseAuthorization()
|
|
43
43
|
} else {
|
|
44
44
|
self.locationManager.requestLocation()
|
|
@@ -59,7 +59,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
|
|
|
59
59
|
self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if
|
|
62
|
+
if self.locationManager.authorizationStatus == .notDetermined {
|
|
63
63
|
self.locationManager.requestWhenInUseAuthorization()
|
|
64
64
|
} else {
|
|
65
65
|
self.locationManager.startUpdatingLocation()
|
|
@@ -121,13 +121,15 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
public func
|
|
124
|
+
public func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
|
|
125
125
|
let removalQueue = callQueue.filter { $0.value == .permissions }
|
|
126
126
|
callQueue = callQueue.filter { $0.value != .permissions }
|
|
127
127
|
|
|
128
128
|
for (id, _) in removalQueue {
|
|
129
129
|
if let call = bridge?.savedCall(withID: id) {
|
|
130
|
-
|
|
130
|
+
DispatchQueue(label: "permissionsQueue").async {
|
|
131
|
+
self.checkPermissions(call)
|
|
132
|
+
}
|
|
131
133
|
bridge?.releaseCall(call)
|
|
132
134
|
}
|
|
133
135
|
}
|
|
@@ -161,7 +163,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
|
|
|
161
163
|
var status: String = ""
|
|
162
164
|
|
|
163
165
|
if CLLocationManager.locationServicesEnabled() {
|
|
164
|
-
switch
|
|
166
|
+
switch self.locationManager.authorizationStatus {
|
|
165
167
|
case .notDetermined:
|
|
166
168
|
status = "prompt"
|
|
167
169
|
case .restricted, .denied:
|
|
@@ -188,7 +190,7 @@ public class GeolocationPlugin: CAPPlugin, CLLocationManagerDelegate, CAPBridged
|
|
|
188
190
|
if CLLocationManager.locationServicesEnabled() {
|
|
189
191
|
// If state is not yet determined, request perms.
|
|
190
192
|
// Otherwise, report back the state right away
|
|
191
|
-
if
|
|
193
|
+
if self.locationManager.authorizationStatus == .notDetermined {
|
|
192
194
|
bridge?.saveCall(call)
|
|
193
195
|
callQueue[call.callbackId] = .permissions
|
|
194
196
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/geolocation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "The Geolocation API provides simple methods for getting and tracking the current position of the device using GPS, along with altitude, heading, and speed information if available.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
34
|
-
"verify:ios": "xcodebuild build -scheme CapacitorGeolocation -
|
|
34
|
+
"verify:ios": "xcodebuild build -scheme CapacitorGeolocation -destination generic/platform=iOS",
|
|
35
35
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
36
36
|
"verify:web": "npm run build",
|
|
37
37
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
@@ -40,30 +40,30 @@
|
|
|
40
40
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
41
41
|
"swiftlint": "node-swiftlint",
|
|
42
42
|
"docgen": "docgen --api GeolocationPlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
|
-
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.
|
|
43
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
44
44
|
"clean": "rimraf ./dist",
|
|
45
45
|
"watch": "tsc --watch",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
47
|
"publish:cocoapod": "pod trunk push ./CapacitorGeolocation.podspec --allow-warnings"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@capacitor/android": "
|
|
51
|
-
"@capacitor/core": "
|
|
50
|
+
"@capacitor/android": "next",
|
|
51
|
+
"@capacitor/core": "next",
|
|
52
52
|
"@capacitor/docgen": "0.2.2",
|
|
53
|
-
"@capacitor/ios": "
|
|
53
|
+
"@capacitor/ios": "next",
|
|
54
54
|
"@ionic/eslint-config": "^0.4.0",
|
|
55
55
|
"@ionic/prettier-config": "~1.0.1",
|
|
56
56
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
57
57
|
"eslint": "^8.57.0",
|
|
58
58
|
"prettier": "~2.3.0",
|
|
59
59
|
"prettier-plugin-java": "~1.0.2",
|
|
60
|
-
"rimraf": "^
|
|
61
|
-
"rollup": "^
|
|
60
|
+
"rimraf": "^6.0.1",
|
|
61
|
+
"rollup": "^4.26.0",
|
|
62
62
|
"swiftlint": "^1.0.1",
|
|
63
63
|
"typescript": "~4.1.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@capacitor/core": "
|
|
66
|
+
"@capacitor/core": "next"
|
|
67
67
|
},
|
|
68
68
|
"prettier": "@ionic/prettier-config",
|
|
69
69
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "2158e6aa205a584a258c34f606e694fdf31cdcc0"
|
|
85
85
|
}
|