Refactored proxy imports in frontend helpers

refs https://github.com/TryGhost/Team/issues/856

- This syntax gives easier understanding of modules dependencies and improves searchability. For exampke, I was looking for all "api" uses exposed by the server proxy and didn't have a clear picture into which modules used it.
- The change was made during a short-lived try to limit the use of "api" in the server proxy :) I thought it would be helpful when bumping the defult server API exposed internally. Next time!
This commit is contained in:
Naz 2021-07-07 17:02:46 +04:00
parent 82ef700d81
commit 9987bdbe17
3 changed files with 4 additions and 12 deletions

View File

@ -3,10 +3,7 @@
//
// Outputs inline scripts used for analytics
const proxy = require('../../../../services/proxy');
const SafeString = proxy.SafeString;
const settingsCache = proxy.settingsCache;
const {SafeString, settingsCache} = require('../../../../services/proxy');
function ampComponents() {
let components = [];

View File

@ -8,9 +8,7 @@
// By default supported AMP HTML tags (no additional script tag necessary):
// amp-img, amp-ad, amp-embed, amp-video and amp-pixel.
// (less) dirty requires
const proxy = require('../../../../services/proxy');
const SafeString = proxy.SafeString;
const {SafeString, settingsCache} = require('../../../../services/proxy');
function ampComponents() {
let components = [];
@ -39,7 +37,7 @@ function ampComponents() {
components.push('<script async custom-element="amp-audio" src="https://cdn.ampproject.org/v0/amp-audio-0.1.js"></script>');
}
if (proxy.settingsCache.get('amp_gtag_id')) {
if (settingsCache.get('amp_gtag_id')) {
components.push('<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>');
}

View File

@ -4,10 +4,7 @@
// Password input used on private.hbs for password-protected blogs
// (less) dirty requires
const proxy = require('../../../../services/proxy');
const SafeString = proxy.SafeString;
const templates = proxy.templates;
const {SafeString, templates} = require('../../../../services/proxy');
// We use the name input_password to match the helper for consistency:
module.exports = function input_password(options) { // eslint-disable-line camelcase