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

@nuxtjs/router

Package Overview
Dependencies
Maintainers
6
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/router - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

CHANGELOG.md

82

lib/module.js

@@ -5,53 +5,51 @@ const { resolve } = require('path')

function routerModule (moduleOptions) {
this.nuxt.hook('build:before', () => {
const defaultOptions = {
path: this.options.srcDir,
fileName: 'router.js',
keepDefaultRouter: false
}
function routerModule(moduleOptions) {
const defaultOptions = {
path: this.options.srcDir,
fileName: 'router.js',
keepDefaultRouter: false
}
const options = {
...{},
...defaultOptions,
...this.options.routerModule,
...moduleOptions
}
const options = {
...{},
...defaultOptions,
...this.options.routerModule,
...moduleOptions
}
const routerFilePath = resolve(options.path, options.fileName)
const routerFilePath = resolve(options.path, options.fileName)
// Check if router file path is defined
if (!existsSync(routerFilePath)) {
return consola.warn(`No \`${options.fileName}\` file found in \`${options.path}\`.`)
}
// Check if router file path is defined
if (!existsSync(routerFilePath)) {
return consola.warn(`No \`${options.fileName}\` file found in \`${options.path}\`.`)
}
// Add router file path as the main template for routing
this.addTemplate({
fileName: 'router.js',
src: routerFilePath
})
// Add router file path as the main template for routing
this.addTemplate({
fileName: 'router.js',
src: routerFilePath
})
// Disable parsing `pages/`
if (!options.keepDefaultRouter) {
this.nuxt.options.build.createRoutes = () => {
return []
}
return
// Disable parsing `pages/`
if (!options.keepDefaultRouter) {
this.nuxt.options.build.createRoutes = () => {
return []
}
// Put default router as .nuxt/defaultRouter.js
let defaultRouter
return
}
try {
defaultRouter = require.resolve('@nuxt/vue-app/template/router')
} catch (err) {
/* istanbul ignore next */
defaultRouter = require.resolve('nuxt/lib/app/router')
}
// Put default router as .nuxt/defaultRouter.js
let defaultRouter
this.addTemplate({
fileName: 'defaultRouter.js',
src: defaultRouter
})
try {
defaultRouter = require.resolve('@nuxt/vue-app/template/router')
} catch (err) {
/* istanbul ignore next */
defaultRouter = require.resolve('nuxt/lib/app/router')
}
this.addTemplate({
fileName: 'defaultRouter.js',
src: defaultRouter
})

@@ -58,0 +56,0 @@ }

{
"name": "@nuxtjs/router",
"version": "1.2.0",
"version": "1.2.1",
"description": "Nuxt module to use router.js instead of pages/ directory",

@@ -17,4 +17,4 @@ "license": "MIT",

"lint": "eslint lib test",
"test": "npm run lint && jest",
"release": "standard-version && git push --follow-tags && npm publish"
"test": "yarn lint && jest",
"release": "yarn test && standard-version && git push --follow-tags && npm publish"
},

@@ -24,30 +24,2 @@ "files": [

],
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
]
]
},
"jest": {
"testEnvironment": "node",
"collectCoverage": true,
"collectCoverageFrom": [
"lib/**/*.js"
],
"moduleNameMapper": {
"^~/(.*)$": "<rootDir>/lib/$1",
"^~~$": "<rootDir>",
"^@@$": "<rootDir>",
"^@/(.*)$": "<rootDir>/lib/$1"
},
"transform": {
"^.+\\.js$": "babel-jest"
}
},
"dependencies": {

@@ -57,22 +29,25 @@ "consola": "^2.4.0"

"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"babel-core": "^7.0.0-bridge",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"codecov": "^3.1.0",
"eslint": "^5.13.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.2.2",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^5.1.0",
"jest": "^23.6.0",
"nuxt": "^2.4.2",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"standard-version": "^4.4.0"
"@babel/core": "latest",
"@babel/preset-env": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"babel-eslint": "latest",
"babel-jest": "latest",
"codecov": "latest",
"eslint": "latest",
"eslint-config-standard": "latest",
"eslint-plugin-import": "latest",
"eslint-plugin-jest": "latest",
"eslint-plugin-node": "latest",
"eslint-plugin-promise": "latest",
"eslint-plugin-standard": "latest",
"eslint-plugin-vue": "latest",
"husky": "latest",
"jest": "latest",
"nuxt": "latest",
"request": "latest",
"request-promise-native": "latest",
"standard-version": "latest"
}
}
# Nuxt Router Module
[![npm (scoped with tag)](https://img.shields.io/npm/v/@nuxtjs/router/latest.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/router)
[![npm](https://img.shields.io/npm/dt/@nuxtjs/router.svg?style=flat-square)](https://npmjs.com/package/@nuxtjs/router)
[![CircleCI](https://img.shields.io/circleci/project/github/nuxt-community/router-module.svg?style=flat-square)](https://circleci.com/gh/nuxt-community/router-module)
[![Codecov](https://img.shields.io/codecov/c/github/nuxt-community/router-module.svg?style=flat-square)](https://codecov.io/gh/nuxt-community/router-module)
[![js-standard-style](https://cdn.rawgit.com/standard/standard/master/badge.svg)](http://standardjs.com)
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Circle CI][circle-ci-src]][circle-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![Dependencies][david-dm-src]][david-dm-href]
[![Standard JS][standard-js-src]][standard-js-href]

@@ -19,4 +20,5 @@ > Nuxt module to use router.js instead of pages/ directory

1. Install `@nuxtjs/router` dependency with `yarn` or `npm` into your project
1. Add `@nuxtjs/router` dependency with `yarn` or `npm` into your project
2. Add `@nuxtjs/router` to `modules` section of `nuxt.config.js`:
3. Configure it:

@@ -41,3 +43,3 @@ ```js

3. If you are using SPA mode, add an index `/` route to `generate` section of `nuxt.config.js`:
If you are using SPA mode, add an index `/` route to `generate` section of `nuxt.config.js`:

@@ -109,2 +111,3 @@ ```js

### Customize Routes Directory or Filename
If you use the module with fileName `{fileName: 'my-router.js'}` and/or `{path: 'custom-dir'}` you can customize the location of you route files.

@@ -116,2 +119,16 @@

Copyright (c) Sebastien Chopin <seb@chopin.io>
Copyright (c) Nuxt Community
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/dt/@nuxtjs/router.svg?style=flat-square
[npm-version-href]: https://npmjs.com/package/@nuxtjs/router
[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/router/latest.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/router
[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/router-module.svg?style=flat-square
[circle-ci-href]: https://circleci.com/gh/nuxt-community/router-module
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/router-module.svg?style=flat-square
[codecov-href]: https://codecov.io/gh/nuxt-community/router-module
[david-dm-src]: https://david-dm.org/nuxt-community/router-module/status.svg?style=flat-square
[david-dm-href]: https://david-dm.org/nuxt-community/router-module
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square
[standard-js-href]: https://standardjs.com

Sorry, the diff of this file is not supported yet

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