@speedkit/cli 3.38.0 → 3.40.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 CHANGED
@@ -1,3 +1,18 @@
1
+ # [3.40.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.39.0...v3.40.0) (2026-04-01)
2
+
3
+
4
+ ### Features
5
+
6
+ * **customer-conifg:** add encouragement for url documentation for selectors ([b56e615](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b56e6155e37dd0f74a6b5978308582d4a7a9750b))
7
+
8
+ # [3.39.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.38.0...v3.39.0) (2026-04-01)
9
+
10
+
11
+ ### Features
12
+
13
+ * add activeSiteCheck as default ([947edda](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/947eddac5f716d05b8f3dc516ddbdad2e44ff16e))
14
+ * implement new soft2HardNavPlugin ([6d29110](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/6d29110a1851048fdf16fa6ad0520a5a908f492e))
15
+
1
16
  # [3.38.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.37.0...v3.38.0) (2026-03-31)
2
17
 
3
18
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/3.38.0 linux-x64 node-v20.20.2
24
+ @speedkit/cli/3.40.0 linux-x64 node-v20.20.2
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -20,6 +20,7 @@
20
20
  ...lazyLoadDefaultConfig,
21
21
  elementSelectors: [
22
22
  '.image-with-text-overlay__banner',
23
+ // e.g. <example-url>
23
24
  ],
24
25
  limit: 1
25
26
  },
@@ -29,6 +30,7 @@
29
30
  ...lazyLoadDefaultConfig,
30
31
  elementSelectors: [
31
32
  '.product-image__wrapper',
33
+ // e.g. <example-url>
32
34
  ],
33
35
  limit: 4
34
36
  },
@@ -38,6 +40,7 @@
38
40
  ...lazyLoadDefaultConfig,
39
41
  elementSelectors: [
40
42
  '.product-gallery__image',
43
+ // e.g. <example-url>
41
44
  ],
42
45
  limit: 1
43
46
  },
@@ -167,8 +170,13 @@ const config = {
167
170
  {
168
171
  whenPresent: 'body > #app',
169
172
  waitFor: [
170
- // e.g. wait for first 4 images to be loaded
171
- '.products-list-page__products-list .products-list__tiles__element:nth-child(-n+4) img[src=""]',
173
+ // TODO: adjust/replace this exemplary list
174
+
175
+ // PLP wait for first image to be loaded
176
+ // e.g. <example-url>
177
+ '.products-list-page__products-list .products-list__tiles__element:first-child img[src]',
178
+ // or the no results disclaimer appears:
179
+ '.products-list-page__products-list .no-results-found',
172
180
  ],
173
181
  {{#if addSSRInnerShadowDomSupport}}
174
182
  waitForCallback: waitForCallback.toString(),
@@ -39,12 +39,14 @@
39
39
  },
40
40
 
41
41
  // Stage Teaser:
42
+ // e.g. <example-url>
42
43
  {
43
44
  find: ".stage-teaser source",
44
45
  compare: ["srcset"],
45
46
  },
46
47
 
47
48
  // PLP Items:
49
+ // e.g. <example-url>
48
50
  {
49
51
  find: ".product-grid .product img",
50
52
  limit: 9, // only compare the first 9 products
@@ -52,6 +54,7 @@
52
54
  },
53
55
 
54
56
  // PDP Hero Image:
57
+ // e.g. <example-url>
55
58
  {
56
59
  find: ".product-detail .slide.main img",
57
60
  compare: ["src"],
@@ -124,12 +127,14 @@
124
127
  },
125
128
 
126
129
  // Stage Teaser:
130
+ // e.g. <example-url>
127
131
  {
128
132
  find: ".stage-teaser source",
129
133
  compare: ["srcset"],
130
134
  },
131
135
 
132
136
  // PLP Items:
137
+ // e.g. <example-url>
133
138
  {
134
139
  find: ".product-grid .product img",
135
140
  limit: 9, // only compare the first 9 products
@@ -137,6 +142,7 @@
137
142
  },
138
143
 
139
144
  // PDP Hero Image:
145
+ // e.g. <example-url>
140
146
  {
141
147
  find: ".product-detail .slide.main img",
142
148
  compare: ["src"],
@@ -48,7 +48,31 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
48
48
  }
49
49
  {{/if}}),
50
50
  {{#if hasSoftNavigations}}
51
- new SpaBundle(), // Soft Navigation Tracking using History API
51
+ {{#if convertSoftToHardNavigations}}
52
+ new SpaBundle({
53
+ enforceHardNavigation: {
54
+ /**
55
+ * @todo add selectors or urls to filter links that should never be converted
56
+ *
57
+ * @param url {string}
58
+ * @param element {HTMLAnchorElement}
59
+ * @returns {boolean}
60
+ */
61
+ filter: (url, element) => {
62
+ // var isMainMenu = element.closest("#MAIN_NAVIGATION_MENU,.burger-menu-body");
63
+ // if(isMainMenu) return false
64
+
65
+ // checks if the currentSite is enabled and an active site
66
+ var isActiveSite =
67
+ SpeedKit.isPageTypeEnabled(location.href) ||
68
+ (speedKit.activeSites ?? []).some((rule) => SpeedKit.testSpeedKitRule(rule, location, speedKit));
69
+ return isActiveSite;
70
+ },
71
+ },
72
+ }), // Soft Navigation Tracking using History API
73
+ {{else}}
74
+ new SpaBundle(), // Soft Navigation Tracking using History API
75
+ {{/if}}
52
76
  {{/if}}
53
77
  {{#if useGATracking}}
54
78
  new GAEcommerceTrackingPlugin({
@@ -271,22 +295,6 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
271
295
  },
272
296
  {{/if}}
273
297
  {{/if}}
274
- {{#if convertSoftToHardNavigations}}
275
- {
276
- on: "domInteractive",
277
- track: () => {
278
- if (
279
- // check that dashboard is not disabled and user is in group A
280
- window?.SpeedKit?.lastNavigate?.disconnectCause?.indexOf("DashboardDisabled") > -1 ||
281
- !window?.SpeedKit?.skSupported ||
282
- window?.SpeedKit?.group !== "A"
283
- ) {
284
- return;
285
- }
286
- convertSoftToHardNavigation();
287
- },
288
- },
289
- {{/if}}
290
298
  {{#if isPlentymarkets}}
291
299
  {
292
300
  on: "domInteractive",
@@ -385,84 +393,6 @@ import { PredictivePreloading } from 'predictive-preloading/predictivePreloading
385
393
  });
386
394
  {{/if}}
387
395
 
388
- {{#if convertSoftToHardNavigations}}
389
- function softNavShouldBeConverted(url) {
390
- // no link item found
391
- if (!url || url === location.href) {
392
- return false;
393
- }
394
-
395
- try {
396
- // Always resolve the target relative to the current location
397
- var resolvedTarget = new URL(url, location.href);
398
-
399
- if (location.origin !== resolvedTarget?.origin) {
400
- return false;
401
- }
402
-
403
- // must be a different path
404
- if (location.pathname === resolvedTarget?.pathname) {
405
- return false;
406
- }
407
-
408
- if (!SpeedKit?.isPageTypeEnabled(resolvedTarget.href)) {
409
- return false;
410
- }
411
-
412
- if (
413
- // speedKit sw is known
414
- window?.speedKit?.sw &&
415
- // can detect sw
416
- navigator?.serviceWorker?.controller?.scriptURL &&
417
- navigator.serviceWorker.controller.scriptURL.indexOf(new URL(window.speedKit.sw, location.origin).pathname) > -1
418
- ) {
419
- return true;
420
- }
421
- } catch (e) {}
422
- return false;
423
- }
424
-
425
- function convertSoftToHardNavigation() {
426
- function speedKitClickEventListener(event) {
427
- var target = event.target.closest("a");
428
-
429
- // Drop out if no link address is found or the target is the current page
430
- if (!target || !target.href || target.href === location.href) {
431
- return;
432
- }
433
-
434
- // Don't convert to hard navigation if it is just a product variant switch
435
- // TODO: adjust conditions to customer-specific implementation as needed
436
- var targetPathname = new URL(target.href).pathname;
437
- var isPDP = targetPathname.indexOf("/p/") !== -1;
438
- var isSamePathname = new URL(location.href).pathname === targetPathname;
439
- var variantSwitchIdentifier = target.matches('.color-option, .size-option, .swatch-option');
440
- if (
441
- (isPDP && isSamePathname) || // url-based check
442
- variantSwitchIdentifier // element-based check
443
- ) {
444
- return;
445
- }
446
-
447
- // Check if the target is enabled by SpeedKit and is a valid page for conversion
448
- if (!softNavShouldBeConverted(target?.href)) {
449
- return;
450
- }
451
-
452
- // Prevent soft navigation
453
- event.preventDefault();
454
- setTimeout(() => {
455
- // let potential click listener be completed
456
-
457
- //Execute hard navigation instead
458
- location.href = target.href;
459
- });
460
- }
461
- window.addEventListener("click", speedKitClickEventListener, true);
462
- }
463
-
464
- {{/if}}
465
-
466
396
  // TODO: check if prerendering needs to be scoped to certain pages
467
397
  new PredictivePreloading({ prerender: true });
468
398
  }();
@@ -751,5 +751,5 @@
751
751
  ]
752
752
  }
753
753
  },
754
- "version": "3.38.0"
754
+ "version": "3.40.0"
755
755
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "3.38.0",
4
+ "version": "3.40.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"