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 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(['.vue', '.ts', '.tsx', '.js', '.jsx', '.mjs', '.mts'])
14
- const IGNORE_DIRS = new Set(['node_modules', '.nuxt', '.output', 'dist', '.git'])
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({ file: file.replace(cwd, '.'), name: r.name, count: matches.length })
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
- }, { watch: [refreshTime] })
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 ? err.message : 'Failed to connect to production'
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
- { 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') },
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
- { key: 'Status', value: h.ok ? 'Healthy' : 'Unhealthy' },
55
+ {
56
+ key: 'Status',
57
+ value: h.ok ? 'Healthy' : 'Unhealthy',
58
+ },
40
59
  { key: 'Build ID', value: h.version, mono: true },
41
- { key: 'Uptime', value: formatUptime(h.uptime) },
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 ? false : new Date(info.expires).getTime() < currentTime,
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' ? id : null
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
- { 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' },
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
@@ -4,9 +4,9 @@
4
4
  "nuxt": "^4.6.0 || ^5.0.0-0"
5
5
  },
6
6
  "configKey": "skewProtection",
7
- "version": "2.0.3",
7
+ "version": "2.0.4",
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.3",
9
+ "@nuxt/module-builder": "1.0.4",
10
10
  "unbuild": "3.6.1"
11
11
  }
12
12
  }