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.
- package/bootstrap.d.ts +2 -4
- package/bootstrap.js +208 -61
- package/bus.d.ts +3 -3
- package/bus.js +1 -1
- package/cache.js +1 -1
- package/cdk/cloudformation-deployments-wrapper.d.ts +3 -0
- package/cdk/cloudformation-deployments-wrapper.js +117 -0
- package/cdk/cloudformation-deployments.d.ts +19 -4
- package/cdk/deploy-stack.d.ts +17 -2
- package/cdk/deploy-stack.js +6 -1
- package/cli/colors.d.ts +28 -0
- package/cli/colors.js +27 -0
- package/cli/commands/bind.d.ts +4 -0
- package/cli/commands/bind.js +10 -7
- package/cli/commands/bootstrap.d.ts +13 -0
- package/cli/commands/bootstrap.js +11 -0
- package/cli/commands/build.d.ts +6 -2
- package/cli/commands/build.js +13 -8
- package/cli/commands/console.d.ts +5 -1
- package/cli/commands/console.js +8 -6
- package/cli/commands/deploy.d.ts +4 -2
- package/cli/commands/deploy.js +71 -29
- package/cli/commands/dev.d.ts +5 -1
- package/cli/commands/dev.js +157 -79
- package/cli/commands/diff.d.ts +15 -0
- package/cli/commands/diff.js +61 -0
- package/cli/commands/env.d.ts +5 -1
- package/cli/commands/env.js +14 -15
- package/cli/commands/plugins/kysely.js +13 -5
- package/cli/commands/plugins/pothos.js +9 -4
- package/cli/commands/remove.d.ts +4 -0
- package/cli/commands/remove.js +26 -18
- package/cli/commands/secrets/get.d.ts +7 -3
- package/cli/commands/secrets/get.js +11 -24
- package/cli/commands/secrets/list.d.ts +6 -2
- package/cli/commands/secrets/list.js +15 -7
- package/cli/commands/secrets/remove.d.ts +8 -4
- package/cli/commands/secrets/remove.js +18 -16
- package/cli/commands/secrets/secrets.js +3 -3
- package/cli/commands/secrets/set.d.ts +8 -6
- package/cli/commands/secrets/set.js +16 -33
- package/cli/commands/telemetry.d.ts +15 -0
- package/cli/commands/telemetry.js +17 -0
- package/cli/commands/transform.d.ts +15 -0
- package/cli/commands/transform.js +55 -0
- package/cli/commands/update.d.ts +6 -2
- package/cli/commands/update.js +41 -33
- package/cli/commands/version.d.ts +13 -0
- package/cli/commands/version.js +7 -0
- package/cli/local/router.d.ts +6 -6
- package/cli/local/router.js +3 -3
- package/cli/local/server.d.ts +5 -3
- package/cli/local/server.js +21 -14
- package/cli/program.d.ts +5 -1
- package/cli/program.js +29 -5
- package/cli/spinner.js +2 -0
- package/cli/sst.js +35 -23
- package/cli/telemetry/environment.d.ts +1 -1
- package/cli/telemetry/environment.js +1 -1
- package/cli/terminal.d.ts +1 -0
- package/cli/terminal.js +8 -0
- package/cli/ui/deploy.d.ts +3 -2
- package/cli/ui/deploy.js +106 -106
- package/cli/ui/functions.d.ts +2 -0
- package/cli/ui/functions.js +132 -0
- package/cli/ui/header.d.ts +5 -0
- package/cli/ui/header.js +16 -0
- package/cli/ui/stack.d.ts +1 -0
- package/cli/ui/stack.js +6 -0
- package/config.d.ts +1 -1
- package/config.js +8 -8
- package/constructs/Api.d.ts +3 -71
- package/constructs/Api.js +3 -42
- package/constructs/ApiGatewayV1Api.d.ts +3 -3
- package/constructs/ApiGatewayV1Api.js +4 -3
- package/constructs/App.d.ts +2 -22
- package/constructs/App.js +12 -25
- package/constructs/AppSyncApi.d.ts +4 -5
- package/constructs/AppSyncApi.js +8 -5
- package/constructs/AstroSite.d.ts +2 -3
- package/constructs/AstroSite.js +43 -53
- package/constructs/Auth.js +27 -16
- package/constructs/BaseSite.d.ts +10 -10
- package/constructs/BaseSite.js +2 -2
- package/constructs/Cognito.js +28 -28
- package/constructs/EdgeFunction.d.ts +6 -4
- package/constructs/EdgeFunction.js +56 -59
- package/constructs/EventBus.js +1 -1
- package/constructs/Function.d.ts +4 -44
- package/constructs/Function.js +14 -50
- package/constructs/FunctionalStack.d.ts +2 -2
- package/constructs/Job.d.ts +23 -63
- package/constructs/Job.js +11 -32
- package/constructs/Metadata.d.ts +18 -20
- package/constructs/NextjsSite.d.ts +21 -5
- package/constructs/NextjsSite.js +67 -101
- package/constructs/Queue.js +10 -10
- package/constructs/RDS.d.ts +1 -1
- package/constructs/RDS.js +1 -1
- package/constructs/RemixSite.d.ts +0 -2
- package/constructs/RemixSite.js +20 -20
- package/constructs/Script.js +1 -1
- package/constructs/Secret.js +5 -3
- package/constructs/SolidStartSite.d.ts +2 -3
- package/constructs/SolidStartSite.js +42 -52
- package/constructs/SsrFunction.d.ts +22 -0
- package/constructs/SsrFunction.js +113 -0
- package/constructs/SsrSite.d.ts +104 -104
- package/constructs/SsrSite.js +196 -217
- package/constructs/Stack.d.ts +1 -20
- package/constructs/Stack.js +3 -65
- package/constructs/StaticSite.d.ts +33 -53
- package/constructs/StaticSite.js +92 -118
- package/constructs/Table.d.ts +1 -1
- package/constructs/Table.js +4 -4
- package/constructs/Topic.js +1 -1
- package/constructs/cdk/certificate-base.d.ts +18 -0
- package/constructs/cdk/certificate-base.js +26 -0
- package/constructs/cdk/dns-validated-certificate.d.ts +77 -0
- package/constructs/cdk/dns-validated-certificate.js +125 -0
- package/constructs/cdk/website-redirect.d.ts +53 -0
- package/constructs/cdk/website-redirect.js +77 -0
- package/constructs/deferred_task.d.ts +1 -1
- package/constructs/deprecated/NextjsSite.js +8 -6
- package/constructs/index.d.ts +0 -6
- package/constructs/index.js +0 -6
- package/constructs/util/apiGatewayV1AccessLog.d.ts +1 -1
- package/constructs/util/apiGatewayV2AccessLog.js +4 -4
- package/constructs/util/apiGatewayV2Domain.js +9 -2
- package/constructs/util/appSyncApiDomain.d.ts +1 -1
- package/constructs/util/appSyncApiDomain.js +9 -15
- package/constructs/util/duration.d.ts +1 -1
- package/constructs/util/functionBinding.js +1 -1
- package/constructs/util/permission.d.ts +3 -3
- package/constructs/util/permission.js +16 -18
- package/constructs/util/size.d.ts +1 -1
- package/constructs/util/warning.js +2 -2
- package/context/context.d.ts +2 -2
- package/context/context.js +4 -4
- package/context/handler.d.ts +1 -1
- package/credentials.d.ts +1 -1
- package/credentials.js +42 -6
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/iot.js +6 -2
- package/logger.js +3 -1
- package/node/api/index.d.ts +4 -3
- package/node/api/index.js +8 -2
- package/node/auth/adapter/adapter.d.ts +1 -1
- package/node/auth/adapter/facebook.js +1 -1
- package/node/auth/adapter/github.js +4 -4
- package/node/auth/adapter/google.d.ts +1 -1
- package/node/auth/adapter/google.js +2 -2
- package/node/auth/adapter/twitch.js +1 -1
- package/node/auth/session.d.ts +1 -1
- package/node/config/index.d.ts +2 -2
- package/node/config/index.js +3 -8
- package/node/job/index.d.ts +2 -2
- package/node/site/index.js +3 -5
- package/package.json +26 -21
- package/pothos.js +1 -0
- package/project.d.ts +47 -0
- package/{app.js → project.js} +60 -53
- package/runtime/handlers/dotnet.d.ts +1 -1
- package/runtime/handlers/dotnet.js +4 -4
- package/runtime/handlers/go.d.ts +1 -1
- package/runtime/handlers/go.js +3 -3
- package/runtime/handlers/java.d.ts +1 -1
- package/runtime/handlers/java.js +4 -4
- package/runtime/handlers/node.d.ts +1 -1
- package/runtime/handlers/node.js +60 -39
- package/runtime/handlers/python.d.ts +1 -1
- package/runtime/handlers/python.js +3 -3
- package/runtime/handlers.js +15 -12
- package/runtime/iot.js +3 -0
- package/runtime/runtime.d.ts +4 -0
- package/runtime/server.d.ts +3 -3
- package/runtime/server.js +11 -5
- package/runtime/workers.d.ts +4 -2
- package/runtime/workers.js +13 -3
- package/site-env.js +2 -1
- package/sst.mjs +6357 -20846
- package/stacks/app-metadata.d.ts +7 -0
- package/stacks/app-metadata.js +78 -0
- package/stacks/assembly.d.ts +1 -0
- package/stacks/assembly.js +4 -0
- package/stacks/build.d.ts +1 -1
- package/stacks/build.js +41 -48
- package/stacks/deploy.d.ts +1 -0
- package/stacks/deploy.js +128 -7
- package/stacks/diff.d.ts +8 -0
- package/stacks/diff.js +62 -0
- package/stacks/index.d.ts +3 -0
- package/stacks/index.js +3 -0
- package/stacks/metadata.d.ts +2 -0
- package/stacks/metadata.js +14 -12
- package/stacks/monitor.d.ts +8 -3
- package/stacks/monitor.js +38 -4
- package/stacks/remove.js +0 -4
- package/stacks/synth.d.ts +1 -0
- package/stacks/synth.js +27 -13
- package/support/base-site-archiver.mjs +1 -1
- package/support/bootstrap-metadata-function/index.mjs +68740 -0
- package/support/bridge/bridge.mjs +28 -28
- package/support/certificate-requestor/index.js +549 -0
- package/support/custom-resources/index.mjs +3824 -26567
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +1 -1
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +1 -1
- package/support/edge-function/edge-lambda.mjs +2 -2
- package/support/job-invoker/index.mjs +26 -0
- package/support/nodejs-runtime/index.mjs +75 -72
- package/support/rds-migrator/index.mjs +22 -23
- package/support/remix-site-function/edge-server.js +1 -1
- package/support/script-function/index.mjs +30485 -0
- package/support/{edge-function-code-replacer → sls-nextjs-site-function-code-replacer}/lambda-code-updater.py +0 -0
- package/support/ssr-site-function-archiver.mjs +96 -0
- package/util/process.d.ts +0 -1
- package/watcher.js +1 -1
- package/app.d.ts +0 -36
- package/constructs/DebugApp.d.ts +0 -49
- package/constructs/DebugApp.js +0 -63
- package/constructs/DebugStack.d.ts +0 -34
- package/constructs/DebugStack.js +0 -132
- package/constructs/GraphQLApi.d.ts +0 -98
- package/constructs/GraphQLApi.js +0 -80
- package/constructs/ReactStaticSite.d.ts +0 -20
- package/constructs/ReactStaticSite.js +0 -54
- package/constructs/Script/cfn-response.d.ts +0 -19
- package/constructs/Script/cfn-response.js +0 -77
- package/constructs/Script/index.d.ts +0 -1
- package/constructs/Script/index.js +0 -78
- package/constructs/Script/outbound.d.ts +0 -10
- package/constructs/Script/outbound.js +0 -42
- package/constructs/Script/util.d.ts +0 -2
- package/constructs/Script/util.js +0 -11
- package/constructs/ViteStaticSite.d.ts +0 -32
- package/constructs/ViteStaticSite.js +0 -66
- package/support/astro-site-html-stub/index.html +0 -99
- package/support/base-site-archiver.cjs +0 -116
- package/support/nextjs-site-html-stub/index.html +0 -99
- package/support/remix-site-html-stub/index.html +0 -99
- package/support/solid-start-site-html-stub/index.html +0 -99
- 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
|
+
}
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -1,35 +1,46 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
|
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
|
-
*
|
|
26
|
-
*
|
|
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
|
-
|
|
38
|
+
bind?: SSTConstruct[];
|
|
29
39
|
/**
|
|
30
40
|
* Path to the directory where the app is located.
|
|
41
|
+
* @default "."
|
|
31
42
|
*/
|
|
32
|
-
path
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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?:
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
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?:
|
|
178
|
-
private
|
|
179
|
-
|
|
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
|
|
197
|
+
* The internally created CDK resources.
|
|
191
198
|
*/
|
|
192
|
-
get
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
|
230
|
-
private
|
|
229
|
+
private createS3Assets;
|
|
230
|
+
private createS3AssetFileOptions;
|
|
231
231
|
private createS3Bucket;
|
|
232
232
|
private createS3Deployment;
|
|
233
|
-
protected createFunctionForRegional():
|
|
233
|
+
protected createFunctionForRegional(): Function;
|
|
234
234
|
protected createFunctionForEdge(): EdgeFunction;
|
|
235
235
|
private createFunctionPermissionsForRegional;
|
|
236
236
|
private createFunctionPermissionsForEdge;
|
|
237
237
|
private validateCloudFrontDistributionSettings;
|
|
238
|
-
protected createCloudFrontDistributionForRegional():
|
|
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:
|
|
245
|
-
protected createCloudFrontServerCachePolicy():
|
|
243
|
+
protected buildDistributionStaticFileBehaviors(origin: S3Origin): Record<string, BehaviorOptions>;
|
|
244
|
+
protected createCloudFrontServerCachePolicy(): CachePolicy;
|
|
246
245
|
private createCloudFrontInvalidation;
|
|
247
246
|
protected validateCustomDomainSettings(): void;
|
|
248
|
-
protected lookupHostedZone():
|
|
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;
|