nuxt-skew-protection 2.0.3 → 2.0.4
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/bin/migrate.mjs +21 -3
- package/dist/devtools/lib/skew-protection/data.ts +6 -2
- package/dist/devtools/pages/skew-protection/index.vue +28 -6
- package/dist/devtools/pages/skew-protection/versions.vue +6 -2
- package/dist/devtools/pages/skew-protection.vue +25 -4
- package/dist/module.d.mts +7 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +435 -96
- package/dist/runtime/adapters/types.js +12 -4
- package/dist/runtime/app/components/SkewNotification.d.vue.ts +20 -18
- package/dist/runtime/app/components/SkewNotification.vue.d.ts +20 -18
- package/dist/runtime/app/composables/useActiveConnections.js +6 -1
- package/dist/runtime/app/plugins/check-updates-adapter.client.js +3 -1
- package/dist/runtime/app/plugins/check-updates-sse.client.js +3 -1
- package/dist/runtime/app/plugins/check-updates-websocket.client.js +3 -1
- package/dist/runtime/app/plugins/sw-track-user-modules.client.js +4 -1
- package/dist/runtime/app/utils/create-skew-connection.js +23 -7
- package/dist/runtime/server/plugins/connection-tracking-cloudflare-durable.js +36 -7
- package/dist/runtime/server/plugins/connection-tracking.js +27 -5
- package/dist/runtime/server/routes/__skew/sse.js +4 -1
- package/dist/runtime/server/routes/__skew-devtools/debug-production.get.js +6 -2
- package/dist/runtime/server/utils/html-cache-policy.js +11 -3
- package/package.json +26 -25
package/bin/migrate.mjs
CHANGED
|
@@ -10,8 +10,22 @@
|
|
|
10
10
|
import { readdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
11
11
|
import { join, resolve } from 'node:path'
|
|
12
12
|
|
|
13
|
-
const SOURCE_EXTENSIONS = new Set([
|
|
14
|
-
|
|
13
|
+
const SOURCE_EXTENSIONS = new Set([
|
|
14
|
+
'.vue',
|
|
15
|
+
'.ts',
|
|
16
|
+
'.tsx',
|
|
17
|
+
'.js',
|
|
18
|
+
'.jsx',
|
|
19
|
+
'.mjs',
|
|
20
|
+
'.mts',
|
|
21
|
+
])
|
|
22
|
+
const IGNORE_DIRS = new Set([
|
|
23
|
+
'node_modules',
|
|
24
|
+
'.nuxt',
|
|
25
|
+
'.output',
|
|
26
|
+
'dist',
|
|
27
|
+
'.git',
|
|
28
|
+
])
|
|
15
29
|
|
|
16
30
|
const replacements = [
|
|
17
31
|
{
|
|
@@ -77,7 +91,11 @@ function migrate(cwd) {
|
|
|
77
91
|
const matches = modified.match(r.pattern)
|
|
78
92
|
if (matches && matches.length > 0) {
|
|
79
93
|
modified = modified.replace(r.pattern, r.replacement)
|
|
80
|
-
changes.push({
|
|
94
|
+
changes.push({
|
|
95
|
+
file: file.replace(cwd, '.'),
|
|
96
|
+
name: r.name,
|
|
97
|
+
count: matches.length,
|
|
98
|
+
})
|
|
81
99
|
}
|
|
82
100
|
}
|
|
83
101
|
|
|
@@ -13,7 +13,9 @@ const { data: debugData, status: debugStatus } = useAsyncData<DebugResponse | nu
|
|
|
13
13
|
// The devtools panel may load before its debug endpoint is available.
|
|
14
14
|
return null
|
|
15
15
|
})
|
|
16
|
-
}, {
|
|
16
|
+
}, {
|
|
17
|
+
watch: [refreshTime],
|
|
18
|
+
})
|
|
17
19
|
|
|
18
20
|
export { debugData }
|
|
19
21
|
|
|
@@ -36,7 +38,9 @@ export async function fetchProductionData() {
|
|
|
36
38
|
productionData.value = await appFetch.value<ProductionDebugResponse>('/__skew-devtools/debug-production', {
|
|
37
39
|
query: { url },
|
|
38
40
|
}).catch((err: unknown) => {
|
|
39
|
-
productionError.value = err instanceof Error
|
|
41
|
+
productionError.value = err instanceof Error
|
|
42
|
+
? err.message
|
|
43
|
+
: 'Failed to connect to production'
|
|
40
44
|
return null
|
|
41
45
|
})
|
|
42
46
|
}
|
|
@@ -22,10 +22,26 @@ const cookieItems = computed(() => {
|
|
|
22
22
|
if (!cookie)
|
|
23
23
|
return []
|
|
24
24
|
return [
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
{
|
|
26
|
+
key: 'Name',
|
|
27
|
+
value: String(cookie.name || '__nkpv'),
|
|
28
|
+
mono: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'Max Age',
|
|
32
|
+
value: cookie.maxAge
|
|
33
|
+
? `${cookie.maxAge}s`
|
|
34
|
+
: 'Not set',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: 'Path',
|
|
38
|
+
value: String(cookie.path || '/'),
|
|
39
|
+
mono: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'SameSite',
|
|
43
|
+
value: String(cookie.sameSite || 'lax'),
|
|
44
|
+
},
|
|
29
45
|
]
|
|
30
46
|
})
|
|
31
47
|
|
|
@@ -36,9 +52,15 @@ const healthItems = computed(() => {
|
|
|
36
52
|
if (!h)
|
|
37
53
|
return []
|
|
38
54
|
return [
|
|
39
|
-
{
|
|
55
|
+
{
|
|
56
|
+
key: 'Status',
|
|
57
|
+
value: h.ok ? 'Healthy' : 'Unhealthy',
|
|
58
|
+
},
|
|
40
59
|
{ key: 'Build ID', value: h.version, mono: true },
|
|
41
|
-
{
|
|
60
|
+
{
|
|
61
|
+
key: 'Uptime',
|
|
62
|
+
value: formatUptime(h.uptime),
|
|
63
|
+
},
|
|
42
64
|
]
|
|
43
65
|
})
|
|
44
66
|
|
|
@@ -23,14 +23,18 @@ const versions = computed(() => {
|
|
|
23
23
|
expires: new Date(info.expires),
|
|
24
24
|
assetCount: info.assets?.length || 0,
|
|
25
25
|
deletedChunks: info.deletedChunks?.length || 0,
|
|
26
|
-
isExpired: currentTime === null
|
|
26
|
+
isExpired: currentTime === null
|
|
27
|
+
? false
|
|
28
|
+
: new Date(info.expires).getTime() < currentTime,
|
|
27
29
|
}))
|
|
28
30
|
.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
|
|
29
31
|
})
|
|
30
32
|
|
|
31
33
|
const currentBuildId = computed(() => {
|
|
32
34
|
const id = productionData.value?.manifest?.id
|
|
33
|
-
return typeof id === 'string'
|
|
35
|
+
return typeof id === 'string'
|
|
36
|
+
? id
|
|
37
|
+
: null
|
|
34
38
|
})
|
|
35
39
|
|
|
36
40
|
function formatDate(date: Date): string {
|
|
@@ -29,10 +29,31 @@ watch(() => route.path, (p) => {
|
|
|
29
29
|
}, { immediate: true })
|
|
30
30
|
|
|
31
31
|
const navItems = [
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
{
|
|
33
|
+
value: 'overview',
|
|
34
|
+
to: '/skew-protection',
|
|
35
|
+
icon: 'carbon:dashboard',
|
|
36
|
+
label: 'Overview',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: 'versions',
|
|
40
|
+
to: '/skew-protection/versions',
|
|
41
|
+
icon: 'carbon:version',
|
|
42
|
+
label: 'Versions',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: 'connections',
|
|
46
|
+
to: '/skew-protection/connections',
|
|
47
|
+
icon: 'carbon:connection-signal',
|
|
48
|
+
label: 'Connections',
|
|
49
|
+
devOnly: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: 'docs',
|
|
53
|
+
to: '/skew-protection/docs',
|
|
54
|
+
icon: 'carbon:book',
|
|
55
|
+
label: 'Docs',
|
|
56
|
+
},
|
|
36
57
|
]
|
|
37
58
|
</script>
|
|
38
59
|
|
package/dist/module.d.mts
CHANGED
|
@@ -9,6 +9,8 @@ interface ModuleOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
storage?: (Record<string, any> & {
|
|
11
11
|
driver: string;
|
|
12
|
+
/** Enable abandoned-upload cleanup only when reads reflect completed writes immediately. */
|
|
13
|
+
readConsistency?: 'strong' | 'eventual';
|
|
12
14
|
});
|
|
13
15
|
/**
|
|
14
16
|
* How long to retain old versions (in days)
|
|
@@ -65,6 +67,11 @@ interface ModuleOptions {
|
|
|
65
67
|
* @note Automatically disabled when using a CDN URL or native Vercel Skew Protection
|
|
66
68
|
*/
|
|
67
69
|
bundleAssets?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Track loaded chunks with a service worker. Disable for apps sharing an origin.
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
serviceWorker?: boolean;
|
|
68
75
|
/**
|
|
69
76
|
* Enable or disable the module
|
|
70
77
|
* @default true
|
package/dist/module.json
CHANGED