@speedkit/cli 2.31.1 → 2.32.0
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/dist/helpers/file-helper.d.ts +6 -0
- package/dist/helpers/file-helper.js +6 -0
- package/dist/helpers/race.d.ts +1 -1
- package/dist/helpers/race.js +8 -9
- package/dist/helpers/safe.js +2 -2
- package/dist/models/cli-parameters.js +4 -3
- package/dist/services/athena/athena-service.js +3 -2
- package/dist/services/athena/error/athena-query-error.d.ts +4 -0
- package/dist/services/athena/error/athena-query-error.js +9 -0
- package/dist/services/athena/error/fetch-credentials-error.d.ts +5 -1
- package/dist/services/athena/error/fetch-credentials-error.js +9 -1
- package/dist/services/bundler/bundle-service.js +5 -3
- package/dist/services/bundler/error/bundle-fetch-error.d.ts +3 -0
- package/dist/services/bundler/error/bundle-fetch-error.js +8 -0
- package/dist/services/bundler/error/bundle-resolve-error.d.ts +3 -0
- package/dist/services/bundler/error/bundle-resolve-error.js +8 -0
- package/dist/services/config-api/client.d.ts +1 -1
- package/dist/services/config-api/client.js +29 -7
- package/dist/services/config-api/error/json-response-error.d.ts +3 -1
- package/dist/services/config-api/error/json-response-error.js +4 -1
- package/dist/services/config-api/error/login-error.d.ts +3 -3
- package/dist/services/config-api/error/login-error.js +3 -4
- package/dist/services/config-api/factory/config-api-service-factory.js +2 -1
- package/dist/services/config-api-service.d.ts +3 -0
- package/dist/services/config-api-service.js +3 -0
- package/dist/services/customer-config/customer-config-service-model.d.ts +2 -0
- package/dist/services/customer-config/customer-config-service.js +10 -2
- package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +35 -1
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +112 -112
- package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +290 -108
- package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +8 -8
- package/dist/services/customer-config/templates/config_loadHandler.js.hbs +61 -0
- package/dist/services/deploy/error/file-handler-error.d.ts +4 -0
- package/dist/services/deploy/error/file-handler-error.js +9 -0
- package/dist/services/diff-service.d.ts +3 -0
- package/dist/services/diff-service.js +3 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +2 -4
- package/dist/services/error-handling/error/application-error.d.ts +18 -0
- package/dist/services/error-handling/error/application-error.js +28 -0
- package/dist/services/error-handling/error/config-file-error.d.ts +4 -0
- package/dist/services/error-handling/error/config-file-error.js +9 -0
- package/dist/services/error-handling/error/connection-error.d.ts +4 -0
- package/dist/services/error-handling/error/connection-error.js +9 -0
- package/dist/services/integration-api/error/customer-config-error.d.ts +2 -1
- package/dist/services/integration-api/error/customer-config-error.js +2 -1
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -1
- package/dist/services/integration-api/error/customer-config-legacy-error.js +4 -1
- package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -2
- package/dist/services/integration-api/error/mandatory-file-missing-error.js +4 -4
- package/dist/services/integration-api/error/origin-error.d.ts +2 -1
- package/dist/services/integration-api/error/origin-error.js +2 -1
- package/dist/services/integration-api/error/read-files-error.d.ts +5 -0
- package/dist/services/integration-api/error/read-files-error.js +10 -0
- package/dist/services/integration-api/external/external-file-reader.js +8 -2
- package/dist/services/integration-api/file-reader.js +12 -4
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +1 -0
- package/dist/services/integration-api/handler/customer-config-handler.js +22 -5
- package/dist/services/integration-api/handler/install-resource-handler.js +2 -1
- package/dist/services/integration-api/integration-api-service.js +2 -1
- package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +4 -3
- package/dist/services/integration-api/validator/customer-config-validator.js +1 -1
- package/dist/services/integration-api/validator/mandatory-files-validator.js +6 -2
- package/dist/services/onboarding/error/vm-error.d.ts +3 -1
- package/dist/services/onboarding/error/vm-error.js +4 -1
- package/dist/services/onboarding/fetch-event-handler.js +1 -1
- package/dist/services/onboarding/todo-collector.d.ts +1 -1
- package/dist/services/onboarding/todo-collector.js +2 -2
- package/dist/services/prewarm/csv-reader.js +1 -3
- package/dist/services/prewarm/error/invalid-origin-error.d.ts +2 -1
- package/dist/services/prewarm/error/invalid-origin-error.js +3 -1
- package/dist/services/prewarm/error/read-csv-error.d.ts +4 -5
- package/dist/services/prewarm/error/read-csv-error.js +5 -8
- package/oclif.manifest.json +7 -1
- package/package.json +1 -1
- package/dist/helpers/get-chrome-path.d.ts +0 -7
- package/dist/helpers/get-chrome-path.js +0 -31
- package/dist/helpers/is-executable.d.ts +0 -1
- package/dist/helpers/is-executable.js +0 -15
- package/dist/helpers/watch-files.d.ts +0 -1
- package/dist/helpers/watch-files.js +0 -20
- package/dist/services/deploy/error/create-find-temporary-directory-error.d.ts +0 -4
- package/dist/services/deploy/error/create-find-temporary-directory-error.js +0 -10
- package/dist/services/deploy/error/deploy-app-error.d.ts +0 -2
- package/dist/services/deploy/error/deploy-app-error.js +0 -5
- package/dist/services/deploy/error/no-active-installation-error.d.ts +0 -4
- package/dist/services/deploy/error/no-active-installation-error.js +0 -10
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +0 -5
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +0 -24
- package/dist/services/integration-api/error/handler/origin-handler.d.ts +0 -5
- package/dist/services/integration-api/error/handler/origin-handler.js +0 -22
- package/dist/services/integration-api/error/load-customer-error.d.ts +0 -4
- package/dist/services/integration-api/error/load-customer-error.js +0 -10
|
@@ -1,130 +1,130 @@
|
|
|
1
1
|
{{#unless addPreRendering}}
|
|
2
2
|
{{#if removeLazyLoading}}
|
|
3
|
-
const lazyLoadDefaultConfig = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
const lazyLoadDefaultConfig = {
|
|
4
|
+
attributes: [
|
|
5
|
+
{find: 'data-src', set: 'src'},
|
|
6
|
+
{find: 'data-srcset', set: 'srcset'},
|
|
7
|
+
],
|
|
8
|
+
lazyClass: 'lazyload',
|
|
9
|
+
lazyLoad: false,
|
|
10
|
+
preload: true // preload lazy-removed images in head
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
const lazyLoadList = [
|
|
14
|
-
|
|
13
|
+
const lazyLoadList = [
|
|
14
|
+
// TODO: adjust/replace this exemplary list
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
// Content page's stage image:
|
|
17
|
+
{
|
|
18
|
+
...lazyLoadDefaultConfig,
|
|
19
|
+
parentClasses: [
|
|
20
|
+
'image-with-text-overlay__banner',
|
|
21
|
+
],
|
|
22
|
+
limit: 1
|
|
23
|
+
},
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
// PLP product images:
|
|
26
|
+
{
|
|
27
|
+
...lazyLoadDefaultConfig,
|
|
28
|
+
parentClasses: [
|
|
29
|
+
'product-image__wrapper',
|
|
30
|
+
],
|
|
31
|
+
limit: 4
|
|
32
|
+
},
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
];
|
|
34
|
+
// PDP hero image:
|
|
35
|
+
{
|
|
36
|
+
...lazyLoadDefaultConfig,
|
|
37
|
+
parentClasses: [
|
|
38
|
+
'product-gallery__image',
|
|
39
|
+
],
|
|
40
|
+
limit: 1
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
43
|
|
|
44
44
|
{{/if}}
|
|
45
45
|
{{/unless}}
|
|
46
46
|
const config = {
|
|
47
|
-
rejectHTML({
|
|
47
|
+
rejectHTML({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
48
48
|
/* Use to configure guards to prevent e.g. error and captcha pages from being cached */
|
|
49
49
|
return false;
|
|
50
50
|
},
|
|
51
|
-
blacklistHTML({
|
|
51
|
+
blacklistHTML({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
52
52
|
/* Use to configure guards to black-list e.g. specific page types */
|
|
53
53
|
return false;
|
|
54
54
|
},
|
|
55
|
-
shouldTransform({
|
|
55
|
+
shouldTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
56
56
|
return true;
|
|
57
57
|
},
|
|
58
|
-
shouldDelayDom({
|
|
59
|
-
{{#if isPlentymarkets}}
|
|
60
|
-
|
|
61
|
-
{{else}}
|
|
62
|
-
|
|
63
|
-
{{/if}}
|
|
58
|
+
shouldDelayDom({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
59
|
+
{{#if isPlentymarkets}}
|
|
60
|
+
return false; // Plentymarkets specific
|
|
61
|
+
{{else}}
|
|
62
|
+
return true;
|
|
63
|
+
{{/if}}
|
|
64
64
|
},
|
|
65
65
|
async preTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
66
|
-
{{#unless addPreRendering}}
|
|
67
|
-
|
|
68
|
-
{{else}}
|
|
69
|
-
|
|
70
|
-
{{/unless}}
|
|
66
|
+
{{#unless addPreRendering}}
|
|
67
|
+
return html;
|
|
68
|
+
{{else}}
|
|
69
|
+
// do nothing
|
|
70
|
+
{{/unless}}
|
|
71
71
|
},
|
|
72
72
|
postTransform({db, {{#if addPreRendering}}document{{else}}html{{/if}}, variation, url, headers}) {
|
|
73
|
-
{{#unless addPreRendering}}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{{else}}
|
|
79
|
-
|
|
80
|
-
{{/unless}}
|
|
73
|
+
{{#unless addPreRendering}}
|
|
74
|
+
{{#if includeServiceWorker}}
|
|
75
|
+
html = injectServiceWorkerScript(html, '{{includeServiceWorker}}');
|
|
76
|
+
{{/if}}
|
|
77
|
+
return html;
|
|
78
|
+
{{else}}
|
|
79
|
+
// do nothing
|
|
80
|
+
{{/unless}}
|
|
81
81
|
},
|
|
82
|
-
{{#if isPlentymarkets}}
|
|
83
|
-
|
|
84
|
-
{{/if}}
|
|
85
|
-
{{#if isShopify}}
|
|
86
|
-
delayScriptPath: "/apps/speed-kit/speed-kit-dom-ready.js", // Shopify specific
|
|
87
|
-
{{else}}
|
|
88
|
-
delayScriptPath: "/speed-kit-dom-ready.js",
|
|
89
|
-
{{/if}}
|
|
90
|
-
executeDeploymentDetection: true,
|
|
91
|
-
{{#unless addPreRendering}}
|
|
92
|
-
{{#if removeLazyLoading}}
|
|
93
|
-
lazyLoadList,
|
|
82
|
+
{{#if isPlentymarkets}}
|
|
83
|
+
stripComments: false, // Plentymarkets specific
|
|
94
84
|
{{/if}}
|
|
95
|
-
{{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
rules: {
|
|
113
|
-
url: [
|
|
114
|
-
// additional domains for the page to work need to be added here (main domain is already added)
|
|
115
|
-
'<scripts-domain.com>',
|
|
85
|
+
{{#if isShopify}}
|
|
86
|
+
delayScriptPath: "/apps/speed-kit/speed-kit-dom-ready.js", // Shopify specific
|
|
87
|
+
{{else}}
|
|
88
|
+
delayScriptPath: "/speed-kit-dom-ready.js",
|
|
89
|
+
{{/if}}
|
|
90
|
+
executeDeploymentDetection: true,
|
|
91
|
+
{{#unless addPreRendering}}
|
|
92
|
+
{{#if removeLazyLoading}}
|
|
93
|
+
lazyLoadList,
|
|
94
|
+
{{/if}}
|
|
95
|
+
{{else}}
|
|
96
|
+
preRender: {
|
|
97
|
+
lambdaUrl: 'https://pw5wfiqnr2kqdzzc45tu3rdjue0zildl.lambda-url.eu-central-1.on.aws',
|
|
98
|
+
elements: [
|
|
99
|
+
// app shell e.g. vue often uses #app
|
|
100
|
+
// this will be the main element to extract from the rendered DOM
|
|
101
|
+
{selector: '#app'}
|
|
116
102
|
],
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
103
|
+
guards: [
|
|
104
|
+
{ // plp
|
|
105
|
+
whenPresent: '.products-list-page', // check wait for selectors, when this is present on current Page
|
|
106
|
+
waitFor: [
|
|
107
|
+
// e.g. wait for first 4 images to be loaded
|
|
108
|
+
'.products-list-page__products-list .products-list__tiles__element:nth-child(-n+4) img[src=""]',
|
|
109
|
+
],
|
|
110
|
+
},
|
|
124
111
|
],
|
|
112
|
+
rules: {
|
|
113
|
+
url: [
|
|
114
|
+
// additional domains for the page to work need to be added here (main domain is already added)
|
|
115
|
+
'<scripts-domain.com>',
|
|
116
|
+
],
|
|
117
|
+
resourceType: [
|
|
118
|
+
// only resource types listed here will be fetched
|
|
119
|
+
'xhr',
|
|
120
|
+
'font',
|
|
121
|
+
'script',
|
|
122
|
+
'document',
|
|
123
|
+
'stylesheet',
|
|
124
|
+
],
|
|
125
|
+
},
|
|
125
126
|
},
|
|
126
|
-
}
|
|
127
|
-
{{/unless}}
|
|
127
|
+
{{/unless}}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
const documentHandler = new DocumentHandler({
|
|
@@ -139,19 +139,19 @@ export const post = async (db, req, res) => {
|
|
|
139
139
|
await documentHandler.transformAndSend(db, req, res);
|
|
140
140
|
}
|
|
141
141
|
{{#unless addPreRendering}}
|
|
142
|
-
{{#if includeServiceWorker}}
|
|
142
|
+
{{#if includeServiceWorker}}
|
|
143
143
|
|
|
144
|
-
//================================================================================
|
|
145
|
-
// Utility Functions
|
|
146
|
-
//================================================================================
|
|
144
|
+
//================================================================================
|
|
145
|
+
// Utility Functions
|
|
146
|
+
//================================================================================
|
|
147
147
|
|
|
148
|
-
function prepend(string, searchString, prependString) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
148
|
+
function prepend(string, searchString, prependString) {
|
|
149
|
+
const index = string.lastIndexOf(searchString);
|
|
150
|
+
return string.slice(0, index) + prependString + string.slice(index);
|
|
151
|
+
}
|
|
152
152
|
|
|
153
|
-
function injectServiceWorkerScript(html, searchedSwPath) {
|
|
154
|
-
|
|
153
|
+
function injectServiceWorkerScript(html, searchedSwPath) {
|
|
154
|
+
return prepend(html, '</head>', `
|
|
155
155
|
<script class="speed-kit-service-worker">
|
|
156
156
|
var serviceWorkerRegister = ServiceWorkerContainer.prototype.register;
|
|
157
157
|
ServiceWorkerContainer.prototype.register = function (swPath, options) {
|
|
@@ -162,6 +162,6 @@ function injectServiceWorkerScript(html, searchedSwPath) {
|
|
|
162
162
|
};
|
|
163
163
|
</script>
|
|
164
164
|
`);
|
|
165
|
-
}
|
|
166
|
-
{{/if}}
|
|
165
|
+
}
|
|
166
|
+
{{/if}}
|
|
167
167
|
{{/unless}}
|