@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
@@ -1,42 +1,5 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`smithyProjectGenerator > shape libraries > should generate a shape library without a service > shapes-build.Dockerfile 1`] = `
4
- "FROM public.ecr.aws/docker/library/node:24 AS builder
5
- ENV CI=true
6
-
7
- # Output directory
8
- RUN mkdir /out
9
-
10
- # Install Smithy CLI
11
- # https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
12
- WORKDIR /smithy
13
- ARG TARGETPLATFORM
14
- RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \\
15
- mkdir -p smithy-install/smithy && \\
16
- 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 && \\
17
- unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \\
18
- mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
19
- RUN smithy-install/smithy/install
20
-
21
- # Copy project files
22
- WORKDIR /project
23
- COPY smithy-build.json .
24
- COPY src src
25
-
26
- # Validate the model and assemble it into a single JSON model file
27
- RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \\
28
- smithy build
29
-
30
- # Copy the assembled model to the output location
31
- RUN mkdir -p /out/model
32
- RUN cp /project/build/smithy/source/model/model.json /out/model/model.json
33
-
34
- # Export the /out directory
35
- FROM scratch AS export
36
- COPY --from=builder /out /
37
- "
38
- `;
39
-
40
3
  exports[`smithyProjectGenerator > shape libraries > should generate a shape library without a service > shapes-main.smithy 1`] = `
41
4
  "$version: "2.0"
42
5
 
@@ -69,13 +32,18 @@ exports[`smithyProjectGenerator > shape libraries > should generate a shape libr
69
32
  },
70
33
  "compile": {
71
34
  "cache": true,
72
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
35
+ "outputs": [
36
+ "{workspaceRoot}/dist/{projectRoot}/smithy",
37
+ "{workspaceRoot}/dist/{projectRoot}/build/model.json"
38
+ ],
73
39
  "executor": "nx:run-commands",
74
40
  "options": {
75
41
  "commands": [
76
42
  "rimraf dist/{projectRoot}/build",
43
+ "rimraf dist/{projectRoot}/smithy",
77
44
  "make-dir dist/{projectRoot}/build",
78
- "docker build -f {projectRoot}/build.Dockerfile --build-context workspace=. --target export --output type=local,dest=dist/{projectRoot}/build {projectRoot}"
45
+ "npx -y mise@2026.8.3 exec smithy@1.72.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
46
+ "ncp dist/{projectRoot}/smithy/source/model/model.json dist/{projectRoot}/build/model.json"
79
47
  ],
80
48
  "parallel": false,
81
49
  "cwd": "{workspaceRoot}"
@@ -91,7 +59,7 @@ exports[`smithyProjectGenerator > shape libraries > should generate a shape libr
91
59
  "version": "1.0",
92
60
  "sources": ["src/"],
93
61
  "maven": {
94
- "dependencies": ["software.amazon.smithy:smithy-model:1.61.0"]
62
+ "dependencies": ["software.amazon.smithy:smithy-model:1.72.1"]
95
63
  }
96
64
  }
97
65
  "
@@ -134,17 +102,36 @@ exports[`smithyProjectGenerator > should generate smithy project with all custom
134
102
  },
135
103
  "targets": {
136
104
  "build": {
137
- "dependsOn": ["compile"]
105
+ "dependsOn": ["compile", "generate-ssdk"]
138
106
  },
139
107
  "compile": {
140
108
  "cache": true,
141
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
109
+ "outputs": [
110
+ "{workspaceRoot}/dist/{projectRoot}/smithy",
111
+ "{workspaceRoot}/dist/{projectRoot}/build/openapi"
112
+ ],
142
113
  "executor": "nx:run-commands",
143
114
  "options": {
144
115
  "commands": [
145
116
  "rimraf dist/{projectRoot}/build",
117
+ "rimraf dist/{projectRoot}/smithy",
146
118
  "make-dir dist/{projectRoot}/build",
147
- "docker build -f {projectRoot}/build.Dockerfile --build-context workspace=. --target export --output type=local,dest=dist/{projectRoot}/build {projectRoot}"
119
+ "npx -y mise@2026.8.3 exec smithy@1.72.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
120
+ "cpy \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi --flat --rename=openapi.json"
121
+ ],
122
+ "parallel": false,
123
+ "cwd": "{workspaceRoot}"
124
+ }
125
+ },
126
+ "generate-ssdk": {
127
+ "cache": true,
128
+ "outputs": ["{workspaceRoot}/dist/{projectRoot}/build/ssdk"],
129
+ "executor": "nx:run-commands",
130
+ "dependsOn": ["compile"],
131
+ "options": {
132
+ "commands": [
133
+ "npm install --prefix dist/{projectRoot}/smithy/source/typescript-ssdk-codegen --include=dev --ignore-scripts --no-audit --no-fund",
134
+ "rolldown -c {projectRoot}/ssdk.rolldown.config.mjs"
148
135
  ],
149
136
  "parallel": false,
150
137
  "cwd": "{workspaceRoot}"
@@ -169,17 +156,36 @@ exports[`smithyProjectGenerator > should generate smithy project with custom dir
169
156
  },
170
157
  "targets": {
171
158
  "build": {
172
- "dependsOn": ["compile"]
159
+ "dependsOn": ["compile", "generate-ssdk"]
173
160
  },
174
161
  "compile": {
175
162
  "cache": true,
176
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
163
+ "outputs": [
164
+ "{workspaceRoot}/dist/{projectRoot}/smithy",
165
+ "{workspaceRoot}/dist/{projectRoot}/build/openapi"
166
+ ],
177
167
  "executor": "nx:run-commands",
178
168
  "options": {
179
169
  "commands": [
180
170
  "rimraf dist/{projectRoot}/build",
171
+ "rimraf dist/{projectRoot}/smithy",
181
172
  "make-dir dist/{projectRoot}/build",
182
- "docker build -f {projectRoot}/build.Dockerfile --build-context workspace=. --target export --output type=local,dest=dist/{projectRoot}/build {projectRoot}"
173
+ "npx -y mise@2026.8.3 exec smithy@1.72.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
174
+ "cpy \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi --flat --rename=openapi.json"
175
+ ],
176
+ "parallel": false,
177
+ "cwd": "{workspaceRoot}"
178
+ }
179
+ },
180
+ "generate-ssdk": {
181
+ "cache": true,
182
+ "outputs": ["{workspaceRoot}/dist/{projectRoot}/build/ssdk"],
183
+ "executor": "nx:run-commands",
184
+ "dependsOn": ["compile"],
185
+ "options": {
186
+ "commands": [
187
+ "npm install --prefix dist/{projectRoot}/smithy/source/typescript-ssdk-codegen --include=dev --ignore-scripts --no-audit --no-fund",
188
+ "rolldown -c {projectRoot}/ssdk.rolldown.config.mjs"
183
189
  ],
184
190
  "parallel": false,
185
191
  "cwd": "{workspaceRoot}"
@@ -236,105 +242,6 @@ service CustomService {
236
242
  "
237
243
  `;
238
244
 
239
- exports[`smithyProjectGenerator > should generate smithy project with default options > build.Dockerfile 1`] = `
240
- "FROM public.ecr.aws/docker/library/node:24 AS builder
241
- ENV CI=true
242
-
243
- # Output directory
244
- RUN mkdir /out
245
-
246
- # Install Smithy CLI
247
- # https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
248
- WORKDIR /smithy
249
- ARG TARGETPLATFORM
250
- RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \\
251
- mkdir -p smithy-install/smithy && \\
252
- 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 && \\
253
- unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \\
254
- mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
255
- RUN smithy-install/smithy/install
256
-
257
- # Add node dependencies for bundling
258
- WORKDIR /project
259
- RUN npm i -g pnpm@11.1.1 rolldown@1.2.2
260
-
261
- # Copy project files
262
- COPY smithy-build.json .
263
- COPY src src
264
-
265
- # Smithy build with Maven cache mount
266
- RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \\
267
- smithy build
268
-
269
- # Copy OpenAPI specification to output location
270
- RUN mkdir -p /out/openapi
271
- RUN cp /project/build/smithy/source/openapi/*.openapi.json /out/openapi/openapi.json
272
-
273
- WORKDIR /project/build/smithy/source/typescript-ssdk-codegen
274
-
275
- # Install SSDK dependencies with pnpm cache mount
276
- RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \\
277
- pnpm install --prefer-offline
278
-
279
- # Install rolldown plugins with pnpm cache mount
280
- RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \\
281
- pnpm add -D rolldown-plugin-dts@0.28.0 @rollup/plugin-esm-shim@0.1.8
282
-
283
- RUN cat <<EOF > rolldown.config.js
284
- import { dts } from 'rolldown-plugin-dts';
285
- import esmShim from '@rollup/plugin-esm-shim';
286
- import fs from 'fs';
287
- import path from 'path';
288
-
289
- // Bundle the re2-wasm wasm file as part of the module
290
- const re2WasmPlugin = () => ({
291
- name: 're2-wasm-plugin',
292
- resolveId: (id) => {
293
- if (!(id === 're2-wasm' || id.endsWith('/re2-wasm'))) return null;
294
- try {
295
- const dir = path.join(path.dirname(require.resolve('re2-wasm/package.json')), 'build/wasm');
296
- return fs.existsSync(path.join(dir, 're2.wasm')) && fs.existsSync(path.join(dir, 're2.js')) ? path.join(dir, 're2.js') : null;
297
- } catch { return null; }
298
- },
299
- load: (id) => {
300
- if (!(id.endsWith('re2.js') && id.includes('re2-wasm'))) return null;
301
- try {
302
- const wasmPath = path.join(path.dirname(id), 're2.wasm');
303
- return fs.existsSync(wasmPath) && fs.existsSync(id) ? \\\`var Module = { wasmBinary: Buffer.from("\\\${fs.readFileSync(wasmPath).toString('base64')}", "base64") }\\n\\\${fs.readFileSync(id, 'utf8')}\\\` : null;
304
- } catch { return null; }
305
- }
306
- });
307
-
308
- export default {
309
- input: './src/index.ts',
310
- plugins: [
311
- re2WasmPlugin(),
312
- dts({ resolve: true }),
313
- esmShim(),
314
- ],
315
- output: [{
316
- dir: 'dist',
317
- format: 'es',
318
- }],
319
- resolve: {
320
- tsconfigFilename: 'tsconfig.es.json',
321
- },
322
- platform: 'node',
323
- };
324
- EOF
325
-
326
- # Create SSDK bundle with rolldown
327
- RUN rolldown -c
328
-
329
- RUN mkdir -p /out/ssdk
330
- RUN cp dist/* /out/ssdk/
331
-
332
- # Export the /out directory
333
- FROM scratch AS export
334
- COPY --from=builder /out /
335
- "
336
- `;
337
-
338
245
  exports[`smithyProjectGenerator > should generate smithy project with default options > echo.smithy 1`] = `
339
246
  "$version: "2.0"
340
247
 
@@ -395,17 +302,36 @@ exports[`smithyProjectGenerator > should generate smithy project with default op
395
302
  },
396
303
  "targets": {
397
304
  "build": {
398
- "dependsOn": ["compile"]
305
+ "dependsOn": ["compile", "generate-ssdk"]
399
306
  },
400
307
  "compile": {
401
308
  "cache": true,
402
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
309
+ "outputs": [
310
+ "{workspaceRoot}/dist/{projectRoot}/smithy",
311
+ "{workspaceRoot}/dist/{projectRoot}/build/openapi"
312
+ ],
403
313
  "executor": "nx:run-commands",
404
314
  "options": {
405
315
  "commands": [
406
316
  "rimraf dist/{projectRoot}/build",
317
+ "rimraf dist/{projectRoot}/smithy",
407
318
  "make-dir dist/{projectRoot}/build",
408
- "docker build -f {projectRoot}/build.Dockerfile --build-context workspace=. --target export --output type=local,dest=dist/{projectRoot}/build {projectRoot}"
319
+ "npx -y mise@2026.8.3 exec smithy@1.72.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
320
+ "cpy \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi --flat --rename=openapi.json"
321
+ ],
322
+ "parallel": false,
323
+ "cwd": "{workspaceRoot}"
324
+ }
325
+ },
326
+ "generate-ssdk": {
327
+ "cache": true,
328
+ "outputs": ["{workspaceRoot}/dist/{projectRoot}/build/ssdk"],
329
+ "executor": "nx:run-commands",
330
+ "dependsOn": ["compile"],
331
+ "options": {
332
+ "commands": [
333
+ "npm install --prefix dist/{projectRoot}/smithy/source/typescript-ssdk-codegen --include=dev --ignore-scripts --no-audit --no-fund",
334
+ "rolldown -c {projectRoot}/ssdk.rolldown.config.mjs"
409
335
  ],
410
336
  "parallel": false,
411
337
  "cwd": "{workspaceRoot}"
@@ -434,17 +360,74 @@ exports[`smithyProjectGenerator > should generate smithy project with default op
434
360
  },
435
361
  "maven": {
436
362
  "dependencies": [
437
- "software.amazon.smithy:smithy-model:1.61.0",
438
- "software.amazon.smithy:smithy-aws-traits:1.61.0",
439
- "software.amazon.smithy:smithy-validation-model:1.61.0",
440
- "software.amazon.smithy:smithy-openapi:1.61.0",
441
- "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.34.1"
363
+ "software.amazon.smithy:smithy-model:1.72.1",
364
+ "software.amazon.smithy:smithy-aws-traits:1.72.1",
365
+ "software.amazon.smithy:smithy-validation-model:1.72.1",
366
+ "software.amazon.smithy:smithy-openapi:1.72.1",
367
+ "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.50.0"
442
368
  ]
443
369
  }
444
370
  }
445
371
  "
446
372
  `;
447
373
 
374
+ exports[`smithyProjectGenerator > should generate smithy project with default options > ssdk.rolldown.config.mjs 1`] = `
375
+ "import fs from 'node:fs';
376
+ import path from 'node:path';
377
+ import { dts } from 'rolldown-plugin-dts';
378
+
379
+ // The Smithy CLI generates the Server SDK under dist, along with its own
380
+ // dependencies, so paths are resolved from there rather than this project. The
381
+ // compile target runs from the workspace root, so these resolve there.
382
+ const ssdkDir = path.resolve(
383
+ 'dist',
384
+ 'test-api',
385
+ 'smithy/source/typescript-ssdk-codegen',
386
+ );
387
+
388
+ // Embed the re2 wasm binary in its emscripten glue module (\`Module.wasmBinary\`),
389
+ // so the bundle stays a single self-contained file. \`__dirname\` is what the
390
+ // glue's on-disk fallback would read, which an ES module doesn't define.
391
+ const inlineRe2Wasm = () => ({
392
+ name: 'inline-re2-wasm',
393
+ load: (id) => {
394
+ if (!/re2-wasm.*[\\\\/]wasm[\\\\/]re2\\.js$/.test(id)) return null;
395
+ const wasm = fs.readFileSync(path.join(path.dirname(id), 're2.wasm'));
396
+ return \`var __dirname = '';\\nvar Module = { wasmBinary: Buffer.from("\${wasm.toString('base64')}", "base64") };\\n\${fs.readFileSync(id, 'utf8')}\`;
397
+ },
398
+ });
399
+
400
+ // Drop any import whose specifier resolves to the importing module itself. A
401
+ // module cannot import its own exports — the Smithy CLI's Windows codegen writes
402
+ // exactly that, which the bundler rejects as an assignment to an import.
403
+ const dropSelfImports = () => ({
404
+ name: 'drop-self-imports',
405
+ transform: (code, id) => ({
406
+ code: code.replace(
407
+ /^import\\s+[^;]*?\\s+from\\s+["'](\\.[^"']*)["'];?\\s*$/gm,
408
+ (line, specifier) =>
409
+ path.resolve(path.dirname(id), specifier) ===
410
+ id.replace(/\\.[cm]?tsx?$/, '')
411
+ ? ''
412
+ : line,
413
+ ),
414
+ map: null,
415
+ }),
416
+ });
417
+
418
+ const outDir = path.resolve('dist', 'test-api', 'build/ssdk');
419
+
420
+ // Bundle from the generated TypeScript sources, emitting the module and its
421
+ // declarations in one pass.
422
+ export default {
423
+ input: path.join(ssdkDir, 'src/index.ts'),
424
+ plugins: [dropSelfImports(), inlineRe2Wasm(), dts({ resolve: true })],
425
+ output: [{ dir: outDir, format: 'es' }],
426
+ platform: 'node',
427
+ };
428
+ "
429
+ `;
430
+
448
431
  exports[`smithyProjectGenerator > should generate smithy project with subdirectory > subdir-project.json 1`] = `
449
432
  "{
450
433
  "name": "@proj/test-api",
@@ -459,17 +442,36 @@ exports[`smithyProjectGenerator > should generate smithy project with subdirecto
459
442
  },
460
443
  "targets": {
461
444
  "build": {
462
- "dependsOn": ["compile"]
445
+ "dependsOn": ["compile", "generate-ssdk"]
463
446
  },
464
447
  "compile": {
465
448
  "cache": true,
466
- "outputs": ["{workspaceRoot}/dist/{projectRoot}/build"],
449
+ "outputs": [
450
+ "{workspaceRoot}/dist/{projectRoot}/smithy",
451
+ "{workspaceRoot}/dist/{projectRoot}/build/openapi"
452
+ ],
467
453
  "executor": "nx:run-commands",
468
454
  "options": {
469
455
  "commands": [
470
456
  "rimraf dist/{projectRoot}/build",
457
+ "rimraf dist/{projectRoot}/smithy",
471
458
  "make-dir dist/{projectRoot}/build",
472
- "docker build -f {projectRoot}/build.Dockerfile --build-context workspace=. --target export --output type=local,dest=dist/{projectRoot}/build {projectRoot}"
459
+ "npx -y mise@2026.8.3 exec smithy@1.72.1 -- smithy build -c {projectRoot}/smithy-build.json --output dist/{projectRoot}/smithy",
460
+ "cpy \\"dist/{projectRoot}/smithy/source/openapi/*.openapi.json\\" dist/{projectRoot}/build/openapi --flat --rename=openapi.json"
461
+ ],
462
+ "parallel": false,
463
+ "cwd": "{workspaceRoot}"
464
+ }
465
+ },
466
+ "generate-ssdk": {
467
+ "cache": true,
468
+ "outputs": ["{workspaceRoot}/dist/{projectRoot}/build/ssdk"],
469
+ "executor": "nx:run-commands",
470
+ "dependsOn": ["compile"],
471
+ "options": {
472
+ "commands": [
473
+ "npm install --prefix dist/{projectRoot}/smithy/source/typescript-ssdk-codegen --include=dev --ignore-scripts --no-audit --no-fund",
474
+ "rolldown -c {projectRoot}/ssdk.rolldown.config.mjs"
473
475
  ],
474
476
  "parallel": false,
475
477
  "cwd": "{workspaceRoot}"
@@ -480,105 +482,6 @@ exports[`smithyProjectGenerator > should generate smithy project with subdirecto
480
482
  "
481
483
  `;
482
484
 
483
- exports[`smithyProjectGenerator > should generate valid Docker build configuration > dockerfile 1`] = `
484
- "FROM public.ecr.aws/docker/library/node:24 AS builder
485
- ENV CI=true
486
-
487
- # Output directory
488
- RUN mkdir /out
489
-
490
- # Install Smithy CLI
491
- # https://smithy.io/2.0/guides/smithy-cli/cli_installation.html
492
- WORKDIR /smithy
493
- ARG TARGETPLATFORM
494
- RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; else ARCH="x86_64"; fi && \\
495
- mkdir -p smithy-install/smithy && \\
496
- 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 && \\
497
- unzip -qo smithy-install/smithy-cli-linux-$ARCH.zip -d smithy-install && \\
498
- mv smithy-install/smithy-cli-linux-$ARCH/* smithy-install/smithy
499
- RUN smithy-install/smithy/install
500
-
501
- # Add node dependencies for bundling
502
- WORKDIR /project
503
- RUN npm i -g pnpm@11.1.1 rolldown@1.2.2
504
-
505
- # Copy project files
506
- COPY smithy-build.json .
507
- COPY src src
508
-
509
- # Smithy build with Maven cache mount
510
- RUN --mount=type=cache,target=/root/.m2/repository,id=maven-cache \\
511
- smithy build
512
-
513
- # Copy OpenAPI specification to output location
514
- RUN mkdir -p /out/openapi
515
- RUN cp /project/build/smithy/source/openapi/*.openapi.json /out/openapi/openapi.json
516
-
517
- WORKDIR /project/build/smithy/source/typescript-ssdk-codegen
518
-
519
- # Install SSDK dependencies with pnpm cache mount
520
- RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \\
521
- pnpm install --prefer-offline
522
-
523
- # Install rolldown plugins with pnpm cache mount
524
- RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \\
525
- pnpm add -D rolldown-plugin-dts@0.28.0 @rollup/plugin-esm-shim@0.1.8
526
-
527
- RUN cat <<EOF > rolldown.config.js
528
- import { dts } from 'rolldown-plugin-dts';
529
- import esmShim from '@rollup/plugin-esm-shim';
530
- import fs from 'fs';
531
- import path from 'path';
532
-
533
- // Bundle the re2-wasm wasm file as part of the module
534
- const re2WasmPlugin = () => ({
535
- name: 're2-wasm-plugin',
536
- resolveId: (id) => {
537
- if (!(id === 're2-wasm' || id.endsWith('/re2-wasm'))) return null;
538
- try {
539
- const dir = path.join(path.dirname(require.resolve('re2-wasm/package.json')), 'build/wasm');
540
- return fs.existsSync(path.join(dir, 're2.wasm')) && fs.existsSync(path.join(dir, 're2.js')) ? path.join(dir, 're2.js') : null;
541
- } catch { return null; }
542
- },
543
- load: (id) => {
544
- if (!(id.endsWith('re2.js') && id.includes('re2-wasm'))) return null;
545
- try {
546
- const wasmPath = path.join(path.dirname(id), 're2.wasm');
547
- return fs.existsSync(wasmPath) && fs.existsSync(id) ? \\\`var Module = { wasmBinary: Buffer.from("\\\${fs.readFileSync(wasmPath).toString('base64')}", "base64") }\\n\\\${fs.readFileSync(id, 'utf8')}\\\` : null;
548
- } catch { return null; }
549
- }
550
- });
551
-
552
- export default {
553
- input: './src/index.ts',
554
- plugins: [
555
- re2WasmPlugin(),
556
- dts({ resolve: true }),
557
- esmShim(),
558
- ],
559
- output: [{
560
- dir: 'dist',
561
- format: 'es',
562
- }],
563
- resolve: {
564
- tsconfigFilename: 'tsconfig.es.json',
565
- },
566
- platform: 'node',
567
- };
568
- EOF
569
-
570
- # Create SSDK bundle with rolldown
571
- RUN rolldown -c
572
-
573
- RUN mkdir -p /out/ssdk
574
- RUN cp dist/* /out/ssdk/
575
-
576
- # Export the /out directory
577
- FROM scratch AS export
578
- COPY --from=builder /out /
579
- "
580
- `;
581
-
582
485
  exports[`smithyProjectGenerator > should handle empty service name by using project name > default-service-name-main.smithy 1`] = `
583
486
  "$version: "2.0"
584
487
 
@@ -643,11 +546,11 @@ exports[`smithyProjectGenerator > should handle kebab-case conversion for servic
643
546
  },
644
547
  "maven": {
645
548
  "dependencies": [
646
- "software.amazon.smithy:smithy-model:1.61.0",
647
- "software.amazon.smithy:smithy-aws-traits:1.61.0",
648
- "software.amazon.smithy:smithy-validation-model:1.61.0",
649
- "software.amazon.smithy:smithy-openapi:1.61.0",
650
- "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.34.1"
549
+ "software.amazon.smithy:smithy-model:1.72.1",
550
+ "software.amazon.smithy:smithy-aws-traits:1.72.1",
551
+ "software.amazon.smithy:smithy-validation-model:1.72.1",
552
+ "software.amazon.smithy:smithy-openapi:1.72.1",
553
+ "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.50.0"
651
554
  ]
652
555
  }
653
556
  }
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "maven": {
17
17
  "dependencies": [
18
- "software.amazon.smithy:smithy-model:1.61.0",
19
- "software.amazon.smithy:smithy-aws-traits:1.61.0",
20
- "software.amazon.smithy:smithy-validation-model:1.61.0",
21
- "software.amazon.smithy:smithy-openapi:1.61.0",
22
- "software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.34.1"
18
+ "<%- smithyModelDependency %>",
19
+ "<%- smithyAwsTraitsDependency %>",
20
+ "<%- smithyValidationModelDependency %>",
21
+ "<%- smithyOpenApiDependency %>",
22
+ "<%- smithyTypeScriptCodegenDependency %>"
23
23
  ]
24
24
  }
25
25
  }
@@ -2,6 +2,6 @@
2
2
  "version": "1.0",
3
3
  "sources": ["src/"],
4
4
  "maven": {
5
- "dependencies": ["software.amazon.smithy:smithy-model:1.61.0"]
5
+ "dependencies": ["<%- smithyModelDependency %>"]
6
6
  }
7
7
  }
@@ -0,0 +1,52 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { dts } from 'rolldown-plugin-dts';
4
+
5
+ // The Smithy CLI generates the Server SDK under dist, along with its own
6
+ // dependencies, so paths are resolved from there rather than this project. The
7
+ // compile target runs from the workspace root, so these resolve there.
8
+ const ssdkDir = path.resolve(
9
+ 'dist',
10
+ '<%- projectRoot %>',
11
+ 'smithy/source/typescript-ssdk-codegen',
12
+ );
13
+
14
+ // Embed the re2 wasm binary in its emscripten glue module (`Module.wasmBinary`),
15
+ // so the bundle stays a single self-contained file. `__dirname` is what the
16
+ // glue's on-disk fallback would read, which an ES module doesn't define.
17
+ const inlineRe2Wasm = () => ({
18
+ name: 'inline-re2-wasm',
19
+ load: (id) => {
20
+ if (!/re2-wasm.*[\\/]wasm[\\/]re2\.js$/.test(id)) return null;
21
+ const wasm = fs.readFileSync(path.join(path.dirname(id), 're2.wasm'));
22
+ return `var __dirname = '';\nvar Module = { wasmBinary: Buffer.from("${wasm.toString('base64')}", "base64") };\n${fs.readFileSync(id, 'utf8')}`;
23
+ },
24
+ });
25
+
26
+ // Drop any import whose specifier resolves to the importing module itself. A
27
+ // module cannot import its own exports — the Smithy CLI's Windows codegen writes
28
+ // exactly that, which the bundler rejects as an assignment to an import.
29
+ const dropSelfImports = () => ({
30
+ name: 'drop-self-imports',
31
+ transform: (code, id) => ({
32
+ code: code.replace(
33
+ /^import\s+[^;]*?\s+from\s+["'](\.[^"']*)["'];?\s*$/gm,
34
+ (line, specifier) =>
35
+ path.resolve(path.dirname(id), specifier) === id.replace(/\.[cm]?tsx?$/, '')
36
+ ? ''
37
+ : line,
38
+ ),
39
+ map: null,
40
+ }),
41
+ });
42
+
43
+ const outDir = path.resolve('dist', '<%- projectRoot %>', 'build/ssdk');
44
+
45
+ // Bundle from the generated TypeScript sources, emitting the module and its
46
+ // declarations in one pass.
47
+ export default {
48
+ input: path.join(ssdkDir, 'src/index.ts'),
49
+ plugins: [dropSelfImports(), inlineRe2Wasm(), dts({ resolve: true })],
50
+ output: [{ dir: outDir, format: 'es' }],
51
+ platform: 'node',
52
+ };