nuxt-typed-router 3.7.2 → 3.8.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.
package/dist/module.d.mts CHANGED
@@ -35,6 +35,11 @@ interface ModuleOptions {
35
35
  * Ex: 404 routes or catchAll routes
36
36
  */
37
37
  ignoreRoutes?: string[];
38
+ /**
39
+ * Disable prettier formatter
40
+ * @default false
41
+ */
42
+ disablePrettier?: boolean;
38
43
  }
39
44
  interface StrictOptions {
40
45
  NuxtLink?: StrictParamsOptions;
package/dist/module.d.ts CHANGED
@@ -35,6 +35,11 @@ interface ModuleOptions {
35
35
  * Ex: 404 routes or catchAll routes
36
36
  */
37
37
  ignoreRoutes?: string[];
38
+ /**
39
+ * Disable prettier formatter
40
+ * @default false
41
+ */
42
+ disablePrettier?: boolean;
38
43
  }
39
44
  interface StrictOptions {
40
45
  NuxtLink?: StrictParamsOptions;
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3.0.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "3.7.2",
8
+ "version": "3.8.0",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -16,6 +16,7 @@ class ModuleOptionsStore {
16
16
  plugin = false;
17
17
  strict = false;
18
18
  pathCheck = true;
19
+ disablePrettier = false;
19
20
  autoImport = false;
20
21
  rootDir = "";
21
22
  buildDir = "";
@@ -545,15 +546,17 @@ function createTypedRouterDefinitionFile() {
545
546
  /* typescript */
546
547
  `
547
548
 
548
- import type { NuxtLinkProps, PageMeta } from 'nuxt/app';
549
+ import type { NuxtLinkProps, PageMeta, NuxtApp } from 'nuxt/app';
549
550
  import NuxtLink from 'nuxt/dist/app/components/nuxt-link';
550
- import type { RouteLocationRaw, RouteLocationPathRaw } from 'vue-router';
551
+ import type { RouteLocationRaw, RouteLocationPathRaw, RouteLocation, RouterLinkProps, UseLinkReturn } from 'vue-router';
551
552
  import type { RoutesNamedLocations, RoutesNamesListRecord, RoutesNamesList } from './__routes';
552
553
  import type {TypedRouter, TypedRoute, TypedRouteLocationRawFromName, TypedLocationAsRelativeRaw, NuxtRoute} from './__router';
553
554
  import { useRoute as _useRoute } from './__useTypedRoute';
554
555
  import { useRouter as _useRouter } from './__useTypedRouter';
555
556
  import { useLink as _useLink } from './__useTypedLink';
556
557
  import { navigateTo as _navigateTo } from './__navigateTo';
558
+ import type { DefineSetupFnComponent, SlotsType, UnwrapRef, VNode } from 'vue';
559
+
557
560
  ${returnIfTrue(
558
561
  i18n,
559
562
  `import { useLocalePath as _useLocalePath, useLocaleRoute as _useLocaleRoute} from './__i18n-router';
@@ -590,22 +593,36 @@ function createTypedRouterDefinitionFile() {
590
593
  }
591
594
 
592
595
  type TypedNuxtLinkProps<
593
- T extends RoutesNamesList,
594
- P extends string,
595
- E extends boolean = false> = Omit<NuxtLinkProps, 'to' | 'external'> &
596
- {
597
- to: NuxtRoute<T, P, E>,
598
- external?: E
596
+ T extends RoutesNamesList,
597
+ P extends string,
598
+ E extends boolean = false,
599
+ CustomProp extends boolean = false> = Omit<NuxtLinkProps<CustomProp>, 'to' | 'external'> &
600
+ {
601
+ to: NuxtRoute<T, P, E>,
602
+ external?: E
599
603
  }
600
604
 
605
+ type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp extends true ? {
606
+ href: string;
607
+ navigate: (e?: MouseEvent) => Promise<void>;
608
+ prefetch: (nuxtApp?: NuxtApp) => Promise<void>;
609
+ route: (RouteLocation & {
610
+ href: string;
611
+ }) | undefined;
612
+ rel: string | null;
613
+ target: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null;
614
+ isExternal: boolean;
615
+ isActive: false;
616
+ isExactActive: false;
617
+ } : UnwrapRef<UseLinkReturn>;
618
+
619
+ type NuxtLinkSlots<CustomProp extends boolean = false> = {
620
+ default?: (props: NuxtLinkDefaultSlotProps<CustomProp>) => VNode[];
621
+ };
622
+
601
623
 
602
624
 
603
- export type TypedNuxtLink = new <T extends RoutesNamesList, P extends string, E extends boolean = false>(props: TypedNuxtLinkProps<T, P, E>) => Omit<
604
- typeof NuxtLink,
605
- '$props'
606
- > & {
607
- $props: TypedNuxtLinkProps<T, P, E>;
608
- };
625
+ 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>
609
626
 
610
627
  declare module 'vue' {
611
628
  interface GlobalComponents {
@@ -1405,11 +1422,11 @@ async function processPathAndWriteFile({
1405
1422
  outDir
1406
1423
  }) {
1407
1424
  try {
1408
- const { rootDir } = moduleOptionStore;
1425
+ const { rootDir, disablePrettier } = moduleOptionStore;
1409
1426
  const finalOutDir = outDir ?? `.nuxt/typed-router`;
1410
1427
  const processedOutDir = resolve(rootDir, finalOutDir);
1411
1428
  const outputFile = resolve(process.cwd(), `${processedOutDir}/${fileName}`);
1412
- const formatedContent = await formatOutputWithPrettier(content);
1429
+ const formatedContent = disablePrettier ? content : await formatOutputWithPrettier(content);
1413
1430
  if (fs.existsSync(outputFile)) {
1414
1431
  await writeFile(outputFile, formatedContent);
1415
1432
  } else {
@@ -1805,6 +1822,7 @@ const module = defineNuxtModule({
1805
1822
  plugin: false,
1806
1823
  strict: false,
1807
1824
  pathCheck: true,
1825
+ disablePrettier: false,
1808
1826
  removeNuxtDefs: true,
1809
1827
  ignoreRoutes: []
1810
1828
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-typed-router",
3
- "version": "3.7.2",
3
+ "version": "3.8.0",
4
4
  "description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
5
5
  "type": "module",
6
6
  "main": "./dist/module.cjs",
@@ -63,15 +63,15 @@
63
63
  "prettier": "^2.5.x || 3.x"
64
64
  },
65
65
  "dependencies": {
66
- "@nuxt/kit": "^3.14.1592",
67
- "chalk": "5.3.0",
66
+ "@nuxt/kit": "^3.16.1",
67
+ "chalk": "5.4.1",
68
68
  "defu": "6.1.4",
69
69
  "lodash-es": "4.17.21",
70
70
  "log-symbols": "7.0.0",
71
71
  "mkdirp": "3.0.1",
72
- "nanoid": "5.0.9",
73
- "pathe": "1.1.2",
74
- "prettier": "3.4.1"
72
+ "nanoid": "5.1.5",
73
+ "pathe": "2.0.3",
74
+ "prettier": "3.5.3"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@intlify/core-base": "~10.0.4",
@@ -80,36 +80,36 @@
80
80
  "@intlify/vue-i18n-bridge": "1.1.0",
81
81
  "@intlify/vue-router-bridge": "1.1.0",
82
82
  "@nuxt/content": "2.13.4",
83
- "@nuxt/devtools": "1.6.1",
83
+ "@nuxt/devtools": "1.7.0",
84
84
  "@nuxt/module-builder": "0.8.4",
85
- "@nuxt/schema": "3.14.1592",
86
- "@nuxt/test-utils": "3.14.4",
85
+ "@nuxt/schema": "3.16.1",
86
+ "@nuxt/test-utils": "3.17.2",
87
87
  "@nuxt/types": "2.18.1",
88
88
  "@nuxtjs/eslint-config-typescript": "12.1.0",
89
- "@nuxtjs/i18n": "9.1.0",
89
+ "@nuxtjs/i18n": "9.3.3",
90
90
  "@nuxtjs/web-vitals": "0.2.7",
91
- "@playwright/test": "1.49.0",
91
+ "@playwright/test": "1.49.1",
92
92
  "@types/lodash-es": "4.17.12",
93
- "@types/node": "22.10.0",
94
- "@typescript-eslint/eslint-plugin": "8.16.0",
95
- "@typescript-eslint/parser": "8.16.0",
93
+ "@types/node": "22.13.11",
94
+ "@typescript-eslint/eslint-plugin": "8.27.0",
95
+ "@typescript-eslint/parser": "8.27.0",
96
96
  "@vue/test-utils": "2.4.6",
97
- "bumpp": "9.8.1",
98
- "changelogithub": "0.13.11",
97
+ "bumpp": "10.1.0",
98
+ "changelogithub": "13.13.0",
99
99
  "cross-env": "7.0.3",
100
- "eslint": "9.15.0",
101
- "eslint-config-prettier": "9.1.0",
102
- "eslint-plugin-vue": "9.31.0",
103
- "nuxt": "3.14.1592",
100
+ "eslint": "9.22.0",
101
+ "eslint-config-prettier": "10.1.1",
102
+ "eslint-plugin-vue": "10.0.0",
103
+ "nuxt": "3.16.1",
104
104
  "nuxt-seo-kit": "1.3.13",
105
- "playwright": "1.49.0",
105
+ "playwright": "1.49.1",
106
106
  "tsd": "0.31.2",
107
- "typescript": "5.6.2",
108
- "vitest": "2.1.6",
107
+ "typescript": "5.8.2",
108
+ "vitest": "2.1.8",
109
109
  "vue": "3.5.13",
110
- "vue-eslint-parser": "9.4.3",
111
- "vue-i18n": "~10.0.4",
110
+ "vue-eslint-parser": "10.1.1",
111
+ "vue-i18n": "~11.1.2",
112
112
  "vue-router": "4.5.0",
113
- "vue-tsc": "2.1.10"
113
+ "vue-tsc": "2.2.8"
114
114
  }
115
115
  }