@nuxtjs/better-auth 0.3.12 → 0.3.13

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxtjs/better-auth",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "configKey": "auth",
5
5
  "compatibility": {
6
6
  "nuxt": ">=4.0.0"
package/dist/module.mjs CHANGED
@@ -13,7 +13,7 @@ import { isCI, isTest } from 'std-env';
13
13
  import { isInternalAssetPath } from '../dist/runtime/internal/auth-route-rules.js';
14
14
  export { defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
15
15
 
16
- const version = "0.3.12";
16
+ const version = "0.3.13";
17
17
 
18
18
  const CONFIG_EXTENSIONS = [".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"];
19
19
  const CONFIG_EXTENSION_RE = /\.[cm]?[jt]s$/;
@@ -1916,7 +1916,7 @@ const module$1 = defineNuxtModule({
1916
1916
  const finishSetupOnce = () => {
1917
1917
  setupPromise ||= finishSetup().catch((error) => {
1918
1918
  if (error instanceof Diagnostic)
1919
- throw new Error(formatDiagnostic(error), { cause: error });
1919
+ throw new TypeError(formatDiagnostic(error), { cause: error });
1920
1920
  throw error;
1921
1921
  });
1922
1922
  return setupPromise;
@@ -78,10 +78,30 @@ export function toWebRequest(event) {
78
78
  headers: req?.headers ? Object.fromEntries(Object.entries(req.headers).flatMap(([key, value]) => value === void 0 ? [] : [[key, Array.isArray(value) ? value.join(", ") : value]])) : void 0,
79
79
  duplex: "half"
80
80
  };
81
- if (req?.method !== "GET" && req?.method !== "HEAD")
82
- init.body = req;
81
+ if (req && req.method !== "GET" && req.method !== "HEAD")
82
+ init.body = requestBody(req);
83
83
  return new Request(getRequestURL(event), init);
84
84
  }
85
+ const h3RawBody = Symbol.for("h3RawBody");
86
+ function requestBody(req) {
87
+ const rawBody = req[h3RawBody];
88
+ if (rawBody) {
89
+ return new ReadableStream({
90
+ async start(controller) {
91
+ const bytes = await rawBody;
92
+ if (bytes?.length)
93
+ controller.enqueue(bytes);
94
+ controller.close();
95
+ }
96
+ });
97
+ }
98
+ const body = req.rawBody ?? req.body;
99
+ if (body === void 0 || body === null)
100
+ return "__unenv__" in req ? void 0 : req;
101
+ if (body.constructor === Object)
102
+ return JSON.stringify(body);
103
+ return body;
104
+ }
85
105
  export async function readBody(event) {
86
106
  const request = toWebRequest(event);
87
107
  const contentType = request.headers.get("content-type") || "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/better-auth",
3
3
  "type": "module",
4
- "version": "0.3.12",
4
+ "version": "0.3.13",
5
5
  "description": "Nuxt module for Better Auth integration with NuxtHub, route protection, session management, and role-based access",
6
6
  "author": "onmax",
7
7
  "license": "MIT",
@@ -93,17 +93,18 @@
93
93
  "zod": "^4.4.3"
94
94
  },
95
95
  "devDependencies": {
96
- "@antfu/eslint-config": "^9.3.0",
96
+ "@antfu/eslint-config": "^10.0.0",
97
97
  "@libsql/client": "^0.18.0",
98
98
  "@libsql/linux-x64-gnu": "0.5.29",
99
99
  "@nuxt/devtools": "^3.4.1",
100
- "@nuxt/fonts": "1.0.1",
100
+ "@nuxt/fonts": "1.2.0",
101
101
  "@nuxt/module-builder": "^1.0.3",
102
102
  "@nuxt/schema": "^4.6.0",
103
103
  "@nuxt/test-utils": "^4.3.3",
104
104
  "@nuxthub/core": "^0.10.8",
105
105
  "@pinia/nuxt": "^1.0.2",
106
106
  "@types/better-sqlite3": "^9.6.0",
107
+ "@typescript/typescript6": "6.0.2",
107
108
  "@vue/test-utils": "^2.4.6",
108
109
  "auth": "1.7.12",
109
110
  "better-auth": "1.7.12",
@@ -116,15 +117,16 @@
116
117
  "nitropack": "2.13.5",
117
118
  "nuxt": "^4.6.0",
118
119
  "pinia": "^4.0.3",
119
- "pkg-pr-new": "0.0.91",
120
+ "pkg-pr-new": "0.0.92",
120
121
  "playwright-core": "1.64.1",
121
122
  "postgres": "^3.4.9",
122
- "typescript": "~5.9.3",
123
+ "typescript": "~7.0.0",
124
+ "typescript-next": "npm:typescript@~7.0.0",
123
125
  "unstorage": "^1.17.5",
124
126
  "vitest": "^5.0.0",
125
127
  "vue": "3.5.44",
126
128
  "vue-tsc": "^3.3.10",
127
- "wrangler": "4.151.3",
129
+ "wrangler": "4.152.0",
128
130
  "yaml": "^2.9.0"
129
131
  },
130
132
  "scripts": {
@@ -135,11 +137,11 @@
135
137
  "dev:docs": "nuxi dev docs",
136
138
  "build:docs": "nuxi build docs",
137
139
  "deploy": "wrangler deploy",
138
- "lint": "eslint .",
140
+ "lint": "NODE_OPTIONS='--import=./scripts/typescript6-shim.mjs --experimental-loader=./scripts/typescript6-shim.mjs' eslint .",
139
141
  "lint:fix": "eslint . --fix",
140
- "typecheck": "vue-tsc --noEmit",
141
- "typecheck:runtime-server": "cd test/cases/plugins-type-inference && nuxi prepare && vue-tsc --noEmit --pretty false -p .nuxt/tsconfig.server.json",
142
- "typecheck:playground": "pnpm -C playground exec nuxi prepare && pnpm -C playground exec vue-tsc --noEmit -p .nuxt/tsconfig.app.json",
142
+ "typecheck": "NODE_OPTIONS='--import=./scripts/typescript6-shim.mjs --experimental-loader=./scripts/typescript6-shim.mjs' vue-tsc --noEmit",
143
+ "typecheck:runtime-server": "cd test/cases/plugins-type-inference && NODE_OPTIONS='--import=../../../scripts/typescript6-shim.mjs --experimental-loader=../../../scripts/typescript6-shim.mjs' nuxi prepare && NODE_OPTIONS='--import=../../../scripts/typescript6-shim.mjs --experimental-loader=../../../scripts/typescript6-shim.mjs' vue-tsc --noEmit --pretty false -p .nuxt/tsconfig.server.json",
144
+ "typecheck:playground": "NODE_OPTIONS=\"--import=$PWD/scripts/typescript6-shim.mjs --experimental-loader=$PWD/scripts/typescript6-shim.mjs\" pnpm -C playground exec nuxi prepare && NODE_OPTIONS=\"--import=$PWD/scripts/typescript6-shim.mjs --experimental-loader=$PWD/scripts/typescript6-shim.mjs\" pnpm -C playground exec vue-tsc --noEmit -p .nuxt/tsconfig.app.json",
143
145
  "test": "vitest run",
144
146
  "test:watch": "vitest watch",
145
147
  "test:runtime": "vitest run --config vitest.runtime.config.ts"