@aws/nx-plugin 1.0.0-rc.24 → 1.0.0-rc.26

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.
Files changed (302) hide show
  1. package/LICENSE-THIRD-PARTY +2020 -702
  2. package/package.json +6 -6
  3. package/src/agentcore-gateway/gateway-connection/generator.d.ts +1 -1
  4. package/src/agentcore-gateway/gateway-connection/generator.js +7 -5
  5. package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
  6. package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -1
  7. package/src/agentcore-gateway/gateway-connection/schema.d.ts +1 -0
  8. package/src/agentcore-gateway/gateway-connection/schema.json +5 -0
  9. package/src/agentcore-gateway/generator.js +7 -4
  10. package/src/agentcore-gateway/generator.js.map +1 -1
  11. package/src/agentcore-gateway/mcp-connection/generator.d.ts +1 -1
  12. package/src/agentcore-gateway/mcp-connection/generator.js +7 -5
  13. package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
  14. package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -1
  15. package/src/agentcore-gateway/mcp-connection/schema.d.ts +1 -0
  16. package/src/agentcore-gateway/mcp-connection/schema.json +5 -0
  17. package/src/agentcore-gateway/schema.d.js.map +1 -1
  18. package/src/agentcore-gateway/schema.d.ts +1 -0
  19. package/src/agentcore-gateway/schema.json +5 -0
  20. package/src/connection/generator.d.ts +3 -10
  21. package/src/connection/generator.js +18 -148
  22. package/src/connection/generator.js.map +1 -1
  23. package/src/connection/schema.d.js.map +1 -1
  24. package/src/connection/schema.d.ts +1 -0
  25. package/src/connection/schema.json +5 -0
  26. package/src/connection/supported-connections.d.ts +98 -0
  27. package/src/connection/supported-connections.js +138 -0
  28. package/src/connection/supported-connections.js.map +1 -0
  29. package/src/infra/app/__snapshots__/generator.spec.ts.snap +29 -21
  30. package/src/infra/app/generator.js +12 -6
  31. package/src/infra/app/generator.js.map +1 -1
  32. package/src/infra/app/schema.d.js.map +1 -1
  33. package/src/infra/app/schema.d.ts +1 -1
  34. package/src/infra/app/schema.json +5 -0
  35. package/src/license/schema.d.js.map +1 -1
  36. package/src/license/schema.d.ts +2 -0
  37. package/src/license/schema.json +5 -0
  38. package/src/mcp-server/tools/general-guidance.js +17 -0
  39. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  40. package/src/preset/__snapshots__/generator.spec.ts.snap +1 -1
  41. package/src/preset/generator.d.ts +1 -1
  42. package/src/preset/generator.js +8 -5
  43. package/src/preset/generator.js.map +1 -1
  44. package/src/preset/schema.d.js.map +1 -1
  45. package/src/preset/schema.d.ts +1 -0
  46. package/src/preset/schema.json +5 -0
  47. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +9 -9
  48. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +10 -10
  49. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +1 -1
  50. package/src/py/agent/a2a-connection/generator.js +7 -4
  51. package/src/py/agent/a2a-connection/generator.js.map +1 -1
  52. package/src/py/agent/a2a-connection/schema.d.js.map +1 -1
  53. package/src/py/agent/a2a-connection/schema.d.ts +1 -0
  54. package/src/py/agent/a2a-connection/schema.json +5 -0
  55. package/src/py/agent/gateway-connection/generator.js +7 -4
  56. package/src/py/agent/gateway-connection/generator.js.map +1 -1
  57. package/src/py/agent/gateway-connection/schema.d.js.map +1 -1
  58. package/src/py/agent/gateway-connection/schema.d.ts +1 -0
  59. package/src/py/agent/gateway-connection/schema.json +5 -0
  60. package/src/py/agent/generator.js +8 -6
  61. package/src/py/agent/generator.js.map +1 -1
  62. package/src/py/agent/mcp-connection/generator.js +7 -4
  63. package/src/py/agent/mcp-connection/generator.js.map +1 -1
  64. package/src/py/agent/mcp-connection/schema.d.js.map +1 -1
  65. package/src/py/agent/mcp-connection/schema.d.ts +1 -0
  66. package/src/py/agent/mcp-connection/schema.json +5 -0
  67. package/src/py/agent/react-connection/generator.d.ts +1 -1
  68. package/src/py/agent/react-connection/generator.js +7 -4
  69. package/src/py/agent/react-connection/generator.js.map +1 -1
  70. package/src/py/agent/react-connection/schema.d.js.map +1 -1
  71. package/src/py/agent/react-connection/schema.d.ts +1 -0
  72. package/src/py/agent/react-connection/schema.json +5 -0
  73. package/src/py/agent/schema.d.js.map +1 -1
  74. package/src/py/agent/schema.d.ts +1 -0
  75. package/src/py/agent/schema.json +5 -0
  76. package/src/py/api/generator.js +2 -1
  77. package/src/py/api/generator.js.map +1 -1
  78. package/src/py/api/schema.d.js.map +1 -1
  79. package/src/py/api/schema.d.ts +1 -0
  80. package/src/py/api/schema.json +5 -0
  81. package/src/py/dynamodb/agent-connection/generator.js +8 -6
  82. package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
  83. package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -1
  84. package/src/py/dynamodb/agent-connection/schema.d.ts +1 -0
  85. package/src/py/dynamodb/agent-connection/schema.json +5 -0
  86. package/src/py/dynamodb/fast-api-connection/generator.js +8 -6
  87. package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
  88. package/src/py/dynamodb/fast-api-connection/schema.d.js.map +1 -1
  89. package/src/py/dynamodb/fast-api-connection/schema.d.ts +1 -0
  90. package/src/py/dynamodb/fast-api-connection/schema.json +5 -0
  91. package/src/py/dynamodb/generator.js +10 -7
  92. package/src/py/dynamodb/generator.js.map +1 -1
  93. package/src/py/dynamodb/mcp-server-connection/generator.js +8 -6
  94. package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
  95. package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -1
  96. package/src/py/dynamodb/mcp-server-connection/schema.d.ts +1 -0
  97. package/src/py/dynamodb/mcp-server-connection/schema.json +5 -0
  98. package/src/py/dynamodb/schema.d.js.map +1 -1
  99. package/src/py/dynamodb/schema.d.ts +1 -0
  100. package/src/py/dynamodb/schema.json +5 -0
  101. package/src/py/fast-api/generator.js +10 -7
  102. package/src/py/fast-api/generator.js.map +1 -1
  103. package/src/py/fast-api/react/generator.d.ts +2 -2
  104. package/src/py/fast-api/react/generator.js +7 -5
  105. package/src/py/fast-api/react/generator.js.map +1 -1
  106. package/src/py/fast-api/react/schema.d.js.map +1 -1
  107. package/src/py/fast-api/react/schema.d.ts +1 -0
  108. package/src/py/fast-api/react/schema.json +5 -0
  109. package/src/py/fast-api/schema.d.js.map +1 -1
  110. package/src/py/fast-api/schema.d.ts +1 -0
  111. package/src/py/fast-api/schema.json +5 -0
  112. package/src/py/lambda-function/generator.js +8 -6
  113. package/src/py/lambda-function/generator.js.map +1 -1
  114. package/src/py/lambda-function/schema.d.js.map +1 -1
  115. package/src/py/lambda-function/schema.d.ts +1 -0
  116. package/src/py/lambda-function/schema.json +5 -0
  117. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +5 -5
  118. package/src/py/mcp-server/generator.js +8 -6
  119. package/src/py/mcp-server/generator.js.map +1 -1
  120. package/src/py/mcp-server/schema.d.js.map +1 -1
  121. package/src/py/mcp-server/schema.d.ts +1 -0
  122. package/src/py/mcp-server/schema.json +5 -0
  123. package/src/py/project/generator.js +9 -6
  124. package/src/py/project/generator.js.map +1 -1
  125. package/src/py/project/schema.d.js.map +1 -1
  126. package/src/py/project/schema.d.ts +1 -0
  127. package/src/py/project/schema.json +5 -0
  128. package/src/sdk/open-api.d.ts +1 -1
  129. package/src/sdk/open-api.js +1 -1
  130. package/src/sdk/open-api.js.map +1 -1
  131. package/src/sdk/utils/ast.d.ts +1 -2
  132. package/src/sdk/utils/ast.js +1 -2
  133. package/src/sdk/utils/ast.js.map +1 -1
  134. package/src/smithy/project/generator.js +7 -4
  135. package/src/smithy/project/generator.js.map +1 -1
  136. package/src/smithy/project/schema.d.js.map +1 -1
  137. package/src/smithy/project/schema.d.ts +1 -0
  138. package/src/smithy/project/schema.json +5 -0
  139. package/src/smithy/react-connection/generator.js +7 -4
  140. package/src/smithy/react-connection/generator.js.map +1 -1
  141. package/src/smithy/react-connection/schema.d.js.map +1 -1
  142. package/src/smithy/react-connection/schema.d.ts +1 -0
  143. package/src/smithy/react-connection/schema.json +5 -0
  144. package/src/smithy/ts/api/generator.js +11 -6
  145. package/src/smithy/ts/api/generator.js.map +1 -1
  146. package/src/smithy/ts/api/schema.d.js.map +1 -1
  147. package/src/smithy/ts/api/schema.d.ts +1 -0
  148. package/src/smithy/ts/api/schema.json +5 -0
  149. package/src/terraform/project/generator.js +13 -4
  150. package/src/terraform/project/generator.js.map +1 -1
  151. package/src/terraform/project/schema.d.js.map +1 -1
  152. package/src/terraform/project/schema.d.ts +1 -0
  153. package/src/terraform/project/schema.json +5 -0
  154. package/src/trpc/backend/generator.d.ts +1 -1
  155. package/src/trpc/backend/generator.js +9 -5
  156. package/src/trpc/backend/generator.js.map +1 -1
  157. package/src/trpc/backend/schema.d.js.map +1 -1
  158. package/src/trpc/backend/schema.d.ts +1 -0
  159. package/src/trpc/backend/schema.json +5 -0
  160. package/src/trpc/react/generator.d.ts +1 -1
  161. package/src/trpc/react/generator.js +9 -5
  162. package/src/trpc/react/generator.js.map +1 -1
  163. package/src/trpc/react/schema.d.js.map +1 -1
  164. package/src/trpc/react/schema.d.ts +1 -0
  165. package/src/trpc/react/schema.json +5 -0
  166. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +2 -2
  167. package/src/ts/agent/a2a-connection/generator.js +7 -4
  168. package/src/ts/agent/a2a-connection/generator.js.map +1 -1
  169. package/src/ts/agent/a2a-connection/schema.d.js.map +1 -1
  170. package/src/ts/agent/a2a-connection/schema.d.ts +1 -0
  171. package/src/ts/agent/a2a-connection/schema.json +5 -0
  172. package/src/ts/agent/gateway-connection/generator.js +7 -4
  173. package/src/ts/agent/gateway-connection/generator.js.map +1 -1
  174. package/src/ts/agent/gateway-connection/schema.d.js.map +1 -1
  175. package/src/ts/agent/gateway-connection/schema.d.ts +1 -0
  176. package/src/ts/agent/gateway-connection/schema.json +5 -0
  177. package/src/ts/agent/generator.js +7 -4
  178. package/src/ts/agent/generator.js.map +1 -1
  179. package/src/ts/agent/mcp-connection/generator.js +7 -4
  180. package/src/ts/agent/mcp-connection/generator.js.map +1 -1
  181. package/src/ts/agent/mcp-connection/schema.d.js.map +1 -1
  182. package/src/ts/agent/mcp-connection/schema.d.ts +1 -0
  183. package/src/ts/agent/mcp-connection/schema.json +5 -0
  184. package/src/ts/agent/react-connection/generator.d.ts +1 -1
  185. package/src/ts/agent/react-connection/generator.js +14 -8
  186. package/src/ts/agent/react-connection/generator.js.map +1 -1
  187. package/src/ts/agent/react-connection/schema.d.js.map +1 -1
  188. package/src/ts/agent/react-connection/schema.d.ts +1 -0
  189. package/src/ts/agent/react-connection/schema.json +5 -0
  190. package/src/ts/agent/schema.d.js.map +1 -1
  191. package/src/ts/agent/schema.d.ts +1 -0
  192. package/src/ts/agent/schema.json +5 -0
  193. package/src/ts/api/generator.js +4 -2
  194. package/src/ts/api/generator.js.map +1 -1
  195. package/src/ts/api/schema.d.js.map +1 -1
  196. package/src/ts/api/schema.d.ts +1 -0
  197. package/src/ts/api/schema.json +5 -0
  198. package/src/ts/astro-docs/generator.js +7 -6
  199. package/src/ts/astro-docs/generator.js.map +1 -1
  200. package/src/ts/astro-docs/schema.d.js.map +1 -1
  201. package/src/ts/astro-docs/schema.d.ts +2 -2
  202. package/src/ts/astro-docs/schema.json +3 -3
  203. package/src/ts/docs/schema.d.js.map +1 -1
  204. package/src/ts/docs/schema.d.ts +1 -4
  205. package/src/ts/docs/schema.json +3 -3
  206. package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -1
  207. package/src/ts/dynamodb/agent-connection/schema.d.ts +1 -0
  208. package/src/ts/dynamodb/agent-connection/schema.json +5 -0
  209. package/src/ts/dynamodb/generator.js +9 -5
  210. package/src/ts/dynamodb/generator.js.map +1 -1
  211. package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -1
  212. package/src/ts/dynamodb/mcp-server-connection/schema.d.ts +1 -0
  213. package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
  214. package/src/ts/dynamodb/schema.d.js.map +1 -1
  215. package/src/ts/dynamodb/schema.d.ts +1 -0
  216. package/src/ts/dynamodb/schema.json +5 -0
  217. package/src/ts/dynamodb/smithy-connection/schema.d.js.map +1 -1
  218. package/src/ts/dynamodb/smithy-connection/schema.d.ts +1 -0
  219. package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
  220. package/src/ts/dynamodb/trpc-connection/schema.d.js.map +1 -1
  221. package/src/ts/dynamodb/trpc-connection/schema.d.ts +1 -0
  222. package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
  223. package/src/ts/lambda-function/generator.js +7 -4
  224. package/src/ts/lambda-function/generator.js.map +1 -1
  225. package/src/ts/lambda-function/schema.d.js.map +1 -1
  226. package/src/ts/lambda-function/schema.d.ts +1 -0
  227. package/src/ts/lambda-function/schema.json +5 -0
  228. package/src/ts/lib/generator.js +10 -6
  229. package/src/ts/lib/generator.js.map +1 -1
  230. package/src/ts/lib/schema.d.js.map +1 -1
  231. package/src/ts/lib/schema.d.ts +1 -1
  232. package/src/ts/lib/schema.json +5 -0
  233. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  234. package/src/ts/mcp-server/generator.js +7 -4
  235. package/src/ts/mcp-server/generator.js.map +1 -1
  236. package/src/ts/mcp-server/schema.d.js.map +1 -1
  237. package/src/ts/mcp-server/schema.d.ts +1 -0
  238. package/src/ts/mcp-server/schema.json +5 -0
  239. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +18 -8
  240. package/src/ts/nx-generator/files/common/schema.d.ts.template +1 -0
  241. package/src/ts/nx-generator/files/common/schema.json.template +5 -0
  242. package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +3 -4
  243. package/src/ts/nx-generator/generator.js +7 -4
  244. package/src/ts/nx-generator/generator.js.map +1 -1
  245. package/src/ts/nx-generator/schema.d.js.map +1 -1
  246. package/src/ts/nx-generator/schema.d.ts +1 -0
  247. package/src/ts/nx-generator/schema.json +5 -0
  248. package/src/ts/nx-plugin/generator.js +13 -6
  249. package/src/ts/nx-plugin/generator.js.map +1 -1
  250. package/src/ts/nx-plugin/schema.json +5 -0
  251. package/src/ts/rdb/agent-connection/schema.d.js.map +1 -1
  252. package/src/ts/rdb/agent-connection/schema.d.ts +1 -0
  253. package/src/ts/rdb/agent-connection/schema.json +5 -0
  254. package/src/ts/rdb/generator.js +9 -5
  255. package/src/ts/rdb/generator.js.map +1 -1
  256. package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -1
  257. package/src/ts/rdb/mcp-server-connection/schema.d.ts +1 -0
  258. package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
  259. package/src/ts/rdb/schema.d.js.map +1 -1
  260. package/src/ts/rdb/schema.d.ts +1 -0
  261. package/src/ts/rdb/schema.json +5 -0
  262. package/src/ts/rdb/smithy-connection/schema.d.js.map +1 -1
  263. package/src/ts/rdb/smithy-connection/schema.d.ts +1 -0
  264. package/src/ts/rdb/smithy-connection/schema.json +5 -0
  265. package/src/ts/rdb/trpc-connection/schema.d.js.map +1 -1
  266. package/src/ts/rdb/trpc-connection/schema.d.ts +1 -0
  267. package/src/ts/rdb/trpc-connection/schema.json +5 -0
  268. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -26
  269. package/src/ts/react-website/app/generator.d.ts +1 -1
  270. package/src/ts/react-website/app/generator.js +18 -6
  271. package/src/ts/react-website/app/generator.js.map +1 -1
  272. package/src/ts/react-website/app/schema.d.js.map +1 -1
  273. package/src/ts/react-website/app/schema.d.ts +1 -1
  274. package/src/ts/react-website/app/schema.json +5 -0
  275. package/src/ts/react-website/cognito-auth/__snapshots__/generator.spec.ts.snap +10 -7
  276. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +1 -1
  277. package/src/ts/react-website/cognito-auth/generator.d.ts +1 -1
  278. package/src/ts/react-website/cognito-auth/generator.js +9 -5
  279. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  280. package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -1
  281. package/src/ts/react-website/cognito-auth/schema.d.ts +1 -0
  282. package/src/ts/react-website/cognito-auth/schema.json +5 -0
  283. package/src/ts/react-website/runtime-config/schema.d.js.map +1 -1
  284. package/src/ts/react-website/runtime-config/schema.d.ts +1 -0
  285. package/src/ts/react-website/runtime-config/schema.json +5 -0
  286. package/src/ts/website/app/schema.d.js.map +1 -1
  287. package/src/ts/website/app/schema.d.ts +1 -1
  288. package/src/ts/website/app/schema.json +5 -0
  289. package/src/ts/website/auth/generator.d.ts +1 -1
  290. package/src/ts/website/auth/generator.js +2 -1
  291. package/src/ts/website/auth/generator.js.map +1 -1
  292. package/src/ts/website/auth/schema.d.js.map +1 -1
  293. package/src/ts/website/auth/schema.d.ts +1 -0
  294. package/src/ts/website/auth/schema.json +5 -0
  295. package/src/utils/files/common/scripts/src/infra/stage-credentials/cdk-command.ts.template +11 -3
  296. package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +10 -7
  297. package/src/utils/install.d.ts +32 -0
  298. package/src/utils/install.js +56 -0
  299. package/src/utils/install.js.map +1 -0
  300. package/src/utils/versions.d.ts +64 -64
  301. package/src/utils/versions.js +63 -63
  302. package/src/utils/versions.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/fast-api/react/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport interface FastApiReactGeneratorSchema {\n frontendProjectName: string;\n fastApiProjectName: string;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GACD,WAGC"}
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/py/fast-api/react/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport interface FastApiReactGeneratorSchema {\n frontendProjectName: string;\n fastApiProjectName: string;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GACD,WAIC"}
@@ -5,4 +5,5 @@
5
5
  export interface FastApiReactGeneratorSchema {
6
6
  frontendProjectName: string;
7
7
  fastApiProjectName: string;
8
+ preferInstallDependencies?: boolean;
8
9
  }
@@ -20,6 +20,11 @@
20
20
  "description": "",
21
21
  "x-prompt": "Package containing your FastAPI backend",
22
22
  "x-dropdown": "projects"
23
+ },
24
+ "preferInstallDependencies": {
25
+ "type": "boolean",
26
+ "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
27
+ "default": true
23
28
  }
24
29
  },
25
30
  "required": ["frontendProjectName", "fastApiProjectName"]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/fast-api/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\nexport interface PyFastApiProjectGeneratorSchema {\n readonly name: string;\n readonly infra: 'rest-lambda' | 'http-lambda' | 'none';\n readonly integrationPattern?: 'isolated' | 'shared';\n readonly auth: 'iam' | 'cognito' | 'custom';\n readonly directory?: string;\n readonly subDirectory?: string;\n readonly moduleName?: string;\n readonly iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAID,WASC"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/fast-api/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\nexport interface PyFastApiProjectGeneratorSchema {\n readonly name: string;\n readonly infra: 'rest-lambda' | 'http-lambda' | 'none';\n readonly integrationPattern?: 'isolated' | 'shared';\n readonly auth: 'iam' | 'cognito' | 'custom';\n readonly directory?: string;\n readonly subDirectory?: string;\n readonly moduleName?: string;\n readonly iac: IacOption;\n readonly preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAID,WAUC"}
@@ -14,4 +14,5 @@ export interface PyFastApiProjectGeneratorSchema {
14
14
  readonly subDirectory?: string;
15
15
  readonly moduleName?: string;
16
16
  readonly iac: IacOption;
17
+ readonly preferInstallDependencies?: boolean;
17
18
  }
@@ -76,6 +76,11 @@
76
76
  "enum": ["rest-lambda", "http-lambda", "none"],
77
77
  "x-prompt": "What infrastructure would you like to deploy your API with?",
78
78
  "x-priority": "important"
79
+ },
80
+ "preferInstallDependencies": {
81
+ "type": "boolean",
82
+ "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
83
+ "default": true
79
84
  }
80
85
  },
81
86
  "required": ["name"]
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ import { generateFiles, installPackagesTask, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
4
+ */ import { generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
5
5
  import { addPythonBundleTarget } from "../../utils/bundle/bundle.js";
6
6
  import { formatFilesInSubtree } from "../../utils/format.js";
7
7
  import { addLambdaFunctionInfra } from "../../utils/function-constructs/function-constructs.js";
8
8
  import { resolveIac } from "../../utils/iac.js";
9
+ import { installDependencies } from "../../utils/install.js";
9
10
  import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
10
11
  import { toClassName, toDotNotation, toKebabCase, toSnakeCase } from "../../utils/names.js";
11
12
  import { getNpmScope } from "../../utils/npm-scope.js";
12
13
  import { addComponentGeneratorMetadata, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
13
- import { Logger, UVProvider } from "../../utils/nxlv-python.js";
14
14
  import { sortObjectKeys } from "../../utils/object.js";
15
15
  import { toProjectRelativePath } from "../../utils/paths.js";
16
16
  import { addDependenciesToPyProjectToml } from "../../utils/py.js";
@@ -104,10 +104,12 @@ const getLambdaFunctionDetails = (tree, schema)=>{
104
104
  LAMBDA_FUNCTION_GENERATOR_INFO
105
105
  ]);
106
106
  await formatFilesInSubtree(tree);
107
- return async ()=>{
108
- await new UVProvider(tree.root, new Logger(), tree).install();
109
- installPackagesTask(tree);
110
- };
107
+ return ()=>installDependencies(tree, schema.preferInstallDependencies, {
108
+ languages: [
109
+ 'typescript',
110
+ 'python'
111
+ ]
112
+ });
111
113
  };
112
114
  export default pyLambdaFunctionGenerator;
113
115
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/lambda-function/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n installPackagesTask,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { addLambdaFunctionInfra } from '../../utils/function-constructs/function-constructs';\nimport { resolveIac } from '../../utils/iac';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport {\n toClassName,\n toDotNotation,\n toKebabCase,\n toSnakeCase,\n} from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { Logger, UVProvider } from '../../utils/nxlv-python';\nimport { sortObjectKeys } from '../../utils/object';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport type { PyLambdaFunctionGeneratorSchema } from './schema';\n\nexport const LAMBDA_FUNCTION_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport interface LambdaFunctionDetails {\n /**\n * The normalized name of the lambda handler project\n */\n readonly normalizedFunctionName: string;\n /**\n * The full package name of the lambda handler construct\n */\n readonly fullyQualifiedFunctionName: string;\n /**\n * The normalized python path to the lambda handler file in dot notation (e.g. `app.lambda_functions.lambda_handler`)\n */\n readonly normalizedFunctionPath: string;\n}\n\nconst getLambdaFunctionDetails = (\n tree: Tree,\n schema: { moduleName: string; name: string; functionPath?: string },\n): LambdaFunctionDetails => {\n const scope = toSnakeCase(getNpmScope(tree));\n const normalizedFunctionName = toSnakeCase(schema.name);\n const fullyQualifiedFunctionName = `${scope}.${normalizedFunctionName}`;\n const normalizedFunctionPath = `${schema.moduleName}.${schema.functionPath ? `${toDotNotation(schema.functionPath)}.` : ''}${normalizedFunctionName}.lambda_handler`;\n\n return {\n fullyQualifiedFunctionName,\n normalizedFunctionName,\n normalizedFunctionPath,\n };\n};\n\n/**\n * Generates a Python Lambda Function to add to a python project\n */\nexport const pyLambdaFunctionGenerator = async (\n tree: Tree,\n schema: PyLambdaFunctionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const projectConfig = readProjectConfigurationUnqualified(\n tree,\n schema.project,\n );\n\n const pyProjectPath = joinPathFragments(projectConfig.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `This generator does not support selected project ${schema.project}`,\n );\n }\n\n if (!projectConfig.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n const dir = projectConfig.root;\n const projectNameWithOutScope = projectConfig.name.split('.').pop();\n const normalizedProjectName = toSnakeCase(projectNameWithOutScope);\n\n // Module name is the last part of the source root,\n const sourceParts = projectConfig.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const { normalizedFunctionName, normalizedFunctionPath } =\n getLambdaFunctionDetails(tree, {\n moduleName,\n name: schema.name,\n functionPath: schema.functionPath,\n });\n\n const constructFunctionName = `${normalizedProjectName}_${normalizedFunctionName}`;\n const constructFunctionClassName = toClassName(constructFunctionName);\n const constructFunctionKebabCase = toKebabCase(constructFunctionName);\n const lambdaFunctionClassName = toClassName(schema.name);\n const lambdaFunctionKebabCase = toKebabCase(schema.name);\n\n const functionPath = joinPathFragments(\n projectConfig.sourceRoot,\n schema.functionPath ?? '',\n `${normalizedFunctionName}.py`,\n );\n\n const infra = schema.infra ?? 'lambda';\n const handlerAlreadyExists = tree.exists(functionPath);\n\n if (handlerAlreadyExists && infra === 'none') {\n throw new Error(\n `This project already has a lambda function with the name ${normalizedFunctionName}. Please remove the lambda function before running this generator or use a different name.`,\n );\n }\n\n // Check if the project has a bundle target and if not add it\n const { bundleOutputDir } = addPythonBundleTarget(projectConfig);\n\n if (infra !== 'none') {\n const iac = await resolveIac(tree, schema.iac);\n\n await sharedConstructsGenerator(tree, {\n iac,\n });\n\n await addLambdaFunctionInfra(tree, {\n functionProjectName: projectConfig.name,\n nameClassName: constructFunctionClassName,\n nameKebabCase: constructFunctionKebabCase,\n handler: normalizedFunctionPath,\n bundlePathFromRoot: bundleOutputDir,\n runtime: 'python',\n iac,\n });\n }\n\n const enhancedOptions = {\n ...schema,\n dir,\n lambdaFunctionClassName,\n lambdaFunctionSnakeCase: normalizedFunctionName,\n };\n\n projectConfig.targets = sortObjectKeys(projectConfig.targets);\n updateProjectConfiguration(tree, projectConfig.name, projectConfig);\n\n // Generate the lambda handler file\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, 'files', 'handler'), // path to the file templates\n joinPathFragments(projectConfig.sourceRoot, schema.functionPath ?? ''),\n enhancedOptions,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Generate the lambda handler test file\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'tests'),\n joinPathFragments(dir, 'tests'),\n enhancedOptions,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addDependenciesToPyProjectToml(tree, dir, [\n 'aws-lambda-powertools',\n 'aws-lambda-powertools[tracer]',\n 'aws-lambda-powertools[parser]',\n ]);\n\n addComponentGeneratorMetadata(\n tree,\n projectConfig.name,\n LAMBDA_FUNCTION_GENERATOR_INFO,\n toProjectRelativePath(projectConfig, functionPath),\n lambdaFunctionKebabCase,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [LAMBDA_FUNCTION_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n return async () => {\n await new UVProvider(tree.root, new Logger(), tree).install();\n installPackagesTask(tree);\n };\n};\nexport default pyLambdaFunctionGenerator;\n"],"names":["generateFiles","installPackagesTask","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addPythonBundleTarget","formatFilesInSubtree","addLambdaFunctionInfra","resolveIac","addGeneratorMetricsIfApplicable","toClassName","toDotNotation","toKebabCase","toSnakeCase","getNpmScope","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","Logger","UVProvider","sortObjectKeys","toProjectRelativePath","addDependenciesToPyProjectToml","sharedConstructsGenerator","LAMBDA_FUNCTION_GENERATOR_INFO","filename","getLambdaFunctionDetails","tree","schema","scope","normalizedFunctionName","name","fullyQualifiedFunctionName","normalizedFunctionPath","moduleName","functionPath","pyLambdaFunctionGenerator","projectConfig","project","pyProjectPath","root","Error","sourceRoot","dir","projectNameWithOutScope","split","pop","normalizedProjectName","sourceParts","length","constructFunctionName","constructFunctionClassName","constructFunctionKebabCase","lambdaFunctionClassName","lambdaFunctionKebabCase","infra","handlerAlreadyExists","exists","bundleOutputDir","iac","functionProjectName","nameClassName","nameKebabCase","handler","bundlePathFromRoot","runtime","enhancedOptions","lambdaFunctionSnakeCase","targets","dirname","overwriteStrategy","KeepExisting","install"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,m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AWmB,MAAMC,OAAO+B,GAAG;QAE7C,MAAMpC,0BAA0BI,MAAM;YACpCgC;QACF;QAEA,MAAMpD,uBAAuBoB,MAAM;YACjCiC,qBAAqBvB,cAAcN,IAAI;YACvC8B,eAAeV;YACfW,eAAeV;YACfW,SAAS9B;YACT+B,oBAAoBN;YACpBO,SAAS;YACTN;QACF;IACF;IAEA,MAAMO,kBAAkB;QACtB,GAAGtC,MAAM;QACTe;QACAU;QACAc,yBAAyBrC;IAC3B;IAEAO,cAAc+B,OAAO,GAAGhD,eAAeiB,cAAc+B,OAAO;IAC5DhE,2BAA2BuB,MAAMU,cAAcN,IAAI,EAAEM;IAErD,mCAAmC;IACnCrC,cACE2B,MACAzB,kBAAkB,YAAYmE,OAAO,EAAE,SAAS,YAChDnE,kBAAkBmC,cAAcK,UAAU,EAAEd,OAAOO,YAAY,IAAI,KACnE+B,iBACA;QAAEI,mBAAmBnE,kBAAkBoE,YAAY;IAAC;IAGtD,wCAAwC;IACxCvE,cACE2B,MACAzB,kBAAkB,YAAYmE,OAAO,EAAE,SAAS,UAChDnE,kBAAkByC,KAAK,UACvBuB,iBACA;QAAEI,mBAAmBnE,kBAAkBoE,YAAY;IAAC;IAGtDjD,+BAA+BK,MAAMgB,KAAK;QACxC;QACA;QACA;KACD;IAED5B,8BACEY,MACAU,cAAcN,IAAI,EAClBP,gCACAH,sBAAsBgB,eAAeF,eACrCmB;IAGF,MAAM7C,gCAAgCkB,MAAM;QAACH;KAA+B;IAE5E,MAAMlB,qBAAqBqB;IAE3B,OAAO;QACL,MAAM,IAAIR,WAAWQ,KAAKa,IAAI,EAAE,IAAItB,UAAUS,MAAM6C,OAAO;QAC3DvE,oBAAoB0B;IACtB;AACF,EAAE;AACF,eAAeS,0BAA0B"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/lambda-function/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { addLambdaFunctionInfra } from '../../utils/function-constructs/function-constructs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport {\n toClassName,\n toDotNotation,\n toKebabCase,\n toSnakeCase,\n} from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { sortObjectKeys } from '../../utils/object';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport type { PyLambdaFunctionGeneratorSchema } from './schema';\n\nexport const LAMBDA_FUNCTION_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport interface LambdaFunctionDetails {\n /**\n * The normalized name of the lambda handler project\n */\n readonly normalizedFunctionName: string;\n /**\n * The full package name of the lambda handler construct\n */\n readonly fullyQualifiedFunctionName: string;\n /**\n * The normalized python path to the lambda handler file in dot notation (e.g. `app.lambda_functions.lambda_handler`)\n */\n readonly normalizedFunctionPath: string;\n}\n\nconst getLambdaFunctionDetails = (\n tree: Tree,\n schema: { moduleName: string; name: string; functionPath?: string },\n): LambdaFunctionDetails => {\n const scope = toSnakeCase(getNpmScope(tree));\n const normalizedFunctionName = toSnakeCase(schema.name);\n const fullyQualifiedFunctionName = `${scope}.${normalizedFunctionName}`;\n const normalizedFunctionPath = `${schema.moduleName}.${schema.functionPath ? `${toDotNotation(schema.functionPath)}.` : ''}${normalizedFunctionName}.lambda_handler`;\n\n return {\n fullyQualifiedFunctionName,\n normalizedFunctionName,\n normalizedFunctionPath,\n };\n};\n\n/**\n * Generates a Python Lambda Function to add to a python project\n */\nexport const pyLambdaFunctionGenerator = async (\n tree: Tree,\n schema: PyLambdaFunctionGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const projectConfig = readProjectConfigurationUnqualified(\n tree,\n schema.project,\n );\n\n const pyProjectPath = joinPathFragments(projectConfig.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `This generator does not support selected project ${schema.project}`,\n );\n }\n\n if (!projectConfig.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n const dir = projectConfig.root;\n const projectNameWithOutScope = projectConfig.name.split('.').pop();\n const normalizedProjectName = toSnakeCase(projectNameWithOutScope);\n\n // Module name is the last part of the source root,\n const sourceParts = projectConfig.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const { normalizedFunctionName, normalizedFunctionPath } =\n getLambdaFunctionDetails(tree, {\n moduleName,\n name: schema.name,\n functionPath: schema.functionPath,\n });\n\n const constructFunctionName = `${normalizedProjectName}_${normalizedFunctionName}`;\n const constructFunctionClassName = toClassName(constructFunctionName);\n const constructFunctionKebabCase = toKebabCase(constructFunctionName);\n const lambdaFunctionClassName = toClassName(schema.name);\n const lambdaFunctionKebabCase = toKebabCase(schema.name);\n\n const functionPath = joinPathFragments(\n projectConfig.sourceRoot,\n schema.functionPath ?? '',\n `${normalizedFunctionName}.py`,\n );\n\n const infra = schema.infra ?? 'lambda';\n const handlerAlreadyExists = tree.exists(functionPath);\n\n if (handlerAlreadyExists && infra === 'none') {\n throw new Error(\n `This project already has a lambda function with the name ${normalizedFunctionName}. Please remove the lambda function before running this generator or use a different name.`,\n );\n }\n\n // Check if the project has a bundle target and if not add it\n const { bundleOutputDir } = addPythonBundleTarget(projectConfig);\n\n if (infra !== 'none') {\n const iac = await resolveIac(tree, schema.iac);\n\n await sharedConstructsGenerator(tree, {\n iac,\n });\n\n await addLambdaFunctionInfra(tree, {\n functionProjectName: projectConfig.name,\n nameClassName: constructFunctionClassName,\n nameKebabCase: constructFunctionKebabCase,\n handler: normalizedFunctionPath,\n bundlePathFromRoot: bundleOutputDir,\n runtime: 'python',\n iac,\n });\n }\n\n const enhancedOptions = {\n ...schema,\n dir,\n lambdaFunctionClassName,\n lambdaFunctionSnakeCase: normalizedFunctionName,\n };\n\n projectConfig.targets = sortObjectKeys(projectConfig.targets);\n updateProjectConfiguration(tree, projectConfig.name, projectConfig);\n\n // Generate the lambda handler file\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, 'files', 'handler'), // path to the file templates\n joinPathFragments(projectConfig.sourceRoot, schema.functionPath ?? ''),\n enhancedOptions,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Generate the lambda handler test file\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'tests'),\n joinPathFragments(dir, 'tests'),\n enhancedOptions,\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addDependenciesToPyProjectToml(tree, dir, [\n 'aws-lambda-powertools',\n 'aws-lambda-powertools[tracer]',\n 'aws-lambda-powertools[parser]',\n ]);\n\n addComponentGeneratorMetadata(\n tree,\n projectConfig.name,\n LAMBDA_FUNCTION_GENERATOR_INFO,\n toProjectRelativePath(projectConfig, functionPath),\n lambdaFunctionKebabCase,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [LAMBDA_FUNCTION_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\nexport default pyLambdaFunctionGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","addPythonBundleTarget","formatFilesInSubtree","addLambdaFunctionInfra","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","toClassName","toDotNotation","toKebabCase","toSnakeCase","getNpmScope","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","toProjectRelativePath","addDependenciesToPyProjectToml","sharedConstructsGenerator","LAMBDA_FUNCTION_GENERATOR_INFO","filename","getLambdaFunctionDetails","tree","schema","scope","normalizedFunctionName","name","fullyQualifiedFunctionName","normalizedFunctionPath","moduleName","functionPath","pyLambdaFunctionGenerator","projectConfig","project","pyProjectPath","root","Error","sourceRoot","dir","projectNameWithOutScope","split","pop","normalizedProjectName","sourceParts","length","constructFunctionName","constructFunctionClassName","constructFunctionKebabCase","lambdaFunctionClassName","lambdaFunctionKebabCase","infra","handlerAlreadyExists","exists","bundleOutputDir","iac","functionProjectName","nameClassName","nameKebabCase","handler","bundlePathFromRoot","runtime","enhancedOptions","lambdaFunctionSnakeCase","targets","dirname","overwriteStrategy","KeepExisting","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,qBAAqB,QAAQ,+BAA4B;AAClE,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,SAASC,sBAAsB,QAAQ,yDAAsD;AAC7F,SAASC,UAAU,QAAQ,qBAAkB;AAC7C,SAASC,mBAAmB,QAAQ,yBAAsB;AAC1D,SAASC,+BAA+B,QAAQ,yBAAsB;AACtE,SACEC,WAAW,EACXC,aAAa,EACbC,WAAW,EACXC,WAAW,QACN,uBAAoB;AAC3B,SAASC,WAAW,QAAQ,2BAAwB;AACpD,SACEC,6BAA6B,EAC7BC,gBAAgB,EAEhBC,mCAAmC,QAC9B,oBAAiB;AACxB,SAASC,cAAc,QAAQ,wBAAqB;AACpD,SAASC,qBAAqB,QAAQ,uBAAoB;AAC1D,SAASC,8BAA8B,QAAQ,oBAAiB;AAChE,SAASC,yBAAyB,QAAQ,mCAAgC;AAG1E,OAAO,MAAMC,iCAAkDN,iBAC7D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AAE,SAAS,UAChDlE,kBAAkBwC,KAAK,UACvBuB,iBACA;QAAEI,mBAAmBlE,kBAAkBmE,YAAY;IAAC;IAGtDjD,+BAA+BK,MAAMgB,KAAK;QACxC;QACA;QACA;KACD;IAED1B,8BACEU,MACAU,cAAcN,IAAI,EAClBP,gCACAH,sBAAsBgB,eAAeF,eACrCmB;IAGF,MAAM3C,gCAAgCgB,MAAM;QAACH;KAA+B;IAE5E,MAAMjB,qBAAqBoB;IAE3B,OAAO,IACLjB,oBAAoBiB,MAAMC,OAAO4C,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AACF,eAAerC,0BAA0B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/lambda-function/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\ntype EventSource =\n | 'Any'\n | 'AlbModel'\n | 'APIGatewayProxyEventModel'\n | 'ApiGatewayAuthorizerToken'\n | 'ApiGatewayAuthorizerRequest'\n | 'APIGatewayProxyEventV2Model'\n | 'ApiGatewayAuthorizerRequestV2'\n | 'APIGatewayWebSocketMessageEventModel'\n | 'APIGatewayWebSocketConnectEventModel'\n | 'APIGatewayWebSocketDisconnectEventModel'\n | 'BedrockAgentEventModel'\n | 'CloudFormationCustomResourceCreateModel'\n | 'CloudFormationCustomResourceUpdateModel'\n | 'CloudFormationCustomResourceDeleteModel'\n | 'CloudwatchLogsModel'\n | 'DynamoDBStreamModel'\n | 'EventBridgeModel'\n | 'IoTCoreThingEvent'\n | 'IoTCoreThingTypeEvent'\n | 'IoTCoreThingTypeAssociationEvent'\n | 'IoTCoreThingGroupEvent'\n | 'IoTCoreAddOrRemoveFromThingGroupEvent'\n | 'IoTCoreAddOrDeleteFromThingGroupEvent'\n | 'KafkaMskEventModel'\n | 'KafkaSelfManagedEventModel'\n | 'KinesisDataStreamModel'\n | 'KinesisFirehoseModel'\n | 'KinesisFirehoseSqsModel'\n | 'LambdaFunctionUrlModel'\n | 'S3BatchOperationModel'\n | 'S3EventNotificationEventBridgeModel'\n | 'S3Model'\n | 'S3ObjectLambdaEvent'\n | 'S3SqsEventNotificationModel'\n | 'SesModel'\n | 'SnsModel'\n | 'SqsModel'\n | 'TransferFamilyAuthorizer'\n | 'VpcLatticeModel'\n | 'VpcLatticeV2Model';\n\nexport type LambdaInfraOption = 'lambda' | 'none';\n\nexport interface PyLambdaFunctionGeneratorSchema {\n readonly project: string;\n readonly name: string;\n readonly functionPath?: string;\n readonly event?: EventSource;\n readonly infra?: LambdaInfraOption;\n readonly iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAgDD,WAOC"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/lambda-function/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\ntype EventSource =\n | 'Any'\n | 'AlbModel'\n | 'APIGatewayProxyEventModel'\n | 'ApiGatewayAuthorizerToken'\n | 'ApiGatewayAuthorizerRequest'\n | 'APIGatewayProxyEventV2Model'\n | 'ApiGatewayAuthorizerRequestV2'\n | 'APIGatewayWebSocketMessageEventModel'\n | 'APIGatewayWebSocketConnectEventModel'\n | 'APIGatewayWebSocketDisconnectEventModel'\n | 'BedrockAgentEventModel'\n | 'CloudFormationCustomResourceCreateModel'\n | 'CloudFormationCustomResourceUpdateModel'\n | 'CloudFormationCustomResourceDeleteModel'\n | 'CloudwatchLogsModel'\n | 'DynamoDBStreamModel'\n | 'EventBridgeModel'\n | 'IoTCoreThingEvent'\n | 'IoTCoreThingTypeEvent'\n | 'IoTCoreThingTypeAssociationEvent'\n | 'IoTCoreThingGroupEvent'\n | 'IoTCoreAddOrRemoveFromThingGroupEvent'\n | 'IoTCoreAddOrDeleteFromThingGroupEvent'\n | 'KafkaMskEventModel'\n | 'KafkaSelfManagedEventModel'\n | 'KinesisDataStreamModel'\n | 'KinesisFirehoseModel'\n | 'KinesisFirehoseSqsModel'\n | 'LambdaFunctionUrlModel'\n | 'S3BatchOperationModel'\n | 'S3EventNotificationEventBridgeModel'\n | 'S3Model'\n | 'S3ObjectLambdaEvent'\n | 'S3SqsEventNotificationModel'\n | 'SesModel'\n | 'SnsModel'\n | 'SqsModel'\n | 'TransferFamilyAuthorizer'\n | 'VpcLatticeModel'\n | 'VpcLatticeV2Model';\n\nexport type LambdaInfraOption = 'lambda' | 'none';\n\nexport interface PyLambdaFunctionGeneratorSchema {\n readonly project: string;\n readonly name: string;\n readonly functionPath?: string;\n readonly event?: EventSource;\n readonly infra?: LambdaInfraOption;\n readonly iac: IacOption;\n readonly preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAgDD,WAQC"}
@@ -56,4 +56,5 @@ export interface PyLambdaFunctionGeneratorSchema {
56
56
  readonly event?: EventSource;
57
57
  readonly infra?: LambdaInfraOption;
58
58
  readonly iac: IacOption;
59
+ readonly preferInstallDependencies?: boolean;
59
60
  }
@@ -90,6 +90,11 @@
90
90
  "x-priority": "important",
91
91
  "default": "inherit",
92
92
  "x-prompt": "Which provider would you like to manage your infrastructure? (default: inherit)"
93
+ },
94
+ "preferInstallDependencies": {
95
+ "type": "boolean",
96
+ "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
97
+ "default": true
93
98
  }
94
99
  },
95
100
  "required": ["project", "name"]
@@ -489,7 +489,7 @@ resource "null_resource" "runtime_ready" {
489
489
 
490
490
  provisioner "local-exec" {
491
491
  command = <<-EOT
492
- uv run --with boto3==1.43.29 python -c "
492
+ uv run --with boto3==1.43.37 python -c "
493
493
  import boto3
494
494
  import json
495
495
  import os
@@ -716,11 +716,11 @@ exports[`py#mcp-server generator > should match snapshot for generated files > u
716
716
  name = "proj.test_project"
717
717
  version = "0.1.0"
718
718
  dependencies = [
719
- "aws-lambda-powertools==3.29.0",
720
- "mcp==1.27.2",
719
+ "aws-lambda-powertools==3.31.0",
720
+ "mcp==1.28.1",
721
721
  "uvicorn==0.49.0",
722
- "boto3==1.43.29",
723
- "aws-opentelemetry-distro==0.17.1"
722
+ "boto3==1.43.37",
723
+ "aws-opentelemetry-distro==0.18.0"
724
724
  ]
725
725
 
726
726
  [dependency-groups]
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ import { addDependenciesToPackageJson, generateFiles, installPackagesTask, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
4
+ */ import { addDependenciesToPackageJson, generateFiles, joinPathFragments, OverwriteStrategy, updateProjectConfiguration } from "@nx/devkit";
5
5
  import { ensureLicenseExceptions } from "../../license/config.js";
6
6
  import { MCP_INSPECTOR_EXCEPTIONS } from "../../license/known-exceptions.js";
7
7
  import { addMcpServerInfra } from "../../utils/agent-core-constructs/agent-core-constructs.js";
@@ -10,11 +10,11 @@ import { resolveContainers } from "../../utils/containers.js";
10
10
  import { formatFilesInSubtree } from "../../utils/format.js";
11
11
  import { FsCommands } from "../../utils/fs.js";
12
12
  import { resolveIac } from "../../utils/iac.js";
13
+ import { installDependencies } from "../../utils/install.js";
13
14
  import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
14
15
  import { kebabCase, toClassName, toSnakeCase } from "../../utils/names.js";
15
16
  import { getNpmScope } from "../../utils/npm-scope.js";
16
17
  import { addComponentDevTarget, addComponentGeneratorMetadata, addDependencyToTargetIfNotPresent, getGeneratorInfo, readProjectConfigurationUnqualified } from "../../utils/nx.js";
17
- import { Logger, UVProvider } from "../../utils/nxlv-python.js";
18
18
  import { toProjectRelativePath } from "../../utils/paths.js";
19
19
  import { assignPort } from "../../utils/port.js";
20
20
  import { addDependenciesToPyProjectToml } from "../../utils/py.js";
@@ -206,10 +206,12 @@ export const pyMcpServerGenerator = async (tree, options)=>{
206
206
  ]);
207
207
  await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);
208
208
  await formatFilesInSubtree(tree);
209
- return async ()=>{
210
- installPackagesTask(tree);
211
- await new UVProvider(tree.root, new Logger(), tree).install();
212
- };
209
+ return ()=>installDependencies(tree, options.preferInstallDependencies, {
210
+ languages: [
211
+ 'typescript',
212
+ 'python'
213
+ ]
214
+ });
213
215
  };
214
216
  export default pyMcpServerGenerator;
215
217
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n type GeneratorCallback,\n generateFiles,\n installPackagesTask,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { Logger, UVProvider } from '../../utils/nxlv-python';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { assignPort } from '../../utils/port';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { withVersions } from '../../utils/versions';\nimport type { PyMcpServerGeneratorSchema } from './schema';\n\nexport const PY_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyMcpServerGenerator = async (\n tree: Tree,\n options: PyMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n const pyProjectPath = joinPathFragments(project.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a Python project (with a pyproject.toml)`,\n );\n }\n\n if (!project.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n // Module name is the last part of the source root,\n const sourceParts = project.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const name = kebabCase(\n options.name || `${kebabCase(project.name.split('.').pop())}-mcp-server`,\n );\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n\n const mcpServerNameSnakeCase = toSnakeCase(options.name || 'mcp-server');\n const mcpServerNameClassName = toClassName(name);\n\n const targetSourceDir = joinPathFragments(\n project.sourceRoot,\n mcpServerNameSnakeCase,\n );\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'app'),\n targetSourceDir,\n {\n name,\n mcpServerNameSnakeCase,\n mcpServerNameClassName,\n moduleName,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addDependenciesToPyProjectToml(tree, project.root, [\n 'aws-lambda-powertools',\n 'mcp',\n 'uvicorn',\n 'boto3',\n 'aws-opentelemetry-distro',\n ]);\n\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n project,\n {\n pythonPlatform: 'aarch64-manylinux_2_28',\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n mcpServerNameSnakeCase,\n moduleName,\n bundleOutputDir,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'docker',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n // Add a docker target that prepares the docker context and builds the image\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(dockerOutputDir),\n fs.mkdir(dockerOutputDir),\n fs.cp(bundleOutputDir, dockerOutputDir),\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: PY_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`uv run -m ${moduleName}.${mcpServerNameSnakeCase}.stdio`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `uv run uvicorn --reload ${moduleName}.${mcpServerNameSnakeCase}.http:app --host 0.0.0.0 --port ${localDevPort}`,\n ],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `uv run uvicorn --reload ${moduleName}.${mcpServerNameSnakeCase}.http:app --host 0.0.0.0 --port ${localDevPort}`,\n ],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- uv run -m ${moduleName}.${mcpServerNameSnakeCase}.stdio`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n targets: mcpTargets,\n });\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(['@modelcontextprotocol/inspector']),\n );\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n PY_MCP_SERVER_GENERATOR_INFO,\n toProjectRelativePath(project, targetSourceDir),\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [PY_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return async () => {\n installPackagesTask(tree);\n await new UVProvider(tree.root, new Logger(), tree).install();\n };\n};\n\nexport default pyMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","generateFiles","installPackagesTask","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addPythonBundleTarget","resolveContainers","formatFilesInSubtree","FsCommands","resolveIac","addGeneratorMetricsIfApplicable","kebabCase","toClassName","toSnakeCase","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","Logger","UVProvider","toProjectRelativePath","assignPort","addDependenciesToPyProjectToml","sharedConstructsGenerator","withVersions","PY_MCP_SERVER_GENERATOR_INFO","filename","pyMcpServerGenerator","tree","options","project","pyProjectPath","root","Error","sourceRoot","sourceParts","split","moduleName","length","name","pop","mcpTargetPrefix","mcpServerNameSnakeCase","mcpServerNameClassName","targetSourceDir","infra","auth","console","warn","dirname","overwriteStrategy","KeepExisting","containers","dockerImageTag","bundleTargetName","bundleOutputDir","pythonPlatform","dockerOutputDir","dockerTargetName","fs","targets","cache","executor","commands","rm","mkdir","cp","parallel","dependsOn","iac","mcpServerNameKebabCase","projectName","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","install"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAE5BC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,iBAAiB,EA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ACV8B,SAASe;IACX;IAEAjF,6BACEkC,MACA,CAAC,GACDJ,aAAa;QAAC;KAAkC;IAGlDV,8BACEc,MACAE,QAAQS,IAAI,EACZd,8BACAL,sBAAsBU,SAASc,kBAC/BH,iBACA;QACEwC,MAAMT;QACNU,IAAIvC;QACJG;IACF;IAGF,MAAMtC,gCAAgCoB,MAAM;QAACH;KAA6B;IAE1E,MAAMzB,wBAAwB4B,MAAM3B;IAEpC,MAAMI,qBAAqBuB;IAC3B,OAAO;QACLhC,oBAAoBgC;QACpB,MAAM,IAAIT,WAAWS,KAAKI,IAAI,EAAE,IAAId,UAAUU,MAAMuD,OAAO;IAC7D;AACF,EAAE;AAEF,eAAexD,qBAAqB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { ensureLicenseExceptions } from '../../license/config';\nimport { MCP_INSPECTOR_EXCEPTIONS } from '../../license/known-exceptions';\nimport { addMcpServerInfra } from '../../utils/agent-core-constructs/agent-core-constructs';\nimport { addPythonBundleTarget } from '../../utils/bundle/bundle';\nimport { resolveContainers } from '../../utils/containers';\nimport { formatFilesInSubtree } from '../../utils/format';\nimport { FsCommands } from '../../utils/fs';\nimport { resolveIac } from '../../utils/iac';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { kebabCase, toClassName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addComponentDevTarget,\n addComponentGeneratorMetadata,\n addDependencyToTargetIfNotPresent,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx';\nimport { toProjectRelativePath } from '../../utils/paths';\nimport { assignPort } from '../../utils/port';\nimport { addDependenciesToPyProjectToml } from '../../utils/py';\nimport { sharedConstructsGenerator } from '../../utils/shared-constructs';\nimport { withVersions } from '../../utils/versions';\nimport type { PyMcpServerGeneratorSchema } from './schema';\n\nexport const PY_MCP_SERVER_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const pyMcpServerGenerator = async (\n tree: Tree,\n options: PyMcpServerGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n\n const pyProjectPath = joinPathFragments(project.root, 'pyproject.toml');\n\n // Check if the project has a pyproject.toml file\n if (!pyProjectPath) {\n throw new Error(\n `Unsupported project ${options.project}. Expected a Python project (with a pyproject.toml)`,\n );\n }\n\n if (!project.sourceRoot) {\n throw new Error(\n `This project does not have a source root. Please add a source root to the project configuration before running this generator.`,\n );\n }\n\n // Module name is the last part of the source root,\n const sourceParts = project.sourceRoot.split('/');\n const moduleName = sourceParts[sourceParts.length - 1];\n\n const name = kebabCase(\n options.name || `${kebabCase(project.name.split('.').pop())}-mcp-server`,\n );\n const mcpTargetPrefix = options.name ? name : 'mcp-server';\n\n const mcpServerNameSnakeCase = toSnakeCase(options.name || 'mcp-server');\n const mcpServerNameClassName = toClassName(name);\n\n const targetSourceDir = joinPathFragments(\n project.sourceRoot,\n mcpServerNameSnakeCase,\n );\n\n const infra = options.infra ?? 'agentcore';\n\n if (infra === 'none' && options.auth && options.auth !== 'iam') {\n console.warn(\n 'Warning: auth is ignored when no infrastructure is configured (no infrastructure is generated)',\n );\n }\n\n const auth = options.auth ?? 'iam';\n\n // Generate example server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'app'),\n targetSourceDir,\n {\n name,\n mcpServerNameSnakeCase,\n mcpServerNameClassName,\n moduleName,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addDependenciesToPyProjectToml(tree, project.root, [\n 'aws-lambda-powertools',\n 'mcp',\n 'uvicorn',\n 'boto3',\n 'aws-opentelemetry-distro',\n ]);\n\n if (infra === 'agentcore') {\n const containers = await resolveContainers(tree, 'inherit');\n const dockerImageTag = `${getNpmScope(tree)}-${name}:latest`;\n\n // Add bundle target\n const { bundleTargetName, bundleOutputDir } = addPythonBundleTarget(\n project,\n {\n pythonPlatform: 'aarch64-manylinux_2_28',\n },\n );\n\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'deploy'),\n targetSourceDir,\n {\n mcpServerNameSnakeCase,\n moduleName,\n bundleOutputDir,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n const dockerOutputDir = joinPathFragments(\n 'dist',\n project.root,\n 'docker',\n name,\n );\n const dockerTargetName = `${mcpTargetPrefix}-docker`;\n\n // Add a docker target that prepares the docker context and builds the image\n const fs = new FsCommands(tree);\n project.targets[dockerTargetName] = {\n cache: true,\n executor: 'nx:run-commands',\n options: {\n commands: [\n fs.rm(dockerOutputDir),\n fs.mkdir(dockerOutputDir),\n fs.cp(bundleOutputDir, dockerOutputDir),\n fs.cp(\n `${targetSourceDir}/Dockerfile`,\n `${dockerOutputDir}/Dockerfile`,\n ),\n `${containers} build --platform linux/arm64 -t ${dockerImageTag} ${dockerOutputDir}`,\n ],\n parallel: false,\n },\n dependsOn: [bundleTargetName],\n };\n\n addDependencyToTargetIfNotPresent(project, 'docker', dockerTargetName);\n addDependencyToTargetIfNotPresent(project, 'build', 'docker');\n\n // Add shared constructs\n const iac = await resolveIac(tree, options.iac);\n await sharedConstructsGenerator(tree, { iac });\n\n // Add the construct to deploy the mcp server\n await addMcpServerInfra(tree, {\n mcpServerNameKebabCase: name,\n mcpServerNameClassName,\n projectName: project.name,\n dockerImageTag,\n dockerOutputDir,\n iac,\n auth,\n containers,\n });\n }\n\n const localDevPort = assignPort(tree, project, 8000, {\n component: { info: PY_MCP_SERVER_GENERATOR_INFO, name: mcpTargetPrefix },\n });\n\n const mcpTargets = {\n ...project.targets,\n // Add targets for running the MCP server\n [`${mcpTargetPrefix}-serve-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [`uv run -m ${moduleName}.${mcpServerNameSnakeCase}.stdio`],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-serve`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `uv run uvicorn --reload ${moduleName}.${mcpServerNameSnakeCase}.http:app --host 0.0.0.0 --port ${localDevPort}`,\n ],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n },\n },\n },\n [`${mcpTargetPrefix}-dev`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `uv run uvicorn --reload ${moduleName}.${mcpServerNameSnakeCase}.http:app --host 0.0.0.0 --port ${localDevPort}`,\n ],\n cwd: '{projectRoot}',\n env: {\n PORT: `${localDevPort}`,\n LOCAL_DEV: 'true',\n },\n },\n },\n [`${mcpTargetPrefix}-inspect`]: {\n executor: 'nx:run-commands',\n continuous: true,\n // Launch the inspector against the locally served HTTP server. The dev\n // target starts the server and any connected dependencies (e.g. a local\n // database).\n dependsOn: [`${mcpTargetPrefix}-dev`],\n options: {\n commands: [\n `mcp-inspector --transport http --server-url http://localhost:${localDevPort}/mcp`,\n ],\n cwd: '{projectRoot}',\n },\n },\n [`${mcpTargetPrefix}-inspect-stdio`]: {\n executor: 'nx:run-commands',\n continuous: true,\n options: {\n commands: [\n `mcp-inspector -- uv run -m ${moduleName}.${mcpServerNameSnakeCase}.stdio`,\n ],\n cwd: '{projectRoot}',\n },\n },\n };\n\n // Aggregate `<mcp>-dev` under the project-level `dev` target.\n addComponentDevTarget(mcpTargets, `${mcpTargetPrefix}-dev`);\n\n updateProjectConfiguration(tree, project.name, {\n ...project,\n targets: mcpTargets,\n });\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(['@modelcontextprotocol/inspector']),\n );\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n PY_MCP_SERVER_GENERATOR_INFO,\n toProjectRelativePath(project, targetSourceDir),\n mcpTargetPrefix,\n {\n port: localDevPort,\n rc: mcpServerNameClassName,\n auth,\n },\n );\n\n await addGeneratorMetricsIfApplicable(tree, [PY_MCP_SERVER_GENERATOR_INFO]);\n\n await ensureLicenseExceptions(tree, MCP_INSPECTOR_EXCEPTIONS);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\n\nexport default pyMcpServerGenerator;\n"],"names":["addDependenciesToPackageJson","generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","ensureLicenseExceptions","MCP_INSPECTOR_EXCEPTIONS","addMcpServerInfra","addPythonBundleTarget","resolveContainers","formatFilesInSubtree","FsCommands","resolveIac","installDependencies","addGeneratorMetricsIfApplicable","kebabCase","toClassName","toSnakeCase","getNpmScope","addComponentDevTarget","addComponentGeneratorMetadata","addDependencyToTargetIfNotPresent","getGeneratorInfo","readProjectConfigurationUnqualified","toProjectRelativePath","assignPort","addDependenciesToPyProjectToml","sharedConstructsGenerator","withVersions","PY_MCP_SERVER_GENERATOR_INFO","filename","pyMcpServerGenerator","tree","options","project","pyProjectPath","root","Error","sourceRoot","sourceParts","split","moduleName","length","name","pop","mcpTargetPrefix","mcpServerNameSnakeCase","mcpServerNameClassName","targetSourceDir","infra","auth","console","warn","dirname","overwriteStrategy","KeepExisting","containers","dockerImageTag","bundleTargetName","bundleOutputDir","pythonPlatform","dockerOutputDir","dockerTargetName","fs","targets","cache","executor","commands","rm","mkdir","cp","parallel","dependsOn","iac","mcpServerNameKebabCase","projectName","localDevPort","component","info","mcpTargets","continuous","cwd","env","PORT","LOCAL_DEV","port","rc","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAE5BC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,0BAA0B,QACrB,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MACA,CAAC,GACDJ,aAAa;QAAC;KAAkC;IAGlDR,8BACEY,MACAE,QAAQS,IAAI,EACZd,8BACAL,sBAAsBU,SAASc,kBAC/BH,iBACA;QACEwC,MAAMT;QACNU,IAAIvC;QACJG;IACF;IAGF,MAAMpC,gCAAgCkB,MAAM;QAACH;KAA6B;IAE1E,MAAMxB,wBAAwB2B,MAAM1B;IAEpC,MAAMI,qBAAqBsB;IAC3B,OAAO,IACLnB,oBAAoBmB,MAAMC,QAAQsD,yBAAyB,EAAE;YAC3DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AAEF,eAAezD,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\nexport type PyMcpServerInfra = 'none' | 'agentcore';\n\nexport type PyMcpServerAuth = 'iam' | 'cognito';\n\nexport interface PyMcpServerGeneratorSchema {\n project: string;\n name?: string;\n infra?: PyMcpServerInfra;\n auth?: PyMcpServerAuth;\n iac: IacOption;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAQD,WAMC"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/mcp-server/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { IacOption } from '../../utils/iac';\n\nexport type PyMcpServerInfra = 'none' | 'agentcore';\n\nexport type PyMcpServerAuth = 'iam' | 'cognito';\n\nexport interface PyMcpServerGeneratorSchema {\n project: string;\n name?: string;\n infra?: PyMcpServerInfra;\n auth?: PyMcpServerAuth;\n iac: IacOption;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAQD,WAOC"}
@@ -15,4 +15,5 @@ export interface PyMcpServerGeneratorSchema {
15
15
  infra?: PyMcpServerInfra;
16
16
  auth?: PyMcpServerAuth;
17
17
  iac: IacOption;
18
+ preferInstallDependencies?: boolean;
18
19
  }
@@ -43,6 +43,11 @@
43
43
  "enum": ["agentcore", "none"],
44
44
  "default": "agentcore",
45
45
  "x-priority": "important"
46
+ },
47
+ "preferInstallDependencies": {
48
+ "type": "boolean",
49
+ "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
50
+ "default": true
46
51
  }
47
52
  },
48
53
  "required": ["project"]
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ import { addDependenciesToPackageJson, ensurePackage, installPackagesTask, joinPathFragments, readNxJson, readProjectConfiguration, updateNxJson, updateProjectConfiguration } from "@nx/devkit";
4
+ */ import { addDependenciesToPackageJson, ensurePackage, joinPathFragments, readNxJson, readProjectConfiguration, updateNxJson, updateProjectConfiguration } from "@nx/devkit";
5
5
  import { addLicenseCheckToLintTarget, ensurePythonLicenseCollector } from "../../license/config.js";
6
6
  import { updateGitIgnore } from "../../utils/git.js";
7
+ import { installDependencies } from "../../utils/install.js";
7
8
  import { addGeneratorMetricsIfApplicable } from "../../utils/metrics.js";
8
9
  import { normalizeDistributionName, toSnakeCase } from "../../utils/names.js";
9
10
  import { getNpmScope } from "../../utils/npm-scope.js";
10
11
  import { addDependencyToTargetIfNotPresent, addGeneratorMetadata, getGeneratorInfo, projectExists } from "../../utils/nx.js";
11
- import { Logger, migrateToSharedVenvGenerator, UVProvider, uvProjectGenerator } from "../../utils/nxlv-python.js";
12
+ import { migrateToSharedVenvGenerator, uvProjectGenerator } from "../../utils/nxlv-python.js";
12
13
  import { sortObjectKeys } from "../../utils/object.js";
13
14
  import { addDependenciesToDependencyGroupInPyProjectToml } from "../../utils/py.js";
14
15
  import { updateToml } from "../../utils/toml.js";
@@ -242,10 +243,12 @@ const PYTHON_TRANSIENT_ARTIFACTS = [
242
243
  // the license generator wires up existing projects itself, so the dependency
243
244
  // is added regardless of which generator runs first.
244
245
  addLicenseCheckToLintTarget(tree, fullyQualifiedName);
245
- return async ()=>{
246
- installPackagesTask(tree);
247
- await new UVProvider(tree.root, new Logger(), tree).install();
248
- };
246
+ return ()=>installDependencies(tree, schema.preferInstallDependencies, {
247
+ languages: [
248
+ 'typescript',
249
+ 'python'
250
+ ]
251
+ });
249
252
  };
250
253
  export default pyProjectGenerator;
251
254
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n ensurePackage,\n type GeneratorCallback,\n installPackagesTask,\n joinPathFragments,\n readNxJson,\n readProjectConfiguration,\n type Tree,\n updateNxJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport {\n addLicenseCheckToLintTarget,\n ensurePythonLicenseCollector,\n} from '../../license/config';\nimport { updateGitIgnore } from '../../utils/git';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { normalizeDistributionName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx';\nimport type { UVPyprojectToml } from '../../utils/nxlv-python';\nimport {\n Logger,\n migrateToSharedVenvGenerator,\n UVProvider,\n uvProjectGenerator,\n} from '../../utils/nxlv-python';\nimport { sortObjectKeys } from '../../utils/object';\nimport { addDependenciesToDependencyGroupInPyProjectToml } from '../../utils/py';\nimport { updateToml } from '../../utils/toml';\nimport { withVersions } from '../../utils/versions';\nimport type { PyProjectGeneratorSchema } from './schema';\n\nexport const PY_PROJECT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n// Transient artifacts that pytest, coverage and ruff create and remove while\n// the test, typecheck and compile targets run concurrently. `.coverage.*` are\n// the per-process data files pytest-cov writes (`.coverage.<host>.<pid>.<rand>`)\n// before combining them. Both `ty` (which respects .gitignore) and the\n// `@nxlv/python:build` copy (which respects `ignorePaths`) would otherwise fail\n// when they read one of these mid-deletion.\nconst PYTHON_TRANSIENT_ARTIFACTS = [\n '__pycache__',\n '.coverage',\n '.coverage.*',\n '.pytest_cache',\n 'pytest-cache-files-*',\n '.ruff_cache',\n];\n\nexport interface PyProjectDetails {\n /**\n * Fully qualified Nx project id including scope, in dot notation (eg foo.bar).\n * This is the identifier Nx uses (readProjectConfiguration, the project\n * graph, target references) and is intentionally kept dotted.\n */\n readonly fullyQualifiedName: string;\n /**\n * PEP 503 normalised Python distribution name (eg foo-bar). This is the name\n * written to the project's `[project].name`, the root `[tool.uv.sources]`\n * key, and any inter-project dependency string. It is hyphenated (not dotted)\n * so `uv` and `@nxlv/python` can match it: uv writes `uv.lock` keyed by the\n * PEP 503 hyphenated name, and `@nxlv/python`'s dependency inference splits a\n * dotted name on `.` and so would otherwise drop the edge entirely. Keeping\n * the distribution name decoupled from `fullyQualifiedName` is what lets the\n * workspace dependency edge appear in the Nx project graph.\n */\n readonly distributionName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n /**\n * Module name for the project\n */\n readonly normalizedModuleName: string;\n}\n\n/**\n * Returns details about the Python project to be created\n */\nexport const getPyProjectDetails = (\n tree: Tree,\n schema: {\n name: string;\n directory?: string;\n subDirectory?: string;\n moduleName?: string;\n },\n): PyProjectDetails => {\n const scope = toSnakeCase(getNpmScope(tree));\n const normalizedName = toSnakeCase(schema.name);\n const normalizedModuleName = toSnakeCase(\n schema.moduleName ?? `${scope}_${normalizedName}`,\n );\n const fullyQualifiedName = `${scope}.${normalizedName}`;\n // The Python distribution name is the PEP 503 normalised form of the\n // fully qualified name: hyphenated, never dotted. See PyProjectDetails.\n const distributionName = normalizeDistributionName(fullyQualifiedName);\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName, distributionName, normalizedModuleName };\n};\n\n/**\n * Generates a Python project\n */\nexport const pyProjectGenerator = async (\n tree: Tree,\n schema: PyProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { dir, normalizedModuleName, fullyQualifiedName, distributionName } =\n getPyProjectDetails(tree, schema);\n\n const pythonPlugin = withVersions(['@nxlv/python']);\n addDependenciesToPackageJson(tree, {}, pythonPlugin);\n\n Object.entries(pythonPlugin).forEach(([name, version]) =>\n ensurePackage(name, version),\n );\n\n const nxJson = readNxJson(tree);\n\n // Only rewrite nx.json when the plugin needs adding, so re-running does not\n // reserialize (and reformat) the file when nothing has changed.\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === '@nxlv/python'\n : p.plugin === '@nxlv/python',\n )\n ) {\n nxJson.plugins = [\n ...(nxJson.plugins ?? []),\n {\n plugin: '@nxlv/python',\n options: {\n packageManager: 'uv',\n },\n },\n ];\n updateNxJson(tree, nxJson);\n }\n\n // Only scaffold the project when it does not already exist so re-running with\n // the same name does not throw. The rest of the generator still runs to apply\n // any changed options to the existing project.\n if (!projectExists(tree, fullyQualifiedName)) {\n if (!tree.exists('uv.lock')) {\n await migrateToSharedVenvGenerator(tree, {\n autoActivate: true,\n packageManager: 'uv',\n moveDevDependencies: false,\n pyenvPythonVersion: '3.14.0',\n pyprojectPythonDependency: '>=3.14',\n });\n }\n\n await uvProjectGenerator(tree, {\n // The Nx project id (and `uv.workspace.members` etc.) keys off `name`, so\n // keep it dotted. `packageName` is the separate PEP 503 distribution name\n // written to `[project].name` and the root `[tool.uv.sources]` key; it is\n // hyphenated so `@nxlv/python` infers the workspace dependency edge (it\n // splits a dotted name on `.` and would otherwise drop it). This split is\n // the whole fix (see PyProjectDetails.distributionName).\n name: fullyQualifiedName,\n packageName: distributionName,\n publishable: false,\n buildLockedVersions: true,\n buildBundleLocalDependencies: true,\n linter: 'ruff',\n rootPyprojectDependencyGroup: 'main',\n pyenvPythonVersion: '3.14.0',\n pyprojectPythonDependency: '>=3.14',\n projectType: schema.type,\n projectNameAndRootFormat: 'as-provided',\n moduleName: normalizedModuleName,\n directory: dir,\n unitTestRunner: 'pytest',\n codeCoverage: true,\n codeCoverageHtmlReport: true,\n codeCoverageXmlReport: true,\n unitTestHtmlReport: true,\n unitTestJUnitReport: true,\n buildSystem: 'hatch',\n srcDir: false,\n });\n\n // Remove generated hello.py and test_hello.py as they are not needed\n [\n joinPathFragments(dir, normalizedModuleName, 'hello.py'),\n joinPathFragments(dir, 'tests', 'test_hello.py'),\n ].forEach((f) => tree.delete(f));\n\n // Add a placeholder test so pytest doesn't fail with \"no tests collected\"\n tree.write(\n joinPathFragments(dir, 'tests', 'test_noop.py'),\n 'def test_noop():\\n pass\\n',\n );\n }\n\n const outputPath = '{workspaceRoot}/dist/{projectRoot}';\n const buildOutputPath = joinPathFragments(outputPath, 'build');\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n projectConfiguration.name = fullyQualifiedName;\n // Derive the compile target from the uv build target, and rewrite build to\n // orchestrate the other targets. This only runs on first creation: on re-run\n // build has already been transformed, so re-deriving would corrupt compile\n // and duplicate the build dependencies.\n if (!projectConfiguration.targets.compile) {\n const buildTarget = projectConfiguration.targets.build;\n projectConfiguration.targets.compile = {\n ...buildTarget,\n inputs: ['default', '^production'],\n outputs: [buildOutputPath],\n options: {\n ...buildTarget.options,\n outputPath: buildOutputPath,\n // The build executor copies the project to a temp folder; exclude the\n // executor defaults plus transient artifacts so the copy does not race\n // a concurrent test/typecheck target deleting a file mid-copy.\n ignorePaths: ['.venv', '.tox', 'tests', ...PYTHON_TRANSIENT_ARTIFACTS],\n },\n };\n projectConfiguration.targets.build = {\n inputs: ['default', '^production'],\n dependsOn: [\n 'lint',\n 'compile',\n 'test',\n 'typecheck',\n ...(buildTarget.dependsOn ?? []),\n ],\n options: {\n outputPath,\n },\n };\n }\n projectConfiguration.targets.typecheck = {\n cache: true,\n inputs: ['default', '^production'],\n executor: '@nxlv/python:run-commands',\n options: {\n command: 'uv run ty check',\n cwd: '{projectRoot}',\n },\n };\n\n // Set the default line length to 120, as 88 is a little too strict\n updateToml(\n tree,\n joinPathFragments(dir, 'pyproject.toml'),\n (pyProjectToml: UVPyprojectToml) => {\n if ((pyProjectToml.tool as any)?.ruff) {\n (pyProjectToml.tool as any).ruff['line-length'] = 120;\n }\n return pyProjectToml;\n },\n );\n\n addDependenciesToDependencyGroupInPyProjectToml(tree, '.', 'dev', ['ty']);\n\n // Add a dependency on the format target for lint in order to reduce the number of\n // fixable lint errors (eg line too long)\n projectConfiguration.targets.lint = {\n ...projectConfiguration.targets.lint,\n cache: true,\n inputs: ['default', '^production'],\n configurations: {\n ...projectConfiguration.targets.lint?.configurations,\n fix: {\n fix: true,\n },\n 'skip-lint': {\n exitZero: true,\n },\n },\n };\n // Append `format` without moving an existing entry, so re-running does not\n // reorder lint dependencies (e.g. relative to a later-added license-check).\n addDependencyToTargetIfNotPresent(projectConfiguration, 'lint', 'format');\n\n projectConfiguration.targets = sortObjectKeys(projectConfiguration.targets);\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, PY_PROJECT_GENERATOR_INFO);\n\n // Update root .gitignore\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '/reports']);\n\n // Update project level .gitignore. The cache directories are also kept out\n // of type checking: `ty` respects .gitignore, and pytest creates and removes\n // transient `pytest-cache-files-*` directories while the test and typecheck\n // targets run concurrently, which would otherwise make `ty` fail with an I/O\n // error when it scans one mid-deletion.\n updateGitIgnore(tree, dir, (patterns) => [\n ...patterns,\n '**/__pycache__',\n ...PYTHON_TRANSIENT_ARTIFACTS.filter((p) => p !== '__pycache__'),\n ]);\n\n await addGeneratorMetricsIfApplicable(tree, [PY_PROJECT_GENERATOR_INFO]);\n\n await ensurePythonLicenseCollector(tree);\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if license checking isn't set up;\n // the license generator wires up existing projects itself, so the dependency\n // is added regardless of which generator runs first.\n addLicenseCheckToLintTarget(tree, fullyQualifiedName);\n\n return async () => {\n installPackagesTask(tree);\n await new UVProvider(tree.root, new Logger(), tree).install();\n };\n};\nexport default pyProjectGenerator;\n"],"names":["addDependenciesToPackageJson","ensurePackage","installPackagesTask","joinPathFragments","readNxJson","readProjectConfiguration","updateNxJson","updateProjectConfiguration","addLicenseCheckToLintTarget","ensurePythonLicenseCollector","updateGitIgnore","addGeneratorMetricsIfApplicable","normalizeDistributionName","toSnakeCase","getNpmScope","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","Logger","migrateToSharedVenvGenerator","UVProvider","uvProjectGenerator","sortObjectKeys","addDependenciesToDependencyGroupInPyProjectToml","updateToml","withVersions","PY_PROJECT_GENERATOR_INFO","filename","PYTHON_TRANSIENT_ARTIFACTS","getPyProjectDetails","tree","schema","scope","normalizedName","name","normalizedModuleName","moduleName","fullyQualifiedName","distributionName","dir","directory","subDirectory","pyProjectGenerator","pythonPlugin","Object","entries","forEach","version","nxJson","plugins","find","p","plugin","options","packageManager","exists","autoActivate","moveDevDependencies","pyenvPythonVersion","pyprojectPythonDependency","packageName","publishable","buildLockedVersions","buildBundleLocalDependencies","linter","rootPyprojectDependencyGroup","projectType","type","projectNameAndRootFormat","unitTestRunner","codeCoverage","codeCoverageHtmlReport","codeCoverageXmlReport","unitTestHtmlReport","unitTestJUnitReport","buildSystem","srcDir","f","delete","write","outputPath","buildOutputPath","projectConfiguration","targets","compile","buildTarget","build","inputs","outputs","ignorePaths","dependsOn","typecheck","cache","executor","command","cwd","pyProjectToml","tool","ruff","lint","configurations","fix","exitZero","patterns","filter","root","install"],"m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M;QAACJ;KAA0B;IAEvE,MAAMlB,6BAA6BsB;IAEnC,4EAA4E;IAC5E,4EAA4E;IAC5E,6EAA6E;IAC7E,qDAAqD;IACrDvB,4BAA4BuB,MAAMO;IAElC,OAAO;QACLpC,oBAAoB6B;QACpB,MAAM,IAAIV,WAAWU,KAAK2E,IAAI,EAAE,IAAIvF,UAAUY,MAAM4E,OAAO;IAC7D;AACF,EAAE;AACF,eAAehE,mBAAmB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/project/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n addDependenciesToPackageJson,\n ensurePackage,\n type GeneratorCallback,\n joinPathFragments,\n readNxJson,\n readProjectConfiguration,\n type Tree,\n updateNxJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport {\n addLicenseCheckToLintTarget,\n ensurePythonLicenseCollector,\n} from '../../license/config';\nimport { updateGitIgnore } from '../../utils/git';\nimport { installDependencies } from '../../utils/install';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics';\nimport { normalizeDistributionName, toSnakeCase } from '../../utils/names';\nimport { getNpmScope } from '../../utils/npm-scope';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx';\nimport type { UVPyprojectToml } from '../../utils/nxlv-python';\nimport {\n migrateToSharedVenvGenerator,\n uvProjectGenerator,\n} from '../../utils/nxlv-python';\nimport { sortObjectKeys } from '../../utils/object';\nimport { addDependenciesToDependencyGroupInPyProjectToml } from '../../utils/py';\nimport { updateToml } from '../../utils/toml';\nimport { withVersions } from '../../utils/versions';\nimport type { PyProjectGeneratorSchema } from './schema';\n\nexport const PY_PROJECT_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n// Transient artifacts that pytest, coverage and ruff create and remove while\n// the test, typecheck and compile targets run concurrently. `.coverage.*` are\n// the per-process data files pytest-cov writes (`.coverage.<host>.<pid>.<rand>`)\n// before combining them. Both `ty` (which respects .gitignore) and the\n// `@nxlv/python:build` copy (which respects `ignorePaths`) would otherwise fail\n// when they read one of these mid-deletion.\nconst PYTHON_TRANSIENT_ARTIFACTS = [\n '__pycache__',\n '.coverage',\n '.coverage.*',\n '.pytest_cache',\n 'pytest-cache-files-*',\n '.ruff_cache',\n];\n\nexport interface PyProjectDetails {\n /**\n * Fully qualified Nx project id including scope, in dot notation (eg foo.bar).\n * This is the identifier Nx uses (readProjectConfiguration, the project\n * graph, target references) and is intentionally kept dotted.\n */\n readonly fullyQualifiedName: string;\n /**\n * PEP 503 normalised Python distribution name (eg foo-bar). This is the name\n * written to the project's `[project].name`, the root `[tool.uv.sources]`\n * key, and any inter-project dependency string. It is hyphenated (not dotted)\n * so `uv` and `@nxlv/python` can match it: uv writes `uv.lock` keyed by the\n * PEP 503 hyphenated name, and `@nxlv/python`'s dependency inference splits a\n * dotted name on `.` and so would otherwise drop the edge entirely. Keeping\n * the distribution name decoupled from `fullyQualifiedName` is what lets the\n * workspace dependency edge appear in the Nx project graph.\n */\n readonly distributionName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n /**\n * Module name for the project\n */\n readonly normalizedModuleName: string;\n}\n\n/**\n * Returns details about the Python project to be created\n */\nexport const getPyProjectDetails = (\n tree: Tree,\n schema: {\n name: string;\n directory?: string;\n subDirectory?: string;\n moduleName?: string;\n },\n): PyProjectDetails => {\n const scope = toSnakeCase(getNpmScope(tree));\n const normalizedName = toSnakeCase(schema.name);\n const normalizedModuleName = toSnakeCase(\n schema.moduleName ?? `${scope}_${normalizedName}`,\n );\n const fullyQualifiedName = `${scope}.${normalizedName}`;\n // The Python distribution name is the PEP 503 normalised form of the\n // fully qualified name: hyphenated, never dotted. See PyProjectDetails.\n const distributionName = normalizeDistributionName(fullyQualifiedName);\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName, distributionName, normalizedModuleName };\n};\n\n/**\n * Generates a Python project\n */\nexport const pyProjectGenerator = async (\n tree: Tree,\n schema: PyProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { dir, normalizedModuleName, fullyQualifiedName, distributionName } =\n getPyProjectDetails(tree, schema);\n\n const pythonPlugin = withVersions(['@nxlv/python']);\n addDependenciesToPackageJson(tree, {}, pythonPlugin);\n\n Object.entries(pythonPlugin).forEach(([name, version]) =>\n ensurePackage(name, version),\n );\n\n const nxJson = readNxJson(tree);\n\n // Only rewrite nx.json when the plugin needs adding, so re-running does not\n // reserialize (and reformat) the file when nothing has changed.\n if (\n !nxJson.plugins?.find((p) =>\n typeof p === 'string'\n ? p === '@nxlv/python'\n : p.plugin === '@nxlv/python',\n )\n ) {\n nxJson.plugins = [\n ...(nxJson.plugins ?? []),\n {\n plugin: '@nxlv/python',\n options: {\n packageManager: 'uv',\n },\n },\n ];\n updateNxJson(tree, nxJson);\n }\n\n // Only scaffold the project when it does not already exist so re-running with\n // the same name does not throw. The rest of the generator still runs to apply\n // any changed options to the existing project.\n if (!projectExists(tree, fullyQualifiedName)) {\n if (!tree.exists('uv.lock')) {\n await migrateToSharedVenvGenerator(tree, {\n autoActivate: true,\n packageManager: 'uv',\n moveDevDependencies: false,\n pyenvPythonVersion: '3.14.0',\n pyprojectPythonDependency: '>=3.14',\n });\n }\n\n await uvProjectGenerator(tree, {\n // The Nx project id (and `uv.workspace.members` etc.) keys off `name`, so\n // keep it dotted. `packageName` is the separate PEP 503 distribution name\n // written to `[project].name` and the root `[tool.uv.sources]` key; it is\n // hyphenated so `@nxlv/python` infers the workspace dependency edge (it\n // splits a dotted name on `.` and would otherwise drop it). This split is\n // the whole fix (see PyProjectDetails.distributionName).\n name: fullyQualifiedName,\n packageName: distributionName,\n publishable: false,\n buildLockedVersions: true,\n buildBundleLocalDependencies: true,\n linter: 'ruff',\n rootPyprojectDependencyGroup: 'main',\n pyenvPythonVersion: '3.14.0',\n pyprojectPythonDependency: '>=3.14',\n projectType: schema.type,\n projectNameAndRootFormat: 'as-provided',\n moduleName: normalizedModuleName,\n directory: dir,\n unitTestRunner: 'pytest',\n codeCoverage: true,\n codeCoverageHtmlReport: true,\n codeCoverageXmlReport: true,\n unitTestHtmlReport: true,\n unitTestJUnitReport: true,\n buildSystem: 'hatch',\n srcDir: false,\n });\n\n // Remove generated hello.py and test_hello.py as they are not needed\n [\n joinPathFragments(dir, normalizedModuleName, 'hello.py'),\n joinPathFragments(dir, 'tests', 'test_hello.py'),\n ].forEach((f) => tree.delete(f));\n\n // Add a placeholder test so pytest doesn't fail with \"no tests collected\"\n tree.write(\n joinPathFragments(dir, 'tests', 'test_noop.py'),\n 'def test_noop():\\n pass\\n',\n );\n }\n\n const outputPath = '{workspaceRoot}/dist/{projectRoot}';\n const buildOutputPath = joinPathFragments(outputPath, 'build');\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n projectConfiguration.name = fullyQualifiedName;\n // Derive the compile target from the uv build target, and rewrite build to\n // orchestrate the other targets. This only runs on first creation: on re-run\n // build has already been transformed, so re-deriving would corrupt compile\n // and duplicate the build dependencies.\n if (!projectConfiguration.targets.compile) {\n const buildTarget = projectConfiguration.targets.build;\n projectConfiguration.targets.compile = {\n ...buildTarget,\n inputs: ['default', '^production'],\n outputs: [buildOutputPath],\n options: {\n ...buildTarget.options,\n outputPath: buildOutputPath,\n // The build executor copies the project to a temp folder; exclude the\n // executor defaults plus transient artifacts so the copy does not race\n // a concurrent test/typecheck target deleting a file mid-copy.\n ignorePaths: ['.venv', '.tox', 'tests', ...PYTHON_TRANSIENT_ARTIFACTS],\n },\n };\n projectConfiguration.targets.build = {\n inputs: ['default', '^production'],\n dependsOn: [\n 'lint',\n 'compile',\n 'test',\n 'typecheck',\n ...(buildTarget.dependsOn ?? []),\n ],\n options: {\n outputPath,\n },\n };\n }\n projectConfiguration.targets.typecheck = {\n cache: true,\n inputs: ['default', '^production'],\n executor: '@nxlv/python:run-commands',\n options: {\n command: 'uv run ty check',\n cwd: '{projectRoot}',\n },\n };\n\n // Set the default line length to 120, as 88 is a little too strict\n updateToml(\n tree,\n joinPathFragments(dir, 'pyproject.toml'),\n (pyProjectToml: UVPyprojectToml) => {\n if ((pyProjectToml.tool as any)?.ruff) {\n (pyProjectToml.tool as any).ruff['line-length'] = 120;\n }\n return pyProjectToml;\n },\n );\n\n addDependenciesToDependencyGroupInPyProjectToml(tree, '.', 'dev', ['ty']);\n\n // Add a dependency on the format target for lint in order to reduce the number of\n // fixable lint errors (eg line too long)\n projectConfiguration.targets.lint = {\n ...projectConfiguration.targets.lint,\n cache: true,\n inputs: ['default', '^production'],\n configurations: {\n ...projectConfiguration.targets.lint?.configurations,\n fix: {\n fix: true,\n },\n 'skip-lint': {\n exitZero: true,\n },\n },\n };\n // Append `format` without moving an existing entry, so re-running does not\n // reorder lint dependencies (e.g. relative to a later-added license-check).\n addDependencyToTargetIfNotPresent(projectConfiguration, 'lint', 'format');\n\n projectConfiguration.targets = sortObjectKeys(projectConfiguration.targets);\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, PY_PROJECT_GENERATOR_INFO);\n\n // Update root .gitignore\n updateGitIgnore(tree, '.', (patterns) => [...patterns, '/reports']);\n\n // Update project level .gitignore. The cache directories are also kept out\n // of type checking: `ty` respects .gitignore, and pytest creates and removes\n // transient `pytest-cache-files-*` directories while the test and typecheck\n // targets run concurrently, which would otherwise make `ty` fail with an I/O\n // error when it scans one mid-deletion.\n updateGitIgnore(tree, dir, (patterns) => [\n ...patterns,\n '**/__pycache__',\n ...PYTHON_TRANSIENT_ARTIFACTS.filter((p) => p !== '__pycache__'),\n ]);\n\n await addGeneratorMetricsIfApplicable(tree, [PY_PROJECT_GENERATOR_INFO]);\n\n await ensurePythonLicenseCollector(tree);\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if license checking isn't set up;\n // the license generator wires up existing projects itself, so the dependency\n // is added regardless of which generator runs first.\n addLicenseCheckToLintTarget(tree, fullyQualifiedName);\n\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript', 'python'],\n });\n};\nexport default pyProjectGenerator;\n"],"names":["addDependenciesToPackageJson","ensurePackage","joinPathFragments","readNxJson","readProjectConfiguration","updateNxJson","updateProjectConfiguration","addLicenseCheckToLintTarget","ensurePythonLicenseCollector","updateGitIgnore","installDependencies","addGeneratorMetricsIfApplicable","normalizeDistributionName","toSnakeCase","getNpmScope","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","migrateToSharedVenvGenerator","uvProjectGenerator","sortObjectKeys","addDependenciesToDependencyGroupInPyProjectToml","updateToml","withVersions","PY_PROJECT_GENERATOR_INFO","filename","PYTHON_TRANSIENT_ARTIFACTS","getPyProjectDetails","tree","schema","scope","normalizedName","name","normalizedModuleName","moduleName","fullyQualifiedName","distributionName","dir","directory","subDirectory","pyProjectGenerator","pythonPlugin","Object","entries","forEach","version","nxJson","plugins","find","p","plugin","options","packageManager","exists","autoActivate","moveDevDependencies","pyenvPythonVersion","pyprojectPythonDependency","packageName","publishable","buildLockedVersions","buildBundleLocalDependencies","linter","rootPyprojectDependencyGroup","projectType","type","projectNameAndRootFormat","unitTestRunner","codeCoverage","codeCoverageHtmlReport","codeCoverageXmlReport","unitTestHtmlReport","unitTestJUnitReport","buildSystem","srcDir","f","delete","write","outputPath","buildOutputPath","projectConfiguration","targets","compile","buildTarget","build","inputs","outputs","ignorePaths","dependsOn","typecheck","cache","executor","command","cwd","pyProjectToml","tool","ruff","lint","configurations","fix","exitZero","patterns","filter","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SACEA,4BAA4B,EAC5BC,aAAa,EAEbC,iBAAiB,EACjBC,UAAU,EACVC,wBAAwB,EAExBC,YAAY,EACZC,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AA4BsB,MAAMO;IAElC,OAAO,IACL1B,oBAAoBmB,MAAMC,OAAO0E,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;gBAAc;aAAS;QACrC;AACJ,EAAE;AACF,eAAehE,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/project/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface PyProjectGeneratorSchema {\n readonly name: string;\n readonly type: 'application' | 'library';\n readonly directory?: string;\n readonly subDirectory?: string;\n readonly moduleName?: string;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED,WAMC"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/py/project/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport interface PyProjectGeneratorSchema {\n readonly name: string;\n readonly type: 'application' | 'library';\n readonly directory?: string;\n readonly subDirectory?: string;\n readonly moduleName?: string;\n readonly preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED,WAOC"}
@@ -9,4 +9,5 @@ export interface PyProjectGeneratorSchema {
9
9
  readonly directory?: string;
10
10
  readonly subDirectory?: string;
11
11
  readonly moduleName?: string;
12
+ readonly preferInstallDependencies?: boolean;
12
13
  }
@@ -36,6 +36,11 @@
36
36
  "moduleName": {
37
37
  "type": "string",
38
38
  "description": "Python module name"
39
+ },
40
+ "preferInstallDependencies": {
41
+ "type": "boolean",
42
+ "description": "Whether to prefer installing dependencies after the generator runs. Set to false to defer installing when batching multiple generators (an install still runs if needed so subsequent generators can compute the Nx project graph); install once at the end.",
43
+ "default": true
39
44
  }
40
45
  },
41
46
  "required": ["name", "type"]
@@ -2,7 +2,7 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export { openApiTsClientGenerator, buildOpenApiCodeGenerationData, } from '../open-api/ts-client/generator';
5
+ export { buildOpenApiCodeGenerationData, openApiTsClientGenerator, } from '../open-api/ts-client/generator';
6
6
  export type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';
7
7
  export { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator';
8
8
  export type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ export { openApiTsClientGenerator, buildOpenApiCodeGenerationData } from "../open-api/ts-client/generator.js";
4
+ */ export { buildOpenApiCodeGenerationData, openApiTsClientGenerator } from "../open-api/ts-client/generator.js";
5
5
  export { openApiTsHooksGenerator } from "../open-api/ts-hooks/generator.js";
6
6
  export { openApiTsMetadataGenerator } from "../open-api/ts-metadata/generator.js";
7
7
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/open-api.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport {\n openApiTsClientGenerator,\n buildOpenApiCodeGenerationData,\n} from '../open-api/ts-client/generator';\nexport type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';\n\nexport { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator';\nexport type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';\n\nexport { openApiTsMetadataGenerator } from '../open-api/ts-metadata/generator';\nexport type { OpenApiTsMetadataGeneratorSchema } from '../open-api/ts-metadata/schema';\n"],"names":["openApiTsClientGenerator","buildOpenApiCodeGenerationData","openApiTsHooksGenerator","openApiTsMetadataGenerator"],"mappings":"AAAA;;;CAGC,GAED,SACEA,wBAAwB,EACxBC,8BAA8B,QACzB,qCAAkC;AAGzC,SAASC,uBAAuB,QAAQ,oCAAiC;AAGzE,SAASC,0BAA0B,QAAQ,uCAAoC"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/sdk/open-api.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport {\n buildOpenApiCodeGenerationData,\n openApiTsClientGenerator,\n} from '../open-api/ts-client/generator';\nexport type { OpenApiTsClientGeneratorSchema } from '../open-api/ts-client/schema';\n\nexport { openApiTsHooksGenerator } from '../open-api/ts-hooks/generator';\nexport type { OpenApiTsHooksGeneratorSchema } from '../open-api/ts-hooks/schema';\n\nexport { openApiTsMetadataGenerator } from '../open-api/ts-metadata/generator';\nexport type { OpenApiTsMetadataGeneratorSchema } from '../open-api/ts-metadata/schema';\n"],"names":["buildOpenApiCodeGenerationData","openApiTsClientGenerator","openApiTsHooksGenerator","openApiTsMetadataGenerator"],"mappings":"AAAA;;;CAGC,GAED,SACEA,8BAA8B,EAC9BC,wBAAwB,QACnB,qCAAkC;AAGzC,SAASC,uBAAuB,QAAQ,oCAAiC;AAGzE,SAASC,0BAA0B,QAAQ,uCAAoC"}
@@ -2,5 +2,4 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export { applyGritQL } from '../../utils/ast';
6
- export { matchGritQL } from '../../utils/ast';
5
+ export { applyGritQL, matchGritQL } from '../../utils/ast';
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ export { applyGritQL } from "../../utils/ast.js";
5
- export { matchGritQL } from "../../utils/ast.js";
4
+ */ export { applyGritQL, matchGritQL } from "../../utils/ast.js";
6
5
 
7
6
  //# sourceMappingURL=ast.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/sdk/utils/ast.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { applyGritQL } from '../../utils/ast';\nexport { matchGritQL } from '../../utils/ast';\n"],"names":["applyGritQL","matchGritQL"],"mappings":"AAAA;;;CAGC,GACD,SAASA,WAAW,QAAQ,qBAAkB;AAC9C,SAASC,WAAW,QAAQ,qBAAkB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/sdk/utils/ast.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { applyGritQL, matchGritQL } from '../../utils/ast';\n"],"names":["applyGritQL","matchGritQL"],"mappings":"AAAA;;;CAGC,GACD,SAASA,WAAW,EAAEC,WAAW,QAAQ,qBAAkB"}