@aws/nx-plugin 1.0.0-rc.87 → 1.0.0-rc.89
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/LICENSE-THIRD-PARTY +9977 -16000
- package/migrations.json +124 -76
- package/package.json +7 -7
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/migrations/latest/nx-parallel-default/metadata.json +3 -0
- package/src/migrations/latest/nx-parallel-default/migration.d.ts +14 -0
- package/src/migrations/latest/nx-parallel-default/migration.js +29 -0
- package/src/migrations/latest/nx-parallel-default/migration.js.map +1 -0
- package/src/migrations/latest/python-version-drop-exact-patch/metadata.json +3 -0
- package/src/migrations/latest/python-version-drop-exact-patch/migration.js +43 -0
- package/src/migrations/latest/python-version-drop-exact-patch/migration.js.map +1 -0
- package/src/migrations/latest/react-website-nx-react-express-override/metadata.json +3 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.d.ts +31 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.js +74 -0
- package/src/migrations/latest/react-website-nx-react-express-override/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.js.map +1 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.d.ts +6 -0
- package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +5 -4
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +5 -5
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +7 -7
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +59 -49
- package/src/ts/react-website/app/generator.d.ts +3 -0
- package/src/ts/react-website/app/generator.js +25 -1
- package/src/ts/react-website/app/generator.js.map +1 -1
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/init.d.ts +1 -0
- package/src/utils/init.js +2 -0
- package/src/utils/init.js.map +1 -1
- package/src/utils/lambda-runtime-resolution.d.ts +0 -21
- package/src/utils/lambda-runtime-resolution.js +0 -14
- package/src/utils/lambda-runtime-resolution.js.map +1 -1
- package/src/utils/version-upgrade-migration/sync-python-language-version.d.ts +2 -2
- package/src/utils/version-upgrade-migration/sync-python-language-version.js +2 -2
- package/src/utils/version-upgrade-migration/sync-python-language-version.js.map +1 -1
- package/src/utils/versions.d.ts +58 -62
- package/src/utils/versions.js +57 -60
- package/src/utils/versions.js.map +1 -1
- package/src/migrations/latest/agentcore-harness-no-tools-by-default/migration.js.map +0 -1
- package/src/migrations/latest/dynamodb-configurable-encryption/migration.js.map +0 -1
- package/src/migrations/latest/dynamodb-terraform-app-module-outputs/migration.js.map +0 -1
- package/src/migrations/latest/py-agent-ag-ui-hooks/migration.js.map +0 -1
- package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration.js.map +0 -1
- package/src/migrations/latest/runtime-config-namespace-defaults/migration.js.map +0 -1
- package/src/migrations/latest/static-website-configurable-waf-encryption/migration.js.map +0 -1
- package/src/migrations/latest/terraform-data-resource-destroy-protection/migration.js.map +0 -1
- package/src/migrations/latest/terraform-declare-used-providers/migration.js.map +0 -1
- package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration.js.map +0 -1
- package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration.js.map +0 -1
- package/src/migrations/latest/terraform-load-runtime-config-src-path/migration.js.map +0 -1
- package/src/migrations/latest/terraform-project-checkov-target-and-bootstrap-destroy/migration.js.map +0 -1
- package/src/migrations/latest/user-identity-configurable-mfa/migration.js.map +0 -1
- package/src/migrations/latest/waf-log-group-cmk-encryption/migration.js.map +0 -1
- /package/src/migrations/latest/{agentcore-harness-no-tools-by-default → python-version-drop-exact-patch}/migration.d.ts +0 -0
- /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/metadata.json +0 -0
- /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/migration.d.ts +0 -0
- /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/migration.js +0 -0
- /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/migration.d.ts +0 -0
- /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/migration.js +0 -0
- /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/metadata.json +0 -0
- /package/src/migrations/{latest/dynamodb-terraform-app-module-outputs → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/migration.d.ts +0 -0
- /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/migration.js +0 -0
- /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/metadata.json +0 -0
- /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/migration.d.ts +0 -0
- /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/metadata.json +0 -0
- /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/migration.js +0 -0
- /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/metadata.json +0 -0
- /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/migration.d.ts +0 -0
- /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/migration.js +0 -0
- /package/src/migrations/{latest/dynamodb-terraform-app-module-outputs → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/metadata.json +0 -0
- /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/migration.d.ts +0 -0
- /package/src/migrations/{latest/dynamodb-terraform-app-module-outputs → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/metadata.json +0 -0
- /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/migration.js +0 -0
- /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/migration.d.ts +0 -0
- /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/migration.js +0 -0
- /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/migration.d.ts +0 -0
- /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.84/0003-terraform-declare-used-providers}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.84/0003-terraform-declare-used-providers}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.84/0003-terraform-declare-used-providers}/migration.js +0 -0
- /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/migration.d.ts +0 -0
- /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/__snapshots__/migration.spec.ts.snap +0 -0
- /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/metadata.json +0 -0
- /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/migration.d.ts +0 -0
- /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/migration.js +0 -0
- /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy}/metadata.json +0 -0
- /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy}/migration.js +0 -0
package/src/utils/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/init.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { initGenerator } from '@nx/js';\nimport { readFileSync } from 'fs';\nimport yaml from 'js-yaml';\nimport GeneratorsJson from '../../generators.json' with { type: 'json' };\nimport { SYNC_GENERATOR_NAME as TS_SYNC_GENERATOR_NAME } from '../ts/sync/generator.js';\nimport { BASE_TSCONFIG_COMPILER_OPTIONS } from './base-tsconfig.js';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from './config/utils.js';\nimport { type Containers, inferContainers } from './containers.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport {\n addDependenciesToPackageJson,\n detectWorkspacePackageManager,\n} from './dependencies.js';\nimport { getDefaultBiomeConfig } from './format.js';\nimport type { Iac } from './iac.js';\nimport { configureMcpServers } from './mcp.js';\nimport { getNpmScope } from './npm-scope.js';\nimport {\n mergeTargetDefault,\n nxPluginMcpDependency,\n nxPluginSelfDependency,\n} from './nx.js';\nimport { getPackageManagerDisplayCommands } from './pkg-manager.js';\nimport { workspaceGlobs } from './project-package-json.js';\nimport { type ITsDepVersion, withVersions } from './versions.js';\n\nconst WORKSPACES = ['packages/*'];\nconst NX_TYPESCRIPT_SYNC_GENERATOR = '@nx/js:typescript-sync';\n\n/** Dependencies a caller must declare to apply the workspace init. */\nexport const INIT_DEPENDENCIES = [\n { name: 'nx' },\n { name: '@nx/js' },\n { name: '@nx/workspace' },\n { name: 'typescript' },\n { name: '@biomejs/biome' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n// Built dependencies whose install scripts the generated workspace trusts.\n// `onlyBuiltDependencies` is the pnpm 10 key (silently ignored by pnpm 11);\n// pnpm 11 reads `allowBuilds` instead. Any dep NOT in this allowlist will\n// have its install scripts skipped with a warning — matching pnpm 10's\n// default behaviour. The user can opt-in later via `pnpm approve-builds`.\nexport const PNPM_BUILT_DEPENDENCIES = ['@swc/core', 'esbuild', 'nx', 'sharp'];\n\n/**\n * Options controlling how the workspace is initialised. These mirror the\n * preset schema so a workspace created via the preset and one initialised via\n * the `init` generator end up in the same shape.\n */\nexport interface ApplyWorkspaceInitOptions {\n /** The IaC provider to record in the plugin config. */\n readonly iac: Iac;\n /**\n * The container engine to record. `undefined`/`'infer'` picks docker when\n * installed, else finch.\n */\n readonly containers?: Containers | 'infer';\n /** Whether to configure MCP servers for coding agents. Defaults to true. */\n readonly mcp?: boolean;\n /**\n * How to treat the generated workspace README. The preset owns the README of\n * a greenfield workspace (`Overwrite`); the `init` generator must not clobber\n * an existing workspace's README (`KeepExisting`, the default).\n */\n readonly readmeOverwriteStrategy?: OverwriteStrategy;\n /**\n * Whether to overwrite root package.json scripts that already exist. The\n * preset owns a greenfield workspace's scripts (`true`); the `init`\n * generator must not clobber an existing workspace's scripts (`false`,\n * the default) — it only adds the convenience scripts that are absent.\n */\n readonly overwriteScripts?: boolean;\n /**\n * Whether generators use the package manager's dependency catalog. On pnpm\n * this also sets `catalogMode: strict` so `pnpm add` records new deps in the\n * catalog. Defaults to true.\n */\n readonly catalogs?: boolean;\n}\n\n/**\n * Add or repair the pnpm `allowBuilds` / `onlyBuiltDependencies` allowlist for\n * the workspace's `packages` globs, without clobbering any packages the user\n * has already declared.\n *\n * A workspace not created by the preset commonly has either no\n * `pnpm-workspace.yaml`, one missing the `packages` globs, or one carrying the\n * broken `set this to true or false` placeholder pnpm writes when it skips a\n * build script. This makes the file self-consistent so the first generator's\n * install doesn't fail with `ERR_PNPM_IGNORED_BUILDS`.\n */\nconst setUpPnpmWorkspace = (tree: Tree, catalogs: boolean) => {\n const existing = tree.exists('pnpm-workspace.yaml')\n ? ((yaml.load(tree.read('pnpm-workspace.yaml', 'utf-8') ?? '') as Record<\n string,\n unknown\n >) ?? {})\n : {};\n\n // Preserve any packages globs the user already has, ensuring ours are present.\n const packages = Array.from(\n new Set([...((existing.packages as string[]) ?? []), ...WORKSPACES]),\n );\n\n const allowBuilds = {\n ...(typeof existing.allowBuilds === 'object' && existing.allowBuilds\n ? (existing.allowBuilds as Record<string, unknown>)\n : {}),\n // Overwrite any non-boolean (e.g. the \"set this to true or false\"\n // placeholder) with an explicit true for the deps we trust.\n ...Object.fromEntries(PNPM_BUILT_DEPENDENCIES.map((dep) => [dep, true])),\n };\n\n // `strict` makes `pnpm add` record new deps in the catalog; it only gates\n // that flow, so pre-declared direct ranges (e.g. tslib) still install.\n // Preserve an explicit user choice.\n const catalogMode = catalogs\n ? (existing.catalogMode ?? 'strict')\n : existing.catalogMode;\n\n tree.write(\n 'pnpm-workspace.yaml',\n yaml.dump(\n {\n ...existing,\n packages,\n allowBuilds,\n onlyBuiltDependencies: PNPM_BUILT_DEPENDENCIES,\n ...(catalogMode ? { catalogMode } : {}),\n },\n { quotingType: \"'\" },\n ),\n );\n};\n\n/**\n * Configure the workspace's package manager for a monorepo layout.\n *\n * pnpm workspaces are declared in `pnpm-workspace.yaml`; every other package\n * manager reads the `workspaces` field of the root `package.json`.\n */\nconst setUpWorkspaces = (tree: Tree, catalogs: boolean) => {\n if (detectWorkspacePackageManager(tree) === 'pnpm') {\n setUpPnpmWorkspace(tree, catalogs);\n } else {\n updateJson(tree, 'package.json', (json) => {\n // The `workspaces` field may be the object form ({ \"packages\": [...] })\n // accepted by yarn and bun — extend the globs while preserving the form.\n const globs = Array.from(\n new Set([...workspaceGlobs(json.workspaces), ...WORKSPACES]),\n );\n return {\n ...json,\n workspaces:\n json.workspaces !== undefined && !Array.isArray(json.workspaces)\n ? { ...json.workspaces, packages: globs }\n : globs,\n };\n });\n }\n};\n\n/**\n * Ensure the workspace has a `tsconfig.base.json`.\n *\n * `@nx/js` `initGenerator` (with `addTsPlugin`) normally creates this, but it\n * short-circuits when the workspace already has a root `tsconfig.json` — in\n * which case no base file is written and the next project generator fails with\n * `Cannot find tsconfig.base.json`. So we create a compatible one when it's\n * absent. An existing base is left untouched: the user may have tuned it, and\n * rewriting shared compiler options can break other projects (see the\n * \"add to an existing workspace\" guide).\n */\nconst ensureBaseTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.base.json')) {\n return;\n }\n tree.write(\n 'tsconfig.base.json',\n JSON.stringify(\n {\n compilerOptions: {\n ...BASE_TSCONFIG_COMPILER_OPTIONS,\n customConditions: [getNpmScope(tree)],\n },\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Ensure the workspace has a root `tsconfig.json`.\n *\n * Nx's `@nx/js:typescript-sync` generator hard-fails with\n * `Missing root \"tsconfig.json\"` when it's absent. The plugin's TypeScript\n * projects reference each other via this file, so we guarantee a minimal one\n * exists (sync populates its `references`).\n */\nconst ensureRootTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.json')) {\n return;\n }\n tree.write(\n 'tsconfig.json',\n JSON.stringify(\n {\n extends: './tsconfig.base.json',\n files: [],\n references: [],\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Transform an Nx workspace into one ready to run `@aws/nx-plugin` generators.\n *\n * This is the deterministic core shared by the workspace preset and the `init`\n * generator. It is safe to re-run: every step is idempotent (config merges,\n * keyed nx.json / package.json entries, create-if-missing files), so running\n * it against an already-initialised workspace is a no-op.\n *\n * It preserves the workspace's module format: the root package.json `type`\n * field is owned by the preset (written from its `--module` option) and left\n * untouched here. It does NOT rewrite an existing `tsconfig.base.json`'s\n * compiler options, migrate a workspace's package manager, or restructure\n * existing projects — those are decisions for the user (see the \"add to an\n * existing workspace\" guide).\n */\nexport const applyWorkspaceInit = async <const D extends DependencyDeclaration>(\n tree: Tree,\n {\n iac,\n containers,\n mcp,\n readmeOverwriteStrategy = OverwriteStrategy.KeepExisting,\n overwriteScripts = false,\n catalogs = true,\n }: ApplyWorkspaceInitOptions,\n declaration: D & MustDeclare<typeof INIT_DEPENDENCIES, D>,\n) => {\n const resolvedContainers =\n !containers || containers === 'infer' ? inferContainers() : containers;\n\n // The catalogs flag is written explicitly (even when true) so the workspace\n // records its dependency-management choice.\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, {\n iac: { provider: iac },\n containers: { engine: resolvedContainers },\n packageManager: { catalogs },\n });\n\n // Set up the TypeScript plugin, base tsconfig, formatter etc. `@nx/js`\n // creates `tsconfig.base.json` when absent, but skips it when a root\n // `tsconfig.json` already exists — so we ensure both explicitly below.\n await initGenerator(tree, {\n formatter: 'none',\n addTsPlugin: true,\n });\n\n ensureBaseTsConfig(tree);\n ensureRootTsConfig(tree);\n\n setUpWorkspaces(tree, catalogs);\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n // Preserve an explicit analytics choice in an existing workspace.\n analytics: (nxJson as { analytics?: boolean }).analytics ?? false,\n targetDefaults: {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n ...base,\n syncGenerators: [\n ...(base.syncGenerators ?? []).filter(\n (g) =>\n ![TS_SYNC_GENERATOR_NAME, NX_TYPESCRIPT_SYNC_GENERATOR].includes(\n g,\n ),\n ),\n NX_TYPESCRIPT_SYNC_GENERATOR,\n TS_SYNC_GENERATOR_NAME,\n ],\n })),\n },\n });\n\n const CONVENIENCE_SCRIPTS = {\n dev: 'nx run-many --target dev',\n build: 'nx run-many --target build',\n lint: 'nx run-many --target lint --configuration=fix',\n test: 'nx run-many --target test --all',\n // Trivy container image scanning is not part of `build` (its result\n // depends on the ever-changing vulnerability database); run it explicitly,\n // e.g. in CI.\n trivy: 'nx run-many --target trivy --all',\n 'build:skip-lint': 'nx run-many --target build --configuration=skip-lint',\n 'build:all': 'nx run-many --target build --all',\n 'affected:all': 'nx affected --target build',\n };\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n // The root `type` field is owned by the preset (written explicitly from\n // its `--module` option). `init` preserves an existing workspace's field\n // as-is: an ESM workspace already carries `type: \"module\"` (that is how\n // the format is inferred), and introducing a `type` into a CommonJS\n // workspace that lacks one changes behaviour for frameworks that parse it\n // (e.g. Next.js starts treating the app's ESM source as CJS).\n scripts: overwriteScripts\n ? { ...packageJson.scripts, ...CONVENIENCE_SCRIPTS }\n : { ...CONVENIENCE_SCRIPTS, ...packageJson.scripts },\n }));\n\n // Pin the workspace's `nx` to the version the plugin's @nx/* packages are\n // built against. A mismatched workspace nx (even a patch apart) hoists a\n // second nested nx under @nx/js, and the two instances deadlock `nx sync`.\n // `@nx/js` must be a root dependency for the `@nx/js:typescript-sync`\n // generator registered in nx.json to resolve (npm doesn't hoist the\n // plugin's own copy reliably).\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'nx',\n '@nx/js',\n '@nx/workspace',\n ]),\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'typescript',\n '@biomejs/biome',\n ]),\n // Declare the plugin the generators are running from, plus the MCP server\n // package the vended config runs, so both are pinned in the workspace's\n // lockfile and upgrading them upgrades what the agents use.\n ...nxPluginSelfDependency(tree),\n ...nxPluginMcpDependency(tree),\n },\n );\n\n // Write biome.json for formatting and linting\n if (!tree.exists('biome.json')) {\n tree.write(\n 'biome.json',\n JSON.stringify(getDefaultBiomeConfig(tree), null, 2),\n );\n }\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, '..', 'preset', 'files'),\n '.',\n {\n projectName: getNpmScope(tree),\n generators: Object.entries(GeneratorsJson.generators)\n .filter(([_, v]) => !v['hidden'])\n .map(([k, v]) => ({ name: k, description: v.description })),\n ...(() => {\n const cmds = getPackageManagerDisplayCommands();\n return {\n pkgMgrCmd: cmds.exec,\n buildCmd: `${cmds.run} build`,\n lintCmd: `${cmds.run} lint`,\n };\n })(),\n },\n {\n overwriteStrategy: readmeOverwriteStrategy,\n },\n );\n\n if (mcp !== false) {\n configureMcpServers(tree);\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","initGenerator","yaml","GeneratorsJson","type","SYNC_GENERATOR_NAME","TS_SYNC_GENERATOR_NAME","BASE_TSCONFIG_COMPILER_OPTIONS","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","inferContainers","forDependencies","addDependenciesToPackageJson","detectWorkspacePackageManager","getDefaultBiomeConfig","configureMcpServers","getNpmScope","mergeTargetDefault","nxPluginMcpDependency","nxPluginSelfDependency","getPackageManagerDisplayCommands","workspaceGlobs","withVersions","WORKSPACES","NX_TYPESCRIPT_SYNC_GENERATOR","INIT_DEPENDENCIES","name","PNPM_BUILT_DEPENDENCIES","setUpPnpmWorkspace","tree","catalogs","existing","exists","load","read","packages","Array","from","Set","allowBuilds","Object","fromEntries","map","dep","catalogMode","write","dump","onlyBuiltDependencies","quotingType","setUpWorkspaces","json","globs","workspaces","undefined","isArray","ensureBaseTsConfig","JSON","stringify","compilerOptions","customConditions","ensureRootTsConfig","extends","files","references","applyWorkspaceInit","iac","containers","mcp","readmeOverwriteStrategy","KeepExisting","overwriteScripts","declaration","resolvedContainers","provider","engine","packageManager","formatter","addTsPlugin","nxJson","analytics","targetDefaults","compile","base","syncGenerators","filter","g","includes","CONVENIENCE_SCRIPTS","dev","build","lint","test","trivy","packageJson","scripts","dirname","projectName","generators","entries","_","v","k","description","cmds","pkgMgrCmd","exec","buildCmd","run","lintCmd","overwriteStrategy"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAEVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAOC,UAAU,UAAU;AAC3B,OAAOC,oBAAoB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACzE,SAASC,uBAAuBC,sBAAsB,QAAQ,0BAA0B;AACxF,SAASC,8BAA8B,QAAQ,qBAAqB;AACpE,SACEC,uBAAuB,EACvBC,uB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SAAS,EAC/B1D,GAAG,CAAC,CAAC,CAAC2D,GAAGD,EAAE,GAAM,CAAA;gBAAE1E,MAAM2E;gBAAGC,aAAaF,EAAEE,WAAW;YAAC,CAAA;QAC1D,GAAG,AAAC,CAAA;YACF,MAAMC,OAAOnF;YACb,OAAO;gBACLoF,WAAWD,KAAKE,IAAI;gBACpBC,UAAU,GAAGH,KAAKI,GAAG,CAAC,MAAM,CAAC;gBAC7BC,SAAS,GAAGL,KAAKI,GAAG,CAAC,KAAK,CAAC;YAC7B;QACF,CAAA,GAAI;IACN,GACA;QACEE,mBAAmBzC;IACrB;IAGF,IAAID,QAAQ,OAAO;QACjBpD,oBAAoBc;IACtB;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/init.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n readNxJson,\n type Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\nimport { initGenerator } from '@nx/js';\nimport { readFileSync } from 'fs';\nimport yaml from 'js-yaml';\nimport GeneratorsJson from '../../generators.json' with { type: 'json' };\nimport { SYNC_GENERATOR_NAME as TS_SYNC_GENERATOR_NAME } from '../ts/sync/generator.js';\nimport { BASE_TSCONFIG_COMPILER_OPTIONS } from './base-tsconfig.js';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from './config/utils.js';\nimport { type Containers, inferContainers } from './containers.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from './declared-dependencies.js';\nimport {\n addDependenciesToPackageJson,\n detectWorkspacePackageManager,\n} from './dependencies.js';\nimport { getDefaultBiomeConfig } from './format.js';\nimport type { Iac } from './iac.js';\nimport { configureMcpServers } from './mcp.js';\nimport { getNpmScope } from './npm-scope.js';\nimport {\n mergeTargetDefault,\n nxPluginMcpDependency,\n nxPluginSelfDependency,\n} from './nx.js';\nimport { getPackageManagerDisplayCommands } from './pkg-manager.js';\nimport { workspaceGlobs } from './project-package-json.js';\nimport { type ITsDepVersion, withVersions } from './versions.js';\n\nconst WORKSPACES = ['packages/*'];\nconst NX_TYPESCRIPT_SYNC_GENERATOR = '@nx/js:typescript-sync';\n\nexport const DEFAULT_PARALLEL = 8;\n\n/** Dependencies a caller must declare to apply the workspace init. */\nexport const INIT_DEPENDENCIES = [\n { name: 'nx' },\n { name: '@nx/js' },\n { name: '@nx/workspace' },\n { name: 'typescript' },\n { name: '@biomejs/biome' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\n// Built dependencies whose install scripts the generated workspace trusts.\n// `onlyBuiltDependencies` is the pnpm 10 key (silently ignored by pnpm 11);\n// pnpm 11 reads `allowBuilds` instead. Any dep NOT in this allowlist will\n// have its install scripts skipped with a warning — matching pnpm 10's\n// default behaviour. The user can opt-in later via `pnpm approve-builds`.\nexport const PNPM_BUILT_DEPENDENCIES = ['@swc/core', 'esbuild', 'nx', 'sharp'];\n\n/**\n * Options controlling how the workspace is initialised. These mirror the\n * preset schema so a workspace created via the preset and one initialised via\n * the `init` generator end up in the same shape.\n */\nexport interface ApplyWorkspaceInitOptions {\n /** The IaC provider to record in the plugin config. */\n readonly iac: Iac;\n /**\n * The container engine to record. `undefined`/`'infer'` picks docker when\n * installed, else finch.\n */\n readonly containers?: Containers | 'infer';\n /** Whether to configure MCP servers for coding agents. Defaults to true. */\n readonly mcp?: boolean;\n /**\n * How to treat the generated workspace README. The preset owns the README of\n * a greenfield workspace (`Overwrite`); the `init` generator must not clobber\n * an existing workspace's README (`KeepExisting`, the default).\n */\n readonly readmeOverwriteStrategy?: OverwriteStrategy;\n /**\n * Whether to overwrite root package.json scripts that already exist. The\n * preset owns a greenfield workspace's scripts (`true`); the `init`\n * generator must not clobber an existing workspace's scripts (`false`,\n * the default) — it only adds the convenience scripts that are absent.\n */\n readonly overwriteScripts?: boolean;\n /**\n * Whether generators use the package manager's dependency catalog. On pnpm\n * this also sets `catalogMode: strict` so `pnpm add` records new deps in the\n * catalog. Defaults to true.\n */\n readonly catalogs?: boolean;\n}\n\n/**\n * Add or repair the pnpm `allowBuilds` / `onlyBuiltDependencies` allowlist for\n * the workspace's `packages` globs, without clobbering any packages the user\n * has already declared.\n *\n * A workspace not created by the preset commonly has either no\n * `pnpm-workspace.yaml`, one missing the `packages` globs, or one carrying the\n * broken `set this to true or false` placeholder pnpm writes when it skips a\n * build script. This makes the file self-consistent so the first generator's\n * install doesn't fail with `ERR_PNPM_IGNORED_BUILDS`.\n */\nconst setUpPnpmWorkspace = (tree: Tree, catalogs: boolean) => {\n const existing = tree.exists('pnpm-workspace.yaml')\n ? ((yaml.load(tree.read('pnpm-workspace.yaml', 'utf-8') ?? '') as Record<\n string,\n unknown\n >) ?? {})\n : {};\n\n // Preserve any packages globs the user already has, ensuring ours are present.\n const packages = Array.from(\n new Set([...((existing.packages as string[]) ?? []), ...WORKSPACES]),\n );\n\n const allowBuilds = {\n ...(typeof existing.allowBuilds === 'object' && existing.allowBuilds\n ? (existing.allowBuilds as Record<string, unknown>)\n : {}),\n // Overwrite any non-boolean (e.g. the \"set this to true or false\"\n // placeholder) with an explicit true for the deps we trust.\n ...Object.fromEntries(PNPM_BUILT_DEPENDENCIES.map((dep) => [dep, true])),\n };\n\n // `strict` makes `pnpm add` record new deps in the catalog; it only gates\n // that flow, so pre-declared direct ranges (e.g. tslib) still install.\n // Preserve an explicit user choice.\n const catalogMode = catalogs\n ? (existing.catalogMode ?? 'strict')\n : existing.catalogMode;\n\n tree.write(\n 'pnpm-workspace.yaml',\n yaml.dump(\n {\n ...existing,\n packages,\n allowBuilds,\n onlyBuiltDependencies: PNPM_BUILT_DEPENDENCIES,\n ...(catalogMode ? { catalogMode } : {}),\n },\n { quotingType: \"'\" },\n ),\n );\n};\n\n/**\n * Configure the workspace's package manager for a monorepo layout.\n *\n * pnpm workspaces are declared in `pnpm-workspace.yaml`; every other package\n * manager reads the `workspaces` field of the root `package.json`.\n */\nconst setUpWorkspaces = (tree: Tree, catalogs: boolean) => {\n if (detectWorkspacePackageManager(tree) === 'pnpm') {\n setUpPnpmWorkspace(tree, catalogs);\n } else {\n updateJson(tree, 'package.json', (json) => {\n // The `workspaces` field may be the object form ({ \"packages\": [...] })\n // accepted by yarn and bun — extend the globs while preserving the form.\n const globs = Array.from(\n new Set([...workspaceGlobs(json.workspaces), ...WORKSPACES]),\n );\n return {\n ...json,\n workspaces:\n json.workspaces !== undefined && !Array.isArray(json.workspaces)\n ? { ...json.workspaces, packages: globs }\n : globs,\n };\n });\n }\n};\n\n/**\n * Ensure the workspace has a `tsconfig.base.json`.\n *\n * `@nx/js` `initGenerator` (with `addTsPlugin`) normally creates this, but it\n * short-circuits when the workspace already has a root `tsconfig.json` — in\n * which case no base file is written and the next project generator fails with\n * `Cannot find tsconfig.base.json`. So we create a compatible one when it's\n * absent. An existing base is left untouched: the user may have tuned it, and\n * rewriting shared compiler options can break other projects (see the\n * \"add to an existing workspace\" guide).\n */\nconst ensureBaseTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.base.json')) {\n return;\n }\n tree.write(\n 'tsconfig.base.json',\n JSON.stringify(\n {\n compilerOptions: {\n ...BASE_TSCONFIG_COMPILER_OPTIONS,\n customConditions: [getNpmScope(tree)],\n },\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Ensure the workspace has a root `tsconfig.json`.\n *\n * Nx's `@nx/js:typescript-sync` generator hard-fails with\n * `Missing root \"tsconfig.json\"` when it's absent. The plugin's TypeScript\n * projects reference each other via this file, so we guarantee a minimal one\n * exists (sync populates its `references`).\n */\nconst ensureRootTsConfig = (tree: Tree) => {\n if (tree.exists('tsconfig.json')) {\n return;\n }\n tree.write(\n 'tsconfig.json',\n JSON.stringify(\n {\n extends: './tsconfig.base.json',\n files: [],\n references: [],\n },\n null,\n 2,\n ),\n );\n};\n\n/**\n * Transform an Nx workspace into one ready to run `@aws/nx-plugin` generators.\n *\n * This is the deterministic core shared by the workspace preset and the `init`\n * generator. It is safe to re-run: every step is idempotent (config merges,\n * keyed nx.json / package.json entries, create-if-missing files), so running\n * it against an already-initialised workspace is a no-op.\n *\n * It preserves the workspace's module format: the root package.json `type`\n * field is owned by the preset (written from its `--module` option) and left\n * untouched here. It does NOT rewrite an existing `tsconfig.base.json`'s\n * compiler options, migrate a workspace's package manager, or restructure\n * existing projects — those are decisions for the user (see the \"add to an\n * existing workspace\" guide).\n */\nexport const applyWorkspaceInit = async <const D extends DependencyDeclaration>(\n tree: Tree,\n {\n iac,\n containers,\n mcp,\n readmeOverwriteStrategy = OverwriteStrategy.KeepExisting,\n overwriteScripts = false,\n catalogs = true,\n }: ApplyWorkspaceInitOptions,\n declaration: D & MustDeclare<typeof INIT_DEPENDENCIES, D>,\n) => {\n const resolvedContainers =\n !containers || containers === 'infer' ? inferContainers() : containers;\n\n // The catalogs flag is written explicitly (even when true) so the workspace\n // records its dependency-management choice.\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, {\n iac: { provider: iac },\n containers: { engine: resolvedContainers },\n packageManager: { catalogs },\n });\n\n // Set up the TypeScript plugin, base tsconfig, formatter etc. `@nx/js`\n // creates `tsconfig.base.json` when absent, but skips it when a root\n // `tsconfig.json` already exists — so we ensure both explicitly below.\n await initGenerator(tree, {\n formatter: 'none',\n addTsPlugin: true,\n });\n\n ensureBaseTsConfig(tree);\n ensureRootTsConfig(tree);\n\n setUpWorkspaces(tree, catalogs);\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n // Preserve an explicit analytics choice in an existing workspace.\n analytics: (nxJson as { analytics?: boolean }).analytics ?? false,\n parallel: nxJson.parallel ?? DEFAULT_PARALLEL,\n targetDefaults: {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n ...base,\n syncGenerators: [\n ...(base.syncGenerators ?? []).filter(\n (g) =>\n ![TS_SYNC_GENERATOR_NAME, NX_TYPESCRIPT_SYNC_GENERATOR].includes(\n g,\n ),\n ),\n NX_TYPESCRIPT_SYNC_GENERATOR,\n TS_SYNC_GENERATOR_NAME,\n ],\n })),\n },\n });\n\n const CONVENIENCE_SCRIPTS = {\n dev: 'nx run-many --target dev',\n build: 'nx run-many --target build',\n lint: 'nx run-many --target lint --configuration=fix',\n test: 'nx run-many --target test --all',\n // Trivy container image scanning is not part of `build` (its result\n // depends on the ever-changing vulnerability database); run it explicitly,\n // e.g. in CI.\n trivy: 'nx run-many --target trivy --all',\n 'build:skip-lint': 'nx run-many --target build --configuration=skip-lint',\n 'build:all': 'nx run-many --target build --all',\n 'affected:all': 'nx affected --target build',\n };\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n // The root `type` field is owned by the preset (written explicitly from\n // its `--module` option). `init` preserves an existing workspace's field\n // as-is: an ESM workspace already carries `type: \"module\"` (that is how\n // the format is inferred), and introducing a `type` into a CommonJS\n // workspace that lacks one changes behaviour for frameworks that parse it\n // (e.g. Next.js starts treating the app's ESM source as CJS).\n scripts: overwriteScripts\n ? { ...packageJson.scripts, ...CONVENIENCE_SCRIPTS }\n : { ...CONVENIENCE_SCRIPTS, ...packageJson.scripts },\n }));\n\n // Pin the workspace's `nx` to the version the plugin's @nx/* packages are\n // built against. A mismatched workspace nx (even a patch apart) hoists a\n // second nested nx under @nx/js, and the two instances deadlock `nx sync`.\n // `@nx/js` must be a root dependency for the `@nx/js:typescript-sync`\n // generator registered in nx.json to resolve (npm doesn't hoist the\n // plugin's own copy reliably).\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'nx',\n '@nx/js',\n '@nx/workspace',\n ]),\n ...withVersions(forDependencies<typeof INIT_DEPENDENCIES>(declaration), [\n 'typescript',\n '@biomejs/biome',\n ]),\n // Declare the plugin the generators are running from, plus the MCP server\n // package the vended config runs, so both are pinned in the workspace's\n // lockfile and upgrading them upgrades what the agents use.\n ...nxPluginSelfDependency(tree),\n ...nxPluginMcpDependency(tree),\n },\n );\n\n // Write biome.json for formatting and linting\n if (!tree.exists('biome.json')) {\n tree.write(\n 'biome.json',\n JSON.stringify(getDefaultBiomeConfig(tree), null, 2),\n );\n }\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, '..', 'preset', 'files'),\n '.',\n {\n projectName: getNpmScope(tree),\n generators: Object.entries(GeneratorsJson.generators)\n .filter(([_, v]) => !v['hidden'])\n .map(([k, v]) => ({ name: k, description: v.description })),\n ...(() => {\n const cmds = getPackageManagerDisplayCommands();\n return {\n pkgMgrCmd: cmds.exec,\n buildCmd: `${cmds.run} build`,\n lintCmd: `${cmds.run} lint`,\n };\n })(),\n },\n {\n overwriteStrategy: readmeOverwriteStrategy,\n },\n );\n\n if (mcp !== false) {\n configureMcpServers(tree);\n }\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readNxJson","updateJson","updateNxJson","initGenerator","yaml","GeneratorsJson","type","SYNC_GENERATOR_NAME","TS_SYNC_GENERATOR_NAME","BASE_TSCONFIG_COMPILER_OPTIONS","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","inferContainers","forDependencies","addDependenciesToPackageJson","detectWorkspacePackageManager","getDefaultBiomeConfig","configureMcpServers","getNpmScope","mergeTargetDefault","nxPluginMcpDependency","nxPluginSelfDependency","getPackageManagerDisplayCommands","workspaceGlobs","withVersions","WORKSPACES","NX_TYPESCRIPT_SYNC_GENERATOR","DEFAULT_PARALLEL","INIT_DEPENDENCIES","name","PNPM_BUILT_DEPENDENCIES","setUpPnpmWorkspace","tree","catalogs","existing","exists","load","read","packages","Array","from","Set","allowBuilds","Object","fromEntries","map","dep","catalogMode","write","dump","onlyBuiltDependencies","quotingType","setUpWorkspaces","json","globs","workspaces","undefined","isArray","ensureBaseTsConfig","JSON","stringify","compilerOptions","customConditions","ensureRootTsConfig","extends","files","references","applyWorkspaceInit","iac","containers","mcp","readmeOverwriteStrategy","KeepExisting","overwriteScripts","declaration","resolvedContainers","provider","engine","packageManager","formatter","addTsPlugin","nxJson","analytics","parallel","targetDefaults","compile","base","syncGenerators","filter","g","includes","CONVENIENCE_SCRIPTS","dev","build","lint","test","trivy","packageJson","scripts","dirname","projectName","generators","entries","_","v","k","description","cmds","pkgMgrCmd","exec","buildCmd","run","lintCmd","overwriteStrategy"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EAEVC,UAAU,EACVC,YAAY,QACP,aAAa;AACpB,SAASC,aAAa,QAAQ,SAAS;AAEvC,OAAOC,UAAU,UAAU;AAC3B,OAAOC,oBAAoB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACzE,SAASC,uBAAuBC,sBAAsB,QAAQ,0BAA0B;AACxF,SAASC,8BAA8B,QAAQ,qBAAqB;AACpE,SACEC,uBAAuB,EACvBC,uBAAuB,QAClB,oBAAoB;AAC3B,SAA0BC,eAAe,QAAQ,kBAAkB;AACnE,SAEEC,eAAe,QAEV,6BAA6B;AACpC,SACEC,4BAA4B,EAC5BC,6BAA6B,QACxB,oBAAoB;AAC3B,SAASC,qBAAqB,QAAQ,cAAc;AAEpD,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,sBAAsB,QACjB,UAAU;AACjB,SAASC,gCAAgC,QAAQ,mBAAmB;AACpE,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAA6BC,YAAY,QAAQ,gBAAgB;AAEjE,MAAMC,aAAa;IAAC;CAAa;AACjC,MAAMC,+BAA+B;AAErC,OAAO,MAAMC,mBAAmB,EAAE;AAElC,oEAAoE,GACpE,OAAO,MAAMC,oBAAoB;IAC/B;QAAEC,MAAM;IAAK;IACb;QAAEA,MAAM;IAAS;IACjB;QAAEA,MAAM;IAAgB;IACxB;QA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sEAAsE;IACtE,oEAAoE;IACpE,+BAA+B;IAC/BpF,6BACEkB,MACA,CAAC,GACD;QACE,GAAGR,aAAaX,gBAA0C6D,cAAc;YACtE;YACA;YACA;SACD,CAAC;QACF,GAAGlD,aAAaX,gBAA0C6D,cAAc;YACtE;YACA;SACD,CAAC;QACF,0EAA0E;QAC1E,wEAAwE;QACxE,4DAA4D;QAC5D,GAAGrD,uBAAuBW,KAAK;QAC/B,GAAGZ,sBAAsBY,KAAK;IAChC;IAGF,8CAA8C;IAC9C,IAAI,CAACA,KAAKG,MAAM,CAAC,eAAe;QAC9BH,KAAKgB,KAAK,CACR,cACAW,KAAKC,SAAS,CAAC5C,sBAAsBgB,OAAO,MAAM;IAEtD;IAEAnC,cACEmC,MACAlC,kBAAkB,YAAYqG,OAAO,EAAE,MAAM,UAAU,UACvD,KACA;QACEC,aAAalF,YAAYc;QACzBqE,YAAY1D,OAAO2D,OAAO,CAACjG,eAAegG,UAAU,EACjDb,MAAM,CAAC,CAAC,CAACe,GAAGC,EAAE,GAAK,CAACA,CAAC,CAAC,SAAS,EAC/B3D,GAAG,CAAC,CAAC,CAAC4D,GAAGD,EAAE,GAAM,CAAA;gBAAE3E,MAAM4E;gBAAGC,aAAaF,EAAEE,WAAW;YAAC,CAAA;QAC1D,GAAG,AAAC,CAAA;YACF,MAAMC,OAAOrF;YACb,OAAO;gBACLsF,WAAWD,KAAKE,IAAI;gBACpBC,UAAU,GAAGH,KAAKI,GAAG,CAAC,MAAM,CAAC;gBAC7BC,SAAS,GAAGL,KAAKI,GAAG,CAAC,KAAK,CAAC;YAC7B;QACF,CAAA,GAAI;IACN,GACA;QACEE,mBAAmB1C;IACrB;IAGF,IAAID,QAAQ,OAAO;QACjBrD,oBAAoBe;IACtB;AACF,EAAE"}
|
|
@@ -51,24 +51,3 @@ export interface RuntimeResolution {
|
|
|
51
51
|
export declare const resolveLambdaRuntimes: (identifiers: readonly string[]) => RuntimeResolution;
|
|
52
52
|
/** The warning a language's unresolved runtime reports. */
|
|
53
53
|
export declare const unresolvedRuntimeWarning: (entry: RuntimeResolution["unresolved"][number]) => string;
|
|
54
|
-
/** A CPython build as `uv python list --output-format json` reports it. */
|
|
55
|
-
export interface UvPythonEntry {
|
|
56
|
-
readonly version: string;
|
|
57
|
-
readonly version_parts: {
|
|
58
|
-
readonly major: number;
|
|
59
|
-
readonly minor: number;
|
|
60
|
-
readonly patch: number;
|
|
61
|
-
};
|
|
62
|
-
readonly implementation: string;
|
|
63
|
-
readonly variant?: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* The latest CPython patch uv can install for a `major.minor`, or undefined when
|
|
67
|
-
* it lists none.
|
|
68
|
-
*
|
|
69
|
-
* Lambda names only `major.minor` and patches the interpreter itself, but uv pins
|
|
70
|
-
* an exact `major.minor.patch`, so the patch is resolved from what uv can actually
|
|
71
|
-
* install for the runtime's minor. Pre-releases and the free-threaded variant are
|
|
72
|
-
* excluded: a generated project needs the default build of a final release.
|
|
73
|
-
*/
|
|
74
|
-
export declare const resolveLatestPythonPatch: (entries: readonly UvPythonEntry[], minor?: string) => string | undefined;
|
|
@@ -79,19 +79,5 @@
|
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
/** The warning a language's unresolved runtime reports. */ export const unresolvedRuntimeWarning = (entry)=>`Found no ${entry.language} runtime in the aws-cdk-lib runtime list, so it keeps its pinned runtime (${entry.kept})`;
|
|
82
|
-
/**
|
|
83
|
-
* The latest CPython patch uv can install for a `major.minor`, or undefined when
|
|
84
|
-
* it lists none.
|
|
85
|
-
*
|
|
86
|
-
* Lambda names only `major.minor` and patches the interpreter itself, but uv pins
|
|
87
|
-
* an exact `major.minor.patch`, so the patch is resolved from what uv can actually
|
|
88
|
-
* install for the runtime's minor. Pre-releases and the free-threaded variant are
|
|
89
|
-
* excluded: a generated project needs the default build of a final release.
|
|
90
|
-
*/ export const resolveLatestPythonPatch = (entries, minor = LAMBDA_RUNTIME_VERSIONS.python)=>{
|
|
91
|
-
const [major, wanted] = minor.split('.').map(Number);
|
|
92
|
-
const patches = entries.filter((entry)=>entry.implementation === 'cpython' && entry.variant !== 'freethreaded' && entry.version_parts.major === major && entry.version_parts.minor === wanted && // A final release only; `3.15.0rc1` carries a suffix.
|
|
93
|
-
/^\d+\.\d+\.\d+$/.test(entry.version)).map((entry)=>entry.version_parts.patch);
|
|
94
|
-
return patches.length > 0 ? String(Math.max(...patches)) : undefined;
|
|
95
|
-
};
|
|
96
82
|
|
|
97
83
|
//# sourceMappingURL=lambda-runtime-resolution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/lambda-runtime-resolution.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type ILambdaRuntime, LAMBDA_RUNTIME_VERSIONS } from './versions.js';\n\n/**\n * Resolution of the Lambda runtimes and the CPython patch the version update\n * pins.\n *\n * Lives here rather than beside the script so it is covered by the plugin's test\n * suite; the script supplies the runtime list and the uv output.\n */\n\n/** Compare two dotted numeric versions (`24`, `3.14`) ascending. */\nexport const compareRuntimeVersions = (a: string, b: string): number => {\n const left = a.split('.').map(Number);\n const right = b.split('.').map(Number);\n for (let i = 0; i < Math.max(left.length, right.length); i++) {\n const diff = (left[i] ?? 0) - (right[i] ?? 0);\n if (diff !== 0) {\n return diff;\n }\n }\n return 0;\n};\n\n/**\n * The version a managed runtime identifier names, or undefined for one that isn't\n * a versioned `nodejs`/`python` runtime.\n *\n * `nodejs24.x` -> `24`, `python3.14` -> `3.14`. The bare `nodejs` and\n * `nodejs4.3-edge` style identifiers carry no comparable version and are skipped.\n */\nexport const runtimeIdentifierVersion = (\n identifier: string,\n): { language: ILambdaRuntime; version: string } | undefined => {\n const node = /^nodejs(\\d+)\\.x$/.exec(identifier);\n if (node) {\n return { language: 'node', version: node[1] };\n }\n const python = /^python(\\d+\\.\\d+)$/.exec(identifier);\n return python ? { language: 'python', version: python[1] } : undefined;\n};\n\n/** Why a language's runtime could not be resolved. */\nexport type UnresolvedReason = 'no-runtimes-listed';\n\nexport interface RuntimeResolution {\n /** Runtime version per language, holding the current pin where unresolved. */\n readonly versions: Record<string, string>;\n /** Languages left on their current pin, and why. */\n readonly unresolved: {\n readonly language: string;\n readonly kept: string;\n readonly reason: UnresolvedReason;\n }[];\n}\n\n/**\n * The latest managed runtime for each language in {@link LAMBDA_RUNTIME_VERSIONS},\n * from the runtime identifiers `aws-cdk-lib` publishes.\n *\n * `Runtime.ALL` is a curated list of the runtimes CDK supports, so a runtime still\n * in public preview does not appear — which is what makes it a usable source for a\n * generally-available runtime. Never moves a runtime backwards: a pin ahead of\n * what CDK offers stays.\n *\n * A language the list says nothing about keeps its current pin and is reported\n * through `unresolved`, so a failure costs this bump alone rather than the whole\n * version update.\n */\nexport const resolveLambdaRuntimes = (\n identifiers: readonly string[],\n): RuntimeResolution => {\n const unresolved: RuntimeResolution['unresolved'][number][] = [];\n\n const versions = Object.fromEntries(\n (Object.keys(LAMBDA_RUNTIME_VERSIONS) as ILambdaRuntime[]).map(\n (language) => {\n const current = LAMBDA_RUNTIME_VERSIONS[language];\n const available = identifiers\n .map(runtimeIdentifierVersion)\n .filter((parsed) => parsed?.language === language)\n .map((parsed) => parsed!.version);\n\n if (available.length === 0) {\n unresolved.push({\n language,\n kept: current,\n reason: 'no-runtimes-listed',\n });\n return [language, current];\n }\n\n const latest = available.reduce((best, version) =>\n compareRuntimeVersions(version, best) > 0 ? version : best,\n );\n\n return [\n language,\n compareRuntimeVersions(latest, current) > 0 ? latest : current,\n ];\n },\n ),\n );\n\n return { versions, unresolved };\n};\n\n/** The warning a language's unresolved runtime reports. */\nexport const unresolvedRuntimeWarning = (\n entry: RuntimeResolution['unresolved'][number],\n): string =>\n `Found no ${entry.language} runtime in the aws-cdk-lib runtime list, so it keeps its pinned runtime (${entry.kept})`;\n
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/utils/lambda-runtime-resolution.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type ILambdaRuntime, LAMBDA_RUNTIME_VERSIONS } from './versions.js';\n\n/**\n * Resolution of the Lambda runtimes and the CPython patch the version update\n * pins.\n *\n * Lives here rather than beside the script so it is covered by the plugin's test\n * suite; the script supplies the runtime list and the uv output.\n */\n\n/** Compare two dotted numeric versions (`24`, `3.14`) ascending. */\nexport const compareRuntimeVersions = (a: string, b: string): number => {\n const left = a.split('.').map(Number);\n const right = b.split('.').map(Number);\n for (let i = 0; i < Math.max(left.length, right.length); i++) {\n const diff = (left[i] ?? 0) - (right[i] ?? 0);\n if (diff !== 0) {\n return diff;\n }\n }\n return 0;\n};\n\n/**\n * The version a managed runtime identifier names, or undefined for one that isn't\n * a versioned `nodejs`/`python` runtime.\n *\n * `nodejs24.x` -> `24`, `python3.14` -> `3.14`. The bare `nodejs` and\n * `nodejs4.3-edge` style identifiers carry no comparable version and are skipped.\n */\nexport const runtimeIdentifierVersion = (\n identifier: string,\n): { language: ILambdaRuntime; version: string } | undefined => {\n const node = /^nodejs(\\d+)\\.x$/.exec(identifier);\n if (node) {\n return { language: 'node', version: node[1] };\n }\n const python = /^python(\\d+\\.\\d+)$/.exec(identifier);\n return python ? { language: 'python', version: python[1] } : undefined;\n};\n\n/** Why a language's runtime could not be resolved. */\nexport type UnresolvedReason = 'no-runtimes-listed';\n\nexport interface RuntimeResolution {\n /** Runtime version per language, holding the current pin where unresolved. */\n readonly versions: Record<string, string>;\n /** Languages left on their current pin, and why. */\n readonly unresolved: {\n readonly language: string;\n readonly kept: string;\n readonly reason: UnresolvedReason;\n }[];\n}\n\n/**\n * The latest managed runtime for each language in {@link LAMBDA_RUNTIME_VERSIONS},\n * from the runtime identifiers `aws-cdk-lib` publishes.\n *\n * `Runtime.ALL` is a curated list of the runtimes CDK supports, so a runtime still\n * in public preview does not appear — which is what makes it a usable source for a\n * generally-available runtime. Never moves a runtime backwards: a pin ahead of\n * what CDK offers stays.\n *\n * A language the list says nothing about keeps its current pin and is reported\n * through `unresolved`, so a failure costs this bump alone rather than the whole\n * version update.\n */\nexport const resolveLambdaRuntimes = (\n identifiers: readonly string[],\n): RuntimeResolution => {\n const unresolved: RuntimeResolution['unresolved'][number][] = [];\n\n const versions = Object.fromEntries(\n (Object.keys(LAMBDA_RUNTIME_VERSIONS) as ILambdaRuntime[]).map(\n (language) => {\n const current = LAMBDA_RUNTIME_VERSIONS[language];\n const available = identifiers\n .map(runtimeIdentifierVersion)\n .filter((parsed) => parsed?.language === language)\n .map((parsed) => parsed!.version);\n\n if (available.length === 0) {\n unresolved.push({\n language,\n kept: current,\n reason: 'no-runtimes-listed',\n });\n return [language, current];\n }\n\n const latest = available.reduce((best, version) =>\n compareRuntimeVersions(version, best) > 0 ? version : best,\n );\n\n return [\n language,\n compareRuntimeVersions(latest, current) > 0 ? latest : current,\n ];\n },\n ),\n );\n\n return { versions, unresolved };\n};\n\n/** The warning a language's unresolved runtime reports. */\nexport const unresolvedRuntimeWarning = (\n entry: RuntimeResolution['unresolved'][number],\n): string =>\n `Found no ${entry.language} runtime in the aws-cdk-lib runtime list, so it keeps its pinned runtime (${entry.kept})`;\n"],"names":["LAMBDA_RUNTIME_VERSIONS","compareRuntimeVersions","a","b","left","split","map","Number","right","i","Math","max","length","diff","runtimeIdentifierVersion","identifier","node","exec","language","version","python","undefined","resolveLambdaRuntimes","identifiers","unresolved","versions","Object","fromEntries","keys","current","available","filter","parsed","push","kept","reason","latest","reduce","best","unresolvedRuntimeWarning","entry"],"mappings":"AAAA;;;CAGC,GACD,SAA8BA,uBAAuB,QAAQ,gBAAgB;AAE7E;;;;;;CAMC,GAED,kEAAkE,GAClE,OAAO,MAAMC,yBAAyB,CAACC,GAAWC;IAChD,MAAMC,OAAOF,EAAEG,KAAK,CAAC,KAAKC,GAAG,CAACC;IAC9B,MAAMC,QA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,QAAQ,IAAInB,UAAUmB;QAGxD,OAAO;YACLpB;YACAjB,uBAAuBmC,QAAQP,WAAW,IAAIO,SAASP;SACxD;IACH;IAIJ,OAAO;QAAEJ;QAAUD;IAAW;AAChC,EAAE;AAEF,yDAAyD,GACzD,OAAO,MAAMe,2BAA2B,CACtCC,QAEA,CAAC,SAAS,EAAEA,MAAMtB,QAAQ,CAAC,0EAA0E,EAAEsB,MAAMN,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -14,8 +14,8 @@ import { type Tree } from '@nx/devkit';
|
|
|
14
14
|
/**
|
|
15
15
|
* Sync the interpreter a uv project pins to the Lambda Python runtime.
|
|
16
16
|
*
|
|
17
|
-
* `.python-version` holds the
|
|
18
|
-
*
|
|
17
|
+
* `.python-version` holds the interpreter and `[project].requires-python` its
|
|
18
|
+
* lower bound; Ruff's `target-version` is derived from the latter, so leaving
|
|
19
19
|
* these behind lints against a different version than the function runs on. Only
|
|
20
20
|
* moved forward, and only from a value this plugin vended.
|
|
21
21
|
*/
|
|
@@ -15,8 +15,8 @@ import { isVendedUpgrade } from "./vended-upgrade.js";
|
|
|
15
15
|
*/ /**
|
|
16
16
|
* Sync the interpreter a uv project pins to the Lambda Python runtime.
|
|
17
17
|
*
|
|
18
|
-
* `.python-version` holds the
|
|
19
|
-
*
|
|
18
|
+
* `.python-version` holds the interpreter and `[project].requires-python` its
|
|
19
|
+
* lower bound; Ruff's `target-version` is derived from the latter, so leaving
|
|
20
20
|
* these behind lints against a different version than the function runs on. Only
|
|
21
21
|
* moved forward, and only from a value this plugin vended.
|
|
22
22
|
*/ export const syncProjectPythonVersion = (tree)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/sync-python-language-version.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateJson, visitNotIgnoredFiles } from '@nx/devkit';\nimport { updateToml } from '../toml.js';\nimport {\n LAMBDA_RUNTIME_VERSIONS,\n pyenvPythonVersion,\n pyprojectPythonDependency,\n} from '../versions.js';\nimport { isVendedUpgrade } from './vended-upgrade.js';\n\n/**\n * Sync the Python language version a generated workspace builds and lints against\n * to the Lambda Python runtime it deploys onto.\n *\n * These are workspace-wide rather than scoped to the infrastructure projects: uv\n * writes a `.python-version` per Python project wherever it sits, and a bundle\n * target lives in the project it belongs to.\n */\n\n/**\n * Sync the interpreter a uv project pins to the Lambda Python runtime.\n *\n * `.python-version` holds the
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/utils/version-upgrade-migration/sync-python-language-version.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { type Tree, updateJson, visitNotIgnoredFiles } from '@nx/devkit';\nimport { updateToml } from '../toml.js';\nimport {\n LAMBDA_RUNTIME_VERSIONS,\n pyenvPythonVersion,\n pyprojectPythonDependency,\n} from '../versions.js';\nimport { isVendedUpgrade } from './vended-upgrade.js';\n\n/**\n * Sync the Python language version a generated workspace builds and lints against\n * to the Lambda Python runtime it deploys onto.\n *\n * These are workspace-wide rather than scoped to the infrastructure projects: uv\n * writes a `.python-version` per Python project wherever it sits, and a bundle\n * target lives in the project it belongs to.\n */\n\n/**\n * Sync the interpreter a uv project pins to the Lambda Python runtime.\n *\n * `.python-version` holds the interpreter and `[project].requires-python` its\n * lower bound; Ruff's `target-version` is derived from the latter, so leaving\n * these behind lints against a different version than the function runs on. Only\n * moved forward, and only from a value this plugin vended.\n */\nexport const syncProjectPythonVersion = (tree: Tree): string[] => {\n const updated: string[] = [];\n const vendedInterpreter = pyenvPythonVersion();\n const vendedRequires = pyprojectPythonDependency();\n\n // Every `.python-version`, not just the root: uv writes one per project too,\n // and a project left behind resolves a different interpreter than it deploys on.\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (path !== '.python-version' && !path.endsWith('/.python-version')) {\n return;\n }\n const declared = (tree.read(path, 'utf-8') ?? '').trim();\n if (declared && isVendedUpgrade(vendedInterpreter, declared)) {\n tree.write(path, `${vendedInterpreter}\\n`);\n updated.push(path);\n }\n });\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (!path.endsWith('pyproject.toml')) {\n return;\n }\n let changed = false;\n updateToml(tree, path, (toml) => {\n const project = toml.project as Record<string, unknown> | undefined;\n const declared = project?.['requires-python'];\n if (typeof declared !== 'string') {\n return toml;\n }\n // Only the `>=<major>.<minor>` shape the generators write, so a specifier\n // the user tightened or widened is theirs to keep.\n const lower = /^>=\\s*(\\d+\\.\\d+)$/.exec(declared.trim());\n if (lower && isVendedUpgrade(LAMBDA_RUNTIME_VERSIONS.python, lower[1])) {\n project!['requires-python'] = vendedRequires;\n changed = true;\n }\n return toml;\n });\n if (changed) {\n updated.push(path);\n }\n });\n\n return updated;\n};\n\n/**\n * Sync the Python version a `bundle` target resolves wheels against.\n *\n * The target pins `--python-platform` but earlier releases pinned no\n * `--python-version`, so wheels resolved against whichever interpreter the build\n * machine had rather than the Lambda runtime. Both the missing flag and a stale\n * one are corrected, keyed on the `uv pip install` the generators write.\n */\nexport const syncPythonBundleVersion = (tree: Tree): string[] => {\n const updated: string[] = [];\n const vended = LAMBDA_RUNTIME_VERSIONS.python;\n\n visitNotIgnoredFiles(tree, '.', (path) => {\n if (!path.endsWith('project.json')) {\n return;\n }\n let changed = false;\n updateJson(tree, path, (json) => {\n for (const target of Object.values(\n (json.targets ?? {}) as Record<string, { options?: unknown }>,\n )) {\n const options = target.options as { commands?: unknown[] } | undefined;\n if (!Array.isArray(options?.commands)) {\n continue;\n }\n options.commands = options.commands.map((command) => {\n if (\n typeof command !== 'string' ||\n !command.includes('uv pip install') ||\n !command.includes('--python-platform')\n ) {\n return command;\n }\n const declared = /--python-version (\\S+)/.exec(command);\n if (!declared) {\n changed = true;\n return command.replace(\n /(--python-platform \\S+)/,\n `$1 --python-version ${vended}`,\n );\n }\n if (isVendedUpgrade(vended, declared[1])) {\n changed = true;\n return command.replace(\n /--python-version \\S+/,\n `--python-version ${vended}`,\n );\n }\n return command;\n });\n }\n return json;\n });\n if (changed) {\n updated.push(path);\n }\n });\n\n return updated;\n};\n"],"names":["updateJson","visitNotIgnoredFiles","updateToml","LAMBDA_RUNTIME_VERSIONS","pyenvPythonVersion","pyprojectPythonDependency","isVendedUpgrade","syncProjectPythonVersion","tree","updated","vendedInterpreter","vendedRequires","path","endsWith","declared","read","trim","write","push","changed","toml","project","lower","exec","python","syncPythonBundleVersion","vended","json","target","Object","values","targets","options","Array","isArray","commands","map","command","includes","replace"],"mappings":"AAAA;;;CAGC,GACD,SAAoBA,UAAU,EAAEC,oBAAoB,QAAQ,aAAa;AACzE,SAASC,UAAU,QAAQ,aAAa;AACxC,SACEC,uBAAuB,EACvBC,kBAAkB,EAClBC,yBAAyB,QACpB,iBAAiB;AACxB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD;;;;;;;CAOC,GAED;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvC,MAAMC,UAAoB,EAAE;IAC5B,MAAMC,oBAAoBN;IAC1B,MAAMO,iBAAiBN;IAEvB,6EAA6E;IAC7E,iFAAiF;IACjFJ,qBAAqBO,MAAM,KAAK,CAACI;QAC/B,IAAIA,SAAS,qBAAqB,CAACA,KAAKC,QAAQ,CAAC,qBAAqB;YACpE;QACF;QACA,MAAMC,WAAW,AAACN,CAAAA,KAAKO,IAAI,CAACH,MAAM,YAAY,EAAC,EAAGI,IAAI;QACtD,IAAIF,YAAYR,gBAAgBI,mBAAmBI,WAAW;YAC5DN,KAAKS,KAAK,CAACL,MAAM,GAAGF,kBAAkB,EAAE,CAAC;YACzCD,QAAQS,IAAI,CAACN;QACf;IACF;IAEAX,qBAAqBO,MAAM,KAAK,CAACI;QAC/B,IAAI,CAACA,KAAKC,QAAQ,CAAC,mBAAmB;YACpC;QACF;Q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AO,CACpB,2BACA,CAAC,oBAAoB,EAAEb,QAAQ;oBAEnC;oBACA,IAAIpB,gBAAgBoB,QAAQZ,QAAQ,CAAC,EAAE,GAAG;wBACxCK,UAAU;wBACV,OAAOkB,QAAQE,OAAO,CACpB,wBACA,CAAC,iBAAiB,EAAEb,QAAQ;oBAEhC;oBACA,OAAOW;gBACT;YACF;YACA,OAAOV;QACT;QACA,IAAIR,SAAS;YACXV,QAAQS,IAAI,CAACN;QACf;IACF;IAEA,OAAOH;AACT,EAAE"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -11,17 +11,17 @@ export declare const TS_VERSIONS: {
|
|
|
11
11
|
readonly '@aws/aws-distro-opentelemetry-node-autoinstrumentation': "0.12.0";
|
|
12
12
|
readonly '@opentelemetry/propagator-jaeger': "2.10.0";
|
|
13
13
|
readonly minimatch: "10.2.6";
|
|
14
|
-
readonly '@aws-sdk/client-dynamodb': "3.
|
|
15
|
-
readonly '@aws-sdk/client-api-gateway': "3.
|
|
16
|
-
readonly '@aws-sdk/client-iam': "3.
|
|
17
|
-
readonly '@aws-sdk/client-bedrock-agentcore': "3.
|
|
18
|
-
readonly '@aws-sdk/client-bedrock-runtime': "3.
|
|
19
|
-
readonly '@aws-sdk/client-s3': "3.
|
|
20
|
-
readonly '@aws-sdk/client-sts': "3.
|
|
21
|
-
readonly '@aws-sdk/credential-providers': "3.
|
|
14
|
+
readonly '@aws-sdk/client-dynamodb': "3.1119.0";
|
|
15
|
+
readonly '@aws-sdk/client-api-gateway': "3.1119.0";
|
|
16
|
+
readonly '@aws-sdk/client-iam': "3.1119.0";
|
|
17
|
+
readonly '@aws-sdk/client-bedrock-agentcore': "3.1119.0";
|
|
18
|
+
readonly '@aws-sdk/client-bedrock-runtime': "3.1119.0";
|
|
19
|
+
readonly '@aws-sdk/client-s3': "3.1119.0";
|
|
20
|
+
readonly '@aws-sdk/client-sts': "3.1119.0";
|
|
21
|
+
readonly '@aws-sdk/credential-providers': "3.1119.0";
|
|
22
22
|
readonly '@aws-sdk/credential-provider-cognito-identity': "3.972.69";
|
|
23
|
-
readonly '@aws-sdk/client-secrets-manager': "3.
|
|
24
|
-
readonly '@aws-sdk/rds-signer': "3.
|
|
23
|
+
readonly '@aws-sdk/client-secrets-manager': "3.1119.0";
|
|
24
|
+
readonly '@aws-sdk/rds-signer': "3.1119.0";
|
|
25
25
|
readonly '@smithy/server-apigateway': "0.3.3";
|
|
26
26
|
readonly '@smithy/server-node': "0.3.3";
|
|
27
27
|
readonly '@aws-lambda-powertools/logger': "2.35.0";
|
|
@@ -29,46 +29,46 @@ export declare const TS_VERSIONS: {
|
|
|
29
29
|
readonly '@aws-lambda-powertools/parameters': "2.35.0";
|
|
30
30
|
readonly '@aws-lambda-powertools/tracer': "2.35.0";
|
|
31
31
|
readonly '@aws-lambda-powertools/parser': "2.35.0";
|
|
32
|
-
readonly '@aws-sdk/client-appconfigdata': "3.
|
|
32
|
+
readonly '@aws-sdk/client-appconfigdata': "3.1119.0";
|
|
33
33
|
readonly '@middy/core': "7.8.0";
|
|
34
34
|
readonly '@nxlv/python': "23.0.0";
|
|
35
35
|
readonly '@nx-extend/terraform': "10.4.1";
|
|
36
|
-
readonly nx: "23.1.
|
|
37
|
-
readonly '@nx/devkit': "23.1.
|
|
38
|
-
readonly '@nx/js': "23.1.
|
|
39
|
-
readonly '@nx/react': "23.1.
|
|
40
|
-
readonly '@nx/vite': "23.1.
|
|
41
|
-
readonly '@nx/vitest': "23.1.
|
|
42
|
-
readonly '@nx/workspace': "23.1.
|
|
43
|
-
readonly 'create-nx-workspace': "23.1.
|
|
36
|
+
readonly nx: "23.1.2";
|
|
37
|
+
readonly '@nx/devkit': "23.1.2";
|
|
38
|
+
readonly '@nx/js': "23.1.2";
|
|
39
|
+
readonly '@nx/react': "23.1.2";
|
|
40
|
+
readonly '@nx/vite': "23.1.2";
|
|
41
|
+
readonly '@nx/vitest': "23.1.2";
|
|
42
|
+
readonly '@nx/workspace': "23.1.2";
|
|
43
|
+
readonly 'create-nx-workspace': "23.1.2";
|
|
44
44
|
readonly '@swc-node/register': "1.12.1";
|
|
45
45
|
readonly '@swc/core': "1.16.1";
|
|
46
46
|
readonly '@modelcontextprotocol/sdk': "1.30.0";
|
|
47
|
-
readonly '@modelcontextprotocol/inspector': "2.
|
|
47
|
+
readonly '@modelcontextprotocol/inspector': "2.4.0";
|
|
48
48
|
readonly '@ag-ui/a2ui-toolkit': "0.0.4";
|
|
49
49
|
readonly '@ag-ui/aws-strands': "0.2.3";
|
|
50
50
|
readonly '@ag-ui/client': "0.0.57";
|
|
51
51
|
readonly '@ag-ui/core': "0.0.57";
|
|
52
52
|
readonly '@ag-ui/encoder': "0.0.57";
|
|
53
53
|
readonly 'agent-chat-cli': "0.3.0";
|
|
54
|
-
readonly '@copilotkit/react-core': "1.69.
|
|
54
|
+
readonly '@copilotkit/react-core': "1.69.2";
|
|
55
55
|
readonly rxjs: "7.8.2";
|
|
56
56
|
readonly '@strands-agents/sdk': "1.14.0";
|
|
57
|
-
readonly '@tanstack/react-router': "1.170.
|
|
58
|
-
readonly '@tanstack/router-plugin': "1.168.
|
|
59
|
-
readonly '@tanstack/router-generator': "1.167.
|
|
57
|
+
readonly '@tanstack/react-router': "1.170.32";
|
|
58
|
+
readonly '@tanstack/router-plugin': "1.168.35";
|
|
59
|
+
readonly '@tanstack/router-generator': "1.167.33";
|
|
60
60
|
readonly '@tanstack/virtual-file-routes': "1.162.0";
|
|
61
61
|
readonly '@tanstack/router-utils': "1.162.2";
|
|
62
62
|
readonly '@cloudscape-design/board-components': "3.0.220";
|
|
63
63
|
readonly '@cloudscape-design/chat-components': "1.0.164";
|
|
64
|
-
readonly '@cloudscape-design/components': "3.0.
|
|
64
|
+
readonly '@cloudscape-design/components': "3.0.1354";
|
|
65
65
|
readonly '@cloudscape-design/global-styles': "1.0.67";
|
|
66
|
-
readonly '@tanstack/react-query': "5.102.
|
|
67
|
-
readonly '@tanstack/react-query-devtools': "5.102.
|
|
66
|
+
readonly '@tanstack/react-query': "5.102.6";
|
|
67
|
+
readonly '@tanstack/react-query-devtools': "5.102.6";
|
|
68
68
|
readonly '@trpc/tanstack-react-query': "11.18.0";
|
|
69
69
|
readonly '@trpc/client': "11.18.0";
|
|
70
70
|
readonly '@trpc/server': "11.18.0";
|
|
71
|
-
readonly '@types/node': "26.
|
|
71
|
+
readonly '@types/node': "26.4.0";
|
|
72
72
|
readonly '@types/aws-lambda': "8.10.162";
|
|
73
73
|
readonly '@types/cors': "2.8.19";
|
|
74
74
|
readonly '@types/pg': "8.23.1";
|
|
@@ -81,11 +81,11 @@ export declare const TS_VERSIONS: {
|
|
|
81
81
|
readonly '@vitest/coverage-v8': "4.1.11";
|
|
82
82
|
readonly '@vitest/ui': "4.1.11";
|
|
83
83
|
readonly '@astrojs/react': "6.0.4";
|
|
84
|
-
readonly '@astrojs/starlight': "0.41.
|
|
85
|
-
readonly astro: "7.2.
|
|
84
|
+
readonly '@astrojs/starlight': "0.41.9";
|
|
85
|
+
readonly astro: "7.2.8";
|
|
86
86
|
readonly cookie: "2.0.1";
|
|
87
87
|
readonly aws4fetch: "1.0.20";
|
|
88
|
-
readonly 'aws-cdk': "2.
|
|
88
|
+
readonly 'aws-cdk': "2.1139.0";
|
|
89
89
|
readonly 'aws-cdk-lib': "2.266.0";
|
|
90
90
|
readonly 'aws-xray-sdk-core': "3.12.0";
|
|
91
91
|
readonly constructs: "10.8.1";
|
|
@@ -100,9 +100,9 @@ export declare const TS_VERSIONS: {
|
|
|
100
100
|
readonly 'event-source-polyfill': "1.0.31";
|
|
101
101
|
readonly '@types/event-source-polyfill': "1.0.5";
|
|
102
102
|
readonly '@biomejs/biome': "2.5.10";
|
|
103
|
-
readonly '@prisma/adapter-mariadb': "7.
|
|
104
|
-
readonly '@prisma/adapter-pg': "7.
|
|
105
|
-
readonly '@prisma/client': "7.
|
|
103
|
+
readonly '@prisma/adapter-mariadb': "7.10.0";
|
|
104
|
+
readonly '@prisma/adapter-pg': "7.10.0";
|
|
105
|
+
readonly '@prisma/client': "7.10.0";
|
|
106
106
|
readonly ejs: "6.0.1";
|
|
107
107
|
readonly '@types/ejs': "3.1.5";
|
|
108
108
|
readonly express: "5.2.1";
|
|
@@ -112,18 +112,18 @@ export declare const TS_VERSIONS: {
|
|
|
112
112
|
readonly '@types/fs-extra': "11.0.4";
|
|
113
113
|
readonly 'make-dir-cli': "4.0.0";
|
|
114
114
|
readonly mariadb: "3.5.3";
|
|
115
|
-
readonly mise: "2026.8.
|
|
115
|
+
readonly mise: "2026.8.14";
|
|
116
116
|
readonly ncp: "2.0.0";
|
|
117
117
|
readonly npm: "12.0.2";
|
|
118
|
-
readonly 'npm-check-updates': "23.0
|
|
118
|
+
readonly 'npm-check-updates': "23.1.0";
|
|
119
119
|
readonly 'oidc-client-ts': "3.5.0";
|
|
120
120
|
readonly pg: "8.23.0";
|
|
121
|
-
readonly prisma: "7.
|
|
121
|
+
readonly prisma: "7.10.0";
|
|
122
122
|
readonly 'react-oidc-context': "3.3.1";
|
|
123
123
|
readonly react: "19.2.8";
|
|
124
124
|
readonly 'react-dom': "19.2.8";
|
|
125
125
|
readonly rimraf: "6.1.3";
|
|
126
|
-
readonly rolldown: "1.2.
|
|
126
|
+
readonly rolldown: "1.2.6";
|
|
127
127
|
readonly 'rolldown-plugin-dts': "0.28.2";
|
|
128
128
|
readonly 'simple-git': "3.36.0";
|
|
129
129
|
readonly 'source-map-support': "0.5.21";
|
|
@@ -131,7 +131,7 @@ export declare const TS_VERSIONS: {
|
|
|
131
131
|
readonly tailwindcss: "4.3.3";
|
|
132
132
|
readonly '@tailwindcss/vite': "4.3.3";
|
|
133
133
|
readonly tsx: "4.23.12";
|
|
134
|
-
readonly 'lucide-react': "1.
|
|
134
|
+
readonly 'lucide-react': "1.34.0";
|
|
135
135
|
readonly 'radix-ui': "1.6.7";
|
|
136
136
|
readonly shadcn: "4.19.0";
|
|
137
137
|
readonly 'tw-animate-css': "1.4.0";
|
|
@@ -162,14 +162,14 @@ export declare const NX_PACKAGES: readonly ["nx", "@nx/devkit", "@nx/js", "@nx/r
|
|
|
162
162
|
* The nx version the plugin is built against, and the single source of truth
|
|
163
163
|
* for every place a workspace's nx is pinned.
|
|
164
164
|
*/
|
|
165
|
-
export declare const NX_VERSION: "23.1.
|
|
165
|
+
export declare const NX_VERSION: "23.1.2";
|
|
166
166
|
/**
|
|
167
167
|
* Versions for Python dependencies added by generators
|
|
168
168
|
*/
|
|
169
169
|
export declare const PY_VERSIONS: {
|
|
170
170
|
readonly 'a2a-sdk': "==0.3.26";
|
|
171
|
-
readonly 'ag-ui-langgraph': "==0.0.
|
|
172
|
-
readonly 'ag-ui-protocol': "==0.1.
|
|
171
|
+
readonly 'ag-ui-langgraph': "==0.0.44";
|
|
172
|
+
readonly 'ag-ui-protocol': "==0.1.21";
|
|
173
173
|
readonly 'ag-ui-strands': "==0.3.0";
|
|
174
174
|
readonly aiosqlite: "==0.22.1";
|
|
175
175
|
readonly 'aws-lambda-powertools': "==3.34.0";
|
|
@@ -177,13 +177,13 @@ export declare const PY_VERSIONS: {
|
|
|
177
177
|
readonly 'aws-lambda-powertools[parser]': "==3.34.0";
|
|
178
178
|
readonly 'aws-opentelemetry-distro': "==0.19.0";
|
|
179
179
|
readonly 'bedrock-agentcore': "==1.22.0";
|
|
180
|
-
readonly boto3: "==1.43.
|
|
181
|
-
readonly checkov: "==3.3.
|
|
180
|
+
readonly boto3: "==1.43.82";
|
|
181
|
+
readonly checkov: "==3.3.15";
|
|
182
182
|
readonly fastapi: "==0.141.1";
|
|
183
183
|
readonly 'fastapi[standard]': "==0.141.1";
|
|
184
184
|
readonly httpx: "==0.28.1";
|
|
185
|
-
readonly langchain: "==1.3.
|
|
186
|
-
readonly 'langchain-aws': "==1.7.
|
|
185
|
+
readonly langchain: "==1.3.18";
|
|
186
|
+
readonly 'langchain-aws': "==1.7.4";
|
|
187
187
|
readonly 'langchain-mcp-adapters': "==0.3.2";
|
|
188
188
|
readonly langgraph: "==1.2.11";
|
|
189
189
|
readonly 'langgraph-checkpoint-aws': "==1.2.2";
|
|
@@ -192,10 +192,10 @@ export declare const PY_VERSIONS: {
|
|
|
192
192
|
readonly 'pip-check-updates': "==0.29.0";
|
|
193
193
|
readonly 'pip-licenses': "==5.5.5";
|
|
194
194
|
readonly ruff: "==0.16.4";
|
|
195
|
-
readonly 'strands-agents': "==1.
|
|
196
|
-
readonly 'strands-agents[a2a]': "==1.
|
|
195
|
+
readonly 'strands-agents': "==1.54.0";
|
|
196
|
+
readonly 'strands-agents[a2a]': "==1.54.0";
|
|
197
197
|
readonly 'strands-agents-tools': "==0.8.6";
|
|
198
|
-
readonly ty: "==0.0.
|
|
198
|
+
readonly ty: "==0.0.75";
|
|
199
199
|
readonly pynamodb: "==6.1.0";
|
|
200
200
|
readonly uvicorn: "==0.52.4";
|
|
201
201
|
readonly sqlmodel: "==0.0.39";
|
|
@@ -226,7 +226,7 @@ export declare const JAVA_VERSIONS: {
|
|
|
226
226
|
readonly 'software.amazon.smithy:smithy-aws-traits': "1.73.0";
|
|
227
227
|
readonly 'software.amazon.smithy:smithy-validation-model': "1.73.0";
|
|
228
228
|
readonly 'software.amazon.smithy:smithy-openapi': "1.73.0";
|
|
229
|
-
readonly 'software.amazon.smithy.typescript:smithy-aws-typescript-codegen': "0.
|
|
229
|
+
readonly 'software.amazon.smithy.typescript:smithy-aws-typescript-codegen': "0.53.0";
|
|
230
230
|
};
|
|
231
231
|
export type IJavaVersion = keyof typeof JAVA_VERSIONS;
|
|
232
232
|
/** The Maven coordinates the version update resolves, in declaration order. */
|
|
@@ -287,17 +287,13 @@ export declare const LAMBDA_RUNTIME_VERSIONS: {
|
|
|
287
287
|
};
|
|
288
288
|
export type ILambdaRuntime = keyof typeof LAMBDA_RUNTIME_VERSIONS;
|
|
289
289
|
/**
|
|
290
|
-
*
|
|
290
|
+
* The interpreter uv pins for a generated Python project, as the Lambda runtime's
|
|
291
|
+
* `major.minor`.
|
|
291
292
|
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*/
|
|
297
|
-
export declare const PYTHON_RUNTIME_PATCH = "7";
|
|
298
|
-
/**
|
|
299
|
-
* The interpreter uv pins for a generated Python project, as `major.minor.patch`.
|
|
300
|
-
* Matches the Lambda Python runtime by construction.
|
|
293
|
+
* No patch: uv reads this as a request for any patch of that minor, so it resolves
|
|
294
|
+
* whichever one the platform has a build for. Naming an exact patch pins one that
|
|
295
|
+
* may not exist everywhere, and Lambda patches the interpreter itself, so the minor
|
|
296
|
+
* is the whole of what a project needs to agree on.
|
|
301
297
|
*/
|
|
302
298
|
export declare const pyenvPythonVersion: () => string;
|
|
303
299
|
/**
|
|
@@ -338,7 +334,7 @@ export declare const terraformLambdaRuntimeVars: () => {
|
|
|
338
334
|
* Pinned exactly (no range operator) so generated infrastructure is reproducible.
|
|
339
335
|
*/
|
|
340
336
|
export declare const TERRAFORM_VERSIONS: {
|
|
341
|
-
readonly aws: "6.
|
|
337
|
+
readonly aws: "6.62.0";
|
|
342
338
|
readonly random: "3.9.0";
|
|
343
339
|
readonly null: "3.3.1";
|
|
344
340
|
readonly archive: "2.8.0";
|
|
@@ -352,7 +348,7 @@ export type ITerraformProviderVersion = keyof typeof TERRAFORM_VERSIONS;
|
|
|
352
348
|
* generated `.tf` templates (e.g. `version = "<%- awsProviderVersion %>"`)
|
|
353
349
|
*/
|
|
354
350
|
export declare const terraformProviderVersions: () => {
|
|
355
|
-
awsProviderVersion: "6.
|
|
351
|
+
awsProviderVersion: "6.62.0";
|
|
356
352
|
randomProviderVersion: "3.9.0";
|
|
357
353
|
nullProviderVersion: "3.3.1";
|
|
358
354
|
archiveProviderVersion: "2.8.0";
|