nuxt-generation-emails 0.1.31 → 0.1.43
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 +8 -1
- package/dist/module.d.ts +8 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +21 -1
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
- package/dist/runtime/server/utils/send-gen-emails.d.ts +0 -8
- package/dist/runtime/server/utils/send-gen-emails.js +0 -8
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
+
/** Payload passed to the `nuxt-gen-emails:send` Nitro runtime hook. */
|
|
4
|
+
interface NuxtGenEmailsSendPayload {
|
|
5
|
+
/** The rendered HTML string of the email template. */
|
|
6
|
+
html: string;
|
|
7
|
+
/** Arbitrary data forwarded from the request body (e.g. `to`, `subject`). */
|
|
8
|
+
data: Record<string, unknown>;
|
|
9
|
+
}
|
|
3
10
|
interface ModuleOptions {
|
|
4
11
|
/** Directory containing email templates; resolved from srcDir when relative. */
|
|
5
12
|
emailDir?: string;
|
|
@@ -7,4 +14,4 @@ interface ModuleOptions {
|
|
|
7
14
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
8
15
|
|
|
9
16
|
export { _default as default };
|
|
10
|
-
export type { ModuleOptions };
|
|
17
|
+
export type { ModuleOptions, NuxtGenEmailsSendPayload };
|
package/dist/module.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
|
+
/** Payload passed to the `nuxt-gen-emails:send` Nitro runtime hook. */
|
|
4
|
+
interface NuxtGenEmailsSendPayload {
|
|
5
|
+
/** The rendered HTML string of the email template. */
|
|
6
|
+
html: string;
|
|
7
|
+
/** Arbitrary data forwarded from the request body (e.g. `to`, `subject`). */
|
|
8
|
+
data: Record<string, unknown>;
|
|
9
|
+
}
|
|
3
10
|
interface ModuleOptions {
|
|
4
11
|
/** Directory containing email templates; resolved from srcDir when relative. */
|
|
5
12
|
emailDir?: string;
|
|
@@ -7,4 +14,4 @@ interface ModuleOptions {
|
|
|
7
14
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
8
15
|
|
|
9
16
|
export { _default as default };
|
|
10
|
-
export type { ModuleOptions };
|
|
17
|
+
export type { ModuleOptions, NuxtGenEmailsSendPayload };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addImports, addServerImports, extendPages, addServerHandler } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addTypeTemplate, addImports, addServerImports, extendPages, addServerHandler } from '@nuxt/kit';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import vue from '@vitejs/plugin-vue';
|
|
4
4
|
import { join, relative } from 'pathe';
|
|
@@ -323,6 +323,26 @@ const module$1 = defineNuxtModule({
|
|
|
323
323
|
},
|
|
324
324
|
async setup(options, nuxt) {
|
|
325
325
|
const resolver = createResolver(import.meta.url);
|
|
326
|
+
addTypeTemplate({
|
|
327
|
+
filename: "types/nuxt-gen-emails-nitro.d.ts",
|
|
328
|
+
getContents: () => `
|
|
329
|
+
export interface NuxtGenEmailsSendPayload {
|
|
330
|
+
html: string
|
|
331
|
+
data: Record<string, unknown>
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare module 'nitropack' {
|
|
335
|
+
interface NitroRuntimeHooks {
|
|
336
|
+
'nuxt-gen-emails:send': (payload: NuxtGenEmailsSendPayload) => void | Promise<void>
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
declare module 'nitropack/types' {
|
|
340
|
+
interface NitroRuntimeHooks {
|
|
341
|
+
'nuxt-gen-emails:send': (payload: NuxtGenEmailsSendPayload) => void | Promise<void>
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
`
|
|
345
|
+
}, { nuxt: true, nitro: true });
|
|
326
346
|
const configuredEmailDir = options.emailDir ?? "emails";
|
|
327
347
|
const emailsDir = join(nuxt.options.srcDir, configuredEmailDir);
|
|
328
348
|
nuxt.options.runtimeConfig.nuxtGenEmails = {
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the sendGenEmails handler function from runtime config
|
|
3
|
-
* This allows users to provide a custom function for sending emails
|
|
4
|
-
* while keeping the logic decoupled from the API routes
|
|
5
|
-
*
|
|
6
|
-
* @returns The sendGenEmails function if provided, or null
|
|
7
|
-
*/
|
|
8
|
-
export declare function getSendGenEmailsHandler(): ((html: string, data: Record<string, unknown>) => Promise<void> | void) | null;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { useRuntimeConfig } from "#imports";
|
|
2
|
-
export function getSendGenEmailsHandler() {
|
|
3
|
-
const config = useRuntimeConfig();
|
|
4
|
-
if (config.nuxtGenEmails?.sendGenEmails && typeof config.nuxtGenEmails.sendGenEmails === "function") {
|
|
5
|
-
return config.nuxtGenEmails.sendGenEmails;
|
|
6
|
-
}
|
|
7
|
-
return null;
|
|
8
|
-
}
|