Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-typed-router

Package Overview
Dependencies
Maintainers
1
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-typed-router - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

5

lib/module.js

@@ -27,3 +27,3 @@ import fs from 'fs';

}
routesEnum.push(route.name);
routesEnum.push(`'${route.name}'`);
};

@@ -36,4 +36,3 @@ routes.map(recursiveTypedRoutes);

`;
const routesEnumsTemplate = `
export type RouteNames = ${routesEnum.join('|')};
const routesEnumsTemplate = `export type RouteNames = ${routesEnum.join('|')};
`;

@@ -40,0 +39,0 @@

6

lib/templates/nuxt-typed-router.js
import Vue from 'vue';
Vue.prototype.$safeRouter = this.nuxt.router;
Vue.prototype.$safeRoute = this.nuxt.route;
export default (ctx, inject) => {
inject('safeRouter', ctx.app.router);
inject('safeRoute', ctx.route);
};
{
"name": "nuxt-typed-router",
"version": "0.0.1",
"version": "0.0.2",
"description": "Provide autocompletion for pages route names generated by Nuxt router",

@@ -5,0 +5,0 @@ "main": "lib/module.js",

@@ -1,2 +0,4 @@

import { SafeVueRouter } from './vue';
import Vue from 'vue';
import { SafeVueRouter, SafeRoute } from './vue';
import './vue';

@@ -30,1 +32,14 @@ interface NuxtTypedRouterOptions {

}
declare module 'vue/types/vue' {
interface Vue {
$safeRouter: SafeVueRouter;
$safeRoute: SafeRoute;
}
}
declare module 'vuex/types/index' {
interface Store<S> {
$safeRouter: SafeVueRouter;
}
}
import VueRouter, { Location, Route, RouteRecord } from 'vue-router';
import { RouteNames } from './__generated.ts';
import { RouteNames } from './__generated';
import { ErrorHandler } from 'vue-router/types/router';
import { ComponentOptions } from 'vue/types/umd';
import Vue, { AsyncComponent } from 'vue';
interface SafeVueRouter extends VueRouter {
type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent;
export interface SafeVueRouter extends VueRouter {
push(location: SafeRawLocation): Promise<SafeRoute>;

@@ -25,25 +30,12 @@ replace(location: SafeRawLocation): Promise<SafeRoute>;

interface SafeLocation extends Location {
export interface SafeLocation extends Location {
name?: RouteNames;
}
interface SafeRoute extends Route {
export interface SafeRoute extends Route {
name?: RouteNames;
}
interface SafeRouteRecord extends RouteRecord {
export interface SafeRouteRecord extends RouteRecord {
name?: RouteNames;
}
declare module 'vue/types/vue' {
interface Vue {
$safeRouter: SafeVueRouter;
$safeRoute: SafeRoute;
}
}
declare module 'vuex/types/index' {
interface Store<S> {
$safeRouter: SafeVueRouter;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc