@merkaly/nuxt 0.10.4 → 0.10.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/README.md CHANGED
@@ -71,7 +71,9 @@ export default defineNuxtConfig({
71
71
  ```
72
72
 
73
73
  The sitemap is only installed for indexable apps and is served at `/sitemap.xml`
74
- (linked from `robots.txt`).
74
+ (linked from `robots.txt`), a single file for every locale. The `x-default`
75
+ alternate points to `merkaly.i18n.defaultLocale`; the sitemap is installed after
76
+ `@nuxtjs/i18n` so it reads those options.
75
77
 
76
78
  ## Money formatting
77
79
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.14.0"
6
6
  },
7
- "version": "0.10.4",
7
+ "version": "0.10.5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, useLogger, createResolver, installModule, addPlugin, addServerHandler, addRouteMiddleware, addImportsDir, addComponentsDir, addTypeTemplate, addTemplate } from '@nuxt/kit';
1
+ import { defineNuxtModule, useLogger, createResolver, addPlugin, addServerHandler, addRouteMiddleware, addImportsDir, addComponentsDir, addTypeTemplate, addTemplate } from '@nuxt/kit';
2
2
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
3
3
  import { resolve, dirname } from 'node:path';
4
4
  import { defu } from 'defu';
@@ -87,6 +87,12 @@ function buildModuleDependencies(nuxt, options) {
87
87
  dependencies["@nuxtjs/robots"] = {
88
88
  overrides: { disallow: options.seo?.disallow ?? [] }
89
89
  };
90
+ if (options.seo?.indexable && options.seo.sitemap) {
91
+ dependencies["@nuxtjs/sitemap"] = {
92
+ // listed after i18n so it installs later and reads its options
93
+ overrides: configureSitemap(options)
94
+ };
95
+ }
90
96
  const logger = useLogger(MODULE_NAME);
91
97
  Object.keys(dependencies).forEach((dependency) => {
92
98
  logger.info(`Loaded ${dependency} module`);
@@ -134,6 +140,8 @@ function configureI18n(nuxt, options) {
134
140
  // absolute hreflang and canonical links
135
141
  defaultLocale: options.i18n.defaultLocale,
136
142
  detectBrowserLanguage: { useCookie: true },
143
+ locales: options.i18n.locales.map((locale) => ({ code: locale.code, language: locale.language })),
144
+ // for modules reading i18n options (sitemap); i18n loads them from the hook
137
145
  restructureDir: ".",
138
146
  strategy: options.i18n.strategy ?? "no_prefix",
139
147
  vueI18n
@@ -163,7 +171,9 @@ function configureSitemap(options) {
163
171
  })),
164
172
  strategy: options.i18n.strategy
165
173
  },
166
- exclude
174
+ exclude,
175
+ sitemaps: false
176
+ // a single /sitemap.xml with hreflang, not one sitemap per locale
167
177
  };
168
178
  }
169
179
  function configureRuntimeConfig(nuxt, options) {
@@ -318,10 +328,6 @@ const module$1 = defineNuxtModule({
318
328
  const resolver = createResolver(import.meta.url);
319
329
  configureNuxtOptions(nuxt, options);
320
330
  await configureExternalIntegrations(nuxt, logger);
321
- if (options.seo?.indexable && options.seo.sitemap) {
322
- await installModule("@nuxtjs/sitemap", configureSitemap(options));
323
- logger.info("Loaded @nuxtjs/sitemap module");
324
- }
325
331
  registerRuntimeFeatures(options, resolver);
326
332
  }
327
333
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkaly/nuxt",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/merkaly-io/nuxt.git"