nuxt-skew-protection 1.4.2 → 1.4.3

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
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=4.0.0"
5
5
  },
6
6
  "configKey": "skewProtection",
7
- "version": "1.4.2",
7
+ "version": "1.4.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -188,6 +188,7 @@ async function resolveBuildTimeDriver(storage) {
188
188
  }
189
189
 
190
190
  const virtualEntryId = "virtual:nuxt-skew-protection/cloudflare-entry";
191
+ const cloudflareAssetProtectionPluginName = "nuxt-skew-protection:cloudflare-asset-fetch";
191
192
  const resolvedVirtualEntryId = `\0${virtualEntryId}`;
192
193
  const legacyCloudflareAdapterSuffixes = [
193
194
  "/nitropack/dist/runtime/entries/cloudflare-module.mjs",
@@ -206,6 +207,13 @@ function normalizeBuildAssetsDir(value) {
206
207
  const path = value.replace(/^\/+|\/+$/g, "");
207
208
  return `/${path}/`;
208
209
  }
210
+ function withoutCloudflareAssetProtectionPlugin(plugins) {
211
+ return plugins.filter((plugin) => {
212
+ if (!plugin || typeof plugin !== "object" || !("name" in plugin))
213
+ return true;
214
+ return plugin.name !== cloudflareAssetProtectionPluginName;
215
+ });
216
+ }
209
217
  function renderCloudflareEntry(options) {
210
218
  const nitroEntryId = JSON.stringify(options.nitroEntryId);
211
219
  const runtimeHelperId = JSON.stringify(options.runtimeHelperId);
@@ -231,7 +239,7 @@ function createCloudflareAssetProtectionPlugin(options) {
231
239
  let wrapperLoaded = false;
232
240
  let shouldWrapEntry = true;
233
241
  return {
234
- name: "nuxt-skew-protection:cloudflare-asset-fetch",
242
+ name: cloudflareAssetProtectionPluginName,
235
243
  options(inputOptions) {
236
244
  nitroEntryId = void 0;
237
245
  wrapperLoaded = false;
@@ -1082,6 +1090,13 @@ export {}
1082
1090
  })
1083
1091
  ];
1084
1092
  });
1093
+ nuxt.hook("nitro:init", (nitro) => {
1094
+ nitro.hooks.hook("prerender:config", (prerenderConfig) => {
1095
+ const plugins = prerenderConfig.rollupConfig?.plugins;
1096
+ if (Array.isArray(plugins))
1097
+ prerenderConfig.rollupConfig.plugins = withoutCloudflareAssetProtectionPlugin(plugins);
1098
+ });
1099
+ });
1085
1100
  }
1086
1101
  const isAdapter = isSkewAdapter(options.updateStrategy);
1087
1102
  let resolvedStrategy = "polling";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-skew-protection",
3
3
  "type": "module",
4
- "version": "1.4.2",
4
+ "version": "1.4.3",
5
5
  "description": "Solve Nuxt version skews with persistent assets and instant updates.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",