Moved theme middleware to new theme engine service

refs: bf0823c9a2

- continuing the work of splitting up the theme service into logical components
This commit is contained in:
Hannah Wolfe 2021-04-23 15:16:59 +01:00
parent 5458126422
commit b9fc68b1b4
5 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,5 @@
module.exports = {
loadCoreHelpers: require('./handlebars/helpers').loadCoreHelpers,
getActive: require('./active').get
getActive: require('./active').get,
middleware: require('./middleware')
};

View File

@ -1,13 +1,13 @@
const _ = require('lodash');
const hbs = require('../theme-engine/engine');
const hbs = require('./engine');
const urlUtils = require('../../../shared/url-utils');
const config = require('../../../shared/config');
const {i18n} = require('../proxy');
const errors = require('@tryghost/errors');
const settingsCache = require('../../../server/services/settings/cache');
const labs = require('../../../server/services/labs');
const activeTheme = require('../theme-engine/active');
const preview = require('../theme-engine/preview');
const activeTheme = require('./active');
const preview = require('./preview');
// ### Ensure Active Theme
// Ensure there's a properly set & mounted active theme before attempting to serve a site request

View File

@ -91,7 +91,6 @@ module.exports = {
});
},
storage: require('./storage'),
middleware: require('./middleware'),
/**
* Load all inactive themes
*/

View File

@ -15,8 +15,7 @@ const urlUtils = require('../../../shared/url-utils');
const sitemapHandler = require('../../../frontend/services/sitemap/handler');
const appService = require('../../../frontend/services/apps');
const themeEngine = require('../../../frontend/services/theme-engine');
const themeService = require('../../../frontend/services/themes');
const themeMiddleware = themeService.middleware;
const themeMiddleware = themeEngine.middleware;
const membersMiddleware = require('../../services/members').middleware;
const siteRoutes = require('./routes');
const shared = require('../shared');

View File

@ -1,11 +1,10 @@
const should = require('should');
const sinon = require('sinon');
const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const themeService = require('../../../../core/frontend/services/themes');
const middleware = require('../../../../core/frontend/services/theme-engine').middleware;
// is only exposed via themeEngine.getActive()
const activeTheme = require('../../../../core/frontend/services/theme-engine/active');
const settingsCache = require('../../../../core/server/services/settings/cache');
const middleware = themeService.middleware;
const sandbox = sinon.createSandbox();