@onderwijsin/nuxt-turnstile 0.2.3 → 0.2.5

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/README.md CHANGED
@@ -137,3 +137,6 @@ after Turnstile succeeds; the module does not replace the route's existing submi
137
137
  - Node.js 22+
138
138
  - Node and Cloudflare Workers-compatible server runtime
139
139
  - No Sentry dependency or telemetry is included
140
+
141
+ Developed and tested against Node.js 24 and Nuxt 4.5.x. Versions outside the current CI matrix are
142
+ not continuously tested. Nuxt 3 is not guaranteed.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onderwijsin/nuxt-turnstile",
3
3
  "configKey": "turnstile",
4
- "version": "0.2.3",
4
+ "version": "0.2.5",
5
5
  "compatibility": {
6
6
  "nuxt": "^4.0.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { defineNuxtModule, useLogger, createResolver, addTypeTemplate, addImportsDir, addServerScanDir } from '@nuxt/kit';
2
2
  import { defu } from 'defu';
3
- import { enabled, resolveModuleName, resolveLoggerScope, moduleSetup, validateModuleOptions, transpileRuntime } from '@onderwijsin/nuxt-module-utils/shared';
3
+ import { enabled, resolveModuleName, resolveLoggerScope, moduleSetup, validateModuleOptions, transpileRuntime, moduleDependenciesWhenEnabled } from '@onderwijsin/nuxt-module-utils/build';
4
4
  import { z } from 'zod';
5
5
 
6
- const version = "0.2.3";
6
+ const version = "0.2.5";
7
7
 
8
8
  const turnstileOptionsSchema = z.object({
9
9
  enabled,
@@ -30,10 +30,10 @@ const module$1 = defineNuxtModule({
30
30
  compatibility: { nuxt: "^4.0.0" }
31
31
  },
32
32
  defaults: DEFAULTS,
33
- moduleDependencies: (nuxt) => nuxt.options.turnstile === false || nuxt.options.turnstile?.enabled === false ? {} : {
33
+ moduleDependencies: (nuxt) => moduleDependenciesWhenEnabled(nuxt.options.turnstile, {
34
34
  "@nuxt/ui": { version: ">=4.0.0" },
35
35
  "@nuxtjs/turnstile": { version: ">=1.1.3" }
36
- },
36
+ }),
37
37
  setup(rawOptions, nuxt) {
38
38
  const log = useLogger(resolveLoggerScope(MODULE_KEY));
39
39
  const { start, end, isEnabled } = moduleSetup(MODULE_NAME, rawOptions, log);
@@ -2,7 +2,7 @@ import { createError, getRequestHeader } from "h3";
2
2
  import { useRuntimeConfig } from "#imports";
3
3
  import { verifyTurnstileToken } from "@nuxtjs/turnstile/runtime/server/utils/verify.js";
4
4
  import { isAdmin } from "@onderwijsin/nuxt-module-utils/server";
5
- import { attempt } from "@onderwijsin/nuxt-module-utils/shared";
5
+ import { attempt, hasKey, isNumber, isRecord } from "@onderwijsin/nuxt-module-utils/shared";
6
6
  import { z } from "zod";
7
7
  import { TURNSTILE_TOKEN_HEADER } from "../../constants.js";
8
8
  const turnstileVerificationSchema = z.object({
@@ -78,7 +78,5 @@ export function createTurnstileErrorData(code, expectedAction) {
78
78
  return expectedAction ? { code, expectedAction } : { code };
79
79
  }
80
80
  export function isErrorWithStatusCode(error) {
81
- return Boolean(
82
- error && typeof error === "object" && "statusCode" in error && typeof error.statusCode === "number"
83
- );
81
+ return isRecord(error) && hasKey(error, "statusCode") && isNumber(error.statusCode);
84
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onderwijsin/nuxt-turnstile",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Nuxt Turnstile integration with client helpers and server-side validation.",
5
5
  "homepage": "https://github.com/onderwijsin/nuxt-modules#readme",
6
6
  "bugs": {
@@ -43,7 +43,7 @@
43
43
  "defu": "6.1.7",
44
44
  "h3": "1.15.11",
45
45
  "zod": "4.4.3",
46
- "@onderwijsin/nuxt-module-utils": "^0.1.0"
46
+ "@onderwijsin/nuxt-module-utils": "^0.3.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@nuxt/module-builder": "1.0.3",