@merkaly/nuxt 0.10.3 → 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 +3 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -6
- package/dist/runtime/components/app.vue +4 -2
- package/package.json +1 -1
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
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, useLogger, createResolver,
|
|
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`);
|
|
@@ -130,8 +136,12 @@ function configureI18n(nuxt, options) {
|
|
|
130
136
|
});
|
|
131
137
|
});
|
|
132
138
|
return {
|
|
139
|
+
baseUrl: options.seo?.url || void 0,
|
|
140
|
+
// absolute hreflang and canonical links
|
|
133
141
|
defaultLocale: options.i18n.defaultLocale,
|
|
134
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
|
|
135
145
|
restructureDir: ".",
|
|
136
146
|
strategy: options.i18n.strategy ?? "no_prefix",
|
|
137
147
|
vueI18n
|
|
@@ -161,7 +171,9 @@ function configureSitemap(options) {
|
|
|
161
171
|
})),
|
|
162
172
|
strategy: options.i18n.strategy
|
|
163
173
|
},
|
|
164
|
-
exclude
|
|
174
|
+
exclude,
|
|
175
|
+
sitemaps: false
|
|
176
|
+
// a single /sitemap.xml with hreflang, not one sitemap per locale
|
|
165
177
|
};
|
|
166
178
|
}
|
|
167
179
|
function configureRuntimeConfig(nuxt, options) {
|
|
@@ -316,10 +328,6 @@ const module$1 = defineNuxtModule({
|
|
|
316
328
|
const resolver = createResolver(import.meta.url);
|
|
317
329
|
configureNuxtOptions(nuxt, options);
|
|
318
330
|
await configureExternalIntegrations(nuxt, logger);
|
|
319
|
-
if (options.seo?.indexable && options.seo.sitemap) {
|
|
320
|
-
await installModule("@nuxtjs/sitemap", configureSitemap(options));
|
|
321
|
-
logger.info("Loaded @nuxtjs/sitemap module");
|
|
322
|
-
}
|
|
323
331
|
registerRuntimeFeatures(options, resolver);
|
|
324
332
|
}
|
|
325
333
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useRoute } from "#app";
|
|
3
3
|
import { computed } from "vue";
|
|
4
|
-
import { useAuth, useTenant, watchOnce, addRouteMiddleware, useNuxtApp } from "#imports";
|
|
4
|
+
import { useAuth, useTenant, watchOnce, addRouteMiddleware, useNuxtApp, useRuntimeConfig } from "#imports";
|
|
5
5
|
import AuthMiddleware from "../middleware/auth";
|
|
6
6
|
import { useNavigation } from "../composables/useNavigation";
|
|
7
7
|
import AuthError from "./auth/AuthError.vue";
|
|
@@ -11,8 +11,10 @@ const $route = useRoute();
|
|
|
11
11
|
const { clear, error, isLoading, logout, retry } = useAuth();
|
|
12
12
|
const { fromServer } = useTenant();
|
|
13
13
|
const { hook } = useNuxtApp();
|
|
14
|
+
const { public: { merkaly } } = useRuntimeConfig();
|
|
14
15
|
useColorMode({ attribute: "data-bs-theme" });
|
|
15
|
-
const
|
|
16
|
+
const waitsForAuth = merkaly.auth0.requiresAuth || merkaly.auth0.requiresTenant;
|
|
17
|
+
const blocking = computed(() => waitsForAuth && isLoading.value && !fromServer.value);
|
|
16
18
|
watchOnce(isLoading, () => AuthMiddleware($route, $route));
|
|
17
19
|
const { defer, regenerate } = useNavigation();
|
|
18
20
|
addRouteMiddleware("navigation", (to) => defer(to), { global: true });
|