nuxt-skew-protection 1.1.1 → 1.3.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.
Files changed (41) hide show
  1. package/dist/devtools/lib/skew-protection/data.ts +46 -0
  2. package/dist/devtools/lib/skew-protection/rpc.ts +7 -0
  3. package/dist/devtools/lib/skew-protection/types.ts +46 -0
  4. package/dist/devtools/nuxt.config.ts +3 -0
  5. package/dist/devtools/pages/skew-protection/connections.vue +124 -0
  6. package/dist/devtools/pages/skew-protection/docs.vue +3 -0
  7. package/dist/devtools/pages/skew-protection/index.vue +153 -0
  8. package/dist/devtools/pages/skew-protection/versions.vue +128 -0
  9. package/dist/devtools/pages/skew-protection.vue +53 -0
  10. package/dist/module.d.mts +18 -2
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +52 -11
  13. package/dist/runtime/app/composables/useSkewProtection.js +1 -1
  14. package/dist/runtime/app/plugins/check-updates-adapter.client.js +1 -1
  15. package/dist/runtime/app/plugins/check-updates-sse.client.js +4 -2
  16. package/dist/runtime/app/plugins/check-updates-websocket.client.js +4 -2
  17. package/dist/runtime/app/utils/create-skew-connection.js +8 -5
  18. package/dist/runtime/server/routes/__skew-devtools/debug.get.js +1 -1
  19. package/dist/runtime/types.d.ts +8 -0
  20. package/package.json +36 -34
  21. package/dist/devtools/200.html +0 -1
  22. package/dist/devtools/404.html +0 -1
  23. package/dist/devtools/_nuxt/5LtG10aQ.js +0 -1
  24. package/dist/devtools/_nuxt/9IE26Pjb.js +0 -6
  25. package/dist/devtools/_nuxt/BmDNknOY.js +0 -1
  26. package/dist/devtools/_nuxt/CACuNVMu.js +0 -31
  27. package/dist/devtools/_nuxt/D0fYefhv.js +0 -5
  28. package/dist/devtools/_nuxt/DAJX6ZVN.js +0 -1
  29. package/dist/devtools/_nuxt/Dcu-uNIw.js +0 -1
  30. package/dist/devtools/_nuxt/DevtoolsEmptyState.ZltHm8Qo.css +0 -1
  31. package/dist/devtools/_nuxt/DevtoolsKeyValue.BFQgpGME.css +0 -1
  32. package/dist/devtools/_nuxt/builds/latest.json +0 -1
  33. package/dist/devtools/_nuxt/builds/meta/c3c72b0d-7040-4fb5-a9b0-9d83383d1bc9.json +0 -1
  34. package/dist/devtools/_nuxt/entry.DBTsh0cs.css +0 -1
  35. package/dist/devtools/_nuxt/fira-code.Bc8wnsZt.woff2 +0 -0
  36. package/dist/devtools/_nuxt/hubot-sans.DLGyhQVu.woff2 +0 -0
  37. package/dist/devtools/_nuxt/versions.NSLB066-.css +0 -1
  38. package/dist/devtools/connections/index.html +0 -1
  39. package/dist/devtools/docs/index.html +0 -1
  40. package/dist/devtools/index.html +0 -1
  41. package/dist/devtools/versions/index.html +0 -1
@@ -0,0 +1,46 @@
1
+ import type { DebugResponse, ProductionDebugResponse } from './types'
2
+ import { appFetch } from 'nuxtseo-layer-devtools/composables/rpc'
3
+ import { isProductionMode, productionUrl, refreshTime } from 'nuxtseo-layer-devtools/composables/state'
4
+ import { computed, ref, refreshNuxtData, useAsyncData, watch } from '#imports'
5
+
6
+ export const productionData = ref<ProductionDebugResponse | null>(null)
7
+ export const productionError = ref<string | null>(null)
8
+
9
+ const { data: debugData, status: debugStatus } = useAsyncData<DebugResponse | null>('debug', () => {
10
+ if (!appFetch.value)
11
+ return Promise.resolve(null)
12
+ return appFetch.value<DebugResponse>('/__skew-devtools/debug').catch(() => null)
13
+ }, { watch: [refreshTime] })
14
+
15
+ export { debugData }
16
+
17
+ export const isLoading = computed(() => debugStatus.value === 'pending')
18
+ export const moduleVersion = computed(() => debugData.value?.version || 'unknown')
19
+ export const siteUrl = computed(() => debugData.value?.siteConfigUrl || '')
20
+
21
+ // Sync production URL from site config when debug data changes
22
+ watch(debugData, (data) => {
23
+ if (data?.siteConfigUrl) {
24
+ productionUrl.value = data.siteConfigUrl
25
+ }
26
+ })
27
+
28
+ export async function fetchProductionData() {
29
+ if (!appFetch.value || !isProductionMode.value)
30
+ return
31
+ productionError.value = null
32
+ const url = productionUrl.value
33
+ productionData.value = await appFetch.value<ProductionDebugResponse>('/__skew-devtools/debug-production', {
34
+ query: { url },
35
+ }).catch((err: unknown) => {
36
+ productionError.value = err instanceof Error ? err.message : 'Failed to connect to production'
37
+ return null
38
+ })
39
+ }
40
+
41
+ export async function refreshAll() {
42
+ await refreshNuxtData('debug')
43
+ if (isProductionMode.value) {
44
+ await fetchProductionData()
45
+ }
46
+ }
@@ -0,0 +1,7 @@
1
+ import { useDevtoolsConnection } from 'nuxtseo-layer-devtools/composables/rpc'
2
+ import { refreshSources } from 'nuxtseo-layer-devtools/composables/state'
3
+
4
+ useDevtoolsConnection({
5
+ onConnected() { refreshSources() },
6
+ onRouteChange() { refreshSources() },
7
+ })
@@ -0,0 +1,46 @@
1
+ export interface DebugResponse {
2
+ version: string
3
+ siteConfigUrl: string
4
+ config: {
5
+ cookie: Record<string, unknown>
6
+ debug: boolean
7
+ connectionTracking: boolean
8
+ routeTracking: boolean
9
+ ipTracking: boolean
10
+ reloadStrategy: string | false
11
+ multiTab: boolean
12
+ }
13
+ buildId: string
14
+ }
15
+
16
+ export interface VersionInfo {
17
+ timestamp: string
18
+ expires: string
19
+ assets: string[]
20
+ deletedChunks?: string[]
21
+ }
22
+
23
+ export interface SkewProtectionManifest {
24
+ versions?: Record<string, VersionInfo>
25
+ }
26
+
27
+ export interface ProductionDebugResponse {
28
+ health?: {
29
+ ok: boolean
30
+ version: string
31
+ uptime: number
32
+ } | null
33
+ manifest?: {
34
+ id?: string
35
+ timestamp?: number
36
+ matcher?: Record<string, unknown>
37
+ prerendered?: string[]
38
+ skewProtection?: SkewProtectionManifest
39
+ } | null
40
+ stats?: {
41
+ total: number
42
+ versions: Record<string, number>
43
+ routes: Record<string, number>
44
+ } | null
45
+ errors: string[]
46
+ }
@@ -0,0 +1,3 @@
1
+ // Nuxt SEO devtools panel, shipped as a layer (Model C). The unified devtools client
2
+ // (assembled by nuxtseo-shared in the user's project) extends this to render /skew-protection.
3
+ export default defineNuxtConfig({})
@@ -0,0 +1,124 @@
1
+ <script lang="ts" setup>
2
+ import { isProductionMode } from 'nuxtseo-layer-devtools/composables/state'
3
+ import { computed } from '#imports'
4
+ import { debugData, productionData, productionError } from '../../lib/skew-protection/data'
5
+
6
+ const connectionTrackingEnabled = computed(() => debugData.value?.config?.connectionTracking === true)
7
+
8
+ const stats = computed(() => productionData.value?.stats)
9
+
10
+ const versionRows = computed(() => {
11
+ if (!stats.value?.versions)
12
+ return []
13
+ return Object.entries(stats.value.versions)
14
+ .map(([version, count]) => ({
15
+ key: version.slice(0, 8),
16
+ value: count,
17
+ mono: true,
18
+ }))
19
+ .sort((a, b) => (b.value as number) - (a.value as number))
20
+ })
21
+
22
+ const routeRows = computed(() => {
23
+ if (!stats.value?.routes)
24
+ return []
25
+ return Object.entries(stats.value.routes)
26
+ .map(([route, count]) => ({
27
+ key: route,
28
+ value: count,
29
+ mono: true,
30
+ }))
31
+ .sort((a, b) => (b.value as number) - (a.value as number))
32
+ })
33
+ </script>
34
+
35
+ <script lang="ts">
36
+ const connectionTrackingSnippet = `export default defineNuxtConfig({
37
+ skewProtection: {
38
+ connectionTracking: true,
39
+ routeTracking: true
40
+ }
41
+ })`
42
+ </script>
43
+
44
+ <template>
45
+ <div class="devtools-main-content space-y-5 p-5">
46
+ <template v-if="isProductionMode">
47
+ <DevtoolsProductionError v-if="productionError" />
48
+
49
+ <!-- Connection tracking not enabled -->
50
+ <template v-if="!connectionTrackingEnabled">
51
+ <DevtoolsAlert variant="warning" icon="carbon:warning">
52
+ Connection tracking is not enabled. Enable it to see live connection data.
53
+ </DevtoolsAlert>
54
+ <DevtoolsEmptyState
55
+ icon="carbon:connection-signal"
56
+ title="Enable Connection Tracking"
57
+ description="Add connectionTracking to your skewProtection config to monitor active users, version distribution, and route activity."
58
+ >
59
+ <DevtoolsSnippet
60
+ label="nuxt.config.ts"
61
+ :code="connectionTrackingSnippet"
62
+ lang="js"
63
+ />
64
+ </DevtoolsEmptyState>
65
+ </template>
66
+
67
+ <!-- Has connection tracking but no stats yet -->
68
+ <template v-else-if="!stats">
69
+ <DevtoolsEmptyState
70
+ icon="carbon:connection-signal"
71
+ title="No Connection Data"
72
+ description="Connection tracking is enabled but no stats are available yet. The endpoint may require authorization via the skew:authorize-stats hook."
73
+ />
74
+ </template>
75
+
76
+ <!-- Live stats -->
77
+ <template v-else>
78
+ <div class="flex items-center gap-3 flex-wrap">
79
+ <DevtoolsMetric
80
+ :value="stats.total"
81
+ variant="info"
82
+ icon="carbon:user-multiple"
83
+ label="Active Connections"
84
+ />
85
+ <DevtoolsMetric
86
+ :value="Object.keys(stats.versions).length"
87
+ variant="default"
88
+ icon="carbon:version"
89
+ label="Active Versions"
90
+ />
91
+ </div>
92
+
93
+ <DevtoolsSection
94
+ v-if="versionRows.length"
95
+ icon="carbon:version"
96
+ text="Version Distribution"
97
+ description="Users per build version"
98
+ >
99
+ <DevtoolsKeyValue :items="versionRows" striped />
100
+ </DevtoolsSection>
101
+
102
+ <DevtoolsSection
103
+ v-if="routeRows.length"
104
+ icon="carbon:map"
105
+ text="Route Distribution"
106
+ description="Users per page route"
107
+ >
108
+ <DevtoolsKeyValue :items="routeRows" striped />
109
+ </DevtoolsSection>
110
+ </template>
111
+ </template>
112
+
113
+ <!-- Dev mode: not shown (devOnly: true hides the tab), but just in case -->
114
+ <template v-else>
115
+ <div class="flex items-center justify-center min-h-[400px]">
116
+ <DevtoolsEmptyState
117
+ icon="carbon:connection-signal"
118
+ title="Live Connections"
119
+ description="Switch to production mode to monitor active user connections, version distribution, and route activity."
120
+ />
121
+ </div>
122
+ </template>
123
+ </div>
124
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <DevtoolsDocs url="https://nuxtseo.com/skew-protection" />
3
+ </template>
@@ -0,0 +1,153 @@
1
+ <script lang="ts" setup>
2
+ import { hasProductionUrl, isProductionMode, productionUrl } from 'nuxtseo-layer-devtools/composables/state'
3
+ import { computed } from '#imports'
4
+ import { debugData, productionData, productionError } from '../../lib/skew-protection/data'
5
+
6
+ const configItems = computed(() => {
7
+ const c = debugData.value?.config
8
+ if (!c)
9
+ return []
10
+ return [
11
+ { key: 'Reload Strategy', value: c.reloadStrategy || 'disabled' },
12
+ { key: 'Multi-Tab Sync', value: c.multiTab },
13
+ { key: 'Connection Tracking', value: c.connectionTracking },
14
+ { key: 'Route Tracking', value: c.routeTracking },
15
+ { key: 'IP Tracking', value: c.ipTracking },
16
+ { key: 'Debug', value: c.debug },
17
+ ]
18
+ })
19
+
20
+ const cookieItems = computed(() => {
21
+ const cookie = debugData.value?.config?.cookie as Record<string, unknown> | undefined
22
+ if (!cookie)
23
+ return []
24
+ return [
25
+ { key: 'Name', value: String(cookie.name || '__nkpv'), mono: true },
26
+ { key: 'Max Age', value: cookie.maxAge ? `${cookie.maxAge}s` : 'Not set' },
27
+ { key: 'Path', value: String(cookie.path || '/'), mono: true },
28
+ { key: 'SameSite', value: String(cookie.sameSite || 'lax') },
29
+ ]
30
+ })
31
+
32
+ const healthOk = computed(() => productionData.value?.health?.ok === true)
33
+
34
+ const healthItems = computed(() => {
35
+ const h = productionData.value?.health
36
+ if (!h)
37
+ return []
38
+ return [
39
+ { key: 'Status', value: h.ok ? 'Healthy' : 'Unhealthy' },
40
+ { key: 'Build ID', value: h.version, mono: true },
41
+ { key: 'Uptime', value: formatUptime(h.uptime) },
42
+ ]
43
+ })
44
+
45
+ const statsItems = computed(() => {
46
+ const s = productionData.value?.stats
47
+ if (!s)
48
+ return []
49
+ return [
50
+ { key: 'Total Connections', value: s.total },
51
+ ...Object.entries(s.versions).map(([v, count]) => ({
52
+ key: `Version ${v.slice(0, 8)}`,
53
+ value: count,
54
+ mono: true,
55
+ })),
56
+ ]
57
+ })
58
+
59
+ function formatUptime(seconds: number): string {
60
+ if (seconds < 60)
61
+ return `${seconds}s`
62
+ if (seconds < 3600)
63
+ return `${Math.floor(seconds / 60)}m`
64
+ if (seconds < 86400)
65
+ return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`
66
+ return `${Math.floor(seconds / 86400)}d ${Math.floor((seconds % 86400) / 3600)}h`
67
+ }
68
+ </script>
69
+
70
+ <script lang="ts">
71
+ const siteConfigSnippet = `export default defineNuxtConfig({
72
+ site: {
73
+ url: 'https://your-production-url.com'
74
+ }
75
+ })`
76
+ </script>
77
+
78
+ <template>
79
+ <div class="devtools-main-content space-y-5 p-5">
80
+ <!-- Production mode: show live data -->
81
+ <template v-if="isProductionMode">
82
+ <DevtoolsAlert v-if="healthOk" variant="production" icon="carbon:cloud">
83
+ Connected to <strong>{{ productionUrl }}</strong>
84
+ </DevtoolsAlert>
85
+
86
+ <DevtoolsProductionError v-if="productionError" />
87
+
88
+ <!-- Health -->
89
+ <DevtoolsSection v-if="productionData?.health" icon="carbon:activity" text="Health" description="Live production server status">
90
+ <div class="flex items-center gap-3 mb-3">
91
+ <DevtoolsMetric
92
+ :value="productionData.health.ok ? 'Healthy' : 'Down'"
93
+ :variant="productionData.health.ok ? 'success' : 'danger'"
94
+ icon="carbon:circle-filled"
95
+ label="Status"
96
+ />
97
+ <DevtoolsMetric
98
+ :value="formatUptime(productionData.health.uptime)"
99
+ variant="info"
100
+ icon="carbon:time"
101
+ label="Uptime"
102
+ />
103
+ </div>
104
+ <DevtoolsKeyValue :items="healthItems" striped />
105
+ </DevtoolsSection>
106
+
107
+ <!-- Stats (if available) -->
108
+ <DevtoolsSection v-if="productionData?.stats" icon="carbon:connection-signal" text="Active Connections" description="Real-time connection statistics">
109
+ <div class="flex items-center gap-3 mb-3">
110
+ <DevtoolsMetric
111
+ :value="productionData.stats.total"
112
+ variant="info"
113
+ icon="carbon:user-multiple"
114
+ label="Connected"
115
+ />
116
+ </div>
117
+ <DevtoolsKeyValue :items="statsItems" striped />
118
+ </DevtoolsSection>
119
+ </template>
120
+
121
+ <!-- Dev mode: show config + CTA -->
122
+ <template v-else>
123
+ <DevtoolsAlert variant="info" icon="carbon:information">
124
+ Skew protection is active in production builds only. Configure your site URL to preview live data.
125
+ </DevtoolsAlert>
126
+
127
+ <!-- Production URL hint -->
128
+ <div v-if="!hasProductionUrl" class="hint-callout">
129
+ <div class="flex items-center gap-2">
130
+ <UIcon name="carbon:cloud" class="text-lg" aria-hidden="true" />
131
+ <span class="font-semibold">Connect to Production</span>
132
+ </div>
133
+ <p class="text-sm opacity-80 mt-1 mb-3">
134
+ Add your production URL to preview live skew protection data, version history, and connection stats.
135
+ </p>
136
+ <DevtoolsSnippet
137
+ label="nuxt.config.ts"
138
+ :code="siteConfigSnippet"
139
+ lang="js"
140
+ />
141
+ </div>
142
+ </template>
143
+
144
+ <!-- Config (always visible) -->
145
+ <DevtoolsSection icon="carbon:settings" text="Module Configuration" description="Resolved runtime settings">
146
+ <DevtoolsKeyValue :items="configItems" striped />
147
+ </DevtoolsSection>
148
+
149
+ <DevtoolsSection icon="carbon:cookie" text="Cookie" description="Version tracking cookie settings">
150
+ <DevtoolsKeyValue :items="cookieItems" striped />
151
+ </DevtoolsSection>
152
+ </div>
153
+ </template>
@@ -0,0 +1,128 @@
1
+ <script lang="ts" setup>
2
+ import type { VersionInfo } from '../../lib/skew-protection/types'
3
+ import { isProductionMode } from 'nuxtseo-layer-devtools/composables/state'
4
+ import { computed, onMounted, ref } from '#imports'
5
+ import { productionData, productionError } from '../../lib/skew-protection/data'
6
+
7
+ const now = ref<number | null>(null)
8
+
9
+ onMounted(() => {
10
+ now.value = Date.now()
11
+ })
12
+
13
+ const versions = computed(() => {
14
+ const skew = productionData.value?.manifest?.skewProtection
15
+ if (!skew?.versions)
16
+ return []
17
+ const currentTime = now.value
18
+ return Object.entries(skew.versions as Record<string, VersionInfo>)
19
+ .map(([id, info]) => ({
20
+ id,
21
+ shortId: id.slice(0, 8),
22
+ timestamp: new Date(info.timestamp),
23
+ expires: new Date(info.expires),
24
+ assetCount: info.assets?.length || 0,
25
+ deletedChunks: info.deletedChunks?.length || 0,
26
+ isExpired: currentTime === null ? false : new Date(info.expires).getTime() < currentTime,
27
+ }))
28
+ .sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
29
+ })
30
+
31
+ const currentBuildId = computed(() => {
32
+ const id = productionData.value?.manifest?.id
33
+ return typeof id === 'string' ? id : null
34
+ })
35
+
36
+ function formatDate(date: Date): string {
37
+ return date.toLocaleString(undefined, {
38
+ month: 'short',
39
+ day: 'numeric',
40
+ hour: '2-digit',
41
+ minute: '2-digit',
42
+ })
43
+ }
44
+
45
+ const rtf = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto', style: 'narrow' })
46
+
47
+ function formatRelative(date: Date): string {
48
+ if (now.value === null)
49
+ return ''
50
+ const diff = now.value - date.getTime()
51
+ const seconds = Math.floor(diff / 1000)
52
+ if (seconds < 60)
53
+ return rtf.format(-seconds, 'second')
54
+ const minutes = Math.floor(seconds / 60)
55
+ if (minutes < 60)
56
+ return rtf.format(-minutes, 'minute')
57
+ const hours = Math.floor(minutes / 60)
58
+ if (hours < 24)
59
+ return rtf.format(-hours, 'hour')
60
+ const days = Math.floor(hours / 24)
61
+ return rtf.format(-days, 'day')
62
+ }
63
+ </script>
64
+
65
+ <template>
66
+ <div class="devtools-main-content space-y-5 p-5">
67
+ <template v-if="isProductionMode">
68
+ <DevtoolsProductionError v-if="productionError" />
69
+
70
+ <DevtoolsAlert v-if="currentBuildId" variant="success" icon="carbon:checkmark-outline">
71
+ Current build: <code class="font-mono ml-1">{{ currentBuildId.slice(0, 8) }}</code>
72
+ </DevtoolsAlert>
73
+
74
+ <DevtoolsEmptyState
75
+ v-if="!versions.length && !productionError"
76
+ icon="carbon:version"
77
+ title="No Version History"
78
+ description="No skew protection version data found in the build manifest. Make sure bundleAssets is enabled."
79
+ />
80
+
81
+ <!-- Version timeline -->
82
+ <DevtoolsPanel
83
+ v-for="v in versions"
84
+ :key="v.id"
85
+ :title="v.shortId"
86
+ icon="carbon:version"
87
+ >
88
+ <template #header>
89
+ <div class="flex items-center gap-2">
90
+ <code class="text-sm font-mono font-semibold">{{ v.shortId }}</code>
91
+ <DevtoolsMetric
92
+ v-if="v.id === currentBuildId"
93
+ value="current"
94
+ variant="success"
95
+ />
96
+ <DevtoolsMetric
97
+ v-else-if="v.isExpired"
98
+ value="expired"
99
+ variant="danger"
100
+ />
101
+ </div>
102
+ <span class="text-xs opacity-60">{{ formatRelative(v.timestamp) }}</span>
103
+ </template>
104
+
105
+ <DevtoolsKeyValue
106
+ :items="[
107
+ { key: 'Built', value: formatDate(v.timestamp) },
108
+ { key: 'Expires', value: formatDate(v.expires) },
109
+ { key: 'Assets', value: v.assetCount },
110
+ { key: 'Deleted Chunks', value: v.deletedChunks },
111
+ ]"
112
+ striped
113
+ />
114
+ </DevtoolsPanel>
115
+ </template>
116
+
117
+ <!-- Dev mode empty state -->
118
+ <template v-else>
119
+ <div class="flex items-center justify-center min-h-[400px]">
120
+ <DevtoolsEmptyState
121
+ icon="carbon:version"
122
+ title="Version History"
123
+ description="Switch to production mode to view your deployment version history, asset tracking, and chunk lifecycle."
124
+ />
125
+ </div>
126
+ </template>
127
+ </div>
128
+ </template>
@@ -0,0 +1,53 @@
1
+ <script lang="ts" setup>
2
+ import { isProductionMode } from 'nuxtseo-layer-devtools/composables/state'
3
+ import { ref } from 'vue'
4
+ import { useRoute, watch } from '#imports'
5
+ import { fetchProductionData, isLoading, moduleVersion, refreshAll } from '../lib/skew-protection/data'
6
+ import '../lib/skew-protection/rpc'
7
+
8
+ const route = useRoute()
9
+
10
+ // Fetch production data when production mode changes
11
+ watch(isProductionMode, async (isProd) => {
12
+ if (isProd) {
13
+ await fetchProductionData()
14
+ }
15
+ }, { immediate: true })
16
+
17
+ const activeTab = ref('overview')
18
+
19
+ // Sync tab from route
20
+ watch(() => route.path, (p) => {
21
+ if (p === '/skew-protection/versions')
22
+ activeTab.value = 'versions'
23
+ else if (p === '/skew-protection/connections')
24
+ activeTab.value = 'connections'
25
+ else if (p === '/skew-protection/docs')
26
+ activeTab.value = 'docs'
27
+ else
28
+ activeTab.value = 'overview'
29
+ }, { immediate: true })
30
+
31
+ const navItems = [
32
+ { value: 'overview', to: '/skew-protection', icon: 'carbon:dashboard', label: 'Overview' },
33
+ { value: 'versions', to: '/skew-protection/versions', icon: 'carbon:version', label: 'Versions' },
34
+ { value: 'connections', to: '/skew-protection/connections', icon: 'carbon:connection-signal', label: 'Connections', devOnly: true },
35
+ { value: 'docs', to: '/skew-protection/docs', icon: 'carbon:book', label: 'Docs' },
36
+ ]
37
+ </script>
38
+
39
+ <template>
40
+ <DevtoolsLayout
41
+ v-model:active-tab="activeTab"
42
+ module-name="nuxt-skew-protection"
43
+ title="Skew Protection"
44
+ icon="carbon:version"
45
+ :version="moduleVersion"
46
+ :nav-items="navItems"
47
+ github-url="https://github.com/harlan-zw/nuxt-skew-protection"
48
+ :loading="isLoading"
49
+ @refresh="refreshAll"
50
+ >
51
+ <NuxtPage />
52
+ </DevtoolsLayout>
53
+ </template>
package/dist/module.d.mts CHANGED
@@ -29,13 +29,29 @@ interface ModuleOptions {
29
29
  * @default Static: 'polling', Node: 'sse', Cloudflare: 'ws'
30
30
  */
31
31
  updateStrategy?: 'polling' | 'sse' | 'ws' | SkewAdapter;
32
+ /**
33
+ * Path prefix for the module's runtime endpoints (`/ws`, `/sse`, `/health`,
34
+ * `/route`, `/subscribe-stats`, `/admin/stats`).
35
+ *
36
+ * Defaults to `/__skew`. Set a sub-path when the app is path-routed behind a
37
+ * worker that only owns part of the host (e.g. a Pro dashboard mounted under
38
+ * `/pro/*` on a host shared with a marketing app): use `/pro/__skew` so the
39
+ * websocket/health requests resolve to this worker's deployment instead of
40
+ * leaking to the sibling app that owns the host route.
41
+ * @default '/__skew'
42
+ */
43
+ basePath?: string;
32
44
  /**
33
45
  * Cookie configuration for storing deployment version
34
46
  */
35
47
  cookie?: false | Omit<CookieSerializeOptions, 'encode'> & {
36
48
  /**
37
- * Cookie name for storing deployment version
38
- * @default '__nkpv'
49
+ * Cookie name for storing deployment version.
50
+ *
51
+ * Defaults to `__nkpv`, suffixed with the mount point for a path-routed app
52
+ * (e.g. `/pro/*` → `__nkpv_pro`) so apps sharing a host don't clobber each
53
+ * other's cookie. Set this to override the derived name.
54
+ * @default '__nkpv' (or `__nkpv_<mount>` when path-routed)
39
55
  */
40
56
  name?: string;
41
57
  };
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=4.0.0"
5
5
  },
6
6
  "configKey": "skewProtection",
7
- "version": "1.1.1",
7
+ "version": "1.3.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"