@nuxt/server
Advanced tools
+59
-32
| /*! | ||
| * @nuxt/server v2.8.1 (c) 2016-2019 | ||
| * @nuxt/server v2.9.0 (c) 2016-2019 | ||
@@ -14,2 +14,21 @@ * - All the amazing contributors | ||
| function _interopNamespace(e) { | ||
| if (e && e.__esModule) { return e; } else { | ||
| var n = {}; | ||
| if (e) { | ||
| Object.keys(e).forEach(function (k) { | ||
| var d = Object.getOwnPropertyDescriptor(e, k); | ||
| Object.defineProperty(n, k, d.get ? d : { | ||
| enumerable: true, | ||
| get: function () { | ||
| return e[k]; | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| n['default'] = e; | ||
| return n; | ||
| } | ||
| } | ||
| const path = _interopDefault(require('path')); | ||
@@ -34,3 +53,3 @@ const consola = _interopDefault(require('consola')); | ||
| class ServerContext { | ||
| constructor(server) { | ||
| constructor (server) { | ||
| this.nuxt = server.nuxt; | ||
@@ -43,3 +62,3 @@ this.globals = server.globals; | ||
| async function renderAndGetWindow( | ||
| async function renderAndGetWindow ( | ||
| url = 'http://localhost:3000', | ||
@@ -54,3 +73,3 @@ jsdomOpts = {}, | ||
| ) { | ||
| const jsdom = await Promise.resolve(require('jsdom')) | ||
| const jsdom = await new Promise(function (resolve) { resolve(_interopNamespace(require('jsdom'))); }) | ||
| .then(m => m.default || m) | ||
@@ -72,3 +91,3 @@ .catch((e) => { | ||
| virtualConsole: true, | ||
| beforeParse(window) { | ||
| beforeParse (window) { | ||
| // Mock window.scrollTo | ||
@@ -119,3 +138,3 @@ window.scrollTo = () => {}; | ||
| const nuxtMiddleware = ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware(req, res, next) { | ||
| const nuxtMiddleware = ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware (req, res, next) { | ||
| // Get context | ||
@@ -229,5 +248,7 @@ const context = utils.getContext(req, res); | ||
| const cors = `${crossorigin ? ` crossorigin=${crossorigin};` : ''}`; | ||
| const ref = modern ? 'modulepreload' : 'preload'; | ||
| // `modulepreload` rel attribute only supports script-like `as` value | ||
| // https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload | ||
| const rel = modern && asType === 'script' ? 'modulepreload' : 'preload'; | ||
| links.push(`<${publicPath}${file}>; rel=${ref};${cors} as=${asType}`); | ||
| links.push(`<${publicPath}${file}>; rel=${rel};${cors} as=${asType}`); | ||
| }); | ||
@@ -267,3 +288,3 @@ return links | ||
| const errorMiddleware = ({ resources, options }) => async function errorMiddleware(err, req, res, next) { | ||
| const errorMiddleware = ({ resources, options }) => async function errorMiddleware (err, req, res, next) { | ||
| // ensure statusCode, message and name fields | ||
@@ -349,3 +370,3 @@ | ||
| const readSourceFactory = ({ srcDir, rootDir, buildDir }) => async function readSource(frame) { | ||
| const readSourceFactory = ({ srcDir, rootDir, buildDir }) => async function readSource (frame) { | ||
| // Remove webpack:/// & query string from the end | ||
@@ -387,3 +408,3 @@ const sanitizeName = name => name ? name.replace('webpack:///', '').split('?')[0] : null; | ||
| class Listener { | ||
| constructor({ port, host, socket, https, app, dev, baseURL }) { | ||
| constructor ({ port, host, socket, https, app, dev, baseURL }) { | ||
| // Options | ||
@@ -406,3 +427,3 @@ this.port = port; | ||
| async close() { | ||
| async close () { | ||
| // Destroy server by forcing every connection to be closed | ||
@@ -422,3 +443,3 @@ if (this.server && this.server.listening) { | ||
| computeURL() { | ||
| computeURL () { | ||
| const address = this.server.address(); | ||
@@ -437,3 +458,3 @@ if (!this.socket) { | ||
| async listen() { | ||
| async listen () { | ||
| // Prevent multi calls | ||
@@ -475,3 +496,3 @@ if (this.listening) { | ||
| async serverErrorHandler(error) { | ||
| async serverErrorHandler (error) { | ||
| // Detect if port is not available | ||
@@ -531,3 +552,3 @@ const addressInUse = error.code === 'EADDRINUSE'; | ||
| class ServerTiming extends utils.Timer { | ||
| constructor(...args) { | ||
| constructor (...args) { | ||
| super(...args); | ||
@@ -537,3 +558,3 @@ this.headers = []; | ||
| end(...args) { | ||
| end (...args) { | ||
| const time = super.end(...args); | ||
@@ -546,3 +567,3 @@ if (time) { | ||
| clear() { | ||
| clear () { | ||
| super.clear(); | ||
@@ -552,3 +573,3 @@ this.headers.length = 0; | ||
| formatHeader(time) { | ||
| formatHeader (time) { | ||
| const desc = time.description ? `;desc="${time.description}"` : ''; | ||
@@ -560,3 +581,3 @@ return `${time.name};dur=${time.duration}${desc}` | ||
| class Server { | ||
| constructor(nuxt) { | ||
| constructor (nuxt) { | ||
| this.nuxt = nuxt; | ||
@@ -591,3 +612,3 @@ this.options = nuxt.options; | ||
| async ready() { | ||
| async ready () { | ||
| if (this._readyCalled) { | ||
@@ -601,3 +622,3 @@ return this | ||
| // Initialize vue-renderer | ||
| const { VueRenderer } = await Promise.resolve(require('@nuxt/vue-renderer')); | ||
| const { VueRenderer } = await new Promise(function (resolve) { resolve(_interopNamespace(require('@nuxt/vue-renderer'))); }); | ||
@@ -617,3 +638,3 @@ this.serverContext = new ServerContext(this); | ||
| async setupMiddleware() { | ||
| async setupMiddleware () { | ||
| // Apply setupMiddleware from modules first | ||
@@ -721,3 +742,3 @@ await this.nuxt.callHook('render:setupMiddleware', this.app); | ||
| useMiddleware(middleware) { | ||
| useMiddleware (middleware) { | ||
| let handler = middleware.handler || middleware; | ||
@@ -758,19 +779,25 @@ | ||
| renderRoute() { | ||
| renderRoute () { | ||
| return this.renderer.renderRoute.apply(this.renderer, arguments) | ||
| } | ||
| loadResources() { | ||
| loadResources () { | ||
| return this.renderer.loadResources.apply(this.renderer, arguments) | ||
| } | ||
| renderAndGetWindow(url, opts = {}) { | ||
| renderAndGetWindow (url, opts = {}, { | ||
| loadingTimeout = 2000, | ||
| loadedCallback = this.globals.loadedCallback, | ||
| ssr = this.options.render.ssr, | ||
| globals = this.globals | ||
| } = {}) { | ||
| return renderAndGetWindow(url, opts, { | ||
| loadedCallback: this.globals.loadedCallback, | ||
| ssr: this.options.render.ssr, | ||
| globals: this.globals | ||
| loadingTimeout, | ||
| loadedCallback, | ||
| ssr, | ||
| globals | ||
| }) | ||
| } | ||
| async listen(port, host, socket) { | ||
| async listen (port, host, socket) { | ||
| // Ensure nuxt is ready | ||
@@ -801,3 +828,3 @@ await this.nuxt.ready(); | ||
| async close() { | ||
| async close () { | ||
| if (this.__closed) { | ||
@@ -804,0 +831,0 @@ return |
+5
-5
| { | ||
| "name": "@nuxt/server", | ||
| "version": "2.8.1", | ||
| "version": "2.9.0", | ||
| "repository": "nuxt/nuxt.js", | ||
@@ -11,4 +11,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@nuxt/config": "2.8.1", | ||
| "@nuxt/utils": "2.8.1", | ||
| "@nuxt/config": "2.9.0", | ||
| "@nuxt/utils": "2.9.0", | ||
| "@nuxtjs/youch": "^4.2.3", | ||
@@ -18,6 +18,6 @@ "chalk": "^2.4.2", | ||
| "connect": "^3.7.0", | ||
| "consola": "^2.7.1", | ||
| "consola": "^2.10.1", | ||
| "etag": "^1.8.1", | ||
| "fresh": "^0.5.2", | ||
| "fs-extra": "^8.0.1", | ||
| "fs-extra": "^8.1.0", | ||
| "ip": "^1.1.5", | ||
@@ -24,0 +24,0 @@ "launch-editor-middleware": "^2.2.1", |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
24438
3.49%693
3.9%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated