feat(utils): move generateEmail to user-accessible utils

- Moved generateEmail from test-utils to utils folder
- Added './utils' export to package.json for public access
- Users can now import from 'better-auth/utils'
- Test-utils re-exports from the new location for backwards compat

This allows users to use generateEmail when they need to generate
temporary emails (e.g., similar to anonymous plugin's needs).

Co-authored-by: taesu <taesu@better-auth.com>
This commit is contained in:
Cursor Agent
2026-01-24 21:39:14 +00:00
parent d71de4ab80
commit 4587a42769
5 changed files with 8 additions and 2 deletions

View File

@@ -115,6 +115,11 @@
"types": "./dist/db/index.d.mts",
"default": "./dist/db/index.mjs"
},
"./utils": {
"dev-source": "./src/utils/index.ts",
"types": "./dist/utils/index.d.mts",
"default": "./dist/utils/index.mjs"
},
"./vue": {
"dev-source": "./src/client/vue/index.ts",
"types": "./dist/client/vue/index.d.mts",

View File

@@ -1,3 +1,3 @@
export { type GenerateEmailOptions, generateEmail } from "./email";
export { type GenerateEmailOptions, generateEmail } from "../utils/email";
export { convertSetCookieToCookie } from "./headers";
export { getTestInstance } from "./test-instance";

View File

@@ -16,7 +16,7 @@ import { bearer } from "../plugins";
import type { Session, User } from "../types";
import { getBaseURL } from "../utils/url";
export { type GenerateEmailOptions, generateEmail } from "./email";
export { type GenerateEmailOptions, generateEmail } from "../utils/email";
const cleanupSet = new Set<Function>();

View File

@@ -1,4 +1,5 @@
export * from "../oauth2/state";
export type { StateData } from "../state";
export { generateGenericState, parseGenericState } from "../state";
export * from "./email";
export * from "./hide-metadata";