@aws/nx-plugin 1.0.0-rc.63 → 1.0.0-rc.65

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 (66) hide show
  1. package/migrations.json +17 -2
  2. package/package.json +1 -1
  3. package/src/mcp-server/guide-pipeline.js.map +1 -1
  4. package/src/migrations/latest/rolldown-code-splitting/metadata.json +3 -0
  5. package/src/migrations/latest/rolldown-code-splitting/migration.d.ts +6 -0
  6. package/src/migrations/latest/rolldown-code-splitting/migration.js +57 -0
  7. package/src/migrations/latest/rolldown-code-splitting/migration.js.map +1 -0
  8. package/src/{smithy/project/files/service/build.Dockerfile.template → migrations/latest/smithy-build-without-docker/legacy-service.Dockerfile.fixture} +2 -2
  9. package/src/migrations/latest/smithy-build-without-docker/metadata.json +3 -0
  10. package/src/migrations/latest/smithy-build-without-docker/migration.d.ts +6 -0
  11. package/src/migrations/latest/smithy-build-without-docker/migration.js +154 -0
  12. package/src/migrations/latest/smithy-build-without-docker/migration.js.map +1 -0
  13. package/src/migrations/latest/smithy-ssdk-bundle-pins/rc57-service.Dockerfile.fixture +95 -0
  14. package/src/migrations/latest/vite-config-import-meta-dirname/metadata.json +3 -0
  15. package/src/migrations/latest/vite-config-import-meta-dirname/migration.d.ts +6 -0
  16. package/src/migrations/latest/vite-config-import-meta-dirname/migration.js +71 -0
  17. package/src/migrations/latest/vite-config-import-meta-dirname/migration.js.map +1 -0
  18. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  19. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  20. package/src/py/agent/generator.d.ts +8 -0
  21. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  22. package/src/py/fast-api/generator.d.ts +4 -0
  23. package/src/py/mcp-server/generator.d.ts +8 -0
  24. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +1 -1
  25. package/src/py/rdb/files/migrations/env.py.template +1 -1
  26. package/src/py/rdb/generator.d.ts +8 -0
  27. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +163 -260
  28. package/src/smithy/project/files/service/smithy-build.json.template +5 -5
  29. package/src/smithy/project/files/shapes/smithy-build.json.template +1 -1
  30. package/src/smithy/project/files/ssdk-bundle/ssdk.rolldown.config.mjs.template +52 -0
  31. package/src/smithy/project/generator.d.ts +76 -18
  32. package/src/smithy/project/generator.js +160 -38
  33. package/src/smithy/project/generator.js.map +1 -1
  34. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +22 -3
  35. package/src/smithy/ts/api/generator.d.ts +4 -0
  36. package/src/ts/agent/generator.d.ts +8 -0
  37. package/src/ts/lib/__snapshots__/vitest.spec.ts.snap +1 -1
  38. package/src/ts/lib/vitest.js +12 -0
  39. package/src/ts/lib/vitest.js.map +1 -1
  40. package/src/ts/mcp-server/generator.d.ts +8 -0
  41. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +1 -1
  42. package/src/ts/nx-generator/files/local/generator.spec.ts.template +1 -1
  43. package/src/ts/nx-migration/files/migration.spec.ts.template +1 -1
  44. package/src/ts/nx-migration/generator.js +7 -1
  45. package/src/ts/nx-migration/generator.js.map +1 -1
  46. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +2 -2
  47. package/src/ts/rdb/generator.d.ts +8 -0
  48. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +10 -10
  49. package/src/ts/react-website/app/generator.js +1 -1
  50. package/src/ts/react-website/app/generator.js.map +1 -1
  51. package/src/utils/bundle/bundle.js +1 -1
  52. package/src/utils/bundle/bundle.js.map +1 -1
  53. package/src/utils/docker.d.ts +2 -0
  54. package/src/utils/fs.d.ts +8 -0
  55. package/src/utils/fs.js +11 -0
  56. package/src/utils/fs.js.map +1 -1
  57. package/src/utils/smithy.d.ts +59 -0
  58. package/src/utils/smithy.js +73 -0
  59. package/src/utils/smithy.js.map +1 -0
  60. package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +2 -2
  61. package/src/utils/version-upgrade-migration/sync-embedded-versions.js +53 -5
  62. package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -1
  63. package/src/utils/versions.d.ts +33 -1
  64. package/src/utils/versions.js +26 -1
  65. package/src/utils/versions.js.map +1 -1
  66. package/src/smithy/project/files/shapes/build.Dockerfile.template +0 -33
package/migrations.json CHANGED
@@ -42,6 +42,21 @@
42
42
  "description": "Add a deploy-sandbox target to CDK infrastructure projects which deploys the sandbox stage",
43
43
  "implementation": "./src/migrations/latest/add-deploy-sandbox-target/migration"
44
44
  },
45
+ "latest-smithy-build-without-docker": {
46
+ "version": "1.0.0-rc.64",
47
+ "description": "Build Smithy projects with the Smithy CLI directly rather than in a container, removing the Docker prerequisite",
48
+ "implementation": "./src/migrations/latest/smithy-build-without-docker/migration"
49
+ },
50
+ "latest-vite-config-import-meta-dirname": {
51
+ "version": "1.0.0-rc.65",
52
+ "description": "Resolve vite and vitest config paths from import.meta.dirname rather than __dirname",
53
+ "implementation": "./src/migrations/latest/vite-config-import-meta-dirname/migration"
54
+ },
55
+ "latest-rolldown-code-splitting": {
56
+ "version": "1.0.0-rc.65",
57
+ "description": "Replace the deprecated inlineDynamicImports rolldown output option with codeSplitting",
58
+ "implementation": "./src/migrations/latest/rolldown-code-splitting/migration"
59
+ },
45
60
  "v1.0.0-rc.50-0001-modernize-function-props-cast": {
46
61
  "version": "1.0.0-rc.50",
47
62
  "description": "Replace the legacy angle-bracket FunctionProps type assertion with the modern as syntax in generated API constructs",
@@ -83,14 +98,14 @@
83
98
  "implementation": "./src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/migration"
84
99
  },
85
100
  "sync-vended-versions": {
86
- "version": "1.0.0-rc.63",
101
+ "version": "1.0.0-rc.65",
87
102
  "description": "Sync vended dependency versions and the tracked plugin version to those vended by this release",
88
103
  "implementation": "./src/utils/version-upgrade-migration/migration"
89
104
  }
90
105
  },
91
106
  "packageJsonUpdates": {
92
107
  "nx-23.1.1-nx-packages": {
93
- "version": "1.0.0-rc.63",
108
+ "version": "1.0.0-rc.65",
94
109
  "packages": {
95
110
  "nx": {
96
111
  "version": "23.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.63",
3
+ "version": "1.0.0-rc.65",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/guide-pipeline.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport fs from 'fs';\n/**\n * Unified + remark-mdx pipeline for the MCP `generator-guide` tool.\n *\n * Passes (in order, each over the already-transformed tree):\n * 1. Snippet inlining — `<Snippet name>` → recursive post-process.\n * 2. Filter transforms — `<OptionFilter>`, `<Infrastructure>` slot\n * selection, `<Tabs><TabItem _filter>` pruning.\n * 3. Component transforms — `<NxCommands>` / `<RunGenerator>` /\n * `<GeneratorParameters>` / `<CreateNxWorkspaceCommand>` /\n * `<InstallCommand>` / `<PackageManagerShortCommand>` /\n * `<PackageManagerExecCommand>` render down to markdown.\n */\nimport type { Root, RootContent } from 'mdast';\nimport type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';\nimport {\n buildCreateNxWorkspaceCommand,\n buildInstallCommand,\n buildNxInitCommand,\n buildPackageManagerExecCommand,\n buildPackageManagerShortCommand,\n} from '../utils/commands';\nimport type { NxGeneratorInfo } from '../utils/generators';\nimport {\n buildNxCommand,\n renderGeneratorCommand,\n renderSchema,\n} from './guide-render';\nimport {\n hasBareAttr,\n isJsxElement,\n type JsxElement,\n type JsxParent,\n readEstreeAttr,\n readExpressionAttr,\n readStringAttr,\n} from './mdx-ast';\nimport {\n describePredicate,\n evaluatePredicate,\n extractStringArrayExpression,\n type Predicate,\n parseWhenExpression,\n} from './option-filter';\n\nexport interface PipelineOptions {\n generators: NxGeneratorInfo[];\n packageManager?: string;\n snippetContentProvider?: (name: string) => Promise<string> | string;\n options?: Record<string, string>;\n}\n\n// unified v11 is ESM-only and this package is CJS; dynamic import + rolldown's\n// inlineDynamicImports bundles everything into the published MCP binary.\ninterface RemarkDeps {\n unified: typeof import('unified').unified;\n remarkParse: typeof import('remark-parse').default;\n remarkMdx: typeof import('remark-mdx').default;\n remarkStringify: typeof import('remark-stringify').default;\n remarkFrontmatter: typeof import('remark-frontmatter').default;\n}\n\nlet depsPromise: Promise<RemarkDeps> | undefined;\nconst loadRemarkDeps = (): Promise<RemarkDeps> => {\n if (!depsPromise) {\n depsPromise = (async () => ({\n unified: (await import('unified')).unified,\n remarkParse: (await import('remark-parse')).default,\n remarkMdx: (await import('remark-mdx')).default,\n remarkStringify: (await import('remark-stringify')).default,\n remarkFrontmatter: (await import('remark-frontmatter')).default,\n }))();\n }\n return depsPromise;\n};\n\nconst parseMdxWithDeps = (source: string, deps: RemarkDeps): Root =>\n deps\n .unified()\n .use(deps.remarkParse)\n .use(deps.remarkFrontmatter)\n .use(deps.remarkMdx)\n .parse(source) as Root;\n\n/** Parse MDX (with frontmatter) into mdast. Exposed so callers like\n * `fetchGuideFrontmatters` don't need to re-load remark themselves. */\nexport const parseMdx = async (source: string): Promise<Root> => {\n const deps = await loadRemarkDeps();\n return parseMdxWithDeps(source, deps);\n};\n\nconst stringifyMdx = (tree: Root, deps: RemarkDeps): string =>\n String(\n deps\n .unified()\n .use(deps.remarkFrontmatter)\n .use(deps.remarkMdx)\n .use(deps.remarkStringify, {\n bullet: '-',\n fences: true,\n listItemIndent: 'one',\n })\n .stringify(tree),\n );\n\n/**\n * Remove nodes that are meaningless once the MDX is rendered to plain markdown\n * for an agent: the YAML frontmatter block and the `import`/`export` (ESM)\n * statements at the top of every docs page. They add noise and tokens without\n * conveying guidance.\n */\nconst stripFrontmatterAndEsm = (tree: Root): void => {\n tree.children = tree.children.filter(\n (node) => node.type !== 'yaml' && node.type !== 'mdxjsEsm',\n );\n};\n\nexport const postProcessGuideWithRemark = async (\n guide: string,\n opts: PipelineOptions,\n): Promise<string> => {\n const deps = await loadRemarkDeps();\n const tree = parseMdxWithDeps(guide, deps);\n\n await inlineSnippets(tree, opts, deps);\n applyFilterTransforms(tree, opts.options);\n applyComponentTransforms(tree, opts, deps);\n stripFrontmatterAndEsm(tree);\n\n return stringifyMdx(tree, deps);\n};\n\nconst inlineSnippets = async (\n tree: Root,\n opts: PipelineOptions,\n deps: RemarkDeps,\n): Promise<void> => {\n const provider = opts.snippetContentProvider;\n if (!provider) return;\n\n interface PendingSnippet {\n parent: JsxParent;\n index: number;\n name: string;\n node: JsxElement;\n }\n\n const pending: PendingSnippet[] = [];\n const walk = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n if (child.name === 'Snippet') {\n const name = readStringAttr(child, 'name');\n if (name) pending.push({ parent, index: i, name, node: child });\n continue;\n }\n walk(child);\n }\n };\n walk(tree);\n if (pending.length === 0) return;\n\n const fetched = await Promise.all(\n pending.map(async (p) => {\n let raw = '';\n try {\n raw = await provider(p.name);\n } catch {\n raw = '';\n }\n if (!raw) return { ...p, replacement: undefined };\n const processed = await postProcessGuideWithRemark(raw.trim(), opts);\n return { ...p, replacement: processed };\n }),\n );\n\n // Splice in descending index order per parent so earlier indices stay valid.\n const byParent = new Map<JsxParent, (typeof fetched)[number][]>();\n for (const f of fetched) {\n const bucket = byParent.get(f.parent) ?? [];\n bucket.push(f);\n byParent.set(f.parent, bucket);\n }\n for (const [parent, items] of byParent) {\n items.sort((a, b) => b.index - a.index);\n for (const { index, name, replacement, node } of items) {\n if (replacement === undefined) continue;\n const snippetTree = parseMdxWithDeps(replacement, deps);\n const wrapper: MdxJsxFlowElement = {\n type: 'mdxJsxFlowElement',\n name: 'Snippet',\n attributes: [{ type: 'mdxJsxAttribute', name: 'name', value: name }],\n children: snippetTree.children as MdxJsxFlowElement['children'],\n };\n if ('position' in node && node.position) {\n (wrapper as { position?: unknown }).position = node.position;\n }\n (parent.children as RootContent[]).splice(\n index,\n 1,\n wrapper as RootContent,\n );\n }\n }\n};\n\nconst applyFilterTransforms = (\n tree: Root,\n options: Record<string, string> | undefined,\n): void => {\n const iac = options?.iac;\n\n const transform = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n\n if (child.name === 'OptionFilter') {\n const when = parseWhenAttr(child);\n if (!when) continue; // malformed — leave alone\n // Recurse first so nested filters collapse before we replace this wrapper.\n transform(child);\n const not = hasBareAttr(child, 'not');\n if (options) {\n const replacement = evaluatePredicate(when, not, options)\n ? (child.children as RootContent[])\n : [];\n children.splice(i, 1, ...replacement);\n i += replacement.length - 1;\n } else {\n children.splice(i, 1, buildNoteQuote(child, when, not));\n }\n continue;\n }\n\n if (child.name === 'Infrastructure') {\n if (iac === 'cdk' || iac === 'terraform') {\n const body = selectInfrastructureSlot(child, iac);\n const pseudo: MdxJsxFlowElement = {\n type: 'mdxJsxFlowElement',\n name: 'tmp',\n attributes: [],\n children: body as MdxJsxFlowElement['children'],\n };\n transform(pseudo);\n children.splice(i, 1, ...(pseudo.children as RootContent[]));\n i--;\n continue;\n }\n // No iac → keep both slots so readers / agents see both variants.\n transform(child);\n continue;\n }\n\n if (child.name === 'Tabs' && child.type === 'mdxJsxFlowElement') {\n transform(child);\n const dropped = applyTabsFilter(child, options);\n if (dropped === 'empty') {\n children.splice(i, 1);\n i--;\n continue;\n }\n if (dropped === 'inline') {\n const survivor = (child.children as RootContent[]).find(\n (c): c is MdxJsxFlowElement =>\n isJsxElement(c) && c.name === 'TabItem',\n )!;\n const body = survivor.children as RootContent[];\n children.splice(i, 1, ...body);\n i += body.length - 1;\n continue;\n }\n continue;\n }\n\n transform(child);\n }\n };\n transform(tree);\n};\n\nconst selectInfrastructureSlot = (\n node: JsxElement,\n iac: 'cdk' | 'terraform',\n): RootContent[] => {\n const slotName = iac.toLowerCase();\n const frag = (node.children as RootContent[]).find(\n (c): c is MdxJsxFlowElement =>\n isJsxElement(c) &&\n c.name === 'Fragment' &&\n readStringAttr(c, 'slot') === slotName,\n );\n return (frag?.children as RootContent[]) ?? [];\n};\n\n/**\n * Prune TabItems whose `_filter` doesn't match `options`. Returns:\n * - `'empty'` if the <Tabs> now has no <TabItem>s — caller drops it.\n * - `'inline'` if exactly one filtered <TabItem> survived — caller\n * inlines the body so agents see just the picked variant.\n * - `'keep'` otherwise.\n */\nconst applyTabsFilter = (\n tabs: MdxJsxFlowElement,\n options: Record<string, string> | undefined,\n): 'empty' | 'inline' | 'keep' => {\n const children = tabs.children as RootContent[];\n const surviving: RootContent[] = [];\n let anyFiltered = false;\n for (const child of children) {\n if (!isJsxElement(child) || child.name !== 'TabItem') {\n surviving.push(child);\n continue;\n }\n const filterEstree = readEstreeAttr(child, '_filter');\n if (!filterEstree) {\n surviving.push(child);\n continue;\n }\n anyFiltered = true;\n let predicate: Predicate;\n try {\n predicate = parseWhenExpression(filterEstree as never);\n } catch {\n stripFilterAttr(child);\n surviving.push(child);\n continue;\n }\n if (!options || evaluatePredicate(predicate, false, options)) {\n stripFilterAttr(child);\n surviving.push(child);\n }\n }\n if (anyFiltered) {\n tabs.children = surviving as MdxJsxFlowElement['children'];\n }\n const tabItems = surviving.filter(\n (c) => isJsxElement(c) && c.name === 'TabItem',\n );\n if (tabItems.length === 0 && surviving.length === 0) return 'empty';\n if (anyFiltered && tabItems.length === 1) return 'inline';\n return 'keep';\n};\n\nconst stripFilterAttr = (el: JsxElement): void => {\n el.attributes = el.attributes.filter(\n (a) => !(a.type === 'mdxJsxAttribute' && a.name === '_filter'),\n );\n};\n\n/**\n * `> [!NOTE] Only when …` blockquote. The alert header goes through as an\n * `html` node so remark-stringify doesn't escape the `[`/`]` brackets —\n * downstream agents match on the literal GitHub alert syntax.\n */\nconst buildNoteQuote = (\n source: JsxElement,\n predicate: Predicate,\n not: boolean,\n): RootContent => {\n const marker = describePredicate(predicate, not);\n const description = readStringAttr(source, 'description');\n const headerLines = description\n ? [`[!NOTE] ${marker}`, description]\n : [`[!NOTE] ${marker}`];\n const headerNodes: RootContent[] = headerLines.map(\n (line) => ({ type: 'html', value: line }) as RootContent,\n );\n return {\n type: 'blockquote',\n children: [...headerNodes, ...(source.children as RootContent[])] as never,\n } as RootContent;\n};\n\nconst parseWhenAttr = (node: JsxElement): Predicate | undefined => {\n const estree = readEstreeAttr(node, 'when');\n if (!estree) return undefined;\n try {\n return parseWhenExpression(estree as never);\n } catch {\n return undefined;\n }\n};\n\nconst applyComponentTransforms = (\n tree: Root,\n opts: PipelineOptions,\n deps: RemarkDeps,\n): void => {\n const pm = opts.packageManager ?? 'pnpm';\n const transform = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n const replacement = renderComponent(child, opts, pm, deps);\n if (replacement !== undefined) {\n children.splice(i, 1, ...replacement);\n i += replacement.length - 1;\n continue;\n }\n transform(child);\n }\n };\n transform(tree);\n};\n\nconst renderComponent = (\n node: JsxElement,\n opts: PipelineOptions,\n pm: string,\n deps: RemarkDeps,\n): RootContent[] | undefined => {\n switch (node.name) {\n case 'NxCommands': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands\n .map((c) => buildNxCommand(c, opts.packageManager))\n .join('\\n'),\n ),\n ];\n }\n case 'RunGenerator': {\n const generatorId = readStringAttr(node, 'generator');\n if (!generatorId) return undefined;\n const schema = findSchema(opts.generators, generatorId);\n if (!schema) return undefined;\n return parseMarkdownFragment(\n renderGeneratorCommand(generatorId, schema, opts.packageManager),\n deps,\n );\n }\n case 'GeneratorParameters': {\n const generatorId = readStringAttr(node, 'generator');\n if (!generatorId) return undefined;\n const schema = findSchema(opts.generators, generatorId);\n if (!schema) return undefined;\n return parseMarkdownFragment(renderSchema(schema), deps);\n }\n case 'CreateNxWorkspaceCommand': {\n const workspace = readStringAttr(node, 'workspace');\n if (!workspace) return undefined;\n const iac = readStringAttr(node, 'iac') as\n | 'cdk'\n | 'terraform'\n | undefined;\n return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, iac))];\n }\n case 'NxInitCommand': {\n return [codeBlock(buildNxInitCommand(pm))];\n }\n case 'InstallCommand': {\n // Without `pkg`, installs the workspace's existing dependencies\n const pkg =\n readStringAttr(node, 'pkg') ?? readExpressionAttr(node, 'pkg');\n return [\n codeBlock(buildInstallCommand(pm, pkg, hasBareAttr(node, 'dev'))),\n ];\n }\n case 'PackageManagerShortCommand': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands\n .map((c) => buildPackageManagerShortCommand(pm, c))\n .join('\\n'),\n ),\n ];\n }\n case 'PackageManagerExecCommand': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands.map((c) => buildPackageManagerExecCommand(pm, c)).join('\\n'),\n ),\n ];\n }\n default:\n return undefined;\n }\n};\n\nconst codeBlock = (body: string): RootContent => ({\n type: 'code',\n lang: 'bash',\n value: body,\n});\n\nconst parseMarkdownFragment = (\n markdown: string,\n deps: RemarkDeps,\n): RootContent[] => {\n const fragTree = deps.unified().use(deps.remarkParse).parse(markdown) as Root;\n return fragTree.children as RootContent[];\n};\n\nconst findSchema = (\n generators: NxGeneratorInfo[],\n generatorId: string,\n):\n | { properties?: Record<string, unknown>; required?: string[] }\n | undefined => {\n const info = generators.find((g) => g.id === generatorId);\n if (!info) return undefined;\n try {\n return JSON.parse(fs.readFileSync(info.resolvedSchemaPath, 'utf-8'));\n } catch {\n return undefined;\n }\n};\n\n/** Parse the `commands={[…]}` attribute from the estree that remark-mdx\n * attaches to the JSX attribute value. */\nconst readCommandsAttr = (node: JsxElement): string[] | undefined => {\n const estree = readEstreeAttr(node, 'commands');\n if (!estree) return undefined;\n try {\n return extractStringArrayExpression(estree as never);\n } catch {\n return undefined;\n }\n};\n"],"names":["fs","buildCreateNxWorkspaceCommand","buildInstallCommand","buildNxInitCommand","buildPackageManagerExecCommand","buildPackageManagerShortCommand","buildNxCommand","renderGeneratorCommand","renderSchema","hasBareAttr","isJsxElement","readEstreeAttr","readExpressionAttr","readStringAttr","describePredicate","evaluatePredicate","extractStringArrayExpression","parseWhenExpression","depsPromise","loadRemarkDeps","unified","remarkParse","default","remarkMdx","remarkStringify","remarkFrontmatter","parseMdxWithDeps","source","deps","use","parse","parseMdx","stringifyMdx","tree","String","bullet","fences","listItemIndent","stringify","stripFrontmatterAndEsm","children","filter","node","type","postProcessGuideWithRemark","guide","opts","inlineSnippets","applyFilterTransforms","options","applyComponentTransforms","provider","snippetContentProvider","pending","walk","parent","i","length","child","name","push","index","fetched","Promise","all","map","p","raw","replacement","undefined","processed","trim","byParent","Map","f","bucket","get","set","items","sort","a","b","snippetTree","wrapper","attributes","value","position","splice","iac","transform","when","parseWhenAttr","not","buildNoteQuote","body","selectInfrastructureSlot","pseudo","dropped","applyTabsFilter","survivor","find","c","slotName","toLowerCase","frag","tabs","surviving","anyFiltered","filterEstree","predicate","stripFilterAttr","tabItems","el","marker","description","headerLines","headerNodes","line","estree","pm","packageManager","renderComponent","commands","readCommandsAttr","codeBlock","join","generatorId","schema","findSchema","generators","parseMarkdownFragment","workspace","pkg","lang","markdown","fragTree","info","g","id","JSON","readFileSync","resolvedSchemaPath"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,QAAQ,KAAK;AAepB,SACEC,6BAA6B,EAC7BC,mBAAmB,EACnBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,+BAA+B,QAC1B,uBAAoB;AAE3B,SACEC,cAAc,EACdC,sBAAsB,EACtBC,YAAY,QACP,oBAAiB;AACxB,SACEC,WAAW,EACXC,YAAY,EAGZC,cAAc,EACdC,kBAAkB,EAClBC,cAAc,QACT,eAAY;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,4BAA4B,EAE5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IACtC,EAAE,OAAM;QACN,OAAOjD;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/guide-pipeline.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport fs from 'fs';\n/**\n * Unified + remark-mdx pipeline for the MCP `generator-guide` tool.\n *\n * Passes (in order, each over the already-transformed tree):\n * 1. Snippet inlining — `<Snippet name>` → recursive post-process.\n * 2. Filter transforms — `<OptionFilter>`, `<Infrastructure>` slot\n * selection, `<Tabs><TabItem _filter>` pruning.\n * 3. Component transforms — `<NxCommands>` / `<RunGenerator>` /\n * `<GeneratorParameters>` / `<CreateNxWorkspaceCommand>` /\n * `<InstallCommand>` / `<PackageManagerShortCommand>` /\n * `<PackageManagerExecCommand>` render down to markdown.\n */\nimport type { Root, RootContent } from 'mdast';\nimport type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';\nimport {\n buildCreateNxWorkspaceCommand,\n buildInstallCommand,\n buildNxInitCommand,\n buildPackageManagerExecCommand,\n buildPackageManagerShortCommand,\n} from '../utils/commands';\nimport type { NxGeneratorInfo } from '../utils/generators';\nimport {\n buildNxCommand,\n renderGeneratorCommand,\n renderSchema,\n} from './guide-render';\nimport {\n hasBareAttr,\n isJsxElement,\n type JsxElement,\n type JsxParent,\n readEstreeAttr,\n readExpressionAttr,\n readStringAttr,\n} from './mdx-ast';\nimport {\n describePredicate,\n evaluatePredicate,\n extractStringArrayExpression,\n type Predicate,\n parseWhenExpression,\n} from './option-filter';\n\nexport interface PipelineOptions {\n generators: NxGeneratorInfo[];\n packageManager?: string;\n snippetContentProvider?: (name: string) => Promise<string> | string;\n options?: Record<string, string>;\n}\n\n// unified v11 is ESM-only and this package is CJS; dynamic import + rolldown's\n// `codeSplitting: false` bundles everything into the published MCP binary.\ninterface RemarkDeps {\n unified: typeof import('unified').unified;\n remarkParse: typeof import('remark-parse').default;\n remarkMdx: typeof import('remark-mdx').default;\n remarkStringify: typeof import('remark-stringify').default;\n remarkFrontmatter: typeof import('remark-frontmatter').default;\n}\n\nlet depsPromise: Promise<RemarkDeps> | undefined;\nconst loadRemarkDeps = (): Promise<RemarkDeps> => {\n if (!depsPromise) {\n depsPromise = (async () => ({\n unified: (await import('unified')).unified,\n remarkParse: (await import('remark-parse')).default,\n remarkMdx: (await import('remark-mdx')).default,\n remarkStringify: (await import('remark-stringify')).default,\n remarkFrontmatter: (await import('remark-frontmatter')).default,\n }))();\n }\n return depsPromise;\n};\n\nconst parseMdxWithDeps = (source: string, deps: RemarkDeps): Root =>\n deps\n .unified()\n .use(deps.remarkParse)\n .use(deps.remarkFrontmatter)\n .use(deps.remarkMdx)\n .parse(source) as Root;\n\n/** Parse MDX (with frontmatter) into mdast. Exposed so callers like\n * `fetchGuideFrontmatters` don't need to re-load remark themselves. */\nexport const parseMdx = async (source: string): Promise<Root> => {\n const deps = await loadRemarkDeps();\n return parseMdxWithDeps(source, deps);\n};\n\nconst stringifyMdx = (tree: Root, deps: RemarkDeps): string =>\n String(\n deps\n .unified()\n .use(deps.remarkFrontmatter)\n .use(deps.remarkMdx)\n .use(deps.remarkStringify, {\n bullet: '-',\n fences: true,\n listItemIndent: 'one',\n })\n .stringify(tree),\n );\n\n/**\n * Remove nodes that are meaningless once the MDX is rendered to plain markdown\n * for an agent: the YAML frontmatter block and the `import`/`export` (ESM)\n * statements at the top of every docs page. They add noise and tokens without\n * conveying guidance.\n */\nconst stripFrontmatterAndEsm = (tree: Root): void => {\n tree.children = tree.children.filter(\n (node) => node.type !== 'yaml' && node.type !== 'mdxjsEsm',\n );\n};\n\nexport const postProcessGuideWithRemark = async (\n guide: string,\n opts: PipelineOptions,\n): Promise<string> => {\n const deps = await loadRemarkDeps();\n const tree = parseMdxWithDeps(guide, deps);\n\n await inlineSnippets(tree, opts, deps);\n applyFilterTransforms(tree, opts.options);\n applyComponentTransforms(tree, opts, deps);\n stripFrontmatterAndEsm(tree);\n\n return stringifyMdx(tree, deps);\n};\n\nconst inlineSnippets = async (\n tree: Root,\n opts: PipelineOptions,\n deps: RemarkDeps,\n): Promise<void> => {\n const provider = opts.snippetContentProvider;\n if (!provider) return;\n\n interface PendingSnippet {\n parent: JsxParent;\n index: number;\n name: string;\n node: JsxElement;\n }\n\n const pending: PendingSnippet[] = [];\n const walk = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n if (child.name === 'Snippet') {\n const name = readStringAttr(child, 'name');\n if (name) pending.push({ parent, index: i, name, node: child });\n continue;\n }\n walk(child);\n }\n };\n walk(tree);\n if (pending.length === 0) return;\n\n const fetched = await Promise.all(\n pending.map(async (p) => {\n let raw = '';\n try {\n raw = await provider(p.name);\n } catch {\n raw = '';\n }\n if (!raw) return { ...p, replacement: undefined };\n const processed = await postProcessGuideWithRemark(raw.trim(), opts);\n return { ...p, replacement: processed };\n }),\n );\n\n // Splice in descending index order per parent so earlier indices stay valid.\n const byParent = new Map<JsxParent, (typeof fetched)[number][]>();\n for (const f of fetched) {\n const bucket = byParent.get(f.parent) ?? [];\n bucket.push(f);\n byParent.set(f.parent, bucket);\n }\n for (const [parent, items] of byParent) {\n items.sort((a, b) => b.index - a.index);\n for (const { index, name, replacement, node } of items) {\n if (replacement === undefined) continue;\n const snippetTree = parseMdxWithDeps(replacement, deps);\n const wrapper: MdxJsxFlowElement = {\n type: 'mdxJsxFlowElement',\n name: 'Snippet',\n attributes: [{ type: 'mdxJsxAttribute', name: 'name', value: name }],\n children: snippetTree.children as MdxJsxFlowElement['children'],\n };\n if ('position' in node && node.position) {\n (wrapper as { position?: unknown }).position = node.position;\n }\n (parent.children as RootContent[]).splice(\n index,\n 1,\n wrapper as RootContent,\n );\n }\n }\n};\n\nconst applyFilterTransforms = (\n tree: Root,\n options: Record<string, string> | undefined,\n): void => {\n const iac = options?.iac;\n\n const transform = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n\n if (child.name === 'OptionFilter') {\n const when = parseWhenAttr(child);\n if (!when) continue; // malformed — leave alone\n // Recurse first so nested filters collapse before we replace this wrapper.\n transform(child);\n const not = hasBareAttr(child, 'not');\n if (options) {\n const replacement = evaluatePredicate(when, not, options)\n ? (child.children as RootContent[])\n : [];\n children.splice(i, 1, ...replacement);\n i += replacement.length - 1;\n } else {\n children.splice(i, 1, buildNoteQuote(child, when, not));\n }\n continue;\n }\n\n if (child.name === 'Infrastructure') {\n if (iac === 'cdk' || iac === 'terraform') {\n const body = selectInfrastructureSlot(child, iac);\n const pseudo: MdxJsxFlowElement = {\n type: 'mdxJsxFlowElement',\n name: 'tmp',\n attributes: [],\n children: body as MdxJsxFlowElement['children'],\n };\n transform(pseudo);\n children.splice(i, 1, ...(pseudo.children as RootContent[]));\n i--;\n continue;\n }\n // No iac → keep both slots so readers / agents see both variants.\n transform(child);\n continue;\n }\n\n if (child.name === 'Tabs' && child.type === 'mdxJsxFlowElement') {\n transform(child);\n const dropped = applyTabsFilter(child, options);\n if (dropped === 'empty') {\n children.splice(i, 1);\n i--;\n continue;\n }\n if (dropped === 'inline') {\n const survivor = (child.children as RootContent[]).find(\n (c): c is MdxJsxFlowElement =>\n isJsxElement(c) && c.name === 'TabItem',\n )!;\n const body = survivor.children as RootContent[];\n children.splice(i, 1, ...body);\n i += body.length - 1;\n continue;\n }\n continue;\n }\n\n transform(child);\n }\n };\n transform(tree);\n};\n\nconst selectInfrastructureSlot = (\n node: JsxElement,\n iac: 'cdk' | 'terraform',\n): RootContent[] => {\n const slotName = iac.toLowerCase();\n const frag = (node.children as RootContent[]).find(\n (c): c is MdxJsxFlowElement =>\n isJsxElement(c) &&\n c.name === 'Fragment' &&\n readStringAttr(c, 'slot') === slotName,\n );\n return (frag?.children as RootContent[]) ?? [];\n};\n\n/**\n * Prune TabItems whose `_filter` doesn't match `options`. Returns:\n * - `'empty'` if the <Tabs> now has no <TabItem>s — caller drops it.\n * - `'inline'` if exactly one filtered <TabItem> survived — caller\n * inlines the body so agents see just the picked variant.\n * - `'keep'` otherwise.\n */\nconst applyTabsFilter = (\n tabs: MdxJsxFlowElement,\n options: Record<string, string> | undefined,\n): 'empty' | 'inline' | 'keep' => {\n const children = tabs.children as RootContent[];\n const surviving: RootContent[] = [];\n let anyFiltered = false;\n for (const child of children) {\n if (!isJsxElement(child) || child.name !== 'TabItem') {\n surviving.push(child);\n continue;\n }\n const filterEstree = readEstreeAttr(child, '_filter');\n if (!filterEstree) {\n surviving.push(child);\n continue;\n }\n anyFiltered = true;\n let predicate: Predicate;\n try {\n predicate = parseWhenExpression(filterEstree as never);\n } catch {\n stripFilterAttr(child);\n surviving.push(child);\n continue;\n }\n if (!options || evaluatePredicate(predicate, false, options)) {\n stripFilterAttr(child);\n surviving.push(child);\n }\n }\n if (anyFiltered) {\n tabs.children = surviving as MdxJsxFlowElement['children'];\n }\n const tabItems = surviving.filter(\n (c) => isJsxElement(c) && c.name === 'TabItem',\n );\n if (tabItems.length === 0 && surviving.length === 0) return 'empty';\n if (anyFiltered && tabItems.length === 1) return 'inline';\n return 'keep';\n};\n\nconst stripFilterAttr = (el: JsxElement): void => {\n el.attributes = el.attributes.filter(\n (a) => !(a.type === 'mdxJsxAttribute' && a.name === '_filter'),\n );\n};\n\n/**\n * `> [!NOTE] Only when …` blockquote. The alert header goes through as an\n * `html` node so remark-stringify doesn't escape the `[`/`]` brackets —\n * downstream agents match on the literal GitHub alert syntax.\n */\nconst buildNoteQuote = (\n source: JsxElement,\n predicate: Predicate,\n not: boolean,\n): RootContent => {\n const marker = describePredicate(predicate, not);\n const description = readStringAttr(source, 'description');\n const headerLines = description\n ? [`[!NOTE] ${marker}`, description]\n : [`[!NOTE] ${marker}`];\n const headerNodes: RootContent[] = headerLines.map(\n (line) => ({ type: 'html', value: line }) as RootContent,\n );\n return {\n type: 'blockquote',\n children: [...headerNodes, ...(source.children as RootContent[])] as never,\n } as RootContent;\n};\n\nconst parseWhenAttr = (node: JsxElement): Predicate | undefined => {\n const estree = readEstreeAttr(node, 'when');\n if (!estree) return undefined;\n try {\n return parseWhenExpression(estree as never);\n } catch {\n return undefined;\n }\n};\n\nconst applyComponentTransforms = (\n tree: Root,\n opts: PipelineOptions,\n deps: RemarkDeps,\n): void => {\n const pm = opts.packageManager ?? 'pnpm';\n const transform = (parent: JsxParent): void => {\n const children = parent.children as RootContent[];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (!isJsxElement(child)) continue;\n const replacement = renderComponent(child, opts, pm, deps);\n if (replacement !== undefined) {\n children.splice(i, 1, ...replacement);\n i += replacement.length - 1;\n continue;\n }\n transform(child);\n }\n };\n transform(tree);\n};\n\nconst renderComponent = (\n node: JsxElement,\n opts: PipelineOptions,\n pm: string,\n deps: RemarkDeps,\n): RootContent[] | undefined => {\n switch (node.name) {\n case 'NxCommands': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands\n .map((c) => buildNxCommand(c, opts.packageManager))\n .join('\\n'),\n ),\n ];\n }\n case 'RunGenerator': {\n const generatorId = readStringAttr(node, 'generator');\n if (!generatorId) return undefined;\n const schema = findSchema(opts.generators, generatorId);\n if (!schema) return undefined;\n return parseMarkdownFragment(\n renderGeneratorCommand(generatorId, schema, opts.packageManager),\n deps,\n );\n }\n case 'GeneratorParameters': {\n const generatorId = readStringAttr(node, 'generator');\n if (!generatorId) return undefined;\n const schema = findSchema(opts.generators, generatorId);\n if (!schema) return undefined;\n return parseMarkdownFragment(renderSchema(schema), deps);\n }\n case 'CreateNxWorkspaceCommand': {\n const workspace = readStringAttr(node, 'workspace');\n if (!workspace) return undefined;\n const iac = readStringAttr(node, 'iac') as\n | 'cdk'\n | 'terraform'\n | undefined;\n return [codeBlock(buildCreateNxWorkspaceCommand(pm, workspace, iac))];\n }\n case 'NxInitCommand': {\n return [codeBlock(buildNxInitCommand(pm))];\n }\n case 'InstallCommand': {\n // Without `pkg`, installs the workspace's existing dependencies\n const pkg =\n readStringAttr(node, 'pkg') ?? readExpressionAttr(node, 'pkg');\n return [\n codeBlock(buildInstallCommand(pm, pkg, hasBareAttr(node, 'dev'))),\n ];\n }\n case 'PackageManagerShortCommand': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands\n .map((c) => buildPackageManagerShortCommand(pm, c))\n .join('\\n'),\n ),\n ];\n }\n case 'PackageManagerExecCommand': {\n const commands = readCommandsAttr(node);\n if (!commands) return undefined;\n return [\n codeBlock(\n commands.map((c) => buildPackageManagerExecCommand(pm, c)).join('\\n'),\n ),\n ];\n }\n default:\n return undefined;\n }\n};\n\nconst codeBlock = (body: string): RootContent => ({\n type: 'code',\n lang: 'bash',\n value: body,\n});\n\nconst parseMarkdownFragment = (\n markdown: string,\n deps: RemarkDeps,\n): RootContent[] => {\n const fragTree = deps.unified().use(deps.remarkParse).parse(markdown) as Root;\n return fragTree.children as RootContent[];\n};\n\nconst findSchema = (\n generators: NxGeneratorInfo[],\n generatorId: string,\n):\n | { properties?: Record<string, unknown>; required?: string[] }\n | undefined => {\n const info = generators.find((g) => g.id === generatorId);\n if (!info) return undefined;\n try {\n return JSON.parse(fs.readFileSync(info.resolvedSchemaPath, 'utf-8'));\n } catch {\n return undefined;\n }\n};\n\n/** Parse the `commands={[…]}` attribute from the estree that remark-mdx\n * attaches to the JSX attribute value. */\nconst readCommandsAttr = (node: JsxElement): string[] | undefined => {\n const estree = readEstreeAttr(node, 'commands');\n if (!estree) return undefined;\n try {\n return extractStringArrayExpression(estree as never);\n } catch {\n return undefined;\n }\n};\n"],"names":["fs","buildCreateNxWorkspaceCommand","buildInstallCommand","buildNxInitCommand","buildPackageManagerExecCommand","buildPackageManagerShortCommand","buildNxCommand","renderGeneratorCommand","renderSchema","hasBareAttr","isJsxElement","readEstreeAttr","readExpressionAttr","readStringAttr","describePredicate","evaluatePredicate","extractStringArrayExpression","parseWhenExpression","depsPromise","loadRemarkDeps","unified","remarkParse","default","remarkMdx","remarkStringify","remarkFrontmatter","parseMdxWithDeps","source","deps","use","parse","parseMdx","stringifyMdx","tree","String","bullet","fences","listItemIndent","stringify","stripFrontmatterAndEsm","children","filter","node","type","postProcessGuideWithRemark","guide","opts","inlineSnippets","applyFilterTransforms","options","applyComponentTransforms","provider","snippetContentProvider","pending","walk","parent","i","length","child","name","push","index","fetched","Promise","all","map","p","raw","replacement","undefined","processed","trim","byParent","Map","f","bucket","get","set","items","sort","a","b","snippetTree","wrapper","attributes","value","position","splice","iac","transform","when","parseWhenAttr","not","buildNoteQuote","body","selectInfrastructureSlot","pseudo","dropped","applyTabsFilter","survivor","find","c","slotName","toLowerCase","frag","tabs","surviving","anyFiltered","filterEstree","predicate","stripFilterAttr","tabItems","el","marker","description","headerLines","headerNodes","line","estree","pm","packageManager","renderComponent","commands","readCommandsAttr","codeBlock","join","generatorId","schema","findSchema","generators","parseMarkdownFragment","workspace","pkg","lang","markdown","fragTree","info","g","id","JSON","readFileSync","resolvedSchemaPath"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,QAAQ,KAAK;AAepB,SACEC,6BAA6B,EAC7BC,mBAAmB,EACnBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,+BAA+B,QAC1B,uBAAoB;AAE3B,SACEC,cAAc,EACdC,sBAAsB,EACtBC,YAAY,QACP,oBAAiB;AACxB,SACEC,WAAW,EACXC,YAAY,EAGZC,cAAc,EACdC,kBAAkB,EAClBC,cAAc,QACT,eAAY;AACnB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,4BAA4B,EAE5BC,mBAAmB,QACd,qBAAkB;AAmBzB,IAAIC;AACJ,MAAMC,iBAAiB;IACrB,IAAI,CAACD,aAAa;QAChBA,cAAc,AAAC,CAAA,UAAa,CAAA;gBAC1BE,SAAS,AAAC,CAAA,MAAM,MAAM,CAAC,UAAS,EAAGA,OAAO;gBAC1CC,aAAa,AAAC,CAAA,MA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,UACEF,SACGzD,GAAG,CAAC,CAACoC,IAAMhG,gCAAgCkH,IAAIlB,IAC/CwB,IAAI,CAAC;iBAEX;YACH;QACA,KAAK;YAA6B;gBAChC,MAAMH,WAAWC,iBAAiBjF;gBAClC,IAAI,CAACgF,UAAU,OAAOrD;gBACtB,OAAO;oBACLuD,UACEF,SAASzD,GAAG,CAAC,CAACoC,IAAMjG,+BAA+BmH,IAAIlB,IAAIwB,IAAI,CAAC;iBAEnE;YACH;QACA;YACE,OAAOxD;IACX;AACF;AAEA,MAAMuD,YAAY,CAAC9B,OAA+B,CAAA;QAChDnD,MAAM;QACN0F,MAAM;QACNhD,OAAOS;IACT,CAAA;AAEA,MAAMoC,wBAAwB,CAC5BI,UACA1G;IAEA,MAAM2G,WAAW3G,KAAKR,OAAO,GAAGS,GAAG,CAACD,KAAKP,WAAW,EAAES,KAAK,CAACwG;IAC5D,OAAOC,SAAS/F,QAAQ;AAC1B;AAEA,MAAMwF,aAAa,CACjBC,YACAH;IAIA,MAAMU,OAAOP,WAAW7B,IAAI,CAAC,CAACqC,IAAMA,EAAEC,EAAE,KAAKZ;IAC7C,IAAI,CAACU,MAAM,OAAOnE;IAClB,IAAI;QACF,OAAOsE,KAAK7G,KAAK,CAAC9B,GAAG4I,YAAY,CAACJ,KAAKK,kBAAkB,EAAE;IAC7D,EAAE,OAAM;QACN,OAAOxE;IACT;AACF;AAEA;yCACyC,GACzC,MAAMsD,mBAAmB,CAACjF;IACxB,MAAM4E,SAAS3G,eAAe+B,MAAM;IACpC,IAAI,CAAC4E,QAAQ,OAAOjD;IACpB,IAAI;QACF,OAAOrD,6BAA6BsG;IACtC,EAAE,OAAM;QACN,OAAOjD;IACT;AACF"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Replace the deprecated inlineDynamicImports rolldown output option with codeSplitting"
3
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments } from "@nx/devkit";
5
+ import { applyGritQL } from "../../../utils/ast.js";
6
+ import { formatFilesInSubtree } from "../../../utils/format.js";
7
+ /**
8
+ * Move generated rolldown configs onto `codeSplitting: false`.
9
+ *
10
+ * rolldown deprecated the `inlineDynamicImports` output option in favour of
11
+ * `codeSplitting`, and warns once per bundle entry — so a workspace with several
12
+ * bundled projects printed the warning many times over on every build. Both
13
+ * spellings ask for the same thing: the whole bundle in a single file, which is
14
+ * what the vended Lambda and container bundles need.
15
+ *
16
+ * Guardrails:
17
+ * - Both patterns are anchored to a rolldown `output` object and scoped with
18
+ * `some` to its direct properties, so an object of the user's own that happens
19
+ * to carry the same key is left alone. `inlineDynamicImports: false` is also
20
+ * left alone: it means the opposite, so a user who set it deliberately keeps it.
21
+ * - Where an output already carries `codeSplitting`, the deprecated option is
22
+ * dropped rather than renamed, so the rewrite can't produce a duplicate key.
23
+ * - Idempotent: neither pattern matches once the option is gone.
24
+ */ /**
25
+ * Rename the deprecated option, where the output does not already set
26
+ * `codeSplitting`.
27
+ */ const RENAME_PATTERN = `\`output: { $props }\` where {
28
+ $props <: some \`inlineDynamicImports: true\` as $deprecated,
29
+ $props <: not some \`codeSplitting: $_\`,
30
+ $deprecated => \`codeSplitting: false\`
31
+ }`;
32
+ /**
33
+ * Drop the deprecated option where `codeSplitting` is already set — renaming it
34
+ * would leave the output with the key twice.
35
+ */ const DROP_PATTERN = `\`output: { $props }\` where {
36
+ $props <: some \`codeSplitting: $_\`,
37
+ $props <: some \`inlineDynamicImports: true\` as $deprecated,
38
+ $deprecated => .
39
+ }`;
40
+ export default async function migration(tree) {
41
+ for (const project of getProjects(tree).values()){
42
+ const configPath = joinPathFragments(project.root, 'rolldown.config.ts');
43
+ if (!tree.exists(configPath)) {
44
+ continue;
45
+ }
46
+ for (const pattern of [
47
+ RENAME_PATTERN,
48
+ DROP_PATTERN
49
+ ]){
50
+ await applyGritQL(tree, configPath, pattern);
51
+ }
52
+ }
53
+ await formatFilesInSubtree(tree);
54
+ return {};
55
+ }
56
+
57
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/rolldown-code-splitting/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type Tree,\n} from '@nx/devkit';\nimport { applyGritQL } from '../../../utils/ast';\nimport { formatFilesInSubtree } from '../../../utils/format';\n\n/**\n * Move generated rolldown configs onto `codeSplitting: false`.\n *\n * rolldown deprecated the `inlineDynamicImports` output option in favour of\n * `codeSplitting`, and warns once per bundle entry — so a workspace with several\n * bundled projects printed the warning many times over on every build. Both\n * spellings ask for the same thing: the whole bundle in a single file, which is\n * what the vended Lambda and container bundles need.\n *\n * Guardrails:\n * - Both patterns are anchored to a rolldown `output` object and scoped with\n * `some` to its direct properties, so an object of the user's own that happens\n * to carry the same key is left alone. `inlineDynamicImports: false` is also\n * left alone: it means the opposite, so a user who set it deliberately keeps it.\n * - Where an output already carries `codeSplitting`, the deprecated option is\n * dropped rather than renamed, so the rewrite can't produce a duplicate key.\n * - Idempotent: neither pattern matches once the option is gone.\n */\n\n/**\n * Rename the deprecated option, where the output does not already set\n * `codeSplitting`.\n */\nconst RENAME_PATTERN = `\\`output: { $props }\\` where {\n $props <: some \\`inlineDynamicImports: true\\` as $deprecated,\n $props <: not some \\`codeSplitting: $_\\`,\n $deprecated => \\`codeSplitting: false\\`\n}`;\n\n/**\n * Drop the deprecated option where `codeSplitting` is already set — renaming it\n * would leave the output with the key twice.\n */\nconst DROP_PATTERN = `\\`output: { $props }\\` where {\n $props <: some \\`codeSplitting: $_\\`,\n $props <: some \\`inlineDynamicImports: true\\` as $deprecated,\n $deprecated => .\n}`;\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n for (const project of getProjects(tree).values()) {\n const configPath = joinPathFragments(project.root, 'rolldown.config.ts');\n if (!tree.exists(configPath)) {\n continue;\n }\n for (const pattern of [RENAME_PATTERN, DROP_PATTERN]) {\n await applyGritQL(tree, configPath, pattern);\n }\n }\n\n await formatFilesInSubtree(tree);\n\n return {};\n}\n"],"names":["getProjects","joinPathFragments","applyGritQL","formatFilesInSubtree","RENAME_PATTERN","DROP_PATTERN","migration","tree","project","values","configPath","root","exists","pattern"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,QAGZ,aAAa;AACpB,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,oBAAoB,QAAQ,2BAAwB;AAE7D;;;;;;;;;;;;;;;;;CAiBC,GAED;;;CAGC,GACD,MAAMC,iBAAiB,CAAC;;;;CAIvB,CAAC;AAEF;;;CAGC,GACD,MAAMC,eAAe,CAAC;;;;CAIrB,CAAC;AAEF,eAAe,eAAeC,UAC5BC,IAAU;IAEV,KAAK,MAAMC,WAAWR,YAAYO,MAAME,MAAM,GAAI;QAChD,MAAMC,aAAaT,kBAAkBO,QAAQG,IAAI,EAAE;QACnD,IAAI,CAACJ,KAAKK,MAAM,CAACF,aAAa;YAC5B;QACF;QACA,KAAK,MAAMG,WAAW;YAACT;YAAgBC;SAAa,CAAE;YACpD,MAAMH,YAAYK,MAAMG,YAAYG;QACtC;IACF;IAEA,MAAMV,qBAAqBI;IAE3B,OAAO,CAAC;AACV"}
@@ -17,7 +17,7 @@ RUN smithy-install/smithy/install
17
17
 
18
18
  # Add node dependencies for bundling
19
19
  WORKDIR /project
20
- RUN npm i -g pnpm@11.1.1 rolldown@<%- rolldownVersion %>
20
+ RUN npm i -g pnpm@11.1.1 rolldown@1.0.0-beta.38
21
21
 
22
22
  # Copy project files
23
23
  COPY smithy-build.json .
@@ -39,7 +39,7 @@ RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \
39
39
 
40
40
  # Install rolldown plugins with pnpm cache mount
41
41
  RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \
42
- pnpm add -D rolldown-plugin-dts@<%- rolldownDtsVersion %> @rollup/plugin-esm-shim@<%- esmShimVersion %>
42
+ pnpm add -D rolldown-plugin-dts@0.16.5 @rollup/plugin-esm-shim@0.1.8
43
43
 
44
44
  RUN cat <<EOF > rolldown.config.js
45
45
  import { dts } from 'rolldown-plugin-dts';
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Build Smithy projects with the Smithy CLI directly rather than in a container, removing the Docker prerequisite"
3
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments, updateProjectConfiguration } from "@nx/devkit";
5
+ import { DEPENDENCIES, SMITHY_PROJECT_GENERATOR_INFO, smithyCompileCommands, smithyCompileOutputs, smithyGenerateSsdkTarget, writeSsdkBundleConfig } from "../../../smithy/project/generator.js";
6
+ import { addTsDependencies } from "../../../utils/add-dependencies.js";
7
+ import { formatFilesInSubtree } from "../../../utils/format.js";
8
+ import { FsCommands } from "../../../utils/fs.js";
9
+ import { warnIfSmithyMissing } from "../../../utils/smithy.js";
10
+ /**
11
+ * Move Smithy projects off the container build onto the Smithy CLI.
12
+ *
13
+ * A Smithy build used to run inside an image: the `build.Dockerfile` installed the
14
+ * CLI, built the model, and — for a service — installed and bundled the generated
15
+ * Server SDK. That made Docker a prerequisite for any workspace holding a Smithy
16
+ * project. The CLI now runs on the machine, so the Dockerfile goes and the
17
+ * `compile` target is rewritten to invoke it.
18
+ *
19
+ * The target's commands are replaced wholesale rather than patched: every one of
20
+ * them changes, and they are generated configuration. A project whose commands the
21
+ * user has edited is left alone and reported, since replacing them would discard
22
+ * those edits.
23
+ */ /** Where a consuming project's Dockerfile brought in a shape library's model. */ const WORKSPACE_CONTEXT_COPY = /COPY\s+--from=workspace\s+(\S+)\s+\S+/g;
24
+ const smithyMetadata = (project)=>project.metadata;
25
+ /**
26
+ * Whether a project's `compile` commands are the ones a previous release
27
+ * generated, so replacing them discards nothing.
28
+ *
29
+ * Matched on the shape of the image build rather than the exact string: the engine
30
+ * is `docker` or `finch` depending on the workspace's configuration, and the
31
+ * commands around it moved between releases.
32
+ */ const hasGeneratedDockerCompile = (project)=>{
33
+ const commands = project.targets?.compile?.options?.commands;
34
+ if (!Array.isArray(commands)) {
35
+ return false;
36
+ }
37
+ const imageBuilds = commands.filter((command)=>typeof command === 'string' && command.includes('build.Dockerfile'));
38
+ // Exactly the one image build the generator wrote, in the form it wrote it.
39
+ // Anything else means the user has been in here.
40
+ return imageBuilds.length === 1 && /^(?:docker|finch) build /.test(imageBuilds[0]) && imageBuilds[0].includes('--target export');
41
+ };
42
+ /**
43
+ * The shape libraries a Dockerfile copied in, as `imports` entries.
44
+ *
45
+ * Consuming a shape library used to need a `COPY --from=workspace` bringing its
46
+ * built model into the image, and an `imports` entry pointing at where it landed.
47
+ * With the build on the machine, `imports` reaches the built model directly — the
48
+ * CLI resolves them relative to `smithy-build.json` — so each copy becomes a
49
+ * relative path, and the Dockerfile is no longer needed to carry it.
50
+ */ const importsFromDockerfileCopies = (dockerfile, projectRoot)=>{
51
+ const upToRoot = projectRoot.split('/').filter(Boolean).map(()=>'..').join('/');
52
+ return [
53
+ ...dockerfile.matchAll(WORKSPACE_CONTEXT_COPY)
54
+ ].map(([, source])=>`${upToRoot}/${source}`);
55
+ };
56
+ /** Add the imports a Dockerfile's copies stood for, keeping the user's own. */ const addImports = (tree, projectRoot, imports)=>{
57
+ if (imports.length === 0) {
58
+ return;
59
+ }
60
+ const path = joinPathFragments(projectRoot, 'smithy-build.json');
61
+ if (!tree.exists(path)) {
62
+ return;
63
+ }
64
+ const smithyBuild = JSON.parse(tree.read(path, 'utf-8') ?? '{}');
65
+ const existing = smithyBuild.imports ?? [];
66
+ smithyBuild.imports = [
67
+ ...existing,
68
+ ...imports.filter((entry)=>!existing.includes(entry))
69
+ ];
70
+ tree.write(path, JSON.stringify(smithyBuild, null, 2));
71
+ };
72
+ const editedNextStep = (projectName)=>`${projectName}: its compile target has been customised, so it was left as it is. Smithy projects now build with the Smithy CLI rather than a container — see https://awslabs.github.io/nx-plugin-for-aws/guides/smithy-project/ for the target it expects.`;
73
+ export default async function migration(tree) {
74
+ const nextSteps = [];
75
+ const migrated = [];
76
+ for (const [name, project] of getProjects(tree)){
77
+ const metadata = smithyMetadata(project);
78
+ if (metadata?.generator !== SMITHY_PROJECT_GENERATOR_INFO.id) {
79
+ continue;
80
+ }
81
+ const dockerfilePath = joinPathFragments(project.root, 'build.Dockerfile');
82
+ if (!tree.exists(dockerfilePath)) {
83
+ continue;
84
+ }
85
+ if (!hasGeneratedDockerCompile(project)) {
86
+ nextSteps.push(editedNextStep(name));
87
+ continue;
88
+ }
89
+ // A project generated before the type was recorded is a service: the shapes
90
+ // type shipped with the metadata already in place.
91
+ const type = metadata.smithyType ?? 'service';
92
+ // Carry over the shape library dependencies the Dockerfile expressed as
93
+ // build-context copies before dropping it.
94
+ addImports(tree, project.root, importsFromDockerfileCopies(tree.read(dockerfilePath, 'utf-8') ?? '', project.root));
95
+ tree.delete(dockerfilePath);
96
+ // Built from the same helpers the generator uses, so the targets a migrated
97
+ // project gets cannot drift from a freshly generated one.
98
+ const cmd = new FsCommands(tree, DEPENDENCIES);
99
+ project.targets ??= {};
100
+ project.targets.compile = {
101
+ ...project.targets.compile,
102
+ outputs: smithyCompileOutputs(type),
103
+ options: {
104
+ ...project.targets.compile?.options,
105
+ commands: smithyCompileCommands(cmd, type)
106
+ }
107
+ };
108
+ // A service's Server SDK moves to its own target, so the model build and the
109
+ // SDK build cache separately.
110
+ if (type === 'service') {
111
+ project.targets['generate-ssdk'] = {
112
+ ...project.targets['generate-ssdk'],
113
+ ...smithyGenerateSsdkTarget()
114
+ };
115
+ project.targets.build = {
116
+ ...project.targets.build,
117
+ dependsOn: [
118
+ 'compile',
119
+ 'generate-ssdk'
120
+ ]
121
+ };
122
+ }
123
+ updateProjectConfiguration(tree, name, project);
124
+ if (type === 'service') {
125
+ writeSsdkBundleConfig(tree, project.root);
126
+ }
127
+ migrated.push({
128
+ smithyType: type,
129
+ namespace: metadata.namespace ?? ''
130
+ });
131
+ }
132
+ // A service's SDK bundler, which the image used to carry. The Smithy CLI needs
133
+ // nothing here — the target fetches mise with `npx`.
134
+ //
135
+ // Added per migrated project rather than once for the workspace, so a mix of
136
+ // services and shape libraries gets the union of what each needs. All of these
137
+ // go to the root manifest, so repeating one is a no-op.
138
+ for (const metadata of migrated){
139
+ addTsDependencies(tree, DEPENDENCIES, {
140
+ metadata
141
+ });
142
+ }
143
+ // On Windows the migrated build runs the Smithy CLI from the PATH rather than
144
+ // through mise, so flag a missing prerequisite when a project was moved across.
145
+ if (migrated.length > 0) {
146
+ warnIfSmithyMissing();
147
+ }
148
+ await formatFilesInSubtree(tree);
149
+ return {
150
+ nextSteps
151
+ };
152
+ }
153
+
154
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/latest/smithy-build-without-docker/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type ProjectConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport {\n DEPENDENCIES,\n SMITHY_PROJECT_GENERATOR_INFO,\n type SmithyProjectMetadata,\n smithyCompileCommands,\n smithyCompileOutputs,\n smithyGenerateSsdkTarget,\n writeSsdkBundleConfig,\n} from '../../../smithy/project/generator';\nimport { addTsDependencies } from '../../../utils/add-dependencies';\nimport { formatFilesInSubtree } from '../../../utils/format';\nimport { FsCommands } from '../../../utils/fs';\nimport { warnIfSmithyMissing } from '../../../utils/smithy';\n\n/**\n * Move Smithy projects off the container build onto the Smithy CLI.\n *\n * A Smithy build used to run inside an image: the `build.Dockerfile` installed the\n * CLI, built the model, and — for a service — installed and bundled the generated\n * Server SDK. That made Docker a prerequisite for any workspace holding a Smithy\n * project. The CLI now runs on the machine, so the Dockerfile goes and the\n * `compile` target is rewritten to invoke it.\n *\n * The target's commands are replaced wholesale rather than patched: every one of\n * them changes, and they are generated configuration. A project whose commands the\n * user has edited is left alone and reported, since replacing them would discard\n * those edits.\n */\n\n/** Where a consuming project's Dockerfile brought in a shape library's model. */\nconst WORKSPACE_CONTEXT_COPY = /COPY\\s+--from=workspace\\s+(\\S+)\\s+\\S+/g;\n\n/**\n * The metadata a Smithy model project records, as a workspace on an older release\n * may hold it — `smithyType` predates neither the generator nor this migration, so\n * it may be absent.\n */\ninterface SmithyMetadata extends Partial<SmithyProjectMetadata> {\n readonly generator?: string;\n}\n\nconst smithyMetadata = (\n project: ProjectConfiguration,\n): SmithyMetadata | undefined => project.metadata as SmithyMetadata | undefined;\n\n/**\n * Whether a project's `compile` commands are the ones a previous release\n * generated, so replacing them discards nothing.\n *\n * Matched on the shape of the image build rather than the exact string: the engine\n * is `docker` or `finch` depending on the workspace's configuration, and the\n * commands around it moved between releases.\n */\nconst hasGeneratedDockerCompile = (project: ProjectConfiguration): boolean => {\n const commands: unknown = project.targets?.compile?.options?.commands;\n if (!Array.isArray(commands)) {\n return false;\n }\n const imageBuilds = commands.filter(\n (command): command is string =>\n typeof command === 'string' && command.includes('build.Dockerfile'),\n );\n // Exactly the one image build the generator wrote, in the form it wrote it.\n // Anything else means the user has been in here.\n return (\n imageBuilds.length === 1 &&\n /^(?:docker|finch) build /.test(imageBuilds[0]) &&\n imageBuilds[0].includes('--target export')\n );\n};\n\n/**\n * The shape libraries a Dockerfile copied in, as `imports` entries.\n *\n * Consuming a shape library used to need a `COPY --from=workspace` bringing its\n * built model into the image, and an `imports` entry pointing at where it landed.\n * With the build on the machine, `imports` reaches the built model directly — the\n * CLI resolves them relative to `smithy-build.json` — so each copy becomes a\n * relative path, and the Dockerfile is no longer needed to carry it.\n */\nconst importsFromDockerfileCopies = (\n dockerfile: string,\n projectRoot: string,\n): string[] => {\n const upToRoot = projectRoot\n .split('/')\n .filter(Boolean)\n .map(() => '..')\n .join('/');\n return [...dockerfile.matchAll(WORKSPACE_CONTEXT_COPY)].map(\n ([, source]) => `${upToRoot}/${source}`,\n );\n};\n\n/** Add the imports a Dockerfile's copies stood for, keeping the user's own. */\nconst addImports = (tree: Tree, projectRoot: string, imports: string[]) => {\n if (imports.length === 0) {\n return;\n }\n const path = joinPathFragments(projectRoot, 'smithy-build.json');\n if (!tree.exists(path)) {\n return;\n }\n const smithyBuild = JSON.parse(tree.read(path, 'utf-8') ?? '{}');\n const existing: string[] = smithyBuild.imports ?? [];\n smithyBuild.imports = [\n ...existing,\n ...imports.filter((entry) => !existing.includes(entry)),\n ];\n tree.write(path, JSON.stringify(smithyBuild, null, 2));\n};\n\nconst editedNextStep = (projectName: string): string =>\n `${projectName}: its compile target has been customised, so it was left as it is. Smithy projects now build with the Smithy CLI rather than a container — see https://awslabs.github.io/nx-plugin-for-aws/guides/smithy-project/ for the target it expects.`;\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n const migrated: SmithyProjectMetadata[] = [];\n\n for (const [name, project] of getProjects(tree)) {\n const metadata = smithyMetadata(project);\n if (metadata?.generator !== SMITHY_PROJECT_GENERATOR_INFO.id) {\n continue;\n }\n\n const dockerfilePath = joinPathFragments(project.root, 'build.Dockerfile');\n if (!tree.exists(dockerfilePath)) {\n continue;\n }\n\n if (!hasGeneratedDockerCompile(project)) {\n nextSteps.push(editedNextStep(name));\n continue;\n }\n\n // A project generated before the type was recorded is a service: the shapes\n // type shipped with the metadata already in place.\n const type = metadata.smithyType ?? 'service';\n\n // Carry over the shape library dependencies the Dockerfile expressed as\n // build-context copies before dropping it.\n addImports(\n tree,\n project.root,\n importsFromDockerfileCopies(\n tree.read(dockerfilePath, 'utf-8') ?? '',\n project.root,\n ),\n );\n tree.delete(dockerfilePath);\n\n // Built from the same helpers the generator uses, so the targets a migrated\n // project gets cannot drift from a freshly generated one.\n const cmd = new FsCommands(tree, DEPENDENCIES);\n project.targets ??= {};\n project.targets.compile = {\n ...project.targets.compile,\n outputs: smithyCompileOutputs(type),\n options: {\n ...project.targets.compile?.options,\n commands: smithyCompileCommands(cmd, type),\n },\n };\n\n // A service's Server SDK moves to its own target, so the model build and the\n // SDK build cache separately.\n if (type === 'service') {\n project.targets['generate-ssdk'] = {\n ...project.targets['generate-ssdk'],\n ...smithyGenerateSsdkTarget(),\n };\n project.targets.build = {\n ...project.targets.build,\n dependsOn: ['compile', 'generate-ssdk'],\n };\n }\n updateProjectConfiguration(tree, name, project);\n\n if (type === 'service') {\n writeSsdkBundleConfig(tree, project.root);\n }\n migrated.push({ smithyType: type, namespace: metadata.namespace ?? '' });\n }\n\n // A service's SDK bundler, which the image used to carry. The Smithy CLI needs\n // nothing here — the target fetches mise with `npx`.\n //\n // Added per migrated project rather than once for the workspace, so a mix of\n // services and shape libraries gets the union of what each needs. All of these\n // go to the root manifest, so repeating one is a no-op.\n for (const metadata of migrated) {\n addTsDependencies(tree, DEPENDENCIES, { metadata });\n }\n\n // On Windows the migrated build runs the Smithy CLI from the PATH rather than\n // through mise, so flag a missing prerequisite when a project was moved across.\n if (migrated.length > 0) {\n warnIfSmithyMissing();\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","updateProjectConfiguration","DEPENDENCIES","SMITHY_PROJECT_GENERATOR_INFO","smithyCompileCommands","smithyCompileOutputs","smithyGenerateSsdkTarget","writeSsdkBundleConfig","addTsDependencies","formatFilesInSubtree","FsCommands","warnIfSmithyMissing","WORKSPACE_CONTEXT_COPY","smithyMetadata","project","metadata","hasGeneratedDockerCompile","commands","targets","compile","options","Array","isArray","imageBuilds","filter","command","includes","length","test","importsFromDockerfileCopies","dockerfile","projectRoot","upToRoot","split","Boolean","map","join","matchAll","source","addImports","tree","imports","path","exists","smithyBuild","JSON","parse","read","existing","entry","write","stringify","editedNextStep","projectName","migration","nextSteps","migrated","name","generator","id","dockerfilePath","root","push","type","smithyType","delete","cmd","outputs","build","dependsOn","namespace"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAIjBC,0BAA0B,QACrB,aAAa;AACpB,SACEC,YAAY,EACZC,6BAA6B,EAE7BC,qBAAqB,EACrBC,oBAAoB,EACpBC,wBAAwB,EACxBC,qBAAqB,QAChB,uCAAoC;AAC3C,SAASC,iBAAiB,QAAQ,qCAAkC;AACpE,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,UAAU,QAAQ,uBAAoB;AAC/C,SAASC,mBAAmB,QAAQ,2BAAwB;AAE5D;;;;;;;;;;;;;CAaC,GAED,+EAA+E,GAC/E,MAAMC,yBAAyB;AAW/B,MAAMC,iBAAiB,CACrBC,UAC+BA,QAAQC,QAAQ;AAEjD;;;;;;;CAOC,GACD,MAAMC,4BAA4B,CAACF;IACjC,MAAMG,WAAoBH,QAAQI,OAAO,EAAEC,SAASC,SAASH;IAC7D,IAAI,CAACI,MAAMC,OAAO,CAACL,WAAW;QAC5B,OAAO;IACT;IACA,MAAMM,cAAcN,SAASO,MAAM,CACjC,CAACC,UACC,OAAOA,YAAY,YAAYA,QAAQC,QAAQ,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AAEE,YAAYD;YAAMO,WAAWvD,SAASuD,SAAS,IAAI;QAAG;IACxE;IAEA,+EAA+E;IAC/E,qDAAqD;IACrD,EAAE;IACF,6EAA6E;IAC7E,+EAA+E;IAC/E,wDAAwD;IACxD,KAAK,MAAMvD,YAAYyC,SAAU;QAC/BhD,kBAAkBgC,MAAMtC,cAAc;YAAEa;QAAS;IACnD;IAEA,8EAA8E;IAC9E,gFAAgF;IAChF,IAAIyC,SAAS7B,MAAM,GAAG,GAAG;QACvBhB;IACF;IAEA,MAAMF,qBAAqB+B;IAE3B,OAAO;QAAEe;IAAU;AACrB"}
@@ -0,0 +1,95 @@
1
+ FROM public.ecr.aws/docker/library/node:24 AS builder
2
+ ENV CI=true
3
+
4
+ # Output directory
5
+ RUN mkdir /out
6
+
7
+ # Install Smithy CLI
8
+ # https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
9
+ WORKDIR /smithy
10
+ ARG TARGETPLATFORM
11
+ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \
12
+ mkdir -p smithy-install/smithy && \
13
+ curl -L https://github.com/smithy-lang/smithy/releases/download/1.61.0/smithy-cli-linux-$ARCH.zip -o smithy-install/smithy-cli-linux-$ARCH.zip && \
14
+ unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \
15
+ mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
16
+ RUN smithy-install/smithy/install
17
+
18
+ # Add node dependencies for bundling
19
+ WORKDIR /project
20
+ RUN npm i -g pnpm@11.1.1 rolldown@1.0.0-beta.38
21
+
22
+ # Copy project files
23
+ COPY smithy-build.json .
24
+ COPY src src
25
+
26
+ # Smithy build with Maven cache mount
27
+ RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \
28
+ smithy build
29
+
30
+ # Copy OpenAPI specification to output location
31
+ RUN mkdir -p /out/openapi
32
+ RUN cp /project/build/smithy/source/openapi/*.openapi.json /out/openapi/openapi.json
33
+
34
+ WORKDIR /project/build/smithy/source/typescript-ssdk-codegen
35
+
36
+ # Install SSDK dependencies with pnpm cache mount
37
+ RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \
38
+ pnpm install --prefer-offline
39
+
40
+ # Install rolldown plugins with pnpm cache mount
41
+ RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \
42
+ pnpm add -D rolldown-plugin-dts@0.16.5 @rollup/plugin-esm-shim@0.1.8
43
+
44
+ RUN cat <<EOF > rolldown.config.js
45
+ import { dts } from 'rolldown-plugin-dts';
46
+ import esmShim from '@rollup/plugin-esm-shim';
47
+ import fs from 'fs';
48
+ import path from 'path';
49
+
50
+ // Bundle the re2-wasm wasm file as part of the module
51
+ const re2WasmPlugin = () => ({
52
+ name: 're2-wasm-plugin',
53
+ resolveId: (id) => {
54
+ if (!(id === 're2-wasm' || id.endsWith('/re2-wasm'))) return null;
55
+ try {
56
+ const dir = path.join(path.dirname(require.resolve('re2-wasm/package.json')), 'build/wasm');
57
+ return fs.existsSync(path.join(dir, 're2.wasm')) && fs.existsSync(path.join(dir, 're2.js')) ? path.join(dir, 're2.js') : null;
58
+ } catch { return null; }
59
+ },
60
+ load: (id) => {
61
+ if (!(id.endsWith('re2.js') && id.includes('re2-wasm'))) return null;
62
+ try {
63
+ const wasmPath = path.join(path.dirname(id), 're2.wasm');
64
+ return fs.existsSync(wasmPath) && fs.existsSync(id) ? \`var Module = { wasmBinary: Buffer.from("\${fs.readFileSync(wasmPath).toString('base64')}", "base64") }\n\${fs.readFileSync(id, 'utf8')}\` : null;
65
+ } catch { return null; }
66
+ }
67
+ });
68
+
69
+ export default {
70
+ input: './src/index.ts',
71
+ plugins: [
72
+ re2WasmPlugin(),
73
+ dts({ resolve: true }),
74
+ esmShim(),
75
+ ],
76
+ output: [{
77
+ dir: 'dist',
78
+ format: 'es',
79
+ }],
80
+ resolve: {
81
+ tsconfigFilename: 'tsconfig.es.json',
82
+ },
83
+ platform: 'node',
84
+ };
85
+ EOF
86
+
87
+ # Create SSDK bundle with rolldown
88
+ RUN rolldown -c
89
+
90
+ RUN mkdir -p /out/ssdk
91
+ RUN cp dist/* /out/ssdk/
92
+
93
+ # Export the /out directory
94
+ FROM scratch AS export
95
+ COPY --from=builder /out /
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Resolve vite and vitest config paths from import.meta.dirname rather than __dirname"
3
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;