nuxt-skew-protection 0.3.5 → 0.3.7
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -12,6 +12,7 @@ const props = defineProps({
|
|
|
12
12
|
const emit = defineEmits(["dismiss", "reload", "update:open", "chunksOutdated"]);
|
|
13
13
|
const skewProtection = useSkewProtection();
|
|
14
14
|
const version = skewProtection.clientVersion;
|
|
15
|
+
const isOnline = skewProtection.isOnline;
|
|
15
16
|
const chunksOutdated = ref(false);
|
|
16
17
|
const appOutdated = ref(false);
|
|
17
18
|
const outdatedPayload = ref(null);
|
|
@@ -24,6 +25,8 @@ skewProtection.onAppOutdated(() => {
|
|
|
24
25
|
appOutdated.value = true;
|
|
25
26
|
});
|
|
26
27
|
const isCurrentChunksOutdated = computed(() => {
|
|
28
|
+
if (!isOnline.value)
|
|
29
|
+
return false;
|
|
27
30
|
if (dismissed.value)
|
|
28
31
|
return false;
|
|
29
32
|
if (props.forceOpen)
|
|
@@ -31,6 +34,8 @@ const isCurrentChunksOutdated = computed(() => {
|
|
|
31
34
|
return chunksOutdated.value;
|
|
32
35
|
});
|
|
33
36
|
const isAppOutdated = computed(() => {
|
|
37
|
+
if (!isOnline.value)
|
|
38
|
+
return false;
|
|
34
39
|
if (dismissed.value)
|
|
35
40
|
return false;
|
|
36
41
|
if (props.forceOpen)
|
|
@@ -4,6 +4,7 @@ export declare function checkForUpdates(): Promise<void>;
|
|
|
4
4
|
export declare function useSkewProtection(): {
|
|
5
5
|
manifest: import("vue").Ref<NuxtAppManifestMeta | undefined, NuxtAppManifestMeta | undefined>;
|
|
6
6
|
clientVersion: any;
|
|
7
|
+
isOnline: Readonly<import("vue").ShallowRef<boolean>>;
|
|
7
8
|
isOutdated: import("vue").ComputedRef<boolean | undefined>;
|
|
8
9
|
onCurrentChunksOutdated: (callback: (payload: ChunksOutdatedPayload) => void | Promise<void>) => () => void;
|
|
9
10
|
onAppOutdated: (callback: (manifest?: NuxtAppManifestMeta) => void | Promise<void>) => () => void;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { buildAssetsURL } from "#internal/nuxt/paths";
|
|
2
|
+
import { useOnline } from "@vueuse/core";
|
|
2
3
|
import { useNuxtApp } from "nuxt/app";
|
|
3
4
|
import { computed, onUnmounted, ref } from "vue";
|
|
4
5
|
import { useRuntimeConfigSkewProtection } from "./useRuntimeConfigSkewProtection.js";
|
|
5
6
|
export async function checkForUpdates() {
|
|
7
|
+
if (import.meta.client && !useOnline().value)
|
|
8
|
+
return;
|
|
6
9
|
const nuxtApp = useNuxtApp();
|
|
7
10
|
const runtimeConfig = useRuntimeConfigSkewProtection();
|
|
8
11
|
const clientVersion = nuxtApp.$skewProtectionBuildId?.value || runtimeConfig.buildId;
|
|
@@ -42,6 +45,7 @@ export function useSkewProtection() {
|
|
|
42
45
|
return {
|
|
43
46
|
manifest,
|
|
44
47
|
clientVersion,
|
|
48
|
+
isOnline: useOnline(),
|
|
45
49
|
isOutdated: computed(() => manifest.value && clientVersion !== manifest.value.id),
|
|
46
50
|
onCurrentChunksOutdated,
|
|
47
51
|
onAppOutdated,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-skew-protection",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.7",
|
|
5
5
|
"description": "Solve Nuxt version skews with persistent assets and instant updates.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@nuxt/kit": "^4.2.1",
|
|
33
|
-
"@nuxtjs/robots": "^5.6.
|
|
33
|
+
"@nuxtjs/robots": "^5.6.3",
|
|
34
34
|
"@vueuse/core": "^14.1.0",
|
|
35
35
|
"consola": "^3.4.2",
|
|
36
36
|
"cookie-es": "^2.0.0",
|
|
@@ -43,42 +43,42 @@
|
|
|
43
43
|
"ufo": "^1.6.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@antfu/eslint-config": "^6.
|
|
46
|
+
"@antfu/eslint-config": "^6.5.1",
|
|
47
47
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
48
|
-
"@nuxt/content": "^3.
|
|
48
|
+
"@nuxt/content": "^3.9.0",
|
|
49
49
|
"@nuxt/devtools-ui-kit": "^3.1.1",
|
|
50
50
|
"@nuxt/module-builder": "^1.0.2",
|
|
51
|
-
"@nuxt/test-utils": "^3.
|
|
51
|
+
"@nuxt/test-utils": "^3.21.0",
|
|
52
52
|
"@nuxt/ui": "^4.2.1",
|
|
53
53
|
"@nuxtjs/color-mode": "^4.0.0",
|
|
54
54
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
55
55
|
"@nuxtjs/i18n": "^10.2.1",
|
|
56
56
|
"@types/ioredis": "^5.0.0",
|
|
57
57
|
"@types/ws": "^8.18.1",
|
|
58
|
-
"@unocss/nuxt": "66.5.10
|
|
59
|
-
"@unocss/preset-icons": "66.5.10
|
|
60
|
-
"@unocss/preset-uno": "66.5.10
|
|
61
|
-
"@unocss/runtime": "66.5.10
|
|
58
|
+
"@unocss/nuxt": "66.5.10",
|
|
59
|
+
"@unocss/preset-icons": "66.5.10",
|
|
60
|
+
"@unocss/preset-uno": "66.5.10",
|
|
61
|
+
"@unocss/runtime": "66.5.10",
|
|
62
62
|
"@vueuse/nuxt": "^14.1.0",
|
|
63
63
|
"better-sqlite3": "^12.5.0",
|
|
64
64
|
"bumpp": "^10.3.2",
|
|
65
65
|
"eslint": "^9.39.1",
|
|
66
66
|
"eventsource": "^4.1.0",
|
|
67
67
|
"execa": "^9.6.1",
|
|
68
|
-
"firebase-functions": "^7.0.
|
|
68
|
+
"firebase-functions": "^7.0.1",
|
|
69
69
|
"happy-dom": "^20.0.11",
|
|
70
70
|
"ioredis": "^5.8.2",
|
|
71
71
|
"nuxt": "^4.2.1",
|
|
72
72
|
"playwright-core": "^1.57.0",
|
|
73
73
|
"tsx": "^4.21.0",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
|
-
"unocss": "66.5.10
|
|
75
|
+
"unocss": "66.5.10",
|
|
76
76
|
"unstorage": "^1.17.3",
|
|
77
77
|
"vitest": "^4.0.15",
|
|
78
78
|
"vue": "^3.5.25",
|
|
79
79
|
"vue-router": "^4.6.3",
|
|
80
|
-
"vue-tsc": "^3.1.
|
|
81
|
-
"wrangler": "^4.
|
|
80
|
+
"vue-tsc": "^3.1.7",
|
|
81
|
+
"wrangler": "^4.53.0",
|
|
82
82
|
"ws": "^8.18.3"
|
|
83
83
|
},
|
|
84
84
|
"resolutions": {
|