@aws/nx-plugin 1.0.0-rc.94 → 1.0.0-rc.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/LICENSE-THIRD-PARTY +234 -38
  2. package/migrations.json +54 -1
  3. package/package.json +6 -6
  4. package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -10
  5. package/src/migrations/latest/agent-connection-pin-strands-peers/metadata.json +3 -0
  6. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.d.ts +18 -0
  7. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js +38 -0
  8. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +1 -0
  9. package/src/migrations/latest/ignore-package-manager-temp-files/metadata.json +3 -0
  10. package/src/migrations/latest/ignore-package-manager-temp-files/migration.d.ts +12 -0
  11. package/src/migrations/latest/ignore-package-manager-temp-files/migration.js +25 -0
  12. package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +1 -0
  13. package/src/migrations/latest/rolldown-config-bundle-transient/metadata.json +3 -0
  14. package/src/migrations/latest/rolldown-config-bundle-transient/migration.d.ts +6 -0
  15. package/src/migrations/latest/rolldown-config-bundle-transient/migration.js +80 -0
  16. package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +1 -0
  17. package/src/migrations/latest/shadcn-package-imports-exports/metadata.json +3 -0
  18. package/src/migrations/latest/shadcn-package-imports-exports/migration.d.ts +6 -0
  19. package/src/migrations/latest/shadcn-package-imports-exports/migration.js +184 -0
  20. package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +1 -0
  21. package/src/preset/__snapshots__/generator.spec.ts.snap +8 -6
  22. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  23. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  24. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  25. package/src/py/agent/react-connection/generator.d.ts +29 -0
  26. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +4 -1
  27. package/src/ts/agent/a2a-connection/generator.d.ts +4 -0
  28. package/src/ts/agent/gateway-connection/generator.d.ts +4 -0
  29. package/src/ts/agent/generator.d.ts +4 -0
  30. package/src/ts/agent/mcp-connection/generator.d.ts +4 -0
  31. package/src/ts/agent/react-connection/generator.d.ts +37 -0
  32. package/src/ts/lib/generator.d.ts +13 -0
  33. package/src/ts/lib/generator.js +3 -2
  34. package/src/ts/lib/generator.js.map +1 -1
  35. package/src/ts/lib/ts-project-utils.d.ts +17 -1
  36. package/src/ts/lib/ts-project-utils.js +29 -0
  37. package/src/ts/lib/ts-project-utils.js.map +1 -1
  38. package/src/ts/lib/vitest.d.ts +6 -0
  39. package/src/ts/lib/vitest.js +16 -1
  40. package/src/ts/lib/vitest.js.map +1 -1
  41. package/src/ts/react-website/agui/generator.d.ts +21 -0
  42. package/src/ts/react-website/agui/generator.js +2 -1
  43. package/src/ts/react-website/agui/generator.js.map +1 -1
  44. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +28 -22
  45. package/src/ts/react-website/app/generator.d.ts +42 -0
  46. package/src/ts/react-website/app/generator.js +4 -2
  47. package/src/ts/react-website/app/generator.js.map +1 -1
  48. package/src/utils/agent-connection/agent-connection.d.ts +2 -0
  49. package/src/utils/agent-connection/agent-connection.js +11 -4
  50. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  51. package/src/utils/bundle/bundle.js +10 -0
  52. package/src/utils/bundle/bundle.js.map +1 -1
  53. package/src/utils/dependencies.js +1 -10
  54. package/src/utils/dependencies.js.map +1 -1
  55. package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -1
  56. package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -1
  57. package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -1
  58. package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -1
  59. package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -1
  60. package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -1
  61. package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -1
  62. package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -1
  63. package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +8 -8
  64. package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +1 -1
  65. package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +1 -1
  66. package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -1
  67. package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -1
  68. package/src/utils/files/shadcn/components.json.template +5 -5
  69. package/src/utils/format.d.ts +16 -0
  70. package/src/utils/format.js +15 -0
  71. package/src/utils/format.js.map +1 -1
  72. package/src/utils/init.js +11 -4
  73. package/src/utils/init.js.map +1 -1
  74. package/src/utils/pnpm-workspace.d.ts +5 -5
  75. package/src/utils/pnpm-workspace.js +5 -5
  76. package/src/utils/pnpm-workspace.js.map +1 -1
  77. package/src/utils/shared-shadcn.d.ts +22 -0
  78. package/src/utils/shared-shadcn.js +39 -28
  79. package/src/utils/shared-shadcn.js.map +1 -1
  80. package/src/utils/test.js +15 -0
  81. package/src/utils/test.js.map +1 -1
  82. package/src/utils/version-upgrade-migration/sync-vended-versions.js +4 -4
  83. package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
  84. package/src/utils/versions.d.ts +10 -9
  85. package/src/utils/versions.js +10 -8
  86. package/src/utils/versions.js.map +1 -1
@@ -11,6 +11,19 @@ export declare const DEPENDENCIES: import("../../utils/declared-dependencies.js"
11
11
  readonly name: "vitest";
12
12
  }, {
13
13
  readonly name: "@vitest/coverage-v8";
14
+ }, {
15
+ readonly name: "jsdom";
16
+ }, {
17
+ readonly name: "@nx/vitest";
18
+ readonly dev: true;
19
+ readonly root: true;
20
+ }, {
21
+ readonly name: "@types/node";
22
+ readonly dev: true;
23
+ }, {
24
+ readonly name: "@types/node";
25
+ readonly dev: true;
26
+ readonly root: true;
14
27
  }], readonly import("../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", Record<string, never>>[]>;
15
28
  export declare const TS_LIB_GENERATOR_INFO: NxGeneratorInfo;
16
29
  /**
@@ -13,11 +13,12 @@ import { getNpmScopePrefix } from "../../utils/npm-scope.js";
13
13
  import { addGeneratorMetadata, getGeneratorInfo, mergeTargetDefault, projectExists } from "../../utils/nx.js";
14
14
  import { sortObjectKeys } from "../../utils/object.js";
15
15
  import { getPackageManagerDisplayCommands } from "../../utils/pkg-manager.js";
16
- import { configureTsProject } from "./ts-project-utils.js";
16
+ import { configureTsProject, TS_PROJECT_DEPENDENCIES } from "./ts-project-utils.js";
17
17
  import { VITEST_DEPENDENCIES } from "./vitest.js";
18
18
  export const DEPENDENCIES = declareDependencies()({
19
19
  ts: [
20
- ...VITEST_DEPENDENCIES
20
+ ...VITEST_DEPENDENCIES,
21
+ ...TS_PROJECT_DEPENDENCIES
21
22
  ]
22
23
  });
23
24
  export const TS_LIB_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport { configureTsProject } from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n targets['compile'] = {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n };\n targets['build'] = {\n dependsOn: ['lint', 'compile', 'test'],\n };\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = {\n dependsOn: ['compile'],\n };\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDep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CAACmB,IAAM,OAAOA,MAAM,YAAYA,EAAEN,MAAM,KAAK;SAEhD;QAED,OAAOhB;IACT;IAEA,MAAMnD,gCAAgCqB,MAAM;QAACP;KAAsB;IAEnE,MAAMhB,qBAAqBuB;IAE3B,mFAAmF;IACnF,uEAAuE;IACvE,8EAA8E;IAC9E,OAAO,IACLtB,oBAAoBsB,MAAMC,OAAOoD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n type NxJsonConfiguration,\n OverwriteStrategy,\n readProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { toKebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addGeneratorMetadata,\n getGeneratorInfo,\n mergeTargetDefault,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport type { TsProjectGeneratorSchema } from './schema';\nimport {\n configureTsProject,\n TS_PROJECT_DEPENDENCIES,\n} from './ts-project-utils.js';\nimport { VITEST_DEPENDENCIES } from './vitest.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...VITEST_DEPENDENCIES, ...TS_PROJECT_DEPENDENCIES],\n});\n\nexport const TS_LIB_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Consumes build artifacts produced by a project's dependencies, so a task\n * re-runs when the output it actually reads changes.\n *\n * Test reports are excluded rather than build artifacts included: several\n * generators emit generated sources outside `dist` (an OpenAPI client under a\n * website's `src/generated`, a Smithy SSDK, the Prisma client) and add them to\n * `.gitignore`, which keeps them out of the project's own fileset — so this\n * input is the only thing that hashes them. `reports/` and `coverage/` hold\n * pytest's JUnit and coverage XML, which carry a wall-clock timestamp and so\n * mint a fresh hash on every test run that would cascade through the graph.\n */\nexport const DEPENDENT_TASKS_OUTPUT_FILES_INPUT = {\n dependentTasksOutputFiles: '!{reports,coverage}/**',\n transitive: true,\n};\n\n// Globs this generator has vended for the dependent-task-output input. Any of\n// them is replaced in place, so the entry is neither duplicated nor left at a\n// different scope when a generator re-runs.\nconst VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS = [\n '**/*',\n 'dist/**',\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT.dependentTasksOutputFiles,\n];\n\nexport interface TsLibDetails {\n /**\n * Full package name including scope (eg @foo/bar)\n */\n readonly fullyQualifiedName: string;\n /**\n * Directory of the library relative to the root\n */\n readonly dir: string;\n}\n\n/**\n * Returns details about the TS library to be created\n */\nexport const getTsLibDetails = (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): TsLibDetails => {\n const scope = getNpmScopePrefix(tree);\n const normalizedName = toKebabCase(schema.name);\n const fullyQualifiedName = `${scope}${normalizedName}`;\n // NB: interactive nx generator cli can pass empty string\n const dir = joinPathFragments(\n schema.directory || '.',\n schema.subDirectory || normalizedName,\n );\n return { dir, fullyQualifiedName };\n};\n\n/**\n * Generates a typescript project\n */\nexport const tsProjectGenerator = async (\n tree: Tree,\n schema: TsProjectGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, schema);\n // The module format is workspace-wide, established by the preset when the\n // workspace is created, so vending generators always infer it from the tree.\n const esm = isEsmWorkspace(tree);\n\n // Only scaffold the project on first run; on re-run skip creation so user\n // edits are preserved, but continue to (re)apply the configuration below.\n if (!projectExists(tree, fullyQualifiedName)) {\n await libraryGenerator(tree, {\n ...schema,\n name: fullyQualifiedName,\n directory: dir,\n skipPackageJson: true,\n bundler: 'tsc', // TODO: consider supporting others\n linter: 'none',\n unitTestRunner: 'vitest',\n // Register the @nx/vitest plugin so the test target is inferred rather\n // than emitting the deprecated @nx/vitest:test executor target.\n addPlugin: true,\n });\n\n // Replace with simpler sample source code\n tree.delete(joinPathFragments(dir, 'src'));\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n joinPathFragments(dir),\n {\n fullyQualifiedName,\n esm,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n },\n {\n overwriteStrategy: OverwriteStrategy.KeepExisting,\n },\n );\n }\n await configureTsProject(\n tree,\n {\n dir,\n fullyQualifiedName,\n esm,\n },\n DEPENDENCIES,\n );\n\n const projectConfiguration = readProjectConfiguration(\n tree,\n fullyQualifiedName,\n );\n const targets = projectConfiguration.targets;\n\n targets['compile'] = {\n executor: 'nx:run-commands',\n outputs: ['{workspaceRoot}/dist/{projectRoot}/tsc'],\n options: {\n command: 'tsc --build tsconfig.lib.json',\n cwd: '{projectRoot}',\n },\n };\n targets['build'] = {\n dependsOn: ['lint', 'compile', 'test'],\n };\n // The artifact-only sibling of build, which the deploy targets depend on.\n targets['assemble'] = {\n dependsOn: ['compile'],\n };\n projectConfiguration.targets = sortObjectKeys(targets);\n\n updateProjectConfiguration(tree, fullyQualifiedName, projectConfiguration);\n\n addGeneratorMetadata(tree, fullyQualifiedName, TS_LIB_GENERATOR_INFO);\n\n updateJson(tree, 'nx.json', (nxJson: NxJsonConfiguration) => {\n nxJson.namedInputs = {\n ...nxJson.namedInputs,\n default: [\n ...(nxJson.namedInputs?.default ?? []).filter(\n (input) =>\n typeof input !== 'object' ||\n !('dependentTasksOutputFiles' in input) ||\n !(\n VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS.includes(\n input.dependentTasksOutputFiles as string,\n ) && input.transitive\n ),\n ),\n DEPENDENT_TASKS_OUTPUT_FILES_INPUT,\n ],\n };\n\n const withDefaultInput = (base: Partial<TargetConfiguration>) => ({\n ...base,\n inputs: [\n ...(base.inputs ?? []).filter((i) => i !== 'default'),\n 'default',\n ],\n });\n\n nxJson.targetDefaults = {\n ...nxJson.targetDefaults,\n compile: mergeTargetDefault(nxJson.targetDefaults?.compile, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n build: mergeTargetDefault(nxJson.targetDefaults?.build, (base) => ({\n cache: true,\n ...withDefaultInput(base),\n })),\n test: mergeTargetDefault(nxJson.targetDefaults?.test, withDefaultInput),\n };\n\n // Ensure we only declare a single typescript plugin with the correct settings\n nxJson.plugins = [\n {\n plugin: '@nx/js/typescript',\n options: {\n typecheck: {\n targetName: 'typecheck',\n },\n build: {\n targetName: 'compile',\n configName: 'tsconfig.lib.json',\n buildDepsName: 'build-deps',\n watchDepsName: 'watch-deps',\n },\n },\n },\n ...(nxJson.plugins ?? []).filter(\n (p) => typeof p === 'string' || p.plugin !== '@nx/js/typescript',\n ),\n ];\n\n return nxJson;\n });\n\n await addGeneratorMetricsIfApplicable(tree, [TS_LIB_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n // `installDependencies` ensures vitest resolves for the `typescript` language (the\n // generated vitest.config.mts imports it and Nx loads that config when\n // computing the project graph), so a deferred install still runs when needed.\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\nexport default tsProjectGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","updateProjectConfiguration","libraryGenerator","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","isEsmWorkspace","toKebabCase","getNpmScopePrefix","addGeneratorMetadata","getGeneratorInfo","mergeTargetDefault","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","configureTsProject","TS_PROJECT_DEPENDENCIES","VITEST_DEPENDENCIES","DEPENDENCIES","ts","TS_LIB_GENERATOR_INFO","filename","DEPENDENT_TASKS_OUTPUT_FILES_INPUT","dependentTasksOutputFiles","transitive","VENDED_DEPENDENT_TASKS_OUTPUT_GLOBS","getTsLibDetails","tree","schema","scope","normalizedName","name","fullyQualifiedName","dir","directory","subDirectory","tsProjectGenerator","esm","skipPackageJson","bundler","linter","unitTestRunner","addPlugin","delete","dirname","pkgMgrCmd","exec","overwriteStrategy","KeepExisting","projectConfiguration","targets","executor","outputs","options","command","cwd","dependsOn","nxJson","namedInputs","default","filter","input","includes","withDefaultInput","base","inputs","i","targetDefaults","compile","cache","build","test","plugins","plugin","typecheck","targetName","configName","buildDepsName","watchDepsName","p","preferInstallDependencies","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EAEjBC,iBAAiB,EACjBC,wBAAwB,EAGxBC,UAAU,EACVC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SACEC,oBAAoB,EACpBC,gBAAgB,EAChBC,kBAAkB,EAElBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,6BAA6B;AAE9E,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,wBAAwB;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;AAElD,OAAO,MAAMC,eAAehB,sBAA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cAAc,EAAEC,SAAS,CAACJ,OAAU,CAAA;oBACrEK,OAAO;oBACP,GAAGN,iBAAiBC,KAAK;gBAC3B,CAAA;YACAM,OAAO3D,mBAAmB8C,OAAOU,cAAc,EAAEG,OAAO,CAACN,OAAU,CAAA;oBACjEK,OAAO;oBACP,GAAGN,iBAAiBC,KAAK;gBAC3B,CAAA;YACAO,MAAM5D,mBAAmB8C,OAAOU,cAAc,EAAEI,MAAMR;QACxD;QAEA,8EAA8E;QAC9EN,OAAOe,OAAO,GAAG;YACf;gBACEC,QAAQ;gBACRpB,SAAS;oBACPqB,WAAW;wBACTC,YAAY;oBACd;oBACAL,OAAO;wBACLK,YAAY;wBACZC,YAAY;wBACZC,eAAe;wBACfC,eAAe;oBACjB;gBACF;YACF;eACG,AAACrB,CAAAA,OAAOe,OAAO,IAAI,EAAE,AAAD,EAAGZ,MAAM,CAC9B,CAACmB,IAAM,OAAOA,MAAM,YAAYA,EAAEN,MAAM,KAAK;SAEhD;QAED,OAAOhB;IACT;IAEA,MAAMpD,gCAAgCsB,MAAM;QAACP;KAAsB;IAEnE,MAAMjB,qBAAqBwB;IAE3B,mFAAmF;IACnF,uEAAuE;IACvE,8EAA8E;IAC9E,OAAO,IACLvB,oBAAoBuB,MAAMC,OAAOoD,yBAAyB,EAAE;YAC1DC,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AACF,eAAe7C,mBAAmB"}
@@ -9,6 +9,22 @@ import { type VITEST_DEPENDENCIES } from './vitest.js';
9
9
  interface TsConfigReference {
10
10
  path: string;
11
11
  }
12
+ /**
13
+ * Dependencies a caller must declare to configure a TypeScript project.
14
+ *
15
+ * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so
16
+ * the types must be declared for `tsc` to resolve them. Declared twice: on the
17
+ * project whose tsconfig names them, and at the root, which `@nx/js` seeded until
18
+ * Nx 23.2 stopped.
19
+ */
20
+ export declare const TS_PROJECT_DEPENDENCIES: readonly [{
21
+ readonly name: "@types/node";
22
+ readonly dev: true;
23
+ }, {
24
+ readonly name: "@types/node";
25
+ readonly dev: true;
26
+ readonly root: true;
27
+ }];
12
28
  /**
13
29
  * Merges new TypeScript project references into existing ones, deduplicating by
14
30
  * path and preserving the order of existing references so re-running a
@@ -18,5 +34,5 @@ export declare const mergeTsReferences: (existing: TsConfigReference[] | undefin
18
34
  /**
19
35
  * Updates typescript projects
20
36
  */
21
- export declare const configureTsProject: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>) => Promise<void>;
37
+ export declare const configureTsProject: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D> & MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>) => Promise<void>;
22
38
  export {};
@@ -4,12 +4,31 @@
4
4
  */ import { joinPathFragments, logger, updateJson } from "@nx/devkit";
5
5
  import { join, relative } from "path";
6
6
  import { addLicenseCheckToLintTarget } from "../../license/config.js";
7
+ import { addTsDependencies } from "../../utils/add-dependencies.js";
7
8
  import { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from "../../utils/config/utils.js";
8
9
  import { forDependencies } from "../../utils/declared-dependencies.js";
9
10
  import { isEsmWorkspace } from "../../utils/module-format.js";
10
11
  import { ensureProjectPackageJson } from "../../utils/project-package-json.js";
11
12
  import { configureBiomeLint } from "./biome.js";
12
13
  import { configureVitest } from "./vitest.js";
14
+ /**
15
+ * Dependencies a caller must declare to configure a TypeScript project.
16
+ *
17
+ * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so
18
+ * the types must be declared for `tsc` to resolve them. Declared twice: on the
19
+ * project whose tsconfig names them, and at the root, which `@nx/js` seeded until
20
+ * Nx 23.2 stopped.
21
+ */ export const TS_PROJECT_DEPENDENCIES = [
22
+ {
23
+ name: '@types/node',
24
+ dev: true
25
+ },
26
+ {
27
+ name: '@types/node',
28
+ dev: true,
29
+ root: true
30
+ }
31
+ ];
13
32
  /**
14
33
  * Merges new TypeScript project references into existing ones, deduplicating by
15
34
  * path and preserving the order of existing references so re-running a
@@ -104,6 +123,16 @@ import { configureVitest } from "./vitest.js";
104
123
  fullyQualifiedName: options.fullyQualifiedName,
105
124
  esm
106
125
  });
126
+ // From this helper's constant, not the caller's declaration, which marks these
127
+ // `ownedElsewhere` because the install happens here.
128
+ addTsDependencies(tree, {
129
+ ts: [
130
+ ...TS_PROJECT_DEPENDENCIES
131
+ ],
132
+ py: []
133
+ }, {
134
+ projectRoot: options.dir
135
+ });
107
136
  await configureBiomeLint(tree, options);
108
137
  await configureVitest(tree, options, forDependencies(declaration));
109
138
  // If license checking is configured, make this project's lint target depend
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","root","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName"],"m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AAE;oBACjD;wBAAEK,MAAM,CAAC,EAAE,EAAEM,QAAQK,GAAG,EAAE;oBAAC;iBAC5B;YACH,CAAA;IACF;IACA,wEAAwE;IACxE,0EAA0E;IAC1EtB,yBAAyBgB,MAAM;QAC7BM,KAAKL,QAAQK,GAAG;QAChBc,oBAAoBnB,QAAQmB,kBAAkB;QAC9Cf;IACF;IAEA,MAAMpB,mBAAmBe,MAAMC;IAC/B,MAAMf,gBACJc,MACAC,SACAnB,gBAA4CoB;IAG9C,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,yEAAyE;IACzEtB,4BAA4BoB,MAAMC,QAAQmB,kBAAkB;AAC9D,EAAE"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/ts-project-utils.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, logger, type Tree, updateJson } from '@nx/devkit';\nimport { join, relative } from 'path';\nimport { addLicenseCheckToLintTarget } from '../../license/config.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { AWS_NX_PLUGIN_CONFIG_FILE_NAME } from '../../utils/config/utils.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { ensureProjectPackageJson } from '../../utils/project-package-json.js';\nimport type { ITsDepVersion } from '../../utils/versions.js';\nimport { configureBiomeLint } from './biome.js';\nimport type { ConfigureProjectOptions } from './types.js';\nimport { configureVitest, type VITEST_DEPENDENCIES } from './vitest.js';\n\ninterface TsConfigReference {\n path: string;\n}\n\n/**\n * Dependencies a caller must declare to configure a TypeScript project.\n *\n * `@nx/js` writes `types: ['node']` into every project's `tsconfig.lib.json`, so\n * the types must be declared for `tsc` to resolve them. Declared twice: on the\n * project whose tsconfig names them, and at the root, which `@nx/js` seeded until\n * Nx 23.2 stopped.\n */\nexport const TS_PROJECT_DEPENDENCIES = [\n { name: '@types/node', dev: true },\n { name: '@types/node', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\n/**\n * Merges new TypeScript project references into existing ones, deduplicating by\n * path and preserving the order of existing references so re-running a\n * generator neither duplicates nor reorders references.\n */\nexport const mergeTsReferences = (\n existing: TsConfigReference[] | undefined,\n toAdd: TsConfigReference[],\n): TsConfigReference[] => {\n const references = [...(existing ?? [])];\n const existingPaths = new Set(references.map((ref) => ref.path));\n for (const ref of toAdd) {\n if (!existingPaths.has(ref.path)) {\n references.push(ref);\n existingPaths.add(ref.path);\n }\n }\n return references;\n};\n\n/**\n * Updates typescript projects\n */\nexport const configureTsProject = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D &\n MustDeclare<typeof VITEST_DEPENDENCIES, D> &\n MustDeclare<typeof TS_PROJECT_DEPENDENCIES, D>,\n) => {\n // Point users at init when the workspace hasn't been configured, since\n // lint/format targets and workspace dependency sync depend on it.\n if (!tree.exists(AWS_NX_PLUGIN_CONFIG_FILE_NAME)) {\n logger.warn(\n `This workspace has no ${AWS_NX_PLUGIN_CONFIG_FILE_NAME} — run 'nx g @aws/nx-plugin:init' (or 'nx add @aws/nx-plugin') to configure linting, formatting and workspace dependency sync.`,\n );\n }\n\n // When the caller doesn't specify a module format, infer it from the\n // workspace root package.json (defaulting to ESM for a fresh workspace).\n const esm = options.esm ?? isEsmWorkspace(tree);\n\n // Remove a conflicting `module: commonjs` from the project tsconfig.json\n // (CommonJS is configured on tsconfig.lib.json below when needed).\n updateJson(tree, join(options.dir, 'tsconfig.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n module:\n tsConfig.compilerOptions?.module === 'commonjs'\n ? undefined\n : tsConfig.compilerOptions?.module,\n },\n }));\n const outDirToRootRelativePath = relative(\n join(tree.root, options.dir),\n tree.root,\n );\n const distDir = join(outDirToRootRelativePath, 'dist', options.dir, 'tsc');\n // Remove baseUrl and rootDir from the tsconfig.lib.json\n if (tree.exists(join(options.dir, 'tsconfig.lib.json'))) {\n updateJson(tree, join(options.dir, 'tsconfig.lib.json'), (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n baseUrl: undefined,\n rootDir: '.',\n outDir: distDir,\n tsBuildInfoFile: join(distDir, 'tsconfig.lib.tsbuildinfo'),\n // @nx/js configures the lib for ESM (module `nodenext`). CommonJS\n // projects use `node16`, which honours the workspace's\n // `type: commonjs`, emits CommonJS and resolves extensionless relative\n // imports. (Plain `commonjs`/`node` is deprecated in TypeScript 6.)\n ...(esm ? {} : { module: 'node16', moduleResolution: 'node16' }),\n },\n }));\n }\n // Update root project tsconfig\n updateJson(tree, 'tsconfig.base.json', (tsConfig) => ({\n ...tsConfig,\n compilerOptions: {\n ...tsConfig.compilerOptions,\n // baseUrl is deprecated in TypeScript 6 — use ./ prefix in paths instead\n baseUrl: undefined,\n rootDir: '.',\n paths: {\n ...tsConfig.compilerOptions?.paths,\n [options.fullyQualifiedName]: [\n `./${joinPathFragments(options.dir, 'src', 'index.ts')}`,\n ],\n },\n },\n }));\n if (tree.exists('tsconfig.json')) {\n updateJson(tree, 'tsconfig.json', (tsConfig) => ({\n ...tsConfig,\n // Add project references, deduplicating and preserving existing order\n references: mergeTsReferences(tsConfig.references, [\n { path: `./${options.dir}` },\n ]),\n }));\n }\n // Every project carries a minimal private package.json so the workspace\n // follows the standard npm package layout (see ensureProjectPackageJson).\n ensureProjectPackageJson(tree, {\n dir: options.dir,\n fullyQualifiedName: options.fullyQualifiedName,\n esm,\n });\n\n // From this helper's constant, not the caller's declaration, which marks these\n // `ownedElsewhere` because the install happens here.\n addTsDependencies(\n tree,\n { ts: [...TS_PROJECT_DEPENDENCIES], py: [] },\n { projectRoot: options.dir },\n );\n\n await configureBiomeLint(tree, options);\n await configureVitest(\n tree,\n options,\n forDependencies<typeof VITEST_DEPENDENCIES>(declaration),\n );\n\n // If license checking is configured, make this project's lint target depend\n // on the root license-check target. No-op if there's no license-check target\n // (i.e. the license generator hasn't run); the license generator wires up\n // existing projects itself, so this works regardless of generator order.\n addLicenseCheckToLintTarget(tree, options.fullyQualifiedName);\n};\n"],"names":["joinPathFragments","logger","updateJson","join","relative","addLicenseCheckToLintTarget","addTsDependencies","AWS_NX_PLUGIN_CONFIG_FILE_NAME","forDependencies","isEsmWorkspace","ensureProjectPackageJson","configureBiomeLint","configureVitest","TS_PROJECT_DEPENDENCIES","name","dev","root","mergeTsReferences","existing","toAdd","references","existingPaths","Set","map","ref","path","has","push","add","configureTsProject","tree","options","declaration","exists","warn","esm","dir","tsConfig","compilerOptions","module","undefined","outDirToRootRelativePath","distDir","baseUrl","rootDir","outDir","tsBuildInfoFile","moduleResolution","paths","fullyQualifiedName","ts","py","projectRoot"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,EAAEC,MAAM,EAAaC,UAAU,QAAQ,aAAa;AAC9E,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,8BAA8B,QAAQ,8BAA8B;AAC7E,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,wBAAwB,QAAQ,sCAAsC;AAE/E,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,SAASC,eAAe,QAAkC,cAAc;AAMxE;;;;;;;CAOC,GACD,OAAO,MAAMC,0BAA0B;IACrC;QAAEC,MAAM;QAAeC,KAAK;IAAK;IACjC;QAAED,MAAM;QAAeC,KAAK;QAAMC,MAAM;IAAK;CAC9C,CAIG;AAEJ;;;;CAIC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,UACAC;IAEA,MAAMC,aAAa;WAAKF,YAAY,EAAE;KAAE;IAC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;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,yEAAyE;IACzE3B,4BAA4ByB,MAAMC,QAAQkB,kBAAkB;AAC9D,EAAE"}
@@ -23,5 +23,11 @@ export declare const VITEST_DEPENDENCIES: readonly [{
23
23
  readonly name: "vitest";
24
24
  }, {
25
25
  readonly name: "@vitest/coverage-v8";
26
+ }, {
27
+ readonly name: "jsdom";
28
+ }, {
29
+ readonly name: "@nx/vitest";
30
+ readonly dev: true;
31
+ readonly root: true;
26
32
  }];
27
33
  export declare const configureVitest: <const D extends DependencyDeclaration>(tree: Tree, options: ConfigureProjectOptions, declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>) => Promise<void>;
@@ -57,6 +57,19 @@ const readGritPattern = (name)=>readFileSync(join(import.meta.dirname, 'grit', `
57
57
  },
58
58
  {
59
59
  name: '@vitest/coverage-v8'
60
+ },
61
+ // `@nx/vitest` writes `environment: 'jsdom'` into the config it generates.
62
+ {
63
+ name: 'jsdom'
64
+ },
65
+ // Registered in nx.json as an inferred-target plugin, so it must resolve when
66
+ // Nx builds the project graph. `@nx/js` installed it until Nx 23.2, which now
67
+ // only reaches for it transiently while its generator runs. Like the other nx
68
+ // packages it upgrades through `packageJsonUpdates`, not the version sync.
69
+ {
70
+ name: '@nx/vitest',
71
+ dev: true,
72
+ root: true
60
73
  }
61
74
  ];
62
75
  export const configureVitest = async (tree, options, declaration)=>{
@@ -93,7 +106,9 @@ export const configureVitest = async (tree, options, declaration)=>{
93
106
  addDependenciesToPackageJson(tree, {}, withVersions(forDependencies(declaration), [
94
107
  'vite',
95
108
  'vitest',
96
- '@vitest/coverage-v8'
109
+ '@vitest/coverage-v8',
110
+ 'jsdom',
111
+ '@nx/vitest'
97
112
  ]));
98
113
  };
99
114
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/vitest.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n readNxJson,\n type Tree,\n updateNxJson,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { applyGritQL } from '../../utils/ast.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { addDependenciesToPackageJson } from '../../utils/dependencies.js';\nimport { type ITsDepVersion, withVersions } from '../../utils/versions.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\nconst readGritPattern = (name: string): string =>\n readFileSync(\n join(import.meta.dirname, 'grit', `${name}.grit`),\n 'utf-8',\n ).trim();\n\n/**\n * Resolve the config's `root` from `import.meta.dirname`.\n *\n * `@nx/js` writes `root: __dirname`, which Vite's native config loader does not\n * provide — it warns today and will reject once `configLoader: 'native'` becomes\n * the default. Scoped with `some` to a direct property of the object the config\n * factory returns, so a nested `root` (a `test.alias` entry, say) is untouched.\n */\nconst ROOT_IMPORT_META_DIRNAME = `\\`defineConfig(() => ({ $props }))\\` where {\n $props <: some \\`root: __dirname\\` as $root,\n $root => \\`root: import.meta.dirname\\`\n}`;\n\n/** The `reportsDirectory` `@nx/vitest` writes, resolved against the project root. */\nexport const GENERATED_REPORTS_DIRECTORY = './test-output/vitest/coverage';\n\n/**\n * The coverage directory for a project, as a path relative to the project root\n * (vitest resolves `reportsDirectory` against the config's `root`).\n *\n * Coverage lands under the workspace's `dist` rather than inside the project, so\n * the HTML reporter's vendored assets are neither formatted by the `format`\n * target nor counted as an input to the project's own tasks.\n */\nexport const getCoverageReportsDirectory = (dir: string): string =>\n joinPathFragments(\n relative(join('/', dir), '/'),\n 'dist',\n dir,\n 'test-output/vitest/coverage',\n );\n\n/**\n * Point coverage at the project's `dist` directory.\n *\n * `@nx/vitest` writes `reportsDirectory: './test-output/vitest/coverage'`, which\n * resolves inside the project. Coverage is off by default, so the directory is\n * dormant until someone runs `vitest --coverage` — at which point the HTML\n * reporter's bundled third-party scripts land in the project, where the `format`\n * target reformats them (failing the build from then on) and the `default` named\n * input counts them, so no task in the project can ever be cached again.\n *\n * Anchored to the exact literal `@nx/vitest` generates, and scoped to the\n * `coverage` block of the config's own `test` object, so a directory the user has\n * repointed is left alone.\n */\nconst coverageReportsDirectoryPattern = (dir: string): string =>\n `\\`test: { $props }\\` where {\n $props <: within \\`defineConfig($_)\\`,\n $props <: some \\`coverage: { $cov }\\`,\n $cov <: some \\`reportsDirectory: '${GENERATED_REPORTS_DIRECTORY}'\\` as $reportsDirectory,\n $reportsDirectory => \\`reportsDirectory: '${getCoverageReportsDirectory(dir)}'\\`\n}`;\n\n/** Dependencies a caller must declare to configure vitest. */\nexport const VITEST_DEPENDENCIES = [\n { name: 'vite' },\n { name: 'vitest' },\n { name: '@vitest/coverage-v8' },\n] as const satisfies readonly { name: ITsDepVersion }[];\n\nexport const configureVitest = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>,\n) => {\n // Find vitest.config.mts or vite.config.mts\n const configPath = [\n join(options.dir, 'vitest.config.mts'),\n join(options.dir, 'vite.config.mts'),\n ].find((config) => tree.exists(config));\n\n if (configPath) {\n await applyGritQL(\n tree,\n configPath,\n readGritPattern('vitest-pass-with-no-tests'),\n );\n\n await applyGritQL(tree, configPath, ROOT_IMPORT_META_DIRNAME);\n\n await applyGritQL(\n tree,\n configPath,\n coverageReportsDirectoryPattern(options.dir),\n );\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n targetDefaults: {\n ...(nxJson.targetDefaults ?? {}),\n '@nx/vitest:test': {\n cache: true,\n inputs: ['default', '^production'],\n configurations: {\n 'update-snapshot': {\n args: '--update',\n },\n },\n ...nxJson.targetDefaults['@nx/vitest:test'],\n },\n },\n });\n }\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(forDependencies<typeof VITEST_DEPENDENCIES>(declaration), [\n 'vite',\n 'vitest',\n '@vitest/coverage-v8',\n ]),\n );\n};\n"],"names":["joinPathFragments","readNxJson","updateNxJson","readFileSync","join","relative","applyGritQL","forDependencies","addDependenciesToPackageJson","withVersions","readGritPattern","name","dirname","trim","ROOT_IMPORT_META_DIRNAME","GENERATED_REPORTS_DIRECTORY","getCoverageReportsDirectory","dir","coverageReportsDirectoryPattern","VITEST_DEPENDENCIES","configureVitest","tree","options","declaration","configPath","find","config","exists","nxJson","targetDefaults","cache","inputs","configurations","args"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EACjBC,UAAU,EAEVC,YAAY,QACP,aAAa;AACpB,SAASC,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,4BAA4B,QAAQ,8BAA8B;AAC3E,SAA6BC,YAAY,QAAQ,0BAA0B;AAG3E,MAAMC,kBAAkB,CAACC,OACvBR,aACEC,KAAK,YAAYQ,OAAO,EAAE,QAAQ,GAAGD,KAAK,KAAK,CAAC,GAChD,SACAE,IAAI;AAER;;;;;;;CAOC,GACD,MAAMC,2BAA2B,CAAC;;;CAGjC,CAAC;AAEF,mFAAmF,GACnF,OAAO,MAAMC,8BAA8B,gCAAgC;AAE3E;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CAACC,MAC1CjB,kBACEK,SAASD,KAAK,KAAKa,MAAM,MACzB,QACAA,KACA,+BACA;AAEJ;;;;;;;;;;;;;CAaC,GACD,MAAMC,kCAAkC,CAACD,MACvC,CAAC;;;oCAGiC,EAAEF,4BAA4B;4CACtB,EAAEC,4BAA4BC,KAAK;CAC9E,CAAC;AAEF,4DAA4D,GAC5D,OAAO,MAAME,sBAAsB;IACjC;QAAER,MAAM;IAAO;IACf;QAAEA,MAAM;IAAS;IACjB;QAAEA,MAAM;IAAsB;CAC/B,CAAuD;AAExD,OAAO,MAAMS,kBAAkB,OAC7BC,MACAC,SACAC;IAEA,4CAA4C;IAC5C,MAAMC,aAAa;QACjBpB,KAAKkB,QAAQL,GAAG,EAAE;QAClBb,KAAKkB,QAAQL,GAAG,EAAE;KACnB,CAACQ,IAAI,CAAC,CAACC,SAAWL,KAAKM,MAAM,CAACD;IAE/B,IAAIF,YAAY;QACd,MAAMlB,YACJe,MACAG,YACAd,gBAAgB;QAGlB,MAAMJ,YAAYe,MAAMG,YAAYV;QAEpC,MAAMR,YACJe,MACAG,YACAN,gCAAgCI,QAAQL,GAAG;QAG7C,MAAMW,SAAS3B,WAAWoB;QAC1BnB,aAAamB,MAAM;YACjB,GAAGO,MAAM;YACTC,gBAAgB;gBACd,GAAID,OAAOC,cAAc,IAAI,CAAC,CAAC;gBAC/B,mBAAmB;oBACjBC,OAAO;oBACPC,QAAQ;wBAAC;wBAAW;qBAAc;oBAClCC,gBAAgB;wBACd,mBAAmB;4BACjBC,MAAM;wBACR;oBACF;oBACA,GAAGL,OAAOC,cAAc,CAAC,kBAAkB;gBAC7C;YACF;QACF;IACF;IAEArB,6BACEa,MACA,CAAC,GACDZ,aAAaF,gBAA4CgB,cAAc;QACrE;QACA;QACA;KACD;AAEL,EAAE"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/lib/vitest.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n readNxJson,\n type Tree,\n updateNxJson,\n} from '@nx/devkit';\nimport { readFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { applyGritQL } from '../../utils/ast.js';\nimport {\n type DependencyDeclaration,\n forDependencies,\n type MustDeclare,\n} from '../../utils/declared-dependencies.js';\nimport { addDependenciesToPackageJson } from '../../utils/dependencies.js';\nimport { type ITsDepVersion, withVersions } from '../../utils/versions.js';\nimport type { ConfigureProjectOptions } from './types.js';\n\nconst readGritPattern = (name: string): string =>\n readFileSync(\n join(import.meta.dirname, 'grit', `${name}.grit`),\n 'utf-8',\n ).trim();\n\n/**\n * Resolve the config's `root` from `import.meta.dirname`.\n *\n * `@nx/js` writes `root: __dirname`, which Vite's native config loader does not\n * provide — it warns today and will reject once `configLoader: 'native'` becomes\n * the default. Scoped with `some` to a direct property of the object the config\n * factory returns, so a nested `root` (a `test.alias` entry, say) is untouched.\n */\nconst ROOT_IMPORT_META_DIRNAME = `\\`defineConfig(() => ({ $props }))\\` where {\n $props <: some \\`root: __dirname\\` as $root,\n $root => \\`root: import.meta.dirname\\`\n}`;\n\n/** The `reportsDirectory` `@nx/vitest` writes, resolved against the project root. */\nexport const GENERATED_REPORTS_DIRECTORY = './test-output/vitest/coverage';\n\n/**\n * The coverage directory for a project, as a path relative to the project root\n * (vitest resolves `reportsDirectory` against the config's `root`).\n *\n * Coverage lands under the workspace's `dist` rather than inside the project, so\n * the HTML reporter's vendored assets are neither formatted by the `format`\n * target nor counted as an input to the project's own tasks.\n */\nexport const getCoverageReportsDirectory = (dir: string): string =>\n joinPathFragments(\n relative(join('/', dir), '/'),\n 'dist',\n dir,\n 'test-output/vitest/coverage',\n );\n\n/**\n * Point coverage at the project's `dist` directory.\n *\n * `@nx/vitest` writes `reportsDirectory: './test-output/vitest/coverage'`, which\n * resolves inside the project. Coverage is off by default, so the directory is\n * dormant until someone runs `vitest --coverage` — at which point the HTML\n * reporter's bundled third-party scripts land in the project, where the `format`\n * target reformats them (failing the build from then on) and the `default` named\n * input counts them, so no task in the project can ever be cached again.\n *\n * Anchored to the exact literal `@nx/vitest` generates, and scoped to the\n * `coverage` block of the config's own `test` object, so a directory the user has\n * repointed is left alone.\n */\nconst coverageReportsDirectoryPattern = (dir: string): string =>\n `\\`test: { $props }\\` where {\n $props <: within \\`defineConfig($_)\\`,\n $props <: some \\`coverage: { $cov }\\`,\n $cov <: some \\`reportsDirectory: '${GENERATED_REPORTS_DIRECTORY}'\\` as $reportsDirectory,\n $reportsDirectory => \\`reportsDirectory: '${getCoverageReportsDirectory(dir)}'\\`\n}`;\n\n/** Dependencies a caller must declare to configure vitest. */\nexport const VITEST_DEPENDENCIES = [\n { name: 'vite' },\n { name: 'vitest' },\n { name: '@vitest/coverage-v8' },\n // `@nx/vitest` writes `environment: 'jsdom'` into the config it generates.\n { name: 'jsdom' },\n // Registered in nx.json as an inferred-target plugin, so it must resolve when\n // Nx builds the project graph. `@nx/js` installed it until Nx 23.2, which now\n // only reaches for it transiently while its generator runs. Like the other nx\n // packages it upgrades through `packageJsonUpdates`, not the version sync.\n { name: '@nx/vitest', dev: true, root: true },\n] as const satisfies readonly {\n name: ITsDepVersion;\n dev?: boolean;\n root?: boolean;\n}[];\n\nexport const configureVitest = async <const D extends DependencyDeclaration>(\n tree: Tree,\n options: ConfigureProjectOptions,\n declaration: D & MustDeclare<typeof VITEST_DEPENDENCIES, D>,\n) => {\n // Find vitest.config.mts or vite.config.mts\n const configPath = [\n join(options.dir, 'vitest.config.mts'),\n join(options.dir, 'vite.config.mts'),\n ].find((config) => tree.exists(config));\n\n if (configPath) {\n await applyGritQL(\n tree,\n configPath,\n readGritPattern('vitest-pass-with-no-tests'),\n );\n\n await applyGritQL(tree, configPath, ROOT_IMPORT_META_DIRNAME);\n\n await applyGritQL(\n tree,\n configPath,\n coverageReportsDirectoryPattern(options.dir),\n );\n\n const nxJson = readNxJson(tree);\n updateNxJson(tree, {\n ...nxJson,\n targetDefaults: {\n ...(nxJson.targetDefaults ?? {}),\n '@nx/vitest:test': {\n cache: true,\n inputs: ['default', '^production'],\n configurations: {\n 'update-snapshot': {\n args: '--update',\n },\n },\n ...nxJson.targetDefaults['@nx/vitest:test'],\n },\n },\n });\n }\n\n addDependenciesToPackageJson(\n tree,\n {},\n withVersions(forDependencies<typeof VITEST_DEPENDENCIES>(declaration), [\n 'vite',\n 'vitest',\n '@vitest/coverage-v8',\n 'jsdom',\n '@nx/vitest',\n ]),\n );\n};\n"],"names":["joinPathFragments","readNxJson","updateNxJson","readFileSync","join","relative","applyGritQL","forDependencies","addDependenciesToPackageJson","withVersions","readGritPattern","name","dirname","trim","ROOT_IMPORT_META_DIRNAME","GENERATED_REPORTS_DIRECTORY","getCoverageReportsDirectory","dir","coverageReportsDirectoryPattern","VITEST_DEPENDENCIES","dev","root","configureVitest","tree","options","declaration","configPath","find","config","exists","nxJson","targetDefaults","cache","inputs","configurations","args"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EACjBC,UAAU,EAEVC,YAAY,QACP,aAAa;AACpB,SAASC,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AACtC,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAEEC,eAAe,QAEV,uCAAuC;AAC9C,SAASC,4BAA4B,QAAQ,8BAA8B;AAC3E,SAA6BC,YAAY,QAAQ,0BAA0B;AAG3E,MAAMC,kBAAkB,CAACC,OACvBR,aACEC,KAAK,YAAYQ,OAAO,EAAE,QAAQ,GAAGD,KAAK,KAAK,CAAC,GAChD,SACAE,IAAI;AAER;;;;;;;CAOC,GACD,MAAMC,2BAA2B,CAAC;;;CAGjC,CAAC;AAEF,mFAAmF,GACnF,OAAO,MAAMC,8BAA8B,gCAAgC;AAE3E;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAA8B,CAACC,MAC1CjB,kBACEK,SAASD,KAAK,KAAKa,MAAM,MACzB,QACAA,KACA,+BACA;AAEJ;;;;;;;;;;;;;CAaC,GACD,MAAMC,kCAAkC,CAACD,MACvC,CAAC;;;oCAGiC,EAAEF,4BAA4B;4CACtB,EAAEC,4BAA4BC,KAAK;CAC9E,CAAC;AAEF,4DAA4D,GAC5D,OAAO,MAAME,sBAAsB;IACjC;QAAER,MAAM;IAAO;IACf;QAAEA,MAAM;IAAS;IACjB;QAAEA,MAAM;IAAsB;IAC9B,2EAA2E;IAC3E;QAAEA,MAAM;IAAQ;IAChB,8EAA8E;IAC9E,8EAA8E;IAC9E,8EAA8E;IAC9E,2EAA2E;IAC3E;QAAEA,MAAM;QAAcS,KAAK;QAAMC,MAAM;IAAK;CAC7C,CAIG;AAEJ,OAAO,MAAMC,kBAAkB,OAC7BC,MACAC,SACAC;IAEA,4CAA4C;IAC5C,MAAMC,aAAa;QACjBtB,KAAKoB,QAAQP,GAAG,EAAE;QAClBb,KAAKoB,QAAQP,GAAG,EAAE;KACnB,CAACU,IAAI,CAAC,CAACC,SAAWL,KAAKM,MAAM,CAACD;IAE/B,IAAIF,YAAY;QACd,MAAMpB,YACJiB,MACAG,YACAhB,gBAAgB;QAGlB,MAAMJ,YAAYiB,MAAMG,YAAYZ;QAEpC,MAAMR,YACJiB,MACAG,YACAR,gCAAgCM,QAAQP,GAAG;QAG7C,MAAMa,SAAS7B,WAAWsB;QAC1BrB,aAAaqB,MAAM;YACjB,GAAGO,MAAM;YACTC,gBAAgB;gBACd,GAAID,OAAOC,cAAc,IAAI,CAAC,CAAC;gBAC/B,mBAAmB;oBACjBC,OAAO;oBACPC,QAAQ;wBAAC;wBAAW;qBAAc;oBAClCC,gBAAgB;wBACd,mBAAmB;4BACjBC,MAAM;wBACR;oBACF;oBACA,GAAGL,OAAOC,cAAc,CAAC,kBAAkB;gBAC7C;YACF;QACF;IACF;IAEAvB,6BACEe,MACA,CAAC,GACDd,aAAaF,gBAA4CkB,cAAc;QACrE;QACA;QACA;QACA;QACA;KACD;AAEL,EAAE"}
@@ -81,6 +81,27 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
81
81
  readonly name: "@vitest/coverage-v8";
82
82
  } & {
83
83
  versionOnly: true;
84
+ }, {
85
+ readonly name: "jsdom";
86
+ } & {
87
+ versionOnly: true;
88
+ }, {
89
+ readonly name: "@nx/vitest";
90
+ readonly dev: true;
91
+ readonly root: true;
92
+ } & {
93
+ versionOnly: true;
94
+ }, {
95
+ readonly name: "@types/node";
96
+ readonly dev: true;
97
+ } & {
98
+ versionOnly: true;
99
+ }, {
100
+ readonly name: "@types/node";
101
+ readonly dev: true;
102
+ readonly root: true;
103
+ } & {
104
+ versionOnly: true;
84
105
  }], readonly import("../../../utils/declared-dependencies.js").DeclaredPyDependency<"ruff" | "a2a-sdk" | "ag-ui-langgraph" | "ag-ui-protocol" | "ag-ui-strands" | "aiosqlite" | "aws-lambda-powertools" | "aws-lambda-powertools[tracer]" | "aws-lambda-powertools[parser]" | "aws-opentelemetry-distro" | "bedrock-agentcore" | "boto3" | "checkov" | "fastapi" | "fastapi[standard]" | "httpx" | "langchain" | "langchain-aws" | "langchain-mcp-adapters" | "langgraph" | "langgraph-checkpoint-aws" | "langgraph-checkpoint-sqlite" | "mcp" | "pip-check-updates" | "pip-licenses" | "strands-agents" | "strands-agents[a2a]" | "strands-agents-tools" | "ty" | "pynamodb" | "uvicorn" | "sqlmodel" | "alembic" | "aiomysql" | "asyncpg" | "greenlet", AgUiMetadata>[]>;
85
106
  export type AgUiAuth = 'iam' | 'cognito' | 'none';
86
107
  export type AgUiTheme = 'cloudscape' | 'shadcn' | 'default';
@@ -9,7 +9,7 @@ import { declareDependencies, ownedElsewhere } from "../../../utils/declared-dep
9
9
  import { kebabCase } from "../../../utils/names.js";
10
10
  import { getNpmScopePrefix } from "../../../utils/npm-scope.js";
11
11
  import { registerPnpmBuiltDependencies } from "../../../utils/pnpm-workspace.js";
12
- import { SHADCN_DEPENDENCIES, sharedShadcnGenerator } from "../../../utils/shared-shadcn.js";
12
+ import { addSharedShadcnDependency, SHADCN_DEPENDENCIES, sharedShadcnGenerator } from "../../../utils/shared-shadcn.js";
13
13
  import { runtimeConfigGenerator } from "../runtime-config/generator.js";
14
14
  // Each entry names the theme or auth branch it belongs to, so the same
15
15
  // declaration drives both adding and the version sync.
@@ -90,6 +90,7 @@ export const DEPENDENCIES = declareDependencies()({
90
90
  // Shadcn theme imports from the shared shadcn library, so it must exist.
91
91
  if (theme === 'shadcn') {
92
92
  await sharedShadcnGenerator(tree, DEPENDENCIES);
93
+ addSharedShadcnDependency(tree, frontendProjectConfig.root);
93
94
  }
94
95
  generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', theme), frontendProjectConfig.root, {
95
96
  scopeAlias
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/agui/generator.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 type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport { addAgentRuntimeToConnectionNamespace } from '../../../connection/agent-runtime-config.js';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n addDestructuredImport,\n addSingleImport,\n applyGritQL,\n} from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScopePrefix } from '../../../utils/npm-scope.js';\nimport { registerPnpmBuiltDependencies } from '../../../utils/pnpm-workspace.js';\nimport {\n SHADCN_DEPENDENCIES,\n sharedShadcnGenerator,\n} from '../../../utils/shared-shadcn.js';\nimport { runtimeConfigGenerator } from '../runtime-config/generator.js';\n\n/**\n * The values this helper's predicates read. Its callers record them, so the\n * theme and auth branches taken here can be confirmed at upgrade time.\n */\nexport interface AgUiMetadata {\n readonly theme: string;\n readonly auth: string;\n}\n\n// Each entry names the theme or auth branch it belongs to, so the same\n// declaration drives both adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<AgUiMetadata>()({\n ts: [\n { name: '@copilotkit/react-core' },\n { name: '@ag-ui/client' },\n {\n name: '@cloudscape-design/chat-components',\n when: (m) => m.theme === 'cloudscape',\n },\n { name: 'lucide-react', when: (m) => m.theme === 'shadcn' },\n { name: 'oidc-client-ts', when: (m) => m.auth === 'iam' },\n { name: 'aws4fetch', when: (m) => m.auth === 'iam' },\n {\n name: '@aws-sdk/credential-provider-cognito-identity',\n when: (m) => m.auth === 'iam',\n },\n {\n name: 'react-oidc-context',\n when: (m) => m.auth === 'iam' || m.auth === 'cognito',\n },\n { name: '@smithy/types', when: (m) => m.auth === 'iam', dev: true },\n // `sharedShadcnGenerator` adds these to the shared shadcn project it\n // creates, not to the website.\n ...ownedElsewhere(SHADCN_DEPENDENCIES),\n ],\n});\n\nexport type AgUiAuth = 'iam' | 'cognito' | 'none';\n\nexport type AgUiTheme = 'cloudscape' | 'shadcn' | 'default';\n\nexport interface AgUiReactConnectionOptions {\n /** The React website project to connect FROM */\n frontendProjectConfig: ProjectConfiguration;\n /** The AG-UI agent's exposed name (used as CopilotKit's agent key) */\n agentName: string;\n /** PascalCase class name used for component names and runtime config keys */\n agentNameClassName: string;\n /** Auth scheme used by the agent */\n auth: AgUiAuth;\n /**\n * When set, the generated hook reads the gateway's URL from\n * runtimeConfig.gateways and routes to the agent via the gateway's\n * path-based `/<targetName>/invocations` route instead of invoking the\n * runtime directly. The gateway publishes its own URL to the website, so\n * the agent's construct is left unpatched.\n */\n gatewayRoute?: {\n gatewayClassName: string;\n targetName: string;\n };\n}\n\n/**\n * Wires a React website up to an AG-UI agent using CopilotKit and\n * @ag-ui/client's HttpAgent. Agent-server-language agnostic.\n *\n * On first invocation creates a shared `AguiProvider` component (with an empty\n * `selfManagedAgents` registry) and wraps `<App />` in it. Each invocation\n * AST-patches `AguiProvider` to register one more agent hook — running the\n * generator multiple times is idempotent and additive.\n *\n * Also vends a `src/components/copilot` theme module picked from the\n * website's `metadata.ux` (cloudscape / shadcn / default).\n */\nexport const addAgUiReactConnection = async (\n tree: Tree,\n options: AgUiReactConnectionOptions,\n) => {\n const {\n frontendProjectConfig,\n agentName,\n agentNameClassName,\n auth,\n gatewayRoute,\n } = options;\n\n const theme = resolveAgUiTheme(frontendProjectConfig);\n // The values the declaration's predicates read. Callers record the same pair,\n // so what is added here is exactly what the version sync owns.\n const metadata: AgUiMetadata = { theme, auth };\n const scopeAlias = getNpmScopePrefix(tree);\n\n // Generates `src/components/AguiProvider.tsx` (if absent) and\n // `src/hooks/useAgui<AgentName>.tsx`. Existing files are kept so re-running\n // the generator is idempotent.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n frontendProjectConfig.root,\n { agentName, agentNameClassName, auth, gatewayRoute },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Shadcn theme imports from the shared shadcn library, so it must exist.\n if (theme === 'shadcn') {\n await sharedShadcnGenerator(tree, DEPENDENCIES);\n }\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', theme),\n frontendProjectConfig.root,\n { scopeAlias },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n if (auth === 'iam') {\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n '../../../utils/files/website/hooks/sigv4',\n ),\n joinPathFragments(frontendProjectConfig.sourceRoot, 'hooks'),\n {},\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n await runtimeConfigGenerator(tree, {\n project: frontendProjectConfig.name,\n });\n\n // AST-patch AguiProvider to register this agent's hook\n await registerAgentHookInProvider(\n tree,\n frontendProjectConfig,\n agentNameClassName,\n );\n\n // Wrap <App /> in <AguiProvider> in main.tsx (idempotent)\n const mainTsxPath = joinPathFragments(\n frontendProjectConfig.sourceRoot,\n 'main.tsx',\n );\n await addSingleImport(\n tree,\n mainTsxPath,\n 'AguiProvider',\n './components/AguiProvider',\n );\n await applyGritQL(\n tree,\n mainTsxPath,\n `\\`<App />\\` => \\`<AguiProvider><App /></AguiProvider>\\` where { $program <: not contains \\`<AguiProvider>$_</AguiProvider>\\` }`,\n );\n\n // @copilotkit/react-core transitively pulls in @scarf/scarf (telemetry),\n // which has a postinstall script. Under pnpm 11's default\n // `strictDepBuilds=true` that script is treated as an unreviewed build and\n // fails the install. Register it as an explicitly-rejected build so pnpm\n // knows we've seen it and will skip it instead of erroring.\n registerPnpmBuiltDependencies(tree, { '@scarf/scarf': false });\n\n addTsDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: frontendProjectConfig.root,\n });\n\n // Agents only publish their runtime ARN to the 'agentcore' namespace by\n // default, which isn't exposed to the website. Patch the agent's CDK/TF\n // construct to also publish under 'connection' so the browser can read it\n // from runtime-config.json. When routing via a gateway, the gateway\n // publishes its own URL instead.\n if (!gatewayRoute) {\n await addAgentRuntimeToConnectionNamespace(tree, {\n agentNameKebabCase: kebabCase(agentNameClassName),\n agentNameClassName,\n });\n }\n};\n\n/**\n * The theme module this helper vends, from the website's `metadata.ux`. Callers\n * record the resolved value, so the theme predicates read what the code branches\n * on.\n */\nexport const resolveAgUiTheme = (\n frontendProjectConfig: ProjectConfiguration,\n): AgUiTheme => {\n const ux = (\n (frontendProjectConfig.metadata as any)?.ux as string | undefined\n )?.toLowerCase();\n switch (ux) {\n case 'cloudscape':\n return 'cloudscape';\n case 'shadcn':\n return 'shadcn';\n default:\n return 'default';\n }\n};\n\n/**\n * Register this agent's hook in the shared `AguiProvider` using GritQL AST\n * patches. The provider starts out with an empty `selfManagedAgents` registry\n * (from the template); each call appends:\n * - `import { useAgui<Name> } from '../hooks/useAgui<Name>';`\n * - `const <varName> = useAgui<Name>();` before the `useMemo` call\n * - `...<varName>` into the memoised object literal\n * - `<varName>` into the `useMemo` deps array\n *\n * All steps are guarded so re-running produces byte-identical output.\n */\nconst registerAgentHookInProvider = async (\n tree: Tree,\n frontendProjectConfig: ProjectConfiguration,\n agentNameClassName: string,\n) => {\n const providerPath = joinPathFragments(\n frontendProjectConfig.sourceRoot,\n 'components',\n 'AguiProvider.tsx',\n );\n const hookName = `useAgui${agentNameClassName}`;\n // useAguiStoryAgent -> storyAgentAgents\n const varName = `${agentNameClassName.charAt(0).toLowerCase()}${agentNameClassName.slice(1)}Agents`;\n\n // 1. Add the hook import\n await addDestructuredImport(\n tree,\n providerPath,\n [hookName],\n `../hooks/${hookName}`,\n );\n\n // 2. Insert `const <varName> = <hookName>();` before the useMemo declaration\n await applyGritQL(\n tree,\n providerPath,\n `\\`const selfManagedAgents = useMemo<Record<string, AbstractAgent>>($body, $deps);\\` => ` +\n `\\`const ${varName} = ${hookName}();\\nconst selfManagedAgents = useMemo<Record<string, AbstractAgent>>($body, $deps);\\` ` +\n `where { $program <: not contains \\`const ${varName} = ${hookName}()\\` }`,\n );\n\n // 3. Spread `...<varName>` into the memoised object and add `<varName>` to\n // the deps array. Branches on `{}`/`[]` vs populated so both the\n // first-agent and nth-agent cases produce clean output.\n await applyGritQL(\n tree,\n providerPath,\n `\\`useMemo<Record<string, AbstractAgent>>(() => ($obj), $deps)\\` where {` +\n ` $obj <: not contains \\`...${varName}\\`,` +\n ` if ($obj <: \\`{}\\`) { $obj => \\`{ ...${varName} }\\` }` +\n ` else { $obj <: \\`{$items}\\` where { $items += \\`, ...${varName}\\` } },` +\n ` if ($deps <: \\`[]\\`) { $deps => \\`[${varName}]\\` }` +\n ` else { $deps <: \\`[$dd]\\` where { $dd += \\`, ${varName}\\` } }` +\n ` }`,\n );\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","addAgentRuntimeToConnectionNamespace","addTsDependencies","addDestructuredImport","addSingleImport","applyGritQL","declareDependencies","ownedElsewhere","kebabCase","getNpmScopePrefix","registerPnpmBuiltDependencies","SHADCN_DEPENDENCIES","sharedShadcnGenerator","runtimeConfigGenerator","DEPENDENCIES","ts","name","when","m","theme","auth","dev","addAgUiReactConnection","tree","options","frontendProjectConfig","agentName","agentNameClassName","gatewayRoute","resolveAgUiTheme","metadata","scopeAlias","dirname","root","overwriteStrategy","KeepExisting","sourceRoot","project","registerAgentHookInProvider","mainTsxPath","projectRoot","agentNameKebabCase","ux","toLowerCase","providerPath","hookName","varName","charAt","slice"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,QAGZ,aAAa;AACpB,SAASC,oCAAoC,QAAQ,8CAA8C;AACnG,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SACEC,qBAAqB,EACrBC,eAAe,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,MAAM,CAAC,GAChE,CAAC,EAAE,CAAC;AAEV"}
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/react-website/agui/generator.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 type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport { addAgentRuntimeToConnectionNamespace } from '../../../connection/agent-runtime-config.js';\nimport { addTsDependencies } from '../../../utils/add-dependencies.js';\nimport {\n addDestructuredImport,\n addSingleImport,\n applyGritQL,\n} from '../../../utils/ast.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../../utils/declared-dependencies.js';\nimport { kebabCase } from '../../../utils/names.js';\nimport { getNpmScopePrefix } from '../../../utils/npm-scope.js';\nimport { registerPnpmBuiltDependencies } from '../../../utils/pnpm-workspace.js';\nimport {\n addSharedShadcnDependency,\n SHADCN_DEPENDENCIES,\n sharedShadcnGenerator,\n} from '../../../utils/shared-shadcn.js';\nimport { runtimeConfigGenerator } from '../runtime-config/generator.js';\n\n/**\n * The values this helper's predicates read. Its callers record them, so the\n * theme and auth branches taken here can be confirmed at upgrade time.\n */\nexport interface AgUiMetadata {\n readonly theme: string;\n readonly auth: string;\n}\n\n// Each entry names the theme or auth branch it belongs to, so the same\n// declaration drives both adding and the version sync.\nexport const DEPENDENCIES = declareDependencies<AgUiMetadata>()({\n ts: [\n { name: '@copilotkit/react-core' },\n { name: '@ag-ui/client' },\n {\n name: '@cloudscape-design/chat-components',\n when: (m) => m.theme === 'cloudscape',\n },\n { name: 'lucide-react', when: (m) => m.theme === 'shadcn' },\n { name: 'oidc-client-ts', when: (m) => m.auth === 'iam' },\n { name: 'aws4fetch', when: (m) => m.auth === 'iam' },\n {\n name: '@aws-sdk/credential-provider-cognito-identity',\n when: (m) => m.auth === 'iam',\n },\n {\n name: 'react-oidc-context',\n when: (m) => m.auth === 'iam' || m.auth === 'cognito',\n },\n { name: '@smithy/types', when: (m) => m.auth === 'iam', dev: true },\n // `sharedShadcnGenerator` adds these to the shared shadcn project it\n // creates, not to the website.\n ...ownedElsewhere(SHADCN_DEPENDENCIES),\n ],\n});\n\nexport type AgUiAuth = 'iam' | 'cognito' | 'none';\n\nexport type AgUiTheme = 'cloudscape' | 'shadcn' | 'default';\n\nexport interface AgUiReactConnectionOptions {\n /** The React website project to connect FROM */\n frontendProjectConfig: ProjectConfiguration;\n /** The AG-UI agent's exposed name (used as CopilotKit's agent key) */\n agentName: string;\n /** PascalCase class name used for component names and runtime config keys */\n agentNameClassName: string;\n /** Auth scheme used by the agent */\n auth: AgUiAuth;\n /**\n * When set, the generated hook reads the gateway's URL from\n * runtimeConfig.gateways and routes to the agent via the gateway's\n * path-based `/<targetName>/invocations` route instead of invoking the\n * runtime directly. The gateway publishes its own URL to the website, so\n * the agent's construct is left unpatched.\n */\n gatewayRoute?: {\n gatewayClassName: string;\n targetName: string;\n };\n}\n\n/**\n * Wires a React website up to an AG-UI agent using CopilotKit and\n * @ag-ui/client's HttpAgent. Agent-server-language agnostic.\n *\n * On first invocation creates a shared `AguiProvider` component (with an empty\n * `selfManagedAgents` registry) and wraps `<App />` in it. Each invocation\n * AST-patches `AguiProvider` to register one more agent hook — running the\n * generator multiple times is idempotent and additive.\n *\n * Also vends a `src/components/copilot` theme module picked from the\n * website's `metadata.ux` (cloudscape / shadcn / default).\n */\nexport const addAgUiReactConnection = async (\n tree: Tree,\n options: AgUiReactConnectionOptions,\n) => {\n const {\n frontendProjectConfig,\n agentName,\n agentNameClassName,\n auth,\n gatewayRoute,\n } = options;\n\n const theme = resolveAgUiTheme(frontendProjectConfig);\n // The values the declaration's predicates read. Callers record the same pair,\n // so what is added here is exactly what the version sync owns.\n const metadata: AgUiMetadata = { theme, auth };\n const scopeAlias = getNpmScopePrefix(tree);\n\n // Generates `src/components/AguiProvider.tsx` (if absent) and\n // `src/hooks/useAgui<AgentName>.tsx`. Existing files are kept so re-running\n // the generator is idempotent.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'common'),\n frontendProjectConfig.root,\n { agentName, agentNameClassName, auth, gatewayRoute },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n // Shadcn theme imports from the shared shadcn library, so it must exist.\n if (theme === 'shadcn') {\n await sharedShadcnGenerator(tree, DEPENDENCIES);\n addSharedShadcnDependency(tree, frontendProjectConfig.root);\n }\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', theme),\n frontendProjectConfig.root,\n { scopeAlias },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n if (auth === 'iam') {\n generateFiles(\n tree,\n joinPathFragments(\n import.meta.dirname,\n '../../../utils/files/website/hooks/sigv4',\n ),\n joinPathFragments(frontendProjectConfig.sourceRoot, 'hooks'),\n {},\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n }\n\n await runtimeConfigGenerator(tree, {\n project: frontendProjectConfig.name,\n });\n\n // AST-patch AguiProvider to register this agent's hook\n await registerAgentHookInProvider(\n tree,\n frontendProjectConfig,\n agentNameClassName,\n );\n\n // Wrap <App /> in <AguiProvider> in main.tsx (idempotent)\n const mainTsxPath = joinPathFragments(\n frontendProjectConfig.sourceRoot,\n 'main.tsx',\n );\n await addSingleImport(\n tree,\n mainTsxPath,\n 'AguiProvider',\n './components/AguiProvider',\n );\n await applyGritQL(\n tree,\n mainTsxPath,\n `\\`<App />\\` => \\`<AguiProvider><App /></AguiProvider>\\` where { $program <: not contains \\`<AguiProvider>$_</AguiProvider>\\` }`,\n );\n\n // @copilotkit/react-core transitively pulls in @scarf/scarf (telemetry),\n // which has a postinstall script. Under pnpm 11's default\n // `strictDepBuilds=true` that script is treated as an unreviewed build and\n // fails the install. Register it as an explicitly-rejected build so pnpm\n // knows we've seen it and will skip it instead of erroring.\n registerPnpmBuiltDependencies(tree, { '@scarf/scarf': false });\n\n addTsDependencies(tree, DEPENDENCIES, {\n metadata,\n projectRoot: frontendProjectConfig.root,\n });\n\n // Agents only publish their runtime ARN to the 'agentcore' namespace by\n // default, which isn't exposed to the website. Patch the agent's CDK/TF\n // construct to also publish under 'connection' so the browser can read it\n // from runtime-config.json. When routing via a gateway, the gateway\n // publishes its own URL instead.\n if (!gatewayRoute) {\n await addAgentRuntimeToConnectionNamespace(tree, {\n agentNameKebabCase: kebabCase(agentNameClassName),\n agentNameClassName,\n });\n }\n};\n\n/**\n * The theme module this helper vends, from the website's `metadata.ux`. Callers\n * record the resolved value, so the theme predicates read what the code branches\n * on.\n */\nexport const resolveAgUiTheme = (\n frontendProjectConfig: ProjectConfiguration,\n): AgUiTheme => {\n const ux = (\n (frontendProjectConfig.metadata as any)?.ux as string | undefined\n )?.toLowerCase();\n switch (ux) {\n case 'cloudscape':\n return 'cloudscape';\n case 'shadcn':\n return 'shadcn';\n default:\n return 'default';\n }\n};\n\n/**\n * Register this agent's hook in the shared `AguiProvider` using GritQL AST\n * patches. The provider starts out with an empty `selfManagedAgents` registry\n * (from the template); each call appends:\n * - `import { useAgui<Name> } from '../hooks/useAgui<Name>';`\n * - `const <varName> = useAgui<Name>();` before the `useMemo` call\n * - `...<varName>` into the memoised object literal\n * - `<varName>` into the `useMemo` deps array\n *\n * All steps are guarded so re-running produces byte-identical output.\n */\nconst registerAgentHookInProvider = async (\n tree: Tree,\n frontendProjectConfig: ProjectConfiguration,\n agentNameClassName: string,\n) => {\n const providerPath = joinPathFragments(\n frontendProjectConfig.sourceRoot,\n 'components',\n 'AguiProvider.tsx',\n );\n const hookName = `useAgui${agentNameClassName}`;\n // useAguiStoryAgent -> storyAgentAgents\n const varName = `${agentNameClassName.charAt(0).toLowerCase()}${agentNameClassName.slice(1)}Agents`;\n\n // 1. Add the hook import\n await addDestructuredImport(\n tree,\n providerPath,\n [hookName],\n `../hooks/${hookName}`,\n );\n\n // 2. Insert `const <varName> = <hookName>();` before the useMemo declaration\n await applyGritQL(\n tree,\n providerPath,\n `\\`const selfManagedAgents = useMemo<Record<string, AbstractAgent>>($body, $deps);\\` => ` +\n `\\`const ${varName} = ${hookName}();\\nconst selfManagedAgents = useMemo<Record<string, AbstractAgent>>($body, $deps);\\` ` +\n `where { $program <: not contains \\`const ${varName} = ${hookName}()\\` }`,\n );\n\n // 3. Spread `...<varName>` into the memoised object and add `<varName>` to\n // the deps array. Branches on `{}`/`[]` vs populated so both the\n // first-agent and nth-agent cases produce clean output.\n await applyGritQL(\n tree,\n providerPath,\n `\\`useMemo<Record<string, AbstractAgent>>(() => ($obj), $deps)\\` where {` +\n ` $obj <: not contains \\`...${varName}\\`,` +\n ` if ($obj <: \\`{}\\`) { $obj => \\`{ ...${varName} }\\` }` +\n ` else { $obj <: \\`{$items}\\` where { $items += \\`, ...${varName}\\` } },` +\n ` if ($deps <: \\`[]\\`) { $deps => \\`[${varName}]\\` }` +\n ` else { $deps <: \\`[$dd]\\` where { $dd += \\`, ${varName}\\` } }` +\n ` }`,\n );\n};\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","addAgentRuntimeToConnectionNamespace","addTsDependencies","addDestructuredImport","addSingleImport","applyGritQL","declareDependencies","ownedElsewhere","kebabCase","getNpmScopePrefix","registerPnpmBuiltDependencies","addSharedShadcnDependency","SHADCN_DEPENDENCIES","sharedShadcnGenerator","runtimeConfigGenerator","DEPENDENCIES","ts","name","when","m","theme","auth","dev","addAgUiReactConnection","tree","options","frontendProjectConfig","agentName","agentNameClassName","gatewayRoute","resolveAgUiTheme","metadata","scopeAlias","dirname","root","overwriteStrategy","KeepExisting","sourceRoot","project","registerAgentHookInProvider","mainTsxPath","projectRoot","agentNameKebabCase","ux","toLowerCase","providerPath","hookName","varName","charAt","slice"],"mappings":"AAAA;;;CAGC,GACD,SACEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,QAGZ,aAAa;AACpB,SAASC,oCAAoC,QAAQ,8CAA8C;AACnG,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SACEC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ACzE,CAAC,oCAAoC,EAAEA,QAAQ,KAAK,CAAC,GACrD,CAAC,8CAA8C,EAAEA,QAAQ,MAAM,CAAC,GAChE,CAAC,EAAE,CAAC;AAEV"}
@@ -1058,8 +1058,6 @@ vitest.config.*.timestamp*
1058
1058
  runtime-config.json"
1059
1059
  `;
1060
1060
 
1061
- exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > .prettierrc 1`] = `"{"singleQuote":true}"`;
1062
-
1063
1061
  exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > biome.json 1`] = `
1064
1062
  "{
1065
1063
  "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
@@ -1109,6 +1107,7 @@ exports[`react-website generator > Tanstack router integration > should generate
1109
1107
  "!**/dist",
1110
1108
  "!**/out-tsc",
1111
1109
  "!**/test-output",
1110
+ "!**/rolldown.config.*.*js",
1112
1111
  "!**/node_modules",
1113
1112
  "!**/.nx",
1114
1113
  "!**/.venv",
@@ -1242,11 +1241,11 @@ exports[`react-website generator > Tanstack router integration > should generate
1242
1241
  "name": "@proj/source",
1243
1242
  "dependencies": {},
1244
1243
  "devDependencies": {
1245
- "@nx/js": "23.1.2",
1244
+ "@nx/js": "23.2.0",
1246
1245
  "@nx/react": "catalog:",
1247
- "@nx/vite": "23.1.2",
1248
- "@nx/vitest": "23.1.2",
1249
- "@nx/web": "23.1.2",
1246
+ "@nx/vite": "23.2.0",
1247
+ "@nx/vitest": "catalog:",
1248
+ "@nx/web": "23.2.0",
1250
1249
  "@swc/helpers": "~0.5.18",
1251
1250
  "@tailwindcss/vite": "catalog:",
1252
1251
  "@testing-library/dom": "10.4.0",
@@ -1258,7 +1257,7 @@ exports[`react-website generator > Tanstack router integration > should generate
1258
1257
  "@vitest/coverage-v8": "catalog:",
1259
1258
  "@vitest/ui": "catalog:",
1260
1259
  "jiti": "2.4.2",
1261
- "jsdom": "^27.1.0",
1260
+ "jsdom": "catalog:",
1262
1261
  "typescript": "~6.0.3",
1263
1262
  "vite": "catalog:",
1264
1263
  "vitest": "catalog:"
@@ -2326,19 +2325,21 @@ exports[`react-website generator > Tanstack router integration > should generate
2326
2325
  - test-app
2327
2326
  - packages/common/*
2328
2327
  catalog:
2328
+ '@types/node': 26.4.0
2329
2329
  vite: 8.2.2
2330
2330
  vitest: 4.1.11
2331
2331
  '@vitest/coverage-v8': 4.1.11
2332
+ jsdom: 27.4.0
2333
+ '@nx/vitest': 23.2.0
2332
2334
  constructs: 10.8.1
2333
2335
  aws-cdk-lib: 2.267.0
2334
- '@types/node': 26.4.0
2335
2336
  react: 19.2.8
2336
2337
  react-dom: 19.2.8
2337
2338
  '@cloudscape-design/components': 3.0.1356
2338
2339
  '@cloudscape-design/board-components': 3.0.221
2339
2340
  '@cloudscape-design/global-styles': 1.0.67
2340
2341
  tailwindcss: 4.3.3
2341
- '@nx/react': 23.1.2
2342
+ '@nx/react': 23.2.0
2342
2343
  '@vitest/ui': 4.1.11
2343
2344
  '@tailwindcss/vite': 4.3.3
2344
2345
  "
@@ -2428,7 +2429,9 @@ exports[`react-website generator > Tanstack router integration > should generate
2428
2429
  "react-dom": "catalog:",
2429
2430
  "tailwindcss": "catalog:"
2430
2431
  },
2431
- "devDependencies": {}
2432
+ "devDependencies": {
2433
+ "@types/node": "catalog:"
2434
+ }
2432
2435
  }
2433
2436
  "
2434
2437
  `;
@@ -2907,7 +2910,7 @@ exports[`react-website generator > Tanstack router integration > should generate
2907
2910
  "
2908
2911
  `;
2909
2912
 
2910
- exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > vitest.config.ts 1`] = `
2913
+ exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > vitest.config.mts 1`] = `
2911
2914
  "import { defineConfig } from 'vitest/config';
2912
2915
 
2913
2916
  export default defineConfig({
@@ -2931,8 +2934,6 @@ vitest.config.*.timestamp*
2931
2934
  runtime-config.json"
2932
2935
  `;
2933
2936
 
2934
- exports[`react-website generator > Tanstack router integration > should generate website with router correctly > .prettierrc 1`] = `"{"singleQuote":true}"`;
2935
-
2936
2937
  exports[`react-website generator > Tanstack router integration > should generate website with router correctly > biome.json 1`] = `
2937
2938
  "{
2938
2939
  "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
@@ -2982,6 +2983,7 @@ exports[`react-website generator > Tanstack router integration > should generate
2982
2983
  "!**/dist",
2983
2984
  "!**/out-tsc",
2984
2985
  "!**/test-output",
2986
+ "!**/rolldown.config.*.*js",
2985
2987
  "!**/node_modules",
2986
2988
  "!**/.nx",
2987
2989
  "!**/.venv",
@@ -3115,11 +3117,11 @@ exports[`react-website generator > Tanstack router integration > should generate
3115
3117
  "name": "@proj/source",
3116
3118
  "dependencies": {},
3117
3119
  "devDependencies": {
3118
- "@nx/js": "23.1.2",
3120
+ "@nx/js": "23.2.0",
3119
3121
  "@nx/react": "catalog:",
3120
- "@nx/vite": "23.1.2",
3121
- "@nx/vitest": "23.1.2",
3122
- "@nx/web": "23.1.2",
3122
+ "@nx/vite": "23.2.0",
3123
+ "@nx/vitest": "catalog:",
3124
+ "@nx/web": "23.2.0",
3123
3125
  "@swc/helpers": "~0.5.18",
3124
3126
  "@tailwindcss/vite": "catalog:",
3125
3127
  "@tanstack/router-generator": "catalog:",
@@ -3135,7 +3137,7 @@ exports[`react-website generator > Tanstack router integration > should generate
3135
3137
  "@vitest/coverage-v8": "catalog:",
3136
3138
  "@vitest/ui": "catalog:",
3137
3139
  "jiti": "2.4.2",
3138
- "jsdom": "^27.1.0",
3140
+ "jsdom": "catalog:",
3139
3141
  "typescript": "~6.0.3",
3140
3142
  "vite": "catalog:",
3141
3143
  "vitest": "catalog:"
@@ -4203,12 +4205,14 @@ exports[`react-website generator > Tanstack router integration > should generate
4203
4205
  - test-app
4204
4206
  - packages/common/*
4205
4207
  catalog:
4208
+ '@types/node': 26.4.0
4206
4209
  vite: 8.2.2
4207
4210
  vitest: 4.1.11
4208
4211
  '@vitest/coverage-v8': 4.1.11
4212
+ jsdom: 27.4.0
4213
+ '@nx/vitest': 23.2.0
4209
4214
  constructs: 10.8.1
4210
4215
  aws-cdk-lib: 2.267.0
4211
- '@types/node': 26.4.0
4212
4216
  react: 19.2.8
4213
4217
  react-dom: 19.2.8
4214
4218
  '@cloudscape-design/components': 3.0.1356
@@ -4216,7 +4220,7 @@ catalog:
4216
4220
  '@cloudscape-design/global-styles': 1.0.67
4217
4221
  tailwindcss: 4.3.3
4218
4222
  '@tanstack/react-router': 1.170.32
4219
- '@nx/react': 23.1.2
4223
+ '@nx/react': 23.2.0
4220
4224
  '@vitest/ui': 4.1.11
4221
4225
  '@tailwindcss/vite': 4.3.3
4222
4226
  '@tanstack/router-plugin': 1.168.35
@@ -4311,7 +4315,9 @@ exports[`react-website generator > Tanstack router integration > should generate
4311
4315
  "react-dom": "catalog:",
4312
4316
  "tailwindcss": "catalog:"
4313
4317
  },
4314
- "devDependencies": {}
4318
+ "devDependencies": {
4319
+ "@types/node": "catalog:"
4320
+ }
4315
4321
  }
4316
4322
  "
4317
4323
  `;
@@ -4983,7 +4989,7 @@ exports[`react-website generator > Tanstack router integration > should generate
4983
4989
  "
4984
4990
  `;
4985
4991
 
4986
- exports[`react-website generator > Tanstack router integration > should generate website with router correctly > vitest.config.ts 1`] = `
4992
+ exports[`react-website generator > Tanstack router integration > should generate website with router correctly > vitest.config.mts 1`] = `
4987
4993
  "import { defineConfig } from 'vitest/config';
4988
4994
 
4989
4995
  export default defineConfig({