Skip to content

Commit a92a665

Browse files
committed
pass read only matcher in call back
1 parent a21c441 commit a92a665

19 files changed

+374
-74
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Note: Due to some last quick changes on v4, detail of v4.5.3 & v4.5.4 are not updated here. v4.5.4x is the last tag of v4 in github repository. I'm extremely sorry for the confusion
44

5+
**5.5.8 / 2026-03-20**
6+
- pass read only matcher in callback
7+
58
**5.5.7 / 2026-03-19**
69
- fix: entity expansion limits
710
- update strnum package to 2.2.0

docs/CHECK_LIST.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Pre release
22
* [ ] npm audit and yarn audit is done
3+
* [ ] update pem.d.ts when there is any change path-expression-matcher package
34
* [ ] Change log has been updated
45
* [ ] Added/updated documentation for new properties/features
56
* [ ] `package-lock.json` reflects the right version : `npm install`

lib/fxbuilder.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fxbuilder.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fxp.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/fxp.d.cts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
// import type { Matcher, Expression } from 'path-expression-matcher';
1+
import type pem = require('./pem');
2+
type Expression = pem.Expression;
3+
type ReadonlyMatcher = pem.ReadonlyMatcher;
24

3-
type Matcher = unknown;
4-
type Expression = unknown;
5+
// jPath: true → string
6+
// jPath: false → ReadonlyMatcher
7+
type JPathOrMatcher = string | ReadonlyMatcher;
8+
type JPathOrExpression = string | Expression;
59

610
type ProcessEntitiesOptions = {
711
/**
@@ -63,7 +67,7 @@ type ProcessEntitiesOptions = {
6367
*
6468
* Defaults to `null`
6569
*/
66-
tagFilter?: ((tagName: string, jPathOrMatcher: string | Matcher) => boolean) | null;
70+
tagFilter?: ((tagName: string, jPathOrMatcher: JPathOrMatcher) => boolean) | null;
6771
};
6872

6973
type X2jOptions = {
@@ -108,7 +112,7 @@ type X2jOptions = {
108112
*
109113
* Defaults to `true`
110114
*/
111-
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: string | Matcher) => boolean);
115+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: JPathOrMatcher) => boolean);
112116

113117
/**
114118
* Whether to remove namespace string from tag and attribute names
@@ -175,7 +179,7 @@ type X2jOptions = {
175179
*
176180
* Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
177181
*/
178-
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: string | Matcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
182+
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: JPathOrMatcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
179183

180184
/**
181185
* Control how attribute value should be parsed
@@ -188,7 +192,7 @@ type X2jOptions = {
188192
*
189193
* Defaults to `(attrName, val, jPathOrMatcher) => val`
190194
*/
191-
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: string | Matcher) => unknown;
195+
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: JPathOrMatcher) => unknown;
192196

193197
/**
194198
* Options to pass to `strnum` for parsing numbers
@@ -206,7 +210,7 @@ type X2jOptions = {
206210
*
207211
* Defaults to `[]`
208212
*/
209-
stopNodes?: (string | Expression)[];
213+
stopNodes?: JPathOrExpression[];
210214

211215
/**
212216
* List of tags without closing tags
@@ -233,7 +237,7 @@ type X2jOptions = {
233237
*
234238
* Defaults to `() => false`
235239
*/
236-
isArray?: (tagName: string, jPathOrMatcher: string | Matcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
240+
isArray?: (tagName: string, jPathOrMatcher: JPathOrMatcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
237241

238242
/**
239243
* Whether to process default and DOCTYPE entities
@@ -295,7 +299,7 @@ type X2jOptions = {
295299
*
296300
* Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
297301
*/
298-
updateTag?: (tagName: string, jPathOrMatcher: string | Matcher, attrs: { [k: string]: string }) => string | boolean;
302+
updateTag?: (tagName: string, jPathOrMatcher: JPathOrMatcher, attrs: { [k: string]: string }) => string | boolean;
299303

300304
/**
301305
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
@@ -477,7 +481,7 @@ type XmlBuilderOptions = {
477481
*
478482
* Defaults to `[]`
479483
*/
480-
stopNodes?: (string | Expression)[];
484+
stopNodes?: JPathOrExpression[];
481485

482486
/**
483487
* Control how tag value should be parsed. Called only if tag value is not empty
@@ -589,7 +593,11 @@ declare namespace fxp {
589593
strnumOptions,
590594
validationOptions,
591595
ProcessEntitiesOptions,
596+
Expression,
597+
ReadonlyMatcher,
598+
JPathOrMatcher,
599+
JPathOrExpression,
592600
}
593601
}
594602

595-
export = fxp;
603+
export = fxp;

lib/fxp.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fxp.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fxparser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fxparser.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)