@aws/nx-plugin 1.0.0-rc.63 → 1.0.0-rc.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +7 -2
- package/package.json +1 -1
- package/src/{smithy/project/files/service/build.Dockerfile.template → migrations/latest/smithy-build-without-docker/legacy-service.Dockerfile.fixture} +2 -2
- package/src/migrations/latest/smithy-build-without-docker/metadata.json +3 -0
- package/src/migrations/latest/smithy-build-without-docker/migration.d.ts +6 -0
- package/src/migrations/latest/smithy-build-without-docker/migration.js +154 -0
- package/src/migrations/latest/smithy-build-without-docker/migration.js.map +1 -0
- package/src/migrations/latest/smithy-ssdk-bundle-pins/rc57-service.Dockerfile.fixture +95 -0
- package/src/py/agent/a2a-connection/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.d.ts +1 -1
- package/src/py/agent/generator.d.ts +8 -0
- package/src/py/agent/mcp-connection/generator.d.ts +1 -1
- package/src/py/fast-api/generator.d.ts +4 -0
- package/src/py/mcp-server/generator.d.ts +8 -0
- package/src/py/rdb/generator.d.ts +8 -0
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +163 -260
- package/src/smithy/project/files/service/smithy-build.json.template +5 -5
- package/src/smithy/project/files/shapes/smithy-build.json.template +1 -1
- package/src/smithy/project/files/ssdk-bundle/ssdk.rolldown.config.mjs.template +52 -0
- package/src/smithy/project/generator.d.ts +76 -18
- package/src/smithy/project/generator.js +160 -38
- package/src/smithy/project/generator.js.map +1 -1
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +22 -3
- package/src/smithy/ts/api/generator.d.ts +4 -0
- package/src/ts/agent/generator.d.ts +8 -0
- package/src/ts/mcp-server/generator.d.ts +8 -0
- package/src/ts/rdb/generator.d.ts +8 -0
- package/src/utils/docker.d.ts +2 -0
- package/src/utils/fs.d.ts +8 -0
- package/src/utils/fs.js +11 -0
- package/src/utils/fs.js.map +1 -1
- package/src/utils/smithy.d.ts +59 -0
- package/src/utils/smithy.js +73 -0
- package/src/utils/smithy.js.map +1 -0
- package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +2 -2
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js +53 -5
- package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -1
- package/src/utils/versions.d.ts +33 -1
- package/src/utils/versions.js +26 -1
- package/src/utils/versions.js.map +1 -1
- package/src/smithy/project/files/shapes/build.Dockerfile.template +0 -33
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* How a generated Smithy project runs the Smithy CLI.
|
|
7
|
+
*
|
|
8
|
+
* Off Windows `mise` resolves the pinned CLI, downloading and caching it on first
|
|
9
|
+
* use, so a Smithy build needs no tool installed on the machine.
|
|
10
|
+
*
|
|
11
|
+
* mise itself is fetched by `npx` rather than added as a workspace dependency. The
|
|
12
|
+
* `mise` npm package is a stub that fetches its real binary in a `preinstall`, and
|
|
13
|
+
* every package manager gates install scripts differently: pnpm, bun and yarn
|
|
14
|
+
* Berry each need their own allowlist entry, bun and yarn fail silently when it is
|
|
15
|
+
* missing, and `nx migrate` installs with `--ignore-scripts` — so a migrated
|
|
16
|
+
* workspace ends up with the package present and no binary. `npx` sidesteps all of
|
|
17
|
+
* it: it runs the package's own bin, resolving from `node_modules` when it happens
|
|
18
|
+
* to be there and fetching it otherwise. A warm cache costs about a second.
|
|
19
|
+
*
|
|
20
|
+
* On Windows mise publishes no platform package to npm, so there the Smithy CLI is
|
|
21
|
+
* a documented prerequisite and the target invokes `smithy` directly.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The prefix a target command runs the Smithy CLI through.
|
|
25
|
+
*
|
|
26
|
+
* Off Windows both mise and the CLI are pinned in the command, so the version sync
|
|
27
|
+
* can move them forward. On Windows the CLI comes from the user's PATH, so there is
|
|
28
|
+
* no version to pin — {@link warnIfSmithyMissing} checks it is there.
|
|
29
|
+
*/
|
|
30
|
+
export declare const smithyCliCommand: () => string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the workspace this generator runs in targets Windows, where the Smithy
|
|
33
|
+
* CLI is a user-installed prerequisite.
|
|
34
|
+
*
|
|
35
|
+
* Read at generate time rather than build time: the resolved command is baked
|
|
36
|
+
* into `project.json`, matching how `containers.engine` is resolved.
|
|
37
|
+
*/
|
|
38
|
+
export declare const isWindows: () => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Warn when generating a Smithy project on Windows without the CLI installed.
|
|
41
|
+
*
|
|
42
|
+
* A warning rather than an error: the project is still generated correctly, and
|
|
43
|
+
* the CLI can be installed before the first build.
|
|
44
|
+
*
|
|
45
|
+
* @param onPath overrides the PATH probe, so a test can cover the Windows branch
|
|
46
|
+
* from any runner — ESM module namespaces cannot be spied on.
|
|
47
|
+
*/
|
|
48
|
+
export declare const warnIfSmithyMissing: (onPath?: () => boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Substitution variables exposing the Smithy Maven pins to the generated
|
|
51
|
+
* `smithy-build.json` templates.
|
|
52
|
+
*/
|
|
53
|
+
export declare const smithyMavenVersions: () => {
|
|
54
|
+
smithyModelDependency: string;
|
|
55
|
+
smithyAwsTraitsDependency: string;
|
|
56
|
+
smithyValidationModelDependency: string;
|
|
57
|
+
smithyOpenApiDependency: string;
|
|
58
|
+
smithyTypeScriptCodegenDependency: string;
|
|
59
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/ import * as childProcess from "node:child_process";
|
|
5
|
+
import { logger } from "@nx/devkit";
|
|
6
|
+
import { javaMavenDependency, MISE_VERSIONS, TS_VERSIONS } from "./versions.js";
|
|
7
|
+
/**
|
|
8
|
+
* How a generated Smithy project runs the Smithy CLI.
|
|
9
|
+
*
|
|
10
|
+
* Off Windows `mise` resolves the pinned CLI, downloading and caching it on first
|
|
11
|
+
* use, so a Smithy build needs no tool installed on the machine.
|
|
12
|
+
*
|
|
13
|
+
* mise itself is fetched by `npx` rather than added as a workspace dependency. The
|
|
14
|
+
* `mise` npm package is a stub that fetches its real binary in a `preinstall`, and
|
|
15
|
+
* every package manager gates install scripts differently: pnpm, bun and yarn
|
|
16
|
+
* Berry each need their own allowlist entry, bun and yarn fail silently when it is
|
|
17
|
+
* missing, and `nx migrate` installs with `--ignore-scripts` — so a migrated
|
|
18
|
+
* workspace ends up with the package present and no binary. `npx` sidesteps all of
|
|
19
|
+
* it: it runs the package's own bin, resolving from `node_modules` when it happens
|
|
20
|
+
* to be there and fetching it otherwise. A warm cache costs about a second.
|
|
21
|
+
*
|
|
22
|
+
* On Windows mise publishes no platform package to npm, so there the Smithy CLI is
|
|
23
|
+
* a documented prerequisite and the target invokes `smithy` directly.
|
|
24
|
+
*/ /**
|
|
25
|
+
* The prefix a target command runs the Smithy CLI through.
|
|
26
|
+
*
|
|
27
|
+
* Off Windows both mise and the CLI are pinned in the command, so the version sync
|
|
28
|
+
* can move them forward. On Windows the CLI comes from the user's PATH, so there is
|
|
29
|
+
* no version to pin — {@link warnIfSmithyMissing} checks it is there.
|
|
30
|
+
*/ export const smithyCliCommand = ()=>isWindows() ? 'smithy' : `npx -y mise@${TS_VERSIONS.mise} exec smithy@${MISE_VERSIONS.smithy} -- smithy`;
|
|
31
|
+
/**
|
|
32
|
+
* Whether the workspace this generator runs in targets Windows, where the Smithy
|
|
33
|
+
* CLI is a user-installed prerequisite.
|
|
34
|
+
*
|
|
35
|
+
* Read at generate time rather than build time: the resolved command is baked
|
|
36
|
+
* into `project.json`, matching how `containers.engine` is resolved.
|
|
37
|
+
*/ export const isWindows = ()=>process.platform === 'win32';
|
|
38
|
+
/** Whether a Smithy CLI is resolvable on the PATH. */ const isSmithyOnPath = ()=>{
|
|
39
|
+
try {
|
|
40
|
+
childProcess.execSync('where smithy', {
|
|
41
|
+
stdio: 'ignore'
|
|
42
|
+
});
|
|
43
|
+
return true;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Warn when generating a Smithy project on Windows without the CLI installed.
|
|
50
|
+
*
|
|
51
|
+
* A warning rather than an error: the project is still generated correctly, and
|
|
52
|
+
* the CLI can be installed before the first build.
|
|
53
|
+
*
|
|
54
|
+
* @param onPath overrides the PATH probe, so a test can cover the Windows branch
|
|
55
|
+
* from any runner — ESM module namespaces cannot be spied on.
|
|
56
|
+
*/ export const warnIfSmithyMissing = (onPath = isSmithyOnPath)=>{
|
|
57
|
+
if (!isWindows() || onPath()) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
logger.warn(`The Smithy CLI was not found on your PATH. Smithy projects build with it directly on Windows, so install it before building: https://smithy.io/2.0/guides/smithy-cli/cli_installation.html`);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Substitution variables exposing the Smithy Maven pins to the generated
|
|
64
|
+
* `smithy-build.json` templates.
|
|
65
|
+
*/ export const smithyMavenVersions = ()=>({
|
|
66
|
+
smithyModelDependency: javaMavenDependency('software.amazon.smithy:smithy-model'),
|
|
67
|
+
smithyAwsTraitsDependency: javaMavenDependency('software.amazon.smithy:smithy-aws-traits'),
|
|
68
|
+
smithyValidationModelDependency: javaMavenDependency('software.amazon.smithy:smithy-validation-model'),
|
|
69
|
+
smithyOpenApiDependency: javaMavenDependency('software.amazon.smithy:smithy-openapi'),
|
|
70
|
+
smithyTypeScriptCodegenDependency: javaMavenDependency('software.amazon.smithy.typescript:smithy-aws-typescript-codegen')
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=smithy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/smithy.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as childProcess from 'node:child_process';\nimport { logger } from '@nx/devkit';\nimport { javaMavenDependency, MISE_VERSIONS, TS_VERSIONS } from './versions';\n\n/**\n * How a generated Smithy project runs the Smithy CLI.\n *\n * Off Windows `mise` resolves the pinned CLI, downloading and caching it on first\n * use, so a Smithy build needs no tool installed on the machine.\n *\n * mise itself is fetched by `npx` rather than added as a workspace dependency. The\n * `mise` npm package is a stub that fetches its real binary in a `preinstall`, and\n * every package manager gates install scripts differently: pnpm, bun and yarn\n * Berry each need their own allowlist entry, bun and yarn fail silently when it is\n * missing, and `nx migrate` installs with `--ignore-scripts` — so a migrated\n * workspace ends up with the package present and no binary. `npx` sidesteps all of\n * it: it runs the package's own bin, resolving from `node_modules` when it happens\n * to be there and fetching it otherwise. A warm cache costs about a second.\n *\n * On Windows mise publishes no platform package to npm, so there the Smithy CLI is\n * a documented prerequisite and the target invokes `smithy` directly.\n */\n\n/**\n * The prefix a target command runs the Smithy CLI through.\n *\n * Off Windows both mise and the CLI are pinned in the command, so the version sync\n * can move them forward. On Windows the CLI comes from the user's PATH, so there is\n * no version to pin — {@link warnIfSmithyMissing} checks it is there.\n */\nexport const smithyCliCommand = (): string =>\n isWindows()\n ? 'smithy'\n : `npx -y mise@${TS_VERSIONS.mise} exec smithy@${MISE_VERSIONS.smithy} -- smithy`;\n\n/**\n * Whether the workspace this generator runs in targets Windows, where the Smithy\n * CLI is a user-installed prerequisite.\n *\n * Read at generate time rather than build time: the resolved command is baked\n * into `project.json`, matching how `containers.engine` is resolved.\n */\nexport const isWindows = (): boolean => process.platform === 'win32';\n\n/** Whether a Smithy CLI is resolvable on the PATH. */\nconst isSmithyOnPath = (): boolean => {\n try {\n childProcess.execSync('where smithy', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Warn when generating a Smithy project on Windows without the CLI installed.\n *\n * A warning rather than an error: the project is still generated correctly, and\n * the CLI can be installed before the first build.\n *\n * @param onPath overrides the PATH probe, so a test can cover the Windows branch\n * from any runner — ESM module namespaces cannot be spied on.\n */\nexport const warnIfSmithyMissing = (\n onPath: () => boolean = isSmithyOnPath,\n): void => {\n if (!isWindows() || onPath()) {\n return;\n }\n logger.warn(\n `The Smithy CLI was not found on your PATH. Smithy projects build with it directly on Windows, so install it before building: https://smithy.io/2.0/guides/smithy-cli/cli_installation.html`,\n );\n};\n\n/**\n * Substitution variables exposing the Smithy Maven pins to the generated\n * `smithy-build.json` templates.\n */\nexport const smithyMavenVersions = () => ({\n smithyModelDependency: javaMavenDependency(\n 'software.amazon.smithy:smithy-model',\n ),\n smithyAwsTraitsDependency: javaMavenDependency(\n 'software.amazon.smithy:smithy-aws-traits',\n ),\n smithyValidationModelDependency: javaMavenDependency(\n 'software.amazon.smithy:smithy-validation-model',\n ),\n smithyOpenApiDependency: javaMavenDependency(\n 'software.amazon.smithy:smithy-openapi',\n ),\n smithyTypeScriptCodegenDependency: javaMavenDependency(\n 'software.amazon.smithy.typescript:smithy-aws-typescript-codegen',\n ),\n});\n"],"names":["childProcess","logger","javaMavenDependency","MISE_VERSIONS","TS_VERSIONS","smithyCliCommand","isWindows","mise","smithy","process","platform","isSmithyOnPath","execSync","stdio","warnIfSmithyMissing","onPath","warn","smithyMavenVersions","smithyModelDependency","smithyAwsTraitsDependency","smithyValidationModelDependency","smithyOpenApiDependency","smithyTypeScriptCodegenDependency"],"mappings":"AAAA;;;CAGC,GAED,YAAYA,kBAAkB,qBAAqB;AACnD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,mBAAmB,EAAEC,aAAa,EAAEC,WAAW,QAAQ,gBAAa;AAE7E;;;;;;;;;;;;;;;;;CAiBC,GAED;;;;;;CAMC,GACD,OAAO,MAAMC,mBAAmB,IAC9BC,cACI,WACA,CAAC,YAAY,EAAEF,YAAYG,IAAI,CAAC,aAAa,EAAEJ,cAAcK,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtF;;;;;;CAMC,GACD,OAAO,MAAMF,YAAY,IAAeG,QAAQC,QAAQ,KAAK,QAAQ;AAErE,oDAAoD,GACpD,MAAMC,iBAAiB;IACrB,IAAI;QACFX,aAAaY,QAAQ,CAAC,gBAAgB;YAAEC,OAAO;QAAS;QACxD,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SAAwBJ,cAAc;IAEtC,IAAI,CAACL,eAAeS,UAAU;QAC5B;IACF;IACAd,OAAOe,IAAI,CACT,CAAC,0LAA0L,CAAC;AAEhM,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAMC,sBAAsB,IAAO,CAAA;QACxCC,uBAAuBhB,oBACrB;QAEFiB,2BAA2BjB,oBACzB;QAEFkB,iCAAiClB,oBAC/B;QAEFmB,yBAAyBnB,oBACvB;QAEFoB,mCAAmCpB,oBACjC;IAEJ,CAAA,EAAG"}
|
|
@@ -14,8 +14,8 @@ import { type OwnedDependencies } from './owned-dependencies';
|
|
|
14
14
|
export declare const isDockerfile: (filePath: string) => boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Sync the vended versions baked into generated file bodies: `Dockerfile` pins,
|
|
17
|
-
* the Python pins in Terraform inline scripts,
|
|
18
|
-
* `
|
|
17
|
+
* the Python pins in Terraform inline scripts, the tooling `project.json` target
|
|
18
|
+
* commands run, and the Maven coordinates a `smithy-build.json` resolves.
|
|
19
19
|
*
|
|
20
20
|
* Reports only the files left for the user: a pin that takes effect the next time
|
|
21
21
|
* the thing holding it runs needs no follow-up, but one this skipped for holding
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/ import { visitNotIgnoredFiles } from "@nx/devkit";
|
|
4
|
+
*/ import { getProjects, joinPathFragments, visitNotIgnoredFiles } from "@nx/devkit";
|
|
5
|
+
import { SMITHY_PROJECT_GENERATOR_INFO } from "../../smithy/project/generator.js";
|
|
5
6
|
import { applyGritQL } from "../ast.js";
|
|
6
|
-
import { BASE_IMAGES, CONTAINER_REPOSITORIES, CONTAINER_VERSIONS, PY_VERSIONS, TS_VERSIONS } from "../versions.js";
|
|
7
|
+
import { BASE_IMAGES, CONTAINER_REPOSITORIES, CONTAINER_VERSIONS, JAVA_ARTIFACTS, JAVA_VERSIONS, MISE_VERSIONS, PY_VERSIONS, TS_VERSIONS } from "../versions.js";
|
|
7
8
|
import { ownedForFile } from "./owned-dependencies.js";
|
|
8
9
|
import { isVendedUpgrade } from "./vended-upgrade.js";
|
|
9
10
|
/** Escape a package name or image reference for use inside a regex. */ const escapeRegExp = (value)=>value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -269,6 +270,17 @@ import { isVendedUpgrade } from "./vended-upgrade.js";
|
|
|
269
270
|
pattern: `${escapeRegExp(repository)}:([^${VERSION_TERMINATORS}']+)`,
|
|
270
271
|
vended: CONTAINER_VERSIONS[tool]
|
|
271
272
|
})),
|
|
273
|
+
// The Smithy CLI a Smithy project's compile target runs, and the `mise` that
|
|
274
|
+
// resolves it. Neither is installed into the workspace — the target fetches
|
|
275
|
+
// mise with `npx` — so this command is the only place either version sits.
|
|
276
|
+
{
|
|
277
|
+
pattern: `exec smithy@([^${VERSION_TERMINATORS}']+)`,
|
|
278
|
+
vended: MISE_VERSIONS.smithy
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
pattern: `npx -y mise@([^${VERSION_TERMINATORS}']+)`,
|
|
282
|
+
vended: TS_VERSIONS.mise
|
|
283
|
+
},
|
|
272
284
|
...Object.keys(PY_VERSIONS).flatMap((name)=>{
|
|
273
285
|
const vended = vendedPyVersion(name);
|
|
274
286
|
return vended ? UVX_PIN_SHAPES.map((shape)=>({
|
|
@@ -285,10 +297,45 @@ import { isVendedUpgrade } from "./vended-upgrade.js";
|
|
|
285
297
|
}
|
|
286
298
|
return skipped;
|
|
287
299
|
};
|
|
300
|
+
/**
|
|
301
|
+
* Sync the Maven coordinates a generated `smithy-build.json` resolves.
|
|
302
|
+
*
|
|
303
|
+
* These are Java artifacts the Smithy CLI downloads, so they appear in no
|
|
304
|
+
* manifest the dependency sync reads — this file is the only place they sit. Each
|
|
305
|
+
* is matched by its `group:artifact` prefix so only the version is rewritten,
|
|
306
|
+
* leaving any coordinate the user added alone.
|
|
307
|
+
*
|
|
308
|
+
* Scoped to the projects `smithy#project` generated: a `smithy-build.json` a user
|
|
309
|
+
* wrote themselves keeps the versions they chose.
|
|
310
|
+
*/ const syncSmithyMavenPins = async (tree)=>{
|
|
311
|
+
const isGeneratedSmithyProject = (project)=>project.metadata?.generator === SMITHY_PROJECT_GENERATOR_INFO.id;
|
|
312
|
+
const smithyBuilds = [];
|
|
313
|
+
for (const [, project] of getProjects(tree)){
|
|
314
|
+
if (!isGeneratedSmithyProject(project)) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
const path = joinPathFragments(project.root, 'smithy-build.json');
|
|
318
|
+
if (tree.exists(path)) {
|
|
319
|
+
smithyBuilds.push(path);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const pins = JAVA_ARTIFACTS.map((artifact)=>({
|
|
323
|
+
// A coordinate is a JSON string here, so a quote ends the version.
|
|
324
|
+
pattern: `${escapeRegExp(artifact)}:([^${VERSION_TERMINATORS}']+)`,
|
|
325
|
+
vended: JAVA_VERSIONS[artifact]
|
|
326
|
+
}));
|
|
327
|
+
const skipped = [];
|
|
328
|
+
for (const path of smithyBuilds){
|
|
329
|
+
if ((await applyPins(tree, path, pins)).skipped) {
|
|
330
|
+
skipped.push(path);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return skipped;
|
|
334
|
+
};
|
|
288
335
|
/**
|
|
289
336
|
* Sync the vended versions baked into generated file bodies: `Dockerfile` pins,
|
|
290
|
-
* the Python pins in Terraform inline scripts,
|
|
291
|
-
* `
|
|
337
|
+
* the Python pins in Terraform inline scripts, the tooling `project.json` target
|
|
338
|
+
* commands run, and the Maven coordinates a `smithy-build.json` resolves.
|
|
292
339
|
*
|
|
293
340
|
* Reports only the files left for the user: a pin that takes effect the next time
|
|
294
341
|
* the thing holding it runs needs no follow-up, but one this skipped for holding
|
|
@@ -298,7 +345,8 @@ import { isVendedUpgrade } from "./vended-upgrade.js";
|
|
|
298
345
|
*/ export const syncEmbeddedVersions = async (tree, owned)=>[
|
|
299
346
|
...await syncDockerfiles(tree, owned),
|
|
300
347
|
...await syncTerraformScriptPins(tree, owned),
|
|
301
|
-
...await syncTargetToolPins(tree)
|
|
348
|
+
...await syncTargetToolPins(tree),
|
|
349
|
+
...await syncSmithyMavenPins(tree)
|
|
302
350
|
];
|
|
303
351
|
|
|
304
352
|
//# sourceMappingURL=sync-embedded-versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/sync-embedded-versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { Tree } from '@nx/devkit';\nimport { visitNotIgnoredFiles } from '@nx/devkit';\nimport { applyGritQL } from '../ast';\nimport {\n BASE_IMAGES,\n CONTAINER_REPOSITORIES,\n CONTAINER_VERSIONS,\n PY_VERSIONS,\n TS_VERSIONS,\n} from '../versions';\nimport { type OwnedDependencies, ownedForFile } from './owned-dependencies';\nimport { isVendedUpgrade } from './vended-upgrade';\n\n/**\n * Sync the vended versions generators bake into the body of a file rather than\n * into a manifest: the container image pins in a `Dockerfile`, the Python pins\n * in a Terraform inline script, and the tooling images a `project.json` target\n * command runs.\n *\n * Every version here is pinned to clear a known HIGH/CRITICAL vulnerability, or\n * to keep a generated image reproducible, so leaving them behind strands a\n * workspace on exactly the versions most in need of an upgrade.\n *\n * These sit inside shell commands, which GritQL has no grammar for — so instead\n * of pattern-matching the surrounding syntax, each pin is located by an anchored\n * regex whose single capture group is the version, and only that capture is\n * rewritten. The file's own text around it is never reconstructed, so a\n * reformatted or hand-edited file syncs the same way a freshly generated one\n * does.\n */\n\n/** A pin found in a file body, and the version this release vends for it. */\ninterface EmbeddedPin {\n /** Regex matching the pin, with the version as its only capture group. */\n readonly pattern: string;\n readonly vended: string;\n /**\n * Whether the declared value is a version to move forward, or a tag to replace\n * whenever it differs. A tag — `lts-slim`, say — has no ordering to compare, so\n * one that isn't what this release vends is simply out of date.\n */\n readonly kind?: 'version' | 'tag';\n}\n\n/** Escape a package name or image reference for use inside a regex. */\nconst escapeRegExp = (value: string): string =>\n value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/**\n * Characters that end a pinned version: whitespace, the backslash continuing a\n * shell line, and the quote closing the string the pin sits in.\n *\n * The quote is escaped because the pattern is itself a double-quoted GritQL\n * regex literal, which a bare quote would terminate.\n */\nconst VERSION_TERMINATORS = '\\\\s\\\\\\\\\\\\\"';\n\n/**\n * Rewrite the capture group of an anchored regex to the vended version.\n *\n * The leading and trailing `[\\s\\S]*` anchor the match to the whole file, which\n * is what lets a capture group be rewritten on its own: GritQL binds the group\n * to a node it can replace, leaving every other byte untouched. Without the\n * anchors nothing matches.\n */\nconst rewriteCapture = (pattern: string, vended: string): string =>\n `r\"[\\\\s\\\\S]*${pattern}[\\\\s\\\\S]*\"($version) where { $version => \\`${vended}\\` }`;\n\n/**\n * Versions a pin's regex currently matches in the file.\n *\n * Read before rewriting so a version the user raised past what this release\n * vends is left alone, matching how every other surface behaves.\n */\nconst declaredVersions = (contents: string, pattern: string): string[] => {\n const matches = contents.matchAll(new RegExp(pattern, 'g'));\n return [...matches].flatMap((match) => (match[1] ? [match[1]] : []));\n};\n\n/**\n * Occurrences of one pin a single rewrite will handle.\n *\n * GritQL rewrites each match separately, so its cost grows with how many a\n * pattern matches — ~10ms an occurrence, which a hand-authored file with hundreds\n * of `RUN npm install` lines turns into minutes of an unattended `nx migrate`.\n * Past this the file is left alone and reported, since a wrong version the user\n * can see and fix beats an upgrade that appears to hang.\n */\nconst MAX_OCCURRENCES_PER_PIN = 100;\n\n/**\n * Apply the pins whose declared version this release moves forward.\n *\n * A single rewrite covers every occurrence of a pin in the file, so each pin is\n * applied once. Reports whether anything changed, and whether a pin was left\n * alone for exceeding {@link MAX_OCCURRENCES_PER_PIN}.\n */\nconst applyPins = async (\n tree: Tree,\n path: string,\n pins: readonly EmbeddedPin[],\n): Promise<{ changed: boolean; skipped: boolean }> => {\n // Read once and re-read only after a rewrite: a rewrite parses the whole file,\n // and there is a pin per owned package, so re-reading per pin would scale the\n // cost of a large file with the size of the owned set.\n let contents = tree.read(path, 'utf-8') ?? '';\n let changed = false;\n let skipped = false;\n\n for (const { pattern, vended, kind = 'version' } of pins) {\n const declared = declaredVersions(contents, pattern);\n if (declared.length === 0) {\n continue;\n }\n if (declared.length > MAX_OCCURRENCES_PER_PIN) {\n skipped = true;\n continue;\n }\n const outOfDate =\n kind === 'tag'\n ? (tag: string) => tag !== vended\n : (version: string) => isVendedUpgrade(vended, version);\n // A rewrite replaces every occurrence at once, so this must hold for all of\n // them — a pin already at or beyond the vended version is left as it is.\n if (!declared.every(outOfDate)) {\n continue;\n }\n if (await applyGritQL(tree, path, rewriteCapture(pattern, vended))) {\n contents = tree.read(path, 'utf-8') ?? '';\n changed = true;\n }\n }\n\n return { changed, skipped };\n};\n\n/**\n * The version this release vends for a package, or undefined for one it doesn't\n * vend at all.\n *\n * Ownership is applied by the caller, which only ever passes a name drawn from\n * the owned set — so a package the user pinned themselves never reaches here and\n * keeps the version they chose.\n */\nconst vendedTsVersion = (name: string): string | undefined =>\n TS_VERSIONS[name as keyof typeof TS_VERSIONS];\n\n/** `PY_VERSIONS` records the `==` operator; a pin holds the bare version. */\nconst vendedPyVersion = (name: string): string | undefined =>\n PY_VERSIONS[name as keyof typeof PY_VERSIONS]?.replace(/^==/, '');\n\n/**\n * The ways a generated `Dockerfile` pins a TypeScript package's version, as\n * regex fragments taking the escaped package name.\n *\n * The name is required to run to its delimiter, so a package whose name merely\n * ends with another's — `some-npm` against `npm` — cannot match, and an\n * installed version must start with a digit so a `@latest` style tag is left\n * alone.\n */\nconst DOCKERFILE_PIN_SHAPES: readonly ((name: string) => string)[] = [\n // Installed by the image build. `install` and its `i` alias are both used, as\n // are `-g` and several packages in one command, so the name only has to follow\n // an `npm` subcommand rather than sit right after it. The whitespace before it\n // is matched rather than asserted, since GritQL's regex engine has no\n // lookbehind — which also keeps `some-npm` from matching `npm`, and unlike a\n // `\\b` boundary still reaches a `@scope/name`.\n (name) =>\n `npm (?:install|i|add)[^\\\\n]*?\\\\s${name}@([0-9][^${VERSION_TERMINATORS}]*)`,\n // Held at a fixed version through an `npm pkg set` override, to clear a known\n // vulnerability in a transitive dependency.\n (name) => `overrides\\\\.${name}=([^${VERSION_TERMINATORS}]+)`,\n];\n\n/**\n * Every pin a generated `Dockerfile` may carry, for the packages owned where it\n * sits.\n *\n * Driven off the owned packages rather than a list of the ones that happen to be\n * pinned today: a pin added to a template in a later release is then covered\n * without this module changing, which is the whole point — the versions baked\n * into image builds are pinned precisely because they clear a known\n * vulnerability.\n *\n * A package the user pinned themselves is not owned, so it is never matched.\n */\nconst dockerfilePins = (owned: {\n readonly ts: ReadonlySet<string>;\n}): EmbeddedPin[] => {\n const pins: EmbeddedPin[] = [];\n\n for (const name of owned.ts) {\n const vended = vendedTsVersion(name);\n if (!vended) {\n continue;\n }\n for (const shape of DOCKERFILE_PIN_SHAPES) {\n pins.push({ pattern: shape(escapeRegExp(name)), vended });\n }\n }\n\n for (const image of Object.values(BASE_IMAGES)) {\n const [repository, tag] = splitImageReference(image);\n pins.push({\n // Only a `FROM` that is the whole instruction. A build stage names itself\n // — `FROM <repo>:24 AS builder` — and picks its tag for what that stage has\n // to run: the smithy builder needs curl and unzip, which the slim tag this\n // release vends for a runtime image does not carry. Rewriting it would\n // break the build, and the two share a repository, so the instruction\n // ending is what separates them.\n pattern: `FROM ${escapeRegExp(repository)}:([^\\\\s]+)\\\\n`,\n vended: tag,\n kind: 'tag',\n });\n }\n\n return pins;\n};\n\n/**\n * The repository and tag of a pinned image reference. The tag is the part after\n * the last `:`, which a registry port would otherwise be mistaken for — every\n * reference here carries one.\n */\nconst splitImageReference = (image: string): [string, string] => {\n const at = image.lastIndexOf(':');\n return [image.slice(0, at), image.slice(at + 1)];\n};\n\n/**\n * Whether a file is a Dockerfile: exactly `Dockerfile`, or the `<name>.Dockerfile`\n * form the smithy templates vend as `build.Dockerfile`.\n *\n * Deliberately exact rather than a prefix match, which would also claim a\n * `Dockerfile.bak` or a `Dockerfile.md` the user keeps beside a real one.\n */\nexport const isDockerfile = (filePath: string): boolean => {\n const name = filePath.split('/').pop() ?? '';\n return name === 'Dockerfile' || name.endsWith('.Dockerfile');\n};\n\n/**\n * Sync the pins in every generated Dockerfile.\n *\n * Ownership is resolved per file, so a Dockerfile is only rewritten for the\n * packages the project it belongs to owns — a sibling project owning `prisma`\n * does not license rewriting a `prisma` pin here.\n */\nconst syncDockerfiles = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => {\n const dockerfiles: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (isDockerfile(path)) {\n dockerfiles.push(path);\n }\n });\n\n const skipped: string[] = [];\n for (const path of dockerfiles) {\n const result = await applyPins(\n tree,\n path,\n dockerfilePins(ownedForFile(owned, path)),\n );\n if (result.skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/** The `uv run --with` pins to apply, for the Python packages owned where a file sits. */\nconst terraformScriptPins = (owned: {\n readonly py: ReadonlySet<string>;\n}): EmbeddedPin[] =>\n [...owned.py].flatMap((name) => {\n const vended = vendedPyVersion(name);\n return vended\n ? [\n {\n pattern: `--with ${escapeRegExp(name)}==([^${VERSION_TERMINATORS}]+)`,\n vended,\n },\n ]\n : [];\n });\n\n/**\n * Sync the Python pins a generated Terraform inline script runs through\n * `uv run --with <package>==<version>`.\n *\n * These are the plugin's own pins, in a file the Terraform provider sync already\n * visits but only reads `required_providers` from. Driven off the owned Python\n * packages, so a pin added to a template later is covered without a change here.\n *\n * Scoped per file like the Dockerfiles. The modules carrying these live in the\n * shared Terraform project, which no single generator owns — a file there belongs\n * to no project, so it takes the workspace-wide union, which is the set of\n * generators that legitimately write into it.\n */\nconst syncTerraformScriptPins = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => {\n const terraformFiles: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path.endsWith('.tf')) {\n terraformFiles.push(path);\n }\n });\n\n const skipped: string[] = [];\n for (const path of terraformFiles) {\n const result = await applyPins(\n tree,\n path,\n terraformScriptPins(ownedForFile(owned, path)),\n );\n if (result.skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/**\n * The ways a `uvx` invocation pins a Python version: the tool it runs, and any\n * package it adds to that tool's environment.\n *\n * A command string is JSON here, so a quote ends a version too.\n */\nconst UVX_PIN_SHAPES: readonly ((name: string) => string)[] = [\n (name) => `uvx --from ${name}==`,\n (name) => `--with ${name}==`,\n];\n\n/**\n * Sync the pinned tools a `project.json` target command runs: a container image,\n * and the Python versions a `uvx` invocation pins.\n *\n * Both are built into the command string rather than declared as a dependency, so\n * nothing else reaches them. The images are driven off `CONTAINER_REPOSITORIES`\n * and the Python versions off `PY_VERSIONS`, so a tool pinned in a target command\n * later is covered without a change here — the same property the Dockerfile and\n * Terraform paths get from the owned set.\n *\n * Unscoped, unlike the file-body pins: a `uvx` invocation installs nothing into\n * the project, so there is no dependency for a generator to own. A version is only\n * rewritten where this release vends that exact package at a higher one.\n */\nconst syncTargetToolPins = async (tree: Tree): Promise<string[]> => {\n const projectJsons: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path.endsWith('project.json')) {\n projectJsons.push(path);\n }\n });\n\n const pins: EmbeddedPin[] = [\n ...Object.entries(CONTAINER_REPOSITORIES).map(([tool, repository]) => ({\n // A command string is JSON here, so a quote ends the reference too.\n pattern: `${escapeRegExp(repository)}:([^${VERSION_TERMINATORS}']+)`,\n vended: CONTAINER_VERSIONS[tool as keyof typeof CONTAINER_VERSIONS],\n })),\n ...Object.keys(PY_VERSIONS).flatMap((name) => {\n const vended = vendedPyVersion(name);\n return vended\n ? UVX_PIN_SHAPES.map((shape) => ({\n pattern: `${shape(escapeRegExp(name))}([^${VERSION_TERMINATORS}']+)`,\n vended,\n }))\n : [];\n }),\n ];\n\n const skipped: string[] = [];\n for (const path of projectJsons) {\n if ((await applyPins(tree, path, pins)).skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/**\n * Sync the vended versions baked into generated file bodies: `Dockerfile` pins,\n * the Python pins in Terraform inline scripts, and the tooling images\n * `project.json` target commands run.\n *\n * Reports only the files left for the user: a pin that takes effect the next time\n * the thing holding it runs needs no follow-up, but one this skipped for holding\n * more occurrences than it will rewrite at once does.\n *\n * @returns paths whose pins were left as they were\n */\nexport const syncEmbeddedVersions = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => [\n ...(await syncDockerfiles(tree, owned)),\n ...(await syncTerraformScriptPins(tree, owned)),\n ...(await syncTargetToolPins(tree)),\n];\n"],"names":["visitNotIgnoredFiles","applyGritQL","BASE_IMAGES","CONTAINER_REPOSITORIES","CONTAINER_VERSIONS","PY_VERSIONS","TS_VERSIONS","ownedForFile","isVendedUpgrade","escapeRegExp","value","replace","VERSION_TERMINATORS","rewriteCapture","pattern","vended","declaredVersions","contents","matches","matchAll","RegExp","flatMap","match","MAX_OCCURRENCES_PER_PIN","applyPins","tree","path","pins","read","changed","skipped","kind","declared","length","outOfDate","tag","version","every","vendedTsVersion","name","vendedPyVersion","DOCKERFILE_PIN_SHAPES","dockerfilePins","owned","ts","shape","push","image","Object","values","repository","splitImageReference","at","lastIndexOf","slice","isDockerfile","filePath","split","pop","endsWith","syncDockerfiles","dockerfiles","result","terraformScriptPins","py","syncTerraformScriptPins","terraformFiles","UVX_PIN_SHAPES","syncTargetToolPins","projectJsons","entries","map","tool","keys","syncEmbeddedVersions"],"mappings":"AAAA;;;CAGC,GAED,SAASA,oBAAoB,QAAQ,aAAa;AAClD,SAASC,WAAW,QAAQ,YAAS;AACrC,SACEC,WAAW,EACXC,sBAAsB,EACtBC,kBAAkB,EAClBC,WAAW,EACXC,WAAW,QACN,iBAAc;AACrB,SAAiCC,YAAY,QAAQ,0BAAuB;AAC5E,SAASC,eAAe,QAAQ,sBAAmB;AAiCnD,qEAAqE,GACrE,MAAMC,eAAe,CAACC,QACpBA,MAAMC,OAAO,CAAC,uBAAuB;AAEvC;;;;;;CAMC,GACD,MAAMC,sBAAsB;AAE5B;;;;;;;CAOC,GACD,MAAMC,iBAAiB,CAACC,SAAiBC,SACvC,CAAC,WAAW,EAAED,QAAQ,2CAA2C,EAAEC,OAAO,IAAI,CAAC;AAEjF;;;;;CAKC,GACD,MAAMC,mBAAmB,CAACC,UAAkBH;IAC1C,MAAMI,UAAUD,SAASE,QAAQ,CAAC,IAAIC,OAAON,SAAS;IACtD,OAAO;WAAII;KAAQ,CAACG,OAAO,CAAC,CAACC,QAAWA,KAAK,CAAC,EAAE,GAAG;YAACA,KAAK,CAAC,EAAE;SAAC,GAAG,EAAE;AACpE;AAEA;;;;;;;;CAQC,GACD,MAAMC,0BAA0B;AAEhC;;;;;;CAMC,GACD,MAAMC,YAAY,OAChBC,MACAC,MACAC;IAEA,+EAA+E;IAC/E,8EAA8E;IAC9E,uDAAuD;IACvD,IAAIV,WAAWQ,KAAKG,IAAI,CAACF,MAAM,YAAY;IAC3C,IAAIG,UAAU;IACd,IAAIC,UAAU;IAEd,KAAK,MAAM,EAAEhB,OAAO,EAAEC,MAAM,EAAEgB,OAAO,SAAS,EAAE,IAAIJ,KAAM;QACxD,MAAMK,WAAWhB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C;gBACpEG,QAAQX,kBAAkB,CAACoE,KAAwC;YACrE,CAAA;WACGxB,OAAOyB,IAAI,CAACpE,aAAagB,OAAO,CAAC,CAACkB;YACnC,MAAMxB,SAASyB,gBAAgBD;YAC/B,OAAOxB,SACHoD,eAAeI,GAAG,CAAC,CAAC1B,QAAW,CAAA;oBAC7B/B,SAAS,GAAG+B,MAAMpC,aAAa8B,OAAO,GAAG,EAAE3B,oBAAoB,IAAI,CAAC;oBACpEG;gBACF,CAAA,KACA,EAAE;QACR;KACD;IAED,MAAMe,UAAoB,EAAE;IAC5B,KAAK,MAAMJ,QAAQ2C,aAAc;QAC/B,IAAI,AAAC,CAAA,MAAM7C,UAAUC,MAAMC,MAAMC,KAAI,EAAGG,OAAO,EAAE;YAC/CA,QAAQgB,IAAI,CAACpB;QACf;IACF;IACA,OAAOI;AACT;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAM4C,uBAAuB,OAClCjD,MACAkB,QACsB;WAClB,MAAMiB,gBAAgBnC,MAAMkB;WAC5B,MAAMsB,wBAAwBxC,MAAMkB;WACpC,MAAMyB,mBAAmB3C;KAC9B,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/sync-embedded-versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { ProjectConfiguration, Tree } from '@nx/devkit';\nimport {\n getProjects,\n joinPathFragments,\n visitNotIgnoredFiles,\n} from '@nx/devkit';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../../smithy/project/generator';\nimport { applyGritQL } from '../ast';\nimport {\n BASE_IMAGES,\n CONTAINER_REPOSITORIES,\n CONTAINER_VERSIONS,\n JAVA_ARTIFACTS,\n JAVA_VERSIONS,\n MISE_VERSIONS,\n PY_VERSIONS,\n TS_VERSIONS,\n} from '../versions';\nimport { type OwnedDependencies, ownedForFile } from './owned-dependencies';\nimport { isVendedUpgrade } from './vended-upgrade';\n\n/**\n * Sync the vended versions generators bake into the body of a file rather than\n * into a manifest: the container image pins in a `Dockerfile`, the Python pins\n * in a Terraform inline script, and the tooling images a `project.json` target\n * command runs.\n *\n * Every version here is pinned to clear a known HIGH/CRITICAL vulnerability, or\n * to keep a generated image reproducible, so leaving them behind strands a\n * workspace on exactly the versions most in need of an upgrade.\n *\n * These sit inside shell commands, which GritQL has no grammar for — so instead\n * of pattern-matching the surrounding syntax, each pin is located by an anchored\n * regex whose single capture group is the version, and only that capture is\n * rewritten. The file's own text around it is never reconstructed, so a\n * reformatted or hand-edited file syncs the same way a freshly generated one\n * does.\n */\n\n/** A pin found in a file body, and the version this release vends for it. */\ninterface EmbeddedPin {\n /** Regex matching the pin, with the version as its only capture group. */\n readonly pattern: string;\n readonly vended: string;\n /**\n * Whether the declared value is a version to move forward, or a tag to replace\n * whenever it differs. A tag — `lts-slim`, say — has no ordering to compare, so\n * one that isn't what this release vends is simply out of date.\n */\n readonly kind?: 'version' | 'tag';\n}\n\n/** Escape a package name or image reference for use inside a regex. */\nconst escapeRegExp = (value: string): string =>\n value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/**\n * Characters that end a pinned version: whitespace, the backslash continuing a\n * shell line, and the quote closing the string the pin sits in.\n *\n * The quote is escaped because the pattern is itself a double-quoted GritQL\n * regex literal, which a bare quote would terminate.\n */\nconst VERSION_TERMINATORS = '\\\\s\\\\\\\\\\\\\"';\n\n/**\n * Rewrite the capture group of an anchored regex to the vended version.\n *\n * The leading and trailing `[\\s\\S]*` anchor the match to the whole file, which\n * is what lets a capture group be rewritten on its own: GritQL binds the group\n * to a node it can replace, leaving every other byte untouched. Without the\n * anchors nothing matches.\n */\nconst rewriteCapture = (pattern: string, vended: string): string =>\n `r\"[\\\\s\\\\S]*${pattern}[\\\\s\\\\S]*\"($version) where { $version => \\`${vended}\\` }`;\n\n/**\n * Versions a pin's regex currently matches in the file.\n *\n * Read before rewriting so a version the user raised past what this release\n * vends is left alone, matching how every other surface behaves.\n */\nconst declaredVersions = (contents: string, pattern: string): string[] => {\n const matches = contents.matchAll(new RegExp(pattern, 'g'));\n return [...matches].flatMap((match) => (match[1] ? [match[1]] : []));\n};\n\n/**\n * Occurrences of one pin a single rewrite will handle.\n *\n * GritQL rewrites each match separately, so its cost grows with how many a\n * pattern matches — ~10ms an occurrence, which a hand-authored file with hundreds\n * of `RUN npm install` lines turns into minutes of an unattended `nx migrate`.\n * Past this the file is left alone and reported, since a wrong version the user\n * can see and fix beats an upgrade that appears to hang.\n */\nconst MAX_OCCURRENCES_PER_PIN = 100;\n\n/**\n * Apply the pins whose declared version this release moves forward.\n *\n * A single rewrite covers every occurrence of a pin in the file, so each pin is\n * applied once. Reports whether anything changed, and whether a pin was left\n * alone for exceeding {@link MAX_OCCURRENCES_PER_PIN}.\n */\nconst applyPins = async (\n tree: Tree,\n path: string,\n pins: readonly EmbeddedPin[],\n): Promise<{ changed: boolean; skipped: boolean }> => {\n // Read once and re-read only after a rewrite: a rewrite parses the whole file,\n // and there is a pin per owned package, so re-reading per pin would scale the\n // cost of a large file with the size of the owned set.\n let contents = tree.read(path, 'utf-8') ?? '';\n let changed = false;\n let skipped = false;\n\n for (const { pattern, vended, kind = 'version' } of pins) {\n const declared = declaredVersions(contents, pattern);\n if (declared.length === 0) {\n continue;\n }\n if (declared.length > MAX_OCCURRENCES_PER_PIN) {\n skipped = true;\n continue;\n }\n const outOfDate =\n kind === 'tag'\n ? (tag: string) => tag !== vended\n : (version: string) => isVendedUpgrade(vended, version);\n // A rewrite replaces every occurrence at once, so this must hold for all of\n // them — a pin already at or beyond the vended version is left as it is.\n if (!declared.every(outOfDate)) {\n continue;\n }\n if (await applyGritQL(tree, path, rewriteCapture(pattern, vended))) {\n contents = tree.read(path, 'utf-8') ?? '';\n changed = true;\n }\n }\n\n return { changed, skipped };\n};\n\n/**\n * The version this release vends for a package, or undefined for one it doesn't\n * vend at all.\n *\n * Ownership is applied by the caller, which only ever passes a name drawn from\n * the owned set — so a package the user pinned themselves never reaches here and\n * keeps the version they chose.\n */\nconst vendedTsVersion = (name: string): string | undefined =>\n TS_VERSIONS[name as keyof typeof TS_VERSIONS];\n\n/** `PY_VERSIONS` records the `==` operator; a pin holds the bare version. */\nconst vendedPyVersion = (name: string): string | undefined =>\n PY_VERSIONS[name as keyof typeof PY_VERSIONS]?.replace(/^==/, '');\n\n/**\n * The ways a generated `Dockerfile` pins a TypeScript package's version, as\n * regex fragments taking the escaped package name.\n *\n * The name is required to run to its delimiter, so a package whose name merely\n * ends with another's — `some-npm` against `npm` — cannot match, and an\n * installed version must start with a digit so a `@latest` style tag is left\n * alone.\n */\nconst DOCKERFILE_PIN_SHAPES: readonly ((name: string) => string)[] = [\n // Installed by the image build. `install` and its `i` alias are both used, as\n // are `-g` and several packages in one command, so the name only has to follow\n // an `npm` subcommand rather than sit right after it. The whitespace before it\n // is matched rather than asserted, since GritQL's regex engine has no\n // lookbehind — which also keeps `some-npm` from matching `npm`, and unlike a\n // `\\b` boundary still reaches a `@scope/name`.\n (name) =>\n `npm (?:install|i|add)[^\\\\n]*?\\\\s${name}@([0-9][^${VERSION_TERMINATORS}]*)`,\n // Held at a fixed version through an `npm pkg set` override, to clear a known\n // vulnerability in a transitive dependency.\n (name) => `overrides\\\\.${name}=([^${VERSION_TERMINATORS}]+)`,\n];\n\n/**\n * Every pin a generated `Dockerfile` may carry, for the packages owned where it\n * sits.\n *\n * Driven off the owned packages rather than a list of the ones that happen to be\n * pinned today: a pin added to a template in a later release is then covered\n * without this module changing, which is the whole point — the versions baked\n * into image builds are pinned precisely because they clear a known\n * vulnerability.\n *\n * A package the user pinned themselves is not owned, so it is never matched.\n */\nconst dockerfilePins = (owned: {\n readonly ts: ReadonlySet<string>;\n}): EmbeddedPin[] => {\n const pins: EmbeddedPin[] = [];\n\n for (const name of owned.ts) {\n const vended = vendedTsVersion(name);\n if (!vended) {\n continue;\n }\n for (const shape of DOCKERFILE_PIN_SHAPES) {\n pins.push({ pattern: shape(escapeRegExp(name)), vended });\n }\n }\n\n for (const image of Object.values(BASE_IMAGES)) {\n const [repository, tag] = splitImageReference(image);\n pins.push({\n // Only a `FROM` that is the whole instruction. A build stage names itself\n // — `FROM <repo>:24 AS builder` — and picks its tag for what that stage has\n // to run: the smithy builder needs curl and unzip, which the slim tag this\n // release vends for a runtime image does not carry. Rewriting it would\n // break the build, and the two share a repository, so the instruction\n // ending is what separates them.\n pattern: `FROM ${escapeRegExp(repository)}:([^\\\\s]+)\\\\n`,\n vended: tag,\n kind: 'tag',\n });\n }\n\n return pins;\n};\n\n/**\n * The repository and tag of a pinned image reference. The tag is the part after\n * the last `:`, which a registry port would otherwise be mistaken for — every\n * reference here carries one.\n */\nconst splitImageReference = (image: string): [string, string] => {\n const at = image.lastIndexOf(':');\n return [image.slice(0, at), image.slice(at + 1)];\n};\n\n/**\n * Whether a file is a Dockerfile: exactly `Dockerfile`, or the `<name>.Dockerfile`\n * form the smithy templates vend as `build.Dockerfile`.\n *\n * Deliberately exact rather than a prefix match, which would also claim a\n * `Dockerfile.bak` or a `Dockerfile.md` the user keeps beside a real one.\n */\nexport const isDockerfile = (filePath: string): boolean => {\n const name = filePath.split('/').pop() ?? '';\n return name === 'Dockerfile' || name.endsWith('.Dockerfile');\n};\n\n/**\n * Sync the pins in every generated Dockerfile.\n *\n * Ownership is resolved per file, so a Dockerfile is only rewritten for the\n * packages the project it belongs to owns — a sibling project owning `prisma`\n * does not license rewriting a `prisma` pin here.\n */\nconst syncDockerfiles = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => {\n const dockerfiles: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (isDockerfile(path)) {\n dockerfiles.push(path);\n }\n });\n\n const skipped: string[] = [];\n for (const path of dockerfiles) {\n const result = await applyPins(\n tree,\n path,\n dockerfilePins(ownedForFile(owned, path)),\n );\n if (result.skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/** The `uv run --with` pins to apply, for the Python packages owned where a file sits. */\nconst terraformScriptPins = (owned: {\n readonly py: ReadonlySet<string>;\n}): EmbeddedPin[] =>\n [...owned.py].flatMap((name) => {\n const vended = vendedPyVersion(name);\n return vended\n ? [\n {\n pattern: `--with ${escapeRegExp(name)}==([^${VERSION_TERMINATORS}]+)`,\n vended,\n },\n ]\n : [];\n });\n\n/**\n * Sync the Python pins a generated Terraform inline script runs through\n * `uv run --with <package>==<version>`.\n *\n * These are the plugin's own pins, in a file the Terraform provider sync already\n * visits but only reads `required_providers` from. Driven off the owned Python\n * packages, so a pin added to a template later is covered without a change here.\n *\n * Scoped per file like the Dockerfiles. The modules carrying these live in the\n * shared Terraform project, which no single generator owns — a file there belongs\n * to no project, so it takes the workspace-wide union, which is the set of\n * generators that legitimately write into it.\n */\nconst syncTerraformScriptPins = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => {\n const terraformFiles: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path.endsWith('.tf')) {\n terraformFiles.push(path);\n }\n });\n\n const skipped: string[] = [];\n for (const path of terraformFiles) {\n const result = await applyPins(\n tree,\n path,\n terraformScriptPins(ownedForFile(owned, path)),\n );\n if (result.skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/**\n * The ways a `uvx` invocation pins a Python version: the tool it runs, and any\n * package it adds to that tool's environment.\n *\n * A command string is JSON here, so a quote ends a version too.\n */\nconst UVX_PIN_SHAPES: readonly ((name: string) => string)[] = [\n (name) => `uvx --from ${name}==`,\n (name) => `--with ${name}==`,\n];\n\n/**\n * Sync the pinned tools a `project.json` target command runs: a container image,\n * and the Python versions a `uvx` invocation pins.\n *\n * Both are built into the command string rather than declared as a dependency, so\n * nothing else reaches them. The images are driven off `CONTAINER_REPOSITORIES`\n * and the Python versions off `PY_VERSIONS`, so a tool pinned in a target command\n * later is covered without a change here — the same property the Dockerfile and\n * Terraform paths get from the owned set.\n *\n * Unscoped, unlike the file-body pins: a `uvx` invocation installs nothing into\n * the project, so there is no dependency for a generator to own. A version is only\n * rewritten where this release vends that exact package at a higher one.\n */\nconst syncTargetToolPins = async (tree: Tree): Promise<string[]> => {\n const projectJsons: string[] = [];\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path.endsWith('project.json')) {\n projectJsons.push(path);\n }\n });\n\n const pins: EmbeddedPin[] = [\n ...Object.entries(CONTAINER_REPOSITORIES).map(([tool, repository]) => ({\n // A command string is JSON here, so a quote ends the reference too.\n pattern: `${escapeRegExp(repository)}:([^${VERSION_TERMINATORS}']+)`,\n vended: CONTAINER_VERSIONS[tool as keyof typeof CONTAINER_VERSIONS],\n })),\n // The Smithy CLI a Smithy project's compile target runs, and the `mise` that\n // resolves it. Neither is installed into the workspace — the target fetches\n // mise with `npx` — so this command is the only place either version sits.\n {\n pattern: `exec smithy@([^${VERSION_TERMINATORS}']+)`,\n vended: MISE_VERSIONS.smithy,\n },\n {\n pattern: `npx -y mise@([^${VERSION_TERMINATORS}']+)`,\n vended: TS_VERSIONS.mise,\n },\n ...Object.keys(PY_VERSIONS).flatMap((name) => {\n const vended = vendedPyVersion(name);\n return vended\n ? UVX_PIN_SHAPES.map((shape) => ({\n pattern: `${shape(escapeRegExp(name))}([^${VERSION_TERMINATORS}']+)`,\n vended,\n }))\n : [];\n }),\n ];\n\n const skipped: string[] = [];\n for (const path of projectJsons) {\n if ((await applyPins(tree, path, pins)).skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/**\n * Sync the Maven coordinates a generated `smithy-build.json` resolves.\n *\n * These are Java artifacts the Smithy CLI downloads, so they appear in no\n * manifest the dependency sync reads — this file is the only place they sit. Each\n * is matched by its `group:artifact` prefix so only the version is rewritten,\n * leaving any coordinate the user added alone.\n *\n * Scoped to the projects `smithy#project` generated: a `smithy-build.json` a user\n * wrote themselves keeps the versions they chose.\n */\nconst syncSmithyMavenPins = async (tree: Tree): Promise<string[]> => {\n const isGeneratedSmithyProject = (project: ProjectConfiguration): boolean =>\n (project.metadata as { generator?: string } | undefined)?.generator ===\n SMITHY_PROJECT_GENERATOR_INFO.id;\n\n const smithyBuilds: string[] = [];\n for (const [, project] of getProjects(tree)) {\n if (!isGeneratedSmithyProject(project)) {\n continue;\n }\n const path = joinPathFragments(project.root, 'smithy-build.json');\n if (tree.exists(path)) {\n smithyBuilds.push(path);\n }\n }\n\n const pins: EmbeddedPin[] = JAVA_ARTIFACTS.map((artifact) => ({\n // A coordinate is a JSON string here, so a quote ends the version.\n pattern: `${escapeRegExp(artifact)}:([^${VERSION_TERMINATORS}']+)`,\n vended: JAVA_VERSIONS[artifact],\n }));\n\n const skipped: string[] = [];\n for (const path of smithyBuilds) {\n if ((await applyPins(tree, path, pins)).skipped) {\n skipped.push(path);\n }\n }\n return skipped;\n};\n\n/**\n * Sync the vended versions baked into generated file bodies: `Dockerfile` pins,\n * the Python pins in Terraform inline scripts, the tooling `project.json` target\n * commands run, and the Maven coordinates a `smithy-build.json` resolves.\n *\n * Reports only the files left for the user: a pin that takes effect the next time\n * the thing holding it runs needs no follow-up, but one this skipped for holding\n * more occurrences than it will rewrite at once does.\n *\n * @returns paths whose pins were left as they were\n */\nexport const syncEmbeddedVersions = async (\n tree: Tree,\n owned: OwnedDependencies,\n): Promise<string[]> => [\n ...(await syncDockerfiles(tree, owned)),\n ...(await syncTerraformScriptPins(tree, owned)),\n ...(await syncTargetToolPins(tree)),\n ...(await syncSmithyMavenPins(tree)),\n];\n"],"names":["getProjects","joinPathFragments","visitNotIgnoredFiles","SMITHY_PROJECT_GENERATOR_INFO","applyGritQL","BASE_IMAGES","CONTAINER_REPOSITORIES","CONTAINER_VERSIONS","JAVA_ARTIFACTS","JAVA_VERSIONS","MISE_VERSIONS","PY_VERSIONS","TS_VERSIONS","ownedForFile","isVendedUpgrade","escapeRegExp","value","replace","VERSION_TERMINATORS","rewriteCapture","pattern","vended","declaredVersions","contents","matches","matchAll","RegExp","flatMap","match","MAX_OCCURRENCES_PER_PIN","applyPins","tree","path","pins","read","changed","skipped","kind","declared","length","outOfDate","tag","version","every","vendedTsVersion","name","vendedPyVersion","DOCKERFILE_PIN_SHAPES","dockerfilePins","owned","ts","shape","push","image","Object","values","repository","splitImageReference","at","lastIndexOf","slice","isDockerfile","filePath","split","pop","endsWith","syncDockerfiles","dockerfiles","result","terraformScriptPins","py","syncTerraformScriptPins","terraformFiles","UVX_PIN_SHAPES","syncTargetToolPins","projectJsons","entries","map","tool","smithy","mise","keys","syncSmithyMavenPins","isGeneratedSmithyProject","project","metadata","generator","id","smithyBuilds","root","exists","artifact","syncEmbeddedVersions"],"mappings":"AAAA;;;CAGC,GAED,SACEA,WAAW,EACXC,iBAAiB,EACjBC,oBAAoB,QACf,aAAa;AACpB,SAASC,6BAA6B,QAAQ,oCAAiC;AAC/E,SAASC,WAAW,QAAQ,YAAS;AACrC,SACEC,WAAW,EACXC,sBAAsB,EACtBC,kBAAkB,EAClBC,cAAc,EACdC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,WAAW,QACN,iBAAc;AACrB,SAAiCC,YAAY,QAAQ,0BAAuB;AAC5E,SAASC,eAAe,QAAQ,sBAAmB;AAiCnD,qEAAqE,GACrE,MAAMC,eAAe,CAACC,QACpBA,MAAMC,OAAO,CAAC,uBAAuB;AAEvC;;;;;;CAMC,GACD,MAAMC,sBAAsB;AAE5B;;;;;;;CAOC,GACD,MAAMC,iBAAiB,CAACC,SAAiBC,SACvC,CAAC,WAAW,EAAED,QAAQ,2CAA2C,EAAEC,OAAO,IAAI,CAAC;AAEjF;;;;;CAKC,GACD,MAAMC,mBAAmB,CAACC,UAAkBH;IAC1C,MAAMI,UAAUD,SAASE,QAAQ,CAAC,IAAIC,OAAON,SAAS;IACtD,OAAO;WAAII;KAAQ,CAACG,OAAO,CAAC,CAACC,QAAWA,KAAK,CAAC,EAAE,GAAG;YAACA,KAAK,CAAC,EAAE;SAAC,GAAG,EAAE;AACpE;AAEA;;;;;;;;CAQC,GACD,M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MC,eAAyB,EAAE;IACjC,KAAK,MAAM,GAAGJ,QAAQ,IAAIpF,YAAY+B,MAAO;QAC3C,IAAI,CAACoD,yBAAyBC,UAAU;YACtC;QACF;QACA,MAAMpD,OAAO/B,kBAAkBmF,QAAQK,IAAI,EAAE;QAC7C,IAAI1D,KAAK2D,MAAM,CAAC1D,OAAO;YACrBwD,aAAapC,IAAI,CAACpB;QACpB;IACF;IAEA,MAAMC,OAAsBzB,eAAeqE,GAAG,CAAC,CAACc,WAAc,CAAA;YAC5D,mEAAmE;YACnEvE,SAAS,GAAGL,aAAa4E,UAAU,IAAI,EAAEzE,oBAAoB,IAAI,CAAC;YAClEG,QAAQZ,aAAa,CAACkF,SAAS;QACjC,CAAA;IAEA,MAAMvD,UAAoB,EAAE;IAC5B,KAAK,MAAMJ,QAAQwD,aAAc;QAC/B,IAAI,AAAC,CAAA,MAAM1D,UAAUC,MAAMC,MAAMC,KAAI,EAAGG,OAAO,EAAE;YAC/CA,QAAQgB,IAAI,CAACpB;QACf;IACF;IACA,OAAOI;AACT;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAMwD,uBAAuB,OAClC7D,MACAkB,QACsB;WAClB,MAAMiB,gBAAgBnC,MAAMkB;WAC5B,MAAMsB,wBAAwBxC,MAAMkB;WACpC,MAAMyB,mBAAmB3C;WACzB,MAAMmD,oBAAoBnD;KAC/B,CAAC"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export declare const TS_VERSIONS: {
|
|
|
93
93
|
readonly 'class-variance-authority': "0.7.1";
|
|
94
94
|
readonly clsx: "2.1.1";
|
|
95
95
|
readonly commander: "15.0.0";
|
|
96
|
+
readonly 'cpy-cli': "7.0.0";
|
|
96
97
|
readonly electrodb: "3.9.1";
|
|
97
98
|
readonly esbuild: "0.28.1";
|
|
98
99
|
readonly 'event-source-polyfill': "1.0.31";
|
|
@@ -110,6 +111,7 @@ export declare const TS_VERSIONS: {
|
|
|
110
111
|
readonly '@types/fs-extra': "11.0.4";
|
|
111
112
|
readonly 'make-dir-cli': "4.0.0";
|
|
112
113
|
readonly mariadb: "3.5.3";
|
|
114
|
+
readonly mise: "2026.8.3";
|
|
113
115
|
readonly ncp: "2.0.0";
|
|
114
116
|
readonly npm: "12.0.2";
|
|
115
117
|
readonly 'npm-check-updates': "22.2.9";
|
|
@@ -122,7 +124,6 @@ export declare const TS_VERSIONS: {
|
|
|
122
124
|
readonly rimraf: "6.1.3";
|
|
123
125
|
readonly rolldown: "1.2.2";
|
|
124
126
|
readonly 'rolldown-plugin-dts': "0.28.0";
|
|
125
|
-
readonly '@rollup/plugin-esm-shim': "0.1.8";
|
|
126
127
|
readonly 'simple-git': "3.36.0";
|
|
127
128
|
readonly 'source-map-support': "0.5.21";
|
|
128
129
|
readonly 'starlight-blog': "0.28.0";
|
|
@@ -210,6 +211,37 @@ export declare const withPyVersions: <D extends DependencyDeclaration>(declarati
|
|
|
210
211
|
export declare const VENDORED_VERSIONS: {
|
|
211
212
|
readonly 'git-secrets': "1.3.0";
|
|
212
213
|
};
|
|
214
|
+
/**
|
|
215
|
+
* Versions of Java dependencies added by generators, keyed by Maven coordinate.
|
|
216
|
+
*
|
|
217
|
+
* Every entry is resolved from Maven Central by the version update and named
|
|
218
|
+
* `<group>:<artifact>:<version>` where a generator writes it.
|
|
219
|
+
*/
|
|
220
|
+
export declare const JAVA_VERSIONS: {
|
|
221
|
+
readonly 'software.amazon.smithy:smithy-model': "1.72.1";
|
|
222
|
+
readonly 'software.amazon.smithy:smithy-aws-traits': "1.72.1";
|
|
223
|
+
readonly 'software.amazon.smithy:smithy-validation-model': "1.72.1";
|
|
224
|
+
readonly 'software.amazon.smithy:smithy-openapi': "1.72.1";
|
|
225
|
+
readonly 'software.amazon.smithy.typescript:smithy-aws-typescript-codegen': "0.50.0";
|
|
226
|
+
};
|
|
227
|
+
export type IJavaVersion = keyof typeof JAVA_VERSIONS;
|
|
228
|
+
/** The Maven coordinates the version update resolves, in declaration order. */
|
|
229
|
+
export declare const JAVA_ARTIFACTS: IJavaVersion[];
|
|
230
|
+
/** A Maven coordinate as a dependency names it: `<group>:<artifact>:<version>`. */
|
|
231
|
+
export declare const javaMavenDependency: (artifact: IJavaVersion) => string;
|
|
232
|
+
/**
|
|
233
|
+
* Versions of tools resolved by mise, keyed by the tool name mise knows.
|
|
234
|
+
*
|
|
235
|
+
* Every entry is checked with `mise latest <tool>` by the version update. Nothing
|
|
236
|
+
* is installed into the workspace: the pin travels in the `project.json` target
|
|
237
|
+
* command, which is what the version sync reaches to move it forward.
|
|
238
|
+
*/
|
|
239
|
+
export declare const MISE_VERSIONS: {
|
|
240
|
+
readonly smithy: "1.72.1";
|
|
241
|
+
};
|
|
242
|
+
export type IMiseVersion = keyof typeof MISE_VERSIONS;
|
|
243
|
+
/** The tools the version update resolves through mise, in declaration order. */
|
|
244
|
+
export declare const MISE_TOOLS: IMiseVersion[];
|
|
213
245
|
/**
|
|
214
246
|
* Base container images used by generated Dockerfiles. Pinned exactly so
|
|
215
247
|
* generated images are reproducible, and chosen to be free of known
|
package/src/utils/versions.js
CHANGED
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
'class-variance-authority': '0.7.1',
|
|
100
100
|
clsx: '2.1.1',
|
|
101
101
|
commander: '15.0.0',
|
|
102
|
+
'cpy-cli': '7.0.0',
|
|
102
103
|
electrodb: '3.9.1',
|
|
103
104
|
esbuild: '0.28.1',
|
|
104
105
|
'event-source-polyfill': '1.0.31',
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
'@types/fs-extra': '11.0.4',
|
|
117
118
|
'make-dir-cli': '4.0.0',
|
|
118
119
|
mariadb: '3.5.3',
|
|
120
|
+
mise: '2026.8.3',
|
|
119
121
|
ncp: '2.0.0',
|
|
120
122
|
npm: '12.0.2',
|
|
121
123
|
'npm-check-updates': '22.2.9',
|
|
@@ -128,7 +130,6 @@
|
|
|
128
130
|
rimraf: '6.1.3',
|
|
129
131
|
rolldown: '1.2.2',
|
|
130
132
|
'rolldown-plugin-dts': '0.28.0',
|
|
131
|
-
'@rollup/plugin-esm-shim': '0.1.8',
|
|
132
133
|
'simple-git': '3.36.0',
|
|
133
134
|
'source-map-support': '0.5.21',
|
|
134
135
|
'starlight-blog': '0.28.0',
|
|
@@ -235,6 +236,30 @@
|
|
|
235
236
|
*/ export const VENDORED_VERSIONS = {
|
|
236
237
|
'git-secrets': '1.3.0'
|
|
237
238
|
};
|
|
239
|
+
/**
|
|
240
|
+
* Versions of Java dependencies added by generators, keyed by Maven coordinate.
|
|
241
|
+
*
|
|
242
|
+
* Every entry is resolved from Maven Central by the version update and named
|
|
243
|
+
* `<group>:<artifact>:<version>` where a generator writes it.
|
|
244
|
+
*/ export const JAVA_VERSIONS = {
|
|
245
|
+
'software.amazon.smithy:smithy-model': '1.72.1',
|
|
246
|
+
'software.amazon.smithy:smithy-aws-traits': '1.72.1',
|
|
247
|
+
'software.amazon.smithy:smithy-validation-model': '1.72.1',
|
|
248
|
+
'software.amazon.smithy:smithy-openapi': '1.72.1',
|
|
249
|
+
'software.amazon.smithy.typescript:smithy-aws-typescript-codegen': '0.50.0'
|
|
250
|
+
};
|
|
251
|
+
/** The Maven coordinates the version update resolves, in declaration order. */ export const JAVA_ARTIFACTS = Object.keys(JAVA_VERSIONS);
|
|
252
|
+
/** A Maven coordinate as a dependency names it: `<group>:<artifact>:<version>`. */ export const javaMavenDependency = (artifact)=>`${artifact}:${JAVA_VERSIONS[artifact]}`;
|
|
253
|
+
/**
|
|
254
|
+
* Versions of tools resolved by mise, keyed by the tool name mise knows.
|
|
255
|
+
*
|
|
256
|
+
* Every entry is checked with `mise latest <tool>` by the version update. Nothing
|
|
257
|
+
* is installed into the workspace: the pin travels in the `project.json` target
|
|
258
|
+
* command, which is what the version sync reaches to move it forward.
|
|
259
|
+
*/ export const MISE_VERSIONS = {
|
|
260
|
+
smithy: '1.72.1'
|
|
261
|
+
};
|
|
262
|
+
/** The tools the version update resolves through mise, in declaration order. */ export const MISE_TOOLS = Object.keys(MISE_VERSIONS);
|
|
238
263
|
/**
|
|
239
264
|
* Base container images used by generated Dockerfiles. Pinned exactly so
|
|
240
265
|
* generated images are reproducible, and chosen to be free of known
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type DeclaredPy,\n type DeclaredTs,\n type DependencyDeclaration,\n declaredNames,\n} from './declared-dependencies';\n\n/**\n * Versons for TypeScript dependencies added by generators\n */\nexport const TS_VERSIONS = {\n '@a2a-js/sdk': '0.3.14',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n // Pinned above the version the ADOT autoinstrumentation package resolves\n // transitively (2.8.0) to clear CVE-2026-59892 (HIGH).\n '@opentelemetry/propagator-jaeger': '2.10.0',\n // Overridden in the vended agent/MCP image builds to clear CVE-2026-14257\n // (HIGH) in brace-expansion: minimatch 10 is the lowest major depending on\n // brace-expansion 5.x, the only line Trivy's `< 5.0.8` advisory range treats\n // as fixed. Overriding brace-expansion directly is not viable — 5.x drops the\n // CommonJS default export that minimatch 9 calls.\n minimatch: '10.2.6',\n '@aws-sdk/client-dynamodb': '3.1101.0',\n '@aws-sdk/client-api-gateway': '3.1101.0',\n '@aws-sdk/client-iam': '3.1101.0',\n '@aws-sdk/client-bedrock-agentcore': '3.1101.0',\n '@aws-sdk/client-bedrock-runtime': '3.1101.0',\n '@aws-sdk/client-s3': '3.1101.0',\n '@aws-sdk/client-sts': '3.1101.0',\n '@aws-sdk/credential-providers': '3.1101.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.64',\n '@aws-sdk/client-secrets-manager': '3.1101.0',\n '@aws-sdk/rds-signer': '3.1101.0',\n '@aws-smithy/server-apigateway': '1.0.0-alpha.10',\n '@aws-smithy/server-node': '1.0.0-alpha.10',\n '@aws-lambda-powertools/logger': '2.34.0',\n '@aws-lambda-powertools/metrics': '2.34.0',\n '@aws-lambda-powertools/parameters': '2.34.0',\n '@aws-lambda-powertools/tracer': '2.34.0',\n '@aws-lambda-powertools/parser': '2.34.0',\n '@aws-sdk/client-appconfigdata': '3.1101.0',\n '@middy/core': '7.7.2',\n '@nxlv/python': '22.2.2',\n '@nx-extend/terraform': '10.3.0',\n // These must all hold the same version — see NX_PACKAGES.\n nx: '23.1.1',\n '@nx/devkit': '23.1.1',\n '@nx/js': '23.1.1',\n '@nx/react': '23.1.1',\n '@nx/vite': '23.1.1',\n '@nx/vitest': '23.1.1',\n '@nx/workspace': '23.1.1',\n 'create-nx-workspace': '23.1.1',\n '@swc-node/register': '1.12.1',\n '@swc/core': '1.15.47',\n '@modelcontextprotocol/sdk': '1.30.0',\n '@modelcontextprotocol/inspector': '0.22.0',\n '@ag-ui/a2ui-toolkit': '0.0.4',\n '@ag-ui/aws-strands': '0.2.3',\n '@ag-ui/client': '0.0.57',\n '@ag-ui/core': '0.0.57',\n '@ag-ui/encoder': '0.0.57',\n 'agent-chat-cli': '0.3.0',\n '@copilotkit/react-core': '1.65.0',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.11.2',\n '@tanstack/react-router': '1.170.18',\n '@tanstack/router-plugin': '1.168.23',\n '@tanstack/router-generator': '1.167.21',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.212',\n '@cloudscape-design/chat-components': '1.0.156',\n '@cloudscape-design/components': '3.0.1340',\n '@cloudscape-design/global-styles': '1.0.65',\n '@tanstack/react-query': '5.101.4',\n '@tanstack/react-query-devtools': '5.101.4',\n '@trpc/tanstack-react-query': '11.18.0',\n '@trpc/client': '11.18.0',\n '@trpc/server': '11.18.0',\n '@types/node': '26.1.2',\n '@types/aws-lambda': '8.10.162',\n '@types/cors': '2.8.19',\n '@types/pg': '8.20.3',\n '@types/ws': '8.18.1',\n '@types/express': '5.0.6',\n '@smithy/config-resolver': '4.6.16',\n '@smithy/node-config-provider': '4.5.16',\n '@smithy/node-http-handler': '4.9.13',\n '@smithy/types': '4.16.1',\n '@vitest/coverage-v8': '4.1.10',\n '@vitest/ui': '4.1.10',\n '@astrojs/react': '6.0.2',\n '@astrojs/starlight': '0.41.3',\n astro: '7.1.1',\n aws4fetch: '1.0.20',\n 'aws-cdk': '2.1135.0',\n 'aws-cdk-lib': '2.263.0',\n 'aws-xray-sdk-core': '3.12.0',\n constructs: '10.8.0',\n cors: '2.8.6',\n chalk: '5.6.2',\n 'class-variance-authority': '0.7.1',\n clsx: '2.1.1',\n commander: '15.0.0',\n electrodb: '3.9.1',\n esbuild: '0.28.1',\n 'event-source-polyfill': '1.0.31',\n '@types/event-source-polyfill': '1.0.5',\n '@biomejs/biome': '2.5.6',\n '@prisma/adapter-mariadb': '7.9.1',\n '@prisma/adapter-pg': '7.9.1',\n '@prisma/client': '7.9.1',\n ejs: '6.0.1',\n '@types/ejs': '3.1.5',\n express: '5.2.1',\n 'fast-glob': '3.3.3',\n husky: '9.1.7',\n 'fs-extra': '11.4.0',\n '@types/fs-extra': '11.0.4',\n 'make-dir-cli': '4.0.0',\n mariadb: '3.5.3',\n ncp: '2.0.0',\n npm: '12.0.2',\n 'npm-check-updates': '22.2.9',\n 'oidc-client-ts': '3.5.0',\n pg: '8.22.0',\n prisma: '7.9.1',\n 'react-oidc-context': '3.3.1',\n react: '19.2.8',\n 'react-dom': '19.2.8',\n rimraf: '6.1.3',\n rolldown: '1.2.2',\n 'rolldown-plugin-dts': '0.28.0',\n '@rollup/plugin-esm-shim': '0.1.8',\n 'simple-git': '3.36.0',\n 'source-map-support': '0.5.21',\n 'starlight-blog': '0.28.0',\n tailwindcss: '4.3.3',\n '@tailwindcss/vite': '4.3.3',\n tsx: '4.23.5',\n 'lucide-react': '1.28.0',\n 'radix-ui': '1.6.7',\n shadcn: '4.16.1',\n 'tw-animate-css': '1.4.0',\n 'tailwind-merge': '3.6.0',\n vite: '8.2.0',\n typescript: '6.0.3',\n vitest: '4.1.10',\n zod: '4.4.3',\n ws: '8.21.1',\n} as const;\nexport type ITsDepVersion = keyof typeof TS_VERSIONS;\n\n/**\n * Add versions to the given dependencies, which the declaration must own.\n *\n * @param declaration the calling generator's `DEPENDENCIES`\n */\nexport const withVersions = <D extends DependencyDeclaration>(\n declaration: D,\n deps: readonly DeclaredTs<D>[],\n): Record<string, string> => {\n assertDeclared(declaration.ts, deps, 'ts');\n return Object.fromEntries(\n deps.map((dep) => [dep, TS_VERSIONS[dep as ITsDepVersion]]),\n );\n};\n\n/**\n * The `nx` and `@nx/*` packages a generated workspace pins, all of which must\n * hold the same version: a workspace nx even a patch apart hoists a second\n * nested nx, and the two deadlock `nx sync`.\n *\n * Bumping them in a user's workspace requires `packageJsonUpdates` rather than a\n * migration — see `version-upgrade-migration/nx-package-updates.ts`.\n */\nexport const NX_PACKAGES = [\n 'nx',\n '@nx/devkit',\n '@nx/js',\n '@nx/react',\n '@nx/vite',\n '@nx/vitest',\n '@nx/workspace',\n] as const satisfies readonly ITsDepVersion[];\n\n/**\n * The nx version the plugin is built against, and the single source of truth\n * for every place a workspace's nx is pinned.\n */\nexport const NX_VERSION = TS_VERSIONS.nx;\n\n/**\n * Versions for Python dependencies added by generators\n */\nexport const PY_VERSIONS = {\n 'a2a-sdk': '==0.3.26',\n 'ag-ui-langgraph': '==0.0.42',\n 'ag-ui-protocol': '==0.1.19',\n 'ag-ui-strands': '==0.2.4',\n 'aws-lambda-powertools': '==3.31.1',\n 'aws-lambda-powertools[tracer]': '==3.31.1',\n 'aws-lambda-powertools[parser]': '==3.31.1',\n 'aws-opentelemetry-distro': '==0.19.0',\n 'bedrock-agentcore': '==1.19.0',\n boto3: '==1.43.63',\n checkov: '==3.3.9',\n fastapi: '==0.141.1',\n 'fastapi[standard]': '==0.141.1',\n httpx: '==0.28.1',\n langchain: '==1.3.14',\n 'langchain-aws': '==1.6.4',\n 'langchain-mcp-adapters': '==0.3.1',\n langgraph: '==1.2.10',\n mcp: '==1.28.1',\n 'pip-check-updates': '==0.29.0',\n 'pip-licenses': '==5.5.5',\n ruff: '==0.16.1',\n 'strands-agents': '==1.50.2',\n 'strands-agents[a2a]': '==1.50.2',\n 'strands-agents-tools': '==0.8.5',\n ty: '==0.0.66',\n pynamodb: '==6.1.0',\n uvicorn: '==0.52.1',\n sqlmodel: '==0.0.39',\n alembic: '==1.18.5',\n aiomysql: '==0.3.2',\n asyncpg: '==0.31.0',\n // Pinned explicitly: SQLAlchemy's async engine pulls greenlet transitively,\n // and leaving it unpinned lets uv resolve to a just-released version whose\n // platform wheels may not all be published yet (breaking aarch64 installs).\n greenlet: '==3.5.4',\n} as const;\nexport type IPyDepVersion = keyof typeof PY_VERSIONS;\n\n/**\n * Add versions to the given dependencies\n */\nexport const withPyVersions = <D extends DependencyDeclaration>(\n declaration: D,\n deps: readonly DeclaredPy<D>[],\n): string[] => {\n assertDeclared(declaration.py, deps, 'py');\n return deps.map((dep) => `${dep}${PY_VERSIONS[dep as IPyDepVersion]}`);\n};\n\n/** Catches undeclared packages that reach here past the type checker. */\nconst assertDeclared = (\n declared: readonly { readonly name: string }[],\n deps: readonly unknown[],\n kind: 'ts' | 'py',\n): void => {\n const names = declaredNames(declared);\n const undeclared = deps.filter((dep) => !names.includes(dep as string));\n if (undeclared.length > 0) {\n throw new Error(\n `Undeclared ${kind} dependencies: ${undeclared.join(', ')}. Add them to the generator's declareDependencies({ ${kind}: [...] }).`,\n );\n }\n};\n\n/**\n * Versions for vendored tools\n */\nexport const VENDORED_VERSIONS = {\n 'git-secrets': '1.3.0',\n} as const;\n\n/**\n * Base container images used by generated Dockerfiles. Pinned exactly so\n * generated images are reproducible, and chosen to be free of known\n * HIGH/CRITICAL vulnerabilities at time of generation.\n */\nexport const BASE_IMAGES = {\n node: 'public.ecr.aws/docker/library/node:lts-slim',\n python: 'public.ecr.aws/docker/library/python:3.14-slim',\n} as const;\n\n/**\n * Versions for container tooling used by generated image build/scan targets.\n * Pinned exactly so generated images are reproducible.\n */\nexport const CONTAINER_VERSIONS = {\n // ECR-hosted Trivy image used to scan built images during the build.\n trivy: '0.72.0',\n} as const;\n\n/**\n * Repository each pinned tool image is pulled from, keyed as\n * {@link CONTAINER_VERSIONS}. Kept beside the versions so a tool added here is\n * one entry rather than a reference built somewhere else, which is also what\n * lets the version sync find these pins wherever a target command runs them.\n */\nexport const CONTAINER_REPOSITORIES = {\n trivy: 'public.ecr.aws/aquasecurity/trivy',\n} as const satisfies Record<keyof typeof CONTAINER_VERSIONS, string>;\n\n/** The pinned reference for a tool image, as a target command runs it. */\nexport const containerImage = (tool: keyof typeof CONTAINER_VERSIONS): string =>\n `${CONTAINER_REPOSITORIES[tool]}:${CONTAINER_VERSIONS[tool]}`;\n\n/**\n * Exact versions for Terraform providers used by generated `.tf` modules.\n * Pinned exactly (no range operator) so generated infrastructure is reproducible.\n */\nexport const TERRAFORM_VERSIONS = {\n aws: '6.57.1',\n random: '3.9.0',\n null: '3.3.0',\n archive: '2.8.0',\n external: '2.4.0',\n local: '2.9.0',\n time: '0.14.0',\n} as const;\nexport type ITerraformProviderVersion = keyof typeof TERRAFORM_VERSIONS;\n\n/**\n * Substitution variables exposing Terraform provider version constraints to\n * generated `.tf` templates (e.g. `version = \"<%- awsProviderVersion %>\"`)\n */\nexport const terraformProviderVersions = () => ({\n awsProviderVersion: TERRAFORM_VERSIONS.aws,\n randomProviderVersion: TERRAFORM_VERSIONS.random,\n nullProviderVersion: TERRAFORM_VERSIONS.null,\n archiveProviderVersion: TERRAFORM_VERSIONS.archive,\n externalProviderVersion: TERRAFORM_VERSIONS.external,\n localProviderVersion: TERRAFORM_VERSIONS.local,\n timeProviderVersion: TERRAFORM_VERSIONS.time,\n});\n"],"names":["declaredNames","TS_VERSIONS","minimatch","nx","rxjs","astro","aws4fetch","constructs","cors","chalk","clsx","commander","electrodb","esbuild","ejs","express","husky","mariadb","ncp","npm","pg","prisma","react","rimraf","rolldown","tailwindcss","tsx","shadcn","vite","typescript","vitest","zod","ws","withVersions","declaration","deps","assertDeclared","ts","Object","fromEntries","map","dep","NX_PACKAGES","NX_VERSION","PY_VERSIONS","boto3","checkov","fastapi","httpx","langchain","langgraph","mcp","ruff","ty","pynamodb","uvicorn","sqlmodel","alembic","aiomysql","asyncpg","greenlet","withPyVersions","py","declared","kind","names","undeclared","filter","includes","length","Error","join","VENDORED_VERSIONS","BASE_IMAGES","node","python","CONTAINER_VERSIONS","trivy","CONTAINER_REPOSITORIES","containerImage","tool","TERRAFORM_VERSIONS","aws","random","null","archive","external","local","time","terraformProviderVersions","awsProviderVersion","randomProviderVersion","nullProviderVersion","archiveProviderVersion","externalProviderVersion","localProviderVersion","timeProviderVersion"],"mappings":"AAAA;;;CAGC,GACD,SAIEA,aAAa,QACR,6BAA0B;AAEjC;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,eAAe;IACf,0DAA0D;IAC1D,yEAAyE;IACzE,uDAAuD;IACvD,oCAAoC;IACpC,0EAA0E;IAC1E,2EAA2E;IAC3E,6EAA6E;IAC7E,8EAA8E;IAC9E,kDAAkD;IAClDC,WAAW;IACX,4BAA4B;IAC5B,+BAA+B;IAC/B,uBAAuB;IACvB,qCAAqC;IACrC,mCAAmC;IACnC,sBAAsB;IACtB,uBAAuB;IACvB,iCAAiC;IACjC,iDAAiD;IACjD,mCAAmC;IACnC,uBAAuB;IACvB,iCAAiC;IACjC,2BAA2B;IAC3B,iCAAiC;IACjC,kCAAkC;IAClC,qCAAqC;IACrC,iCAAiC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,eAAe;IACf,gBAAgB;IAChB,wBAAwB;IACxB,0DAA0D;IAC1DC,IAAI;IACJ,cAAc;IACd,UAAU;IACV,aAAa;IACb,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,aAAa;IACb,6BAA6B;IAC7B,mCAAmC;IACnC,uBAAuB;IACvB,sBAAsB;IACtB,iBAAiB;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,MAAQ,CAACwB,MAAMG,QAAQ,CAAC3B;IACxD,IAAIyB,WAAWG,MAAM,GAAG,GAAG;QACzB,MAAM,IAAIC,MACR,CAAC,WAAW,EAAEN,KAAK,eAAe,EAAEE,WAAWK,IAAI,CAAC,MAAM,oDAAoD,EAAEP,KAAK,WAAW,CAAC;IAErI;AACF;AAEA;;CAEC,GACD,OAAO,MAAMQ,oBAAoB;IAC/B,eAAe;AACjB,EAAW;AAEX;;;;CAIC,GACD,OAAO,MAAMC,cAAc;IACzBC,MAAM;IACNC,QAAQ;AACV,EAAW;AAEX;;;CAGC,GACD,OAAO,MAAMC,qBAAqB;IAChC,qEAAqE;IACrEC,OAAO;AACT,EAAW;AAEX;;;;;CAKC,GACD,OAAO,MAAMC,yBAAyB;IACpCD,OAAO;AACT,EAAqE;AAErE,wEAAwE,GACxE,OAAO,MAAME,iBAAiB,CAACC,OAC7B,GAAGF,sBAAsB,CAACE,KAAK,CAAC,CAAC,EAAEJ,kBAAkB,CAACI,KAAK,EAAE,CAAC;AAEhE;;;CAGC,GACD,OAAO,MAAMC,qBAAqB;IAChCC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,MAAM;AACR,EAAW;AAGX;;;CAGC,GACD,OAAO,MAAMC,4BAA4B,IAAO,CAAA;QAC9CC,oBAAoBT,mBAAmBC,GAAG;QAC1CS,uBAAuBV,mBAAmBE,MAAM;QAChDS,qBAAqBX,mBAAmBG,IAAI;QAC5CS,wBAAwBZ,mBAAmBI,OAAO;QAClDS,yBAAyBb,mBAAmBK,QAAQ;QACpDS,sBAAsBd,mBAAmBM,KAAK;QAC9CS,qBAAqBf,mBAAmBO,IAAI;IAC9C,CAAA,EAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type DeclaredPy,\n type DeclaredTs,\n type DependencyDeclaration,\n declaredNames,\n} from './declared-dependencies';\n\n/**\n * Versons for TypeScript dependencies added by generators\n */\nexport const TS_VERSIONS = {\n '@a2a-js/sdk': '0.3.14',\n '@aws/aws-distro-opentelemetry-node-autoinstrumentation': '0.12.0',\n // Pinned above the version the ADOT autoinstrumentation package resolves\n // transitively (2.8.0) to clear CVE-2026-59892 (HIGH).\n '@opentelemetry/propagator-jaeger': '2.10.0',\n // Overridden in the vended agent/MCP image builds to clear CVE-2026-14257\n // (HIGH) in brace-expansion: minimatch 10 is the lowest major depending on\n // brace-expansion 5.x, the only line Trivy's `< 5.0.8` advisory range treats\n // as fixed. Overriding brace-expansion directly is not viable — 5.x drops the\n // CommonJS default export that minimatch 9 calls.\n minimatch: '10.2.6',\n '@aws-sdk/client-dynamodb': '3.1101.0',\n '@aws-sdk/client-api-gateway': '3.1101.0',\n '@aws-sdk/client-iam': '3.1101.0',\n '@aws-sdk/client-bedrock-agentcore': '3.1101.0',\n '@aws-sdk/client-bedrock-runtime': '3.1101.0',\n '@aws-sdk/client-s3': '3.1101.0',\n '@aws-sdk/client-sts': '3.1101.0',\n '@aws-sdk/credential-providers': '3.1101.0',\n '@aws-sdk/credential-provider-cognito-identity': '3.972.64',\n '@aws-sdk/client-secrets-manager': '3.1101.0',\n '@aws-sdk/rds-signer': '3.1101.0',\n '@aws-smithy/server-apigateway': '1.0.0-alpha.10',\n '@aws-smithy/server-node': '1.0.0-alpha.10',\n '@aws-lambda-powertools/logger': '2.34.0',\n '@aws-lambda-powertools/metrics': '2.34.0',\n '@aws-lambda-powertools/parameters': '2.34.0',\n '@aws-lambda-powertools/tracer': '2.34.0',\n '@aws-lambda-powertools/parser': '2.34.0',\n '@aws-sdk/client-appconfigdata': '3.1101.0',\n '@middy/core': '7.7.2',\n '@nxlv/python': '22.2.2',\n '@nx-extend/terraform': '10.3.0',\n // These must all hold the same version — see NX_PACKAGES.\n nx: '23.1.1',\n '@nx/devkit': '23.1.1',\n '@nx/js': '23.1.1',\n '@nx/react': '23.1.1',\n '@nx/vite': '23.1.1',\n '@nx/vitest': '23.1.1',\n '@nx/workspace': '23.1.1',\n 'create-nx-workspace': '23.1.1',\n '@swc-node/register': '1.12.1',\n '@swc/core': '1.15.47',\n '@modelcontextprotocol/sdk': '1.30.0',\n '@modelcontextprotocol/inspector': '0.22.0',\n '@ag-ui/a2ui-toolkit': '0.0.4',\n '@ag-ui/aws-strands': '0.2.3',\n '@ag-ui/client': '0.0.57',\n '@ag-ui/core': '0.0.57',\n '@ag-ui/encoder': '0.0.57',\n 'agent-chat-cli': '0.3.0',\n '@copilotkit/react-core': '1.65.0',\n rxjs: '7.8.2',\n '@strands-agents/sdk': '1.11.2',\n '@tanstack/react-router': '1.170.18',\n '@tanstack/router-plugin': '1.168.23',\n '@tanstack/router-generator': '1.167.21',\n '@tanstack/virtual-file-routes': '1.162.0',\n '@tanstack/router-utils': '1.162.2',\n '@cloudscape-design/board-components': '3.0.212',\n '@cloudscape-design/chat-components': '1.0.156',\n '@cloudscape-design/components': '3.0.1340',\n '@cloudscape-design/global-styles': '1.0.65',\n '@tanstack/react-query': '5.101.4',\n '@tanstack/react-query-devtools': '5.101.4',\n '@trpc/tanstack-react-query': '11.18.0',\n '@trpc/client': '11.18.0',\n '@trpc/server': '11.18.0',\n '@types/node': '26.1.2',\n '@types/aws-lambda': '8.10.162',\n '@types/cors': '2.8.19',\n '@types/pg': '8.20.3',\n '@types/ws': '8.18.1',\n '@types/express': '5.0.6',\n '@smithy/config-resolver': '4.6.16',\n '@smithy/node-config-provider': '4.5.16',\n '@smithy/node-http-handler': '4.9.13',\n '@smithy/types': '4.16.1',\n '@vitest/coverage-v8': '4.1.10',\n '@vitest/ui': '4.1.10',\n '@astrojs/react': '6.0.2',\n '@astrojs/starlight': '0.41.3',\n astro: '7.1.1',\n aws4fetch: '1.0.20',\n 'aws-cdk': '2.1135.0',\n 'aws-cdk-lib': '2.263.0',\n 'aws-xray-sdk-core': '3.12.0',\n constructs: '10.8.0',\n cors: '2.8.6',\n chalk: '5.6.2',\n 'class-variance-authority': '0.7.1',\n clsx: '2.1.1',\n commander: '15.0.0',\n 'cpy-cli': '7.0.0',\n electrodb: '3.9.1',\n esbuild: '0.28.1',\n 'event-source-polyfill': '1.0.31',\n '@types/event-source-polyfill': '1.0.5',\n '@biomejs/biome': '2.5.6',\n '@prisma/adapter-mariadb': '7.9.1',\n '@prisma/adapter-pg': '7.9.1',\n '@prisma/client': '7.9.1',\n ejs: '6.0.1',\n '@types/ejs': '3.1.5',\n express: '5.2.1',\n 'fast-glob': '3.3.3',\n husky: '9.1.7',\n 'fs-extra': '11.4.0',\n '@types/fs-extra': '11.0.4',\n 'make-dir-cli': '4.0.0',\n mariadb: '3.5.3',\n mise: '2026.8.3',\n ncp: '2.0.0',\n npm: '12.0.2',\n 'npm-check-updates': '22.2.9',\n 'oidc-client-ts': '3.5.0',\n pg: '8.22.0',\n prisma: '7.9.1',\n 'react-oidc-context': '3.3.1',\n react: '19.2.8',\n 'react-dom': '19.2.8',\n rimraf: '6.1.3',\n rolldown: '1.2.2',\n 'rolldown-plugin-dts': '0.28.0',\n 'simple-git': '3.36.0',\n 'source-map-support': '0.5.21',\n 'starlight-blog': '0.28.0',\n tailwindcss: '4.3.3',\n '@tailwindcss/vite': '4.3.3',\n tsx: '4.23.5',\n 'lucide-react': '1.28.0',\n 'radix-ui': '1.6.7',\n shadcn: '4.16.1',\n 'tw-animate-css': '1.4.0',\n 'tailwind-merge': '3.6.0',\n vite: '8.2.0',\n typescript: '6.0.3',\n vitest: '4.1.10',\n zod: '4.4.3',\n ws: '8.21.1',\n} as const;\nexport type ITsDepVersion = keyof typeof TS_VERSIONS;\n\n/**\n * Add versions to the given dependencies, which the declaration must own.\n *\n * @param declaration the calling generator's `DEPENDENCIES`\n */\nexport const withVersions = <D extends DependencyDeclaration>(\n declaration: D,\n deps: readonly DeclaredTs<D>[],\n): Record<string, string> => {\n assertDeclared(declaration.ts, deps, 'ts');\n return Object.fromEntries(\n deps.map((dep) => [dep, TS_VERSIONS[dep as ITsDepVersion]]),\n );\n};\n\n/**\n * The `nx` and `@nx/*` packages a generated workspace pins, all of which must\n * hold the same version: a workspace nx even a patch apart hoists a second\n * nested nx, and the two deadlock `nx sync`.\n *\n * Bumping them in a user's workspace requires `packageJsonUpdates` rather than a\n * migration — see `version-upgrade-migration/nx-package-updates.ts`.\n */\nexport const NX_PACKAGES = [\n 'nx',\n '@nx/devkit',\n '@nx/js',\n '@nx/react',\n '@nx/vite',\n '@nx/vitest',\n '@nx/workspace',\n] as const satisfies readonly ITsDepVersion[];\n\n/**\n * The nx version the plugin is built against, and the single source of truth\n * for every place a workspace's nx is pinned.\n */\nexport const NX_VERSION = TS_VERSIONS.nx;\n\n/**\n * Versions for Python dependencies added by generators\n */\nexport const PY_VERSIONS = {\n 'a2a-sdk': '==0.3.26',\n 'ag-ui-langgraph': '==0.0.42',\n 'ag-ui-protocol': '==0.1.19',\n 'ag-ui-strands': '==0.2.4',\n 'aws-lambda-powertools': '==3.31.1',\n 'aws-lambda-powertools[tracer]': '==3.31.1',\n 'aws-lambda-powertools[parser]': '==3.31.1',\n 'aws-opentelemetry-distro': '==0.19.0',\n 'bedrock-agentcore': '==1.19.0',\n boto3: '==1.43.63',\n checkov: '==3.3.9',\n fastapi: '==0.141.1',\n 'fastapi[standard]': '==0.141.1',\n httpx: '==0.28.1',\n langchain: '==1.3.14',\n 'langchain-aws': '==1.6.4',\n 'langchain-mcp-adapters': '==0.3.1',\n langgraph: '==1.2.10',\n mcp: '==1.28.1',\n 'pip-check-updates': '==0.29.0',\n 'pip-licenses': '==5.5.5',\n ruff: '==0.16.1',\n 'strands-agents': '==1.50.2',\n 'strands-agents[a2a]': '==1.50.2',\n 'strands-agents-tools': '==0.8.5',\n ty: '==0.0.66',\n pynamodb: '==6.1.0',\n uvicorn: '==0.52.1',\n sqlmodel: '==0.0.39',\n alembic: '==1.18.5',\n aiomysql: '==0.3.2',\n asyncpg: '==0.31.0',\n // Pinned explicitly: SQLAlchemy's async engine pulls greenlet transitively,\n // and leaving it unpinned lets uv resolve to a just-released version whose\n // platform wheels may not all be published yet (breaking aarch64 installs).\n greenlet: '==3.5.4',\n} as const;\nexport type IPyDepVersion = keyof typeof PY_VERSIONS;\n\n/**\n * Add versions to the given dependencies\n */\nexport const withPyVersions = <D extends DependencyDeclaration>(\n declaration: D,\n deps: readonly DeclaredPy<D>[],\n): string[] => {\n assertDeclared(declaration.py, deps, 'py');\n return deps.map((dep) => `${dep}${PY_VERSIONS[dep as IPyDepVersion]}`);\n};\n\n/** Catches undeclared packages that reach here past the type checker. */\nconst assertDeclared = (\n declared: readonly { readonly name: string }[],\n deps: readonly unknown[],\n kind: 'ts' | 'py',\n): void => {\n const names = declaredNames(declared);\n const undeclared = deps.filter((dep) => !names.includes(dep as string));\n if (undeclared.length > 0) {\n throw new Error(\n `Undeclared ${kind} dependencies: ${undeclared.join(', ')}. Add them to the generator's declareDependencies({ ${kind}: [...] }).`,\n );\n }\n};\n\n/**\n * Versions for vendored tools\n */\nexport const VENDORED_VERSIONS = {\n 'git-secrets': '1.3.0',\n} as const;\n\n/**\n * Versions of Java dependencies added by generators, keyed by Maven coordinate.\n *\n * Every entry is resolved from Maven Central by the version update and named\n * `<group>:<artifact>:<version>` where a generator writes it.\n */\nexport const JAVA_VERSIONS = {\n 'software.amazon.smithy:smithy-model': '1.72.1',\n 'software.amazon.smithy:smithy-aws-traits': '1.72.1',\n 'software.amazon.smithy:smithy-validation-model': '1.72.1',\n 'software.amazon.smithy:smithy-openapi': '1.72.1',\n 'software.amazon.smithy.typescript:smithy-aws-typescript-codegen': '0.50.0',\n} as const;\nexport type IJavaVersion = keyof typeof JAVA_VERSIONS;\n\n/** The Maven coordinates the version update resolves, in declaration order. */\nexport const JAVA_ARTIFACTS = Object.keys(JAVA_VERSIONS) as IJavaVersion[];\n\n/** A Maven coordinate as a dependency names it: `<group>:<artifact>:<version>`. */\nexport const javaMavenDependency = (artifact: IJavaVersion): string =>\n `${artifact}:${JAVA_VERSIONS[artifact]}`;\n\n/**\n * Versions of tools resolved by mise, keyed by the tool name mise knows.\n *\n * Every entry is checked with `mise latest <tool>` by the version update. Nothing\n * is installed into the workspace: the pin travels in the `project.json` target\n * command, which is what the version sync reaches to move it forward.\n */\nexport const MISE_VERSIONS = {\n smithy: '1.72.1',\n} as const;\nexport type IMiseVersion = keyof typeof MISE_VERSIONS;\n\n/** The tools the version update resolves through mise, in declaration order. */\nexport const MISE_TOOLS = Object.keys(MISE_VERSIONS) as IMiseVersion[];\n\n/**\n * Base container images used by generated Dockerfiles. Pinned exactly so\n * generated images are reproducible, and chosen to be free of known\n * HIGH/CRITICAL vulnerabilities at time of generation.\n */\nexport const BASE_IMAGES = {\n node: 'public.ecr.aws/docker/library/node:lts-slim',\n python: 'public.ecr.aws/docker/library/python:3.14-slim',\n} as const;\n\n/**\n * Versions for container tooling used by generated image build/scan targets.\n * Pinned exactly so generated images are reproducible.\n */\nexport const CONTAINER_VERSIONS = {\n // ECR-hosted Trivy image used to scan built images during the build.\n trivy: '0.72.0',\n} as const;\n\n/**\n * Repository each pinned tool image is pulled from, keyed as\n * {@link CONTAINER_VERSIONS}. Kept beside the versions so a tool added here is\n * one entry rather than a reference built somewhere else, which is also what\n * lets the version sync find these pins wherever a target command runs them.\n */\nexport const CONTAINER_REPOSITORIES = {\n trivy: 'public.ecr.aws/aquasecurity/trivy',\n} as const satisfies Record<keyof typeof CONTAINER_VERSIONS, string>;\n\n/** The pinned reference for a tool image, as a target command runs it. */\nexport const containerImage = (tool: keyof typeof CONTAINER_VERSIONS): string =>\n `${CONTAINER_REPOSITORIES[tool]}:${CONTAINER_VERSIONS[tool]}`;\n\n/**\n * Exact versions for Terraform providers used by generated `.tf` modules.\n * Pinned exactly (no range operator) so generated infrastructure is reproducible.\n */\nexport const TERRAFORM_VERSIONS = {\n aws: '6.57.1',\n random: '3.9.0',\n null: '3.3.0',\n archive: '2.8.0',\n external: '2.4.0',\n local: '2.9.0',\n time: '0.14.0',\n} as const;\nexport type ITerraformProviderVersion = keyof typeof TERRAFORM_VERSIONS;\n\n/**\n * Substitution variables exposing Terraform provider version constraints to\n * generated `.tf` templates (e.g. `version = \"<%- awsProviderVersion %>\"`)\n */\nexport const terraformProviderVersions = () => ({\n awsProviderVersion: TERRAFORM_VERSIONS.aws,\n randomProviderVersion: TERRAFORM_VERSIONS.random,\n nullProviderVersion: TERRAFORM_VERSIONS.null,\n archiveProviderVersion: TERRAFORM_VERSIONS.archive,\n externalProviderVersion: TERRAFORM_VERSIONS.external,\n localProviderVersion: TERRAFORM_VERSIONS.local,\n timeProviderVersion: TERRAFORM_VERSIONS.time,\n});\n"],"names":["declaredNames","TS_VERSIONS","minimatch","nx","rxjs","astro","aws4fetch","constructs","cors","chalk","clsx","commander","electrodb","esbuild","ejs","express","husky","mariadb","mise","ncp","npm","pg","prisma","react","rimraf","rolldown","tailwindcss","tsx","shadcn","vite","typescript","vitest","zod","ws","withVersions","declaration","deps","assertDeclared","ts","Object","fromEntries","map","dep","NX_PACKAGES","NX_VERSION","PY_VERSIONS","boto3","checkov","fastapi","httpx","langchain","langgraph","mcp","ruff","ty","pynamodb","uvicorn","sqlmodel","alembic","aiomysql","asyncpg","greenlet","withPyVersions","py","declared","kind","names","undeclared","filter","includes","length","Error","join","VENDORED_VERSIONS","JAVA_VERSIONS","JAVA_ARTIFACTS","keys","javaMavenDependency","artifact","MISE_VERSIONS","smithy","MISE_TOOLS","BASE_IMAGES","node","python","CONTAINER_VERSIONS","trivy","CONTAINER_REPOSITORIES","containerImage","tool","TERRAFORM_VERSIONS","aws","random","null","archive","external","local","time","terraformProviderVersions","awsProviderVersion","randomProviderVersion","nullProviderVersion","archiveProviderVersion","externalProviderVersion","localProviderVersion","timeProviderVersion"],"mappings":"AAAA;;;CAGC,GACD,SAIEA,aAAa,QACR,6BAA0B;AAEjC;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,eAA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S,CAAC,EAAEJ,aAAa,CAACI,SAAS,EAAE,CAAC;AAE3C;;;;;;CAMC,GACD,OAAO,MAAMC,gBAAgB;IAC3BC,QAAQ;AACV,EAAW;AAGX,8EAA8E,GAC9E,OAAO,MAAMC,aAAa1C,OAAOqC,IAAI,CAACG,eAAiC;AAEvE;;;;CAIC,GACD,OAAO,MAAMG,cAAc;IACzBC,MAAM;IACNC,QAAQ;AACV,EAAW;AAEX;;;CAGC,GACD,OAAO,MAAMC,qBAAqB;IAChC,qEAAqE;IACrEC,OAAO;AACT,EAAW;AAEX;;;;;CAKC,GACD,OAAO,MAAMC,yBAAyB;IACpCD,OAAO;AACT,EAAqE;AAErE,wEAAwE,GACxE,OAAO,MAAME,iBAAiB,CAACC,OAC7B,GAAGF,sBAAsB,CAACE,KAAK,CAAC,CAAC,EAAEJ,kBAAkB,CAACI,KAAK,EAAE,CAAC;AAEhE;;;CAGC,GACD,OAAO,MAAMC,qBAAqB;IAChCC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,MAAM;AACR,EAAW;AAGX;;;CAGC,GACD,OAAO,MAAMC,4BAA4B,IAAO,CAAA;QAC9CC,oBAAoBT,mBAAmBC,GAAG;QAC1CS,uBAAuBV,mBAAmBE,MAAM;QAChDS,qBAAqBX,mBAAmBG,IAAI;QAC5CS,wBAAwBZ,mBAAmBI,OAAO;QAClDS,yBAAyBb,mBAAmBK,QAAQ;QACpDS,sBAAsBd,mBAAmBM,KAAK;QAC9CS,qBAAqBf,mBAAmBO,IAAI;IAC9C,CAAA,EAAG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
FROM public.ecr.aws/docker/library/node:24 AS builder
|
|
2
|
-
ENV CI=true
|
|
3
|
-
|
|
4
|
-
# Output directory
|
|
5
|
-
RUN mkdir /out
|
|
6
|
-
|
|
7
|
-
# Install Smithy CLI
|
|
8
|
-
# https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
|
|
9
|
-
WORKDIR /smithy
|
|
10
|
-
ARG TARGETPLATFORM
|
|
11
|
-
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \
|
|
12
|
-
mkdir -p smithy-install/smithy && \
|
|
13
|
-
curl -L https://github.com/smithy-lang/smithy/releases/download/1.61.0/smithy-cli-linux-$ARCH.zip -o smithy-install/smithy-cli-linux-$ARCH.zip && \
|
|
14
|
-
unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \
|
|
15
|
-
mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
|
|
16
|
-
RUN smithy-install/smithy/install
|
|
17
|
-
|
|
18
|
-
# Copy project files
|
|
19
|
-
WORKDIR /project
|
|
20
|
-
COPY smithy-build.json .
|
|
21
|
-
COPY src src
|
|
22
|
-
|
|
23
|
-
# Validate the model and assemble it into a single JSON model file
|
|
24
|
-
RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \
|
|
25
|
-
smithy build
|
|
26
|
-
|
|
27
|
-
# Copy the assembled model to the output location
|
|
28
|
-
RUN mkdir -p /out/model
|
|
29
|
-
RUN cp /project/build/smithy/source/model/model.json /out/model/model.json
|
|
30
|
-
|
|
31
|
-
# Export the /out directory
|
|
32
|
-
FROM scratch AS export
|
|
33
|
-
COPY --from=builder /out /
|