@speedkit/cli 2.70.0 → 2.71.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 +15 -0
- package/README.md +1 -1
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +22 -0
- package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +0 -14
- package/dist/services/prewarm/assets/asset-api-client.d.ts +16 -0
- package/dist/services/prewarm/assets/asset-api-client.js +29 -3
- package/dist/services/prewarm/pre-warm-model.d.ts +1 -0
- package/dist/services/prewarm/pre-warm-model.js +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [2.71.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.70.1...v2.71.0) (2024-12-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **wizard:** lambda add initial hiding of shadow-dom and un-hide when rendered ([dddfd62](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/dddfd62791754558ae7481914c1be3eef65ffc8f))
|
|
7
|
+
* **wizard:** remove legacy dynamic blocks lambda server-side rendering related code ([3ee1e4a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/3ee1e4a755b21b28f56aa4f2e74f910e093be6ba))
|
|
8
|
+
|
|
9
|
+
## [2.70.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.70.0...v2.70.1) (2024-12-12)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **prewarm:** set variationString in correct case ([627959d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/627959d1d997601840c13a679a304b573c985e6f))
|
|
15
|
+
|
|
1
16
|
# [2.70.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.69.1...v2.70.0) (2024-12-12)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -98,6 +98,8 @@ const config = {
|
|
|
98
98
|
assignStylesToShadowDom(document);
|
|
99
99
|
addDeclarativeShadowDOMPolyfill(document);
|
|
100
100
|
addPolyFillAfterMainPreRenderTemplate(document);
|
|
101
|
+
hideCustomShadowDom(document);
|
|
102
|
+
showCustomShadowDom(document);
|
|
101
103
|
{{/unless}}
|
|
102
104
|
{{#if supportShadowDomInPreRendering}}
|
|
103
105
|
overrideCustomElementDefine(document);
|
|
@@ -350,6 +352,26 @@ export const post = async (db, req, res) => {
|
|
|
350
352
|
topTemplate.after(polyfillScript);
|
|
351
353
|
});
|
|
352
354
|
}
|
|
355
|
+
|
|
356
|
+
function hideCustomShadowDom(document) {
|
|
357
|
+
const customShadowRoots = getCustomShadowElements(document);
|
|
358
|
+
|
|
359
|
+
customShadowRoots.forEach((element) => {
|
|
360
|
+
const style = document.createElement("style");
|
|
361
|
+
style.textContent = `.speed-kit-pre-rendered-block-added{visibility:hidden;}`;
|
|
362
|
+
element.prepend(style);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function showCustomShadowDom(document) {
|
|
367
|
+
const customShadowRoots = getCustomShadowElements(document);
|
|
368
|
+
|
|
369
|
+
customShadowRoots.forEach((element) => {
|
|
370
|
+
const style = document.createElement("style");
|
|
371
|
+
style.textContent = `.speed-kit-pre-rendered-block-added{visibility:visible;}`;
|
|
372
|
+
element.appendChild(style);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
353
375
|
{{#if supportShadowDomInPreRendering}}
|
|
354
376
|
//================================================================================
|
|
355
377
|
// PuppeteerCallback
|
|
@@ -13,20 +13,6 @@
|
|
|
13
13
|
{{/if}}
|
|
14
14
|
|
|
15
15
|
blocks: [
|
|
16
|
-
{{#if addPreRendering}}
|
|
17
|
-
{{#unless supportShadowDomInPreRendering}}
|
|
18
|
-
...preRenderedRootConfig.map((config) => {
|
|
19
|
-
return {
|
|
20
|
-
selector: config.selector,
|
|
21
|
-
merge: (localBlock, remoteBlock) => {
|
|
22
|
-
handlePreRenderBlock(localBlock, remoteBlock);
|
|
23
|
-
},
|
|
24
|
-
detectChanges: false,
|
|
25
|
-
};
|
|
26
|
-
}),
|
|
27
|
-
|
|
28
|
-
{{/unless}}
|
|
29
|
-
{{/if}}
|
|
30
16
|
// TODO: adjust/replace this exemplary list
|
|
31
17
|
{
|
|
32
18
|
{{#if addPreRendering}}
|
|
@@ -14,4 +14,20 @@ export declare class AssetApiClient {
|
|
|
14
14
|
increaseMaxRequestsPerSecond(): void;
|
|
15
15
|
private isValidUrl;
|
|
16
16
|
private setRateLimit;
|
|
17
|
+
/**
|
|
18
|
+
* handle parameter "bqvariation"
|
|
19
|
+
* reflect behaviour of SpeedKit.
|
|
20
|
+
* - do not send default variation
|
|
21
|
+
* - send mobile/tablet/tv as lowercase
|
|
22
|
+
* - send customVariations as they are
|
|
23
|
+
*
|
|
24
|
+
* As orestes will always make variations uppercase and does not care for caseSensitivity,
|
|
25
|
+
* a caseMissMatch on fastly will also resolve in a cacheMiss.
|
|
26
|
+
* That is why we need to preWarm in the correct case always.
|
|
27
|
+
*
|
|
28
|
+
* @param variation
|
|
29
|
+
* @param assetUrl
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
private setVariationParameter;
|
|
17
33
|
}
|
|
@@ -27,9 +27,7 @@ class AssetApiClient {
|
|
|
27
27
|
async fetchURL(url, variation) {
|
|
28
28
|
this.isValidUrl(url);
|
|
29
29
|
const assetUrl = new node_url_1.URL((0, normalize_1.normalize)(url, this.sortParameters));
|
|
30
|
-
|
|
31
|
-
assetUrl.searchParams.set("bqvariation", variation);
|
|
32
|
-
}
|
|
30
|
+
this.setVariationParameter(variation, assetUrl);
|
|
33
31
|
assetUrl.searchParams.set("bqpass", "1");
|
|
34
32
|
return (0, node_fetch_1.default)(`https://${this.app}.app.baqend.com/v1/asset/${assetUrl.toString()}`, {
|
|
35
33
|
agent: this.agent,
|
|
@@ -68,5 +66,33 @@ class AssetApiClient {
|
|
|
68
66
|
setRateLimit(limit) {
|
|
69
67
|
this.rateLimit = limit > 1 ? Math.floor(limit) : 1;
|
|
70
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* handle parameter "bqvariation"
|
|
71
|
+
* reflect behaviour of SpeedKit.
|
|
72
|
+
* - do not send default variation
|
|
73
|
+
* - send mobile/tablet/tv as lowercase
|
|
74
|
+
* - send customVariations as they are
|
|
75
|
+
*
|
|
76
|
+
* As orestes will always make variations uppercase and does not care for caseSensitivity,
|
|
77
|
+
* a caseMissMatch on fastly will also resolve in a cacheMiss.
|
|
78
|
+
* That is why we need to preWarm in the correct case always.
|
|
79
|
+
*
|
|
80
|
+
* @param variation
|
|
81
|
+
* @param assetUrl
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
setVariationParameter(variation, assetUrl) {
|
|
85
|
+
// on default or desktop do net set variationParam
|
|
86
|
+
if (variation === "default" || variation === "desktop") {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// on tv|tablet|mobile set variation as lowerCase
|
|
90
|
+
if (__1.DEFAULT_VARIATIONS.includes(variation.toLowerCase())) {
|
|
91
|
+
assetUrl.searchParams.set("bqvariation", variation.toLowerCase());
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// on any other customVariation set variation as it is
|
|
95
|
+
assetUrl.searchParams.set("bqvariation", variation);
|
|
96
|
+
}
|
|
71
97
|
}
|
|
72
98
|
exports.AssetApiClient = AssetApiClient;
|
|
@@ -37,3 +37,4 @@ export declare const TIMING_HEADER_KEY = "server-timing";
|
|
|
37
37
|
export declare const PROGRESS_BAR_FORMAT = "[{bar}] {percentage}% | ETA: {eta}s | {value}/{total} | error:{errors} | rate: {rate} | retry: {retry}";
|
|
38
38
|
export declare const VARIATION_SEPARATOR = ",";
|
|
39
39
|
export declare const DEFAULT_VARIATION: string[];
|
|
40
|
+
export declare const DEFAULT_VARIATIONS: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_VARIATION = exports.VARIATION_SEPARATOR = exports.PROGRESS_BAR_FORMAT = exports.TIMING_HEADER_KEY = exports.TIMING_HEADER_ERROR_CODE_SELECTOR = exports.RATE_LIMIT_CODES = exports.RATE_LIMIT_MULTIPLICATOR = exports.MAX_REQUESTS_PER_SECOND = exports.DEFAULT_REQUESTS_PER_SECOND = exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = exports.FETCH_TIMEOUT = exports.MIN_TIME_TO_FETCH_BATCH = exports.ItemStatus = exports.PreWarmContext = void 0;
|
|
3
|
+
exports.DEFAULT_VARIATIONS = exports.DEFAULT_VARIATION = exports.VARIATION_SEPARATOR = exports.PROGRESS_BAR_FORMAT = exports.TIMING_HEADER_KEY = exports.TIMING_HEADER_ERROR_CODE_SELECTOR = exports.RATE_LIMIT_CODES = exports.RATE_LIMIT_MULTIPLICATOR = exports.MAX_REQUESTS_PER_SECOND = exports.DEFAULT_REQUESTS_PER_SECOND = exports.TIMOUT_AFTER_DETECTED_RATE_LIMIT = exports.FETCH_TIMEOUT = exports.MIN_TIME_TO_FETCH_BATCH = exports.ItemStatus = exports.PreWarmContext = void 0;
|
|
4
4
|
class PreWarmContext {
|
|
5
5
|
app;
|
|
6
6
|
path;
|
|
@@ -36,4 +36,5 @@ exports.TIMING_HEADER_ERROR_CODE_SELECTOR = /errorcode;desc=([^,]*),/;
|
|
|
36
36
|
exports.TIMING_HEADER_KEY = "server-timing";
|
|
37
37
|
exports.PROGRESS_BAR_FORMAT = "[{bar}] {percentage}% | ETA: {eta}s | {value}/{total} | error:{errors} | rate: {rate} | retry: {retry}";
|
|
38
38
|
exports.VARIATION_SEPARATOR = ",";
|
|
39
|
-
exports.DEFAULT_VARIATION = ["
|
|
39
|
+
exports.DEFAULT_VARIATION = ["default"];
|
|
40
|
+
exports.DEFAULT_VARIATIONS = ["mobile", "tablet", "tv"];
|
package/oclif.manifest.json
CHANGED