Ghost/core/frontend/services/proxy.js
Hannah Wolfe 22e13acd65 Updated var declarations to const/let and no lists
- All var declarations are now const or let as per ES6
- All comma-separated lists / chained declarations are now one declaration per line
- This is for clarity/readability but also made running the var-to-const/let switch smoother
- ESLint rules updated to match

How this was done:

- npm install -g jscodeshift
- git clone https://github.com/cpojer/js-codemod.git
- git clone git@github.com:TryGhost/Ghost.git shallow-ghost
- cd shallow-ghost
- jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2
- jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2
- yarn
- yarn test
- yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode
- grunt test-regression
- sorted!
2020-04-29 16:51:13 +01:00

70 lines
2.3 KiB
JavaScript

// This file defines everything that helpers "require"
// With the exception of modules like lodash, Bluebird
// We can later refactor to enforce this something like we did in apps
const hbs = require('./themes/engine');
const settingsCache = require('../../server/services/settings/cache');
const config = require('../../server/config');
// Direct requires:
// - lodash
// - bluebird
// - downsize
// - moment-timezone
// - jsonpath
module.exports = {
hbs: hbs,
SafeString: hbs.SafeString,
escapeExpression: hbs.escapeExpression,
// TODO: Expose less of the API to make this safe
api: require('../../server/api'),
// TODO: Only expose "get"
settingsCache: settingsCache,
// These 3 are kind of core and required all the time
errors: require('../../server/lib/common/errors'),
i18n: require('../../server/lib/common/i18n'),
logging: require('../../server/lib/common/logging'),
// Theme i18n is separate to common i18n
themeI18n: require('./themes/i18n'),
// This is used to detect if "isPost" is true in prevNext.
checks: require('../../server/data/schema').checks,
// Config!
// Keys used:
// isPrivacyDisabled & referrerPolicy used in ghost_head
config: {
get: config.get.bind(config),
isPrivacyDisabled: config.isPrivacyDisabled.bind(config)
},
// Labs utils for enabling/disabling helpers
labs: require('../../server/services/labs'),
// Things required from data/meta
metaData: {
get: require('../meta'), // ghost_head
getAssetUrl: require('../meta/asset_url'), // asset
getMetaDataExcerpt: require('../meta/excerpt'), // excerpt
getMetaDataDescription: require('../meta/description'), // meta_desc
getMetaDataTitle: require('../meta/title'), // meta_title
getPaginatedUrl: require('../meta/paginated_url'), // page_url
getMetaDataUrl: require('../meta/url') // url
},
// The local template thing, should this be merged with the channels one?
templates: require('./themes/handlebars/template'),
// Various utils, needs cleaning up / simplifying
socialUrls: require('@tryghost/social-urls'),
blogIcon: require('../../server/lib/image/blog-icon'),
urlService: require('./url'),
urlUtils: require('../../server/lib/url-utils'),
localUtils: require('./themes/handlebars/utils')
};