nuxt-generation-emails 1.4.3 → 1.4.4

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/README.md CHANGED
@@ -284,6 +284,9 @@ The `components/` directory is reserved — it is skipped during route generatio
284
284
  |----------------------------|-------------------------------|-------------------------------|
285
285
  | `emails/welcome.vue` | `/__emails/welcome` | `POST /api/emails/welcome` |
286
286
  | `emails/v1/order.vue` | `/__emails/v1/order` | `POST /api/emails/v1/order` |
287
+ | `emails/v1/order/index.vue` | `/__emails/v1/order/index` | `POST /api/emails/v1/order` |
288
+
289
+ For API endpoints, nested `index.vue` files are treated as directory index routes, so the trailing `/index` is removed. Root-level `emails/index.vue` keeps the existing endpoint: `POST /api/emails/index`.
287
290
 
288
291
  ---
289
292
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "1.4.3",
7
+ "version": "1.4.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -762,6 +762,13 @@ function sanitizeForOpenApi(value) {
762
762
  }
763
763
  return value;
764
764
  }
765
+ function normalizeApiEmailPath(routePrefix, emailName) {
766
+ const rawPath = `${routePrefix}/${emailName}`.replace(/^\//, "");
767
+ if (emailName === "index" && routePrefix) {
768
+ return routePrefix.replace(/^\//, "");
769
+ }
770
+ return rawPath;
771
+ }
765
772
  function generateServerRoutes(emailsDir, buildDir) {
766
773
  if (!fs.existsSync(emailsDir)) return [];
767
774
  const handlersDir = join(buildDir, "email-handlers");
@@ -781,7 +788,7 @@ function generateServerRoutes(emailsDir, buildDir) {
781
788
  processEmailDirectory(fullPath, `${routePrefix}/${entry}`);
782
789
  } else if (entry.endsWith(".vue")) {
783
790
  const emailName = entry.replace(".vue", "");
784
- const emailPath = `${routePrefix}/${emailName}`.replace(/^\//, "");
791
+ const emailPath = normalizeApiEmailPath(routePrefix, emailName);
785
792
  const mjmlTemplateName = extractMjmlTemplateName(fullPath);
786
793
  if (!mjmlTemplateName) {
787
794
  console.warn(`[nuxt-generation-emails] Could not find useNgeTemplate() call in ${emailName}.vue \u2014 skipping API route.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-generation-emails",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "A Nuxt module for authoring, previewing, and sending transactional email templates with MJML and Handlebars.",
5
5
  "author": "nullcarry@icloud.com",
6
6
  "repository": {