@openrewrite/rewrite 8.66.1 → 8.66.3
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/java/tree.d.ts +10 -1
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/tree.js +21 -5
- package/dist/java/tree.js.map +1 -1
- package/dist/java/type-visitor.d.ts +1 -1
- package/dist/java/type-visitor.d.ts.map +1 -1
- package/dist/java/visitor.d.ts +2 -2
- package/dist/java/visitor.d.ts.map +1 -1
- package/dist/java/visitor.js +8 -2
- package/dist/java/visitor.js.map +1 -1
- package/dist/javascript/assertions.d.ts +6 -0
- package/dist/javascript/assertions.d.ts.map +1 -1
- package/dist/javascript/assertions.js +14 -6
- package/dist/javascript/assertions.js.map +1 -1
- package/dist/javascript/comparator.d.ts +154 -7
- package/dist/javascript/comparator.d.ts.map +1 -1
- package/dist/javascript/comparator.js +623 -180
- package/dist/javascript/comparator.js.map +1 -1
- package/dist/javascript/format.d.ts +5 -3
- package/dist/javascript/format.d.ts.map +1 -1
- package/dist/javascript/format.js +85 -43
- package/dist/javascript/format.js.map +1 -1
- package/dist/javascript/index.d.ts +1 -0
- package/dist/javascript/index.d.ts.map +1 -1
- package/dist/javascript/index.js +1 -0
- package/dist/javascript/index.js.map +1 -1
- package/dist/javascript/parser.d.ts +2 -1
- package/dist/javascript/parser.d.ts.map +1 -1
- package/dist/javascript/parser.js +39 -30
- package/dist/javascript/parser.js.map +1 -1
- package/dist/javascript/templating/capture.d.ts +81 -14
- package/dist/javascript/templating/capture.d.ts.map +1 -1
- package/dist/javascript/templating/capture.js +98 -8
- package/dist/javascript/templating/capture.js.map +1 -1
- package/dist/javascript/templating/comparator.d.ts +125 -15
- package/dist/javascript/templating/comparator.d.ts.map +1 -1
- package/dist/javascript/templating/comparator.js +946 -118
- package/dist/javascript/templating/comparator.js.map +1 -1
- package/dist/javascript/templating/engine.d.ts +58 -25
- package/dist/javascript/templating/engine.d.ts.map +1 -1
- package/dist/javascript/templating/engine.js +527 -94
- package/dist/javascript/templating/engine.js.map +1 -1
- package/dist/javascript/templating/index.d.ts +3 -3
- package/dist/javascript/templating/index.d.ts.map +1 -1
- package/dist/javascript/templating/index.js +3 -1
- package/dist/javascript/templating/index.js.map +1 -1
- package/dist/javascript/templating/pattern.d.ts +121 -16
- package/dist/javascript/templating/pattern.d.ts.map +1 -1
- package/dist/javascript/templating/pattern.js +528 -257
- package/dist/javascript/templating/pattern.js.map +1 -1
- package/dist/javascript/templating/placeholder-replacement.d.ts +30 -5
- package/dist/javascript/templating/placeholder-replacement.d.ts.map +1 -1
- package/dist/javascript/templating/placeholder-replacement.js +183 -81
- package/dist/javascript/templating/placeholder-replacement.js.map +1 -1
- package/dist/javascript/templating/rewrite.d.ts +56 -11
- package/dist/javascript/templating/rewrite.d.ts.map +1 -1
- package/dist/javascript/templating/rewrite.js +143 -16
- package/dist/javascript/templating/rewrite.js.map +1 -1
- package/dist/javascript/templating/template.d.ts +31 -5
- package/dist/javascript/templating/template.d.ts.map +1 -1
- package/dist/javascript/templating/template.js +89 -15
- package/dist/javascript/templating/template.js.map +1 -1
- package/dist/javascript/templating/types.d.ts +359 -12
- package/dist/javascript/templating/types.d.ts.map +1 -1
- package/dist/javascript/templating/utils.d.ts +52 -35
- package/dist/javascript/templating/utils.d.ts.map +1 -1
- package/dist/javascript/templating/utils.js +107 -109
- package/dist/javascript/templating/utils.js.map +1 -1
- package/dist/javascript/type-mapping.d.ts.map +1 -1
- package/dist/javascript/type-mapping.js +21 -11
- package/dist/javascript/type-mapping.js.map +1 -1
- package/dist/json/rpc.js +2 -2
- package/dist/json/rpc.js.map +1 -1
- package/dist/recipe/order-imports.js.map +1 -1
- package/dist/test/rewrite-test.d.ts.map +1 -1
- package/dist/test/rewrite-test.js +10 -6
- package/dist/test/rewrite-test.js.map +1 -1
- package/dist/version.txt +1 -1
- package/dist/visitor.d.ts +4 -4
- package/dist/visitor.d.ts.map +1 -1
- package/dist/visitor.js +8 -3
- package/dist/visitor.js.map +1 -1
- package/package.json +4 -2
- package/src/java/tree.ts +10 -3
- package/src/java/type-visitor.ts +1 -1
- package/src/java/visitor.ts +11 -5
- package/src/javascript/assertions.ts +9 -3
- package/src/javascript/comparator.ts +676 -185
- package/src/javascript/format.ts +72 -34
- package/src/javascript/index.ts +1 -0
- package/src/javascript/parser.ts +51 -31
- package/src/javascript/templating/capture.ts +107 -15
- package/src/javascript/templating/comparator.ts +1087 -134
- package/src/javascript/templating/engine.ts +601 -103
- package/src/javascript/templating/index.ts +9 -2
- package/src/javascript/templating/pattern.ts +655 -281
- package/src/javascript/templating/placeholder-replacement.ts +183 -80
- package/src/javascript/templating/rewrite.ts +152 -18
- package/src/javascript/templating/template.ts +110 -22
- package/src/javascript/templating/types.ts +386 -12
- package/src/javascript/templating/utils.ts +116 -102
- package/src/javascript/type-mapping.ts +20 -11
- package/src/json/rpc.ts +2 -2
- package/src/recipe/order-imports.ts +1 -1
- package/src/test/rewrite-test.ts +12 -7
- package/src/visitor.ts +14 -6
|
@@ -9,30 +9,96 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.fromRecipe = void 0;
|
|
12
13
|
exports.rewrite = rewrite;
|
|
13
14
|
/**
|
|
14
15
|
* Implementation of a replacement rule.
|
|
15
16
|
*/
|
|
16
17
|
class RewriteRuleImpl {
|
|
17
|
-
constructor(before, after) {
|
|
18
|
+
constructor(before, after, where, whereNot) {
|
|
18
19
|
this.before = before;
|
|
19
20
|
this.after = after;
|
|
21
|
+
this.where = where;
|
|
22
|
+
this.whereNot = whereNot;
|
|
20
23
|
}
|
|
21
24
|
tryOn(cursor, node) {
|
|
22
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
26
|
for (const pattern of this.before) {
|
|
24
|
-
|
|
27
|
+
// Pass cursor to pattern.match() for context-aware capture constraints
|
|
28
|
+
const match = yield pattern.match(node, cursor);
|
|
25
29
|
if (match) {
|
|
26
|
-
|
|
30
|
+
// Evaluate context predicates after structural match
|
|
31
|
+
if (this.where) {
|
|
32
|
+
const whereResult = yield this.where(node, cursor);
|
|
33
|
+
if (!whereResult) {
|
|
34
|
+
continue; // Pattern matched but context doesn't, try next pattern
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (this.whereNot) {
|
|
38
|
+
const whereNotResult = yield this.whereNot(node, cursor);
|
|
39
|
+
if (whereNotResult) {
|
|
40
|
+
continue; // Pattern matched but context is excluded, try next pattern
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Apply transformation
|
|
44
|
+
let result;
|
|
45
|
+
if (typeof this.after === 'function') {
|
|
46
|
+
// Call the function to get a template, then apply it
|
|
47
|
+
const template = this.after(match);
|
|
48
|
+
result = yield template.apply(cursor, node, match);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Use template.apply() as before
|
|
52
|
+
result = yield this.after.apply(cursor, node, match);
|
|
53
|
+
}
|
|
27
54
|
if (result) {
|
|
28
55
|
return result;
|
|
29
56
|
}
|
|
30
57
|
}
|
|
31
58
|
}
|
|
32
|
-
// Return undefined if no patterns match
|
|
59
|
+
// Return undefined if no patterns match or all context checks failed
|
|
33
60
|
return undefined;
|
|
34
61
|
});
|
|
35
62
|
}
|
|
63
|
+
andThen(next) {
|
|
64
|
+
const first = this;
|
|
65
|
+
return new (class extends RewriteRuleImpl {
|
|
66
|
+
constructor() {
|
|
67
|
+
// Pass empty patterns and a function that will never be called
|
|
68
|
+
// since we override tryOn
|
|
69
|
+
super([], () => undefined);
|
|
70
|
+
}
|
|
71
|
+
tryOn(cursor, node) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const firstResult = yield first.tryOn(cursor, node);
|
|
74
|
+
if (firstResult !== undefined) {
|
|
75
|
+
const secondResult = yield next.tryOn(cursor, firstResult);
|
|
76
|
+
return secondResult !== null && secondResult !== void 0 ? secondResult : firstResult;
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
})();
|
|
82
|
+
}
|
|
83
|
+
orElse(alternative) {
|
|
84
|
+
const first = this;
|
|
85
|
+
return new (class extends RewriteRuleImpl {
|
|
86
|
+
constructor() {
|
|
87
|
+
// Pass empty patterns and a function that will never be called
|
|
88
|
+
// since we override tryOn
|
|
89
|
+
super([], () => undefined);
|
|
90
|
+
}
|
|
91
|
+
tryOn(cursor, node) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const firstResult = yield first.tryOn(cursor, node);
|
|
94
|
+
if (firstResult !== undefined) {
|
|
95
|
+
return firstResult;
|
|
96
|
+
}
|
|
97
|
+
return yield alternative.tryOn(cursor, node);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
}
|
|
36
102
|
}
|
|
37
103
|
/**
|
|
38
104
|
* Creates a replacement rule using a capture context and configuration.
|
|
@@ -42,20 +108,26 @@ class RewriteRuleImpl {
|
|
|
42
108
|
*
|
|
43
109
|
* @example
|
|
44
110
|
* // Single pattern
|
|
45
|
-
* const swapOperands = rewrite(() =>
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* }
|
|
111
|
+
* const swapOperands = rewrite(() => {
|
|
112
|
+
* const { left, right } = { left: capture(), right: capture() };
|
|
113
|
+
* return {
|
|
114
|
+
* before: pattern`${left} + ${right}`,
|
|
115
|
+
* after: template`${right} + ${left}`
|
|
116
|
+
* };
|
|
117
|
+
* });
|
|
49
118
|
*
|
|
50
119
|
* @example
|
|
51
120
|
* // Multiple patterns
|
|
52
|
-
* const normalizeComparisons = rewrite(() =>
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
121
|
+
* const normalizeComparisons = rewrite(() => {
|
|
122
|
+
* const { left, right } = { left: capture(), right: capture() };
|
|
123
|
+
* return {
|
|
124
|
+
* before: [
|
|
125
|
+
* pattern`${left} == ${right}`,
|
|
126
|
+
* pattern`${left} === ${right}`
|
|
127
|
+
* ],
|
|
128
|
+
* after: template`${left} === ${right}`
|
|
129
|
+
* };
|
|
130
|
+
* });
|
|
59
131
|
*
|
|
60
132
|
* @example
|
|
61
133
|
* // Using in a visitor - IMPORTANT: use `|| node` to handle undefined when no match
|
|
@@ -76,6 +148,61 @@ function rewrite(builderFn) {
|
|
|
76
148
|
if (!config.before || !config.after) {
|
|
77
149
|
throw new Error('Builder function must return an object with before and after properties');
|
|
78
150
|
}
|
|
79
|
-
return new RewriteRuleImpl(Array.isArray(config.before) ? config.before : [config.before], config.after);
|
|
151
|
+
return new RewriteRuleImpl(Array.isArray(config.before) ? config.before : [config.before], config.after, config.where, config.whereNot);
|
|
80
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Creates a RewriteRule from a Recipe by using its editor visitor.
|
|
155
|
+
*
|
|
156
|
+
* This allows recipes to be used in the same chaining pattern as other rewrite rules,
|
|
157
|
+
* enabling composition with `andThen()`.
|
|
158
|
+
*
|
|
159
|
+
* @param recipe The recipe whose editor will be used to transform nodes
|
|
160
|
+
* @param ctx The execution context to pass to the recipe's editor
|
|
161
|
+
* @returns A RewriteRule that applies the recipe's editor to nodes
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* class MyRecipe extends Recipe {
|
|
166
|
+
* name = "my.recipe";
|
|
167
|
+
* displayName = "My Recipe";
|
|
168
|
+
* description = "Transforms code.";
|
|
169
|
+
*
|
|
170
|
+
* async editor(): Promise<TreeVisitor<any, ExecutionContext>> {
|
|
171
|
+
* return new MyVisitor();
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
*
|
|
175
|
+
* // In a visitor:
|
|
176
|
+
* override async visitBinary(binary: J.Binary, p: ExecutionContext): Promise<J | undefined> {
|
|
177
|
+
* const rule1 = rewrite(() => ({
|
|
178
|
+
* before: pattern`${capture('a')} + ${capture('b')}`,
|
|
179
|
+
* after: template`${capture('b')} + ${capture('a')}`
|
|
180
|
+
* }));
|
|
181
|
+
*
|
|
182
|
+
* const rule2 = fromRecipe(new MyRecipe(), p);
|
|
183
|
+
*
|
|
184
|
+
* // Chain the pattern-based rule with the recipe
|
|
185
|
+
* const combined = rule1.andThen(rule2);
|
|
186
|
+
* return await combined.tryOn(this.cursor, binary) || binary;
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
const fromRecipe = (recipe, ctx) => {
|
|
191
|
+
return new (class extends RewriteRuleImpl {
|
|
192
|
+
constructor() {
|
|
193
|
+
// Pass empty patterns and a function that will never be called
|
|
194
|
+
// since we override tryOn
|
|
195
|
+
super([], () => undefined);
|
|
196
|
+
}
|
|
197
|
+
tryOn(cursor, tree) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const visitor = yield recipe.editor();
|
|
200
|
+
const result = yield visitor.visit(tree, ctx, cursor);
|
|
201
|
+
// Return undefined if the visitor didn't change the node
|
|
202
|
+
return result !== tree ? result : undefined;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
})();
|
|
206
|
+
};
|
|
207
|
+
exports.fromRecipe = fromRecipe;
|
|
81
208
|
//# sourceMappingURL=rewrite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../../src/javascript/templating/rewrite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../../src/javascript/templating/rewrite.ts"],"names":[],"mappings":";;;;;;;;;;;;AA6JA,0BAgBC;AAxJD;;GAEG;AACH,MAAM,eAAe;IACjB,YACqB,MAAiB,EACjB,KAAoD,EACpD,KAA+D,EAC/D,QAAkE;QAHlE,WAAM,GAAN,MAAM,CAAW;QACjB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AAC;SAAA;KACJ,CAAC,EAAE,CAAC;AACT,CAAC,CAAA;AAhBY,QAAA,UAAU,cAgBtB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Cursor, Tree } from '../..';
|
|
2
2
|
import { J } from '../../java';
|
|
3
|
-
import { TemplateOptions, TemplateParameter
|
|
4
|
-
import {
|
|
3
|
+
import { Capture, Parameter, TemplateOptions, TemplateParameter } from './types';
|
|
4
|
+
import { JS } from '..';
|
|
5
5
|
/**
|
|
6
6
|
* Coordinates for template application.
|
|
7
7
|
*/
|
|
@@ -109,6 +109,7 @@ export declare class Template {
|
|
|
109
109
|
private readonly templateParts;
|
|
110
110
|
private readonly parameters;
|
|
111
111
|
private options;
|
|
112
|
+
private _cachedTemplate?;
|
|
112
113
|
/**
|
|
113
114
|
* Creates a new builder for constructing templates programmatically.
|
|
114
115
|
*
|
|
@@ -139,11 +140,25 @@ export declare class Template {
|
|
|
139
140
|
* @example
|
|
140
141
|
* template`isDate(${capture('date')})`
|
|
141
142
|
* .configure({
|
|
142
|
-
*
|
|
143
|
+
* context: ['import { isDate } from "util"'],
|
|
143
144
|
* dependencies: { 'util': '^1.0.0' }
|
|
144
145
|
* })
|
|
145
146
|
*/
|
|
146
147
|
configure(options: TemplateOptions): Template;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the template tree for this template, using two-level caching:
|
|
150
|
+
* - Level 1: Instance cache (this._cachedTemplate) - fastest, no lookup needed
|
|
151
|
+
* - Level 2: Global cache (globalAstCache) - fast, shared across all templates
|
|
152
|
+
* - Level 3: TemplateEngine - slow, parses and processes the template
|
|
153
|
+
*
|
|
154
|
+
* Most parameters use placeholders that are replaced during application, so templates
|
|
155
|
+
* with the same structure share cached ASTs. However, raw() parameters are spliced at
|
|
156
|
+
* construction time, so their values must be included in the cache key.
|
|
157
|
+
*
|
|
158
|
+
* @returns The cached or newly computed template tree
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
getTemplateTree(): Promise<JS.CompilationUnit>;
|
|
147
162
|
/**
|
|
148
163
|
* Applies this template and returns the resulting tree.
|
|
149
164
|
*
|
|
@@ -152,7 +167,7 @@ export declare class Template {
|
|
|
152
167
|
* @param values values for parameters in template
|
|
153
168
|
* @returns A Promise resolving to the generated AST node
|
|
154
169
|
*/
|
|
155
|
-
apply(cursor: Cursor, tree: J, values?: Map<Capture | string, J> | Pick<Map<string, J>, 'get'>): Promise<J | undefined>;
|
|
170
|
+
apply(cursor: Cursor, tree: J, values?: Map<Capture | string, J> | Pick<Map<string, J>, 'get'> | Record<string, J>): Promise<J | undefined>;
|
|
156
171
|
}
|
|
157
172
|
/**
|
|
158
173
|
* Tagged template function for creating templates that generate AST nodes.
|
|
@@ -162,8 +177,13 @@ export declare class Template {
|
|
|
162
177
|
* to navigate properties (e.g., `method.name`) or array bracket notation to
|
|
163
178
|
* access array elements (e.g., `args.elements[0].element`).
|
|
164
179
|
*
|
|
180
|
+
* Templates can also accept AST wrapper types directly:
|
|
181
|
+
* - J.RightPadded<T>: The element will be extracted and inserted
|
|
182
|
+
* - J.RightPadded<T>[]: Elements will be expanded in place
|
|
183
|
+
* - J.Container<T>: Elements will be expanded in place
|
|
184
|
+
*
|
|
165
185
|
* @param strings The string parts of the template
|
|
166
|
-
* @param parameters The parameters between the string parts (Capture, Tree, or
|
|
186
|
+
* @param parameters The parameters between the string parts (Capture, CaptureValue, TemplateParam, Tree, Tree[], J.RightPadded, J.RightPadded[], or J.Container)
|
|
167
187
|
* @returns A Template object that can be applied to generate AST nodes
|
|
168
188
|
*
|
|
169
189
|
* @example
|
|
@@ -198,6 +218,12 @@ export declare class Template {
|
|
|
198
218
|
* // Array element access
|
|
199
219
|
* const invocation = capture<J.MethodInvocation>('invocation');
|
|
200
220
|
* template`bar(${invocation.arguments.elements[0].element})`
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* // Using J.RightPadded and J.Container directly
|
|
224
|
+
* const selectExpr = method.select; // J.RightPadded<Expression>
|
|
225
|
+
* const args = method.arguments; // J.Container<Expression>
|
|
226
|
+
* template`${selectExpr}.newMethod(${args})`
|
|
201
227
|
*/
|
|
202
228
|
export declare function template(strings: TemplateStringsArray, ...parameters: TemplateParameter[]): Template;
|
|
203
229
|
export type { JavaCoordinates };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/javascript/templating/template.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,CAAC,EAAC,MAAM,YAAY,CAAC;AAC7B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/javascript/templating/template.ts"],"names":[],"mappings":"AAeA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,CAAC,EAAC,MAAM,YAAY,CAAC;AAC7B,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAK/E,OAAO,EAAC,EAAE,EAAC,MAAM,IAAI,CAAC;AAEtB;;GAEG;AACH,KAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,GAAG,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC;IAC/B,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC;CAC/B,CAAC;AAEF,kBAAU,eAAe,CAAC;IAEtB,KAAY,QAAQ,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,WAAW,CAAC;IAE9E,KAAY,IAAI;QACZ,MAAM,IAAA;QACN,KAAK,IAAA;QACL,OAAO,IAAA;KACV;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,MAAM,CAA2B;IAEzC;;;;;OAKG;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14 +187,62 @@ class Template {
|
|
|
187
187
|
* @example
|
|
188
188
|
* template`isDate(${capture('date')})`
|
|
189
189
|
* .configure({
|
|
190
|
-
*
|
|
190
|
+
* context: ['import { isDate } from "util"'],
|
|
191
191
|
* dependencies: { 'util': '^1.0.0' }
|
|
192
192
|
* })
|
|
193
193
|
*/
|
|
194
194
|
configure(options) {
|
|
195
195
|
this.options = Object.assign(Object.assign({}, this.options), options);
|
|
196
|
+
// Invalidate cache when configuration changes
|
|
197
|
+
this._cachedTemplate = undefined;
|
|
196
198
|
return this;
|
|
197
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Gets the template tree for this template, using two-level caching:
|
|
202
|
+
* - Level 1: Instance cache (this._cachedTemplate) - fastest, no lookup needed
|
|
203
|
+
* - Level 2: Global cache (globalAstCache) - fast, shared across all templates
|
|
204
|
+
* - Level 3: TemplateEngine - slow, parses and processes the template
|
|
205
|
+
*
|
|
206
|
+
* Most parameters use placeholders that are replaced during application, so templates
|
|
207
|
+
* with the same structure share cached ASTs. However, raw() parameters are spliced at
|
|
208
|
+
* construction time, so their values must be included in the cache key.
|
|
209
|
+
*
|
|
210
|
+
* @returns The cached or newly computed template tree
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
getTemplateTree() {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
// Level 1: Instance cache (fastest path)
|
|
216
|
+
if (this._cachedTemplate) {
|
|
217
|
+
return this._cachedTemplate;
|
|
218
|
+
}
|
|
219
|
+
// Generate cache key for global lookup
|
|
220
|
+
// For raw() parameters, we need to include their code values in the key
|
|
221
|
+
// since they're spliced at construction time, not application time
|
|
222
|
+
const contextStatements = this.options.context || this.options.imports || [];
|
|
223
|
+
const parametersKey = this.parameters.map((p, i) => {
|
|
224
|
+
const value = p.value;
|
|
225
|
+
// Include raw code values in the cache key using the symbol
|
|
226
|
+
if (value && typeof value === 'object' && value[capture_1.RAW_CODE_SYMBOL]) {
|
|
227
|
+
return `raw:${value.code}`;
|
|
228
|
+
}
|
|
229
|
+
return i.toString();
|
|
230
|
+
}).join(',');
|
|
231
|
+
const cacheKey = (0, utils_1.generateCacheKey)(this.templateParts, parametersKey, contextStatements, this.options.dependencies || {});
|
|
232
|
+
// Level 2: Global cache (fast path - shared with Pattern)
|
|
233
|
+
const cached = utils_1.globalAstCache.get(cacheKey);
|
|
234
|
+
if (cached) {
|
|
235
|
+
this._cachedTemplate = cached;
|
|
236
|
+
return cached;
|
|
237
|
+
}
|
|
238
|
+
// Level 3: Compute via TemplateEngine (slow path)
|
|
239
|
+
const result = yield engine_1.TemplateEngine.getTemplateTree(this.templateParts, this.parameters, contextStatements, this.options.dependencies || {});
|
|
240
|
+
// Cache in both levels
|
|
241
|
+
utils_1.globalAstCache.set(cacheKey, result);
|
|
242
|
+
this._cachedTemplate = result;
|
|
243
|
+
return result;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
198
246
|
/**
|
|
199
247
|
* Applies this template and returns the resulting tree.
|
|
200
248
|
*
|
|
@@ -208,7 +256,12 @@ class Template {
|
|
|
208
256
|
// Normalize the values map: convert any Capture keys to string keys
|
|
209
257
|
let normalizedValues;
|
|
210
258
|
let wrappersMap = new Map();
|
|
211
|
-
if (values instanceof
|
|
259
|
+
if (values instanceof pattern_1.MatchResult) {
|
|
260
|
+
// MatchResult - extract both bindings and wrappersMap
|
|
261
|
+
normalizedValues = values;
|
|
262
|
+
wrappersMap = values[utils_1.WRAPPERS_MAP_SYMBOL]();
|
|
263
|
+
}
|
|
264
|
+
else if (values instanceof Map) {
|
|
212
265
|
const normalized = new Map();
|
|
213
266
|
for (const [key, value] of values.entries()) {
|
|
214
267
|
const stringKey = typeof key === 'string'
|
|
@@ -218,21 +271,31 @@ class Template {
|
|
|
218
271
|
}
|
|
219
272
|
normalizedValues = normalized;
|
|
220
273
|
}
|
|
221
|
-
else if (values
|
|
222
|
-
//
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
274
|
+
else if (values && typeof values === 'object') {
|
|
275
|
+
// Check if it's a Map-like object with 'get' method, or a plain object literal
|
|
276
|
+
if ('get' in values && typeof values.get === 'function') {
|
|
277
|
+
// Map-like object with get method
|
|
278
|
+
normalizedValues = values;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
// Plain object literal - convert to Map
|
|
282
|
+
// Keys may be strings or Capture objects (via computed properties {[x]: value})
|
|
283
|
+
const normalized = new Map();
|
|
284
|
+
for (const [key, value] of Object.entries(values)) {
|
|
285
|
+
// If the key happens to be a stringified Capture (from computed properties),
|
|
286
|
+
// it's already been converted to a string by JavaScript
|
|
287
|
+
normalized.set(key, value);
|
|
288
|
+
}
|
|
289
|
+
normalizedValues = normalized;
|
|
290
|
+
}
|
|
229
291
|
}
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
|
|
292
|
+
// Use instance-level cache to get the template tree
|
|
293
|
+
const ast = yield this.getTemplateTree();
|
|
294
|
+
// Delegate to TemplateEngine for placeholder substitution and application
|
|
295
|
+
return engine_1.TemplateEngine.applyTemplateFromAst(ast, this.parameters, cursor, {
|
|
233
296
|
tree,
|
|
234
297
|
mode: JavaCoordinates.Mode.Replace
|
|
235
|
-
}, normalizedValues, wrappersMap
|
|
298
|
+
}, normalizedValues, wrappersMap);
|
|
236
299
|
});
|
|
237
300
|
}
|
|
238
301
|
}
|
|
@@ -245,8 +308,13 @@ exports.Template = Template;
|
|
|
245
308
|
* to navigate properties (e.g., `method.name`) or array bracket notation to
|
|
246
309
|
* access array elements (e.g., `args.elements[0].element`).
|
|
247
310
|
*
|
|
311
|
+
* Templates can also accept AST wrapper types directly:
|
|
312
|
+
* - J.RightPadded<T>: The element will be extracted and inserted
|
|
313
|
+
* - J.RightPadded<T>[]: Elements will be expanded in place
|
|
314
|
+
* - J.Container<T>: Elements will be expanded in place
|
|
315
|
+
*
|
|
248
316
|
* @param strings The string parts of the template
|
|
249
|
-
* @param parameters The parameters between the string parts (Capture, Tree, or
|
|
317
|
+
* @param parameters The parameters between the string parts (Capture, CaptureValue, TemplateParam, Tree, Tree[], J.RightPadded, J.RightPadded[], or J.Container)
|
|
250
318
|
* @returns A Template object that can be applied to generate AST nodes
|
|
251
319
|
*
|
|
252
320
|
* @example
|
|
@@ -281,6 +349,12 @@ exports.Template = Template;
|
|
|
281
349
|
* // Array element access
|
|
282
350
|
* const invocation = capture<J.MethodInvocation>('invocation');
|
|
283
351
|
* template`bar(${invocation.arguments.elements[0].element})`
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* // Using J.RightPadded and J.Container directly
|
|
355
|
+
* const selectExpr = method.select; // J.RightPadded<Expression>
|
|
356
|
+
* const args = method.arguments; // J.Container<Expression>
|
|
357
|
+
* template`${selectExpr}.newMethod(${args})`
|
|
284
358
|
*/
|
|
285
359
|
function template(strings, ...parameters) {
|
|
286
360
|
// Convert parameters to Parameter objects (no longer need to check for mutable tree property)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/javascript/templating/template.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/javascript/templating/template.ts"],"names":[],"mappings":";;;;;;;;;;;;AAmZA,4BAQC;AAzYD,uCAAsC;AACtC,mCAA8E;AAC9E,uCAA+D;AAC/D,qCAAwC;AAYxC,IAAU,eAAe,CASxB;AATD,WAAU,eAAe;IAIrB,IAAY,IAIX;IAJD,WAAY,IAAI;QACZ,mCAAM,CAAA;QACN,iCAAK,CAAA;QACL,qCAAO,CAAA;IACX,CAAC,EAJW,IAAI,GAAJ,oBAAI,KAAJ,oBAAI,QAIf;AACL,CAAC,EATS,eAAe,KAAf,eAAe,QASxB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,eAAe;IAA5B;QACY,UAAK,GAAa,EAAE,CAAC;QACrB,WAAM,GAAw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