@whotracksme/reporting 12.1.0 β†’ 12.1.2

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,27 @@
1
+ # v12.1.2 (Fri Sep 18 2026)
2
+
3
+ #### πŸ› Bug Fix
4
+
5
+ - "firstMatch" needs to wait for transforms to succeed before accepting [#231](https://github.com/whotracksme/webextension-packages/pull/231) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### Authors: 1
8
+
9
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
10
+
11
+ ---
12
+
13
+ # v12.1.1 (Mon Sep 14 2026)
14
+
15
+ #### πŸ› Bug Fix
16
+
17
+ - Export the URL sanitizer for Node consumers [#230](https://github.com/whotracksme/webextension-packages/pull/230) ([@chrmod](https://github.com/chrmod))
18
+
19
+ #### Authors: 1
20
+
21
+ - Krzysztof Modras ([@chrmod](https://github.com/chrmod))
22
+
23
+ ---
24
+
1
25
  # v12.1.0 (Mon Sep 07 2026)
2
26
 
3
27
  #### πŸš€ Enhancement
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "12.1.0",
3
+ "version": "12.1.2",
4
4
  "type": "module",
5
+ "exports": {
6
+ "./sanitizer": "./reporting/src/sanitizer.js",
7
+ "./*": "./*"
8
+ },
5
9
  "description": "",
6
10
  "scripts": {
7
11
  "lint": "eslint reporting/ communication/",
@@ -477,7 +477,7 @@ export function lookupBuiltinTransform(name) {
477
477
  * to disable clients that do not meet the minimum requirements of the
478
478
  * current patterns.
479
479
  */
480
- const PATTERN_DSL_VERSION = 9;
480
+ const PATTERN_DSL_VERSION = 10;
481
481
 
482
482
  /**
483
483
  * "Magic" empty rule set, which exists only if patterns were loaded, but
@@ -9,8 +9,8 @@
9
9
  * file, You can obtain one at http://mozilla.org/MPL/2.0
10
10
  */
11
11
 
12
- import logger from './logger';
13
- import { isHash } from './hash-detector';
12
+ import logger from './logger.js';
13
+ import { isHash } from './hash-detector.js';
14
14
 
15
15
  function isCharNumber(char) {
16
16
  const code = char.charCodeAt(0);
@@ -85,9 +85,10 @@ function findFirstMatch(rootItem, selectorDef, baseURI) {
85
85
  // special case: allows to define multiple rules (first matching rule wins)
86
86
  if (selectorDef.firstMatch) {
87
87
  for (const { select, attr, transform = [] } of selectorDef.firstMatch) {
88
- const match = runSelector(rootItem, select, attr, baseURI) ?? null;
89
- if (match !== null) {
90
- return runTransforms(match, transform);
88
+ const match = runSelector(rootItem, select, attr, baseURI);
89
+ const value = runTransforms(match, transform);
90
+ if (value !== null) {
91
+ return value;
91
92
  }
92
93
  }
93
94
  return null;
@@ -236,6 +236,62 @@ describe('#SearchExtractor', function () {
236
236
  });
237
237
  });
238
238
 
239
+ it('should fall through in "firstMatch" if the transforms reject a match', function () {
240
+ runScenario({
241
+ url: 'http://example.test/x?q=some-query',
242
+ query: 'some-query',
243
+ category: 'example-test',
244
+ html: `
245
+ <!DOCTYPE html>
246
+ <html>
247
+ <body>
248
+ <a id="link" href="https://example.test/some/path">link</a>
249
+ </body>
250
+ </html>`,
251
+ patterns: {
252
+ 'example-test': {
253
+ input: {
254
+ 'html body': {
255
+ first: {
256
+ u: {
257
+ firstMatch: [
258
+ {
259
+ // selector matches, but the transforms reject it
260
+ select: 'a#link',
261
+ attr: 'href',
262
+ transform: [
263
+ ['selectFirstMatch', 'will-not-match'],
264
+ ['minLength', 1],
265
+ ],
266
+ },
267
+ {
268
+ select: 'a#link',
269
+ attr: 'href',
270
+ transform: [['maskU']],
271
+ },
272
+ ],
273
+ },
274
+ },
275
+ },
276
+ },
277
+ output: {
278
+ 'test-action': {
279
+ fields: [{ key: 'u', source: 'html body' }],
280
+ },
281
+ },
282
+ },
283
+ },
284
+ mustContain: [
285
+ {
286
+ action: 'test-action',
287
+ payload: {
288
+ u: 'https://example.test/some/path',
289
+ },
290
+ },
291
+ ],
292
+ });
293
+ });
294
+
239
295
  it('should not double-encode links', function () {
240
296
  // Note: this URL has an encoded Umlaut. Depending on the DOMParser and
241
297
  // the mechanism to extract the URL (elem.href vs elem.getAttribute('href'),