jekyll-client-search 0.3.3 → 0.3.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60acab6161a3d4eafb265742c337c86bbc26e444bc0ce202a02e5ce80049c3f0
4
- data.tar.gz: bf05aa7d4945bb3e82acd8ab5127ab2e84bb457eb9868f79d235a8a5ce701a53
3
+ metadata.gz: 74262c7813a4c946b9a4c9c7d7a19aa1d866dedfdf82781131e5edbe9aabbdef
4
+ data.tar.gz: 6ebbd6018cfc419d586d50d60d7d346c5a6c0a7b442275caf55fc22d3420a797
5
5
  SHA512:
6
- metadata.gz: cc8c5846be7c3a812a94c59aea41ecbb58c9672fa5948b4a306193e6d5914fc18f7104263f9a0ec84a1d405099dbc72dfc6c38c84cc3135133111b3f1c199ab8
7
- data.tar.gz: e5eb813ed9b6dc1ba7abf34a96bbefa1c353453d8596d79dbf0f04290c7b502f18306419f4b5adc33712a8a18896def5fe0389293ffe43f7f7fbed2622083d6c
6
+ metadata.gz: 402221144b4bbf95e1daf759430c6a59fad8025d650f4f84624146ed44951de2e34755a1e335f478aeabe2fbec693f2b95c74c64aad1ff19e54b3a1e30213ee8
7
+ data.tar.gz: 84d405d332fdd45895885b43dc408a46574b97f26f2b1742513ad97f9910e0ed96f6bb4ddff0c4cf0148751b2a0348b97b5adaa41aab57ba5c724c07f0827d5e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.4 — 2026-09-11
6
+
7
+ ### Added
8
+ - SonarQube Cloud badge in README.md (project key: `gundestrup_jekyll-client-search`)
9
+
10
+ ### Fixed
11
+ - Verify `event.origin` in transformers-worker.js `message` listener to prevent cross-origin message injection (SonarQube: `javascript:S2819`, CRITICAL)
12
+ - Add `--ignore-scripts` to `npm ci` in CI to prevent lifecycle script execution during dependency installation (SonarQube: `githubactions:S6505`)
13
+ - Pin Semgrep to `1.176.0` with `--only-binary :all:` in CI to prevent setup script execution and lock resolved versions (SonarQube: `githubactions:S8541`, `githubactions:S8544`)
14
+ - Wrap `normalize` and `resultElement` callbacks in anonymous functions in `.map()` calls to avoid passing unexpected iterator arguments (SonarQube: `javascript:S7727`)
15
+ - Wrap `search` callback in anonymous function in `.forEach()` call in benchmark (SonarQube: `javascript:S7727`)
16
+ - Replace `parseInt` with `Number.parseInt` in dropdown and related runtimes (SonarQube: `javascript:S7773`)
17
+
5
18
  ## 0.3.3 — 2026-09-11
6
19
 
7
20
  ### Refactored
data/README.md CHANGED
@@ -10,6 +10,7 @@
10
10
  [![Coverage](https://img.shields.io/badge/coverage-100%25%20branches-brightgreen.svg)](#testing-strategy)
11
11
  [![Semgrep](https://img.shields.io/badge/semgrep-scanning-brightgreen.svg)](https://semgrep.dev)
12
12
  [![CodeFactor](https://www.codefactor.io/repository/github/gundestrup/jekyll-client-search/badge)](https://www.codefactor.io/repository/github/gundestrup/jekyll-client-search)
13
+ [![SonarQube](https://sonarcloud.io/api/project_badges/measure?project=gundestrup_jekyll-client-search&metric=alert_status)](https://sonarcloud.io/project/overview?id=gundestrup_jekyll-client-search)
13
14
 
14
15
  A Jekyll plugin that generates a JSON document index for client-side search.
15
16
  Supports lexical search ([MiniSearch](https://lucaong.github.io/minisearch/),
@@ -66,7 +66,7 @@
66
66
  throw new TypeError("Search index must be an array");
67
67
  }
68
68
 
69
- var documents = data.map(normalize).filter(Boolean);
69
+ var documents = data.map(function (entry) { return normalize(entry); }).filter(Boolean);
70
70
  documentsById = new Map(documents.map(function (entry) {
71
71
  return [entry.id, entry];
72
72
  }));
@@ -232,7 +232,7 @@
232
232
  }
233
233
  results.replaceChildren.apply(
234
234
  results,
235
- matches.map(resultElement).filter(Boolean)
235
+ matches.map(function (match) { return resultElement(match); }).filter(Boolean)
236
236
  );
237
237
  }
238
238
 
@@ -67,7 +67,7 @@
67
67
  if (!Array.isArray(data)) {
68
68
  throw new TypeError("Search index must be an array");
69
69
  }
70
- var documents = data.map(normalize).filter(Boolean);
70
+ var documents = data.map(function (entry) { return normalize(entry); }).filter(Boolean);
71
71
  var adapter = window.ClientSearchAdapters &&
72
72
  (window.ClientSearchAdapters[config.engine] ||
73
73
  window.ClientSearchAdapters.minisearch);
@@ -177,7 +177,7 @@
177
177
  this.input = root.querySelector("[data-cs-dropdown-input]");
178
178
  this.results = root.querySelector("[data-cs-dropdown-results]");
179
179
  this.config = config;
180
- this.maxItems = parseInt(this.results.dataset.maxItems, 10) || config.maxItems || 5;
180
+ this.maxItems = Number.parseInt(this.results.dataset.maxItems, 10) || config.maxItems || 5;
181
181
  this.selectedIndex = -1;
182
182
  this.currentItems = [];
183
183
  this.debounceTimer = null;
@@ -153,7 +153,7 @@
153
153
  }
154
154
 
155
155
  if (container.dataset.relatedMax) {
156
- options.maxItems = parseInt(container.dataset.relatedMax, 10) || 0;
156
+ options.maxItems = Number.parseInt(container.dataset.relatedMax, 10) || 0;
157
157
  }
158
158
 
159
159
  return fetch(options.relationsUrl, { headers: { Accept: "application/json" } })
@@ -106,6 +106,9 @@ async function embed(query) {
106
106
  }
107
107
 
108
108
  self.addEventListener("message", function (event) {
109
+ if (event.origin !== self.location.origin) {
110
+ return;
111
+ }
109
112
  var message = event.data || {};
110
113
  activeConfig = activeConfig || message.config || {};
111
114
  latestRequestId = message.id;
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module ClientSearch
5
- VERSION = "0.3.3"
5
+ VERSION = "0.3.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-client-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svend Gundestrup