@capgo/capacitor-updater 6.4.1 → 6.6.3
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/README.md +1 -0
- package/android/build.gradle +2 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +225 -192
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +21 -9
- package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +28 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +206 -133
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +3 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +22 -16
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +6 -6
- package/package.json +13 -13
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { registerPlugin } from \"@capacitor/core\";\nconst CapacitorUpdater = registerPlugin(\"CapacitorUpdater\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorUpdaterWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from \"@capacitor/core\";\nconst BUNDLE_BUILTIN = {\n status: \"success\",\n version: \"\",\n downloaded: \"1970-01-01T00:00:00.000Z\",\n id: \"builtin\",\n checksum: \"\",\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn(\"Cannot setStatsUrl in web\", options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn(\"Cannot setUpdateUrl in web\", options);\n return;\n }\n async setChannelUrl(options) {\n console.warn(\"Cannot setChannelUrl in web\", options);\n return;\n }\n async download(options) {\n console.warn(\"Cannot download version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn(\"Cannot set next version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn(\"Cannot get isAutoUpdateEnabled in web\");\n return { enabled: false };\n }\n async set(options) {\n console.warn(\"Cannot set active bundle in web\", options);\n return;\n }\n async getDeviceId() {\n console.warn(\"Cannot get ID in web\");\n return { deviceId: \"default\" };\n }\n async getBuiltinVersion() {\n console.warn(\"Cannot get version in web\");\n return { version: \"default\" };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async delete(options) {\n console.warn(\"Cannot delete bundle in web\", options);\n }\n async list() {\n console.warn(\"Cannot list bundles in web\");\n return { bundles: [] };\n }\n async reset(options) {\n console.warn(\"Cannot reset version in web\", options);\n }\n async current() {\n console.warn(\"Cannot get current bundle in web\");\n return { bundle: BUNDLE_BUILTIN, native: \"0.0.0\" };\n }\n async reload() {\n console.warn(\"Cannot reload current bundle in web\");\n return;\n }\n async getLatest() {\n console.warn(\"Cannot getLatest current bundle in web\");\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async setChannel(options) {\n console.warn(\"Cannot setChannel in web\", options);\n return {\n status: \"error\",\n error: \"Cannot setChannel in web\",\n };\n }\n async unsetChannel(options) {\n console.warn(\"Cannot unsetChannel in web\", options);\n return;\n }\n async setCustomId(options) {\n console.warn(\"Cannot setCustomId in web\", options);\n return;\n }\n async getChannel() {\n console.warn(\"Cannot getChannel in web\");\n return {\n status: \"error\",\n error: \"Cannot getChannel in web\",\n };\n }\n async notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return { bundle: BUNDLE_BUILTIN };\n }\n async setMultiDelay(options) {\n console.warn(\"Cannot setMultiDelay in web\", options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn(\"Cannot setDelay in web\", option);\n return;\n }\n async cancelDelay() {\n console.warn(\"Cannot cancelDelay in web\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AAEK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICRD;IACA;IACA;IACA;IACA;IAEA,MAAM,cAAc,GAAG;IACvB,IAAI,MAAM,EAAE,SAAS;IACrB,IAAI,OAAO,EAAE,EAAE;IACf,IAAI,UAAU,EAAE,0BAA0B;IAC1C,IAAI,EAAE,EAAE,SAAS;IACjB,IAAI,QAAQ,EAAE,EAAE;IAChB,CAAC
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { registerPlugin } from \"@capacitor/core\";\nconst CapacitorUpdater = registerPlugin(\"CapacitorUpdater\", {\n web: () => import(\"./web\").then((m) => new m.CapacitorUpdaterWeb()),\n});\nexport * from \"./definitions\";\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from \"@capacitor/core\";\nconst BUNDLE_BUILTIN = {\n status: \"success\",\n version: \"\",\n downloaded: \"1970-01-01T00:00:00.000Z\",\n id: \"builtin\",\n checksum: \"\",\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn(\"Cannot setStatsUrl in web\", options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn(\"Cannot setUpdateUrl in web\", options);\n return;\n }\n async setChannelUrl(options) {\n console.warn(\"Cannot setChannelUrl in web\", options);\n return;\n }\n async download(options) {\n console.warn(\"Cannot download version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn(\"Cannot set next version in web\", options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn(\"Cannot get isAutoUpdateEnabled in web\");\n return { enabled: false };\n }\n async set(options) {\n console.warn(\"Cannot set active bundle in web\", options);\n return;\n }\n async getDeviceId() {\n console.warn(\"Cannot get ID in web\");\n return { deviceId: \"default\" };\n }\n async getBuiltinVersion() {\n console.warn(\"Cannot get version in web\");\n return { version: \"default\" };\n }\n async getPluginVersion() {\n console.warn(\"Cannot get plugin version in web\");\n return { version: \"default\" };\n }\n async delete(options) {\n console.warn(\"Cannot delete bundle in web\", options);\n }\n async list() {\n console.warn(\"Cannot list bundles in web\");\n return { bundles: [] };\n }\n async reset(options) {\n console.warn(\"Cannot reset version in web\", options);\n }\n async current() {\n console.warn(\"Cannot get current bundle in web\");\n return { bundle: BUNDLE_BUILTIN, native: \"0.0.0\" };\n }\n async reload() {\n console.warn(\"Cannot reload current bundle in web\");\n return;\n }\n async getLatest() {\n console.warn(\"Cannot getLatest current bundle in web\");\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async setChannel(options) {\n console.warn(\"Cannot setChannel in web\", options);\n return {\n status: \"error\",\n error: \"Cannot setChannel in web\",\n };\n }\n async unsetChannel(options) {\n console.warn(\"Cannot unsetChannel in web\", options);\n return;\n }\n async setCustomId(options) {\n console.warn(\"Cannot setCustomId in web\", options);\n return;\n }\n async getChannel() {\n console.warn(\"Cannot getChannel in web\");\n return {\n status: \"error\",\n error: \"Cannot getChannel in web\",\n };\n }\n async notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return { bundle: BUNDLE_BUILTIN };\n }\n async setMultiDelay(options) {\n console.warn(\"Cannot setMultiDelay in web\", options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn(\"Cannot setDelay in web\", option);\n return;\n }\n async cancelDelay() {\n console.warn(\"Cannot cancelDelay in web\");\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AAEK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICRD;IACA;IACA;IACA;IACA;IAEA,MAAM,cAAc,GAAG;IACvB,IAAI,MAAM,EAAE,SAAS;IACrB,IAAI,OAAO,EAAE,EAAE;IACf,IAAI,UAAU,EAAE,0BAA0B;IAC1C,IAAI,EAAE,EAAE,SAAS;IACjB,IAAI,QAAQ,EAAE,EAAE;IAChB,CAAC;IACM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC;IAC1D,QAAQ;IACR;IACA,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,OAAO,CAAC;IAC3D,QAAQ;IACR;IACA,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;IACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC;IAC5D,QAAQ;IACR;IACA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CAAgC,CAAC;IACtD,QAAQ,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE;IACzC;IACA,IAAI,MAAM,aAAa,CAAC,OAAO,EAAE;IACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAC9H,QAAQ;IACR;IACA,IAAI,MAAM,QAAQ,CAAC,MAAM,EAAE;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC;IACtD,QAAQ;IACR;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC;IACjD,QAAQ;IACR;IACA;;;;;;;;;;;;;;;"}
|
|
@@ -719,10 +719,16 @@ extension CustomError: LocalizedError {
|
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
|
|
722
|
+
private func verifyChecksum(file: URL, expectedHash: String) -> Bool {
|
|
723
|
+
let actualHash = calcChecksumV2(filePath: file)
|
|
724
|
+
return actualHash == expectedHash
|
|
725
|
+
}
|
|
726
|
+
|
|
722
727
|
public func downloadManifest(manifest: [ManifestEntry], version: String, sessionKey: String) throws -> BundleInfo {
|
|
723
728
|
let id = self.randomString(length: 10)
|
|
724
729
|
print("\(self.TAG) downloadManifest start \(id)")
|
|
725
730
|
let destFolder = self.getBundleDirectory(id: id)
|
|
731
|
+
let builtinFolder = Bundle.main.bundleURL.appendingPathComponent("public")
|
|
726
732
|
|
|
727
733
|
try FileManager.default.createDirectory(at: cacheFolder, withIntermediateDirectories: true, attributes: nil)
|
|
728
734
|
try FileManager.default.createDirectory(at: destFolder, withIntermediateDirectories: true, attributes: nil)
|
|
@@ -751,25 +757,25 @@ extension CustomError: LocalizedError {
|
|
|
751
757
|
let cacheFileName = "\(fileHash)_\(fileNameWithoutPath)"
|
|
752
758
|
let cacheFilePath = cacheFolder.appendingPathComponent(cacheFileName)
|
|
753
759
|
let destFilePath = destFolder.appendingPathComponent(fileName)
|
|
760
|
+
let builtinFilePath = builtinFolder.appendingPathComponent(fileName)
|
|
754
761
|
|
|
755
762
|
// Create necessary subdirectories in the destination folder
|
|
756
763
|
try FileManager.default.createDirectory(at: destFilePath.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil)
|
|
757
764
|
|
|
758
765
|
dispatchGroup.enter()
|
|
759
766
|
|
|
760
|
-
if FileManager.default.fileExists(atPath:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}
|
|
767
|
+
if FileManager.default.fileExists(atPath: builtinFilePath.path) && verifyChecksum(file: builtinFilePath, expectedHash: fileHash) {
|
|
768
|
+
try FileManager.default.copyItem(at: builtinFilePath, to: destFilePath)
|
|
769
|
+
print("\(self.TAG) downloadManifest \(fileName) using builtin file \(id)")
|
|
770
|
+
completedFiles += 1
|
|
771
|
+
self.notifyDownload(id: id, percent: self.calcTotalPercent(percent: Int((Double(completedFiles) / Double(totalFiles)) * 100), min: 10, max: 70))
|
|
772
|
+
dispatchGroup.leave()
|
|
773
|
+
} else if FileManager.default.fileExists(atPath: cacheFilePath.path) && verifyChecksum(file: cacheFilePath, expectedHash: fileHash) {
|
|
774
|
+
try FileManager.default.copyItem(at: cacheFilePath, to: destFilePath)
|
|
775
|
+
print("\(self.TAG) downloadManifest \(fileName) copy from cache \(id)")
|
|
776
|
+
completedFiles += 1
|
|
777
|
+
self.notifyDownload(id: id, percent: self.calcTotalPercent(percent: Int((Double(completedFiles) / Double(totalFiles)) * 100), min: 10, max: 70))
|
|
778
|
+
dispatchGroup.leave()
|
|
773
779
|
} else {
|
|
774
780
|
// File not in cache, download, decompress, and save to both cache and destination
|
|
775
781
|
AF.download(downloadUrl).responseData { response in
|
|
@@ -973,7 +979,7 @@ extension CustomError: LocalizedError {
|
|
|
973
979
|
let finalPath = tempDataPath.deletingLastPathComponent().appendingPathComponent("\(id)")
|
|
974
980
|
do {
|
|
975
981
|
var checksumDecrypted = checksum
|
|
976
|
-
if !self.hasOldPrivateKeyPropertyInConfig {
|
|
982
|
+
if !self.hasOldPrivateKeyPropertyInConfig && !sessionKey.isEmpty {
|
|
977
983
|
try self.decryptFileV2(filePath: tempDataPath, sessionKey: sessionKey, version: version)
|
|
978
984
|
} else {
|
|
979
985
|
try self.decryptFile(filePath: tempDataPath, sessionKey: sessionKey, version: version)
|
|
@@ -1334,13 +1340,13 @@ extension CustomError: LocalizedError {
|
|
|
1334
1340
|
}
|
|
1335
1341
|
case let .failure(error):
|
|
1336
1342
|
if let data = response.data, let bodyString = String(data: data, encoding: .utf8) {
|
|
1337
|
-
if
|
|
1343
|
+
if bodyString.contains("channel_not_found") && response.response?.statusCode == 400 && !self.defaultChannel.isEmpty {
|
|
1338
1344
|
getChannel.channel = self.defaultChannel
|
|
1339
1345
|
getChannel.status = "default"
|
|
1340
1346
|
return
|
|
1341
1347
|
}
|
|
1342
1348
|
}
|
|
1343
|
-
|
|
1349
|
+
|
|
1344
1350
|
print("\(self.TAG) Error get Channel", response.value ?? "", error)
|
|
1345
1351
|
getChannel.message = "Error get Channel \(String(describing: response.value)))"
|
|
1346
1352
|
getChannel.error = "response_error"
|
|
@@ -43,7 +43,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
43
43
|
CAPPluginMethod(name: "getBuiltinVersion", returnType: CAPPluginReturnPromise)
|
|
44
44
|
]
|
|
45
45
|
public var implementation = CapacitorUpdater()
|
|
46
|
-
private let PLUGIN_VERSION: String = "6.
|
|
46
|
+
private let PLUGIN_VERSION: String = "6.6.3"
|
|
47
47
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
48
48
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
49
49
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -125,7 +125,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
125
125
|
if resetWhenUpdate {
|
|
126
126
|
self.cleanupObsoleteVersions()
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
// Load the server
|
|
130
130
|
// This is very much swift specific, android does not do that
|
|
131
131
|
// In android we depend on the serverBasePath capacitor property
|
|
@@ -136,7 +136,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
136
136
|
if !self.initialLoad() {
|
|
137
137
|
print("\(self.implementation.TAG) unable to force reload, the plugin might fallback to the builtin version")
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
let nc = NotificationCenter.default
|
|
141
141
|
nc.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
|
|
142
142
|
nc.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
|
|
@@ -291,7 +291,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
291
291
|
DispatchQueue.global(qos: .background).async {
|
|
292
292
|
do {
|
|
293
293
|
let next = try self.implementation.download(url: url!, version: version, sessionKey: sessionKey)
|
|
294
|
-
if !self.implementation.hasOldPrivateKeyPropertyInConfig {
|
|
294
|
+
if !self.implementation.hasOldPrivateKeyPropertyInConfig && !sessionKey.isEmpty {
|
|
295
295
|
checksum = try self.implementation.decryptChecksum(checksum: checksum, version: version)
|
|
296
296
|
}
|
|
297
297
|
if (checksum != "" || self.implementation.publicKey != "") && next.getChecksum() != checksum {
|
|
@@ -698,7 +698,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
698
698
|
}
|
|
699
699
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
700
700
|
self.sendReadyToJs(current: current, msg: msg)
|
|
701
|
-
print("\(self.implementation.TAG) endBackGroundTaskWithNotif \(msg)")
|
|
701
|
+
print("\(self.implementation.TAG) endBackGroundTaskWithNotif \(msg) current: \(current.getVersionName()) latestVersionName: \(latestVersionName)")
|
|
702
702
|
self.endBackGroundTask()
|
|
703
703
|
}
|
|
704
704
|
|
|
@@ -775,7 +775,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
775
775
|
self.endBackGroundTaskWithNotif(msg: "Latest version is in error state. Aborting update.", latestVersionName: latestVersionName, current: current)
|
|
776
776
|
return
|
|
777
777
|
}
|
|
778
|
-
if !self.implementation.hasOldPrivateKeyPropertyInConfig {
|
|
778
|
+
if !self.implementation.hasOldPrivateKeyPropertyInConfig && !sessionKey.isEmpty {
|
|
779
779
|
res.checksum = try self.implementation.decryptChecksum(checksum: res.checksum, version: latestVersionName)
|
|
780
780
|
}
|
|
781
781
|
if res.checksum != "" && next.getChecksum() != res.checksum && res.manifest == nil {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-updater",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.3",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Live update for capacitor apps",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -56,25 +56,25 @@
|
|
|
56
56
|
"prepublishOnly": "npm run build"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@capacitor/android": "^6.
|
|
60
|
-
"@capacitor/cli": "^6.
|
|
61
|
-
"@capacitor/core": "^6.
|
|
59
|
+
"@capacitor/android": "^6.2.0",
|
|
60
|
+
"@capacitor/cli": "^6.2.0",
|
|
61
|
+
"@capacitor/core": "^6.2.0",
|
|
62
62
|
"@capacitor/docgen": "^0.3.0",
|
|
63
|
-
"@capacitor/ios": "^6.
|
|
63
|
+
"@capacitor/ios": "^6.2.0",
|
|
64
64
|
"@ionic/eslint-config": "^0.4.0",
|
|
65
65
|
"@ionic/prettier-config": "^4.0.0",
|
|
66
66
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
67
|
-
"@types/node": "^22.
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
69
|
-
"@typescript-eslint/parser": "^7.
|
|
70
|
-
"eslint": "^8.57.
|
|
67
|
+
"@types/node": "^22.10.1",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
69
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
70
|
+
"eslint": "^8.57.1",
|
|
71
71
|
"eslint-plugin-import": "^2.31.0",
|
|
72
|
-
"prettier": "^3.
|
|
73
|
-
"prettier-plugin-java": "^2.6.
|
|
72
|
+
"prettier": "^3.4.2",
|
|
73
|
+
"prettier-plugin-java": "^2.6.5",
|
|
74
74
|
"rimraf": "^6.0.1",
|
|
75
|
-
"rollup": "^4.
|
|
75
|
+
"rollup": "^4.28.0",
|
|
76
76
|
"swiftlint": "^2.0.0",
|
|
77
|
-
"typescript": "^5.
|
|
77
|
+
"typescript": "^5.7.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@capacitor/core": "^6.0.0"
|