nuxt-typed-router 3.3.0 → 3.3.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.
@@ -0,0 +1,84 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ /**
5
+ *
6
+ * Enables path autocomplete and path validity for programmatic validation
7
+ *
8
+ * @default true
9
+ */
10
+ pathCheck?: boolean;
11
+ /**
12
+ * Set to false if you don't want a plugin generated
13
+ * @default false
14
+ */
15
+ plugin?: boolean;
16
+ /**
17
+ * Customise Route location arguments strictness for `NuxtLink` or `router`
18
+ * All strict options are disabled by default.
19
+ * You can tweak options to add strict router navigation options.
20
+ *
21
+ * By passing `true` you can enable all of them
22
+ *
23
+ * @default false
24
+ */
25
+ strict?: boolean | StrictOptions;
26
+ /**
27
+ * Remove Nuxt definitions to avoid conflicts
28
+ * @default true
29
+ */
30
+ experimentalRemoveNuxtDefs?: boolean;
31
+ /**
32
+ * ⚠️ Experimental
33
+ *
34
+ * Exclude certain routes from being included into the generated types
35
+ * Ex: 404 routes or catchAll routes
36
+ */
37
+ experimentalIgnoreRoutes?: string[];
38
+ }
39
+ interface StrictOptions {
40
+ NuxtLink?: StrictParamsOptions;
41
+ router?: StrictParamsOptions;
42
+ }
43
+ interface StrictParamsOptions {
44
+ /**
45
+ * Prevent passing string path to the RouteLocation argument.
46
+ *
47
+ * Ex:
48
+ * ```vue
49
+ * <template>
50
+ * <NuxtLink to='/login'/> // Error ❌
51
+ * </template>
52
+ * ```
53
+ * Or
54
+ * ```ts
55
+ * router.push('/login'); // Error ❌
56
+ * navigateTo('/login'); // Error ❌
57
+ * ```
58
+ *
59
+ * @default false
60
+ */
61
+ strictToArgument?: boolean;
62
+ /**
63
+ * Prevent passing a `params` property in the RouteLocation argument.
64
+ *
65
+ * Ex:
66
+ * ```vue
67
+ * <template>
68
+ * <NuxtLink :to='{path: "/login"}'/> // Error ❌
69
+ * </template>
70
+ * ```
71
+ * Or
72
+ * ```ts
73
+ * router.push({path: "/login"}); // Error ❌
74
+ * navigateTo({path: "/login"}); // Error ❌
75
+ * ```
76
+ *
77
+ * @default false
78
+ */
79
+ strictRouteLocation?: boolean;
80
+ }
81
+
82
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
83
+
84
+ export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -81,4 +81,4 @@ interface StrictParamsOptions {
81
81
 
82
82
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
83
83
 
84
- export { ModuleOptions, _default as default };
84
+ export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "nuxt": "^3.0.0",
6
6
  "bridge": false
7
7
  },
8
- "version": "3.3.0"
8
+ "version": "3.3.2"
9
9
  }
package/dist/module.mjs CHANGED
@@ -12,20 +12,26 @@ import { mkdirp } from 'mkdirp';
12
12
  import { camelCase } from 'lodash-es';
13
13
  import { readFile } from 'fs/promises';
14
14
 
15
+ var __defProp = Object.defineProperty;
16
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
+ var __publicField = (obj, key, value) => {
18
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
+ return value;
20
+ };
15
21
  class ModuleOptionsStore {
16
22
  constructor() {
17
- this.plugin = false;
18
- this.strict = false;
19
- this.pathCheck = true;
20
- this.autoImport = false;
21
- this.rootDir = "";
22
- this.buildDir = "";
23
- this.srcDir = "";
24
- this.pagesDir = "";
25
- this.i18n = false;
26
- this.i18nOptions = null;
27
- this.i18nLocales = [];
28
- this.experimentalIgnoreRoutes = [];
23
+ __publicField(this, "plugin", false);
24
+ __publicField(this, "strict", false);
25
+ __publicField(this, "pathCheck", true);
26
+ __publicField(this, "autoImport", false);
27
+ __publicField(this, "rootDir", "");
28
+ __publicField(this, "buildDir", "");
29
+ __publicField(this, "srcDir", "");
30
+ __publicField(this, "pagesDir", "");
31
+ __publicField(this, "i18n", false);
32
+ __publicField(this, "i18nOptions", null);
33
+ __publicField(this, "i18nLocales", []);
34
+ __publicField(this, "experimentalIgnoreRoutes", []);
29
35
  }
30
36
  updateOptions(options) {
31
37
  if (options.plugin != null)
@@ -1690,6 +1696,14 @@ const module = defineNuxtModule({
1690
1696
  });
1691
1697
  }
1692
1698
  });
1699
+ nuxt.hook("build:done", () => {
1700
+ if (moduleOptions.experimentalRemoveNuxtDefs) {
1701
+ removeNuxtDefinitions({
1702
+ autoImport: nuxt.options.imports.autoImport ?? true,
1703
+ buildDir: nuxt.options.buildDir
1704
+ });
1705
+ }
1706
+ });
1693
1707
  if (nuxt.options.dev) {
1694
1708
  nuxt.hook("devtools:customTabs", (tabs) => {
1695
1709
  tabs.push({
@@ -0,0 +1,15 @@
1
+
2
+ import { ModuleOptions } from './module'
3
+
4
+ declare module '@nuxt/schema' {
5
+ interface NuxtConfig { ['nuxtTypedRouter']?: Partial<ModuleOptions> }
6
+ interface NuxtOptions { ['nuxtTypedRouter']?: ModuleOptions }
7
+ }
8
+
9
+ declare module 'nuxt/schema' {
10
+ interface NuxtConfig { ['nuxtTypedRouter']?: Partial<ModuleOptions> }
11
+ interface NuxtOptions { ['nuxtTypedRouter']?: ModuleOptions }
12
+ }
13
+
14
+
15
+ export { ModuleOptions, default } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-typed-router",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
5
5
  "type": "module",
6
6
  "main": "./dist/module.cjs",
@@ -15,11 +15,11 @@
15
15
  "dist"
16
16
  ],
17
17
  "scripts": {
18
- "prepack": "nuxt-module-build",
18
+ "prepack": "nuxt-module-build build",
19
19
  "dev": "nuxi dev playground",
20
20
  "dev:build": "nuxi build playground",
21
21
  "prepare:playground": "nuxi prepare playground",
22
- "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground && pnpm run test:prepare-fixtures",
22
+ "dev:prepare": "nuxt-module-build 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
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",
@@ -60,44 +60,44 @@
60
60
  "url": "https://github.com/victorgarciaesgi/nuxt-typed-router/issues"
61
61
  },
62
62
  "dependencies": {
63
- "@nuxt/kit": "^3.6.5",
63
+ "@nuxt/kit": "^3.8.0",
64
64
  "chalk": "^5.3.0",
65
65
  "defu": "^6.1.2",
66
66
  "lodash-es": "^4.17.21",
67
67
  "log-symbols": "^5.1.0",
68
68
  "mkdirp": "^3.0.1",
69
- "nanoid": "^4.0.2",
69
+ "nanoid": "^5.0.2",
70
70
  "pathe": "1.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@nuxt/devtools": "^0.8.0",
74
- "@nuxt/module-builder": "^0.4.0",
75
- "@nuxt/test-utils": "^3.6.5",
73
+ "@nuxt/devtools": "^1.0.0",
74
+ "@nuxt/module-builder": "^0.5.2",
75
+ "@nuxt/test-utils": "^3.8.0",
76
76
  "@nuxt/types": "^2.17.1",
77
- "@nuxtjs/eslint-config-typescript": "^12.0.0",
77
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
78
78
  "@nuxtjs/i18n": "8.0.0-beta.10",
79
79
  "@nuxtjs/web-vitals": "^0.2.6",
80
- "@types/lodash-es": "^4.17.8",
81
- "@types/node": "^20.5.0",
80
+ "@types/lodash-es": "^4.17.10",
81
+ "@types/node": "^20.8.7",
82
82
  "@types/prettier": "^3.0.0",
83
- "@typescript-eslint/eslint-plugin": "^6.4.0",
84
- "@typescript-eslint/parser": "^6.4.0",
83
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
84
+ "@typescript-eslint/parser": "^6.8.0",
85
85
  "@vue/test-utils": "^2.4.1",
86
- "bumpp": "9.1.1",
87
- "changelogithub": "0.12.12",
86
+ "bumpp": "9.2.0",
87
+ "changelogithub": "0.13.1",
88
88
  "cross-env": "^7.0.3",
89
- "eslint": "8.47.0",
89
+ "eslint": "8.51.0",
90
90
  "eslint-config-prettier": "^9.0.0",
91
91
  "eslint-plugin-vue": "^9.17.0",
92
- "nuxt": "3.6.5",
93
- "nuxt-seo-kit": "1.3.9",
94
- "playwright": "1.37.0",
95
- "prettier": "3.0.2",
96
- "tsd": "^0.28.1",
97
- "typescript": "^5.1.6",
98
- "vitest": "^0.34.2",
99
- "vue-eslint-parser": "^9.3.1",
100
- "vue-router": "^4.2.4",
101
- "vue-tsc": "^1.8.8"
92
+ "nuxt": "3.8.0",
93
+ "nuxt-seo-kit": "1.3.13",
94
+ "playwright": "1.39.0",
95
+ "prettier": "3.0.3",
96
+ "tsd": "^0.29.0",
97
+ "typescript": "^5.2.2",
98
+ "vitest": "^0.34.6",
99
+ "vue-eslint-parser": "^9.3.2",
100
+ "vue-router": "^4.2.5",
101
+ "vue-tsc": "^1.8.19"
102
102
  }
103
103
  }