@commercetools-frontend/mc-html-template 27.5.1 → 27.5.3
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 +21 -25
- package/dist/commercetools-frontend-mc-html-template.cjs.prod.js +21 -25
- package/dist/commercetools-frontend-mc-html-template.esm.js +3 -5
- 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-cd3fdf14.esm.js → generate-template-BRTX4i2Q.esm.js} +0 -0
- /package/dist/{generate-template-775d54b0.cjs.prod.js → generate-template-Dqgy-ei1.cjs.dev.js} +0 -0
- /package/dist/{generate-template-92ee209d.cjs.dev.js → generate-template-Dqgy-ei1.cjs.prod.js} +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var fs = require('fs');
|
|
6
4
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
7
5
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
@@ -24,9 +22,9 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
24
22
|
var constants = require('@commercetools-frontend/constants');
|
|
25
23
|
var crypto = require('crypto');
|
|
26
24
|
var serialize = require('serialize-javascript');
|
|
27
|
-
var generateTemplate = require('./generate-template-
|
|
25
|
+
var generateTemplate = require('./generate-template-Dqgy-ei1.cjs.dev.js');
|
|
28
26
|
|
|
29
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
27
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
28
|
|
|
31
29
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
32
30
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -48,7 +46,7 @@ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
|
48
46
|
var serialize__default = /*#__PURE__*/_interopDefault(serialize);
|
|
49
47
|
|
|
50
48
|
function createAssetHash(content) {
|
|
51
|
-
const sha256Hash = crypto__default
|
|
49
|
+
const sha256Hash = crypto__default.default.createHash('sha256').update(content).digest('base64');
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* NOTE:
|
|
@@ -60,43 +58,43 @@ function createAssetHash(content) {
|
|
|
60
58
|
return `sha256-${sha256Hash}`;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
const sanitizeAppEnvironment = env => serialize__default
|
|
61
|
+
const sanitizeAppEnvironment = env => serialize__default.default(env, {
|
|
64
62
|
isJSON: true
|
|
65
63
|
});
|
|
66
64
|
|
|
67
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
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
|
|
65
|
+
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; }
|
|
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.default(_context7 = ownKeys(Object(t), true)).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; }
|
|
69
67
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
70
68
|
const htmlScripts$1 = {
|
|
71
69
|
"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);",
|
|
72
70
|
"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)};"
|
|
73
71
|
};
|
|
74
|
-
const toArray = value => _Array$isArray__default
|
|
72
|
+
const toArray = value => _Array$isArray__default.default(value) ? value : [value];
|
|
75
73
|
const parseCSPDirectives = function () {
|
|
76
74
|
var _context2;
|
|
77
75
|
for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
76
|
directives[_key] = arguments[_key];
|
|
79
77
|
}
|
|
80
|
-
const mergedDirectives = _reduceInstanceProperty__default
|
|
78
|
+
const mergedDirectives = _reduceInstanceProperty__default.default(directives).call(directives, (mergedDirectives, directive) => {
|
|
81
79
|
var _context;
|
|
82
|
-
return _Object$assign__default
|
|
80
|
+
return _Object$assign__default.default(mergedDirectives, _reduceInstanceProperty__default.default(_context = _Object$keys__default.default(directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
|
|
83
81
|
const existingDirectiveValue = mergedDirectives[directiveKey];
|
|
84
|
-
return _Object$assign__default
|
|
82
|
+
return _Object$assign__default.default(mergedDirectiveValues, {
|
|
85
83
|
[directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
|
|
86
84
|
});
|
|
87
85
|
}, {}));
|
|
88
86
|
}, {});
|
|
89
|
-
return _mapInstanceProperty__default
|
|
87
|
+
return _mapInstanceProperty__default.default(_context2 = _Object$entries__default.default(mergedDirectives)).call(_context2, _ref => {
|
|
90
88
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
91
89
|
directive = _ref2[0],
|
|
92
90
|
value = _ref2[1];
|
|
93
|
-
return `${directive} ${_Array$isArray__default
|
|
91
|
+
return `${directive} ${_Array$isArray__default.default(value) ? value.join(' ') : value}`;
|
|
94
92
|
}).join('; ');
|
|
95
93
|
};
|
|
96
94
|
const parsePermissionsPolicyDirectives = (defaultValue, customDirectives) => {
|
|
97
95
|
var _context3;
|
|
98
|
-
const mergedDirectives = _mapInstanceProperty__default
|
|
99
|
-
const _directive$trim$split = _trimInstanceProperty__default
|
|
96
|
+
const mergedDirectives = _mapInstanceProperty__default.default(_context3 = defaultValue.split(',')).call(_context3, directive => {
|
|
97
|
+
const _directive$trim$split = _trimInstanceProperty__default.default(directive).call(directive).split('='),
|
|
100
98
|
_directive$trim$split2 = _slicedToArray(_directive$trim$split, 2),
|
|
101
99
|
directiveName = _directive$trim$split2[0],
|
|
102
100
|
directiveValue = _directive$trim$split2[1];
|
|
@@ -124,17 +122,17 @@ const processHeaders = applicationConfig => {
|
|
|
124
122
|
* Content Security Policy (CSP)
|
|
125
123
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
126
124
|
*/
|
|
127
|
-
const defaultCSPDirectives = _Object$assign__default
|
|
125
|
+
const defaultCSPDirectives = _Object$assign__default.default({
|
|
128
126
|
'default-src': "'none'",
|
|
129
|
-
'script-src': _concatInstanceProperty__default
|
|
127
|
+
'script-src': _concatInstanceProperty__default.default(_context4 = ["'self'"]).call(_context4, isMcDevEnv ?
|
|
130
128
|
// Allow webpack to load source maps on runtime when errors occur
|
|
131
129
|
// using script tags
|
|
132
|
-
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default
|
|
133
|
-
'connect-src': _concatInstanceProperty__default
|
|
130
|
+
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default.default(htmlScriptsHashes).call(htmlScriptsHashes, assetHash => `'${assetHash}'`)),
|
|
131
|
+
'connect-src': _concatInstanceProperty__default.default(_context5 = ["'self'", 'app.launchdarkly.com', 'clientstream.launchdarkly.com', 'events.launchdarkly.com', 'app.getsentry.com',
|
|
134
132
|
// Match all attempts to load from any subdomain of `sentry.io`
|
|
135
133
|
'*.sentry.io']).call(_context5, isMcDevEnv ? ['ws:', 'localhost:8080', 'webpack-internal:'] : []),
|
|
136
134
|
'img-src': ['*', 'data:'],
|
|
137
|
-
'style-src': _concatInstanceProperty__default
|
|
135
|
+
'style-src': _concatInstanceProperty__default.default(_context6 = ["'self'", 'fonts.googleapis.com', 'data:']).call(_context6,
|
|
138
136
|
// TODO: investigate what needs to be done to avoid unsafe-inline styles
|
|
139
137
|
// https://github.com/commercetools/merchant-center-frontend/pull/5223#discussion_r210367636
|
|
140
138
|
["'unsafe-inline'"]
|
|
@@ -169,9 +167,7 @@ const processHeaders = applicationConfig => {
|
|
|
169
167
|
|
|
170
168
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
171
169
|
const htmlScripts = {
|
|
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
|
|
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);"}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
175
171
|
const htmlStyles = {
|
|
176
172
|
"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}"
|
|
177
173
|
};
|
|
@@ -183,7 +179,7 @@ const replaceHtmlPlaceholders = (indexHtmlContent, options) => indexHtmlContent.
|
|
|
183
179
|
async function compileHtml(indexHtmlTemplatePath) {
|
|
184
180
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
185
181
|
const compiledHeaders = processHeaders(applicationConfig$1);
|
|
186
|
-
const indexHtmlTemplateContent = fs__default
|
|
182
|
+
const indexHtmlTemplateContent = fs__default.default.readFileSync(indexHtmlTemplatePath, 'utf8');
|
|
187
183
|
const indexHtmlContent = replaceHtmlPlaceholders(indexHtmlTemplateContent, {
|
|
188
184
|
env: applicationConfig$1.env,
|
|
189
185
|
headers: compiledHeaders
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var fs = require('fs');
|
|
6
4
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
7
5
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
@@ -24,9 +22,9 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
|
|
|
24
22
|
var constants = require('@commercetools-frontend/constants');
|
|
25
23
|
var crypto = require('crypto');
|
|
26
24
|
var serialize = require('serialize-javascript');
|
|
27
|
-
var generateTemplate = require('./generate-template-
|
|
25
|
+
var generateTemplate = require('./generate-template-Dqgy-ei1.cjs.prod.js');
|
|
28
26
|
|
|
29
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
27
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
28
|
|
|
31
29
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
32
30
|
var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
|
|
@@ -48,7 +46,7 @@ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
|
48
46
|
var serialize__default = /*#__PURE__*/_interopDefault(serialize);
|
|
49
47
|
|
|
50
48
|
function createAssetHash(content) {
|
|
51
|
-
const sha256Hash = crypto__default
|
|
49
|
+
const sha256Hash = crypto__default.default.createHash('sha256').update(content).digest('base64');
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
52
|
* NOTE:
|
|
@@ -60,43 +58,43 @@ function createAssetHash(content) {
|
|
|
60
58
|
return `sha256-${sha256Hash}`;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
const sanitizeAppEnvironment = env => serialize__default
|
|
61
|
+
const sanitizeAppEnvironment = env => serialize__default.default(env, {
|
|
64
62
|
isJSON: true
|
|
65
63
|
});
|
|
66
64
|
|
|
67
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
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
|
|
65
|
+
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; }
|
|
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.default(_context7 = ownKeys(Object(t), true)).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; }
|
|
69
67
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
70
68
|
const htmlScripts$1 = {
|
|
71
69
|
"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);",
|
|
72
70
|
"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)};"
|
|
73
71
|
};
|
|
74
|
-
const toArray = value => _Array$isArray__default
|
|
72
|
+
const toArray = value => _Array$isArray__default.default(value) ? value : [value];
|
|
75
73
|
const parseCSPDirectives = function () {
|
|
76
74
|
var _context2;
|
|
77
75
|
for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
76
|
directives[_key] = arguments[_key];
|
|
79
77
|
}
|
|
80
|
-
const mergedDirectives = _reduceInstanceProperty__default
|
|
78
|
+
const mergedDirectives = _reduceInstanceProperty__default.default(directives).call(directives, (mergedDirectives, directive) => {
|
|
81
79
|
var _context;
|
|
82
|
-
return _Object$assign__default
|
|
80
|
+
return _Object$assign__default.default(mergedDirectives, _reduceInstanceProperty__default.default(_context = _Object$keys__default.default(directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
|
|
83
81
|
const existingDirectiveValue = mergedDirectives[directiveKey];
|
|
84
|
-
return _Object$assign__default
|
|
82
|
+
return _Object$assign__default.default(mergedDirectiveValues, {
|
|
85
83
|
[directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
|
|
86
84
|
});
|
|
87
85
|
}, {}));
|
|
88
86
|
}, {});
|
|
89
|
-
return _mapInstanceProperty__default
|
|
87
|
+
return _mapInstanceProperty__default.default(_context2 = _Object$entries__default.default(mergedDirectives)).call(_context2, _ref => {
|
|
90
88
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
91
89
|
directive = _ref2[0],
|
|
92
90
|
value = _ref2[1];
|
|
93
|
-
return `${directive} ${_Array$isArray__default
|
|
91
|
+
return `${directive} ${_Array$isArray__default.default(value) ? value.join(' ') : value}`;
|
|
94
92
|
}).join('; ');
|
|
95
93
|
};
|
|
96
94
|
const parsePermissionsPolicyDirectives = (defaultValue, customDirectives) => {
|
|
97
95
|
var _context3;
|
|
98
|
-
const mergedDirectives = _mapInstanceProperty__default
|
|
99
|
-
const _directive$trim$split = _trimInstanceProperty__default
|
|
96
|
+
const mergedDirectives = _mapInstanceProperty__default.default(_context3 = defaultValue.split(',')).call(_context3, directive => {
|
|
97
|
+
const _directive$trim$split = _trimInstanceProperty__default.default(directive).call(directive).split('='),
|
|
100
98
|
_directive$trim$split2 = _slicedToArray(_directive$trim$split, 2),
|
|
101
99
|
directiveName = _directive$trim$split2[0],
|
|
102
100
|
directiveValue = _directive$trim$split2[1];
|
|
@@ -124,17 +122,17 @@ const processHeaders = applicationConfig => {
|
|
|
124
122
|
* Content Security Policy (CSP)
|
|
125
123
|
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
126
124
|
*/
|
|
127
|
-
const defaultCSPDirectives = _Object$assign__default
|
|
125
|
+
const defaultCSPDirectives = _Object$assign__default.default({
|
|
128
126
|
'default-src': "'none'",
|
|
129
|
-
'script-src': _concatInstanceProperty__default
|
|
127
|
+
'script-src': _concatInstanceProperty__default.default(_context4 = ["'self'"]).call(_context4, isMcDevEnv ?
|
|
130
128
|
// Allow webpack to load source maps on runtime when errors occur
|
|
131
129
|
// using script tags
|
|
132
|
-
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default
|
|
133
|
-
'connect-src': _concatInstanceProperty__default
|
|
130
|
+
['localhost:*', "'unsafe-inline'"] : _mapInstanceProperty__default.default(htmlScriptsHashes).call(htmlScriptsHashes, assetHash => `'${assetHash}'`)),
|
|
131
|
+
'connect-src': _concatInstanceProperty__default.default(_context5 = ["'self'", 'app.launchdarkly.com', 'clientstream.launchdarkly.com', 'events.launchdarkly.com', 'app.getsentry.com',
|
|
134
132
|
// Match all attempts to load from any subdomain of `sentry.io`
|
|
135
133
|
'*.sentry.io']).call(_context5, isMcDevEnv ? ['ws:', 'localhost:8080', 'webpack-internal:'] : []),
|
|
136
134
|
'img-src': ['*', 'data:'],
|
|
137
|
-
'style-src': _concatInstanceProperty__default
|
|
135
|
+
'style-src': _concatInstanceProperty__default.default(_context6 = ["'self'", 'fonts.googleapis.com', 'data:']).call(_context6,
|
|
138
136
|
// TODO: investigate what needs to be done to avoid unsafe-inline styles
|
|
139
137
|
// https://github.com/commercetools/merchant-center-frontend/pull/5223#discussion_r210367636
|
|
140
138
|
["'unsafe-inline'"]
|
|
@@ -169,9 +167,7 @@ const processHeaders = applicationConfig => {
|
|
|
169
167
|
|
|
170
168
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
171
169
|
const htmlScripts = {
|
|
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
|
|
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);"}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
175
171
|
const htmlStyles = {
|
|
176
172
|
"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}"
|
|
177
173
|
};
|
|
@@ -183,7 +179,7 @@ const replaceHtmlPlaceholders = (indexHtmlContent, options) => indexHtmlContent.
|
|
|
183
179
|
async function compileHtml(indexHtmlTemplatePath) {
|
|
184
180
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
185
181
|
const compiledHeaders = processHeaders(applicationConfig$1);
|
|
186
|
-
const indexHtmlTemplateContent = fs__default
|
|
182
|
+
const indexHtmlTemplateContent = fs__default.default.readFileSync(indexHtmlTemplatePath, 'utf8');
|
|
187
183
|
const indexHtmlContent = replaceHtmlPlaceholders(indexHtmlTemplateContent, {
|
|
188
184
|
env: applicationConfig$1.env,
|
|
189
185
|
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-BRTX4i2Q.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), true)).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,9 +144,7 @@ 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);"
|
|
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
|
|
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);"}; // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
150
148
|
const htmlStyles = {
|
|
151
149
|
"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}"
|
|
152
150
|
};
|
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.3",
|
|
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.3",
|
|
42
|
+
"@commercetools-frontend/constants": "27.5.3",
|
|
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-Dqgy-ei1.cjs.dev.js');
|
|
10
10
|
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? 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-Dqgy-ei1.cjs.prod.js');
|
|
10
10
|
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? 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-BRTX4i2Q.esm.js';
|
|
6
6
|
|
|
7
7
|
function webpackHtmlTemplate(templateParams) {
|
|
8
8
|
var _context, _context2, _context3;
|
|
File without changes
|
/package/dist/{generate-template-775d54b0.cjs.prod.js → generate-template-Dqgy-ei1.cjs.dev.js}
RENAMED
|
File without changes
|
/package/dist/{generate-template-92ee209d.cjs.dev.js → generate-template-Dqgy-ei1.cjs.prod.js}
RENAMED
|
File without changes
|