@speedkit/cli 4.20.0 → 4.20.1
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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.20.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.20.0...v4.20.1) (2026-08-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **customer-config:** marker detectDevice reads the passed doc, not document ([6f1b697](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/6f1b697b52cc6786c7e975edfcbc85c52750749b))
|
|
7
|
+
|
|
1
8
|
# [4.20.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.19.0...v4.20.0) (2026-08-07)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -34,14 +34,23 @@
|
|
|
34
34
|
|
|
35
35
|
{{#if isShopify}}
|
|
36
36
|
import { ShopifyPlugin } from "speed-kit-config/ShopifyPlugin";
|
|
37
|
+
{{/if}}
|
|
38
|
+
{{#if addSSR}}
|
|
39
|
+
import { SSRPlugin } from "speed-kit-config/SSRPlugin";
|
|
40
|
+
{{/if}}
|
|
37
41
|
|
|
38
42
|
(function() {
|
|
43
|
+
{{#if isShopify}}
|
|
39
44
|
SpeedKit.configPlugins = SpeedKit.configPlugins || [];
|
|
40
45
|
SpeedKit.configPlugins.push(new ShopifyPlugin());
|
|
41
|
-
|
|
42
|
-
{{else}}
|
|
43
|
-
(function() {
|
|
44
46
|
{{/if}}
|
|
47
|
+
{{#if addSSR}}
|
|
48
|
+
{{#unless isShopify}}
|
|
49
|
+
SpeedKit.configPlugins = SpeedKit.configPlugins || [];
|
|
50
|
+
{{/unless}}
|
|
51
|
+
SpeedKit.configPlugins.push(new SSRPlugin());
|
|
52
|
+
{{/if}}
|
|
53
|
+
|
|
45
54
|
var ENABLED_HOSTS_CONFIGS = [
|
|
46
55
|
// Production:
|
|
47
56
|
{
|
|
@@ -98,15 +107,20 @@ import { ShopifyPlugin } from "speed-kit-config/ShopifyPlugin";
|
|
|
98
107
|
rumTracking: true,
|
|
99
108
|
{{#if addDeviceDetection}}
|
|
100
109
|
{{#unless addSSR}}
|
|
110
|
+
// Server-side responsive: origin returns different HTML per device (UA-keyed).
|
|
101
111
|
userAgentDetection: true,
|
|
102
112
|
detectDevice: function(doc) {
|
|
103
|
-
// TODO:
|
|
113
|
+
// TODO: set a marker present only in the mobile variation. Read it from `doc`.
|
|
104
114
|
return doc.querySelector('<mobile-specific-element>') ? "mobile" : "desktop";
|
|
105
115
|
},
|
|
106
116
|
{{/unless}}
|
|
107
117
|
{{#if addSSR}}
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
// SSR: pick the device by viewport width; SSRPlugin (above) handles resize/zoom/bfcache.
|
|
119
|
+
detectDevice: function(doc) {
|
|
120
|
+
// TODO: set the real breakpoint — discover it, don't guess (tools/sk-breakpoints.mjs).
|
|
121
|
+
var width = document.documentElement.clientWidth;
|
|
122
|
+
if (!width) return null;
|
|
123
|
+
return width <= 820 ? "mobile" : "desktop";
|
|
110
124
|
},
|
|
111
125
|
{{/if}}
|
|
112
126
|
{{/if}}
|
|
@@ -458,29 +472,6 @@ import { ShopifyPlugin } from "speed-kit-config/ShopifyPlugin";
|
|
|
458
472
|
// Utility Functions
|
|
459
473
|
//================================================================================
|
|
460
474
|
|
|
461
|
-
{{#if addSSR}}
|
|
462
|
-
function customDevice() {
|
|
463
|
-
var width = window.innerWidth || 1025;
|
|
464
|
-
// TODO: adjust devices + breakpoints to your needs
|
|
465
|
-
if (width <= 820) {
|
|
466
|
-
return "mobile";
|
|
467
|
-
}
|
|
468
|
-
return "desktop";
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Re-evaluate device on orientation change and push to service worker
|
|
472
|
-
window.addEventListener("orientationchange", function () {
|
|
473
|
-
if (typeof SpeedKit !== "undefined" && SpeedKit.updateDevice) {
|
|
474
|
-
SpeedKit.updateDevice(customDevice());
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
window.addEventListener("resize", function () {
|
|
478
|
-
if (typeof SpeedKit !== "undefined" && SpeedKit.updateDevice) {
|
|
479
|
-
SpeedKit.updateDevice(customDevice());
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
{{/if}}
|
|
483
|
-
|
|
484
475
|
function getEnabledHosts(enabledHostsConfigs) {
|
|
485
476
|
var allHosts = [];
|
|
486
477
|
enabledHostsConfigs.forEach(function (enabledHostsConfig) {
|
|
@@ -7,12 +7,19 @@
|
|
|
7
7
|
{{#if addDeviceDetection}}
|
|
8
8
|
{{#unless addSSR}}
|
|
9
9
|
detectDevice: (doc) => {
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
// TODO: adjust condition to your needs
|
|
10
|
+
// Only if you need a DOM marker; for width checks the SK config's detectDevice suffices.
|
|
11
|
+
// TODO: set a marker present only in the mobile variation. Read it from `doc`.
|
|
13
12
|
return doc.querySelector('<mobile-specific-element>') ? "mobile" : "desktop";
|
|
14
13
|
},
|
|
15
14
|
{{/unless}}
|
|
15
|
+
{{#if addSSR}}
|
|
16
|
+
// Mirror config_SpeedKit.js detectDevice — keep the breakpoint identical.
|
|
17
|
+
detectDevice: (doc) => {
|
|
18
|
+
let width = document.documentElement.clientWidth;
|
|
19
|
+
if (!width) return null;
|
|
20
|
+
return width <= 820 ? "mobile" : "desktop";
|
|
21
|
+
},
|
|
22
|
+
{{/if}}
|
|
16
23
|
{{/if}}
|
|
17
24
|
blocks: [
|
|
18
25
|
// TODO: adjust/replace this exemplary list
|
package/oclif.manifest.json
CHANGED