sst 2.7.1 → 2.8.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 (51) hide show
  1. package/cli/ci-info.d.ts +4 -0
  2. package/cli/ci-info.js +8 -0
  3. package/cli/commands/bind.js +1 -0
  4. package/cli/commands/deploy.js +2 -1
  5. package/cli/commands/dev.js +9 -3
  6. package/cli/commands/diff.js +20 -5
  7. package/cli/commands/update.js +1 -0
  8. package/cli/telemetry/environment.js +4 -4
  9. package/cli/ui/functions.js +3 -3
  10. package/config.js +2 -1
  11. package/constructs/AppSyncApi.d.ts +1 -2
  12. package/constructs/AppSyncApi.js +5 -15
  13. package/constructs/AstroSite.js +4 -8
  14. package/constructs/EdgeFunction.js +6 -6
  15. package/constructs/Function.d.ts +1 -1
  16. package/constructs/Function.js +10 -2
  17. package/constructs/RemixSite.js +4 -8
  18. package/constructs/SolidStartSite.js +4 -9
  19. package/constructs/SsrFunction.d.ts +10 -2
  20. package/constructs/SsrFunction.js +99 -32
  21. package/constructs/SsrSite.d.ts +5 -3
  22. package/constructs/SsrSite.js +23 -11
  23. package/constructs/SvelteKitSite.d.ts +27 -0
  24. package/constructs/SvelteKitSite.js +101 -0
  25. package/constructs/SvelteKitSite.tsdoc.d.ts +2 -0
  26. package/constructs/SvelteKitSite.tsdoc.js +2 -0
  27. package/constructs/deprecated/NextjsSite.js +1 -1
  28. package/constructs/deprecated/cross-region-helper.js +3 -3
  29. package/constructs/index.d.ts +1 -0
  30. package/constructs/index.js +1 -0
  31. package/constructs/static-file-list.d.ts +1 -0
  32. package/constructs/static-file-list.js +51 -0
  33. package/constructs/util/appSyncApiDomain.d.ts +14 -2
  34. package/constructs/util/appSyncApiDomain.js +56 -11
  35. package/node/config/index.js +0 -9
  36. package/node/site/index.d.ts +6 -6
  37. package/node/site/index.js +5 -5
  38. package/node/util/index.js +11 -0
  39. package/package.json +2 -2
  40. package/runtime/handlers.js +7 -0
  41. package/runtime/workers.js +4 -0
  42. package/sst.mjs +70 -16
  43. package/support/base-site-archiver.mjs +18 -18
  44. package/support/bootstrap-metadata-function/index.mjs +1345 -1409
  45. package/support/bridge/bridge.mjs +46 -35
  46. package/support/custom-resources/index.mjs +6468 -6532
  47. package/support/job-invoker/index.mjs +90 -907
  48. package/support/rds-migrator/index.mjs +16 -16
  49. package/support/script-function/index.mjs +90 -907
  50. package/support/ssr-site-function-archiver.mjs +9 -9
  51. /package/support/{sls-nextjs-site-function-stub → ssr-site-function-stub}/index.js +0 -0
@@ -2,12 +2,16 @@ import url from "url";
2
2
  import path from "path";
3
3
  import spawn from "cross-spawn";
4
4
  import { Construct } from "constructs";
5
- import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
5
+ import { Effect, Policy, PolicyStatement, } from "aws-cdk-lib/aws-iam";
6
6
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
7
- import { Architecture, Runtime, Code, Function as CdkFunction, } from "aws-cdk-lib/aws-lambda";
7
+ import { Architecture, AssetCode, Runtime, Code, Function as CdkFunction, } from "aws-cdk-lib/aws-lambda";
8
+ import { Bucket } from "aws-cdk-lib/aws-s3";
8
9
  import { Asset } from "aws-cdk-lib/aws-s3-assets";
9
- import { Duration as CdkDuration, CustomResource } from "aws-cdk-lib";
10
+ import { Duration as CdkDuration, CustomResource, } from "aws-cdk-lib";
10
11
  import { useProject } from "../project.js";
12
+ import { useRuntimeHandlers } from "../runtime/handlers.js";
13
+ import { useFunctions, } from "./Function.js";
14
+ import { useDeferredTasks } from "./deferred_task.js";
11
15
  import { Stack } from "./Stack.js";
12
16
  import { bindEnvironment, bindPermissions, getReferencedSecrets, } from "./util/functionBinding.js";
13
17
  import { attachPermissionsToRole } from "./util/permission.js";
@@ -19,6 +23,8 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
19
23
  /////////////////////
20
24
  export class SsrFunction extends Construct {
21
25
  function;
26
+ assetReplacer;
27
+ assetReplacerPolicy;
22
28
  props;
23
29
  constructor(scope, id, props) {
24
30
  super(scope, id);
@@ -27,41 +33,48 @@ export class SsrFunction extends Construct {
27
33
  environment: props.environment || {},
28
34
  permissions: props.permissions || [],
29
35
  };
30
- const asset = this.createCodeAsset();
31
- const assetReplacer = this.createCodeReplacer(asset);
32
- this.function = this.createFunction(asset);
36
+ const { assetBucket, assetKey } = (props.bundle
37
+ ? // Case: bundle is pre-built
38
+ () => {
39
+ const asset = this.buildAssetFromBundle(props.bundle);
40
+ return {
41
+ assetBucket: asset.s3BucketName,
42
+ assetKey: asset.s3ObjectKey,
43
+ };
44
+ }
45
+ : // Case: bundle is NOT pre-built
46
+ () => {
47
+ this.buildAssetFromHandler((code) => {
48
+ const codeConfig = code.bind(this.function);
49
+ const assetBucket = codeConfig.s3Location?.bucketName;
50
+ const assetKey = codeConfig.s3Location?.objectKey;
51
+ this.updateCodeReplacer(assetBucket, assetKey);
52
+ this.updateFunction(code, assetBucket, assetKey);
53
+ });
54
+ return {
55
+ assetBucket: "placeholder",
56
+ assetKey: "placeholder",
57
+ };
58
+ })();
59
+ const { assetReplacer, assetReplacerPolicy } = this.createCodeReplacer(assetBucket, assetKey);
60
+ this.function = this.createFunction(assetBucket, assetKey);
33
61
  this.attachPermissions(props.permissions || []);
34
62
  this.bind(props.bind || []);
63
+ // Create function after the code is updated
35
64
  this.function.node.addDependency(assetReplacer);
65
+ this.assetReplacer = assetReplacer;
66
+ this.assetReplacerPolicy = assetReplacerPolicy;
36
67
  }
37
68
  attachPermissions(permissions) {
38
69
  attachPermissionsToRole(this.function.role, permissions);
39
70
  }
40
- createCodeAsset() {
41
- const { bundle } = this.props;
42
- // Note: cannot point the bundle to the `.open-next/server-function`
43
- // b/c the folder contains node_modules. And pnpm node_modules
44
- // contains symlinks. CDK cannot zip symlinks correctly.
45
- // https://github.com/aws/aws-cdk/issues/9251
46
- // We will zip the folder ourselves.
47
- const outputPath = path.resolve(useProject().paths.artifacts, `SsrFunction-${this.node.id}-${this.node.addr}`);
48
- const script = path.resolve(__dirname, "../support/ssr-site-function-archiver.mjs");
49
- const result = spawn.sync("node", [script, path.join(bundle), path.join(outputPath, "server-function.zip")], { stdio: "inherit" });
50
- if (result.status !== 0) {
51
- throw new Error(`There was a problem generating the assets package.`);
52
- }
53
- // Create asset
54
- return new Asset(this, "Asset", {
55
- path: path.join(outputPath, "server-function.zip"),
56
- });
57
- }
58
- createFunction(asset) {
71
+ createFunction(assetBucket, assetKey) {
59
72
  const { runtime, timeout, memorySize, handler } = this.props;
60
73
  return new CdkFunction(this, `ServerFunction`, {
61
74
  ...this.props,
62
75
  handler,
63
76
  logRetention: RetentionDays.THREE_DAYS,
64
- code: Code.fromBucket(asset.bucket, asset.s3ObjectKey),
77
+ code: Code.fromBucket(Bucket.fromBucketName(this, "IServerFunctionBucket", assetBucket), assetKey),
65
78
  runtime: runtime === "nodejs14.x"
66
79
  ? Runtime.NODEJS_14_X
67
80
  : runtime === "nodejs16.x"
@@ -76,18 +89,21 @@ export class SsrFunction extends Construct {
76
89
  : CdkDuration.seconds(timeout),
77
90
  });
78
91
  }
79
- createCodeReplacer(asset) {
92
+ createCodeReplacer(assetBucket, assetKey) {
80
93
  const { environment } = this.props;
81
94
  // Note: Source code for the Lambda functions have "{{ ENV_KEY }}" in them.
82
95
  // They need to be replaced with real values before the Lambda
83
96
  // functions get deployed.
97
+ // - "*.js" files: ie. Next.js server function
98
+ // - "*.html" files: ie. SvelteKit prerendered pages data
99
+ // - "*.json" files: ie. SvelteKit prerendered + SSR data
84
100
  const stack = Stack.of(this);
85
101
  const policy = new Policy(this, "AssetReplacerPolicy", {
86
102
  statements: [
87
103
  new PolicyStatement({
88
104
  effect: Effect.ALLOW,
89
105
  actions: ["s3:GetObject", "s3:PutObject"],
90
- resources: [`arn:${stack.partition}:s3:::${asset.s3BucketName}/*`],
106
+ resources: [`arn:${stack.partition}:s3:::${assetBucket}/*`],
91
107
  }),
92
108
  ],
93
109
  });
@@ -96,17 +112,17 @@ export class SsrFunction extends Construct {
96
112
  serviceToken: stack.customResourceHandler.functionArn,
97
113
  resourceType: "Custom::AssetReplacer",
98
114
  properties: {
99
- bucket: asset.s3BucketName,
100
- key: asset.s3ObjectKey,
115
+ bucket: assetBucket,
116
+ key: assetKey,
101
117
  replacements: Object.entries(environment).map(([key, value]) => ({
102
- files: "**/*.*js",
118
+ files: "**/*.@(*js|json|html)",
103
119
  search: `{{ ${key} }}`,
104
120
  replace: value,
105
121
  })),
106
122
  },
107
123
  });
108
124
  resource.node.addDependency(policy);
109
- return resource;
125
+ return { assetReplacer: resource, assetReplacerPolicy: policy };
110
126
  }
111
127
  bind(constructs) {
112
128
  const app = this.node.root;
@@ -131,4 +147,55 @@ export class SsrFunction extends Construct {
131
147
  ]));
132
148
  });
133
149
  }
150
+ buildAssetFromHandler(onBundled) {
151
+ useFunctions().add(this.node.addr, {
152
+ handler: this.props.handler,
153
+ runtime: this.props.runtime,
154
+ nodejs: this.props.nodejs,
155
+ copyFiles: this.props.copyFiles,
156
+ });
157
+ useDeferredTasks().add(async () => {
158
+ // Build function
159
+ const bundle = await useRuntimeHandlers().build(this.node.addr, "deploy");
160
+ // create wrapper that calls the handler
161
+ if (bundle.type === "error")
162
+ throw new Error(`There was a problem bundling the SSR function for the "${this.node.id}" Site.`);
163
+ const code = AssetCode.fromAsset(bundle.out);
164
+ onBundled(code);
165
+ });
166
+ }
167
+ buildAssetFromBundle(bundle) {
168
+ // Note: cannot point the bundle to the `.open-next/server-function`
169
+ // b/c the folder contains node_modules. And pnpm node_modules
170
+ // contains symlinks. CDK cannot zip symlinks correctly.
171
+ // https://github.com/aws/aws-cdk/issues/9251
172
+ // We will zip the folder ourselves.
173
+ const outputPath = path.resolve(useProject().paths.artifacts, `SsrFunction-${this.node.id}-${this.node.addr}`);
174
+ const script = path.resolve(__dirname, "../support/ssr-site-function-archiver.mjs");
175
+ const result = spawn.sync("node", [script, path.join(bundle), path.join(outputPath, "server-function.zip")], { stdio: "inherit" });
176
+ if (result.status !== 0) {
177
+ throw new Error(`There was a problem generating the assets package.`);
178
+ }
179
+ // Create asset
180
+ return new Asset(this, `FunctionAsset`, {
181
+ path: path.join(outputPath, "server-function.zip"),
182
+ });
183
+ }
184
+ updateCodeReplacer(assetBucket, assetKey) {
185
+ const stack = Stack.of(this);
186
+ const cfnReplacer = this.assetReplacer.node
187
+ .defaultChild;
188
+ cfnReplacer.addPropertyOverride("bucket", assetBucket);
189
+ cfnReplacer.addPropertyOverride("key", assetKey);
190
+ const cfnPolicy = this.assetReplacerPolicy.node.defaultChild;
191
+ cfnPolicy.addPropertyOverride("PolicyDocument.Statement.0.Resource", `arn:${stack.partition}:s3:::${assetBucket}/*`);
192
+ }
193
+ updateFunction(code, assetBucket, assetKey) {
194
+ const cfnFunction = this.function.node.defaultChild;
195
+ cfnFunction.code = {
196
+ s3Bucket: assetBucket,
197
+ s3Key: assetKey,
198
+ };
199
+ code.bindToResource(cfnFunction);
200
+ }
134
201
  }
@@ -5,19 +5,21 @@ import { IHostedZone } from "aws-cdk-lib/aws-route53";
5
5
  import { Distribution, ICachePolicy, BehaviorOptions, CachePolicy, Function as CfFunction, FunctionEventType as CfFunctionEventType } from "aws-cdk-lib/aws-cloudfront";
6
6
  import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
7
7
  import { SSTConstruct } from "./Construct.js";
8
- import { NodeJSProps, Function } from "./Function.js";
8
+ import { NodeJSProps } from "./Function.js";
9
9
  import { EdgeFunction } from "./EdgeFunction.js";
10
10
  import { BaseSiteDomainProps, BaseSiteReplaceProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
11
11
  import { Size } from "./util/size.js";
12
12
  import { Duration } from "./util/duration.js";
13
13
  import { Permissions } from "./util/permission.js";
14
14
  import { FunctionBindingProps } from "./util/functionBinding.js";
15
- type SsrSiteType = "NextjsSite" | "RemixSite" | "AstroSite" | "SolidStartSite";
15
+ type SsrSiteType = "NextjsSite" | "RemixSite" | "AstroSite" | "SolidStartSite" | "SvelteKitSite";
16
16
  export type SsrBuildConfig = {
17
17
  typesPath: string;
18
18
  serverBuildOutputFile: string;
19
+ serverCFFunctionInjection?: string;
19
20
  clientBuildOutputDir: string;
20
21
  clientBuildVersionedSubDir: string;
22
+ prerenderedBuildOutputDir?: string;
21
23
  };
22
24
  export interface SsrSiteNodeJSProps extends NodeJSProps {
23
25
  }
@@ -259,7 +261,7 @@ export declare class SsrSite extends Construct implements SSTConstruct {
259
261
  private createS3Deployment;
260
262
  protected createFunctionForRegional(): CdkFunction;
261
263
  protected createFunctionForEdge(): EdgeFunction;
262
- protected createFunctionForDev(): Function;
264
+ protected createFunctionForDev(): CdkFunction;
263
265
  private createFunctionPermissionsForRegional;
264
266
  private createFunctionPermissionsForEdge;
265
267
  private validateCloudFrontDistributionSettings;
@@ -20,8 +20,8 @@ import { Stack } from "./Stack.js";
20
20
  import { Logger } from "../logger.js";
21
21
  import { createAppContext } from "./context.js";
22
22
  import { isCDKConstruct } from "./Construct.js";
23
- import { Function } from "./Function.js";
24
23
  import { Secret } from "./Secret.js";
24
+ import { SsrFunction } from "./SsrFunction.js";
25
25
  import { getBuildCmdEnvironment, } from "./BaseSite.js";
26
26
  import { HttpsRedirect } from "./cdk/website-redirect.js";
27
27
  import { DnsValidatedCertificate } from "./cdk/dns-validated-certificate.js";
@@ -167,8 +167,10 @@ export class SsrSite extends Construct {
167
167
  * ```
168
168
  */
169
169
  attachPermissions(permissions) {
170
- this.serverLambdaForDev?.attachPermissions(permissions);
171
170
  this.serverLambdaForEdge?.attachPermissions(permissions);
171
+ if (this.serverLambdaForDev) {
172
+ attachPermissionsToRole(this.serverLambdaForDev.role, permissions);
173
+ }
172
174
  if (this.serverLambdaForRegional) {
173
175
  attachPermissionsToRole(this.serverLambdaForRegional.role, permissions);
174
176
  }
@@ -291,7 +293,14 @@ export class SsrSite extends Construct {
291
293
  : 200;
292
294
  const result = spawn.sync("node", [
293
295
  script,
294
- path.join(this.props.path, this.buildConfig.clientBuildOutputDir),
296
+ [
297
+ path.join(this.props.path, this.buildConfig.clientBuildOutputDir),
298
+ ...(this.buildConfig.prerenderedBuildOutputDir
299
+ ? [
300
+ path.join(this.props.path, this.buildConfig.prerenderedBuildOutputDir),
301
+ ]
302
+ : []),
303
+ ].join(","),
295
304
  zipOutDir,
296
305
  `${fileSizeLimit}`,
297
306
  ], {
@@ -425,22 +434,20 @@ export class SsrSite extends Construct {
425
434
  assumedBy: new AnyPrincipal(),
426
435
  maxSessionDuration: CdkDuration.hours(12),
427
436
  });
428
- const fn = new Function(this, `ServerFunction`, {
437
+ const ssrFn = new SsrFunction(this, `ServerFunction`, {
429
438
  description: "Server handler placeholder",
430
- handler: "placeholder",
439
+ bundle: path.join(__dirname, "../../support/ssr-site-function-stub"),
440
+ handler: "index.handler",
431
441
  runtime,
432
442
  memorySize,
433
443
  timeout,
444
+ role,
434
445
  bind,
435
446
  environment,
436
447
  permissions,
437
- role,
438
- // Force enable live dev to prevent the function handler to be built
439
- // in the case user set "enableLiveDev: false" on the app or stack.
440
- enableLiveDev: true,
448
+ // note: do not need to set vpc settings b/c this function is not being used
441
449
  });
442
- fn._doNotAllowOthersToBind = true;
443
- return fn;
450
+ return ssrFn.function;
444
451
  }
445
452
  createFunctionPermissionsForRegional() {
446
453
  this.bucket.grantReadWrite(this.serverLambdaForRegional.role);
@@ -466,6 +473,7 @@ export class SsrSite extends Construct {
466
473
  function handler(event) {
467
474
  var request = event.request;
468
475
  request.headers["x-forwarded-host"] = request.headers.host;
476
+ ${this.buildConfig.serverCFFunctionInjection || ""}
469
477
  return request;
470
478
  }`),
471
479
  });
@@ -786,6 +794,10 @@ function handler(event) {
786
794
  files: "**/*.js",
787
795
  search: token,
788
796
  replace: value,
797
+ }, {
798
+ files: "**/*.json",
799
+ search: token,
800
+ replace: value,
789
801
  });
790
802
  });
791
803
  return replaceValues;
@@ -0,0 +1,27 @@
1
+ import { Function as CdkFunction } from "aws-cdk-lib/aws-lambda";
2
+ import { SsrSite } from "./SsrSite.js";
3
+ import { EdgeFunction } from "./EdgeFunction.js";
4
+ /**
5
+ * The `SvelteKitSite` construct is a higher level CDK construct that makes it easy to create a SvelteKit app.
6
+ * @example
7
+ * Deploys a SvelteKit app in the `my-svelte-app` directory.
8
+ *
9
+ * ```js
10
+ * new SvelteKitSite(stack, "web", {
11
+ * path: "my-svelte-app/",
12
+ * });
13
+ * ```
14
+ */
15
+ export declare class SvelteKitSite extends SsrSite {
16
+ protected initBuildConfig(): {
17
+ typesPath: string;
18
+ serverBuildOutputFile: string;
19
+ serverCFFunctionInjection: string;
20
+ clientBuildOutputDir: string;
21
+ clientBuildVersionedSubDir: string;
22
+ prerenderedBuildOutputDir: string;
23
+ };
24
+ protected createFunctionForRegional(): CdkFunction;
25
+ protected createFunctionForEdge(): EdgeFunction;
26
+ protected generateBuildId(): string;
27
+ }
@@ -0,0 +1,101 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { SsrSite } from "./SsrSite.js";
4
+ import { SsrFunction } from "./SsrFunction.js";
5
+ import { EdgeFunction } from "./EdgeFunction.js";
6
+ /**
7
+ * The `SvelteKitSite` construct is a higher level CDK construct that makes it easy to create a SvelteKit app.
8
+ * @example
9
+ * Deploys a SvelteKit app in the `my-svelte-app` directory.
10
+ *
11
+ * ```js
12
+ * new SvelteKitSite(stack, "web", {
13
+ * path: "my-svelte-app/",
14
+ * });
15
+ * ```
16
+ */
17
+ export class SvelteKitSite extends SsrSite {
18
+ initBuildConfig() {
19
+ return {
20
+ typesPath: "src",
21
+ serverBuildOutputFile: ".svelte-kit-sst/server/lambda-handler/index.js",
22
+ // Note: form action requests contain "/" in request query string
23
+ // ie. POST request with query string "?/action"
24
+ // CloudFront does not allow query string with "/". It needs to be encoded.
25
+ serverCFFunctionInjection: `
26
+ for (var key in request.querystring) {
27
+ if (key.includes("/")) {
28
+ request.querystring[encodeURIComponent(key)] = request.querystring[key];
29
+ delete request.querystring[key];
30
+ }
31
+ }
32
+ `,
33
+ clientBuildOutputDir: ".svelte-kit-sst/client",
34
+ clientBuildVersionedSubDir: "_app",
35
+ prerenderedBuildOutputDir: ".svelte-kit-sst/prerendered",
36
+ };
37
+ }
38
+ createFunctionForRegional() {
39
+ const { runtime, timeout, memorySize, permissions, environment, nodejs, bind, cdk, } = this.props;
40
+ const ssrFn = new SsrFunction(this, `ServerFunction`, {
41
+ description: "Server handler for SvelteKit",
42
+ handler: path.join(this.props.path, ".svelte-kit-sst", "server", "lambda-handler", "index.handler"),
43
+ runtime,
44
+ memorySize,
45
+ timeout,
46
+ bind,
47
+ environment,
48
+ permissions,
49
+ nodejs: {
50
+ format: "esm",
51
+ ...nodejs,
52
+ esbuild: {
53
+ minify: process.env.SST_DEBUG ? false : true,
54
+ sourcemap: process.env.SST_DEBUG ? "inline" : false,
55
+ define: {
56
+ "process.env.SST_DEBUG": process.env.SST_DEBUG ? "true" : "false",
57
+ },
58
+ ...nodejs?.esbuild,
59
+ },
60
+ },
61
+ copyFiles: [
62
+ {
63
+ from: path.join(this.props.path, ".svelte-kit-sst", "prerendered"),
64
+ to: "prerendered",
65
+ },
66
+ ],
67
+ ...cdk?.server,
68
+ });
69
+ return ssrFn.function;
70
+ }
71
+ createFunctionForEdge() {
72
+ const { runtime, timeout, memorySize, bind, permissions, environment, nodejs, } = this.props;
73
+ return new EdgeFunction(this, `Server`, {
74
+ scopeOverride: this,
75
+ handler: path.join(this.props.path, ".svelte-kit-sst", "server", "lambda-handler", "index.handler"),
76
+ runtime,
77
+ timeout,
78
+ memorySize,
79
+ bind,
80
+ environment,
81
+ permissions,
82
+ nodejs: {
83
+ format: "esm",
84
+ ...nodejs,
85
+ esbuild: {
86
+ minify: process.env.SST_DEBUG ? false : true,
87
+ sourcemap: process.env.SST_DEBUG ? "inline" : false,
88
+ define: {
89
+ "process.env.SST_DEBUG": process.env.SST_DEBUG ? "true" : "false",
90
+ },
91
+ ...nodejs?.esbuild,
92
+ },
93
+ },
94
+ });
95
+ }
96
+ generateBuildId() {
97
+ const filePath = path.join(this.props.path, ".svelte-kit-sst/client/_app/version.json");
98
+ const content = fs.readFileSync(filePath).toString();
99
+ return JSON.parse(content).version;
100
+ }
101
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./SvelteKitSite.js";
2
+ export * from "./SsrSite.js";
@@ -0,0 +1,2 @@
1
+ export * from "./SvelteKitSite.js";
2
+ export * from "./SsrSite.js";
@@ -309,7 +309,7 @@ export class NextjsSite extends Construct {
309
309
  // Create function asset
310
310
  const assetPath = hasRealCode && this.buildOutDir
311
311
  ? path.join(this.buildOutDir, handlerPath)
312
- : path.join(__dirname, "../../support/sls-nextjs-site-function-stub");
312
+ : path.join(__dirname, "../../support/ssr-site-function-stub");
313
313
  const asset = new s3Assets.Asset(this, `${name}FunctionAsset`, {
314
314
  path: assetPath,
315
315
  });
@@ -16,7 +16,7 @@ export function getOrCreateBucket(scope) {
16
16
  }
17
17
  // Create provider
18
18
  const provider = new lambda.Function(stack, providerId, {
19
- code: lambda.Code.fromAsset(path.join(__dirname, "../../../support/edge-function")),
19
+ code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
20
20
  handler: "s3-bucket.handler",
21
21
  runtime: lambda.Runtime.NODEJS_16_X,
22
22
  timeout: cdk.Duration.minutes(15),
@@ -48,7 +48,7 @@ export function createFunction(scope, name, role, bucketName, functionParams) {
48
48
  // Create provider if not already created
49
49
  if (!provider) {
50
50
  provider = new lambda.Function(stack, providerId, {
51
- code: lambda.Code.fromAsset(path.join(__dirname, "../../../support/edge-function")),
51
+ code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
52
52
  handler: "edge-lambda.handler",
53
53
  runtime: lambda.Runtime.NODEJS_16_X,
54
54
  timeout: cdk.Duration.minutes(15),
@@ -86,7 +86,7 @@ export function createVersion(scope, name, functionArn) {
86
86
  // Create provider if not already created
87
87
  if (!provider) {
88
88
  provider = new lambda.Function(stack, providerId, {
89
- code: lambda.Code.fromAsset(path.join(__dirname, "../../../support/edge-function")),
89
+ code: lambda.Code.fromAsset(path.join(__dirname, "../../support/edge-function")),
90
90
  handler: "edge-lambda-version.handler",
91
91
  runtime: lambda.Runtime.NODEJS_16_X,
92
92
  timeout: cdk.Duration.minutes(15),
@@ -22,6 +22,7 @@ export * from "./NextjsSite.js";
22
22
  export * from "./RemixSite.js";
23
23
  export * from "./SolidStartSite.js";
24
24
  export * from "./StaticSite.js";
25
+ export * from "./SvelteKitSite.js";
25
26
  export * from "./util/size.js";
26
27
  export * from "./util/duration.js";
27
28
  export * from "./util/permission.js";
@@ -22,6 +22,7 @@ export * from "./NextjsSite.js";
22
22
  export * from "./RemixSite.js";
23
23
  export * from "./SolidStartSite.js";
24
24
  export * from "./StaticSite.js";
25
+ export * from "./SvelteKitSite.js";
25
26
  export * from "./util/size.js";
26
27
  export * from "./util/duration.js";
27
28
  export * from "./util/permission.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ const a = [
2
+ "_app/immutable/assets/_layout.2f593b13.css",
3
+ "_app/immutable/assets/_page.265a38f0.css",
4
+ "_app/immutable/assets/_page.89a9e780.css",
5
+ "_app/immutable/assets/_page.9d501049.css",
6
+ "_app/immutable/assets/fira-mono-all-400-normal.1e3b098c.woff",
7
+ "_app/immutable/assets/fira-mono-cyrillic-400-normal.c7d433fd.woff2",
8
+ "_app/immutable/assets/fira-mono-cyrillic-ext-400-normal.3df7909e.woff2",
9
+ "_app/immutable/assets/fira-mono-greek-400-normal.a8be01ce.woff2",
10
+ "_app/immutable/assets/fira-mono-greek-ext-400-normal.9e2fe623.woff2",
11
+ "_app/immutable/assets/fira-mono-latin-400-normal.e43b3538.woff2",
12
+ "_app/immutable/assets/fira-mono-latin-ext-400-normal.6bfabd30.woff2",
13
+ "_app/immutable/assets/github.1ea8d62e.svg",
14
+ "_app/immutable/assets/svelte-logo.87df40b8.svg",
15
+ "_app/immutable/assets/svelte-welcome.6c300099.png",
16
+ "_app/immutable/assets/svelte-welcome.c18bcf5a.webp",
17
+ "_app/immutable/assets/_layout.fa9427ff.css",
18
+ "_app/immutable/chunks/0.7f85a543.js",
19
+ "_app/immutable/chunks/1.738ccc86.js",
20
+ "_app/immutable/chunks/2.d07a3f09.js",
21
+ "_app/immutable/chunks/3.0efc1f6a.js",
22
+ "_app/immutable/chunks/4.bfbd068e.js",
23
+ "_app/immutable/chunks/5.2a8a9ad4.js",
24
+ "_app/immutable/chunks/_page.1806d283.js",
25
+ "_app/immutable/chunks/_page.40474c2a.js",
26
+ "_app/immutable/chunks/_page.da46b06b.js",
27
+ "_app/immutable/chunks/environment.9aa685ef.js",
28
+ "_app/immutable/chunks/index.b0aa1c80.js",
29
+ "_app/immutable/chunks/index.cb779306.js",
30
+ "_app/immutable/chunks/parse.d12b0d5b.js",
31
+ "_app/immutable/chunks/singletons.f0ecbf4a.js",
32
+ "_app/immutable/chunks/stores.c25ce8c1.js",
33
+ "_app/immutable/entry/_layout.svelte.831a1d97.js",
34
+ "_app/immutable/entry/_page.svelte.097e6a34.js",
35
+ "_app/immutable/entry/_page.ts.9c5eea7e.js",
36
+ "_app/immutable/entry/about-page.svelte.adb87672.js",
37
+ "_app/immutable/entry/about-page.ts.13bb5e39.js",
38
+ "_app/immutable/entry/app.dc82e134.js",
39
+ "_app/immutable/entry/error.svelte.02b0c44a.js",
40
+ "_app/immutable/entry/start.ace7d4ec.js",
41
+ "_app/immutable/entry/sverdle-how-to-play-page.svelte.2a60bb43.js",
42
+ "_app/immutable/entry/sverdle-how-to-play-page.ts.13bb5e39.js",
43
+ "_app/immutable/entry/sverdle-page.svelte.e6b731c7.js",
44
+ "_app/version.json",
45
+ "favicon.png",
46
+ "robots.txt",
47
+ "about.html",
48
+ "index.html",
49
+ "sverdle/how-to-play.html",
50
+ ];
51
+ export {};
@@ -1,5 +1,4 @@
1
1
  import * as route53 from "aws-cdk-lib/aws-route53";
2
- import * as appsync from "aws-cdk-lib/aws-appsync";
3
2
  import * as acm from "aws-cdk-lib/aws-certificatemanager";
4
3
  import { AppSyncApi } from "../AppSyncApi.js";
5
4
  export interface CustomDomainProps {
@@ -11,6 +10,11 @@ export interface CustomDomainProps {
11
10
  * The hosted zone in Route 53 that contains the domain. By default, SST will look for a hosted zone by stripping out the first part of the domainName that's passed in. So, if your domainName is api.domain.com. SST will default the hostedZone to domain.com.
12
11
  */
13
12
  hostedZone?: string;
13
+ /**
14
+ * DNS record type for the Route 53 record associated with the custom domain. Default is CNAME.
15
+ * @default CNAME
16
+ */
17
+ recordType?: "CNAME" | "A_AAAA";
14
18
  /**
15
19
  * Set this option if the domain is not hosted on Amazon Route 53.
16
20
  */
@@ -26,4 +30,12 @@ export interface CustomDomainProps {
26
30
  certificate?: acm.ICertificate;
27
31
  };
28
32
  }
29
- export declare function buildCustomDomainData(scope: AppSyncApi, customDomain: string | CustomDomainProps | undefined): appsync.DomainOptions | undefined;
33
+ interface CustomDomainData {
34
+ certificate: acm.ICertificate;
35
+ domainName: string;
36
+ hostedZone?: route53.IHostedZone;
37
+ recordType?: CustomDomainProps["recordType"];
38
+ }
39
+ export declare function buildCustomDomainData(scope: AppSyncApi, customDomain: string | CustomDomainProps | undefined): CustomDomainData | undefined;
40
+ export declare function cleanup(scope: AppSyncApi, domainData: CustomDomainData): void;
41
+ export {};