@vite-hub/device 0.5.0 → 0.6.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/{device-BTHQPRQv.js → device-Bh2mN8kx.js} +3 -6
- package/dist/index.d.ts +0 -4
- package/dist/index.js +2 -3
- package/dist/vue.d.ts +1 -3
- package/dist/vue.js +2 -3
- package/package.json +9 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineErrors } from "@vite-hub/runtime";
|
|
2
|
-
|
|
2
|
+
// src/errors.ts
|
|
3
3
|
const deviceErrors = /*#__PURE__*/ defineErrors({
|
|
4
4
|
docs: "https://vitehub.dev/docs/device/diagnostics",
|
|
5
5
|
codes: {
|
|
@@ -47,8 +47,7 @@ function warn(error) {
|
|
|
47
47
|
if (error.cause === void 0) console.warn(message);
|
|
48
48
|
else console.warn(message, error.cause);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
//#region src/indexeddb.ts
|
|
50
|
+
// src/indexeddb.ts
|
|
52
51
|
const databaseName = "vitehub-device";
|
|
53
52
|
const format = 3;
|
|
54
53
|
const metaKey = "device";
|
|
@@ -205,8 +204,7 @@ function browserChannel() {
|
|
|
205
204
|
}
|
|
206
205
|
};
|
|
207
206
|
}
|
|
208
|
-
|
|
209
|
-
//#region src/device.ts
|
|
207
|
+
// src/device.ts
|
|
210
208
|
const maxDeviceBytes = 5242880;
|
|
211
209
|
const openTimeout = 1e3;
|
|
212
210
|
const encoder = /*#__PURE__*/ new TextEncoder();
|
|
@@ -641,5 +639,4 @@ function currentDevice() {
|
|
|
641
639
|
});
|
|
642
640
|
return browserDevice;
|
|
643
641
|
}
|
|
644
|
-
//#endregion
|
|
645
642
|
export { deviceErrors as a, currentDevice as i, checkKey as n, checkMaxAge as r, checkAccount as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Result } from "@vite-hub/runtime";
|
|
2
|
-
//#region src/device.d.ts
|
|
3
2
|
/** What `inspectDevice()` returns. */
|
|
4
3
|
interface DeviceInspection {
|
|
5
4
|
/**
|
|
@@ -25,8 +24,6 @@ interface OpenDeviceOptions {
|
|
|
25
24
|
*/
|
|
26
25
|
version?: string;
|
|
27
26
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/index.d.ts
|
|
30
27
|
/**
|
|
31
28
|
* Reads the stored copies into memory, so the first render of `useStoredData()` shows them at once. Await it before
|
|
32
29
|
* `app.mount()`. It never fails: without IndexedDB, or when IndexedDB takes more than 1 second, the page keeps its
|
|
@@ -52,5 +49,4 @@ export declare function setDeviceAccount(account: string | null): Promise<Result
|
|
|
52
49
|
export declare function clearDevice(): Promise<Result<void, "DEVICE_STORAGE_FAILED">>;
|
|
53
50
|
/** The account, the storage, and each stored copy of this tab, to debug stored reads in code or in the browser console. */
|
|
54
51
|
export declare function inspectDevice(): DeviceInspection;
|
|
55
|
-
//#endregion
|
|
56
52
|
export type { DeviceInspection, OpenDeviceOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as currentDevice, t as checkAccount } from "./device-
|
|
2
|
-
|
|
1
|
+
import { i as currentDevice, t as checkAccount } from "./device-Bh2mN8kx.js";
|
|
2
|
+
// src/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reads the stored copies into memory, so the first render of `useStoredData()` shows them at once. Await it before
|
|
5
5
|
* `app.mount()`. It never fails: without IndexedDB, or when IndexedDB takes more than 1 second, the page keeps its
|
|
@@ -39,5 +39,4 @@ function inspectDevice() {
|
|
|
39
39
|
entries: []
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { clearDevice, inspectDevice, openDevice, setDeviceAccount };
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
-
//#region src/vue.d.ts
|
|
3
2
|
/** `idle` on the server and before the loader starts, `pending` while the loader runs, then `success` or `error`. */
|
|
4
3
|
export type StoredDataStatus = "idle" | "pending" | "success" | "error";
|
|
5
4
|
export interface UseStoredDataOptions<TData, TDefault> {
|
|
@@ -74,5 +73,4 @@ export declare function useStoredData<TData, TDefault = undefined>(key: MaybeRef
|
|
|
74
73
|
export declare function useStoredFetch<TData = unknown>(url: MaybeRefOrGetter<string>, options: UseStoredFetchOptions<TData, TData> & {
|
|
75
74
|
default: () => NoInfer<TData>;
|
|
76
75
|
}): UseStoredDataReturn<TData, TData>;
|
|
77
|
-
export declare function useStoredFetch<TData = unknown, TDefault = undefined>(url: MaybeRefOrGetter<string>, options?: UseStoredFetchOptions<TData, TDefault>): UseStoredDataReturn<TData, TDefault>;
|
|
78
|
-
//#endregion
|
|
76
|
+
export declare function useStoredFetch<TData = unknown, TDefault = undefined>(url: MaybeRefOrGetter<string>, options?: UseStoredFetchOptions<TData, TDefault>): UseStoredDataReturn<TData, TDefault>;
|
package/dist/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as deviceErrors, i as currentDevice, n as checkKey, r as checkMaxAge, t as checkAccount } from "./device-
|
|
1
|
+
import { a as deviceErrors, i as currentDevice, n as checkKey, r as checkMaxAge, t as checkAccount } from "./device-Bh2mN8kx.js";
|
|
2
2
|
import { computed, getCurrentInstance, getCurrentScope, onMounted, onScopeDispose, shallowRef, toValue, watch } from "vue";
|
|
3
|
-
|
|
3
|
+
// src/vue.ts
|
|
4
4
|
const week = 6048e5;
|
|
5
5
|
const reads = /* @__PURE__ */ new Map();
|
|
6
6
|
let watching = false;
|
|
@@ -241,5 +241,4 @@ function useRead(key, loader, options) {
|
|
|
241
241
|
refresh: () => load(current.value, loader, device)
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
//#endregion
|
|
245
244
|
export { useStoredData, useStoredFetch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/device",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Stored reads for the browser: show the last server answer at once from the device, for the signed-in account, then refresh it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vite-hub/runtime": "0.
|
|
43
|
+
"@vite-hub/runtime": "0.6.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^24.19.
|
|
46
|
+
"@types/node": "^24.19.2",
|
|
47
47
|
"@vite-hub/internal": "0.0.1",
|
|
48
|
-
"happy-dom": "21.0.
|
|
49
|
-
"playwright-core": "^1.
|
|
48
|
+
"happy-dom": "21.0.4",
|
|
49
|
+
"playwright-core": "^1.65.1",
|
|
50
50
|
"publint": "^0.3.25",
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
|
-
"vite": "^8.
|
|
53
|
-
"vite-plus": "^
|
|
54
|
-
"vitest": "
|
|
55
|
-
"vue": "3.5.
|
|
52
|
+
"vite": "^8.3.8",
|
|
53
|
+
"vite-plus": "^1.7.0",
|
|
54
|
+
"vitest": "5.1.0",
|
|
55
|
+
"vue": "3.5.46"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vue": "^3.5.0"
|