@websanova/vue-auth
Advanced tools
Comparing version 2.14.2-beta to 2.15.0-beta
{ | ||
"dependencies": { | ||
"@websanova/vue-auth": "2.14.2-beta" | ||
"@websanova/vue-auth": "2.15.0-beta" | ||
}, | ||
@@ -5,0 +5,0 @@ |
{ | ||
"dependencies": { | ||
"@websanova/vue-auth": "2.14.2-beta", | ||
"@websanova/vue-auth": "2.15.0-beta", | ||
"axios": "0.16.2", | ||
@@ -5,0 +5,0 @@ "vue-axios": "2.0.2" |
{ | ||
"name": "vue-webpack-ssr-fully-featured", | ||
"version": "0.0.5", | ||
"description": "", | ||
"author": "Cristian Baldi", | ||
"license": "GPL-3.0", | ||
"private": true, | ||
"scripts": { | ||
"demo": "node server", | ||
"start": "cross-env NODE_ENV=production node server", | ||
"build": "rimraf dist && npm run build:client && npm run build:server", | ||
"build:client": "cross-env NODE_ENV=production webpack --config build/webpack.client.config.js --progress --hide-modules", | ||
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.server.config.js --progress --hide-modules" | ||
}, | ||
"engines": { | ||
"node": ">=7.0", | ||
"npm": ">=4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "6.16.0", | ||
"babel-loader": "6.2.5", | ||
"babel-runtime": "6.9.2", | ||
"babel-plugin-transform-runtime": "6.12.0", | ||
"babel-preset-es2015": "6.16.0", | ||
"vue": "2.3.4", | ||
"vue-router": "2.5.3", | ||
"vue-resource": "1.3.4", | ||
"vue-server-renderer": "2.3.4", | ||
"vue-loader": "12.2.1", | ||
"vue-style-loader": "3.0.1", | ||
"vue-template-compiler": "2.3.4", | ||
"css-loader": "0.28.4", | ||
"style-loader": "0.18.2", | ||
"file-loader": "0.11.2", | ||
"webpack": "1.13.1", | ||
"webpack-dev-server": "1.16.1", | ||
"webpack-stream": "3.2.0", | ||
"copy-webpack-plugin": "3.0.1", | ||
"replace-webpack-plugin": "0.1.2", | ||
"@websanova/vue-auth": "2.14.2-beta", | ||
"axios": "0.16.2", | ||
"vue-axios": "2.0.2" | ||
"babel-core": "^6.25.0", | ||
"babel-loader": "^7.1.0", | ||
"babel-preset-env": "^1.5.2", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"cross-env": "^5.0.1", | ||
"cross-spawn": "^5.1.0", | ||
"css-loader": "^0.28.4", | ||
"file-loader": "^0.11.2", | ||
"friendly-errors-webpack-plugin": "^1.6.1", | ||
"html-webpack-plugin": "^2.29.0", | ||
"inject-loader": "^3.0.0", | ||
"lolex": "^1.5.2", | ||
"memory-fs": "^0.4.1", | ||
"node-sass": "^4.5.3", | ||
"pug": "^2.0.0-rc.2", | ||
"rimraf": "^2.6.1", | ||
"sass-loader": "^6.0.5", | ||
"url-loader": "^0.5.8", | ||
"vue-loader": "^12.2.1", | ||
"vue-template-compiler": "^2.3.4", | ||
"webpack": "3.0.0", | ||
"webpack-dev-middleware": "^1.11.0", | ||
"webpack-hot-middleware": "^2.17.1", | ||
"webpack-merge": "^4.1.0" | ||
}, | ||
"scripts": { | ||
"demo": "webpack-dev-server --host=0.0.0.0 --https --port=8003", | ||
"server": "node server" | ||
"dependencies": { | ||
"@websanova/vue-auth": "^2.15.0-beta", | ||
"axios": "^0.16.2", | ||
"compression": "^1.6.2", | ||
"es6-promise": "^4.1.0", | ||
"express": "^4.15.3", | ||
"lru-cache": "^4.1.0", | ||
"serve-favicon": "^2.4.3", | ||
"vue": "^2.3.4", | ||
"vue-axios": "^2.0.2", | ||
"vue-no-ssr": "^0.1.2", | ||
"vue-router": "^2.6.0", | ||
"vue-server-renderer": "^2.3.4", | ||
"vuex": "^2.2.1", | ||
"vuex-router-sync": "^4.2.0" | ||
} | ||
} | ||
} |
@@ -1,52 +0,111 @@ | ||
'use strict' | ||
const fs = require("fs") | ||
const path = require("path") | ||
const compression = require("compression") | ||
const express = require("express") | ||
const app = express() | ||
var fs = require('fs') | ||
var path = require('path') | ||
const favicon = require('serve-favicon') | ||
// Define global Vue for server-side app.js | ||
global.Vue = require('vue') | ||
const resolve = (file) => path.resolve(__dirname, file) | ||
// Get the HTML layout | ||
var layout = fs.readFileSync('./public/index.html', 'utf8') | ||
const config = require("./config") | ||
const isProduction = config.isProduction | ||
// Create a renderer | ||
var renderer = require('vue-server-renderer').createRenderer() | ||
const template = fs.readFileSync(resolve("./src/index.template.html"), "utf-8") | ||
// Create an express server | ||
var express = require('express') | ||
var server = express() | ||
const createRenderer = (bundle, options) => { | ||
// https://github.com/vuejs/vue/blob/dev/packages/vue-server-renderer/README.md#why-use-bundlerenderer | ||
return require("vue-server-renderer").createBundleRenderer(bundle, Object.assign(options, { | ||
template, | ||
cache: require("lru-cache")({ | ||
max: 1000, | ||
maxAge: 1000 * 60 * 15 | ||
}), | ||
// this is only needed when vue-server-renderer is npm-linked | ||
basedir: resolve("./dist"), | ||
// recommended for performance | ||
runInNewContext: false | ||
})) | ||
} | ||
var app = require('./public/app.min.js'); | ||
const serve = (path, cache) => express.static(resolve(path), { | ||
maxAge: cache && isProduction ? 60 * 60 * 24 * 30 : 0 | ||
}) | ||
// Serve files from the assets directory | ||
server.use('/public', express.static( | ||
path.resolve(__dirname, 'public') | ||
)) | ||
let renderer | ||
let readyPromise | ||
if (isProduction) { | ||
// In production: create server renderer using built server bundle. | ||
// The server bundle is generated by vue-ssr-webpack-plugin. | ||
const bundle = require("./dist/vue-ssr-server-bundle.json") | ||
// The client manifests are optional, but it allows the renderer | ||
// to automatically infer preload/prefetch links and directly add <script> | ||
// tags for any async chunks used during render, avoiding waterfall requests. | ||
const clientManifest = require("./dist/vue-ssr-client-manifest.json") | ||
renderer = createRenderer(bundle, { | ||
clientManifest | ||
}) | ||
readyPromise = Promise.resolve() | ||
} else { | ||
// In development: setup the dev server with watch and hot-reload, | ||
// and create a new renderer on bundle / index template update. | ||
readyPromise = require("./build/setup-dev-server")(app, (bundle, options) => { | ||
renderer = createRenderer(bundle, options) | ||
}) | ||
} | ||
// Handle all GET requests | ||
server.get('*', function (request, response) { | ||
// Render our Vue app to a string | ||
renderer.renderToString( | ||
// Create an app instance | ||
app, | ||
// Handle the rendered result | ||
function (error, html) { | ||
// If an error occurred while rendering... | ||
if (error) { | ||
// Log the error in the console | ||
console.error(error) | ||
// Tell the client something went wrong | ||
return response | ||
.status(500) | ||
.send('Server Error') | ||
} | ||
// Send the layout with the rendered app's HTML | ||
response.send(layout.replace('<div id="app"></div>', html)) | ||
} | ||
) | ||
const render = (req, res, context) => { | ||
const s = Date.now() | ||
console.log(`Rendering: ${req.url}`) | ||
res.setHeader("Content-Type", "text/html") | ||
const errorHandler = (err) => { | ||
// TODO: Render Error Page | ||
console.error(`Fatal error when rendering : ${req.url}`) | ||
console.error(err) | ||
res.status(500) | ||
res.end(`500 | Fatal error: ${err}`) | ||
console.log(`Whole request: ${Date.now() - s}ms`) | ||
} | ||
renderer.renderToString(context, (err, html) => { | ||
if (err) return errorHandler(err) | ||
res.status(context.meta.httpStatusCode || 200) | ||
res.end(html) | ||
console.log(`Whole request: ${Date.now() - s}ms`) | ||
}) | ||
} | ||
app.use(compression({ threshold: 0 })) | ||
app.use(favicon('./static/favicon.png')) | ||
app.use("/dist", serve("./dist", true)) | ||
app.use("/static", serve("./static", true)) | ||
app.get("*", (req, res) => { | ||
const context = { | ||
url: req.url | ||
} | ||
isProduction ? | ||
render(req, res, context) : | ||
readyPromise.then(() => render(req, res, context)) | ||
}) | ||
server.listen(8003, function (error) { | ||
if (error) throw error | ||
console.log('Server is running at localhost:8003') | ||
}) | ||
const port = config.server.port | ||
let server = app.listen(port, () => { | ||
console.log(`Server started at localhost:${port}`) | ||
}) | ||
module.exports = { | ||
ready: readyPromise, | ||
close: () => { | ||
server.close() | ||
} | ||
} |
@@ -1,124 +0,38 @@ | ||
var Vue = require('vue'); | ||
var VueRouter = require('vue-router'); | ||
// var App = require('./components/App.vue'); | ||
import Vue from "vue" | ||
import { sync } from "vuex-router-sync" | ||
(function () { | ||
import { createStore } from "./store" | ||
import { createRouter } from "./router" | ||
// Router | ||
Vue.router = new VueRouter({ | ||
hashbang: false, | ||
linkActiveClass: 'active', | ||
mode: 'history', | ||
base: __dirname, | ||
routes: [{ | ||
path: '/', | ||
name: 'default', | ||
component: require('./components/pages/Home.vue') | ||
}] | ||
// }, { | ||
// path: '/login', | ||
// name: 'login', | ||
// component: require('./components/pages/Login.vue'), | ||
// meta: {auth: false} | ||
// }, { | ||
// path: '/login/:type', | ||
// name: 'oauth2-type', | ||
// component: require('./components/pages/Oauth2.vue') | ||
// }, { | ||
// path: '/register', | ||
// name: 'register', | ||
// component: require('./components/pages/Register.vue'), | ||
// meta: {auth: false} | ||
// }, { | ||
// path: '/oauth1', | ||
// name: 'oauth1', | ||
// component: require('./components/pages/Oauth1.vue') | ||
// }, { | ||
// path: '/oauth2', | ||
// name: 'oauth2', | ||
// component: require('./components/pages/Oauth2.vue') | ||
// }, { | ||
// path: '/account', | ||
// name: 'account', | ||
// component: require('./components/pages/Account.vue'), | ||
// meta: {auth: true} | ||
// }, { | ||
// path: '/async', | ||
// name: 'async', | ||
// component: function(resolve) { require(['./components/pages/Async.vue'], resolve); } | ||
// }, { | ||
// path: '/admin', | ||
// name: 'admin', | ||
// component: require('./components/pages/Admin.vue'), | ||
// meta: {auth: 'admin'}, | ||
// children: [{ | ||
// path: 'products', | ||
// name: 'admin-products', | ||
// component: require('./components/pages/admin/Products.vue'), | ||
// children: [{ | ||
// path: ':product_id', | ||
// name: 'admin-product', | ||
// component: require('./components/pages/admin/Product.vue'), | ||
// children: [{ | ||
// path: 'info', | ||
// name: 'admin-product-info', | ||
// component: require('./components/pages/admin/ProductInfo.vue'), | ||
// meta: {auth: undefined} | ||
// }, { | ||
// path: 'media', | ||
// name: 'admin-product-media', | ||
// component: require('./components/pages/admin/ProductMedia.vue') | ||
// }] | ||
// }] | ||
// }] | ||
// }, { | ||
// path: '/users', | ||
// name: 'users', | ||
// component: require('./components/pages/Users.vue'), | ||
// meta: {auth: ['admin']} | ||
// }, { | ||
// path: '/404', | ||
// name: 'error-404', | ||
// component: require('./components/pages/404.vue') | ||
// }, { | ||
// path: '/403', | ||
// name: 'error-403', | ||
// component: require('./components/pages/403.vue') | ||
// }, { | ||
// path: '/502', | ||
// name: 'error-502', | ||
// component: require('./components/pages/502.vue') | ||
// }] | ||
}); | ||
import App from "./App.vue" | ||
// import axios from 'axios'; | ||
// import VueAxios from 'vue-axios'; | ||
// Vue.use(VueAxios, axios); | ||
// Vue.axios.defaults.baseURL = 'https://api-demo.websanova.com/api/v1'; | ||
import metaInfo from "./mixins/metaInfo" | ||
Vue.mixin(metaInfo) | ||
// Http | ||
// Vue.http.options.root = 'https://api-demo.websanova.com/api/v1'; | ||
// Expose a factory function that creates a fresh set of store, router, | ||
// app instances on each call (which is called for each SSR request) | ||
export function createApp(ssrContext) { | ||
// create store and router instances | ||
const store = createStore() | ||
const router = createRouter() | ||
// Vue Auth | ||
// Vue.use(require('../../src/index.js'), { | ||
// auth: require('../../drivers/auth/bearer.js'), | ||
// http: require('../../drivers/http/vue-resource.1.x.js'), | ||
// // http: require('../../drivers/http/axios.1.x.js'), | ||
// router: require('../../drivers/router/vue-router.2.x.js'), | ||
// rolesVar: 'role', | ||
// facebookOauth2Data: { | ||
// clientId: '196729390739201' | ||
// }, | ||
// googleOauth2Data: { | ||
// clientId: '337636458732-tatve7q4qo4gnpfcenbv3i47id4offbg.apps.googleusercontent.com' | ||
// } | ||
// }); | ||
// sync the router with the vuex store. | ||
// this registers `store.state.route` | ||
sync(store, router) | ||
// Start | ||
var component = require('./components/App.vue'); | ||
// create the app instance. | ||
// here we inject the router and store to all child components, | ||
// making them available everywhere as `this.$router` and `this.$store`. | ||
const app = new Vue({ | ||
router, | ||
store, | ||
ssrContext, | ||
render: (h) => h(App) | ||
}) | ||
component.router = Vue.router; | ||
// expose the app, the router and the store. | ||
// note we are not mounting the app here, since bootstrapping will be | ||
// different depending on whether we are in a browser or on the server. | ||
return { app, router, store } | ||
} | ||
return new Vue(component); | ||
}); |
@@ -7,2 +7,3 @@ # Change Log | ||
* Separate docs. | ||
* Add Vue.auth object (with no context, for use in interceptors). | ||
@@ -9,0 +10,0 @@ ### v2.13.x-beta |
# Contributors | ||
* Thanks to [@crisbal](https://github.com/crisbal) for contributing [Vue SSR demo with vue-auth integration](https://github.com/crisbal/vue-webpack-ssr-fully-featured/tree/vue-auth-demo). | ||
Thank you for everyone who has submitted bugs or fixes. | ||
This is a new section so if you feel left out, just let me know! |
@@ -17,3 +17,3 @@ { | ||
"version": "2.14.2-beta", | ||
"version": "2.15.0-beta", | ||
@@ -20,0 +20,0 @@ "repository": { |
@@ -7,3 +7,3 @@ # Vue Auth | ||
* [Installation](https://github.com/websanova/vue-auth/blob/master/docs/Installation.md) | ||
* [Demo](https://github.com/websanova/vue-auth/blob/master/docs/Demo.md) | ||
* [Demos](https://github.com/websanova/vue-auth/blob/master/docs/Demos.md) | ||
* [Lifecycle](https://github.com/websanova/vue-auth/blob/master/docs/Lifecycle.md) | ||
@@ -10,0 +10,0 @@ * [Tokens](https://github.com/websanova/vue-auth/blob/master/docs/Tokens.md) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
137
3
8
748255
3
70
2355
2