From 07fee6d0272f3989c634a997607a09d20eb82b70 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Thu, 20 Sep 2018 16:51:29 +0200 Subject: [PATCH] Replaced `setPrototypeOf` with `Object.setPrototypeOf` no issue - discovered here: https://github.com/TryGhost/Ghost/pull/9886#discussion_r219127231 - `setPrototypeOf` is a npm package and a dependency of e.g. express - we can use `Object.setPrototypeOf` instead --- core/server/services/routing/ParentRouter.js | 3 +-- core/server/web/site/app.js | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/server/services/routing/ParentRouter.js b/core/server/services/routing/ParentRouter.js index 7f185691b1..1896bad09d 100644 --- a/core/server/services/routing/ParentRouter.js +++ b/core/server/services/routing/ParentRouter.js @@ -11,7 +11,6 @@ const debug = require('ghost-ignition').debug('services:routing:ParentRouter'), express = require('express'), _ = require('lodash'), url = require('url'), - setPrototypeOf = require('setprototypeof'), security = require('../../lib/security'), urlService = require('../url'), // This the route registry for the whole site @@ -24,7 +23,7 @@ function GhostRouter(options) { return innerRouter.handle(req, res, next); } - setPrototypeOf(innerRouter, router); + Object.setPrototypeOf(innerRouter, router); Object.defineProperty(innerRouter, 'name', { value: options.parent.name, diff --git a/core/server/web/site/app.js b/core/server/web/site/app.js index 11e6c8a856..0da63acb01 100644 --- a/core/server/web/site/app.js +++ b/core/server/web/site/app.js @@ -2,9 +2,6 @@ const debug = require('ghost-ignition').debug('blog'); const path = require('path'); const express = require('express'); -// this module is missing in package.json -const setPrototypeOf = require('setprototypeof'); - // App requires const config = require('../../config'); const apps = require('../../services/apps'); @@ -135,7 +132,7 @@ module.exports = function setupSiteApp(options = {}) { debug('General middleware done'); router = siteRoutes(options); - setPrototypeOf(SiteRouter, router); + Object.setPrototypeOf(SiteRouter, router); // Set up Frontend routes (including private blogging routes) siteApp.use(SiteRouter); @@ -152,7 +149,7 @@ module.exports = function setupSiteApp(options = {}) { module.exports.reload = () => { // https://github.com/expressjs/express/issues/2596 router = siteRoutes({start: true}); - setPrototypeOf(SiteRouter, router); + Object.setPrototypeOf(SiteRouter, router); // re-initialse apps (register app routers, because we have re-initialised the site routers) apps.init();