@openrewrite/rewrite 8.85.0 → 8.85.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/rewrite-javascript-version.txt +1 -1
- package/dist/rpc/request/prepare-recipe.d.ts +6 -0
- package/dist/rpc/request/prepare-recipe.d.ts.map +1 -1
- package/dist/rpc/request/prepare-recipe.js +44 -3
- package/dist/rpc/request/prepare-recipe.js.map +1 -1
- package/package.json +1 -1
- package/src/rpc/request/prepare-recipe.ts +43 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
8.85.
|
|
1
|
+
8.85.1
|
|
@@ -6,6 +6,12 @@ export declare class PrepareRecipe {
|
|
|
6
6
|
private readonly options?;
|
|
7
7
|
constructor(id: string, options?: any | undefined);
|
|
8
8
|
static handle(connection: MessageConnection, marketplace: RecipeMarketplace, preparedRecipes: Map<String, Recipe>, metricsCsv?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Minimal stand-in descriptor for a recipe the host will resolve locally via
|
|
11
|
+
* {@link PrepareRecipeResponse.delegatesTo}. The host reads only `delegatesTo` for
|
|
12
|
+
* delegated recipes and ignores this descriptor, but the response type requires one.
|
|
13
|
+
*/
|
|
14
|
+
private static delegateDescriptor;
|
|
9
15
|
private static installSubRecipes;
|
|
10
16
|
/**
|
|
11
17
|
* For preconditions that can be evaluated on the remote peer, let the remote peer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-recipe.d.ts","sourceRoot":"","sources":["../../../src/rpc/request/prepare-recipe.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAiB,MAAM,cAAc,CAAC;AAOtE,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,aAAa;IACV,OAAO,CAAC,QAAQ,CAAC,EAAE;IAAU,OAAO,CAAC,QA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BAAgB,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,YAAY,EAAE,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,YAAY,EAAE,CAAA;IACjC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC5B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,EAAE,CAAA;IACnB,EAAE,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,CAAA;IACzB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;CAC5B"}
|
|
@@ -63,12 +63,31 @@ class PrepareRecipe {
|
|
|
63
63
|
static handle(connection, marketplace, preparedRecipes, metricsCsv) {
|
|
64
64
|
const snowflake = (0, snowflake_id_1.SnowflakeId)();
|
|
65
65
|
connection.onRequest(new rpc.RequestType("PrepareRecipe"), (0, metrics_1.withMetrics)("PrepareRecipe", metricsCsv, (context) => async (request) => {
|
|
66
|
-
var _a;
|
|
66
|
+
var _a, _b;
|
|
67
67
|
context.target = request.id;
|
|
68
68
|
const id = snowflake.generate();
|
|
69
69
|
const recipeCtor = marketplace.findRecipe(request.id);
|
|
70
70
|
if (!recipeCtor) {
|
|
71
|
-
|
|
71
|
+
// The host re-prepares every sub-recipe of a composite by id while
|
|
72
|
+
// building RpcRecipe.getRecipeList(). A sub-recipe that delegates to a
|
|
73
|
+
// Java recipe (e.g. org.openrewrite.javascript.UpgradeDependencyVersion,
|
|
74
|
+
// produced by upgradeDependencyVersion() -> prepareJavaRecipe) is an
|
|
75
|
+
// RpcRecipe that installSubRecipes deliberately did not register here: it
|
|
76
|
+
// has no no-arg constructor and is hosted on the peer. A miss therefore
|
|
77
|
+
// means the host owns this recipe, so tell it to resolve the id locally
|
|
78
|
+
// (the Java recipe is on the host's classpath) via delegatesTo, rather
|
|
79
|
+
// than failing with "Could not find recipe with id ...".
|
|
80
|
+
return {
|
|
81
|
+
id: id,
|
|
82
|
+
descriptor: PrepareRecipe.delegateDescriptor(request.id),
|
|
83
|
+
editVisitor: `edit:${id}`,
|
|
84
|
+
editPreconditions: [],
|
|
85
|
+
scanPreconditions: [],
|
|
86
|
+
delegatesTo: {
|
|
87
|
+
recipeName: request.id,
|
|
88
|
+
options: (_a = request.options) !== null && _a !== void 0 ? _a : {}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
72
91
|
}
|
|
73
92
|
if (!recipeCtor[1]) {
|
|
74
93
|
throw new Error(`Recipe ${request.id} was installed without a constructor`);
|
|
@@ -91,12 +110,34 @@ class PrepareRecipe {
|
|
|
91
110
|
if ('javaRecipeName' in recipe) {
|
|
92
111
|
result.delegatesTo = {
|
|
93
112
|
recipeName: recipe.javaRecipeName,
|
|
94
|
-
options: (
|
|
113
|
+
options: (_b = recipe.delegatesToOptions) !== null && _b !== void 0 ? _b : {}
|
|
95
114
|
};
|
|
96
115
|
}
|
|
97
116
|
return result;
|
|
98
117
|
}));
|
|
99
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Minimal stand-in descriptor for a recipe the host will resolve locally via
|
|
121
|
+
* {@link PrepareRecipeResponse.delegatesTo}. The host reads only `delegatesTo` for
|
|
122
|
+
* delegated recipes and ignores this descriptor, but the response type requires one.
|
|
123
|
+
*/
|
|
124
|
+
static delegateDescriptor(name) {
|
|
125
|
+
return {
|
|
126
|
+
name: name,
|
|
127
|
+
displayName: name,
|
|
128
|
+
instanceName: name,
|
|
129
|
+
description: "",
|
|
130
|
+
tags: [],
|
|
131
|
+
estimatedEffortPerOccurrence: 5,
|
|
132
|
+
options: [],
|
|
133
|
+
preconditions: [],
|
|
134
|
+
recipeList: [],
|
|
135
|
+
dataTables: [],
|
|
136
|
+
maintainers: [],
|
|
137
|
+
contributors: [],
|
|
138
|
+
examples: []
|
|
139
|
+
};
|
|
140
|
+
}
|
|
100
141
|
static async installSubRecipes(recipe, marketplace) {
|
|
101
142
|
for (const subRecipe of await recipe.recipeList()) {
|
|
102
143
|
// An RpcRecipe is a proxy for a recipe already prepared on a remote
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-recipe.js","sourceRoot":"","sources":["../../../src/rpc/request/prepare-recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yDAA2C;AAE3C,yCAAsE;AACtE,gEAA0D;AAC1D,uDAAsF;AACtF,sCAAoC;AAGpC,uCAAsC;AAGtC,MAAa,aAAa;IACtB,YAA6B,EAAU,EAAmB,OAAa;QAA1C,OAAE,GAAF,EAAE,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAAM;IACvE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,UAA6B,EAC7B,WAA8B,EAC9B,eAAoC,EACpC,UAAmB;QAC7B,MAAM,SAAS,GAAG,IAAA,0BAAW,GAAE,CAAC;QAChC,UAAU,CAAC,SAAS,CAChB,IAAI,GAAG,CAAC,WAAW,CAA8C,eAAe,CAAC,EACjF,IAAA,qBAAW,EACP,eAAe,EACf,UAAU,EACV,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;;YAC3B,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;YAC5B,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;YAChC,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,
|
|
1
|
+
{"version":3,"file":"prepare-recipe.js","sourceRoot":"","sources":["../../../src/rpc/request/prepare-recipe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,yDAA2C;AAE3C,yCAAsE;AACtE,gEAA0D;AA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;YAC3B,QAAQ,GAAG,gCAAgC,CAAC;QAChD,CAAC;aAAM,IAAI,CAAC,YAAY,iBAAiB,EAAE,CAAC;YACxC,0EAA0E;YAC1E,2DAA2D;YAC3D,QAAQ,GAAG,oCAAoC,CAAC;QACpD,CAAC;aAAM,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;YAClC,QAAQ,GAAG,6BAA6B,CAAC;QAC7C,CAAC;aAAM,IAAI,CAAC,YAAY,gBAAgB,EAAE,CAAC;YACvC,QAAQ,GAAG,gCAAgC,CAAC;QAChD,CAAC;aAAM,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;YAClC,QAAQ,GAAG,gCAAgC,CAAC;QAChD,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACX,aAAa,CAAC,IAAI,CAAC;gBACf,WAAW,EAAE,8CAA8C;gBAC3D,cAAc,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;aACnC,CAAC,CAAC;QACP,CAAC;QACD,OAAO,aAAa,CAAC;IACzB,CAAC;CACJ;AAnOD,sCAmOC"}
|
package/package.json
CHANGED
|
@@ -43,7 +43,26 @@ export class PrepareRecipe {
|
|
|
43
43
|
const id = snowflake.generate();
|
|
44
44
|
const recipeCtor = marketplace.findRecipe(request.id);
|
|
45
45
|
if (!recipeCtor) {
|
|
46
|
-
|
|
46
|
+
// The host re-prepares every sub-recipe of a composite by id while
|
|
47
|
+
// building RpcRecipe.getRecipeList(). A sub-recipe that delegates to a
|
|
48
|
+
// Java recipe (e.g. org.openrewrite.javascript.UpgradeDependencyVersion,
|
|
49
|
+
// produced by upgradeDependencyVersion() -> prepareJavaRecipe) is an
|
|
50
|
+
// RpcRecipe that installSubRecipes deliberately did not register here: it
|
|
51
|
+
// has no no-arg constructor and is hosted on the peer. A miss therefore
|
|
52
|
+
// means the host owns this recipe, so tell it to resolve the id locally
|
|
53
|
+
// (the Java recipe is on the host's classpath) via delegatesTo, rather
|
|
54
|
+
// than failing with "Could not find recipe with id ...".
|
|
55
|
+
return {
|
|
56
|
+
id: id,
|
|
57
|
+
descriptor: PrepareRecipe.delegateDescriptor(request.id),
|
|
58
|
+
editVisitor: `edit:${id}`,
|
|
59
|
+
editPreconditions: [],
|
|
60
|
+
scanPreconditions: [],
|
|
61
|
+
delegatesTo: {
|
|
62
|
+
recipeName: request.id,
|
|
63
|
+
options: request.options ?? {}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
47
66
|
}
|
|
48
67
|
if (!recipeCtor[1]) {
|
|
49
68
|
throw new Error(`Recipe ${request.id} was installed without a constructor`);
|
|
@@ -82,6 +101,29 @@ export class PrepareRecipe {
|
|
|
82
101
|
);
|
|
83
102
|
}
|
|
84
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Minimal stand-in descriptor for a recipe the host will resolve locally via
|
|
106
|
+
* {@link PrepareRecipeResponse.delegatesTo}. The host reads only `delegatesTo` for
|
|
107
|
+
* delegated recipes and ignores this descriptor, but the response type requires one.
|
|
108
|
+
*/
|
|
109
|
+
private static delegateDescriptor(name: string): RecipeDescriptor {
|
|
110
|
+
return {
|
|
111
|
+
name: name,
|
|
112
|
+
displayName: name,
|
|
113
|
+
instanceName: name,
|
|
114
|
+
description: "",
|
|
115
|
+
tags: [],
|
|
116
|
+
estimatedEffortPerOccurrence: 5,
|
|
117
|
+
options: [],
|
|
118
|
+
preconditions: [],
|
|
119
|
+
recipeList: [],
|
|
120
|
+
dataTables: [],
|
|
121
|
+
maintainers: [],
|
|
122
|
+
contributors: [],
|
|
123
|
+
examples: []
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
85
127
|
private static async installSubRecipes(recipe: Recipe, marketplace: RecipeMarketplace) {
|
|
86
128
|
for (const subRecipe of await recipe.recipeList()) {
|
|
87
129
|
// An RpcRecipe is a proxy for a recipe already prepared on a remote
|