@sit-onyx/nuxt 1.0.0-beta.287 → 1.0.0-beta.289

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 CHANGED
@@ -11,20 +11,6 @@ interface ModuleOptions {
11
11
  * @see https://onyx.schwarz/development/#installation
12
12
  */
13
13
  disableGlobalStyles?: boolean;
14
- /**
15
- * Settings related to the integration with @nuxtjs/i18n
16
- */
17
- i18n?: {
18
- /**
19
- * Mapping for registering the translations from onyx with @nuxtjs/i18n.
20
- * @example
21
- * ```ts
22
- * registerLocales: { "en_US": "en-US" }
23
- * ```
24
- * This would register the onyx translations for the language "en-US" to the code "en_US" of your projects locales.
25
- */
26
- registerLocales?: Record<string, "en-US" | "de-DE" | "ko-KR">;
27
- };
28
14
  }
29
15
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
30
16
 
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt",
3
3
  "configKey": "onyx",
4
- "version": "1.0.0-beta.286",
4
+ "version": "1.0.0-beta.288",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.1",
6
+ "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { defineNuxtModule, useLogger, createResolver, addComponent, addPlugin } from '@nuxt/kit';
2
+ import { stat } from 'node:fs/promises';
2
3
  import * as onyx from 'sit-onyx';
3
4
 
4
5
  const module = defineNuxtModule({
@@ -33,13 +34,23 @@ const module = defineNuxtModule({
33
34
  );
34
35
  }
35
36
  if (i18nModuleIndex >= 0) {
36
- const registerOnyxLocales = (register) => {
37
+ const registerOnyxLocales = async (register) => {
38
+ const onyxLocalesToRegister = {};
39
+ await Promise.allSettled(
40
+ nuxt.options.i18n?.locales?.map(async (projectLocale) => {
41
+ const locale = typeof projectLocale === "string" ? { code: projectLocale, language: projectLocale } : projectLocale;
42
+ const language = locale.language ?? locale.code;
43
+ await stat(resolve(`./runtime/locales/${language}.js`));
44
+ onyxLocalesToRegister[locale.code] = language;
45
+ }) ?? []
46
+ );
37
47
  register({
38
48
  langDir: resolve("./runtime/locales"),
39
49
  // we need to use .js files instead of .ts because the .ts files would be compiled to .js in the build step, so
40
50
  // when projects use this nuxt module, .ts files will throw a "can not find file" error
41
- locales: Object.entries(options.i18n?.registerLocales ?? {}).map(([code, language]) => ({
51
+ locales: Object.entries(onyxLocalesToRegister).map(([code, language]) => ({
42
52
  code,
53
+ language,
43
54
  file: `${language}.js`
44
55
  }))
45
56
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt",
3
- "version": "1.0.0-beta.287",
3
+ "version": "1.0.0-beta.289",
4
4
  "description": "A Nuxt module to easily integrate onyx into Nuxt projects",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
@@ -29,18 +29,18 @@
29
29
  ],
30
30
  "devDependencies": {
31
31
  "@nuxt/devtools": "^2.6.2",
32
- "@nuxt/kit": "^4.0.1",
33
- "@nuxt/module-builder": "^1.0.1",
34
- "@nuxt/schema": "^4.0.1",
32
+ "@nuxt/kit": "^4.0.3",
33
+ "@nuxt/module-builder": "^1.0.2",
34
+ "@nuxt/schema": "^4.0.3",
35
35
  "@nuxt/test-utils": "^3.19.2",
36
36
  "@nuxtjs/i18n": "^10.0.3",
37
- "nuxt": "^4.0.1",
38
- "typescript": "5.8.3",
37
+ "nuxt": "^4.0.3",
38
+ "typescript": "5.9.2",
39
39
  "vue-i18n": "^11.1.11",
40
- "sit-onyx": "^1.0.0-beta.286"
40
+ "sit-onyx": "^1.0.0-beta.288"
41
41
  },
42
42
  "peerDependencies": {
43
- "sit-onyx": "^1.0.0-beta.286"
43
+ "sit-onyx": "^1.0.0-beta.288"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "nuxi dev playground",