nuxt-skew-protection 0.1.4 → 0.1.6
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.cjs +5 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -3
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -12,7 +12,7 @@ const pathe = require('pathe');
|
|
|
12
12
|
|
|
13
13
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
14
|
function isStaticPreset(nuxt = kit.useNuxt()) {
|
|
15
|
-
return nuxt.options.nitro
|
|
15
|
+
return nuxt.options.nitro?.static || nuxt.options._generate || [
|
|
16
16
|
"static",
|
|
17
17
|
"github-pages"
|
|
18
18
|
].includes(resolveNitroPreset());
|
|
@@ -592,7 +592,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
592
592
|
cookie: options.cookie,
|
|
593
593
|
debug: options.debug
|
|
594
594
|
};
|
|
595
|
-
const nitroPreset = nuxt.options.nitro?.preset || resolveNitroPreset(nuxt);
|
|
595
|
+
const nitroPreset = nuxt.options.nitro?.preset || resolveNitroPreset(nuxt.options.nitro);
|
|
596
596
|
kit.addTypeTemplate({
|
|
597
597
|
filename: "types/nuxt-skew-protection.d.ts",
|
|
598
598
|
getContents: () => {
|
|
@@ -642,6 +642,7 @@ export {}
|
|
|
642
642
|
});
|
|
643
643
|
nuxt.options.alias["nuxt-skew-protection/server"] = resolver.resolve("./runtime/server");
|
|
644
644
|
if (options.storage?.driver) {
|
|
645
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
645
646
|
nuxt.options.nitro.storage = nuxt.options.nitro.storage || {};
|
|
646
647
|
nuxt.options.nitro.storage["skew-protection"] = options.storage;
|
|
647
648
|
}
|
|
@@ -669,6 +670,7 @@ export {}
|
|
|
669
670
|
if (!node_fs.existsSync(swPath)) {
|
|
670
671
|
swPath = resolver.resolve("../sw");
|
|
671
672
|
}
|
|
673
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
672
674
|
nuxt.options.nitro.publicAssets = nuxt.options.nitro.publicAssets || [];
|
|
673
675
|
nuxt.options.nitro.publicAssets.push({
|
|
674
676
|
dir: swPath,
|
|
@@ -698,7 +700,7 @@ export {}
|
|
|
698
700
|
});
|
|
699
701
|
}
|
|
700
702
|
if (options.checkForUpdateStrategy === "ws") {
|
|
701
|
-
if (!nuxt.options.nitro
|
|
703
|
+
if (!nuxt.options.nitro?.experimental?.websocket) {
|
|
702
704
|
logger.warn("You need to enable `experimental.websocket` in your Nitro config to use WebSockets. Falling back to polling.");
|
|
703
705
|
options.checkForUpdateStrategy = "polling";
|
|
704
706
|
} else if (isCloudflareRuntime && nitroPreset !== "cloudflare-durable") {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { colors } from 'consola/utils';
|
|
|
9
9
|
import { join as join$1, dirname } from 'pathe';
|
|
10
10
|
|
|
11
11
|
function isStaticPreset(nuxt = useNuxt()) {
|
|
12
|
-
return nuxt.options.nitro
|
|
12
|
+
return nuxt.options.nitro?.static || nuxt.options._generate || [
|
|
13
13
|
"static",
|
|
14
14
|
"github-pages"
|
|
15
15
|
].includes(resolveNitroPreset());
|
|
@@ -589,7 +589,7 @@ const module = defineNuxtModule({
|
|
|
589
589
|
cookie: options.cookie,
|
|
590
590
|
debug: options.debug
|
|
591
591
|
};
|
|
592
|
-
const nitroPreset = nuxt.options.nitro?.preset || resolveNitroPreset(nuxt);
|
|
592
|
+
const nitroPreset = nuxt.options.nitro?.preset || resolveNitroPreset(nuxt.options.nitro);
|
|
593
593
|
addTypeTemplate({
|
|
594
594
|
filename: "types/nuxt-skew-protection.d.ts",
|
|
595
595
|
getContents: () => {
|
|
@@ -639,6 +639,7 @@ export {}
|
|
|
639
639
|
});
|
|
640
640
|
nuxt.options.alias["nuxt-skew-protection/server"] = resolver.resolve("./runtime/server");
|
|
641
641
|
if (options.storage?.driver) {
|
|
642
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
642
643
|
nuxt.options.nitro.storage = nuxt.options.nitro.storage || {};
|
|
643
644
|
nuxt.options.nitro.storage["skew-protection"] = options.storage;
|
|
644
645
|
}
|
|
@@ -666,6 +667,7 @@ export {}
|
|
|
666
667
|
if (!existsSync(swPath)) {
|
|
667
668
|
swPath = resolver.resolve("../sw");
|
|
668
669
|
}
|
|
670
|
+
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
669
671
|
nuxt.options.nitro.publicAssets = nuxt.options.nitro.publicAssets || [];
|
|
670
672
|
nuxt.options.nitro.publicAssets.push({
|
|
671
673
|
dir: swPath,
|
|
@@ -695,7 +697,7 @@ export {}
|
|
|
695
697
|
});
|
|
696
698
|
}
|
|
697
699
|
if (options.checkForUpdateStrategy === "ws") {
|
|
698
|
-
if (!nuxt.options.nitro
|
|
700
|
+
if (!nuxt.options.nitro?.experimental?.websocket) {
|
|
699
701
|
logger.warn("You need to enable `experimental.websocket` in your Nitro config to use WebSockets. Falling back to polling.");
|
|
700
702
|
options.checkForUpdateStrategy = "polling";
|
|
701
703
|
} else if (isCloudflareRuntime && nitroPreset !== "cloudflare-durable") {
|