nuxt-typed-router 4.0.2 โ†’ 4.0.3

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
@@ -16,6 +16,8 @@
16
16
  [![npm downloads][npm-total-downloads-src]][npm-downloads-href]
17
17
  <img src='https://img.shields.io/npm/l/nuxt-typed-router.svg'>
18
18
 
19
+ <a href="https://www.buymeacoffee.com/victorgarco"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a beer&emoji=๐Ÿบ&slug=victorgarco&button_colour=FFDD00&font_colour=000000&font_family=Bree&outline_colour=000000&coffee_colour=ffffff" /></a>
20
+
19
21
 
20
22
  ## Provide a type safe router to Nuxt
21
23
 
@@ -60,6 +62,7 @@ Demo repo ๐Ÿงช : [nuxt-typed-router-demo](https://github.com/victorgarciaesgi/nu
60
62
  ## Compatibility:
61
63
 
62
64
  - Nuxt 3
65
+ - Nuxt 4
63
66
 
64
67
 
65
68
  ## Install
package/dist/module.json CHANGED
@@ -2,12 +2,11 @@
2
2
  "name": "nuxt-typed-router",
3
3
  "configKey": "nuxtTypedRouter",
4
4
  "compatibility": {
5
- "nuxt": ">=3.0.0",
6
- "bridge": false
5
+ "nuxt": ">=3.0.0 || >= 4.0.0"
7
6
  },
8
- "version": "4.0.2",
7
+ "version": "4.0.3",
9
8
  "builder": {
10
- "@nuxt/module-builder": "1.0.1",
9
+ "@nuxt/module-builder": "1.0.2",
11
10
  "unbuild": "unknown"
12
11
  }
13
12
  }
package/dist/module.mjs CHANGED
@@ -371,16 +371,19 @@ function createTypedRouterFile() {
371
371
  // - Routes location for navigation types (ex: router.push or navigateTo)
372
372
 
373
373
 
374
- export type NuxtRoute<T extends RoutesNamesList, P extends string, E extends boolean = false> =
374
+ export type NuxtRoute<
375
+ const T extends RoutesNamesList,
376
+ const P extends string,
377
+ TExternal extends boolean> =
375
378
  | TypedRouteLocationRawFromName<T, P>
376
379
  ${returnIfTrue(!pathCheck && !strictOptions.NuxtLink.strictToArgument, ` | string`)}
377
380
  ${returnIfTrue(
378
381
  pathCheck && strictOptions.NuxtLink.strictToArgument,
379
- ` | (E extends true ? string : never)`
382
+ ` | (TExternal extends true ? string : never)`
380
383
  )}
381
384
  ${returnIfTrue(
382
385
  pathCheck && !strictOptions.NuxtLink.strictToArgument,
383
- ` | (E extends true ? string : TypedPathParameter<P>)`
386
+ ` | (TExternal extends true ? string : TypedPathParameter<P>)`
384
387
  )}
385
388
 
386
389
  /**
@@ -543,16 +546,15 @@ function createTypedRouterDefinitionFile() {
543
546
  /* typescript */
544
547
  `
545
548
 
546
- import type { NuxtLinkProps, PageMeta, NuxtApp } from 'nuxt/app';
547
- import NuxtLink from 'nuxt/dist/app/components/nuxt-link';
548
- import type { RouteLocationRaw, RouteLocationPathRaw, RouteLocation, RouterLinkProps, UseLinkReturn } from 'vue-router';
549
- import type { RoutesNamedLocations, RoutesNamesListRecord, RoutesNamesList } from './__routes';
550
- import type {TypedRouter, TypedRoute, TypedRouteLocationRawFromName, TypedLocationAsRelativeRaw, NuxtRoute} from './__router';
549
+ import type { NuxtApp, NuxtLinkProps } from 'nuxt/app';
550
+ import type { RouteLocation, UseLinkReturn } from 'vue-router';
551
+ import type { RoutesNamesListRecord, RoutesNamesList } from './__routes';
552
+ import type {TypedRouter, TypedRoute, NuxtRoute} from './__router';
551
553
  import { useRoute as _useRoute } from './__useTypedRoute';
552
554
  import { useRouter as _useRouter } from './__useTypedRouter';
553
555
  import { useLink as _useLink } from './__useTypedLink';
554
556
  import { navigateTo as _navigateTo } from './__navigateTo';
555
- import type { DefineSetupFnComponent, SlotsType, UnwrapRef, VNode } from 'vue';
557
+ import type { AllowedComponentProps, AnchorHTMLAttributes, DefineSetupFnComponent, SlotsType, UnwrapRef, VNode, VNodeProps } from 'vue';
556
558
 
557
559
  ${returnIfTrue(
558
560
  i18n,
@@ -591,13 +593,13 @@ function createTypedRouterDefinitionFile() {
591
593
 
592
594
  type TypedNuxtLinkProps<
593
595
  T extends RoutesNamesList,
594
- P extends string,
595
- E extends boolean = false,
596
- CustomProp extends boolean = false> = Omit<NuxtLinkProps<CustomProp>, 'to' | 'external'> &
597
- {
598
- to: NuxtRoute<T, P, E>,
599
- external?: E
600
- }
596
+ const P extends string,
597
+ TExternal extends boolean,
598
+ CustomProp extends boolean = false,
599
+ > = Omit<NuxtLinkProps<CustomProp>, 'to' | 'external'> & {
600
+ external?: TExternal;
601
+ to: NuxtRoute<T, P, TExternal>;
602
+ };
601
603
 
602
604
  type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp extends true ? {
603
605
  href: string;
@@ -619,7 +621,20 @@ function createTypedRouterDefinitionFile() {
619
621
 
620
622
 
621
623
 
622
- export type TypedNuxtLink = (new <T extends RoutesNamesList, P extends string, E extends boolean = false, CustomProp extends boolean = false>(props: TypedNuxtLinkProps<T, P, E, CustomProp>) => InstanceType<DefineSetupFnComponent<TypedNuxtLinkProps<T, P, E, CustomProp>, [], SlotsType<NuxtLinkSlots<CustomProp>>>>) & Record<string, any>
624
+ export type TypedNuxtLink = new <
625
+ const T extends RoutesNamesList,
626
+ const P extends string,
627
+ CustomProp extends boolean,
628
+ TExternal extends boolean = false,
629
+ >(
630
+ props: TypedNuxtLinkProps<T, P, TExternal, CustomProp>
631
+ ) => InstanceType<
632
+ DefineSetupFnComponent<
633
+ TypedNuxtLinkProps<T, P, NoInfer<TExternal>, CustomProp>,
634
+ [],
635
+ SlotsType<NuxtLinkSlots<CustomProp>>
636
+ >
637
+ >;
623
638
 
624
639
  declare module 'vue' {
625
640
  interface GlobalComponents {
@@ -637,7 +652,7 @@ function createTypedRouterDefinitionFile() {
637
652
  $typedRoute: TypedRoute,
638
653
  $routesNames: RoutesNamesListRecord
639
654
  }
640
- declare module '#app' {
655
+ declare module 'nuxt/app' {
641
656
  interface NuxtApp extends CustomPluginProperties {}
642
657
  }
643
658
  declare module 'vue' {
@@ -1809,11 +1824,11 @@ async function removeNuxtDefinitions({
1809
1824
  }
1810
1825
  }
1811
1826
 
1812
- const module = defineNuxtModule({
1827
+ const module$1 = defineNuxtModule({
1813
1828
  meta: {
1814
1829
  name: "nuxt-typed-router",
1815
1830
  configKey: "nuxtTypedRouter",
1816
- compatibility: { nuxt: ">=3.0.0", bridge: false }
1831
+ compatibility: { nuxt: ">=3.0.0 || >= 4.0.0" }
1817
1832
  },
1818
1833
  defaults: {
1819
1834
  plugin: false,
@@ -1825,7 +1840,6 @@ const module = defineNuxtModule({
1825
1840
  },
1826
1841
  setup(moduleOptions, nuxt) {
1827
1842
  const { resolve } = createResolver(import.meta.url);
1828
- const rootDir = nuxt.options.rootDir;
1829
1843
  let i18nOptions = null;
1830
1844
  const hasi18nModuleRegistered = nuxt.options.modules.some((mod) => {
1831
1845
  if (Array.isArray(mod)) {
@@ -1858,7 +1872,7 @@ const module = defineNuxtModule({
1858
1872
  });
1859
1873
  nuxt.options.alias = {
1860
1874
  ...nuxt.options.alias,
1861
- "@typed-router": resolve(`${rootDir}/.nuxt/typed-router`)
1875
+ "@typed-router": resolve(`${nuxt.options.buildDir}/typed-router`)
1862
1876
  };
1863
1877
  nuxt.hook("prepare:types", (options) => {
1864
1878
  options.tsConfig.include?.unshift("./typed-router/typed-router.d.ts");
@@ -1894,4 +1908,4 @@ const module = defineNuxtModule({
1894
1908
  }
1895
1909
  });
1896
1910
 
1897
- export { module as default };
1911
+ export { module$1 as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-typed-router",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
5
5
  "type": "module",
6
6
  "main": "./dist/module.mjs",
@@ -14,6 +14,10 @@
14
14
  "files": [
15
15
  "dist"
16
16
  ],
17
+ "packageManager": "pnpm@10.28.2",
18
+ "engines": {
19
+ "pnpm": ">=10.14.0"
20
+ },
17
21
  "scripts": {
18
22
  "prepack": "nuxt-module-build build",
19
23
  "dev": "nuxi dev playground",
@@ -63,53 +67,54 @@
63
67
  "prettier": "^2.5.x || 3.x"
64
68
  },
65
69
  "dependencies": {
66
- "@nuxt/kit": "3.17.5",
67
- "chalk": "5.4.1",
70
+ "@nuxt/kit": "catalog:",
71
+ "better-sqlite3": "^12.6.2",
72
+ "chalk": "5.6.2",
68
73
  "defu": "6.1.4",
69
- "lodash-es": "4.17.21",
74
+ "lodash-es": "4.17.23",
70
75
  "log-symbols": "7.0.1",
71
76
  "mkdirp": "3.0.1",
72
- "nanoid": "5.1.5",
77
+ "nanoid": "5.1.6",
73
78
  "pathe": "2.0.3",
74
- "prettier": "3.5.3"
79
+ "prettier": "catalog:"
75
80
  },
76
81
  "devDependencies": {
77
- "@intlify/core-base": "11.1.5",
78
- "@intlify/message-compiler": "11.1.5",
79
- "@intlify/shared": "11.1.5",
80
- "@intlify/vue-i18n-bridge": "1.1.0",
81
- "@intlify/vue-router-bridge": "1.1.0",
82
- "@nuxt/content": "2.13.4",
83
- "@nuxt/devtools": "2.5.0",
84
- "@nuxt/module-builder": "1.0.1",
85
- "@nuxt/schema": "3.17.5",
86
- "@nuxt/test-utils": "3.19.1",
82
+ "@intlify/core-base": "catalog:",
83
+ "@intlify/message-compiler": "catalog:",
84
+ "@intlify/shared": "catalog:",
85
+ "@intlify/vue-i18n-bridge": "catalog:",
86
+ "@intlify/vue-router-bridge": "catalog:",
87
+ "@nuxt/content": "catalog:",
88
+ "@nuxt/devtools": "3.1.1",
89
+ "@nuxt/module-builder": "1.0.2",
90
+ "@nuxt/schema": "catalog:",
91
+ "@nuxt/test-utils": "catalog:",
87
92
  "@nuxt/types": "2.18.1",
88
93
  "@nuxtjs/eslint-config-typescript": "12.1.0",
89
- "@nuxtjs/i18n": "9.5.5",
94
+ "@nuxtjs/i18n": "catalog:",
90
95
  "@nuxtjs/web-vitals": "0.2.7",
91
- "@playwright/test": "1.52.0",
92
- "@types/lodash-es": "4.17.12",
93
- "@types/node": "22.15.29",
94
- "@typescript-eslint/eslint-plugin": "8.33.1",
95
- "@typescript-eslint/parser": "8.33.1",
96
- "@vue/test-utils": "2.4.6",
97
- "bumpp": "10.1.1",
98
- "changelogithub": "13.15.0",
99
- "cross-env": "7.0.3",
96
+ "@playwright/test": "catalog:",
97
+ "@types/lodash-es": "catalog:",
98
+ "@types/node": "catalog:",
99
+ "@typescript-eslint/eslint-plugin": "8.55.0",
100
+ "@typescript-eslint/parser": "8.55.0",
101
+ "@vue/test-utils": "catalog:",
102
+ "bumpp": "10.4.1",
103
+ "changelogithub": "14.0.0",
104
+ "cross-env": "10.1.0",
100
105
  "eslint": "9.28.0",
101
106
  "eslint-config-prettier": "10.1.5",
102
107
  "eslint-plugin-vue": "10.1.0",
103
- "nuxt": "3.17.5",
108
+ "nuxt": "catalog:",
104
109
  "nuxt-seo-kit": "1.3.13",
105
- "playwright": "1.52.0",
110
+ "playwright": "catalog:",
106
111
  "tsd": "0.32.0",
107
- "typescript": "5.8.3",
108
- "vitest": "3.2.1",
109
- "vue": "3.5.16",
110
- "vue-eslint-parser": "10.1.3",
111
- "vue-i18n": "11.1.5",
112
- "vue-router": "4.5.1",
113
- "vue-tsc": "2.2.10"
112
+ "typescript": "catalog:",
113
+ "vitest": "catalog:",
114
+ "vue": "catalog:",
115
+ "vue-eslint-parser": "catalog:",
116
+ "vue-i18n": "catalog:",
117
+ "vue-router": "catalog:",
118
+ "vue-tsc": "catalog:"
114
119
  }
115
- }
120
+ }