nuxt-skew-protection 1.3.1 → 1.4.1

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 (50) hide show
  1. package/dist/devtools/lib/skew-protection/data.ts +4 -1
  2. package/dist/module.json +2 -2
  3. package/dist/module.mjs +140 -50
  4. package/dist/runtime/app/composables/useSkewProtection.d.ts +1 -1
  5. package/dist/runtime/app/plugins/check-updates-adapter.client.d.ts +2 -2
  6. package/dist/runtime/app/plugins/check-updates-sse.client.d.ts +2 -2
  7. package/dist/runtime/app/plugins/check-updates-sse.client.js +3 -6
  8. package/dist/runtime/app/plugins/check-updates-websocket.client.d.ts +2 -2
  9. package/dist/runtime/app/plugins/check-updates-websocket.client.js +3 -6
  10. package/dist/runtime/app/utils/create-skew-connection.d.ts +1 -10
  11. package/dist/runtime/app/utils/route-tracking.d.ts +20 -0
  12. package/dist/runtime/app/utils/route-tracking.js +8 -0
  13. package/dist/runtime/server/imports/cookie.d.ts +4 -4
  14. package/dist/runtime/server/imports/cookie.js +1 -1
  15. package/dist/runtime/server/imports/getRuntimeConfigSkewProtection.d.ts +5 -2
  16. package/dist/runtime/server/imports/getRuntimeConfigSkewProtection.js +1 -1
  17. package/dist/runtime/server/imports/utils.d.ts +3 -3
  18. package/dist/runtime/server/imports/utils.js +1 -1
  19. package/dist/runtime/server/middleware/set-skew-protection-cookie.d.ts +1 -1
  20. package/dist/runtime/server/middleware/set-skew-protection-cookie.js +2 -2
  21. package/dist/runtime/server/middleware/vercel-skew.d.ts +1 -1
  22. package/dist/runtime/server/middleware/vercel-skew.js +1 -1
  23. package/dist/runtime/server/plugins/connection-tracking-cloudflare-durable.d.ts +1 -1
  24. package/dist/runtime/server/plugins/connection-tracking-cloudflare-durable.js +1 -1
  25. package/dist/runtime/server/plugins/connection-tracking.d.ts +1 -1
  26. package/dist/runtime/server/plugins/connection-tracking.js +1 -1
  27. package/dist/runtime/server/routes/__skew/admin/stats.get.d.ts +1 -1
  28. package/dist/runtime/server/routes/__skew/admin/stats.get.js +2 -2
  29. package/dist/runtime/server/routes/__skew/health.get.d.ts +1 -5
  30. package/dist/runtime/server/routes/__skew/health.get.js +2 -2
  31. package/dist/runtime/server/routes/__skew/route.post.d.ts +1 -3
  32. package/dist/runtime/server/routes/__skew/route.post.js +2 -2
  33. package/dist/runtime/server/routes/__skew/sse.d.ts +1 -1
  34. package/dist/runtime/server/routes/__skew/sse.js +2 -2
  35. package/dist/runtime/server/routes/__skew/subscribe-stats.post.d.ts +1 -3
  36. package/dist/runtime/server/routes/__skew/subscribe-stats.post.js +2 -2
  37. package/dist/runtime/server/routes/__skew/ws.d.ts +1 -1
  38. package/dist/runtime/server/routes/__skew/ws.js +2 -2
  39. package/dist/runtime/server/routes/__skew-devtools/debug-production.get.d.ts +1 -15
  40. package/dist/runtime/server/routes/__skew-devtools/debug-production.get.js +1 -1
  41. package/dist/runtime/server/routes/__skew-devtools/debug.get.d.ts +1 -14
  42. package/dist/runtime/server/routes/__skew-devtools/debug.get.js +2 -2
  43. package/dist/runtime/server/utils/cloudflare-asset-fetch.d.ts +6 -0
  44. package/dist/runtime/server/utils/cloudflare-asset-fetch.js +34 -0
  45. package/dist/runtime/shared/logger.d.ts +2 -1
  46. package/dist/runtime/shared/logger.js +2 -6
  47. package/dist/runtime/types.d.ts +0 -2
  48. package/package.json +32 -30
  49. package/dist/runtime/adapters/logger.d.ts +0 -1
  50. package/dist/runtime/adapters/logger.js +0 -6
@@ -9,7 +9,10 @@ export const productionError = ref<string | null>(null)
9
9
  const { data: debugData, status: debugStatus } = useAsyncData<DebugResponse | null>('debug', () => {
10
10
  if (!appFetch.value)
11
11
  return Promise.resolve(null)
12
- return appFetch.value<DebugResponse>('/__skew-devtools/debug').catch(() => null)
12
+ return appFetch.value<DebugResponse>('/__skew-devtools/debug').catch(() => {
13
+ // The devtools panel may load before its debug endpoint is available.
14
+ return null
15
+ })
13
16
  }, { watch: [refreshTime] })
14
17
 
15
18
  export { debugData }
package/dist/module.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "nuxt": ">=4.0.0"
5
5
  },
6
6
  "configKey": "skewProtection",
7
- "version": "1.3.1",
7
+ "version": "1.4.1",
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.2",
9
+ "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { writeFileSync, unlinkSync, existsSync, readFileSync, promises } from 'node:fs';
2
2
  import { useLogger, useNuxt, defineNuxtModule, createResolver, hasNuxtModule, addTypeTemplate, addComponent, addImports, addServerHandler, addPlugin, tryResolveModule, addTemplate } from '@nuxt/kit';
3
3
  import { colors } from 'consola/utils';
4
+ import { setupNitroRuntimeCompatibility, resolveNitroPreset, renderNitroTypeAugmentations, isNuxtGenerate } from 'nuxtseo-shared/kit';
4
5
  import { readPackageJSON } from 'pkg-types';
5
- import { resolveNitroPreset, isNuxtGenerate } from 'nuxtseo-shared/kit';
6
6
  import { join } from 'node:path';
7
7
  import { tmpdir } from 'node:os';
8
8
  import { x } from 'tinyexec';
@@ -27,7 +27,9 @@ function resolveBasePath(input = {}) {
27
27
  let mount = "";
28
28
  if (assetsDir.startsWith("/")) {
29
29
  const segments = trimSlashes(assetsDir).split("/").filter(Boolean);
30
- mount = segments.slice(0, -1).join("/");
30
+ const nuxtAssetsIndex = segments.indexOf("_nuxt");
31
+ const mountEnd = nuxtAssetsIndex === -1 ? segments.length - 1 : nuxtAssetsIndex;
32
+ mount = segments.slice(0, mountEnd).join("/");
31
33
  }
32
34
  if (!mount)
33
35
  mount = trimSlashes(app.baseURL || "");
@@ -185,6 +187,86 @@ async function resolveBuildTimeDriver(storage) {
185
187
  return lazyDriver({ base, ...driverOptions });
186
188
  }
187
189
 
190
+ const virtualEntryId = "virtual:nuxt-skew-protection/cloudflare-entry";
191
+ const resolvedVirtualEntryId = `\0${virtualEntryId}`;
192
+ const legacyCloudflareAdapterSuffixes = [
193
+ "/nitropack/dist/runtime/entries/cloudflare-module.mjs",
194
+ "/nitropack/dist/runtime/entries/cloudflare.mjs",
195
+ "/nitropack/dist/runtime/entries/cloudflare-pages.mjs"
196
+ ];
197
+ function isLegacyCloudflareEntry(id) {
198
+ const normalizedId = id.split("?", 1)[0].replaceAll("\\", "/");
199
+ return legacyCloudflareAdapterSuffixes.some((suffix) => normalizedId.endsWith(suffix));
200
+ }
201
+ function normalizeBuildAssetsDir(value) {
202
+ const path = value.replace(/^\/+|\/+$/g, "");
203
+ return `/${path}/`;
204
+ }
205
+ function renderCloudflareEntry(options) {
206
+ const nitroEntryId = JSON.stringify(options.nitroEntryId);
207
+ const runtimeHelperId = JSON.stringify(options.runtimeHelperId);
208
+ const buildAssetsDir = JSON.stringify(normalizeBuildAssetsDir(options.buildAssetsDir));
209
+ return `import nitroEntry from ${nitroEntryId};
210
+ import { fetchCloudflareBuildAsset } from ${runtimeHelperId};
211
+ export * from ${nitroEntryId};
212
+
213
+ if (!nitroEntry || typeof nitroEntry.fetch !== "function") {
214
+ throw new TypeError("[nuxt-skew-protection] Nitro's Cloudflare entry does not expose a fetch handler.");
215
+ }
216
+
217
+ export default {
218
+ ...nitroEntry,
219
+ fetch(request, env, context) {
220
+ const assetResponse = fetchCloudflareBuildAsset(request, env.ASSETS, ${buildAssetsDir});
221
+ return assetResponse ?? nitroEntry.fetch(request, env, context);
222
+ },
223
+ };`;
224
+ }
225
+ function createCloudflareAssetProtectionPlugin(options) {
226
+ let nitroEntryId;
227
+ let wrapperLoaded = false;
228
+ return {
229
+ name: "nuxt-skew-protection:cloudflare-asset-fetch",
230
+ options(inputOptions) {
231
+ if (typeof inputOptions.input !== "string") {
232
+ this.error(
233
+ "[nuxt-skew-protection] Asset 404 protection requires one Nitro entry."
234
+ );
235
+ }
236
+ if (isLegacyCloudflareEntry(inputOptions.input)) {
237
+ this.error(
238
+ "[nuxt-skew-protection] Asset 404 protection requires nitropack >= 2.10.0. Your project uses an older adapter without the ASSETS binding. Upgrade nitropack (or nuxt) to enable asset 404 protection."
239
+ );
240
+ }
241
+ nitroEntryId = inputOptions.input;
242
+ return {
243
+ ...inputOptions,
244
+ input: virtualEntryId
245
+ };
246
+ },
247
+ resolveId(id) {
248
+ return id === virtualEntryId ? resolvedVirtualEntryId : null;
249
+ },
250
+ load(id) {
251
+ if (id !== resolvedVirtualEntryId || !nitroEntryId) {
252
+ return null;
253
+ }
254
+ wrapperLoaded = true;
255
+ return renderCloudflareEntry({
256
+ ...options,
257
+ nitroEntryId
258
+ });
259
+ },
260
+ buildEnd(error) {
261
+ if (!error && !wrapperLoaded) {
262
+ this.error(
263
+ "[nuxt-skew-protection] Nitro's Cloudflare entry was not bundled. Refusing to build without asset 404 protection."
264
+ );
265
+ }
266
+ }
267
+ };
268
+ }
269
+
188
270
  const RE_ENOTFOUND = /ENOTFOUND\s+(\S+)/;
189
271
  const RE_GETADDRINFO = /getaddrinfo\s+\S+\s+(\S+)/;
190
272
  const RE_SIZE_PROP = /(['"]?)size\1\s*:\s*\d+/;
@@ -236,7 +318,7 @@ function calculateDeletedChunks(currentAssets, previousAssets) {
236
318
  return previousAssets.filter((asset) => !currentSet.has(asset)).filter((asset) => asset.endsWith(".js"));
237
319
  }
238
320
  function getPreviousVersion(manifest, currentVersionId) {
239
- const sortedVersions = Object.entries(manifest.versions).map(([id, data]) => ({ id, timestamp: new Date(data.timestamp).getTime() })).sort((a, b) => b.timestamp - a.timestamp);
321
+ const sortedVersions = Object.entries(manifest.versions).map(([id, data], index) => ({ id, timestamp: new Date(data.timestamp).getTime(), index })).sort((a, b) => b.timestamp - a.timestamp || b.index - a.index);
240
322
  const currentIndex = sortedVersions.findIndex((v) => v.id === currentVersionId);
241
323
  if (currentIndex === -1 || currentIndex === sortedVersions.length - 1) {
242
324
  return null;
@@ -288,21 +370,35 @@ function formatDuration(ms) {
288
370
  return `${ms}ms`;
289
371
  return `${(ms / 1e3).toFixed(2)}s`;
290
372
  }
373
+ function formatAge(timestamp, now) {
374
+ const ageMinutes = Math.floor((now - timestamp) / 6e4);
375
+ const ageHours = Math.floor(ageMinutes / 60);
376
+ const ageDays = Math.floor(ageHours / 24);
377
+ if (ageDays > 0)
378
+ return `${ageDays}d ago`;
379
+ if (ageHours > 0)
380
+ return `${ageHours}h ago`;
381
+ if (ageMinutes > 0)
382
+ return `${ageMinutes}m ago`;
383
+ return "just now";
384
+ }
291
385
  function createAssetManager(options) {
292
386
  const storage = createStorage({
293
387
  driver: options.driver
294
388
  });
295
389
  const retentionDays = options.retentionDays || 7;
296
390
  const maxNumberOfVersions = options.maxNumberOfVersions || 20;
391
+ const buildAssetsDir = (options.buildAssetsDir || "/_nuxt/").replace(/^\/+|\/+$/g, "");
392
+ const buildAssetsPath = `/${buildAssetsDir}`;
297
393
  async function getAssetsFromBuild(publicDir) {
298
394
  const startTime = Date.now();
299
- const nuxtDir = join$1(publicDir, "_nuxt");
395
+ const nuxtDir = join$1(publicDir, buildAssetsDir);
300
396
  logger.debug(`Scanning build assets from ${nuxtDir}`);
301
397
  const assets = [];
302
398
  const nuxtFiles = await getFilesRecursively(nuxtDir);
303
399
  for (const file of nuxtFiles) {
304
400
  const relativePath = file.replace(nuxtDir, "");
305
- assets.push(`_nuxt${relativePath}`);
401
+ assets.push(`${buildAssetsDir}${relativePath}`);
306
402
  }
307
403
  logger.debug(`Found ${assets.length} assets in ${formatDuration(Date.now() - startTime)}`);
308
404
  return assets;
@@ -563,25 +659,11 @@ function createAssetManager(options) {
563
659
  await promises.writeFile(targetPath, dataToWrite, { flag: "wx" });
564
660
  totalBytes += dataToWrite.byteLength;
565
661
  const versionTimestamp = new Date(versionData.timestamp).getTime();
566
- const ageMs = now - versionTimestamp;
567
- const ageMinutes = Math.floor(ageMs / 6e4);
568
- const ageHours = Math.floor(ageMinutes / 60);
569
- const ageDays = Math.floor(ageHours / 24);
570
- let ageStr;
571
- if (ageDays > 0) {
572
- ageStr = `${ageDays}d ago`;
573
- } else if (ageHours > 0) {
574
- ageStr = `${ageHours}h ago`;
575
- } else if (ageMinutes > 0) {
576
- ageStr = `${ageMinutes}m ago`;
577
- } else {
578
- ageStr = "just now";
579
- }
580
662
  return {
581
663
  asset,
582
664
  size: dataToWrite.byteLength,
583
665
  versionId,
584
- age: ageStr
666
+ age: formatAge(versionTimestamp, now)
585
667
  };
586
668
  }
587
669
  return null;
@@ -605,11 +687,7 @@ function createAssetManager(options) {
605
687
  const isLast = index === otherVersions.length - 1;
606
688
  const prefix = isLast ? " \u2514\u2500" : " \u251C\u2500";
607
689
  const versionTimestamp = new Date(versionData.timestamp).getTime();
608
- const ageMs = now - versionTimestamp;
609
- const ageMinutes = Math.floor(ageMs / 6e4);
610
- const ageHours = Math.floor(ageMinutes / 60);
611
- const ageDays = Math.floor(ageHours / 24);
612
- const ageStr = ageDays > 0 ? `${ageDays}d ago` : ageHours > 0 ? `${ageHours}h ago` : ageMinutes > 0 ? `${ageMinutes}m ago` : "just now";
690
+ const ageStr = formatAge(versionTimestamp, now);
613
691
  const restored = restoredByVersion.get(versionId) || 0;
614
692
  const total = versionData.originalAssets?.length || versionData.assets.length;
615
693
  logger.log(colors.gray(`${prefix} ${versionId.slice(0, 8)} (${restored}/${total} files restored, ${ageStr})`));
@@ -619,7 +697,7 @@ function createAssetManager(options) {
619
697
  }
620
698
  async function augmentBuildMetadata(buildId, publicDir, serverDir) {
621
699
  const manifest = await getVersionManifest(storage);
622
- const latestPath = join$1(publicDir, "_nuxt", "builds", "latest.json");
700
+ const latestPath = join$1(publicDir, buildAssetsDir, "builds", "latest.json");
623
701
  let newLatestContent;
624
702
  try {
625
703
  const latestData = await promises.readFile(latestPath, "utf-8");
@@ -641,7 +719,7 @@ function createAssetManager(options) {
641
719
  logger.warn("Failed to augment builds/latest.json:", error);
642
720
  }
643
721
  }
644
- const metaPath = join$1(publicDir, "_nuxt", "builds", "meta", `${buildId}.json`);
722
+ const metaPath = join$1(publicDir, buildAssetsDir, "builds", "meta", `${buildId}.json`);
645
723
  try {
646
724
  const metaData = await promises.readFile(metaPath, "utf-8");
647
725
  const metaJson = JSON.parse(metaData);
@@ -659,12 +737,14 @@ function createAssetManager(options) {
659
737
  }
660
738
  }
661
739
  if (serverDir && newLatestContent) {
662
- await patchNitroManifest(serverDir, "/_nuxt/builds/latest.json", newLatestContent);
740
+ await patchNitroManifest(serverDir, `${buildAssetsPath}/builds/latest.json`, newLatestContent);
663
741
  }
664
742
  }
665
743
  async function patchNitroManifest(serverDir, assetPath, newContent) {
666
744
  const nitroPath = join$1(serverDir, "chunks", "nitro", "nitro.mjs");
667
- let nitro = await promises.readFile(nitroPath, "utf-8").catch(() => null);
745
+ let nitro = await promises.readFile(nitroPath, "utf-8").catch(() => {
746
+ return null;
747
+ });
668
748
  if (!nitro)
669
749
  return;
670
750
  const assetIdx = nitro.indexOf(`"${assetPath}":`);
@@ -778,6 +858,7 @@ const module$1 = defineNuxtModule({
778
858
  logger.debug("The module is disabled, skipping setup.");
779
859
  return;
780
860
  }
861
+ const nitroCompatibility = setupNitroRuntimeCompatibility(nuxt);
781
862
  const basePathExplicit = !!options.basePath;
782
863
  const basePath = resolveBasePath({ basePath: options.basePath, app: nuxt.options.app });
783
864
  options.basePath = basePath;
@@ -888,19 +969,11 @@ export type { ChunksOutdatedPayload, SkewAdapterConfig, SkewConnection, SkewSSEC
888
969
  }, { nuxt: true });
889
970
  addTypeTemplate({
890
971
  filename: "types/nuxt-skew-protection-nitro.d.ts",
891
- getContents: () => `// Generated by nuxt-skew-protection
892
- import type { H3Event } from 'h3'
893
-
894
- declare module 'h3' {
895
- interface H3EventContext {
896
- /** Client's deployment version from skew protection cookie */
897
- skewVersion?: string
898
- }
899
- }
900
-
901
- declare module 'nitropack/types' {
902
- interface NitroRuntimeHooks {
903
- 'skew:connection:open': (payload: {
972
+ getContents: () => {
973
+ const nitroTypes = renderNitroTypeAugmentations(nitroCompatibility, {
974
+ eventContext: `/** Client's deployment version from skew protection cookie */
975
+ skewVersion?: string`,
976
+ runtimeHooks: `'skew:connection:open': (payload: {
904
977
  id: string
905
978
  version: string
906
979
  route?: string
@@ -909,16 +982,19 @@ declare module 'nitropack/types' {
909
982
  }) => void
910
983
  'skew:connection:route-update': (payload: { id: string, route: string }) => void
911
984
  'skew:connection:close': (payload: { id: string }) => void
912
- // event is H3Event for SSE (via POST), { headers } for WebSocket (no H3Event available)
913
- 'skew:subscribe-stats': (payload: { id: string, event?: H3Event | { headers?: Headers } }) => void
914
- // event is H3Event for SSE (via POST), { headers } for WebSocket (no H3Event available)
915
- 'skew:authorize-stats': (payload: { event?: H3Event | { headers?: Headers }, authorize: () => void }) => void
916
- 'skew:stats': (callback: (stats: { total: number, versions: Record<string, number>, routes: Record<string, number> }) => void) => void
917
- }
918
- }
985
+ /** event is an HTTP event for SSE, or headers for WebSocket connections. */
986
+ 'skew:subscribe-stats': (payload: { id: string, event?: ${nitroCompatibility.eventType} | { headers?: Headers } }) => void
987
+ /** event is an HTTP event for SSE, or headers for WebSocket connections. */
988
+ 'skew:authorize-stats': (payload: { event?: ${nitroCompatibility.eventType} | { headers?: Headers }, authorize: () => void }) => void
989
+ 'skew:stats': (callback: (stats: { total: number, versions: Record<string, number>, routes: Record<string, number> }) => void) => void`
990
+ });
991
+ return `// Generated by nuxt-skew-protection
992
+
993
+ ${nitroTypes}
919
994
 
920
995
  export {}
921
- `
996
+ `;
997
+ }
922
998
  }, { nitro: true });
923
999
  addComponent({
924
1000
  name: "SkewNotification",
@@ -982,6 +1058,19 @@ export {}
982
1058
  const isCloudflareRuntime = nitroPreset?.includes("cloudflare");
983
1059
  const isVercel = nitroPreset?.includes("vercel") || process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1";
984
1060
  const isStatic = isNuxtGenerate(nuxt);
1061
+ if (nitroPreset === "cloudflare-module" || nitroPreset === "cloudflare-durable") {
1062
+ nuxt.hook("nitro:config", (nitroConfig) => {
1063
+ nitroConfig.rollupConfig ||= {};
1064
+ const existingPlugins = nitroConfig.rollupConfig.plugins;
1065
+ nitroConfig.rollupConfig.plugins = [
1066
+ ...Array.isArray(existingPlugins) ? existingPlugins : existingPlugins ? [existingPlugins] : [],
1067
+ createCloudflareAssetProtectionPlugin({
1068
+ buildAssetsDir: nuxt.options.app.buildAssetsDir,
1069
+ runtimeHelperId: resolver.resolve("./runtime/server/utils/cloudflare-asset-fetch")
1070
+ })
1071
+ ];
1072
+ });
1073
+ }
985
1074
  const isAdapter = isSkewAdapter(options.updateStrategy);
986
1075
  let resolvedStrategy = "polling";
987
1076
  if (isAdapter) {
@@ -1052,6 +1141,7 @@ export {}
1052
1141
  const publicDir = nitro.options.output.publicDir;
1053
1142
  assetManager = createAssetManager({
1054
1143
  ...options,
1144
+ buildAssetsDir: nuxt.options.app.buildAssetsDir,
1055
1145
  driver: await resolveBuildTimeDriver(options.storage)
1056
1146
  });
1057
1147
  const assets = await assetManager.getAssetsFromBuild(publicDir);
@@ -14,7 +14,7 @@ export declare function useSkewProtection(options?: UseSkewProtectionOptions): {
14
14
  clientVersion: any;
15
15
  serverVersion: import("vue").ComputedRef<string | undefined>;
16
16
  isConnected: import("vue").ComputedRef<boolean>;
17
- isOnline: Readonly<import("vue").ShallowRef<boolean>>;
17
+ isOnline: Readonly<import("vue").ShallowRef<boolean, boolean>>;
18
18
  isAppOutdated: import("vue").ComputedRef<boolean>;
19
19
  isRollback: import("vue").ComputedRef<boolean>;
20
20
  connect: () => void;
@@ -1,8 +1,8 @@
1
1
  import type { SkewAdapterConfig } from '../types.js';
2
2
  export type { SkewAdapterConfig };
3
3
  declare const _default: import("nuxt/app").Plugin<{
4
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
4
+ skewConnection: import("../types.js").SkewConnection;
5
5
  }> & import("nuxt/app").ObjectPlugin<{
6
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
6
+ skewConnection: import("../types.js").SkewConnection;
7
7
  }>;
8
8
  export default _default;
@@ -1,8 +1,8 @@
1
1
  import type { SkewSSEConfig } from '../types.js';
2
2
  export type { SkewSSEConfig };
3
3
  declare const _default: import("nuxt/app").Plugin<{
4
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
4
+ skewConnection: import("../types.js").SkewConnection;
5
5
  }> & import("nuxt/app").ObjectPlugin<{
6
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
6
+ skewConnection: import("../types.js").SkewConnection;
7
7
  }>;
8
8
  export default _default;
@@ -2,6 +2,7 @@ import { useEventSource } from "@vueuse/core";
2
2
  import { defineNuxtPlugin, useNuxtApp, useRouter, useRuntimeConfig } from "nuxt/app";
3
3
  import { watch } from "vue";
4
4
  import { createSkewConnection } from "../utils/create-skew-connection.js";
5
+ import { resolveInitialRouteQuery, trackRouteChanges } from "../utils/route-tracking.js";
5
6
  export default defineNuxtPlugin({
6
7
  name: "skew-protection:sse-updates",
7
8
  async setup() {
@@ -13,7 +14,7 @@ export default defineNuxtPlugin({
13
14
  const skewConfig = runtimeConfig.public.skewProtection;
14
15
  const routeTracking = skewConfig?.routeTracking;
15
16
  const basePath = skewConfig?.basePath || "/__skew";
16
- const initialRoute = routeTracking ? `?route=${encodeURIComponent(router.currentRoute.value.path)}` : "";
17
+ const initialRoute = resolveInitialRouteQuery(routeTracking, router);
17
18
  const config = {
18
19
  url: `${basePath}/sse${initialRoute}`,
19
20
  options: {
@@ -33,11 +34,7 @@ export default defineNuxtPlugin({
33
34
  return { cleanup: sse.close };
34
35
  }
35
36
  });
36
- if (routeTracking) {
37
- router.afterEach((to) => {
38
- skewConnection.sendRoute(to.path);
39
- });
40
- }
37
+ trackRouteChanges(router, routeTracking, skewConnection);
41
38
  return { provide: { skewConnection } };
42
39
  }
43
40
  });
@@ -1,8 +1,8 @@
1
1
  import type { SkewWebSocketConfig } from '../types.js';
2
2
  export type { SkewWebSocketConfig };
3
3
  declare const _default: import("nuxt/app").Plugin<{
4
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
4
+ skewConnection: import("../types.js").SkewConnection;
5
5
  }> & import("nuxt/app").ObjectPlugin<{
6
- skewConnection: import("../utils/create-skew-connection.js").SkewConnection;
6
+ skewConnection: import("../types.js").SkewConnection;
7
7
  }>;
8
8
  export default _default;
@@ -3,6 +3,7 @@ import { defineNuxtPlugin, useNuxtApp, useRouter, useRuntimeConfig } from "nuxt/
3
3
  import { watch } from "vue";
4
4
  import { SKEW_MESSAGE_TYPE } from "../../const.js";
5
5
  import { createSkewConnection } from "../utils/create-skew-connection.js";
6
+ import { resolveInitialRouteQuery, trackRouteChanges } from "../utils/route-tracking.js";
6
7
  export default defineNuxtPlugin({
7
8
  name: "skew-protection:ws-updates",
8
9
  async setup() {
@@ -15,7 +16,7 @@ export default defineNuxtPlugin({
15
16
  const routeTracking = skewConfig?.routeTracking;
16
17
  const basePath = skewConfig?.basePath || "/__skew";
17
18
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
18
- const initialRoute = routeTracking ? `?route=${encodeURIComponent(router.currentRoute.value.path)}` : "";
19
+ const initialRoute = resolveInitialRouteQuery(routeTracking, router);
19
20
  const config = {
20
21
  url: `${protocol}//${window.location.host}${basePath}/ws${initialRoute}`,
21
22
  options: {
@@ -45,11 +46,7 @@ export default defineNuxtPlugin({
45
46
  };
46
47
  }
47
48
  });
48
- if (routeTracking) {
49
- router.afterEach((to) => {
50
- skewConnection.sendRoute(to.path);
51
- });
52
- }
49
+ trackRouteChanges(router, routeTracking, skewConnection);
53
50
  return { provide: { skewConnection } };
54
51
  }
55
52
  });
@@ -1,4 +1,4 @@
1
- import type { Ref } from 'vue';
1
+ import type { SkewConnection } from '../types.js';
2
2
  export interface SkewMessage {
3
3
  type: string;
4
4
  version?: string;
@@ -12,13 +12,4 @@ export interface CreateSkewConnectionConfig {
12
12
  send?: (data: unknown) => void;
13
13
  } | (() => void) | void;
14
14
  }
15
- export interface SkewConnection {
16
- connect: () => void;
17
- disconnect: () => void;
18
- send: (data: unknown) => void;
19
- sendRoute: (route: string) => void;
20
- subscribeStats: () => void;
21
- buildId: string;
22
- cookie: Ref<string | null | undefined>;
23
- }
24
15
  export declare function createSkewConnection(config: CreateSkewConnectionConfig): SkewConnection;
@@ -0,0 +1,20 @@
1
+ import type { SkewConnection } from '../types.js';
2
+ export interface RouteTrackingRouter {
3
+ currentRoute: {
4
+ value: {
5
+ path: string;
6
+ };
7
+ };
8
+ afterEach: (guard: (to: {
9
+ path: string;
10
+ }) => void) => void;
11
+ }
12
+ /**
13
+ * Build the `?route=` query param appended to the initial SSE/WS connection URL
14
+ * so the server knows the client's starting route when route tracking is on.
15
+ */
16
+ export declare function resolveInitialRouteQuery(routeTracking: boolean | undefined, router: RouteTrackingRouter): string;
17
+ /**
18
+ * Send route updates to the server on client-side navigation when route tracking is on.
19
+ */
20
+ export declare function trackRouteChanges(router: RouteTrackingRouter, routeTracking: boolean | undefined, skewConnection: SkewConnection): void;
@@ -0,0 +1,8 @@
1
+ export function resolveInitialRouteQuery(routeTracking, router) {
2
+ return routeTracking ? `?route=${encodeURIComponent(router.currentRoute.value.path)}` : "";
3
+ }
4
+ export function trackRouteChanges(router, routeTracking, skewConnection) {
5
+ if (!routeTracking)
6
+ return;
7
+ router.afterEach((to) => skewConnection.sendRoute(to.path));
8
+ }
@@ -1,11 +1,11 @@
1
- import type { H3Event } from 'h3';
1
+ import type { SkewProtectionEvent } from './getRuntimeConfigSkewProtection.js';
2
2
  /**
3
3
  * Get the skew protection version cookie name from runtime config
4
4
  *
5
5
  * @param event - H3 event (optional, for better type safety)
6
6
  * @returns The configured cookie name
7
7
  */
8
- export declare function getSkewProtectionCookieName(event?: H3Event): string;
8
+ export declare function getSkewProtectionCookieName(event?: SkewProtectionEvent): string;
9
9
  /**
10
10
  * Get the skew protection version cookie value
11
11
  *
@@ -20,7 +20,7 @@ export declare function getSkewProtectionCookieName(event?: H3Event): string;
20
20
  * })
21
21
  * ```
22
22
  */
23
- export declare function getSkewProtectionCookie(event: H3Event): string | undefined;
23
+ export declare function getSkewProtectionCookie(event: SkewProtectionEvent): string | undefined;
24
24
  /**
25
25
  * Set the skew protection version cookie
26
26
  *
@@ -34,4 +34,4 @@ export declare function getSkewProtectionCookie(event: H3Event): string | undefi
34
34
  * })
35
35
  * ```
36
36
  */
37
- export declare function setSkewProtectionCookie(event: H3Event, value: string): void;
37
+ export declare function setSkewProtectionCookie(event: SkewProtectionEvent, value: string): void;
@@ -1,4 +1,4 @@
1
- import { getCookie, setCookie } from "h3";
1
+ import { getCookie, setCookie } from "#nuxtseo/h3";
2
2
  import { getRuntimeConfigSkewProtection } from "./getRuntimeConfigSkewProtection.js";
3
3
  export function getSkewProtectionCookieName(event) {
4
4
  const { cookie } = getRuntimeConfigSkewProtection(event);
@@ -1,7 +1,10 @@
1
- import type { H3Event } from 'h3';
2
1
  import type { SkewProtectionRuntimeConfig } from '../../types.js';
2
+ /** Event surface shared by Nitro 2 and Nitro 3 request handlers. */
3
+ export interface SkewProtectionEvent {
4
+ context: object;
5
+ }
3
6
  /**
4
7
  * Get skew protection runtime config with proper types
5
8
  * Ensures cookie config is always defined with required properties
6
9
  */
7
- export declare function getRuntimeConfigSkewProtection(event?: H3Event): SkewProtectionRuntimeConfig;
10
+ export declare function getRuntimeConfigSkewProtection(event?: SkewProtectionEvent): SkewProtectionRuntimeConfig;
@@ -1,4 +1,4 @@
1
- import { useRuntimeConfig } from "nitropack/runtime";
1
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
2
2
  export function getRuntimeConfigSkewProtection(event) {
3
3
  const config = useRuntimeConfig(event);
4
4
  return config.public.skewProtection;
@@ -1,10 +1,10 @@
1
- import type { H3Event } from 'h3';
1
+ import type { SkewProtectionEvent } from './getRuntimeConfigSkewProtection.js';
2
2
  /**
3
3
  * Get the client's deployment version from the skew protection cookie.
4
4
  * Returns undefined if no cookie is set.
5
5
  */
6
- export declare function getClientVersion(event: H3Event): string | undefined;
6
+ export declare function getClientVersion(event: SkewProtectionEvent): string | undefined;
7
7
  /**
8
8
  * Check if the client is outdated based on cookie version vs current build ID
9
9
  */
10
- export declare function isClientOutdated(event: H3Event): boolean;
10
+ export declare function isClientOutdated(event: SkewProtectionEvent): boolean;
@@ -1,4 +1,4 @@
1
- import { useRuntimeConfig } from "nitropack/runtime";
1
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
2
2
  import { getSkewProtectionCookie } from "./cookie.js";
3
3
  export function getClientVersion(event) {
4
4
  return getSkewProtectionCookie(event);
@@ -3,5 +3,5 @@
3
3
  * 1. Sets event.context.skewVersion on all requests (from cookie)
4
4
  * 2. Sets the skew-version cookie on document requests (HTML pages)
5
5
  */
6
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
6
+ declare const _default: any;
7
7
  export default _default;
@@ -1,5 +1,5 @@
1
- import { defineEventHandler, getHeader } from "h3";
2
- import { useRuntimeConfig } from "nitropack/runtime";
1
+ import { defineEventHandler, getHeader } from "#nuxtseo/h3";
2
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  import { getSkewProtectionCookie, setSkewProtectionCookie } from "../imports/cookie.js";
4
4
  export default defineEventHandler(async (event) => {
5
5
  const clientVersion = getSkewProtectionCookie(event);
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineEventHandler, getHeader, setCookie } from "h3";
1
+ import { defineEventHandler, getHeader, setCookie } from "#nuxtseo/h3";
2
2
  export default defineEventHandler(async (event) => {
3
3
  const secFetchDest = getHeader(event, "sec-fetch-dest");
4
4
  if (secFetchDest !== "document") {
@@ -1,2 +1,2 @@
1
- declare const _default: import("nitropack/types").NitroAppPlugin;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineNitroPlugin } from "nitropack/runtime";
1
+ import { defineNitroPlugin } from "#nuxtseo/nitro";
2
2
  function getCtx(peer) {
3
3
  return peer?._internal?.durable?.ctx || null;
4
4
  }
@@ -1,2 +1,2 @@
1
- declare const _default: import("nitropack/types").NitroAppPlugin;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineNitroPlugin } from "nitropack/runtime";
1
+ import { defineNitroPlugin } from "#nuxtseo/nitro";
2
2
  export default defineNitroPlugin((nitroApp) => {
3
3
  const connections = /* @__PURE__ */ new Map();
4
4
  const statsSubscribers = /* @__PURE__ */ new Set();
@@ -2,5 +2,5 @@
2
2
  * Admin endpoint for nuxtseo.com dashboard to query live connection stats.
3
3
  * Requires Authorization header with SEO Pro key.
4
4
  */
5
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown>>;
5
+ declare const _default: any;
6
6
  export default _default;
@@ -1,5 +1,5 @@
1
- import { createError, defineEventHandler, getHeader } from "h3";
2
- import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
1
+ import { createError, defineEventHandler, getHeader } from "#nuxtseo/h3";
2
+ import { useNitroApp, useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const config = useRuntimeConfig(event);
5
5
  const seoProKey = config.seoProKey || process.env.NUXT_SEO_PRO_KEY;
@@ -2,9 +2,5 @@
2
2
  * Health check endpoint returning current deployment version.
3
3
  * Useful for monitoring and load balancers.
4
4
  */
5
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, {
6
- ok: boolean;
7
- version: any;
8
- uptime: number;
9
- }>;
5
+ declare const _default: any;
10
6
  export default _default;
@@ -1,5 +1,5 @@
1
- import { defineEventHandler } from "h3";
2
- import { useRuntimeConfig } from "nitropack/runtime";
1
+ import { defineEventHandler } from "#nuxtseo/h3";
2
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  export default defineEventHandler((event) => {
4
4
  const config = useRuntimeConfig(event);
5
5
  return {
@@ -1,4 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- ok: boolean;
3
- }>>;
1
+ declare const _default: any;
4
2
  export default _default;
@@ -1,5 +1,5 @@
1
- import { defineEventHandler, readBody } from "h3";
2
- import { useNitroApp } from "nitropack/runtime";
1
+ import { defineEventHandler, readBody } from "#nuxtseo/h3";
2
+ import { useNitroApp } from "#nuxtseo/nitro";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const body = await readBody(event);
5
5
  if (!body?.connectionId || !body?.route) {
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,5 +1,5 @@
1
- import { createEventStream, defineEventHandler, getQuery, getRequestIP } from "h3";
2
- import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
1
+ import { createEventStream, defineEventHandler, getQuery, getRequestIP } from "#nuxtseo/h3";
2
+ import { useNitroApp, useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  import { SKEW_MESSAGE_TYPE } from "../../../const.js";
4
4
  import { getSkewProtectionCookie } from "../../imports/cookie.js";
5
5
  export default defineEventHandler(async (event) => {
@@ -2,7 +2,5 @@
2
2
  * POST endpoint for SSE connections to request stats subscription.
3
3
  * Since SSE is unidirectional, clients POST here to subscribe.
4
4
  */
5
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
6
- ok: boolean;
7
- }>>;
5
+ declare const _default: any;
8
6
  export default _default;
@@ -1,5 +1,5 @@
1
- import { createError, defineEventHandler, readBody } from "h3";
2
- import { useNitroApp } from "nitropack/runtime";
1
+ import { createError, defineEventHandler, readBody } from "#nuxtseo/h3";
2
+ import { useNitroApp } from "#nuxtseo/nitro";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const body = await readBody(event);
5
5
  if (!body.connectionId) {
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, never>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { parse as parseCookie } from "cookie-es";
2
- import { defineWebSocketHandler } from "h3";
3
- import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
2
+ import { defineWebSocketHandler } from "#nuxtseo/h3";
3
+ import { useNitroApp, useRuntimeConfig } from "#nuxtseo/nitro";
4
4
  import { SKEW_MESSAGE_TYPE } from "../../../const.js";
5
5
  import { getSkewProtectionCookieName } from "../../imports/cookie.js";
6
6
  export default defineWebSocketHandler({
@@ -1,20 +1,6 @@
1
- interface ProductionDebugResponse {
2
- health?: {
3
- ok: boolean;
4
- version: string;
5
- uptime: number;
6
- } | null;
7
- manifest?: Record<string, unknown> | null;
8
- stats?: {
9
- total: number;
10
- versions: Record<string, number>;
11
- routes: Record<string, number>;
12
- } | null;
13
- errors: string[];
14
- }
15
1
  /**
16
2
  * Proxy endpoint that fetches debug data from a production site.
17
3
  * Avoids CORS issues by proxying through the dev server.
18
4
  */
19
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<ProductionDebugResponse>>;
5
+ declare const _default: any;
20
6
  export default _default;
@@ -1,5 +1,5 @@
1
- import { defineEventHandler, getQuery } from "h3";
2
1
  import { $fetch } from "ofetch";
2
+ import { defineEventHandler, getQuery } from "#nuxtseo/h3";
3
3
  const RE_TRAILING_SLASHES = /\/+$/;
4
4
  export default defineEventHandler(async (event) => {
5
5
  const { url } = getQuery(event);
@@ -1,18 +1,5 @@
1
1
  /**
2
2
  * Devtools debug endpoint returning module configuration and resolved state.
3
3
  */
4
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, {
5
- version: {};
6
- siteConfigUrl: string;
7
- config: {
8
- cookie: unknown;
9
- debug: unknown;
10
- connectionTracking: unknown;
11
- routeTracking: unknown;
12
- ipTracking: unknown;
13
- reloadStrategy: unknown;
14
- multiTab: unknown;
15
- };
16
- buildId: any;
17
- }>;
4
+ declare const _default: any;
18
5
  export default _default;
@@ -1,5 +1,5 @@
1
- import { defineEventHandler } from "h3";
2
- import { useRuntimeConfig } from "nitropack/runtime";
1
+ import { defineEventHandler } from "#nuxtseo/h3";
2
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  import { getSiteConfig } from "#site-config/server/composables";
4
4
  export default defineEventHandler((event) => {
5
5
  const config = useRuntimeConfig(event);
@@ -0,0 +1,6 @@
1
+ interface CloudflareAssetBinding {
2
+ fetch: (request: Request) => Promise<Response>;
3
+ }
4
+ export declare function fetchCloudflareAsset(request: Request, assets: CloudflareAssetBinding): Promise<Response>;
5
+ export declare function fetchCloudflareBuildAsset(request: Request, assets: CloudflareAssetBinding | undefined, buildAssetsDir: string): Promise<Response> | undefined;
6
+ export {};
@@ -0,0 +1,34 @@
1
+ function disableCaching(response) {
2
+ const headers = new Headers(response.headers);
3
+ headers.set("cache-control", "no-store");
4
+ headers.set("cdn-cache-control", "no-store");
5
+ headers.set("cloudflare-cdn-cache-control", "no-store");
6
+ return new Response(response.body, {
7
+ status: response.status,
8
+ statusText: response.statusText,
9
+ headers
10
+ });
11
+ }
12
+ function createRetryRequest(request) {
13
+ return new Request(request, { cache: "no-cache" });
14
+ }
15
+ export async function fetchCloudflareAsset(request, assets) {
16
+ const response = await assets.fetch(request);
17
+ if (response.status < 400) {
18
+ return response;
19
+ }
20
+ if (response.status !== 404) {
21
+ return disableCaching(response);
22
+ }
23
+ const retryResponse = await assets.fetch(createRetryRequest(request));
24
+ return retryResponse.status < 400 ? retryResponse : disableCaching(retryResponse);
25
+ }
26
+ export function fetchCloudflareBuildAsset(request, assets, buildAssetsDir) {
27
+ if (!new URL(request.url).pathname.startsWith(buildAssetsDir)) {
28
+ return void 0;
29
+ }
30
+ if (!assets) {
31
+ return Promise.resolve(disableCaching(new Response(null, { status: 404 })));
32
+ }
33
+ return fetchCloudflareAsset(request, assets);
34
+ }
@@ -1,4 +1,5 @@
1
- export declare const logger: import("consola").ConsolaInstance;
1
+ import type { ConsolaInstance } from 'consola';
2
+ export declare const logger: ConsolaInstance;
2
3
  /**
3
4
  * Initialize logger with runtime config
4
5
  */
@@ -1,10 +1,6 @@
1
- import { createConsola } from "consola";
2
1
  import { useRuntimeConfig } from "nuxt/app";
3
- export const logger = createConsola({
4
- defaults: {
5
- tag: "nuxt-skew-protection"
6
- }
7
- });
2
+ import { createModuleLogger } from "nuxtseo-shared/utils";
3
+ export const logger = createModuleLogger("nuxt-skew-protection");
8
4
  export function init() {
9
5
  const config = useRuntimeConfig();
10
6
  logger.level = config.public.skewProtection.debug ? 4 : 3;
@@ -1,7 +1,5 @@
1
1
  import type { CookieSerializeOptions } from 'cookie-es';
2
2
  export interface NuxtSkewProtectionRuntimeConfig {
3
- sse: boolean;
4
- durableObjects: boolean;
5
3
  /**
6
4
  * Path prefix for the module's runtime endpoints (`/ws`, `/sse`, `/health`,
7
5
  * `/route`, `/subscribe-stats`, `/admin/stats`). Defaults to `/__skew`. Set a
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-skew-protection",
3
3
  "type": "module",
4
- "version": "1.3.1",
4
+ "version": "1.4.1",
5
5
  "description": "Solve Nuxt version skews with persistent assets and instant updates.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -77,49 +77,50 @@
77
77
  }
78
78
  },
79
79
  "dependencies": {
80
- "@nuxt/kit": "^4.5.0",
81
- "@vueuse/core": "^14.3.0",
80
+ "@nuxt/kit": "^4.5.2",
81
+ "@vueuse/core": "^14.4.0",
82
82
  "consola": "^3.4.2",
83
83
  "cookie-es": "^3.1.1",
84
- "nuxt-site-config": "^4.1.1",
85
- "nuxtseo-shared": "^5.3.2",
84
+ "nuxt-site-config": "^4.2.0",
85
+ "nuxtseo-shared": "^5.3.10",
86
+ "ofetch": "^1.5.1",
86
87
  "pathe": "^2.0.3",
87
88
  "pkg-types": "^2.3.1",
88
- "tinyexec": "^1.2.4",
89
+ "tinyexec": "^1.3.0",
89
90
  "unstorage": "^1.17.5",
90
91
  "zod": "^4.4.3"
91
92
  },
92
93
  "devDependencies": {
93
- "@antfu/eslint-config": "^9.1.0",
94
+ "@antfu/eslint-config": "^9.3.0",
94
95
  "@arethetypeswrong/cli": "^0.18.5",
95
- "@nuxt/module-builder": "^1.0.2",
96
- "@nuxt/test-utils": "^4.0.3",
96
+ "@nuxt/module-builder": "^1.0.3",
97
+ "@nuxt/test-utils": "^4.1.0",
97
98
  "@nuxt/ui": "^4.10.0",
98
- "@nuxtjs/robots": "^6.1.2",
99
+ "@nuxtjs/robots": "^6.1.4",
99
100
  "@types/ws": "^8.18.1",
100
- "ably": "^2.25.0",
101
- "better-sqlite3": "^12.11.1",
102
- "bumpp": "^11.1.0",
103
- "eslint": "^10.7.0",
104
- "eslint-plugin-harlanzw": "^0.17.0",
105
- "eventsource": "^4.1.0",
106
- "happy-dom": "^20.10.6",
107
- "ioredis": "^5.11.1",
108
- "nuxt": "^4.5.0",
109
- "nuxt-auth-utils": "^0.5.29",
110
- "nuxtseo-layer-devtools": "^5.3.2",
111
- "playwright-core": "^1.61.1",
112
- "pusher-js": "^8.5.0",
101
+ "ably": "^2.26.0",
102
+ "better-sqlite3": "^13.0.3",
103
+ "bumpp": "^12.2.0",
104
+ "eslint": "^10.8.1",
105
+ "eslint-plugin-harlanzw": "^0.17.1",
106
+ "eventsource": "^4.1.1",
107
+ "happy-dom": "^20.11.2",
108
+ "ioredis": "^6.0.0",
109
+ "nuxt": "^4.5.2",
110
+ "nuxt-auth-utils": "^0.5.30",
111
+ "nuxtseo-layer-devtools": "^5.3.10",
112
+ "playwright-core": "^1.62.1",
113
+ "pusher-js": "^8.6.0",
113
114
  "std-env": "^4.2.0",
114
- "tsx": "^4.23.1",
115
- "typescript": "^6.0.3",
115
+ "tsx": "^4.23.11",
116
+ "typescript": "6.0.3",
116
117
  "unbuild": "^3.6.1",
117
118
  "vitest": "^4.1.10",
118
- "vue": "^3.5.40",
119
+ "vue": "^3.5.41",
119
120
  "vue-router": "^5.2.0",
120
- "vue-tsc": "^3.3.7",
121
- "wrangler": "^4.112.0",
122
- "ws": "^8.21.1"
121
+ "vue-tsc": "^3.3.9",
122
+ "wrangler": "^4.120.0",
123
+ "ws": "^8.21.3"
123
124
  },
124
125
  "resolutions": {
125
126
  "nuxt-skew-protection": "workspace:*",
@@ -134,7 +135,7 @@
134
135
  "dev:build": "nuxi build playground",
135
136
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && nuxi prepare playground && pnpm run build:devtools",
136
137
  "release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
137
- "test": "vitest",
138
+ "test": "vitest && pnpm test:nuxt5",
138
139
  "test:unit": "vitest run test/unit",
139
140
  "test:integration": "vitest run test/integration",
140
141
  "test:e2e": "vitest run test/e2e",
@@ -145,6 +146,7 @@
145
146
  "test:node-polling": "node --experimental-strip-types scripts/test-node-polling.ts",
146
147
  "test:node-ws": "node --experimental-strip-types scripts/test-node-ws.ts",
147
148
  "test:static-polling": "node --experimental-strip-types scripts/test-static-polling.ts",
149
+ "test:nuxt5": "pnpm pack --out test/fixtures/nuxt5/module.tgz && node test/fixtures/nuxt5/run.mjs",
148
150
  "test:vercel-sse": "node --experimental-strip-types scripts/test-vercel-sse.ts",
149
151
  "typecheck": "nuxt typecheck",
150
152
  "test:attw": "attw --pack"
@@ -1 +0,0 @@
1
- export declare const logger: import("consola").ConsolaInstance;
@@ -1,6 +0,0 @@
1
- import { createConsola } from "consola";
2
- export const logger = createConsola({
3
- defaults: {
4
- tag: "nuxt-skew-protection"
5
- }
6
- });