nuxt-i18n-micro 1.38.5 → 1.40.0

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.
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CKJhJvrR.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CAvb8X3f.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BFMOhgGT.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1733427504762,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"a3b3daef-9807-4654-8b36-3ef9596ccdda",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1734506141780,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"4316af1d-27df-4ab9-b027-2c99cf42eaf5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CKJhJvrR.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CAvb8X3f.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BFMOhgGT.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1733427504762,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"a3b3daef-9807-4654-8b36-3ef9596ccdda",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1734506141781,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"4316af1d-27df-4ab9-b027-2c99cf42eaf5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1 +1 @@
1
- {"id":"a3b3daef-9807-4654-8b36-3ef9596ccdda","timestamp":1733427495145}
1
+ {"id":"4316af1d-27df-4ab9-b027-2c99cf42eaf5","timestamp":1734506134944}
@@ -0,0 +1 @@
1
+ {"id":"4316af1d-27df-4ab9-b027-2c99cf42eaf5","timestamp":1734506134944,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -8,5 +8,5 @@
8
8
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CKJhJvrR.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CAvb8X3f.css">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BFMOhgGT.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1733427504763,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"a3b3daef-9807-4654-8b36-3ef9596ccdda",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/D9PvWz4w.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1734506141781,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"4316af1d-27df-4ab9-b027-2c99cf42eaf5",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -45,6 +45,7 @@ interface ModuleOptionsExtend extends ModuleOptions {
45
45
  hashMode: boolean;
46
46
  isSSG: boolean;
47
47
  apiBaseUrl: string;
48
+ disablePageLocales: boolean;
48
49
  }
49
50
  interface ModulePrivateOptionsExtend extends ModuleOptions {
50
51
  rootDir: string;
package/dist/module.d.ts CHANGED
@@ -45,6 +45,7 @@ interface ModuleOptionsExtend extends ModuleOptions {
45
45
  hashMode: boolean;
46
46
  isSSG: boolean;
47
47
  apiBaseUrl: string;
48
+ disablePageLocales: boolean;
48
49
  }
49
50
  interface ModulePrivateOptionsExtend extends ModuleOptions {
50
51
  rootDir: string;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
3
  "configKey": "i18n",
4
- "version": "1.38.5",
4
+ "version": "1.40.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -503,7 +503,8 @@ const module = defineNuxtModule({
503
503
  globalLocaleRoutes: void 0,
504
504
  apiBaseUrl,
505
505
  isSSG,
506
- customRegexMatcher: options.customRegexMatcher
506
+ customRegexMatcher: options.customRegexMatcher,
507
+ disablePageLocales: options.disablePageLocales ?? false
507
508
  };
508
509
  if (typeof options.customRegexMatcher !== "undefined") {
509
510
  const localeCodes = localeManager.locales.map((l) => l.code);
@@ -1,9 +1,20 @@
1
1
  <template>
2
+ <a
3
+ v-if="isExternalLink"
4
+ :href="externalHref"
5
+ :style="computedStyle"
6
+ target="_blank"
7
+ rel="noopener noreferrer"
8
+ >
9
+ <slot />
10
+ </a>
11
+
2
12
  <NuxtLink
13
+ v-else
3
14
  :to="$localeRoute(to)"
4
- :style="activeStyle"
15
+ :style="computedStyle"
5
16
  >
6
- <slot>Go to Page</slot>
17
+ <slot />
7
18
  </NuxtLink>
8
19
  </template>
9
20
 
@@ -17,13 +28,33 @@ const { $localeRoute } = useNuxtApp()
17
28
 
18
29
  interface Props {
19
30
  to: RouteLocationRaw | string
20
- activeStyle?: Partial<CSSStyleDeclaration>
31
+ activeStyle?: Partial<CSSStyleValue>
21
32
  }
22
33
 
23
34
  const props = defineProps<Props>()
24
35
  const route = useRoute()
25
36
 
37
+ const isExternalLink = computed(() => {
38
+ if (typeof props.to === 'string') {
39
+ return /^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})/.test(props.to)
40
+ }
41
+ return false
42
+ })
43
+
44
+ const externalHref = computed(() => {
45
+ if (isExternalLink.value && typeof props.to === 'string') {
46
+ if (!/^https?:\/\//.test(props.to)) {
47
+ return `https://${props.to}`
48
+ }
49
+ return props.to
50
+ }
51
+ return undefined
52
+ })
53
+
26
54
  const isActive = computed(() => {
55
+ if (isExternalLink.value) {
56
+ return false
57
+ }
27
58
  // If `to` is a string, compare it directly to the route path
28
59
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
29
60
  // @ts-ignore
@@ -35,13 +66,9 @@ const isActive = computed(() => {
35
66
  return route.path === newPath.path
36
67
  })
37
68
 
38
- // Define the active styles
39
- const activeStyle = computed(() => {
69
+ const computedStyle = computed((): Partial<CSSStyleValue> => {
40
70
  return isActive.value
41
- ? {
42
- fontWeight: 'bold',
43
- ...props.activeStyle, // Merge with any custom active styles passed as props
44
- }
71
+ ? { ...props.activeStyle }
45
72
  : {}
46
73
  })
47
74
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.38.5",
3
+ "version": "1.40.0",
4
4
  "description": "Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.",
5
5
  "repository": "s00d/nuxt-i18n-micro",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  "chokidar": "^3.6.0",
46
46
  "sirv": "^2.0.4",
47
47
  "ufo": "^1.5.4",
48
- "nuxt-i18n-micro-core": "1.0.10",
49
- "nuxt-i18n-micro-test-utils": "1.0.3"
48
+ "nuxt-i18n-micro-test-utils": "1.0.3",
49
+ "nuxt-i18n-micro-core": "1.0.10"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/jest": "^29.5.14",
@@ -1 +0,0 @@
1
- {"id":"a3b3daef-9807-4654-8b36-3ef9596ccdda","timestamp":1733427495145,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}