@nuxtjs/better-auth 0.3.4 → 0.3.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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -10,9 +10,10 @@ import { defu } from 'defu';
|
|
|
10
10
|
import { toRouteMatcher, createRouter } from 'radix3';
|
|
11
11
|
import { randomBytes } from 'node:crypto';
|
|
12
12
|
import { isCI, isTest } from 'std-env';
|
|
13
|
+
import { isInternalAssetPath } from '../dist/runtime/internal/auth-route-rules.js';
|
|
13
14
|
export { defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
|
|
14
15
|
|
|
15
|
-
const version = "0.3.
|
|
16
|
+
const version = "0.3.5";
|
|
16
17
|
|
|
17
18
|
const CONFIG_EXTENSIONS = [".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"];
|
|
18
19
|
const CONFIG_EXTENSION_RE = /\.[cm]?[jt]s$/;
|
|
@@ -991,6 +992,8 @@ function assertSafeAuthRouteRules(routeRules) {
|
|
|
991
992
|
for (const path of collectRouteRulePaths(patterns, ""))
|
|
992
993
|
paths.add(path);
|
|
993
994
|
const conflicts = [...paths].flatMap((path) => {
|
|
995
|
+
if (isInternalAssetPath(path))
|
|
996
|
+
return [];
|
|
994
997
|
const matches = matcher.matchAll(path);
|
|
995
998
|
const effectiveRule = defu({}, ...matches.reverse());
|
|
996
999
|
if (effectiveRule.auth === void 0 || effectiveRule.auth === false)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthRouteRules } from '../types.js';
|
|
2
|
+
export declare function isInternalAssetPath(path: string): boolean;
|
|
2
3
|
export declare function normalizeAuthRoutePath(path: string, baseURL?: string): string;
|
|
3
4
|
export declare function normalizeAuthRouteRule(rule: unknown): AuthRouteRules['auth'];
|
|
4
5
|
export declare function shouldSkipAuthRouteRules(path: string): boolean;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { withoutBase } from "ufo";
|
|
2
|
+
const internalAssetPaths = ["/_fonts", "/_ipx", "/_nuxt", "/api/_nuxt_icon"];
|
|
3
|
+
export function isInternalAssetPath(path) {
|
|
4
|
+
const pathname = path.split(/[?#]/, 1)[0] || "/";
|
|
5
|
+
return internalAssetPaths.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));
|
|
6
|
+
}
|
|
2
7
|
const internalRouteRuleAuthPaths = /* @__PURE__ */ new Set([
|
|
3
|
-
"/_ipx",
|
|
4
|
-
"/_nuxt",
|
|
5
8
|
"/__better-auth-devtools",
|
|
6
9
|
"/__nuxt_devtools__",
|
|
7
10
|
"/__nuxt_error",
|
|
8
11
|
"/__nuxt_vite_node__",
|
|
9
12
|
"/api/_better-auth",
|
|
10
|
-
"/api/_nuxt_icon",
|
|
11
13
|
"/api/auth"
|
|
12
14
|
]);
|
|
13
15
|
const internalRouteRuleAuthPrefixes = [
|
|
14
|
-
"/_ipx/",
|
|
15
|
-
"/_nuxt/",
|
|
16
16
|
"/__nuxt_devtools__/",
|
|
17
17
|
"/__nuxt_vite_node__/",
|
|
18
18
|
"/api/_better-auth/",
|
|
19
|
-
"/api/_nuxt_icon/",
|
|
20
19
|
"/api/auth/"
|
|
21
20
|
];
|
|
22
21
|
export function normalizeAuthRoutePath(path, baseURL = "/") {
|
|
@@ -30,5 +29,5 @@ export function normalizeAuthRouteRule(rule) {
|
|
|
30
29
|
}
|
|
31
30
|
export function shouldSkipAuthRouteRules(path) {
|
|
32
31
|
const pathname = path.split(/[?#]/, 1)[0] || "/";
|
|
33
|
-
return internalRouteRuleAuthPaths.has(pathname) || internalRouteRuleAuthPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
32
|
+
return isInternalAssetPath(pathname) || internalRouteRuleAuthPaths.has(pathname) || internalRouteRuleAuthPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
34
33
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/better-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.5",
|
|
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",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"@libsql/client": "^0.17.4",
|
|
95
95
|
"@libsql/linux-x64-gnu": "0.5.29",
|
|
96
96
|
"@nuxt/devtools": "^3.4.1",
|
|
97
|
+
"@nuxt/fonts": "0.14.0",
|
|
97
98
|
"@nuxt/module-builder": "^1.0.3",
|
|
98
99
|
"@nuxt/schema": "^4.5.2",
|
|
99
100
|
"@nuxt/test-utils": "^4.1.0",
|