@capuchoo/updater 0.1.0

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/dist/vue.js ADDED
@@ -0,0 +1,265 @@
1
+ import { a as openNativeInstaller, c as UpdateCheckBlockedError, d as logUpdateEvent, g as isNative, i as notifyAppReady, l as UpdaterConfigError, o as cleanApkCache, r as getCurrentBundle, s as downloadNativeUpdate, t as applyOtaUpdate, u as checkForUpdate, y as getUpdaterConfig } from "./ota.service-t2_hIxcy.js";
2
+ import { CapacitorUpdater } from "@capgo/capacitor-updater";
3
+ import { computed, readonly, ref } from "vue";
4
+ //#region src/vue/useUpdater.ts
5
+ const NO_PROGRESS = {
6
+ loaded: 0,
7
+ total: 0,
8
+ percent: 0
9
+ };
10
+ const DONE_PROGRESS = {
11
+ loaded: 100,
12
+ total: 100,
13
+ percent: 100
14
+ };
15
+ /**
16
+ * Module-level state: one updater per app, shared by every component that calls
17
+ * `useUpdater()`. Two independent copies would race over the same download.
18
+ */
19
+ const state = ref({
20
+ checking: false,
21
+ downloading: false,
22
+ installing: false,
23
+ updateAvailable: false,
24
+ currentUpdate: null,
25
+ progress: { ...NO_PROGRESS },
26
+ cachedPath: null,
27
+ error: null,
28
+ statusMessage: "",
29
+ lastCheckMessage: ""
30
+ });
31
+ const listeners = [];
32
+ let initialised = false;
33
+ function publish(update) {
34
+ if (state.value.currentUpdate?.kind === "native" && update.kind === "ota") return;
35
+ state.value.currentUpdate = update;
36
+ state.value.updateAvailable = true;
37
+ state.value.cachedPath = null;
38
+ state.value.progress = { ...NO_PROGRESS };
39
+ state.value.error = null;
40
+ state.value.lastCheckMessage = `Version ${update.version} is available`;
41
+ }
42
+ async function attachPluginListeners() {
43
+ listeners.push(await CapacitorUpdater.addListener("updateAvailable", ({ bundle }) => {
44
+ publish({
45
+ kind: "ota",
46
+ version: bundle.version,
47
+ bundleId: bundle.id,
48
+ required: false
49
+ });
50
+ }), await CapacitorUpdater.addListener("download", ({ percent }) => {
51
+ if (state.value.currentUpdate?.kind !== "ota") return;
52
+ state.value.downloading = true;
53
+ state.value.progress = {
54
+ loaded: percent,
55
+ total: 100,
56
+ percent
57
+ };
58
+ }), await CapacitorUpdater.addListener("downloadComplete", ({ bundle }) => {
59
+ if (state.value.currentUpdate?.kind !== "ota") return;
60
+ state.value.downloading = false;
61
+ state.value.currentUpdate.bundleId = bundle.id;
62
+ state.value.progress = { ...DONE_PROGRESS };
63
+ state.value.statusMessage = "Ready to install";
64
+ }), await CapacitorUpdater.addListener("downloadFailed", () => {
65
+ state.value.downloading = false;
66
+ state.value.error = "The update could not be downloaded";
67
+ }), await CapacitorUpdater.addListener("updateFailed", () => {
68
+ const { appName } = getUpdaterConfig();
69
+ state.value.error = `The update failed, so ${appName} restored the previous version`;
70
+ }));
71
+ }
72
+ /**
73
+ * Checks for an update.
74
+ *
75
+ * @param silent suppresses console noise for background checks.
76
+ * @returns whether an update is now pending.
77
+ */
78
+ async function check(silent = false) {
79
+ if (!isNative() || state.value.checking) return false;
80
+ state.value.checking = true;
81
+ state.value.error = null;
82
+ state.value.lastCheckMessage = "";
83
+ state.value.statusMessage = "Checking for updates...";
84
+ try {
85
+ const update = await checkForUpdate();
86
+ if (update) {
87
+ publish(update);
88
+ await logUpdateEvent("check", update);
89
+ return true;
90
+ }
91
+ if (!state.value.updateAvailable) {
92
+ const { appName } = getUpdaterConfig();
93
+ state.value.lastCheckMessage = `${appName} is up to date`;
94
+ }
95
+ return false;
96
+ } catch (error) {
97
+ if (error instanceof UpdaterConfigError) {
98
+ state.value.error = "Updates are not configured for this build";
99
+ console.error("[capuchoo]", error.problems.join("; "));
100
+ } else if (error instanceof UpdateCheckBlockedError) {
101
+ state.value.error = `The update service rejected this build: ${error.message}`;
102
+ console.error("[capuchoo]", error.message, error.response);
103
+ } else {
104
+ state.value.error = "Could not reach the update service";
105
+ if (!silent) console.error("[capuchoo] update check failed", error);
106
+ }
107
+ return false;
108
+ } finally {
109
+ state.value.checking = false;
110
+ state.value.statusMessage = "";
111
+ }
112
+ }
113
+ /** Downloads the pending update. For native updates, install is a second step. */
114
+ async function startDownload() {
115
+ const update = state.value.currentUpdate;
116
+ if (!update || state.value.downloading || state.value.installing) return;
117
+ state.value.error = null;
118
+ if (update.kind === "native" && state.value.cachedPath) {
119
+ await installNativeUpdate();
120
+ return;
121
+ }
122
+ state.value.downloading = true;
123
+ state.value.statusMessage = update.kind === "native" ? "Downloading the new version..." : "Downloading update...";
124
+ try {
125
+ if (update.kind === "native") {
126
+ state.value.cachedPath = await downloadNativeUpdate(update, (progress) => {
127
+ state.value.progress = progress;
128
+ });
129
+ state.value.progress = { ...DONE_PROGRESS };
130
+ state.value.statusMessage = "Download complete. Tap Install to continue.";
131
+ await logUpdateEvent("download_complete", update);
132
+ return;
133
+ }
134
+ await applyOtaUpdate(update);
135
+ } catch (error) {
136
+ state.value.error = error instanceof Error ? error.message : "The update failed";
137
+ await logUpdateEvent("error", update, { error: state.value.error });
138
+ } finally {
139
+ state.value.downloading = false;
140
+ if (!state.value.cachedPath) state.value.statusMessage = "";
141
+ }
142
+ }
143
+ /** Hands the downloaded APK to the Android installer. */
144
+ async function installNativeUpdate() {
145
+ const update = state.value.currentUpdate;
146
+ const path = state.value.cachedPath;
147
+ if (!update || update.kind !== "native" || !path) return;
148
+ state.value.installing = true;
149
+ state.value.error = null;
150
+ try {
151
+ await openNativeInstaller(path);
152
+ await logUpdateEvent("install", update);
153
+ } catch (error) {
154
+ state.value.error = error instanceof Error ? error.message : "Installation failed";
155
+ await logUpdateEvent("error", update, { error: state.value.error });
156
+ } finally {
157
+ state.value.installing = false;
158
+ }
159
+ }
160
+ /**
161
+ * Wires up the updater. Call once, from the app's Capacitor bootstrap.
162
+ *
163
+ * Also calls `notifyAppReady`, without which the OTA plugin rolls the bundle
164
+ * back after `appReadyTimeout`.
165
+ */
166
+ async function init() {
167
+ if (!isNative() || initialised) return;
168
+ initialised = true;
169
+ await notifyAppReady();
170
+ await attachPluginListeners();
171
+ await cleanApkCache();
172
+ await check(true);
173
+ }
174
+ async function cleanup() {
175
+ await Promise.all(listeners.splice(0).map((listener) => listener.remove()));
176
+ initialised = false;
177
+ }
178
+ /** Dismisses a pending update. Refuses for required updates and mid-download. */
179
+ async function dismiss() {
180
+ const update = state.value.currentUpdate;
181
+ if (!update || update.required || state.value.downloading) return;
182
+ await logUpdateEvent("cancel", update);
183
+ state.value.updateAvailable = false;
184
+ state.value.currentUpdate = null;
185
+ state.value.cachedPath = null;
186
+ state.value.statusMessage = "";
187
+ state.value.progress = { ...NO_PROGRESS };
188
+ }
189
+ function useUpdater() {
190
+ return {
191
+ state: readonly(state),
192
+ isChecking: computed(() => state.value.checking),
193
+ isDownloading: computed(() => state.value.downloading),
194
+ isInstalling: computed(() => state.value.installing),
195
+ updateAvailable: computed(() => state.value.updateAvailable),
196
+ currentUpdate: computed(() => state.value.currentUpdate),
197
+ progress: computed(() => state.value.progress),
198
+ cachedPath: computed(() => state.value.cachedPath),
199
+ error: computed(() => state.value.error),
200
+ statusMessage: computed(() => state.value.statusMessage),
201
+ lastCheckMessage: computed(() => state.value.lastCheckMessage),
202
+ /** True when the user may not postpone the update. */
203
+ isRequired: computed(() => state.value.currentUpdate?.required === true),
204
+ check,
205
+ startDownload,
206
+ installNativeUpdate,
207
+ dismiss,
208
+ init,
209
+ cleanup,
210
+ getCurrentBundle
211
+ };
212
+ }
213
+ //#endregion
214
+ //#region src/vue/useUpdatePrompt.ts
215
+ /**
216
+ * Derives everything an update prompt needs to render, so each app only writes
217
+ * the markup for its own design system.
218
+ *
219
+ * The styled component itself stays in the app on purpose: this package would
220
+ * otherwise have to ship a Framework7 dialog to one app and something else to
221
+ * the next, and a component library is not what makes updates work. The state
222
+ * machine is the reusable part.
223
+ */
224
+ function useUpdatePrompt() {
225
+ const updater = useUpdater();
226
+ const update = updater.currentUpdate;
227
+ const isNativeUpdate = computed(() => update.value?.kind === "native");
228
+ return {
229
+ ...updater,
230
+ /** Whether the prompt should be on screen at all. */
231
+ visible: computed(() => updater.updateAvailable.value || updater.error.value !== null),
232
+ title: computed(() => {
233
+ if (updater.error.value) return "Update problem";
234
+ if (!update.value) return "";
235
+ return update.value.required ? "Update required" : "Update available";
236
+ }),
237
+ subtitle: computed(() => {
238
+ if (!update.value) return "";
239
+ const kind = isNativeUpdate.value ? "app version" : "update";
240
+ return `Version ${update.value.version} - ${kind}`;
241
+ }),
242
+ body: computed(() => updater.error.value ?? update.value?.releaseNotes ?? ""),
243
+ /**
244
+ * Native updates need a download step and then an install step; OTA
245
+ * updates apply themselves once downloaded.
246
+ */
247
+ primaryLabel: computed(() => {
248
+ if (updater.isDownloading.value) return "Downloading...";
249
+ if (updater.isInstalling.value) return "Installing...";
250
+ if (isNativeUpdate.value && updater.cachedPath.value) return "Install now";
251
+ if (isNativeUpdate.value) return "Download";
252
+ return "Update now";
253
+ }),
254
+ primaryAction: () => isNativeUpdate.value && updater.cachedPath.value ? updater.installNativeUpdate() : updater.startDownload(),
255
+ /** Busy state - the primary button must be disabled. */
256
+ busy: computed(() => updater.isDownloading.value || updater.isInstalling.value),
257
+ /** A required update cannot be postponed, and neither can one mid-flight. */
258
+ dismissible: computed(() => !updater.isRequired.value && !updater.isDownloading.value && !updater.isInstalling.value),
259
+ showProgress: computed(() => updater.isDownloading.value && updater.progress.value.percent > 0)
260
+ };
261
+ }
262
+ //#endregion
263
+ export { useUpdatePrompt, useUpdater };
264
+
265
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.js","names":[],"sources":["../src/vue/useUpdater.ts","../src/vue/useUpdatePrompt.ts"],"sourcesContent":["import type { PluginListenerHandle } from \"@capacitor/core\";\nimport { CapacitorUpdater } from \"@capgo/capacitor-updater\";\nimport type { ResolvedUpdate } from \"@capuchoo/core\";\nimport { computed, readonly, ref } from \"vue\";\nimport {\n UpdateCheckBlockedError,\n UpdaterConfigError,\n checkForUpdate,\n logUpdateEvent,\n} from \"../api.service.js\";\nimport { getUpdaterConfig } from \"../config.js\";\nimport { isNative } from \"../device.js\";\nimport { cleanApkCache, downloadNativeUpdate, type DownloadProgress } from \"../download.service.js\";\nimport { openNativeInstaller } from \"../install.service.js\";\nimport { applyOtaUpdate, getCurrentBundle, notifyAppReady } from \"../ota.service.js\";\n\nexport interface UpdaterState {\n checking: boolean;\n downloading: boolean;\n installing: boolean;\n updateAvailable: boolean;\n currentUpdate: ResolvedUpdate | null;\n progress: DownloadProgress;\n /** Local path of a downloaded APK, ready to install. */\n cachedPath: string | null;\n error: string | null;\n /** Transient status for the current operation. */\n statusMessage: string;\n /** Result of the last check, shown when no update is pending. */\n lastCheckMessage: string;\n}\n\nconst NO_PROGRESS: DownloadProgress = { loaded: 0, total: 0, percent: 0 };\nconst DONE_PROGRESS: DownloadProgress = { loaded: 100, total: 100, percent: 100 };\n\n/**\n * Module-level state: one updater per app, shared by every component that calls\n * `useUpdater()`. Two independent copies would race over the same download.\n */\nconst state = ref<UpdaterState>({\n checking: false,\n downloading: false,\n installing: false,\n updateAvailable: false,\n currentUpdate: null,\n progress: { ...NO_PROGRESS },\n cachedPath: null,\n error: null,\n statusMessage: \"\",\n lastCheckMessage: \"\",\n});\n\nconst listeners: PluginListenerHandle[] = [];\nlet initialised = false;\n\nfunction publish(update: ResolvedUpdate): void {\n // A pending native update outranks an OTA bundle: the bundle may well be the\n // one that needs the new binary. Do not let a plugin event downgrade it.\n if (state.value.currentUpdate?.kind === \"native\" && update.kind === \"ota\") return;\n\n state.value.currentUpdate = update;\n state.value.updateAvailable = true;\n state.value.cachedPath = null;\n state.value.progress = { ...NO_PROGRESS };\n state.value.error = null;\n state.value.lastCheckMessage = `Version ${update.version} is available`;\n}\n\nasync function attachPluginListeners(): Promise<void> {\n listeners.push(\n // Raised when the plugin's own background check finds a bundle. With\n // autoUpdate: \"onlyDownload\" it has already been fetched, so the id is\n // enough to apply it without downloading again.\n await CapacitorUpdater.addListener(\"updateAvailable\", ({ bundle }) => {\n publish({\n kind: \"ota\",\n version: bundle.version,\n bundleId: bundle.id,\n required: false,\n });\n }),\n\n await CapacitorUpdater.addListener(\"download\", ({ percent }) => {\n if (state.value.currentUpdate?.kind !== \"ota\") return;\n state.value.downloading = true;\n state.value.progress = { loaded: percent, total: 100, percent };\n }),\n\n await CapacitorUpdater.addListener(\"downloadComplete\", ({ bundle }) => {\n if (state.value.currentUpdate?.kind !== \"ota\") return;\n state.value.downloading = false;\n state.value.currentUpdate.bundleId = bundle.id;\n state.value.progress = { ...DONE_PROGRESS };\n state.value.statusMessage = \"Ready to install\";\n }),\n\n await CapacitorUpdater.addListener(\"downloadFailed\", () => {\n state.value.downloading = false;\n state.value.error = \"The update could not be downloaded\";\n }),\n\n await CapacitorUpdater.addListener(\"updateFailed\", () => {\n const { appName } = getUpdaterConfig();\n state.value.error = `The update failed, so ${appName} restored the previous version`;\n }),\n );\n}\n\n/**\n * Checks for an update.\n *\n * @param silent suppresses console noise for background checks.\n * @returns whether an update is now pending.\n */\nasync function check(silent = false): Promise<boolean> {\n if (!isNative() || state.value.checking) return false;\n\n state.value.checking = true;\n state.value.error = null;\n state.value.lastCheckMessage = \"\";\n state.value.statusMessage = \"Checking for updates...\";\n\n try {\n const update = await checkForUpdate();\n\n if (update) {\n publish(update);\n await logUpdateEvent(\"check\", update);\n return true;\n }\n\n if (!state.value.updateAvailable) {\n const { appName } = getUpdaterConfig();\n state.value.lastCheckMessage = `${appName} is up to date`;\n }\n return false;\n } catch (error) {\n // Configuration and channel errors are the developer's problem, not the\n // user's, but reporting \"up to date\" would hide them completely.\n if (error instanceof UpdaterConfigError) {\n state.value.error = \"Updates are not configured for this build\";\n console.error(\"[capuchoo]\", error.problems.join(\"; \"));\n } else if (error instanceof UpdateCheckBlockedError) {\n state.value.error = `The update service rejected this build: ${error.message}`;\n console.error(\"[capuchoo]\", error.message, error.response);\n } else {\n state.value.error = \"Could not reach the update service\";\n if (!silent) console.error(\"[capuchoo] update check failed\", error);\n }\n return false;\n } finally {\n state.value.checking = false;\n state.value.statusMessage = \"\";\n }\n}\n\n/** Downloads the pending update. For native updates, install is a second step. */\nasync function startDownload(): Promise<void> {\n const update = state.value.currentUpdate;\n if (!update || state.value.downloading || state.value.installing) return;\n\n state.value.error = null;\n\n // Already on disk - go straight to the installer.\n if (update.kind === \"native\" && state.value.cachedPath) {\n await installNativeUpdate();\n return;\n }\n\n state.value.downloading = true;\n state.value.statusMessage =\n update.kind === \"native\" ? \"Downloading the new version...\" : \"Downloading update...\";\n\n try {\n if (update.kind === \"native\") {\n state.value.cachedPath = await downloadNativeUpdate(update, (progress) => {\n state.value.progress = progress;\n });\n state.value.progress = { ...DONE_PROGRESS };\n state.value.statusMessage = \"Download complete. Tap Install to continue.\";\n await logUpdateEvent(\"download_complete\", update);\n return;\n }\n\n // Reloads the WebView on success, so nothing below runs.\n await applyOtaUpdate(update);\n } catch (error) {\n state.value.error = error instanceof Error ? error.message : \"The update failed\";\n await logUpdateEvent(\"error\", update, { error: state.value.error });\n } finally {\n state.value.downloading = false;\n if (!state.value.cachedPath) state.value.statusMessage = \"\";\n }\n}\n\n/** Hands the downloaded APK to the Android installer. */\nasync function installNativeUpdate(): Promise<void> {\n const update = state.value.currentUpdate;\n const path = state.value.cachedPath;\n if (!update || update.kind !== \"native\" || !path) return;\n\n state.value.installing = true;\n state.value.error = null;\n\n try {\n await openNativeInstaller(path);\n await logUpdateEvent(\"install\", update);\n } catch (error) {\n state.value.error = error instanceof Error ? error.message : \"Installation failed\";\n await logUpdateEvent(\"error\", update, { error: state.value.error });\n } finally {\n state.value.installing = false;\n }\n}\n\n/**\n * Wires up the updater. Call once, from the app's Capacitor bootstrap.\n *\n * Also calls `notifyAppReady`, without which the OTA plugin rolls the bundle\n * back after `appReadyTimeout`.\n */\nasync function init(): Promise<void> {\n if (!isNative() || initialised) return;\n initialised = true;\n\n await notifyAppReady();\n await attachPluginListeners();\n await cleanApkCache();\n await check(true);\n}\n\nasync function cleanup(): Promise<void> {\n await Promise.all(listeners.splice(0).map((listener) => listener.remove()));\n initialised = false;\n}\n\n/** Dismisses a pending update. Refuses for required updates and mid-download. */\nasync function dismiss(): Promise<void> {\n const update = state.value.currentUpdate;\n if (!update || update.required || state.value.downloading) return;\n\n await logUpdateEvent(\"cancel\", update);\n state.value.updateAvailable = false;\n state.value.currentUpdate = null;\n state.value.cachedPath = null;\n state.value.statusMessage = \"\";\n state.value.progress = { ...NO_PROGRESS };\n}\n\nexport function useUpdater() {\n return {\n state: readonly(state),\n isChecking: computed(() => state.value.checking),\n isDownloading: computed(() => state.value.downloading),\n isInstalling: computed(() => state.value.installing),\n updateAvailable: computed(() => state.value.updateAvailable),\n currentUpdate: computed(() => state.value.currentUpdate),\n progress: computed(() => state.value.progress),\n cachedPath: computed(() => state.value.cachedPath),\n error: computed(() => state.value.error),\n statusMessage: computed(() => state.value.statusMessage),\n lastCheckMessage: computed(() => state.value.lastCheckMessage),\n /** True when the user may not postpone the update. */\n isRequired: computed(() => state.value.currentUpdate?.required === true),\n\n check,\n startDownload,\n installNativeUpdate,\n dismiss,\n init,\n cleanup,\n getCurrentBundle,\n };\n}\n\n/** @internal test hook - resets module state between cases. */\nexport function __resetUpdaterState(): void {\n listeners.length = 0;\n initialised = false;\n state.value = {\n checking: false,\n downloading: false,\n installing: false,\n updateAvailable: false,\n currentUpdate: null,\n progress: { ...NO_PROGRESS },\n cachedPath: null,\n error: null,\n statusMessage: \"\",\n lastCheckMessage: \"\",\n };\n}\n","import { computed } from \"vue\";\nimport { useUpdater } from \"./useUpdater.js\";\n\n/**\n * Derives everything an update prompt needs to render, so each app only writes\n * the markup for its own design system.\n *\n * The styled component itself stays in the app on purpose: this package would\n * otherwise have to ship a Framework7 dialog to one app and something else to\n * the next, and a component library is not what makes updates work. The state\n * machine is the reusable part.\n */\nexport function useUpdatePrompt() {\n const updater = useUpdater();\n\n const update = updater.currentUpdate;\n const isNativeUpdate = computed(() => update.value?.kind === \"native\");\n\n return {\n ...updater,\n\n /** Whether the prompt should be on screen at all. */\n visible: computed(() => updater.updateAvailable.value || updater.error.value !== null),\n\n title: computed(() => {\n if (updater.error.value) return \"Update problem\";\n if (!update.value) return \"\";\n return update.value.required ? \"Update required\" : \"Update available\";\n }),\n\n subtitle: computed(() => {\n if (!update.value) return \"\";\n const kind = isNativeUpdate.value ? \"app version\" : \"update\";\n return `Version ${update.value.version} - ${kind}`;\n }),\n\n body: computed(() => updater.error.value ?? update.value?.releaseNotes ?? \"\"),\n\n /**\n * Native updates need a download step and then an install step; OTA\n * updates apply themselves once downloaded.\n */\n primaryLabel: computed(() => {\n if (updater.isDownloading.value) return \"Downloading...\";\n if (updater.isInstalling.value) return \"Installing...\";\n if (isNativeUpdate.value && updater.cachedPath.value) return \"Install now\";\n if (isNativeUpdate.value) return \"Download\";\n return \"Update now\";\n }),\n\n primaryAction: () =>\n isNativeUpdate.value && updater.cachedPath.value\n ? updater.installNativeUpdate()\n : updater.startDownload(),\n\n /** Busy state - the primary button must be disabled. */\n busy: computed(() => updater.isDownloading.value || updater.isInstalling.value),\n\n /** A required update cannot be postponed, and neither can one mid-flight. */\n dismissible: computed(\n () =>\n !updater.isRequired.value && !updater.isDownloading.value && !updater.isInstalling.value,\n ),\n\n showProgress: computed(() => updater.isDownloading.value && updater.progress.value.percent > 0),\n };\n}\n"],"mappings":";;;;AAgCA,MAAM,cAAgC;CAAE,QAAQ;CAAG,OAAO;CAAG,SAAS;AAAE;AACxE,MAAM,gBAAkC;CAAE,QAAQ;CAAK,OAAO;CAAK,SAAS;AAAI;;;;;AAMhF,MAAM,QAAQ,IAAkB;CAC9B,UAAU;CACV,aAAa;CACb,YAAY;CACZ,iBAAiB;CACjB,eAAe;CACf,UAAU,EAAE,GAAG,YAAY;CAC3B,YAAY;CACZ,OAAO;CACP,eAAe;CACf,kBAAkB;AACpB,CAAC;AAED,MAAM,YAAoC,CAAC;AAC3C,IAAI,cAAc;AAElB,SAAS,QAAQ,QAA8B;CAG7C,IAAI,MAAM,MAAM,eAAe,SAAS,YAAY,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O;GACxC,IAAI,QAAQ,aAAa,OAAO,OAAO;GACvC,IAAI,eAAe,SAAS,QAAQ,WAAW,OAAO,OAAO;GAC7D,IAAI,eAAe,OAAO,OAAO;GACjC,OAAO;EACT,CAAC;EAED,qBACE,eAAe,SAAS,QAAQ,WAAW,QACvC,QAAQ,oBAAoB,IAC5B,QAAQ,cAAc;;EAG5B,MAAM,eAAe,QAAQ,cAAc,SAAS,QAAQ,aAAa,KAAK;;EAG9E,aAAa,eAET,CAAC,QAAQ,WAAW,SAAS,CAAC,QAAQ,cAAc,SAAS,CAAC,QAAQ,aAAa,KACvF;EAEA,cAAc,eAAe,QAAQ,cAAc,SAAS,QAAQ,SAAS,MAAM,UAAU,CAAC;CAChG;AACF"}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@capuchoo/updater",
3
+ "version": "0.1.0",
4
+ "description": "App-side runtime for Capucho OTA and native updates in Capacitor apps",
5
+ "keywords": [
6
+ "capacitor",
7
+ "capucho",
8
+ "live-update",
9
+ "ota",
10
+ "vue"
11
+ ],
12
+ "homepage": "https://github.com/aybinv7/capuchoo/tree/main/packages/updater",
13
+ "license": "MIT",
14
+ "author": "aybinv7",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/aybinv7/capuchoo.git",
18
+ "directory": "packages/updater"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "type": "module",
24
+ "sideEffects": false,
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ },
32
+ "./vue": {
33
+ "types": "./dist/vue.d.ts",
34
+ "default": "./dist/vue.js"
35
+ },
36
+ "./capacitor": {
37
+ "types": "./dist/capacitor-config.d.ts",
38
+ "default": "./dist/capacitor-config.js"
39
+ }
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "@capuchoo/core": "0.1.0"
46
+ },
47
+ "devDependencies": {
48
+ "@capacitor/app": "^8.0.0",
49
+ "@capacitor/core": "^8.0.0",
50
+ "@capacitor/file-transfer": "^2.0.5",
51
+ "@capacitor/filesystem": "^8.1.2",
52
+ "@capacitor/network": "^8.0.1",
53
+ "@capawesome-team/capacitor-file-opener": "^8.0.1",
54
+ "@capgo/capacitor-updater": "^8.51.8",
55
+ "typescript": "^5.9.3",
56
+ "vite-plus": "0.2.9",
57
+ "vue": "^3.5.25"
58
+ },
59
+ "peerDependencies": {
60
+ "@capacitor/app": "^8.0.0",
61
+ "@capacitor/core": "^8.0.0",
62
+ "@capacitor/file-transfer": "^2.0.5",
63
+ "@capacitor/filesystem": "^8.1.2",
64
+ "@capacitor/network": "^8.0.1",
65
+ "@capawesome-team/capacitor-file-opener": "^8.0.1",
66
+ "@capgo/capacitor-updater": "^8.51.8",
67
+ "vue": "^3.5.25"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "vue": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "scripts": {
75
+ "build": "vp pack",
76
+ "test": "vp test --run"
77
+ }
78
+ }