@openrewrite/rewrite 8.103.0 → 8.103.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/dist/json/index.d.ts +1 -0
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +1 -0
- package/dist/json/index.js.map +1 -1
- package/dist/json/path-matcher.d.ts +29 -0
- package/dist/json/path-matcher.d.ts.map +1 -0
- package/dist/json/path-matcher.js +974 -0
- package/dist/json/path-matcher.js.map +1 -0
- package/dist/rewrite-javascript-version.txt +1 -1
- package/package.json +1 -1
- package/src/json/index.ts +1 -0
- package/src/json/path-matcher.ts +1092 -0
package/dist/json/index.d.ts
CHANGED
package/dist/json/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAeA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAeA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,SAAS,CAAC;AACjB,OAAO,OAAO,CAAC"}
|
package/dist/json/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./edit"), exports);
|
|
|
34
34
|
__exportStar(require("./visitor"), exports);
|
|
35
35
|
__exportStar(require("./assertions"), exports);
|
|
36
36
|
__exportStar(require("./parser"), exports);
|
|
37
|
+
__exportStar(require("./path-matcher"), exports);
|
|
37
38
|
require("./print");
|
|
38
39
|
require("./rpc");
|
|
39
40
|
//# sourceMappingURL=index.js.map
|
package/dist/json/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B;AAC1B,+CAA6B;AAC7B,2CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B;AAC1B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAE/B,mBAAiB;AACjB,iBAAe"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Cursor } from "../tree";
|
|
2
|
+
/**
|
|
3
|
+
* Matches a cursor location against a JsonPath expression, such as `$.sap.ui5.dependencies.libs.*`.
|
|
4
|
+
*
|
|
5
|
+
* A port of `org.openrewrite.json.JsonPathMatcher`, supporting the same subset of JsonPath with the same results:
|
|
6
|
+
* `$`, `.key`, `['key']`, `*`, `..`, array indexes and slices, and `?()` filters using `==`, `!=`, `=~`,
|
|
7
|
+
* `contains`, `!`, `&&` and `||`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class JsonPathMatcher {
|
|
10
|
+
private readonly jsonPath;
|
|
11
|
+
private parsed?;
|
|
12
|
+
constructor(jsonPath: string);
|
|
13
|
+
/**
|
|
14
|
+
* What the expression selects, evaluated along the path from the document root to the cursor: a
|
|
15
|
+
* `Json` element, an array of them, or `undefined` when nothing matches.
|
|
16
|
+
*
|
|
17
|
+
* @throws Error when the expression is not valid JsonPath
|
|
18
|
+
*/
|
|
19
|
+
find<T = unknown>(cursor: Cursor): T | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the element at the cursor is one that the expression selects.
|
|
22
|
+
*
|
|
23
|
+
* @throws Error when the expression is not valid JsonPath
|
|
24
|
+
*/
|
|
25
|
+
matches(cursor: Cursor): boolean;
|
|
26
|
+
private find0;
|
|
27
|
+
private parse;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=path-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-matcher.d.ts","sourceRoot":"","sources":["../../src/json/path-matcher.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,MAAM,EAAe,MAAM,SAAS,CAAC;AAG7C;;;;;;GAMG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,CAAe;gBAElB,QAAQ,EAAE,MAAM;IAM5B;;;;;OAKG;IACH,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIhD;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAUhC,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,KAAK;CAMhB"}
|