sst 2.16.0 → 2.16.2

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.
@@ -114,6 +114,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
114
114
  const useStackBuilder = Context.memo(async () => {
115
115
  const watcher = useWatcher();
116
116
  const project = useProject();
117
+ const scriptVersion = Date.now().toString();
117
118
  let lastDeployed;
118
119
  let isWorking = false;
119
120
  let isDirty = false;
@@ -135,6 +136,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
135
136
  project.stacks = sstConfig.stacks;
136
137
  const assembly = await Stacks.synth({
137
138
  increaseTimeout: args["increase-timeout"],
139
+ scriptVersion,
138
140
  fn: project.stacks,
139
141
  outDir: `.sst/cdk.out`,
140
142
  mode: "dev",
@@ -14,4 +14,6 @@ export declare const diff: (program: Program) => import("yargs").Argv<{
14
14
  future: boolean | undefined;
15
15
  } & {
16
16
  dev: boolean | undefined;
17
+ } & {
18
+ to: string | undefined;
17
19
  }>;
@@ -1,7 +1,12 @@
1
1
  import { stackNameToId } from "../ui/stack.js";
2
- export const diff = (program) => program.command("diff", "Compare your app with what is deployed on AWS", (yargs) => yargs.option("dev", {
2
+ export const diff = (program) => program.command("diff", "Compare your app with what is deployed on AWS", (yargs) => yargs
3
+ .option("dev", {
3
4
  type: "boolean",
4
5
  describe: "Compare in dev mode",
6
+ })
7
+ .option("to", {
8
+ type: "string",
9
+ describe: "Output directory, defaults to .sst/dist",
5
10
  }), async (args) => {
6
11
  const { useProject } = await import("../../project.js");
7
12
  const { Stacks } = await import("../../stacks/index.js");
@@ -14,6 +19,7 @@ export const diff = (program) => program.command("diff", "Compare your app with
14
19
  const [_metafile, sstConfig] = await Stacks.load(project.paths.config);
15
20
  const assembly = await Stacks.synth({
16
21
  fn: sstConfig.stacks,
22
+ buildDir: args.to,
17
23
  mode: args.dev ? "dev" : "deploy",
18
24
  });
19
25
  // Diff each stack
@@ -30,7 +30,7 @@ export interface AppDeployProps {
30
30
  readonly region?: string;
31
31
  readonly buildDir?: string;
32
32
  readonly account?: string;
33
- readonly debugStartedAt?: number;
33
+ readonly debugScriptVersion?: string;
34
34
  readonly debugIncreaseTimeout?: boolean;
35
35
  readonly mode: "deploy" | "dev" | "remove";
36
36
  readonly isActiveStack?: (stackName: string) => boolean;
@@ -66,7 +66,7 @@ export declare class App extends CDKApp {
66
66
  */
67
67
  readonly account: string;
68
68
  /** @internal */
69
- readonly debugStartedAt?: number;
69
+ readonly debugScriptVersion?: string;
70
70
  /** @internal */
71
71
  readonly debugIncreaseTimeout?: boolean;
72
72
  /** @internal */
package/constructs/App.js CHANGED
@@ -50,7 +50,7 @@ export class App extends CDKApp {
50
50
  */
51
51
  account;
52
52
  /** @internal */
53
- debugStartedAt;
53
+ debugScriptVersion;
54
54
  /** @internal */
55
55
  debugIncreaseTimeout;
56
56
  /** @internal */
@@ -82,7 +82,7 @@ export class App extends CDKApp {
82
82
  this.isActiveStack = deployProps.isActiveStack;
83
83
  this.defaultFunctionProps = [];
84
84
  if (this.mode === "dev") {
85
- this.debugStartedAt = deployProps.debugStartedAt;
85
+ this.debugScriptVersion = deployProps.debugScriptVersion;
86
86
  this.debugIncreaseTimeout = deployProps.debugIncreaseTimeout;
87
87
  }
88
88
  }
@@ -144,9 +144,8 @@ export class Script extends Construct {
144
144
  // when rebuilding infrastructure. Otherwise, there will always be
145
145
  // a change when rebuilding infrastructure b/c the "version" property
146
146
  // changes on each build.
147
- const version = app.mode === "dev"
148
- ? app.debugStartedAt
149
- : this.props.version ?? Date.now().toString();
147
+ const defaultVersion = app.mode === "dev" ? app.debugScriptVersion : Date.now().toString();
148
+ const version = this.props.version ?? defaultVersion;
150
149
  new CustomResource(this, "ScriptResource", {
151
150
  serviceToken: crFunction.functionArn,
152
151
  resourceType: "Custom::SSTScript",
@@ -10,6 +10,7 @@ export interface StaticSiteFileOptions {
10
10
  exclude: string | string[];
11
11
  include: string | string[];
12
12
  cacheControl: string;
13
+ contentType?: string;
13
14
  }
14
15
  export interface StaticSiteProps {
15
16
  /**
@@ -358,18 +358,19 @@ interface ImportMeta {
358
358
  BucketName: filenamesAsset.s3BucketName,
359
359
  ObjectKey: filenamesAsset.s3ObjectKey,
360
360
  },
361
- FileOptions: (fileOptions || []).map(({ exclude, include, cacheControl }) => {
361
+ FileOptions: (fileOptions || []).map(({ exclude, include, cacheControl, contentType }) => {
362
362
  if (typeof exclude === "string") {
363
363
  exclude = [exclude];
364
364
  }
365
365
  if (typeof include === "string") {
366
366
  include = [include];
367
367
  }
368
- const options = [];
369
- exclude.forEach((per) => options.push("--exclude", per));
370
- include.forEach((per) => options.push("--include", per));
371
- options.push("--cache-control", cacheControl);
372
- return options;
368
+ return [
369
+ ...exclude.map((per) => ["--exclude", per]),
370
+ ...include.map((per) => ["--include", per]),
371
+ ["--cache-control", cacheControl],
372
+ contentType ? ["--content-type", contentType] : [],
373
+ ].flat();
373
374
  }),
374
375
  ReplaceValues: this.getS3ContentReplaceValues(),
375
376
  },
@@ -482,6 +483,10 @@ function handler(event) {
482
483
  var request = event.request;
483
484
  var uri = request.uri;
484
485
 
486
+ if (uri.startsWith("/.well-known/")) {
487
+ return request;
488
+ }
489
+
485
490
  if (uri.endsWith("/")) {
486
491
  request.uri += "index.html";
487
492
  } else if (!uri.split("/").pop().includes(".")) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.16.0",
4
+ "version": "2.16.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -95,6 +95,7 @@ export const usePythonHandler = Context.memo(async () => {
95
95
  installCommands: input.props.python?.installCommands,
96
96
  entry: src,
97
97
  runtime: RUNTIME_MAP[input.props.runtime],
98
+ architecture: input.props.architecture,
98
99
  outputPathSuffix: ".",
99
100
  out: input.out,
100
101
  });
@@ -1,4 +1,5 @@
1
1
  import { Runtime } from "aws-cdk-lib/aws-lambda";
2
+ import { FunctionProps } from "../../constructs/Function.js";
2
3
  import { AssetHashType } from "aws-cdk-lib/core";
3
4
  /**
4
5
  * Dependency files to exclude from the asset hash.
@@ -20,6 +21,10 @@ export interface BundlingOptions {
20
21
  * The runtime of the lambda function
21
22
  */
22
23
  readonly runtime: Runtime;
24
+ /**
25
+ * Architecture used by the lambda function
26
+ */
27
+ readonly architecture: FunctionProps["architecture"];
23
28
  /**
24
29
  * Output path suffix ('python' for a layer, '.' otherwise)
25
30
  */
@@ -18,7 +18,7 @@ export const BUNDLER_DEPENDENCIES_CACHE = "/var/dependencies";
18
18
  * Produce bundled Lambda asset code
19
19
  */
20
20
  export function bundle(options) {
21
- const { entry, runtime, outputPathSuffix, installCommands } = options;
21
+ const { entry, runtime, architecture, outputPathSuffix, installCommands } = options;
22
22
  const stagedir = FileSystem.mkdtemp("python-bundling-");
23
23
  const hasDeps = stageDependencies(entry, stagedir);
24
24
  const hasInstallCommands = stageInstallCommands(installCommands || [], stagedir);
@@ -35,7 +35,9 @@ export function bundle(options) {
35
35
  fs.copyFileSync(path.join(__dirname, "../../support/python-runtime", dockerfile), path.join(stagedir, dockerfile));
36
36
  const image = DockerImage.fromBuild(stagedir, {
37
37
  buildArgs: {
38
- IMAGE: runtime.bundlingImage.image,
38
+ IMAGE: runtime.bundlingImage.image +
39
+ // the default x86_64 doesn't need to be set explicitly
40
+ (architecture == "arm_64" ? ":latest-arm64" : ""),
39
41
  },
40
42
  file: dockerfile,
41
43
  });
package/sst.mjs CHANGED
@@ -4815,7 +4815,7 @@ import url5 from "url";
4815
4815
  import path11 from "path";
4816
4816
  import { DockerImage, FileSystem } from "aws-cdk-lib/core";
4817
4817
  function bundle(options) {
4818
- const { entry, runtime, outputPathSuffix, installCommands } = options;
4818
+ const { entry, runtime, architecture, outputPathSuffix, installCommands } = options;
4819
4819
  const stagedir = FileSystem.mkdtemp("python-bundling-");
4820
4820
  const hasDeps = stageDependencies(entry, stagedir);
4821
4821
  const hasInstallCommands = stageInstallCommands(
@@ -4829,7 +4829,7 @@ function bundle(options) {
4829
4829
  );
4830
4830
  const image = DockerImage.fromBuild(stagedir, {
4831
4831
  buildArgs: {
4832
- IMAGE: runtime.bundlingImage.image
4832
+ IMAGE: runtime.bundlingImage.image + (architecture == "arm_64" ? ":latest-arm64" : "")
4833
4833
  },
4834
4834
  file: dockerfile
4835
4835
  });
@@ -4985,6 +4985,7 @@ var init_python = __esm({
4985
4985
  installCommands: input.props.python?.installCommands,
4986
4986
  entry: src,
4987
4987
  runtime: RUNTIME_MAP[input.props.runtime],
4988
+ architecture: input.props.architecture,
4988
4989
  outputPathSuffix: ".",
4989
4990
  out: input.out
4990
4991
  });
@@ -5151,6 +5152,7 @@ async function synth(opts) {
5151
5152
  region: project.config.region,
5152
5153
  mode: opts.mode,
5153
5154
  debugIncreaseTimeout: opts.increaseTimeout,
5155
+ debugScriptVersion: opts.scriptVersion,
5154
5156
  isActiveStack: opts.isActiveStack
5155
5157
  },
5156
5158
  {
@@ -7140,6 +7142,7 @@ var dev = (program2) => program2.command(
7140
7142
  const useStackBuilder = Context2.memo(async () => {
7141
7143
  const watcher = useWatcher2();
7142
7144
  const project = useProject2();
7145
+ const scriptVersion = Date.now().toString();
7143
7146
  let lastDeployed;
7144
7147
  let isWorking = false;
7145
7148
  let isDirty = false;
@@ -7163,6 +7166,7 @@ var dev = (program2) => program2.command(
7163
7166
  project.stacks = sstConfig.stacks;
7164
7167
  const assembly = await Stacks.synth({
7165
7168
  increaseTimeout: args["increase-timeout"],
7169
+ scriptVersion,
7166
7170
  fn: project.stacks,
7167
7171
  outDir: `.sst/cdk.out`,
7168
7172
  mode: "dev"
@@ -8294,6 +8298,9 @@ var diff2 = (program2) => program2.command(
8294
8298
  (yargs2) => yargs2.option("dev", {
8295
8299
  type: "boolean",
8296
8300
  describe: "Compare in dev mode"
8301
+ }).option("to", {
8302
+ type: "string",
8303
+ describe: "Output directory, defaults to .sst/dist"
8297
8304
  }),
8298
8305
  async (args) => {
8299
8306
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
@@ -8306,6 +8313,7 @@ var diff2 = (program2) => program2.command(
8306
8313
  const [_metafile, sstConfig] = await Stacks.load(project.paths.config);
8307
8314
  const assembly = await Stacks.synth({
8308
8315
  fn: sstConfig.stacks,
8316
+ buildDir: args.to,
8309
8317
  mode: args.dev ? "dev" : "deploy"
8310
8318
  });
8311
8319
  let changesAcc = 0;
package/stacks/synth.d.ts CHANGED
@@ -3,6 +3,7 @@ interface SynthOptions {
3
3
  buildDir?: string;
4
4
  outDir?: string;
5
5
  increaseTimeout?: boolean;
6
+ scriptVersion?: string;
6
7
  mode: App["mode"];
7
8
  fn: (app: App) => Promise<void> | void;
8
9
  isActiveStack?: (stackName: string) => boolean;
package/stacks/synth.js CHANGED
@@ -46,6 +46,7 @@ export async function synth(opts) {
46
46
  region: project.config.region,
47
47
  mode: opts.mode,
48
48
  debugIncreaseTimeout: opts.increaseTimeout,
49
+ debugScriptVersion: opts.scriptVersion,
49
50
  isActiveStack: opts.isActiveStack,
50
51
  }, {
51
52
  outdir: opts.buildDir,