nuxt-typed-router 2.2.2-beta.1 → 2.2.2-beta.2

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.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.0.0-rc.1",
6
6
  "bridge": false
7
7
  },
8
- "version": "2.2.2-beta.1"
8
+ "version": "2.2.2-beta.2"
9
9
  }
package/dist/module.mjs CHANGED
@@ -209,6 +209,7 @@ function createTypedRouterFile() {
209
209
  RouteLocationNormalizedLoaded,
210
210
  RouteLocationRaw,
211
211
  Router,
212
+ RouteLocationPathRaw
212
213
  } from 'vue-router';
213
214
  import type {
214
215
  RoutesNamedLocations,
@@ -227,22 +228,26 @@ function createTypedRouterFile() {
227
228
  * {@link RouteLocationRaw}
228
229
  * */
229
230
  export type TypedRouteLocationRaw =
230
- | (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params' ${returnIfTrue(
231
+ | (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params'> & RoutesNamedLocations)
232
+ ${returnIfFalse(strictOptions.router.strictToArgument, "| string")}
233
+ ${returnIfTrue(
231
234
  strictOptions.router.strictRouteLocation,
232
- `| 'path'`
233
- )}> & RoutesNamedLocations)
234
- ${returnIfFalse(strictOptions.router.strictToArgument, "| string")};
235
+ `| Omit<RouteLocationPathRaw, 'path'>`,
236
+ "| RouteLocationPathRaw"
237
+ )};
235
238
 
236
239
 
237
240
  /**
238
241
  * Alternative version of {@link TypedRouteLocationRaw} but with a name generic
239
242
  */
240
243
  export type TypedRouteLocationRawFromName<T extends RoutesNamesList> =
241
- | (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params' ${returnIfTrue(
244
+ | (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params'> & TypedLocationAsRelativeRaw<T>)
245
+ ${returnIfFalse(strictOptions.router.strictToArgument, "| string")}
246
+ ${returnIfTrue(
242
247
  strictOptions.router.strictRouteLocation,
243
- `| 'path'`
244
- )}> & TypedLocationAsRelativeRaw<T>)
245
- ${returnIfFalse(strictOptions.router.strictToArgument, "| string")};
248
+ `| Omit<RouteLocationPathRaw, 'path'>`,
249
+ "| RouteLocationPathRaw"
250
+ )}
246
251
 
247
252
  /**
248
253
  * Generic providing inference and dynamic inclusion of \`params\` property
@@ -352,7 +357,7 @@ function createTypedRouterDefinitionFile() {
352
357
 
353
358
  import type { NuxtLinkProps } from '#app';
354
359
  import type { DefineComponent } from 'vue';
355
- import type { RouteLocationRaw } from 'vue-router';
360
+ import type { RouteLocationRaw, RouteLocationPathRaw } from 'vue-router';
356
361
  import type { RoutesNamedLocations, RoutesNamesListRecord } from './__routes';
357
362
  import type {TypedRouter, TypedRoute} from './__router';
358
363
  import { useRoute as _useRoute } from './__useTypedRoute';
@@ -372,13 +377,14 @@ function createTypedRouterDefinitionFile() {
372
377
  }
373
378
 
374
379
  type TypedNuxtLinkProps = Omit<NuxtLinkProps, 'to'> & {
375
- to: ${returnIfFalse(
376
- strictOptions.NuxtLink.strictToArgument,
377
- "string |"
378
- )} Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params' ${returnIfTrue(
380
+ to:
381
+ Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params'> & RoutesNamedLocations
382
+ ${returnIfFalse(strictOptions.NuxtLink.strictToArgument, "| string")}
383
+ ${returnIfTrue(
379
384
  strictOptions.NuxtLink.strictRouteLocation,
380
- `| 'path'`
381
- )}> & RoutesNamedLocations;
385
+ `| Omit<RouteLocationPathRaw, 'path'>`,
386
+ "| RouteLocationPathRaw"
387
+ )}
382
388
  };
383
389
 
384
390
  export type TypedNuxtLink = DefineComponent<
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-typed-router",
3
- "version": "2.2.2-beta.1",
3
+ "version": "2.2.2-beta.2",
4
4
  "description": "Provide autocompletion for pages route names generated by Nuxt router",
5
5
  "type": "module",
6
6
  "main": "./dist/module.cjs",
@@ -21,10 +21,10 @@
21
21
  "dev:build": "nuxi build playground",
22
22
  "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground && pnpm run test:prepare-fixtures",
23
23
  "build:test": "cross-env NUXT_BUILD_TYPE=stub pnpm run prepack && pnpm run dev:build",
24
- "test:prepare-fixtures": "nuxi prepare test/fixtures/simple && nuxi generate test/fixtures/complex",
24
+ "test:prepare-fixtures": "nuxi prepare test/fixtures/simple && nuxi prepare test/fixtures/withOptions && nuxi prepare test/fixtures/complex",
25
25
  "test:fixtures": " vitest run --dir test",
26
26
  "test:types": "pnpm run typecheck && pnpm run test:vue && vitest typecheck --run --dir test",
27
- "test:vue": "vue-tsc -p test/fixtures/simple/tsconfig.json --noEmit && vue-tsc -p test/fixtures/complex/tsconfig.json --noEmit",
27
+ "test:vue": "vue-tsc -p test/fixtures/simple/tsconfig.json --noEmit && vue-tsc -p test/fixtures/complex/tsconfig.json --noEmit && vue-tsc -p test/fixtures/withOptions/tsconfig.json --noEmit",
28
28
  "test": "pnpm run dev:prepare && pnpm run test:fixtures && pnpm run test:types",
29
29
  "docs:dev": "cd docs && pnpm run dev",
30
30
  "docs:build": "npm run dev:prepare && cd docs && nuxi generate",
@@ -59,12 +59,12 @@
59
59
  "dependencies": {
60
60
  "@nuxt/kit": "3.1.1",
61
61
  "chalk": "^5.2.0",
62
+ "defu": "^6.1.2",
62
63
  "lodash-es": "^4.17.21",
63
64
  "log-symbols": "^5.1.0",
64
65
  "mkdirp": "^1.0.4",
65
66
  "pathe": "1.1.0",
66
- "prettier": "2.8.3",
67
- "defu": "^6.1.2"
67
+ "prettier": "2.8.3"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@nuxt/module-builder": "^0.2.1",
@@ -77,6 +77,7 @@
77
77
  "@types/prettier": "^2.7.2",
78
78
  "@typescript-eslint/eslint-plugin": "^5.49.0",
79
79
  "@typescript-eslint/parser": "^5.49.0",
80
+ "@vue/test-utils": "^2.2.8",
80
81
  "cross-env": "^7.0.3",
81
82
  "eslint": "8.33.0",
82
83
  "eslint-config-prettier": "^8.6.0",