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 +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -1
- package/package.json +1 -1
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
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 =
|
|
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