@commercetools-frontend/mc-html-template 27.5.3 → 27.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-mc-html-template.cjs.dev.js +25 -21
- package/dist/commercetools-frontend-mc-html-template.cjs.prod.js +25 -21
- package/dist/commercetools-frontend-mc-html-template.esm.js +5 -3
- package/package.json +3 -3
- package/webpack-html-template/dist/commercetools-frontend-mc-html-template-webpack-html-template.cjs.dev.js +9 -9
- package/webpack-html-template/dist/commercetools-frontend-mc-html-template-webpack-html-template.cjs.prod.js +9 -9
- package/webpack-html-template/dist/commercetools-frontend-mc-html-template-webpack-html-template.esm.js +1 -1
- /package/dist/{generate-template-Dqgy-ei1.cjs.dev.js → generate-template-775d54b0.cjs.prod.js} +0 -0
- /package/dist/{generate-template-Dqgy-ei1.cjs.prod.js → generate-template-92ee209d.cjs.dev.js} +0 -0
- /package/dist/{generate-template-BRTX4i2Q.esm.js → generate-template-cd3fdf14.esm.js} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var fs = require('fs');
|
|
4
6
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
5
7
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
@@ -22,9 +24,9 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
22
24
|
var constants = require('@commercetools-frontend/constants');
|
|
23
25
|
var crypto = require('crypto');
|
|
24
26
|
var serialize = require('serialize-javascript');
|
|
25
|
-
var generateTemplate = require('./generate-template-
|
|
27
|
+
var generateTemplate = require('./generate-template-92ee209d.cjs.dev.js');
|
|
26
28
|
|
|
27
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
28
30
|
|
|
29
31
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
30
32
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -46,7 +48,7 @@ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
|
46
48
|
var serialize__default = /*#__PURE__*/_interopDefault(serialize);
|
|
47
49
|
|
|
48
50
|
function createAssetHash(content) {
|
|
49
|
-
const sha256Hash = crypto__default
|
|
51
|
+
const sha256Hash = crypto__default["default"].createHash('sha256').update(content).digest('base64');
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* NOTE:
|
|
@@ -58,43 +60,43 @@ function createAssetHash(content) {
|
|
|
58
60
|
return `sha256-${sha256Hash}`;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const sanitizeAppEnvironment = env => serialize__default
|
|
63
|
+
const sanitizeAppEnvironment = env => serialize__default["default"](env, {
|
|
62
64
|
isJSON: true
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
66
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
67
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
68
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
67
69
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
68
70
|
const htmlScripts$1 = {
|
|
69
71
|
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
70
72
|
"publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
|
|
71
73
|
};
|
|
72
|
-
const toArray = value => _Array$isArray__default
|
|
74
|
+
const toArray = value => _Array$isArray__default["default"](value) ? value : [value];
|
|
73
75
|
const parseCSPDirectives = function () {
|
|
74
76
|
var _context2;
|
|
75
77
|
for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
76
78
|
directives[_key] = arguments[_key];
|
|
77
79
|
}
|
|
78
|
-
const mergedDirectives = _reduceInstanceProperty__default
|
|
80
|
+
const mergedDirectives = _reduceInstanceProperty__default["default"](directives).call(directives, (mergedDirectives, directive) => {
|
|
79
81
|
var _context;
|
|
80
|
-
return _Object$assign__default
|
|
82
|
+
return _Object$assign__default["default"](mergedDirectives, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
|
|
81
83
|
const existingDirectiveValue = mergedDirectives[directiveKey];
|
|
82
|
-
return _Object$assign__default
|
|
84
|
+
return _Object$assign__default["default"](mergedDirectiveValues, {
|
|
83
85
|
[directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
|
|
84
86
|
});
|
|
85
87
|
}, {}));
|
|
86
88
|
}, {});
|
|
87
|
-
return _mapInstanceProperty__default
|
|
89
|
+
return _mapInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](mergedDirectives)).call(_context2, _ref => {
|
|
88
90
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
89
91
|
directive = _ref2[0],
|
|
90
92
|
value = _ref2[1];
|
|
91
|
-
return `${directive} ${_Array$isArray__default
|
|
93
|
+
return `${directive} ${_Array$isArray__default["default"](value) ? value.join(' ') : value}`;
|
|
92
94
|
}).join('; ');
|
|
93
95
|
};
|
|
94
96
|
const parsePermissionsPolicyDirectives = (defaultValue, customDirectives) => {
|
|
95
97
|
var _context3;
|
|
96
|
-
const mergedDirectives = _mapInstanceProperty__default
|
|
97
|
-
const _directive$trim$split = _trimInstanceProperty__default
|
|
98
|
+
const mergedDirectives = _mapInstanceProperty__default["default"](_context3 = defaultValue.split(',')).call(_context3, directive => {
|
|
99
|
+
const _directive$trim$split = _trimInstanceProperty__default["default"](directive).call(directive).split('='),
|
|
98
100
|
_directive$trim$split2 = _slicedToArray(_directive$trim$split, 2),
|
|
99
101
|
directiveName = _directive$trim$split2[0],
|
|
100
102
|
directiveValue = _directive$trim$split2[1];
|
|
@@ -122,17 +124,17 @@ const processHeaders = applicationConfig => {
|
|
|
122
124
|
* Content Security Policy (CSP)
|
|
123
125
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
124
126
|
*/
|
|
125
|
-
const defaultCSPDirectives = _Object$assign__default
|
|
127
|
+
const defaultCSPDirectives = _Object$assign__default["default"]({
|
|
126
128
|
'default-src': "'none'",
|
|
127
|
-
'script-src': _concatInstanceProperty__default
|
|
129
|
+
'script-src': _concatInstanceProperty__default["default"](_context4 = ["'self'"]).call(_context4, isMcDevEnv ?
|
|
128
130
|
// Allow webpack to load source maps on runtime when errors occur
|
|
129
131
|
// using script tags
|
|
130
|
-
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default
|
|
131
|
-
'connect-src': _concatInstanceProperty__default
|
|
132
|
+
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default["default"](htmlScriptsHashes).call(htmlScriptsHashes, assetHash => `'${assetHash}'`)),
|
|
133
|
+
'connect-src': _concatInstanceProperty__default["default"](_context5 = ["'self'", 'app.launchdarkly.com', 'clientstream.launchdarkly.com', 'events.launchdarkly.com', 'app.getsentry.com',
|
|
132
134
|
// Match all attempts to load from any subdomain of `sentry.io`
|
|
133
135
|
'*.sentry.io']).call(_context5, isMcDevEnv ? ['ws:', 'localhost:8080', 'webpack-internal:'] : []),
|
|
134
136
|
'img-src': ['*', 'data:'],
|
|
135
|
-
'style-src': _concatInstanceProperty__default
|
|
137
|
+
'style-src': _concatInstanceProperty__default["default"](_context6 = ["'self'", 'fonts.googleapis.com', 'data:']).call(_context6,
|
|
136
138
|
// TODO: investigate what needs to be done to avoid unsafe-inline styles
|
|
137
139
|
// https://github.com/commercetools/merchant-center-frontend/pull/5223#discussion_r210367636
|
|
138
140
|
["'unsafe-inline'"]
|
|
@@ -167,7 +169,9 @@ const processHeaders = applicationConfig => {
|
|
|
167
169
|
|
|
168
170
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
169
171
|
const htmlScripts = {
|
|
170
|
-
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);"
|
|
172
|
+
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
173
|
+
"publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
|
|
174
|
+
}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
171
175
|
const htmlStyles = {
|
|
172
176
|
"loadingScreen": ".loading-screen{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;width:100vw}.loading-screen--hidden{display:none}.loading-screen>*+*{margin:24px 0 0}.loading-spinner{width:32px;height:32px}.long-loading-notice{color:#999;font-family:'Open Sans',sans-serif;font-size:12px}.long-loading-notice--hidden{visibility:hidden}.loading-spinner-circle{fill:#213c45;opacity:.2}@keyframes loading-spinner-animation{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loading-spinner-pointer{transform-origin:20px 20px 0;animation:loading-spinner-animation .5s infinite linear}"
|
|
173
177
|
};
|
|
@@ -179,7 +183,7 @@ const replaceHtmlPlaceholders = (indexHtmlContent, options) => indexHtmlContent.
|
|
|
179
183
|
async function compileHtml(indexHtmlTemplatePath) {
|
|
180
184
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
181
185
|
const compiledHeaders = processHeaders(applicationConfig$1);
|
|
182
|
-
const indexHtmlTemplateContent = fs__default
|
|
186
|
+
const indexHtmlTemplateContent = fs__default["default"].readFileSync(indexHtmlTemplatePath, 'utf8');
|
|
183
187
|
const indexHtmlContent = replaceHtmlPlaceholders(indexHtmlTemplateContent, {
|
|
184
188
|
env: applicationConfig$1.env,
|
|
185
189
|
headers: compiledHeaders
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var fs = require('fs');
|
|
4
6
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
5
7
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
@@ -22,9 +24,9 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
22
24
|
var constants = require('@commercetools-frontend/constants');
|
|
23
25
|
var crypto = require('crypto');
|
|
24
26
|
var serialize = require('serialize-javascript');
|
|
25
|
-
var generateTemplate = require('./generate-template-
|
|
27
|
+
var generateTemplate = require('./generate-template-775d54b0.cjs.prod.js');
|
|
26
28
|
|
|
27
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
28
30
|
|
|
29
31
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
30
32
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -46,7 +48,7 @@ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
|
46
48
|
var serialize__default = /*#__PURE__*/_interopDefault(serialize);
|
|
47
49
|
|
|
48
50
|
function createAssetHash(content) {
|
|
49
|
-
const sha256Hash = crypto__default
|
|
51
|
+
const sha256Hash = crypto__default["default"].createHash('sha256').update(content).digest('base64');
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* NOTE:
|
|
@@ -58,43 +60,43 @@ function createAssetHash(content) {
|
|
|
58
60
|
return `sha256-${sha256Hash}`;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const sanitizeAppEnvironment = env => serialize__default
|
|
63
|
+
const sanitizeAppEnvironment = env => serialize__default["default"](env, {
|
|
62
64
|
isJSON: true
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
66
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
67
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
68
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
67
69
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
68
70
|
const htmlScripts$1 = {
|
|
69
71
|
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
70
72
|
"publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
|
|
71
73
|
};
|
|
72
|
-
const toArray = value => _Array$isArray__default
|
|
74
|
+
const toArray = value => _Array$isArray__default["default"](value) ? value : [value];
|
|
73
75
|
const parseCSPDirectives = function () {
|
|
74
76
|
var _context2;
|
|
75
77
|
for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
76
78
|
directives[_key] = arguments[_key];
|
|
77
79
|
}
|
|
78
|
-
const mergedDirectives = _reduceInstanceProperty__default
|
|
80
|
+
const mergedDirectives = _reduceInstanceProperty__default["default"](directives).call(directives, (mergedDirectives, directive) => {
|
|
79
81
|
var _context;
|
|
80
|
-
return _Object$assign__default
|
|
82
|
+
return _Object$assign__default["default"](mergedDirectives, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
|
|
81
83
|
const existingDirectiveValue = mergedDirectives[directiveKey];
|
|
82
|
-
return _Object$assign__default
|
|
84
|
+
return _Object$assign__default["default"](mergedDirectiveValues, {
|
|
83
85
|
[directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
|
|
84
86
|
});
|
|
85
87
|
}, {}));
|
|
86
88
|
}, {});
|
|
87
|
-
return _mapInstanceProperty__default
|
|
89
|
+
return _mapInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](mergedDirectives)).call(_context2, _ref => {
|
|
88
90
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
89
91
|
directive = _ref2[0],
|
|
90
92
|
value = _ref2[1];
|
|
91
|
-
return `${directive} ${_Array$isArray__default
|
|
93
|
+
return `${directive} ${_Array$isArray__default["default"](value) ? value.join(' ') : value}`;
|
|
92
94
|
}).join('; ');
|
|
93
95
|
};
|
|
94
96
|
const parsePermissionsPolicyDirectives = (defaultValue, customDirectives) => {
|
|
95
97
|
var _context3;
|
|
96
|
-
const mergedDirectives = _mapInstanceProperty__default
|
|
97
|
-
const _directive$trim$split = _trimInstanceProperty__default
|
|
98
|
+
const mergedDirectives = _mapInstanceProperty__default["default"](_context3 = defaultValue.split(',')).call(_context3, directive => {
|
|
99
|
+
const _directive$trim$split = _trimInstanceProperty__default["default"](directive).call(directive).split('='),
|
|
98
100
|
_directive$trim$split2 = _slicedToArray(_directive$trim$split, 2),
|
|
99
101
|
directiveName = _directive$trim$split2[0],
|
|
100
102
|
directiveValue = _directive$trim$split2[1];
|
|
@@ -122,17 +124,17 @@ const processHeaders = applicationConfig => {
|
|
|
122
124
|
* Content Security Policy (CSP)
|
|
123
125
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
124
126
|
*/
|
|
125
|
-
const defaultCSPDirectives = _Object$assign__default
|
|
127
|
+
const defaultCSPDirectives = _Object$assign__default["default"]({
|
|
126
128
|
'default-src': "'none'",
|
|
127
|
-
'script-src': _concatInstanceProperty__default
|
|
129
|
+
'script-src': _concatInstanceProperty__default["default"](_context4 = ["'self'"]).call(_context4, isMcDevEnv ?
|
|
128
130
|
// Allow webpack to load source maps on runtime when errors occur
|
|
129
131
|
// using script tags
|
|
130
|
-
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default
|
|
131
|
-
'connect-src': _concatInstanceProperty__default
|
|
132
|
+
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default["default"](htmlScriptsHashes).call(htmlScriptsHashes, assetHash => `'${assetHash}'`)),
|
|
133
|
+
'connect-src': _concatInstanceProperty__default["default"](_context5 = ["'self'", 'app.launchdarkly.com', 'clientstream.launchdarkly.com', 'events.launchdarkly.com', 'app.getsentry.com',
|
|
132
134
|
// Match all attempts to load from any subdomain of `sentry.io`
|
|
133
135
|
'*.sentry.io']).call(_context5, isMcDevEnv ? ['ws:', 'localhost:8080', 'webpack-internal:'] : []),
|
|
134
136
|
'img-src': ['*', 'data:'],
|
|
135
|
-
'style-src': _concatInstanceProperty__default
|
|
137
|
+
'style-src': _concatInstanceProperty__default["default"](_context6 = ["'self'", 'fonts.googleapis.com', 'data:']).call(_context6,
|
|
136
138
|
// TODO: investigate what needs to be done to avoid unsafe-inline styles
|
|
137
139
|
// https://github.com/commercetools/merchant-center-frontend/pull/5223#discussion_r210367636
|
|
138
140
|
["'unsafe-inline'"]
|
|
@@ -167,7 +169,9 @@ const processHeaders = applicationConfig => {
|
|
|
167
169
|
|
|
168
170
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
169
171
|
const htmlScripts = {
|
|
170
|
-
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);"
|
|
172
|
+
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
173
|
+
"publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
|
|
174
|
+
}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
171
175
|
const htmlStyles = {
|
|
172
176
|
"loadingScreen": ".loading-screen{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;width:100vw}.loading-screen--hidden{display:none}.loading-screen>*+*{margin:24px 0 0}.loading-spinner{width:32px;height:32px}.long-loading-notice{color:#999;font-family:'Open Sans',sans-serif;font-size:12px}.long-loading-notice--hidden{visibility:hidden}.loading-spinner-circle{fill:#213c45;opacity:.2}@keyframes loading-spinner-animation{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loading-spinner-pointer{transform-origin:20px 20px 0;animation:loading-spinner-animation .5s infinite linear}"
|
|
173
177
|
};
|
|
@@ -179,7 +183,7 @@ const replaceHtmlPlaceholders = (indexHtmlContent, options) => indexHtmlContent.
|
|
|
179
183
|
async function compileHtml(indexHtmlTemplatePath) {
|
|
180
184
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
181
185
|
const compiledHeaders = processHeaders(applicationConfig$1);
|
|
182
|
-
const indexHtmlTemplateContent = fs__default
|
|
186
|
+
const indexHtmlTemplateContent = fs__default["default"].readFileSync(indexHtmlTemplatePath, 'utf8');
|
|
183
187
|
const indexHtmlContent = replaceHtmlPlaceholders(indexHtmlTemplateContent, {
|
|
184
188
|
env: applicationConfig$1.env,
|
|
185
189
|
headers: compiledHeaders
|
|
@@ -20,7 +20,7 @@ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object
|
|
|
20
20
|
import { HTTP_SECURITY_HEADER_KEYS, HTTP_SECURITY_HEADERS } from '@commercetools-frontend/constants';
|
|
21
21
|
import crypto from 'crypto';
|
|
22
22
|
import serialize from 'serialize-javascript';
|
|
23
|
-
export { g as generateTemplate } from './generate-template-
|
|
23
|
+
export { g as generateTemplate } from './generate-template-cd3fdf14.esm.js';
|
|
24
24
|
|
|
25
25
|
function createAssetHash(content) {
|
|
26
26
|
const sha256Hash = crypto.createHash('sha256').update(content).digest('base64');
|
|
@@ -40,7 +40,7 @@ const sanitizeAppEnvironment = env => serialize(env, {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
43
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t),
|
|
43
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context7, _context8; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(t), !0)).call(_context7, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context8 = ownKeys(Object(t))).call(_context8, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
44
44
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
45
45
|
const htmlScripts$1 = {
|
|
46
46
|
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
@@ -144,7 +144,9 @@ const processHeaders = applicationConfig => {
|
|
|
144
144
|
|
|
145
145
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
146
146
|
const htmlScripts = {
|
|
147
|
-
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);"
|
|
147
|
+
"loadingScreen": "window.onAppLoaded=function(){var e=document.querySelector(\"#app-loader\");e&&e.parentNode.removeChild(e)},setTimeout(function(){var e=document.querySelector(\".loading-screen\");e&&e.classList.remove(\"loading-screen--hidden\")},250),setTimeout(function(){var e=document.querySelector(\".long-loading-notice\");e&&e.classList.remove(\"long-loading-notice--hidden\")},2e3);",
|
|
148
|
+
"publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
|
|
149
|
+
}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
148
150
|
const htmlStyles = {
|
|
149
151
|
"loadingScreen": ".loading-screen{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;width:100vw}.loading-screen--hidden{display:none}.loading-screen>*+*{margin:24px 0 0}.loading-spinner{width:32px;height:32px}.long-loading-notice{color:#999;font-family:'Open Sans',sans-serif;font-size:12px}.long-loading-notice--hidden{visibility:hidden}.loading-spinner-circle{fill:#213c45;opacity:.2}@keyframes loading-spinner-animation{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loading-spinner-pointer{transform-origin:20px 20px 0;animation:loading-spinner-animation .5s infinite linear}"
|
|
150
152
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/mc-html-template",
|
|
3
|
-
"version": "27.5.
|
|
3
|
+
"version": "27.5.4",
|
|
4
4
|
"description": "Everything related to render the index.html for a MC application",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@babel/runtime": "^7.22.15",
|
|
40
40
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
41
|
-
"@commercetools-frontend/application-config": "27.5.
|
|
42
|
-
"@commercetools-frontend/constants": "27.5.
|
|
41
|
+
"@commercetools-frontend/application-config": "27.5.4",
|
|
42
|
+
"@commercetools-frontend/constants": "27.5.4",
|
|
43
43
|
"serialize-javascript": "7.0.5",
|
|
44
44
|
"uglify-js": "3.19.3",
|
|
45
45
|
"uglifycss": "0.0.29"
|
|
@@ -6,9 +6,9 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
6
6
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
7
7
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
8
8
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
9
|
-
var generateTemplate = require('../../dist/generate-template-
|
|
9
|
+
var generateTemplate = require('../../dist/generate-template-92ee209d.cjs.dev.js');
|
|
10
10
|
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
12
12
|
|
|
13
13
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
14
14
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -19,24 +19,24 @@ function webpackHtmlTemplate(templateParams) {
|
|
|
19
19
|
var _context, _context2, _context3;
|
|
20
20
|
const cssVendorChunks = [];
|
|
21
21
|
const cssAppChunks = [];
|
|
22
|
-
_forEachInstanceProperty__default
|
|
23
|
-
if (_indexOfInstanceProperty__default
|
|
22
|
+
_forEachInstanceProperty__default["default"](_context = templateParams.htmlWebpackPlugin.files.css).call(_context, file => {
|
|
23
|
+
if (_indexOfInstanceProperty__default["default"](file).call(file, 'vendor') === -1) {
|
|
24
24
|
cssAppChunks.push(file);
|
|
25
25
|
} else {
|
|
26
26
|
cssVendorChunks.push(file);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
const cssChunks = _mapInstanceProperty__default
|
|
30
|
-
const scriptChunks = _mapInstanceProperty__default
|
|
29
|
+
const cssChunks = _mapInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](cssVendorChunks).call(cssVendorChunks, cssAppChunks)).call(_context2, fileName => fileName.replace(/^\//, ''));
|
|
30
|
+
const scriptChunks = _mapInstanceProperty__default["default"](_context3 = templateParams.htmlWebpackPlugin.files.js).call(_context3, fileName =>
|
|
31
31
|
// Trim leading slash, the CDN_URL will ensure to have a trailing slash
|
|
32
32
|
// (see `replaceHtmlPlaceholders`)
|
|
33
33
|
fileName.replace(/^\//, ''));
|
|
34
|
-
const cssImports = _mapInstanceProperty__default
|
|
35
|
-
const scriptImports = _mapInstanceProperty__default
|
|
34
|
+
const cssImports = _mapInstanceProperty__default["default"](cssChunks).call(cssChunks, chunkPath => `<link href="__CDN_URL__${chunkPath}" rel='stylesheet' type='text/css'>`);
|
|
35
|
+
const scriptImports = _mapInstanceProperty__default["default"](scriptChunks).call(scriptChunks, chunkPath => `<script src="__CDN_URL__${chunkPath}" defer></script>`);
|
|
36
36
|
return generateTemplate.generateTemplate({
|
|
37
37
|
cssImports,
|
|
38
38
|
scriptImports
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
exports
|
|
42
|
+
exports["default"] = webpackHtmlTemplate;
|
|
@@ -6,9 +6,9 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
6
6
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
7
7
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
8
8
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
9
|
-
var generateTemplate = require('../../dist/generate-template-
|
|
9
|
+
var generateTemplate = require('../../dist/generate-template-775d54b0.cjs.prod.js');
|
|
10
10
|
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
12
12
|
|
|
13
13
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
14
14
|
var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
|
|
@@ -19,24 +19,24 @@ function webpackHtmlTemplate(templateParams) {
|
|
|
19
19
|
var _context, _context2, _context3;
|
|
20
20
|
const cssVendorChunks = [];
|
|
21
21
|
const cssAppChunks = [];
|
|
22
|
-
_forEachInstanceProperty__default
|
|
23
|
-
if (_indexOfInstanceProperty__default
|
|
22
|
+
_forEachInstanceProperty__default["default"](_context = templateParams.htmlWebpackPlugin.files.css).call(_context, file => {
|
|
23
|
+
if (_indexOfInstanceProperty__default["default"](file).call(file, 'vendor') === -1) {
|
|
24
24
|
cssAppChunks.push(file);
|
|
25
25
|
} else {
|
|
26
26
|
cssVendorChunks.push(file);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
const cssChunks = _mapInstanceProperty__default
|
|
30
|
-
const scriptChunks = _mapInstanceProperty__default
|
|
29
|
+
const cssChunks = _mapInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](cssVendorChunks).call(cssVendorChunks, cssAppChunks)).call(_context2, fileName => fileName.replace(/^\//, ''));
|
|
30
|
+
const scriptChunks = _mapInstanceProperty__default["default"](_context3 = templateParams.htmlWebpackPlugin.files.js).call(_context3, fileName =>
|
|
31
31
|
// Trim leading slash, the CDN_URL will ensure to have a trailing slash
|
|
32
32
|
// (see `replaceHtmlPlaceholders`)
|
|
33
33
|
fileName.replace(/^\//, ''));
|
|
34
|
-
const cssImports = _mapInstanceProperty__default
|
|
35
|
-
const scriptImports = _mapInstanceProperty__default
|
|
34
|
+
const cssImports = _mapInstanceProperty__default["default"](cssChunks).call(cssChunks, chunkPath => `<link href="__CDN_URL__${chunkPath}" rel='stylesheet' type='text/css'>`);
|
|
35
|
+
const scriptImports = _mapInstanceProperty__default["default"](scriptChunks).call(scriptChunks, chunkPath => `<script src="__CDN_URL__${chunkPath}" defer></script>`);
|
|
36
36
|
return generateTemplate.generateTemplate({
|
|
37
37
|
cssImports,
|
|
38
38
|
scriptImports
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
exports
|
|
42
|
+
exports["default"] = webpackHtmlTemplate;
|
|
@@ -2,7 +2,7 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
2
2
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
3
3
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
4
4
|
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
5
|
-
import { g as generateTemplate } from '../../dist/generate-template-
|
|
5
|
+
import { g as generateTemplate } from '../../dist/generate-template-cd3fdf14.esm.js';
|
|
6
6
|
|
|
7
7
|
function webpackHtmlTemplate(templateParams) {
|
|
8
8
|
var _context, _context2, _context3;
|
/package/dist/{generate-template-Dqgy-ei1.cjs.dev.js → generate-template-775d54b0.cjs.prod.js}
RENAMED
|
File without changes
|
/package/dist/{generate-template-Dqgy-ei1.cjs.prod.js → generate-template-92ee209d.cjs.dev.js}
RENAMED
|
File without changes
|
|
File without changes
|