better-auth-nuxt 0.0.4 → 0.0.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.d.mts CHANGED
@@ -6,7 +6,6 @@ interface ModuleServerOptions extends Pick<BetterAuthOptions, 'appName' | 'baseU
6
6
  interface ModuleClientOptions extends Pick<ClientOptions, 'baseURL' | 'basePath' | 'disableDefaultFetchPlugins'> {
7
7
  }
8
8
  interface ModuleOptions {
9
- baseUrl: string;
10
9
  /**
11
10
  * auth endpoint
12
11
  * @default 'api/auth/**'
@@ -24,11 +23,11 @@ interface ModuleOptions {
24
23
  /**
25
24
  * client options object or path to client setup script
26
25
  */
27
- client: ModuleClientOptions;
26
+ client?: ModuleClientOptions;
28
27
  /**
29
28
  * server options object or path to server setup script
30
29
  */
31
- server: ModuleServerOptions;
30
+ server?: ModuleServerOptions;
32
31
  };
33
32
  /**
34
33
  * redirect options
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "better-auth",
3
3
  "configKey": "betterAuth",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -14,6 +14,11 @@ async function serverAuth({ options }) {
14
14
  return `import ${config.key} from "${config.path}"`;
15
15
  }),
16
16
  "const betterAuthConfigs = mergeDeep({all: true})({},",
17
+ "{",
18
+ ...options.moduleOptions?.options?.server ? Object.entries(options.moduleOptions.options.server).map(([key, value]) => {
19
+ return ` ${key}: ${JSON.stringify(value)},`;
20
+ }) : [],
21
+ "},",
17
22
  ...options.configs.map((config) => {
18
23
  return `${config.key},`;
19
24
  }),
@@ -52,6 +57,9 @@ async function useUserSession({ options }) {
52
57
  "",
53
58
  " const authClient = createAuthClient({",
54
59
  " baseURL: url.origin,",
60
+ ...options.moduleOptions?.options?.client ? Object.entries(options.moduleOptions.options.client).map(([key, value]) => {
61
+ return ` ${key}: ${JSON.stringify(value)},`;
62
+ }) : [],
55
63
  " fetchOptions: {",
56
64
  ...options.configs.map((config) => {
57
65
  return ` ...${config.key}?.fetchOptions || {},`;
@@ -173,7 +181,6 @@ const module = defineNuxtModule({
173
181
  logger.withTag("better-auth").error("Missing endpoint option");
174
182
  }
175
183
  nuxt.options.runtimeConfig.public.betterAuth = defu(nuxt.options.runtimeConfig.public.betterAuth, {
176
- baseUrl: options.baseUrl,
177
184
  endpoint: options.endpoint,
178
185
  redirectOptions: options.redirectOptions
179
186
  });
@@ -233,7 +240,7 @@ const module = defineNuxtModule({
233
240
  const server = registerTemplate({
234
241
  filename: "better-auth/server.mjs",
235
242
  getContents: serverAuth,
236
- options: { configs: serverConfigs }
243
+ options: { configs: serverConfigs, moduleOptions: options }
237
244
  });
238
245
  addTypeTemplate({
239
246
  filename: "better-auth/server.d.ts",
@@ -284,7 +291,7 @@ const module = defineNuxtModule({
284
291
  const client = registerTemplate({
285
292
  filename: "better-auth/client.mjs",
286
293
  getContents: useUserSession,
287
- options: { configs: clientConfigs }
294
+ options: { configs: clientConfigs, moduleOptions: options }
288
295
  });
289
296
  addTypeTemplate({
290
297
  filename: "better-auth/client.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth-nuxt",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Better Auth Nuxt Module",
5
5
  "repository": "productdevbook/better-auth-nuxt",
6
6
  "license": "MIT",