sst 2.0.0-rc.8 → 2.0.0

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 (243) hide show
  1. package/bootstrap.d.ts +2 -4
  2. package/bootstrap.js +208 -61
  3. package/bus.d.ts +3 -3
  4. package/bus.js +1 -1
  5. package/cache.js +1 -1
  6. package/cdk/cloudformation-deployments-wrapper.d.ts +3 -0
  7. package/cdk/cloudformation-deployments-wrapper.js +117 -0
  8. package/cdk/cloudformation-deployments.d.ts +19 -4
  9. package/cdk/deploy-stack.d.ts +17 -2
  10. package/cdk/deploy-stack.js +6 -1
  11. package/cli/colors.d.ts +28 -0
  12. package/cli/colors.js +27 -0
  13. package/cli/commands/bind.d.ts +4 -0
  14. package/cli/commands/bind.js +10 -7
  15. package/cli/commands/bootstrap.d.ts +13 -0
  16. package/cli/commands/bootstrap.js +11 -0
  17. package/cli/commands/build.d.ts +6 -2
  18. package/cli/commands/build.js +13 -8
  19. package/cli/commands/console.d.ts +5 -1
  20. package/cli/commands/console.js +8 -6
  21. package/cli/commands/deploy.d.ts +4 -2
  22. package/cli/commands/deploy.js +71 -29
  23. package/cli/commands/dev.d.ts +5 -1
  24. package/cli/commands/dev.js +157 -79
  25. package/cli/commands/diff.d.ts +15 -0
  26. package/cli/commands/diff.js +61 -0
  27. package/cli/commands/env.d.ts +5 -1
  28. package/cli/commands/env.js +14 -15
  29. package/cli/commands/plugins/kysely.js +13 -5
  30. package/cli/commands/plugins/pothos.js +9 -4
  31. package/cli/commands/remove.d.ts +4 -0
  32. package/cli/commands/remove.js +26 -18
  33. package/cli/commands/secrets/get.d.ts +7 -3
  34. package/cli/commands/secrets/get.js +11 -24
  35. package/cli/commands/secrets/list.d.ts +6 -2
  36. package/cli/commands/secrets/list.js +15 -7
  37. package/cli/commands/secrets/remove.d.ts +8 -4
  38. package/cli/commands/secrets/remove.js +18 -16
  39. package/cli/commands/secrets/secrets.js +3 -3
  40. package/cli/commands/secrets/set.d.ts +8 -6
  41. package/cli/commands/secrets/set.js +16 -33
  42. package/cli/commands/telemetry.d.ts +15 -0
  43. package/cli/commands/telemetry.js +17 -0
  44. package/cli/commands/transform.d.ts +15 -0
  45. package/cli/commands/transform.js +55 -0
  46. package/cli/commands/update.d.ts +6 -2
  47. package/cli/commands/update.js +41 -33
  48. package/cli/commands/version.d.ts +13 -0
  49. package/cli/commands/version.js +7 -0
  50. package/cli/local/router.d.ts +6 -6
  51. package/cli/local/router.js +3 -3
  52. package/cli/local/server.d.ts +5 -3
  53. package/cli/local/server.js +21 -14
  54. package/cli/program.d.ts +5 -1
  55. package/cli/program.js +29 -5
  56. package/cli/spinner.js +2 -0
  57. package/cli/sst.js +35 -23
  58. package/cli/telemetry/environment.d.ts +1 -1
  59. package/cli/telemetry/environment.js +1 -1
  60. package/cli/terminal.d.ts +1 -0
  61. package/cli/terminal.js +8 -0
  62. package/cli/ui/deploy.d.ts +3 -2
  63. package/cli/ui/deploy.js +106 -106
  64. package/cli/ui/functions.d.ts +2 -0
  65. package/cli/ui/functions.js +132 -0
  66. package/cli/ui/header.d.ts +5 -0
  67. package/cli/ui/header.js +16 -0
  68. package/cli/ui/stack.d.ts +1 -0
  69. package/cli/ui/stack.js +6 -0
  70. package/config.d.ts +1 -1
  71. package/config.js +8 -8
  72. package/constructs/Api.d.ts +3 -71
  73. package/constructs/Api.js +3 -42
  74. package/constructs/ApiGatewayV1Api.d.ts +3 -3
  75. package/constructs/ApiGatewayV1Api.js +4 -3
  76. package/constructs/App.d.ts +2 -22
  77. package/constructs/App.js +12 -25
  78. package/constructs/AppSyncApi.d.ts +4 -5
  79. package/constructs/AppSyncApi.js +8 -5
  80. package/constructs/AstroSite.d.ts +2 -3
  81. package/constructs/AstroSite.js +43 -53
  82. package/constructs/Auth.js +27 -16
  83. package/constructs/BaseSite.d.ts +10 -10
  84. package/constructs/BaseSite.js +2 -2
  85. package/constructs/Cognito.js +28 -28
  86. package/constructs/EdgeFunction.d.ts +6 -4
  87. package/constructs/EdgeFunction.js +56 -59
  88. package/constructs/EventBus.js +1 -1
  89. package/constructs/Function.d.ts +4 -44
  90. package/constructs/Function.js +14 -50
  91. package/constructs/FunctionalStack.d.ts +2 -2
  92. package/constructs/Job.d.ts +23 -63
  93. package/constructs/Job.js +11 -32
  94. package/constructs/Metadata.d.ts +18 -20
  95. package/constructs/NextjsSite.d.ts +21 -5
  96. package/constructs/NextjsSite.js +67 -101
  97. package/constructs/Queue.js +10 -10
  98. package/constructs/RDS.d.ts +1 -1
  99. package/constructs/RDS.js +1 -1
  100. package/constructs/RemixSite.d.ts +0 -2
  101. package/constructs/RemixSite.js +20 -20
  102. package/constructs/Script.js +1 -1
  103. package/constructs/Secret.js +5 -3
  104. package/constructs/SolidStartSite.d.ts +2 -3
  105. package/constructs/SolidStartSite.js +42 -52
  106. package/constructs/SsrFunction.d.ts +22 -0
  107. package/constructs/SsrFunction.js +113 -0
  108. package/constructs/SsrSite.d.ts +104 -104
  109. package/constructs/SsrSite.js +196 -217
  110. package/constructs/Stack.d.ts +1 -20
  111. package/constructs/Stack.js +3 -65
  112. package/constructs/StaticSite.d.ts +33 -53
  113. package/constructs/StaticSite.js +92 -118
  114. package/constructs/Table.d.ts +1 -1
  115. package/constructs/Table.js +4 -4
  116. package/constructs/Topic.js +1 -1
  117. package/constructs/cdk/certificate-base.d.ts +18 -0
  118. package/constructs/cdk/certificate-base.js +26 -0
  119. package/constructs/cdk/dns-validated-certificate.d.ts +77 -0
  120. package/constructs/cdk/dns-validated-certificate.js +125 -0
  121. package/constructs/cdk/website-redirect.d.ts +53 -0
  122. package/constructs/cdk/website-redirect.js +77 -0
  123. package/constructs/deferred_task.d.ts +1 -1
  124. package/constructs/deprecated/NextjsSite.js +8 -6
  125. package/constructs/index.d.ts +0 -6
  126. package/constructs/index.js +0 -6
  127. package/constructs/util/apiGatewayV1AccessLog.d.ts +1 -1
  128. package/constructs/util/apiGatewayV2AccessLog.js +4 -4
  129. package/constructs/util/apiGatewayV2Domain.js +9 -2
  130. package/constructs/util/appSyncApiDomain.d.ts +1 -1
  131. package/constructs/util/appSyncApiDomain.js +9 -15
  132. package/constructs/util/duration.d.ts +1 -1
  133. package/constructs/util/functionBinding.js +1 -1
  134. package/constructs/util/permission.d.ts +3 -3
  135. package/constructs/util/permission.js +16 -18
  136. package/constructs/util/size.d.ts +1 -1
  137. package/constructs/util/warning.js +2 -2
  138. package/context/context.d.ts +2 -2
  139. package/context/context.js +4 -4
  140. package/context/handler.d.ts +1 -1
  141. package/credentials.d.ts +1 -1
  142. package/credentials.js +42 -6
  143. package/index.d.ts +1 -0
  144. package/index.js +1 -0
  145. package/iot.js +6 -2
  146. package/logger.js +3 -1
  147. package/node/api/index.d.ts +4 -3
  148. package/node/api/index.js +8 -2
  149. package/node/auth/adapter/adapter.d.ts +1 -1
  150. package/node/auth/adapter/facebook.js +1 -1
  151. package/node/auth/adapter/github.js +4 -4
  152. package/node/auth/adapter/google.d.ts +1 -1
  153. package/node/auth/adapter/google.js +2 -2
  154. package/node/auth/adapter/twitch.js +1 -1
  155. package/node/auth/session.d.ts +1 -1
  156. package/node/config/index.d.ts +2 -2
  157. package/node/config/index.js +3 -8
  158. package/node/job/index.d.ts +2 -2
  159. package/node/site/index.js +3 -5
  160. package/package.json +26 -21
  161. package/pothos.js +1 -0
  162. package/project.d.ts +47 -0
  163. package/{app.js → project.js} +60 -53
  164. package/runtime/handlers/dotnet.d.ts +1 -1
  165. package/runtime/handlers/dotnet.js +4 -4
  166. package/runtime/handlers/go.d.ts +1 -1
  167. package/runtime/handlers/go.js +3 -3
  168. package/runtime/handlers/java.d.ts +1 -1
  169. package/runtime/handlers/java.js +4 -4
  170. package/runtime/handlers/node.d.ts +1 -1
  171. package/runtime/handlers/node.js +60 -39
  172. package/runtime/handlers/python.d.ts +1 -1
  173. package/runtime/handlers/python.js +3 -3
  174. package/runtime/handlers.js +15 -12
  175. package/runtime/iot.js +3 -0
  176. package/runtime/runtime.d.ts +4 -0
  177. package/runtime/server.d.ts +3 -3
  178. package/runtime/server.js +11 -5
  179. package/runtime/workers.d.ts +4 -2
  180. package/runtime/workers.js +13 -3
  181. package/site-env.js +2 -1
  182. package/sst.mjs +6357 -20846
  183. package/stacks/app-metadata.d.ts +7 -0
  184. package/stacks/app-metadata.js +78 -0
  185. package/stacks/assembly.d.ts +1 -0
  186. package/stacks/assembly.js +4 -0
  187. package/stacks/build.d.ts +1 -1
  188. package/stacks/build.js +41 -48
  189. package/stacks/deploy.d.ts +1 -0
  190. package/stacks/deploy.js +128 -7
  191. package/stacks/diff.d.ts +8 -0
  192. package/stacks/diff.js +62 -0
  193. package/stacks/index.d.ts +3 -0
  194. package/stacks/index.js +3 -0
  195. package/stacks/metadata.d.ts +2 -0
  196. package/stacks/metadata.js +14 -12
  197. package/stacks/monitor.d.ts +8 -3
  198. package/stacks/monitor.js +38 -4
  199. package/stacks/remove.js +0 -4
  200. package/stacks/synth.d.ts +1 -0
  201. package/stacks/synth.js +27 -13
  202. package/support/base-site-archiver.mjs +1 -1
  203. package/support/bootstrap-metadata-function/index.mjs +68740 -0
  204. package/support/bridge/bridge.mjs +28 -28
  205. package/support/certificate-requestor/index.js +549 -0
  206. package/support/custom-resources/index.mjs +3824 -26567
  207. package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +1 -1
  208. package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +1 -1
  209. package/support/edge-function/edge-lambda.mjs +2 -2
  210. package/support/job-invoker/index.mjs +26 -0
  211. package/support/nodejs-runtime/index.mjs +75 -72
  212. package/support/rds-migrator/index.mjs +22 -23
  213. package/support/remix-site-function/edge-server.js +1 -1
  214. package/support/script-function/index.mjs +30485 -0
  215. package/support/{edge-function-code-replacer → sls-nextjs-site-function-code-replacer}/lambda-code-updater.py +0 -0
  216. package/support/ssr-site-function-archiver.mjs +96 -0
  217. package/util/process.d.ts +0 -1
  218. package/watcher.js +1 -1
  219. package/app.d.ts +0 -36
  220. package/constructs/DebugApp.d.ts +0 -49
  221. package/constructs/DebugApp.js +0 -63
  222. package/constructs/DebugStack.d.ts +0 -34
  223. package/constructs/DebugStack.js +0 -132
  224. package/constructs/GraphQLApi.d.ts +0 -98
  225. package/constructs/GraphQLApi.js +0 -80
  226. package/constructs/ReactStaticSite.d.ts +0 -20
  227. package/constructs/ReactStaticSite.js +0 -54
  228. package/constructs/Script/cfn-response.d.ts +0 -19
  229. package/constructs/Script/cfn-response.js +0 -77
  230. package/constructs/Script/index.d.ts +0 -1
  231. package/constructs/Script/index.js +0 -78
  232. package/constructs/Script/outbound.d.ts +0 -10
  233. package/constructs/Script/outbound.js +0 -42
  234. package/constructs/Script/util.d.ts +0 -2
  235. package/constructs/Script/util.js +0 -11
  236. package/constructs/ViteStaticSite.d.ts +0 -32
  237. package/constructs/ViteStaticSite.js +0 -66
  238. package/support/astro-site-html-stub/index.html +0 -99
  239. package/support/base-site-archiver.cjs +0 -116
  240. package/support/nextjs-site-html-stub/index.html +0 -99
  241. package/support/remix-site-html-stub/index.html +0 -99
  242. package/support/solid-start-site-html-stub/index.html +0 -99
  243. package/support/static-site-stub/index.html +0 -90
@@ -0,0 +1,113 @@
1
+ import url from "url";
2
+ import path from "path";
3
+ import spawn from "cross-spawn";
4
+ import { Construct } from "constructs";
5
+ import * as iam from "aws-cdk-lib/aws-iam";
6
+ import * as logs from "aws-cdk-lib/aws-logs";
7
+ import * as lambda from "aws-cdk-lib/aws-lambda";
8
+ import * as s3Assets from "aws-cdk-lib/aws-s3-assets";
9
+ import { Duration as CdkDuration, CustomResource } from "aws-cdk-lib";
10
+ import { Stack } from "./Stack.js";
11
+ import { useProject } from "../project.js";
12
+ import { attachPermissionsToRole } from "./util/permission.js";
13
+ import { toCdkSize } from "./util/size.js";
14
+ import { toCdkDuration } from "./util/duration.js";
15
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
16
+ /////////////////////
17
+ // Construct
18
+ /////////////////////
19
+ export class SsrFunction extends Construct {
20
+ function;
21
+ props;
22
+ constructor(scope, id, props) {
23
+ super(scope, id);
24
+ this.props = props;
25
+ const { permissions } = props;
26
+ this.function = this.createFunction();
27
+ this.attachPermissions(permissions || []);
28
+ }
29
+ attachPermissions(permissions) {
30
+ attachPermissionsToRole(this.function.role, permissions);
31
+ }
32
+ createFunction() {
33
+ const { timeout, memorySize, handler, bundlePath } = this.props;
34
+ // Note: cannot point the bundlePath to the `.open-next/server-function`
35
+ // b/c the folder contains node_modules. And pnpm node_modules
36
+ // contains symlinks. CDK cannot zip symlinks correctly.
37
+ // https://github.com/aws/aws-cdk/issues/9251
38
+ // We will zip the folder ourselves.
39
+ const zipOutDir = path.resolve(useProject().paths.artifacts, `Site-${this.node.id}-${this.node.addr}`);
40
+ const script = path.resolve(__dirname, "../support/ssr-site-function-archiver.mjs");
41
+ const result = spawn.sync("node", [
42
+ script,
43
+ path.join(bundlePath),
44
+ path.join(zipOutDir, "server-function.zip"),
45
+ ], { stdio: "inherit" });
46
+ if (result.status !== 0) {
47
+ throw new Error(`There was a problem generating the assets package.`);
48
+ }
49
+ // Create asset
50
+ const asset = new s3Assets.Asset(this, "Asset", {
51
+ path: path.join(zipOutDir, "server-function.zip"),
52
+ });
53
+ // Deploy after the code is updated
54
+ const replacer = this.createLambdaCodeReplacer(asset);
55
+ const fn = new lambda.Function(this, `ServerFunction`, {
56
+ ...this.props,
57
+ handler,
58
+ logRetention: logs.RetentionDays.THREE_DAYS,
59
+ code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),
60
+ runtime: lambda.Runtime.NODEJS_18_X,
61
+ architecture: lambda.Architecture.ARM_64,
62
+ memorySize: typeof memorySize === "string"
63
+ ? toCdkSize(memorySize).toMebibytes()
64
+ : memorySize,
65
+ timeout: typeof timeout === "string"
66
+ ? toCdkDuration(timeout)
67
+ : CdkDuration.seconds(timeout),
68
+ });
69
+ fn.node.addDependency(replacer);
70
+ return fn;
71
+ }
72
+ createLambdaCodeReplacer(asset) {
73
+ // Note: Source code for the Lambda functions have "{{ ENV_KEY }}" in them.
74
+ // They need to be replaced with real values before the Lambda
75
+ // functions get deployed.
76
+ const stack = Stack.of(this);
77
+ const resource = new CustomResource(this, "AssetReplacer", {
78
+ serviceToken: stack.customResourceHandler.functionArn,
79
+ resourceType: "Custom::AssetReplacer",
80
+ properties: {
81
+ bucket: asset.s3BucketName,
82
+ key: asset.s3ObjectKey,
83
+ replacements: this.getLambdaContentReplaceValues(),
84
+ },
85
+ });
86
+ stack.customResourceHandler.role?.addToPrincipalPolicy(new iam.PolicyStatement({
87
+ effect: iam.Effect.ALLOW,
88
+ actions: ["s3:GetObject", "s3:PutObject"],
89
+ resources: [`arn:${stack.partition}:s3:::${asset.s3BucketName}/*`],
90
+ }));
91
+ return resource;
92
+ }
93
+ getLambdaContentReplaceValues() {
94
+ const replaceValues = [];
95
+ Object.entries(this.props.environment || {}).forEach(([key, value]) => {
96
+ const token = `{{ ${key} }}`;
97
+ replaceValues.push({
98
+ files: "**/*.js",
99
+ search: token,
100
+ replace: value,
101
+ }, {
102
+ files: "**/*.cjs",
103
+ search: token,
104
+ replace: value,
105
+ }, {
106
+ files: "**/*.mjs",
107
+ search: token,
108
+ replace: value,
109
+ });
110
+ });
111
+ return replaceValues;
112
+ }
113
+ }
@@ -1,35 +1,46 @@
1
1
  import { Construct } from "constructs";
2
- import * as s3 from "aws-cdk-lib/aws-s3";
3
- import * as lambda from "aws-cdk-lib/aws-lambda";
4
- import * as route53 from "aws-cdk-lib/aws-route53";
5
- import * as cloudfront from "aws-cdk-lib/aws-cloudfront";
6
- import * as acm from "aws-cdk-lib/aws-certificatemanager";
7
- import * as origins from "aws-cdk-lib/aws-cloudfront-origins";
2
+ import { Bucket, BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
3
+ import { Function, FunctionProps } from "aws-cdk-lib/aws-lambda";
4
+ import { IHostedZone } from "aws-cdk-lib/aws-route53";
5
+ import { Distribution, ICachePolicy, BehaviorOptions, CachePolicy } from "aws-cdk-lib/aws-cloudfront";
6
+ import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
7
+ import { S3Origin } from "aws-cdk-lib/aws-cloudfront-origins";
8
8
  import { SSTConstruct } from "./Construct.js";
9
9
  import { EdgeFunction } from "./EdgeFunction.js";
10
- import { BaseSiteDomainProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
10
+ import { BaseSiteDomainProps, BaseSiteReplaceProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
11
+ import { Size } from "./util/size.js";
12
+ import { Duration } from "./util/duration.js";
11
13
  import { Permissions } from "./util/permission.js";
12
14
  import { FunctionBindingProps } from "./util/functionBinding.js";
13
- export declare type SsrBuildConfig = {
15
+ export type SsrBuildConfig = {
14
16
  serverBuildOutputFile: string;
15
17
  clientBuildOutputDir: string;
16
18
  clientBuildVersionedSubDir: string;
17
- siteStub: string;
18
19
  };
19
20
  export interface SsrDomainProps extends BaseSiteDomainProps {
20
21
  }
22
+ export interface SsrSiteReplaceProps extends BaseSiteReplaceProps {
23
+ }
21
24
  export interface SsrCdkDistributionProps extends BaseSiteCdkDistributionProps {
22
25
  }
23
26
  export interface SsrSiteProps {
24
27
  /**
25
- * The SSR function is deployed to Lambda in a single region. Alternatively, you can enable this option to deploy to Lambda@Edge.
26
- * @default false
28
+ * Bind resources for the function
29
+ *
30
+ * @example
31
+ * ```js
32
+ * new Function(stack, "Function", {
33
+ * handler: "src/function.handler",
34
+ * bind: [STRIPE_KEY, bucket],
35
+ * })
36
+ * ```
27
37
  */
28
- edge?: boolean;
38
+ bind?: SSTConstruct[];
29
39
  /**
30
40
  * Path to the directory where the app is located.
41
+ * @default "."
31
42
  */
32
- path: string;
43
+ path?: string;
33
44
  /**
34
45
  * The command for building the website
35
46
  * @default `npm run build`
@@ -60,6 +71,37 @@ export interface SsrSiteProps {
60
71
  * ```
61
72
  */
62
73
  customDomain?: string | SsrDomainProps;
74
+ /**
75
+ * The SSR function is deployed to Lambda in a single region. Alternatively, you can enable this option to deploy to Lambda@Edge.
76
+ * @default false
77
+ */
78
+ edge?: boolean;
79
+ /**
80
+ * The execution timeout in seconds for SSR function.
81
+ * @default 10 seconds
82
+ * @example
83
+ * ```js
84
+ * timeout: "5 seconds",
85
+ * ```
86
+ */
87
+ timeout?: number | Duration;
88
+ /**
89
+ * The amount of memory in MB allocated for SSR function.
90
+ * @default 1024 MB
91
+ * @example
92
+ * ```js
93
+ * memorySize: "512 MB",
94
+ * ```
95
+ */
96
+ memorySize?: number | Size;
97
+ /**
98
+ * Attaches the given list of permissions to the SSR function. Configuring this property is equivalent to calling `attachPermissions()` after the site is created.
99
+ * @example
100
+ * ```js
101
+ * permissions: ["ses"]
102
+ * ```
103
+ */
104
+ permissions?: Permissions;
63
105
  /**
64
106
  * An object with the key being the environment variable name.
65
107
  *
@@ -72,26 +114,22 @@ export interface SsrSiteProps {
72
114
  * ```
73
115
  */
74
116
  environment?: Record<string, string>;
75
- /**
76
- * When running `sst start`, a placeholder site is deployed. This is to ensure
77
- * that the site content remains unchanged, and subsequent `sst start` can
78
- * start up quickly.
79
- *
80
- * @example
81
- * ```js
82
- * disablePlaceholder: true,
83
- * ```
84
- */
85
- disablePlaceholder?: boolean;
86
- defaults?: {
87
- function?: {
88
- timeout?: number;
89
- memorySize?: number;
90
- permissions?: Permissions;
91
- };
117
+ dev?: {
118
+ /**
119
+ * When running `sst dev, site is not deployed. This is to ensure `sst dev` can start up quickly.
120
+ * @default false
121
+ * @example
122
+ * ```js
123
+ * dev: {
124
+ * deploy: true
125
+ * }
126
+ * ```
127
+ */
128
+ deploy?: boolean;
92
129
  };
93
130
  /**
94
131
  * While deploying, SST waits for the CloudFront cache invalidation process to finish. This ensures that the new content will be served once the deploy command finishes. However, this process can sometimes take more than 5 mins. For non-prod environments it might make sense to pass in `false`. That'll skip waiting for the cache to invalidate and speed up the deploy process.
132
+ * @default false
95
133
  */
96
134
  waitForInvalidation?: boolean;
97
135
  cdk?: {
@@ -102,25 +140,21 @@ export interface SsrSiteProps {
102
140
  /**
103
141
  * Allows you to override default settings this construct uses internally to ceate the bucket
104
142
  */
105
- bucket?: s3.BucketProps | s3.IBucket;
143
+ bucket?: BucketProps | IBucket;
106
144
  /**
107
145
  * Pass in a value to override the default settings this construct uses to
108
146
  * create the CDK `Distribution` internally.
109
147
  */
110
148
  distribution?: SsrCdkDistributionProps;
111
149
  /**
112
- * Override the default CloudFront cache policies created internally.
150
+ * Override the CloudFront cache policy properties for responses from the
151
+ * server rendering Lambda.
152
+ *
153
+ * @note The default cache policy that is used in the abscene of this property
154
+ * is one that performs no caching of the server response.
113
155
  */
114
- cachePolicies?: {
115
- /**
116
- * Override the CloudFront cache policy properties for responses from the
117
- * server rendering Lambda.
118
- *
119
- * @note The default cache policy that is used in the abscene of this property
120
- * is one that performs no caching of the server response.
121
- */
122
- serverRequests?: cloudfront.ICachePolicy;
123
- };
156
+ serverCachePolicy?: ICachePolicy;
157
+ server?: Pick<FunctionProps, "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture">;
124
158
  };
125
159
  }
126
160
  /**
@@ -136,72 +170,39 @@ export interface SsrSiteProps {
136
170
  */
137
171
  export declare class SsrSite extends Construct implements SSTConstruct {
138
172
  readonly id: string;
139
- /**
140
- * Exposes CDK instances created within the construct.
141
- */
142
- readonly cdk: {
143
- /**
144
- * The internally created CDK `Function` instance. Not available in the "edge" mode.
145
- */
146
- function?: lambda.Function;
147
- /**
148
- * The internally created CDK `Bucket` instance.
149
- */
150
- bucket: s3.Bucket;
151
- /**
152
- * The internally created CDK `Distribution` instance.
153
- */
154
- distribution: cloudfront.Distribution;
155
- /**
156
- * The Route 53 hosted zone for the custom domain.
157
- */
158
- hostedZone?: route53.IHostedZone;
159
- /**
160
- * The AWS Certificate Manager certificate for the custom domain.
161
- */
162
- certificate?: acm.ICertificate;
173
+ protected props: Omit<SsrSiteProps, "path"> & {
174
+ path: string;
175
+ timeout: number | Duration;
176
+ memorySize: number | Size;
163
177
  };
164
- protected props: SsrSiteProps;
165
- /**
166
- * Determines if a placeholder site should be deployed instead. We will set
167
- * this to `true` by default when performing local development, although the
168
- * user can choose to override this value.
169
- */
170
- protected isPlaceholder: boolean;
171
- /**
172
- * The root SST directory used for builds.
173
- */
174
- protected sstBuildDir: string;
178
+ private doNotDeploy;
175
179
  protected buildConfig: SsrBuildConfig;
176
180
  private serverLambdaForEdge?;
177
- protected serverLambdaForRegional?: lambda.Function;
178
- private awsCliLayer;
179
- constructor(scope: Construct, id: string, props: SsrSiteProps);
181
+ protected serverLambdaForRegional?: Function;
182
+ private bucket;
183
+ private distribution;
184
+ private hostedZone?;
185
+ private certificate?;
186
+ constructor(scope: Construct, id: string, props?: SsrSiteProps);
180
187
  /**
181
188
  * The CloudFront URL of the website.
182
189
  */
183
- get url(): string;
190
+ get url(): string | undefined;
184
191
  /**
185
192
  * If the custom domain is enabled, this is the URL of the website with the
186
193
  * custom domain.
187
194
  */
188
195
  get customDomainUrl(): string | undefined;
189
196
  /**
190
- * The ARN of the internally created S3 Bucket.
197
+ * The internally created CDK resources.
191
198
  */
192
- get bucketArn(): string;
193
- /**
194
- * The name of the internally created S3 Bucket.
195
- */
196
- get bucketName(): string;
197
- /**
198
- * The ID of the internally created CloudFront Distribution.
199
- */
200
- get distributionId(): string;
201
- /**
202
- * The domain name of the internally created CloudFront Distribution.
203
- */
204
- get distributionDomain(): string;
199
+ get cdk(): {
200
+ function: Function | undefined;
201
+ bucket: Bucket;
202
+ distribution: Distribution;
203
+ hostedZone: IHostedZone | undefined;
204
+ certificate: ICertificate | undefined;
205
+ };
205
206
  /**
206
207
  * Attaches the given list of permissions to allow the Astro server side
207
208
  * rendering to access other AWS resources.
@@ -216,7 +217,6 @@ export declare class SsrSite extends Construct implements SSTConstruct {
216
217
  getConstructMetadata(): {
217
218
  type: "SsrSite";
218
219
  data: {
219
- distributionId: string;
220
220
  customDomainUrl: string | undefined;
221
221
  };
222
222
  };
@@ -226,28 +226,28 @@ export declare class SsrSite extends Construct implements SSTConstruct {
226
226
  private buildApp;
227
227
  protected validateBuildOutput(): void;
228
228
  private runBuild;
229
- private createStaticsS3Assets;
230
- private createStaticsS3AssetsWithStub;
229
+ private createS3Assets;
230
+ private createS3AssetFileOptions;
231
231
  private createS3Bucket;
232
232
  private createS3Deployment;
233
- protected createFunctionForRegional(): lambda.Function;
233
+ protected createFunctionForRegional(): Function;
234
234
  protected createFunctionForEdge(): EdgeFunction;
235
235
  private createFunctionPermissionsForRegional;
236
236
  private createFunctionPermissionsForEdge;
237
237
  private validateCloudFrontDistributionSettings;
238
- protected createCloudFrontDistributionForRegional(): cloudfront.Distribution;
238
+ protected createCloudFrontDistributionForRegional(): Distribution;
239
239
  private createCloudFrontDistributionForEdge;
240
- protected createCloudFrontDistributionForStub(): cloudfront.Distribution;
241
240
  protected buildDistributionDomainNames(): string[];
242
241
  private buildDistributionDefaultBehaviorForRegional;
243
242
  private buildDistributionDefaultBehaviorForEdge;
244
- protected buildDistributionStaticFileBehaviors(origin: origins.S3Origin): Record<string, cloudfront.BehaviorOptions>;
245
- protected createCloudFrontServerCachePolicy(): cloudfront.CachePolicy;
243
+ protected buildDistributionStaticFileBehaviors(origin: S3Origin): Record<string, BehaviorOptions>;
244
+ protected createCloudFrontServerCachePolicy(): CachePolicy;
246
245
  private createCloudFrontInvalidation;
247
246
  protected validateCustomDomainSettings(): void;
248
- protected lookupHostedZone(): route53.IHostedZone | undefined;
247
+ protected lookupHostedZone(): IHostedZone | undefined;
249
248
  private createCertificate;
250
249
  protected createRoute53Records(): void;
250
+ private getS3ContentReplaceValues;
251
251
  private validateSiteExists;
252
252
  private registerSiteEnvironment;
253
253
  protected generateBuildId(): string;