sst 2.0.18 → 2.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sst.mjs CHANGED
@@ -2291,9 +2291,11 @@ var init_server2 = __esm({
2291
2291
  "Lambda-Runtime-Client-Context": JSON.stringify(
2292
2292
  payload.context.clientContext || {}
2293
2293
  ),
2294
- "Lambda-Runtime-Cognito-Identity": JSON.stringify(
2295
- payload.context.identity || {}
2296
- )
2294
+ ...payload.context.identity ? {
2295
+ "Lambda-Runtime-Cognito-Identity": JSON.stringify(
2296
+ payload.context.identity
2297
+ )
2298
+ } : {}
2297
2299
  });
2298
2300
  res.json(payload.event);
2299
2301
  }
@@ -2302,10 +2304,13 @@ var init_server2 = __esm({
2302
2304
  `/:workerID/${cfg.API_VERSION}/runtime/invocation/:awsRequestId/response`,
2303
2305
  express2.json({
2304
2306
  strict: false,
2305
- type: ["application/json", "application/*+json"],
2307
+ type() {
2308
+ return true;
2309
+ },
2306
2310
  limit: "10mb"
2307
2311
  }),
2308
2312
  (req, res) => {
2313
+ console.log(JSON.stringify(req.body, null, 4));
2309
2314
  Logger.debug("Worker", req.params.workerID, "got response", req.body);
2310
2315
  const worker = workers.fromID(req.params.workerID);
2311
2316
  bus.publish("function.success", {
@@ -4355,13 +4360,13 @@ async function listImports(exportName) {
4355
4360
  }
4356
4361
  }
4357
4362
  async function getLocalTemplate(stack) {
4358
- const fs18 = await import("fs/promises");
4359
- const fileContent = await fs18.readFile(stack.templateFullPath);
4363
+ const fs19 = await import("fs/promises");
4364
+ const fileContent = await fs19.readFile(stack.templateFullPath);
4360
4365
  return fileContent.toString();
4361
4366
  }
4362
4367
  async function saveLocalTemplate(stack, content) {
4363
- const fs18 = await import("fs/promises");
4364
- await fs18.writeFile(stack.templateFullPath, content);
4368
+ const fs19 = await import("fs/promises");
4369
+ await fs19.writeFile(stack.templateFullPath, content);
4365
4370
  }
4366
4371
  var init_deploy = __esm({
4367
4372
  "src/stacks/deploy.ts"() {
@@ -5048,19 +5053,131 @@ var init_go = __esm({
5048
5053
  }
5049
5054
  });
5050
5055
 
5056
+ // src/runtime/handlers/rust.ts
5057
+ var rust_exports = {};
5058
+ __export(rust_exports, {
5059
+ useRustHandler: () => useRustHandler
5060
+ });
5061
+ import path12 from "path";
5062
+ import fs12 from "fs/promises";
5063
+ import { exec as exec4, spawn as spawn4 } from "child_process";
5064
+ import { promisify as promisify3 } from "util";
5065
+ var execAsync3, useRustHandler;
5066
+ var init_rust = __esm({
5067
+ "src/runtime/handlers/rust.ts"() {
5068
+ "use strict";
5069
+ init_handlers();
5070
+ init_workers();
5071
+ init_context();
5072
+ init_error();
5073
+ init_server2();
5074
+ init_fs();
5075
+ execAsync3 = promisify3(exec4);
5076
+ useRustHandler = Context.memo(async () => {
5077
+ const workers = await useRuntimeWorkers();
5078
+ const server = await useRuntimeServerConfig();
5079
+ const handlers = useRuntimeHandlers();
5080
+ const processes = /* @__PURE__ */ new Map();
5081
+ const sources = /* @__PURE__ */ new Map();
5082
+ const handlerName = process.platform === "win32" ? `handler.exe` : `handler`;
5083
+ handlers.register({
5084
+ shouldBuild: (input) => {
5085
+ if (!input.file.endsWith(".rs"))
5086
+ return false;
5087
+ const parent = sources.get(input.functionID);
5088
+ if (!parent)
5089
+ return false;
5090
+ const result = isChild(parent, input.file);
5091
+ return result;
5092
+ },
5093
+ canHandle: (input) => input.startsWith("rust"),
5094
+ startWorker: async (input) => {
5095
+ const proc = spawn4(path12.join(input.out, handlerName), {
5096
+ env: {
5097
+ ...process.env,
5098
+ ...input.environment,
5099
+ IS_LOCAL: "true",
5100
+ RUST_BACKTRACE: "1",
5101
+ AWS_LAMBDA_RUNTIME_API: `http://localhost:${server.port}/${input.workerID}`,
5102
+ AWS_LAMBDA_FUNCTION_MEMORY_SIZE: "1024"
5103
+ },
5104
+ cwd: input.out
5105
+ });
5106
+ proc.on("exit", () => workers.exited(input.workerID));
5107
+ proc.stdout.on("data", (data2) => {
5108
+ workers.stdout(input.workerID, data2.toString());
5109
+ });
5110
+ proc.stderr.on("data", (data2) => {
5111
+ workers.stdout(input.workerID, data2.toString());
5112
+ });
5113
+ processes.set(input.workerID, proc);
5114
+ },
5115
+ stopWorker: async (workerID) => {
5116
+ const proc = processes.get(workerID);
5117
+ if (proc) {
5118
+ proc.kill();
5119
+ processes.delete(workerID);
5120
+ }
5121
+ },
5122
+ build: async (input) => {
5123
+ const parsed = path12.parse(input.props.handler);
5124
+ const project = await findAbove(parsed.dir, "Cargo.toml");
5125
+ sources.set(input.functionID, project);
5126
+ if (input.mode === "start") {
5127
+ try {
5128
+ await execAsync3(`cargo build --bin ${parsed.name}`, {
5129
+ cwd: project,
5130
+ env: {
5131
+ ...process.env
5132
+ }
5133
+ });
5134
+ await fs12.cp(
5135
+ path12.join(project, `target/debug`, parsed.name),
5136
+ path12.join(input.out, "handler")
5137
+ );
5138
+ } catch (ex) {
5139
+ throw new VisibleError("Failed to build");
5140
+ }
5141
+ }
5142
+ if (input.mode === "deploy") {
5143
+ try {
5144
+ await execAsync3(`cargo lambda build --release --bin ${parsed.name}`, {
5145
+ cwd: project,
5146
+ env: {
5147
+ ...process.env
5148
+ }
5149
+ });
5150
+ await fs12.cp(
5151
+ path12.join(project, `target/lambda/`, parsed.name, "bootstrap"),
5152
+ path12.join(input.out, "bootstrap")
5153
+ );
5154
+ } catch (ex) {
5155
+ throw new VisibleError("Failed to build");
5156
+ }
5157
+ }
5158
+ return {
5159
+ type: "success",
5160
+ handler: "handler"
5161
+ };
5162
+ }
5163
+ });
5164
+ });
5165
+ }
5166
+ });
5167
+
5051
5168
  // src/runtime/handlers/python.ts
5052
5169
  var python_exports = {};
5053
5170
  __export(python_exports, {
5054
5171
  usePythonHandler: () => usePythonHandler
5055
5172
  });
5056
- import path12 from "path";
5057
- import { exec as exec4, spawn as spawn4 } from "child_process";
5058
- import { promisify as promisify3 } from "util";
5173
+ import path13 from "path";
5174
+ import { exec as exec5, spawn as spawn5 } from "child_process";
5175
+ import { promisify as promisify4 } from "util";
5059
5176
  import { Runtime as Runtime2 } from "aws-cdk-lib/aws-lambda";
5060
- import fs12 from "fs/promises";
5177
+ import fs13 from "fs/promises";
5061
5178
  import os3 from "os";
5062
5179
  import url6 from "url";
5063
- var execAsync3, RUNTIME_MAP, usePythonHandler;
5180
+ var execAsync4, RUNTIME_MAP, usePythonHandler;
5064
5181
  var init_python = __esm({
5065
5182
  "src/runtime/handlers/python.ts"() {
5066
5183
  "use strict";
@@ -5069,7 +5186,7 @@ var init_python = __esm({
5069
5186
  init_context();
5070
5187
  init_server2();
5071
5188
  init_fs();
5072
- execAsync3 = promisify3(exec4);
5189
+ execAsync4 = promisify4(exec5);
5073
5190
  RUNTIME_MAP = {
5074
5191
  "python2.7": Runtime2.PYTHON_2_7,
5075
5192
  "python3.6": Runtime2.PYTHON_3_6,
@@ -5093,9 +5210,9 @@ var init_python = __esm({
5093
5210
  canHandle: (input) => input.startsWith("python"),
5094
5211
  startWorker: async (input) => {
5095
5212
  const src = await findAbove(input.handler, "requirements.txt");
5096
- const parsed = path12.parse(path12.relative(src, input.handler));
5097
- const target = [...parsed.dir.split(path12.sep), parsed.name].join(".");
5098
- const proc = spawn4(
5213
+ const parsed = path13.parse(path13.relative(src, input.handler));
5214
+ const target = [...parsed.dir.split(path13.sep), parsed.name].join(".");
5215
+ const proc = spawn5(
5099
5216
  os3.platform() === "win32" ? "python.exe" : "python3",
5100
5217
  [
5101
5218
  "-u",
@@ -5141,18 +5258,18 @@ var init_python = __esm({
5141
5258
  handler: input.props.handler
5142
5259
  };
5143
5260
  const src = await findAbove(input.props.handler, "requirements.txt");
5144
- await fs12.cp(src, input.out, {
5261
+ await fs13.cp(src, input.out, {
5145
5262
  recursive: true,
5146
5263
  filter: (src2) => !src2.includes(".sst")
5147
5264
  });
5148
5265
  if (input.props.python?.installCommands) {
5149
5266
  for (const cmd of input.props.python.installCommands) {
5150
- await execAsync3(cmd);
5267
+ await execAsync4(cmd);
5151
5268
  }
5152
5269
  }
5153
5270
  const result = {
5154
5271
  type: "success",
5155
- handler: path12.relative(src, path12.resolve(input.props.handler))
5272
+ handler: path13.relative(src, path13.resolve(input.props.handler))
5156
5273
  };
5157
5274
  return result;
5158
5275
  }
@@ -5166,14 +5283,14 @@ var java_exports = {};
5166
5283
  __export(java_exports, {
5167
5284
  useJavaHandler: () => useJavaHandler
5168
5285
  });
5169
- import path13 from "path";
5170
- import fs13 from "fs/promises";
5286
+ import path14 from "path";
5287
+ import fs14 from "fs/promises";
5171
5288
  import os4 from "os";
5172
5289
  import zipLocal from "zip-local";
5173
- import { spawn as spawn5 } from "child_process";
5290
+ import { spawn as spawn6 } from "child_process";
5174
5291
  import url7 from "url";
5175
5292
  async function getGradleBinary(srcPath) {
5176
- const gradleWrapperPath = path13.resolve(path13.join(srcPath, "gradlew"));
5293
+ const gradleWrapperPath = path14.resolve(path14.join(srcPath, "gradlew"));
5177
5294
  return await existsAsync(gradleWrapperPath) ? gradleWrapperPath : "gradle";
5178
5295
  }
5179
5296
  var useJavaHandler;
@@ -5205,7 +5322,7 @@ var init_java = __esm({
5205
5322
  },
5206
5323
  canHandle: (input) => input.startsWith("java"),
5207
5324
  startWorker: async (input) => {
5208
- const proc = spawn5(
5325
+ const proc = spawn6(
5209
5326
  `java`,
5210
5327
  [
5211
5328
  `-cp`,
@@ -5257,11 +5374,11 @@ var init_java = __esm({
5257
5374
  cwd: srcPath
5258
5375
  }
5259
5376
  );
5260
- const buildOutput = path13.join(srcPath, "build", outputDir);
5261
- const zip = (await fs13.readdir(buildOutput)).find(
5377
+ const buildOutput = path14.join(srcPath, "build", outputDir);
5378
+ const zip = (await fs14.readdir(buildOutput)).find(
5262
5379
  (f) => f.endsWith(".zip")
5263
5380
  );
5264
- zipLocal.sync.unzip(path13.join(buildOutput, zip)).save(input.out);
5381
+ zipLocal.sync.unzip(path14.join(buildOutput, zip)).save(input.out);
5265
5382
  return {
5266
5383
  type: "success",
5267
5384
  handler: input.props.handler
@@ -5280,12 +5397,13 @@ var init_java = __esm({
5280
5397
 
5281
5398
  // src/stacks/synth.ts
5282
5399
  import * as contextproviders from "aws-cdk/lib/context-providers/index.js";
5283
- import path14 from "path";
5400
+ import path15 from "path";
5284
5401
  async function synth(opts) {
5285
5402
  Logger.debug("Synthesizing stacks...");
5286
5403
  const { App: App2 } = await import("../src/constructs/App.js");
5287
5404
  const { useNodeHandler: useNodeHandler2 } = await Promise.resolve().then(() => (init_node(), node_exports));
5288
5405
  const { useGoHandler: useGoHandler2 } = await Promise.resolve().then(() => (init_go(), go_exports));
5406
+ const { useRustHandler: useRustHandler2 } = await Promise.resolve().then(() => (init_rust(), rust_exports));
5289
5407
  const { usePythonHandler: usePythonHandler2 } = await Promise.resolve().then(() => (init_python(), python_exports));
5290
5408
  const { useJavaHandler: useJavaHandler2 } = await Promise.resolve().then(() => (init_java(), java_exports));
5291
5409
  useNodeHandler2();
@@ -5293,12 +5411,13 @@ async function synth(opts) {
5293
5411
  usePythonHandler2();
5294
5412
  useJavaHandler2();
5295
5413
  useDotnetHandler();
5414
+ useRustHandler2();
5296
5415
  const { Configuration } = await import("aws-cdk/lib/settings.js");
5297
5416
  const project = useProject();
5298
5417
  const identity = await useSTSIdentity();
5299
5418
  opts = {
5300
5419
  ...opts,
5301
- buildDir: opts.buildDir || path14.join(project.paths.out, "dist")
5420
+ buildDir: opts.buildDir || path15.join(project.paths.out, "dist")
5302
5421
  };
5303
5422
  const cfg = new Configuration();
5304
5423
  await cfg.load();
@@ -5672,16 +5791,16 @@ __export(pothos_exports, {
5672
5791
  import babel from "@babel/core";
5673
5792
  import generator from "@babel/generator";
5674
5793
  import esbuild3 from "esbuild";
5675
- import fs14 from "fs/promises";
5676
- import path15 from "path";
5794
+ import fs15 from "fs/promises";
5795
+ import path16 from "path";
5677
5796
  import url8 from "url";
5678
5797
  async function generate(opts) {
5679
5798
  const { printSchema, lexicographicSortSchema } = await import("graphql");
5680
5799
  const contents = await extractSchema(opts);
5681
- const out = path15.join(path15.dirname(opts.schema), "out.mjs");
5682
- await fs14.writeFile(out, contents, "utf8");
5800
+ const out = path16.join(path16.dirname(opts.schema), "out.mjs");
5801
+ await fs15.writeFile(out, contents, "utf8");
5683
5802
  const { schema } = await import(url8.pathToFileURL(out).href + "?bust=" + Date.now());
5684
- await fs14.rm(out);
5803
+ await fs15.rm(out);
5685
5804
  const schemaAsString = printSchema(lexicographicSortSchema(schema));
5686
5805
  return schemaAsString;
5687
5806
  }
@@ -5716,15 +5835,15 @@ async function extractSchema(opts) {
5716
5835
  {
5717
5836
  name: "pothos-extractor",
5718
5837
  visitor: {
5719
- Program(path18) {
5720
- const dummyResolverId = path18.scope.generateUidIdentifier("DUMMY_RESOLVER");
5838
+ Program(path19) {
5839
+ const dummyResolverId = path19.scope.generateUidIdentifier("DUMMY_RESOLVER");
5721
5840
  const resolverNode = dummyResolver({
5722
5841
  dummy_resolver: dummyResolverId
5723
5842
  });
5724
- path18.unshiftContainer("body", resolverNode);
5725
- path18.scope.crawl();
5843
+ path19.unshiftContainer("body", resolverNode);
5844
+ path19.scope.crawl();
5726
5845
  let schemaBuilder = null;
5727
- path18.traverse({
5846
+ path19.traverse({
5728
5847
  ImportDeclaration(declarator) {
5729
5848
  if (!declarator)
5730
5849
  return;
@@ -5782,17 +5901,17 @@ async function extractSchema(opts) {
5782
5901
  );
5783
5902
  return contents.code;
5784
5903
  }
5785
- function getBindings(path18, globalPaths) {
5904
+ function getBindings(path19, globalPaths) {
5786
5905
  const bindings = [];
5787
- path18.traverse({
5906
+ path19.traverse({
5788
5907
  Expression(expressionPath) {
5789
5908
  if (!expressionPath.isIdentifier())
5790
5909
  return;
5791
- const binding = path18.scope.getBinding(expressionPath);
5910
+ const binding = path19.scope.getBinding(expressionPath);
5792
5911
  if (!binding || globalPaths.has(binding.path) || bindings.includes(binding.path))
5793
5912
  return;
5794
5913
  const rootBinding = findRootBinding(binding.path);
5795
- if (path18 === rootBinding) {
5914
+ if (path19 === rootBinding) {
5796
5915
  bindings.push(binding.path);
5797
5916
  return;
5798
5917
  }
@@ -5805,8 +5924,8 @@ function getBindings(path18, globalPaths) {
5805
5924
  }
5806
5925
  return bindings;
5807
5926
  }
5808
- function findRootBinding(path18) {
5809
- let rootPath = path18;
5927
+ function findRootBinding(path19) {
5928
+ let rootPath = path19;
5810
5929
  while (rootPath.parentPath?.node !== void 0 && !rootPath.parentPath?.isProgram()) {
5811
5930
  rootPath = rootPath.parentPath;
5812
5931
  }
@@ -5829,11 +5948,11 @@ var pothos_exports2 = {};
5829
5948
  __export(pothos_exports2, {
5830
5949
  usePothosBuilder: () => usePothosBuilder
5831
5950
  });
5832
- import fs15 from "fs/promises";
5833
- import { exec as exec5 } from "child_process";
5834
- import { promisify as promisify4 } from "util";
5835
- import path16 from "path";
5836
- var execAsync4, usePothosBuilder;
5951
+ import fs16 from "fs/promises";
5952
+ import { exec as exec6 } from "child_process";
5953
+ import { promisify as promisify5 } from "util";
5954
+ import path17 from "path";
5955
+ var execAsync5, usePothosBuilder;
5837
5956
  var init_pothos2 = __esm({
5838
5957
  "src/cli/commands/plugins/pothos.ts"() {
5839
5958
  "use strict";
@@ -5841,7 +5960,7 @@ var init_pothos2 = __esm({
5841
5960
  init_context();
5842
5961
  init_pothos();
5843
5962
  init_colors();
5844
- execAsync4 = promisify4(exec5);
5963
+ execAsync5 = promisify5(exec6);
5845
5964
  usePothosBuilder = Context.memo(() => {
5846
5965
  let routes = [];
5847
5966
  const bus = useBus();
@@ -5850,9 +5969,9 @@ var init_pothos2 = __esm({
5850
5969
  const schema = await pothos_exports.generate({
5851
5970
  schema: route.schema
5852
5971
  });
5853
- await fs15.writeFile(route.output, schema);
5972
+ await fs16.writeFile(route.output, schema);
5854
5973
  if (Array.isArray(route.commands) && route.commands.length > 0) {
5855
- await Promise.all(route.commands.map((cmd) => execAsync4(cmd)));
5974
+ await Promise.all(route.commands.map((cmd) => execAsync5(cmd)));
5856
5975
  }
5857
5976
  Colors.line(Colors.success(`\u2714`), " Pothos: Extracted pothos schema");
5858
5977
  } catch (ex) {
@@ -5866,9 +5985,9 @@ var init_pothos2 = __esm({
5866
5985
  if (evt.properties.file.endsWith("out.mjs"))
5867
5986
  return;
5868
5987
  for (const route of routes) {
5869
- const dir = path16.dirname(route.schema);
5870
- const relative = path16.relative(dir, evt.properties.file);
5871
- if (relative && !relative.startsWith("..") && !path16.isAbsolute(relative))
5988
+ const dir = path17.dirname(route.schema);
5989
+ const relative = path17.relative(dir, evt.properties.file);
5990
+ if (relative && !relative.startsWith("..") && !path17.isAbsolute(relative))
5872
5991
  build2(route);
5873
5992
  }
5874
5993
  });
@@ -5894,7 +6013,7 @@ __export(kysely_exports, {
5894
6013
  import { Kysely } from "kysely";
5895
6014
  import { DataApiDialect } from "kysely-data-api";
5896
6015
  import RDSDataService from "aws-sdk/clients/rdsdataservice.js";
5897
- import * as fs16 from "fs/promises";
6016
+ import * as fs17 from "fs/promises";
5898
6017
  import {
5899
6018
  DatabaseMetadata,
5900
6019
  EnumCollection,
@@ -5970,7 +6089,7 @@ var init_kysely = __esm({
5970
6089
  };
5971
6090
  const serializer = new Serializer();
5972
6091
  const data2 = serializer.serialize(nodes);
5973
- await fs16.writeFile(db.types.path, data2);
6092
+ await fs17.writeFile(db.types.path, data2);
5974
6093
  }
5975
6094
  bus.subscribe("stacks.metadata", (evt) => {
5976
6095
  const constructs = Object.values(evt.properties).flat();
@@ -6329,14 +6448,14 @@ var env = (program2) => program2.command(
6329
6448
  ),
6330
6449
  async (args) => {
6331
6450
  const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
6332
- const fs18 = await import("fs/promises");
6451
+ const fs19 = await import("fs/promises");
6333
6452
  const { SiteEnv } = await Promise.resolve().then(() => (init_site_env(), site_env_exports));
6334
6453
  const { spawnSync } = await import("child_process");
6335
6454
  const { useAWSCredentials: useAWSCredentials2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
6336
6455
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
6337
6456
  let spinner;
6338
6457
  while (true) {
6339
- const exists = await fs18.access(SiteEnv.valuesFile()).then(() => true).catch(() => false);
6458
+ const exists = await fs19.access(SiteEnv.valuesFile()).then(() => true).catch(() => false);
6340
6459
  if (!exists) {
6341
6460
  spinner = createSpinner2(
6342
6461
  "Cannot find SST environment variables. Waiting for SST to start..."
@@ -6398,8 +6517,8 @@ var dev = (program2) => program2.command(
6398
6517
  const { Context: Context2 } = await Promise.resolve().then(() => (init_context(), context_exports));
6399
6518
  const { printDeploymentResults: printDeploymentResults2, DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
6400
6519
  const { useLocalServer: useLocalServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
6401
- const path18 = await import("path");
6402
- const fs18 = await import("fs/promises");
6520
+ const path19 = await import("path");
6521
+ const fs19 = await import("fs/promises");
6403
6522
  const crypto2 = await import("crypto");
6404
6523
  const { useFunctions: useFunctions3 } = await import("../src/constructs/Function.js");
6405
6524
  const { SiteEnv } = await Promise.resolve().then(() => (init_site_env(), site_env_exports));
@@ -6588,8 +6707,8 @@ var dev = (program2) => program2.command(
6588
6707
  }
6589
6708
  await SiteEnv.writeValues(result);
6590
6709
  }
6591
- fs18.writeFile(
6592
- path18.join(project.paths.out, "outputs.json"),
6710
+ fs19.writeFile(
6711
+ path19.join(project.paths.out, "outputs.json"),
6593
6712
  JSON.stringify(
6594
6713
  pipe2(
6595
6714
  results,
@@ -6605,17 +6724,17 @@ var dev = (program2) => program2.command(
6605
6724
  build2();
6606
6725
  }
6607
6726
  async function checksum(cdkOutPath) {
6608
- const manifestPath = path18.join(cdkOutPath, "manifest.json");
6727
+ const manifestPath = path19.join(cdkOutPath, "manifest.json");
6609
6728
  const cdkManifest = JSON.parse(
6610
- await fs18.readFile(manifestPath).then((x) => x.toString())
6729
+ await fs19.readFile(manifestPath).then((x) => x.toString())
6611
6730
  );
6612
6731
  const checksumData = await Promise.all(
6613
6732
  Object.keys(cdkManifest.artifacts).filter(
6614
6733
  (key) => cdkManifest.artifacts[key].type === "aws:cloudformation:stack"
6615
6734
  ).map(async (key) => {
6616
6735
  const { templateFile } = cdkManifest.artifacts[key].properties;
6617
- const templatePath = path18.join(cdkOutPath, templateFile);
6618
- const templateContent = await fs18.readFile(templatePath);
6736
+ const templatePath = path19.join(cdkOutPath, templateFile);
6737
+ const templateContent = await fs19.readFile(templatePath);
6619
6738
  return templateContent;
6620
6739
  })
6621
6740
  ).then((x) => x.join("\n"));
@@ -6725,7 +6844,7 @@ var build = (program2) => program2.command(
6725
6844
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
6726
6845
  const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
6727
6846
  const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
6728
- const path18 = await import("path");
6847
+ const path19 = await import("path");
6729
6848
  const result = await Stacks.synth({
6730
6849
  fn: useProject2().stacks,
6731
6850
  buildDir: args.to,
@@ -6735,7 +6854,7 @@ var build = (program2) => program2.command(
6735
6854
  Colors2.line(
6736
6855
  Colors2.success(`\u2714`),
6737
6856
  Colors2.bold(" Built:"),
6738
- `${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${path18.relative(process.cwd(), result.directory)}`
6857
+ `${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${path19.relative(process.cwd(), result.directory)}`
6739
6858
  );
6740
6859
  process.exit(0);
6741
6860
  }
@@ -6744,8 +6863,8 @@ var build = (program2) => program2.command(
6744
6863
  // src/cli/commands/deploy.tsx
6745
6864
  init_credentials();
6746
6865
  init_colors();
6747
- import fs17 from "fs/promises";
6748
- import path17 from "path";
6866
+ import fs18 from "fs/promises";
6867
+ import path18 from "path";
6749
6868
  var deploy2 = (program2) => program2.command(
6750
6869
  "deploy [filter]",
6751
6870
  "Deploy your app to AWS",
@@ -6814,8 +6933,8 @@ var deploy2 = (program2) => program2.command(
6814
6933
  printDeploymentResults2(assembly, results);
6815
6934
  if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
6816
6935
  process.exit(1);
6817
- fs17.writeFile(
6818
- path17.join(project.paths.out, "outputs.json"),
6936
+ fs18.writeFile(
6937
+ path18.join(project.paths.out, "outputs.json"),
6819
6938
  JSON.stringify(
6820
6939
  mapValues2(results, (val) => val.outputs),
6821
6940
  null,
@@ -7099,22 +7218,22 @@ var update = (program2) => program2.command(
7099
7218
  }),
7100
7219
  async (args) => {
7101
7220
  const { green, yellow } = await import("colorette");
7102
- const fs18 = await import("fs/promises");
7103
- const path18 = await import("path");
7221
+ const fs19 = await import("fs/promises");
7222
+ const path19 = await import("path");
7104
7223
  const { fetch } = await import("undici");
7105
7224
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
7106
7225
  const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
7107
7226
  async function find2(dir) {
7108
- const children = await fs18.readdir(dir);
7227
+ const children = await fs19.readdir(dir);
7109
7228
  const tasks2 = children.map(async (item) => {
7110
7229
  if (item === "node_modules")
7111
7230
  return [];
7112
7231
  if (/(^|\/)\.[^\/\.]/g.test(item))
7113
7232
  return [];
7114
- const full = path18.join(dir, item);
7233
+ const full = path19.join(dir, item);
7115
7234
  if (item === "package.json")
7116
7235
  return [full];
7117
- const stat = await fs18.stat(full);
7236
+ const stat = await fs19.stat(full);
7118
7237
  if (stat.isDirectory())
7119
7238
  return find2(full);
7120
7239
  return [];
@@ -7128,7 +7247,7 @@ var update = (program2) => program2.command(
7128
7247
  ).then((resp) => resp.json());
7129
7248
  const results = /* @__PURE__ */ new Map();
7130
7249
  const tasks = files.map(async (file) => {
7131
- const data2 = await fs18.readFile(file).then((x) => x.toString()).then(JSON.parse);
7250
+ const data2 = await fs19.readFile(file).then((x) => x.toString()).then(JSON.parse);
7132
7251
  for (const field of FIELDS) {
7133
7252
  const deps = data2[field];
7134
7253
  if (!deps)
@@ -7156,7 +7275,7 @@ var update = (program2) => program2.command(
7156
7275
  deps[pkg] = desired;
7157
7276
  }
7158
7277
  }
7159
- await fs18.writeFile(file, JSON.stringify(data2, null, 2));
7278
+ await fs19.writeFile(file, JSON.stringify(data2, null, 2));
7160
7279
  });
7161
7280
  await Promise.all(tasks);
7162
7281
  if (results.size === 0) {
@@ -7166,7 +7285,7 @@ var update = (program2) => program2.command(
7166
7285
  for (const [file, pkgs] of results.entries()) {
7167
7286
  Colors2.line(
7168
7287
  Colors2.success(`\u2714 `),
7169
- Colors2.bold.dim(path18.relative(project.paths.root, file))
7288
+ Colors2.bold.dim(path19.relative(project.paths.root, file))
7170
7289
  );
7171
7290
  for (const [pkg, version2] of pkgs) {
7172
7291
  Colors2.line(Colors2.dim(` ${pkg}@${version2}`));
package/stacks/synth.js CHANGED
@@ -10,6 +10,7 @@ export async function synth(opts) {
10
10
  const { App } = await import("../constructs/App.js");
11
11
  const { useNodeHandler } = await import("../runtime/handlers/node.js");
12
12
  const { useGoHandler } = await import("../runtime/handlers/go.js");
13
+ const { useRustHandler } = await import("../runtime/handlers/rust.js");
13
14
  const { usePythonHandler } = await import("../runtime/handlers/python.js");
14
15
  const { useJavaHandler } = await import("../runtime/handlers/java.js");
15
16
  useNodeHandler();
@@ -17,6 +18,7 @@ export async function synth(opts) {
17
18
  usePythonHandler();
18
19
  useJavaHandler();
19
20
  useDotnetHandler();
21
+ useRustHandler();
20
22
  const { Configuration } = await import("aws-cdk/lib/settings.js");
21
23
  const project = useProject();
22
24
  const identity = await useSTSIdentity();