sst 2.30.4 → 2.32.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/constructs/App.js +7 -7
- package/constructs/BaseSite.d.ts +2 -13
- package/constructs/Distribution.d.ts +5 -10
- package/constructs/Distribution.js +6 -4
- package/constructs/Function.d.ts +6 -6
- package/constructs/Function.js +3 -3
- package/constructs/NextjsSite.d.ts +14 -2
- package/constructs/NextjsSite.js +204 -39
- package/constructs/RDS.js +2 -2
- package/constructs/Service.d.ts +0 -1
- package/constructs/Service.js +0 -1
- package/constructs/SsrSite.d.ts +58 -88
- package/constructs/SsrSite.js +136 -238
- package/constructs/StaticSite.d.ts +46 -33
- package/constructs/StaticSite.js +60 -76
- package/constructs/deprecated/NextjsSite.js +57 -71
- package/package.json +5 -4
- package/support/base-site-archiver.mjs +18 -18
- package/support/custom-resources/index.mjs +14875 -6761
- package/support/base-site-custom-resource/s3-handler.py +0 -195
- package/support/base-site-custom-resource/s3-upload.py +0 -89
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { SSTConstruct } from "./Construct.js";
|
|
|
8
8
|
import { NodeJSProps, FunctionProps } from "./Function.js";
|
|
9
9
|
import { SsrFunction, SsrFunctionProps } from "./SsrFunction.js";
|
|
10
10
|
import { EdgeFunction, EdgeFunctionProps } from "./EdgeFunction.js";
|
|
11
|
-
import { BaseSiteFileOptions,
|
|
11
|
+
import { BaseSiteFileOptions, BaseSiteReplaceProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
|
|
12
12
|
import { Size } from "./util/size.js";
|
|
13
13
|
import { Duration } from "./util/duration.js";
|
|
14
14
|
import { Permissions } from "./util/permission.js";
|
|
@@ -52,12 +52,7 @@ export interface SsrSiteNodeJSProps extends NodeJSProps {
|
|
|
52
52
|
}
|
|
53
53
|
export interface SsrDomainProps extends DistributionDomainProps {
|
|
54
54
|
}
|
|
55
|
-
export interface SsrSiteFileOptionsFilter extends BaseSiteFileOptionsFilter {
|
|
56
|
-
}
|
|
57
55
|
export interface SsrSiteFileOptions extends BaseSiteFileOptions {
|
|
58
|
-
filters: SsrSiteFileOptionsFilter[];
|
|
59
|
-
}
|
|
60
|
-
export interface SsrSiteFileOptionsDeprecated extends BaseSiteFileOptionsDeprecated {
|
|
61
56
|
}
|
|
62
57
|
export interface SsrSiteReplaceProps extends BaseSiteReplaceProps {
|
|
63
58
|
}
|
|
@@ -207,40 +202,25 @@ export interface SsrSiteProps {
|
|
|
207
202
|
*/
|
|
208
203
|
url?: string;
|
|
209
204
|
};
|
|
210
|
-
|
|
205
|
+
assets?: {
|
|
211
206
|
/**
|
|
212
|
-
* Character encoding for text based assets
|
|
207
|
+
* Character encoding for text based assets uploaded to S3 (ex: html, css, js, etc.). If "none" is specified, no charset will be returned in header.
|
|
213
208
|
* @default utf-8
|
|
214
209
|
* @example
|
|
215
210
|
* ```js
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* }
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
textEncoding?: "UTF-8" | "ISO-8859-1" | "Windows-1252" | "ASCII" | "none";
|
|
222
|
-
/**
|
|
223
|
-
* The strategy to use for invalidating the CDN cache. By default, the CDN cache will invalidate on changes any cached file, but this could become slow on very large projects.
|
|
224
|
-
* - "never" - No invalidation will be performed.
|
|
225
|
-
* - "all" - All files will be invalidated when any file changes. (Default, requires checking file content which will increase deployment time)
|
|
226
|
-
* - "versioned" - Only versioned files will be invalidated when versioned files change.
|
|
227
|
-
* - "always" - All files are invalidated on every deployment.
|
|
228
|
-
* @default all
|
|
229
|
-
* @example
|
|
230
|
-
* ```js
|
|
231
|
-
* cache: {
|
|
232
|
-
* cdnInvalidationStrategy: "versioned"
|
|
211
|
+
* assets: {
|
|
212
|
+
* textEncoding: "iso-8859-1"
|
|
233
213
|
* }
|
|
234
214
|
* ```
|
|
235
215
|
*/
|
|
236
|
-
|
|
216
|
+
textEncoding?: "utf-8" | "iso-8859-1" | "windows-1252" | "ascii" | "none";
|
|
237
217
|
/**
|
|
238
218
|
* The TTL for versioned files (ex: `main-1234.css`) in the CDN and browser cache. Ignored when `versionedFilesCacheHeader` is specified.
|
|
239
219
|
* @default 1 year
|
|
240
220
|
* @example
|
|
241
221
|
* ```js
|
|
242
|
-
*
|
|
243
|
-
*
|
|
222
|
+
* assets: {
|
|
223
|
+
* versionedFilesTTL: "30 days"
|
|
244
224
|
* }
|
|
245
225
|
* ```
|
|
246
226
|
*/
|
|
@@ -250,7 +230,7 @@ export interface SsrSiteProps {
|
|
|
250
230
|
* @default public,max-age=31536000,immutable
|
|
251
231
|
* @example
|
|
252
232
|
* ```js
|
|
253
|
-
*
|
|
233
|
+
* assets: {
|
|
254
234
|
* versionedFilesCacheHeader: "public,max-age=31536000,immutable"
|
|
255
235
|
* }
|
|
256
236
|
* ```
|
|
@@ -261,8 +241,8 @@ export interface SsrSiteProps {
|
|
|
261
241
|
* @default 1 day
|
|
262
242
|
* @example
|
|
263
243
|
* ```js
|
|
264
|
-
*
|
|
265
|
-
*
|
|
244
|
+
* assets: {
|
|
245
|
+
* nonVersionedFilesTTL: "4 hours"
|
|
266
246
|
* }
|
|
267
247
|
* ```
|
|
268
248
|
*/
|
|
@@ -272,7 +252,7 @@ export interface SsrSiteProps {
|
|
|
272
252
|
* @default public,max-age=0,s-maxage=86400,stale-while-revalidate=8640
|
|
273
253
|
* @example
|
|
274
254
|
* ```js
|
|
275
|
-
*
|
|
255
|
+
* assets: {
|
|
276
256
|
* nonVersionedFilesCacheHeader: "public,max-age=0,no-cache"
|
|
277
257
|
* }
|
|
278
258
|
* ```
|
|
@@ -282,10 +262,10 @@ export interface SsrSiteProps {
|
|
|
282
262
|
* List of file options to specify cache control and content type for cached files. These file options are appended to the default file options so it's possible to override the default file options by specifying an overlapping file pattern.
|
|
283
263
|
* @example
|
|
284
264
|
* ```js
|
|
285
|
-
*
|
|
265
|
+
* assets: {
|
|
286
266
|
* fileOptions: [
|
|
287
267
|
* {
|
|
288
|
-
*
|
|
268
|
+
* files: "**\/*.zip",
|
|
289
269
|
* cacheControl: "private,no-cache,no-store,must-revalidate",
|
|
290
270
|
* contentType: "application/zip",
|
|
291
271
|
* },
|
|
@@ -294,10 +274,50 @@ export interface SsrSiteProps {
|
|
|
294
274
|
* ```
|
|
295
275
|
*/
|
|
296
276
|
fileOptions?: SsrSiteFileOptions[];
|
|
277
|
+
/**
|
|
278
|
+
* @internal
|
|
279
|
+
*/
|
|
280
|
+
_uploadConcurrency?: number;
|
|
281
|
+
};
|
|
282
|
+
invalidation?: {
|
|
283
|
+
/**
|
|
284
|
+
* 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.
|
|
285
|
+
* @default false
|
|
286
|
+
* @example
|
|
287
|
+
* ```js
|
|
288
|
+
* invalidation: {
|
|
289
|
+
* wait: true,
|
|
290
|
+
* }
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
wait?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* The paths to invalidate. There are three built-in options:
|
|
296
|
+
* - "none" - No invalidation will be performed.
|
|
297
|
+
* - "all" - All files will be invalidated when any file changes.
|
|
298
|
+
* - "versioned" - Only versioned files will be invalidated when versioned files change.
|
|
299
|
+
* Alternatively you can pass in an array of paths to invalidate.
|
|
300
|
+
* @default "all"
|
|
301
|
+
* @example
|
|
302
|
+
* Disable invalidation:
|
|
303
|
+
* ```js
|
|
304
|
+
* invalidation: {
|
|
305
|
+
* paths: "none",
|
|
306
|
+
* }
|
|
307
|
+
* ```
|
|
308
|
+
* Invalidate "index.html" and all files under the "products" route:
|
|
309
|
+
* ```js
|
|
310
|
+
* invalidation: {
|
|
311
|
+
* paths: ["/index.html", "/products/*"],
|
|
312
|
+
* }
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
paths?: "none" | "all" | "versioned" | string[];
|
|
297
316
|
};
|
|
298
317
|
/**
|
|
299
318
|
* 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.
|
|
300
319
|
* @default false
|
|
320
|
+
* @deprecated Use `invalidation.wait` instead.
|
|
301
321
|
*/
|
|
302
322
|
waitForInvalidation?: boolean;
|
|
303
323
|
cdk?: {
|
|
@@ -343,67 +363,17 @@ export interface SsrSiteProps {
|
|
|
343
363
|
responseHeadersPolicy?: IResponseHeadersPolicy;
|
|
344
364
|
server?: Pick<CdkFunctionProps, "layers" | "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture" | "logRetention"> & Pick<FunctionProps, "copyFiles">;
|
|
345
365
|
};
|
|
346
|
-
/**
|
|
347
|
-
* Pass in a list of file options to customize cache control and content type specific files. Specifying file options will bypass all default file options and only use the ones specified. Most configurations within the `cache` prop will be ignored.
|
|
348
|
-
* @deprecated Use `cache.fileOptions` instead. Note that the `cache.fileOptions` are appended to default file options, not a replacement as this prop was.
|
|
349
|
-
* @default
|
|
350
|
-
* Versioned files cached for 1 year at the CDN and browser level.
|
|
351
|
-
* Nonversioned files cached for 1 day at the CDN level, but not at the browser level.
|
|
352
|
-
* ```js
|
|
353
|
-
* fileOptions: [
|
|
354
|
-
* {
|
|
355
|
-
* exclude: "*",
|
|
356
|
-
* include: "{versioned_directory}/*",
|
|
357
|
-
* cacheControl: "public,max-age=31536000,immutable",
|
|
358
|
-
* },
|
|
359
|
-
* {
|
|
360
|
-
* exclude: "*",
|
|
361
|
-
* include: "[{non_versioned_file1}, {non_versioned_file2}, ...]",
|
|
362
|
-
* cacheControl: "public,max-age=0,s-maxage=31536000,must-revalidate",
|
|
363
|
-
* },
|
|
364
|
-
* {
|
|
365
|
-
* exclude: "*",
|
|
366
|
-
* include: "[{non_versioned_dir_1}/*, {non_versioned_dir_2}/*, ...]",
|
|
367
|
-
* cacheControl: "public,max-age=0,s-maxage=31536000,must-revalidate",
|
|
368
|
-
* },
|
|
369
|
-
* ]
|
|
370
|
-
* ```
|
|
371
|
-
*
|
|
372
|
-
* @example
|
|
373
|
-
* ```js
|
|
374
|
-
* fileOptions: [
|
|
375
|
-
* {
|
|
376
|
-
* exclude: "*",
|
|
377
|
-
* include: "{versioned_directory}/*.css",
|
|
378
|
-
* cacheControl: "public,max-age=31536000,immutable",
|
|
379
|
-
* contentType: "text/css; charset=UTF-8",
|
|
380
|
-
* },
|
|
381
|
-
* {
|
|
382
|
-
* exclude: "*",
|
|
383
|
-
* include: "{versioned_directory}/*.js",
|
|
384
|
-
* cacheControl: "public,max-age=31536000,immutable",
|
|
385
|
-
* },
|
|
386
|
-
* {
|
|
387
|
-
* exclude: "*",
|
|
388
|
-
* include: "[{non_versioned_file1}, {non_versioned_file2}, ...]",
|
|
389
|
-
* cacheControl: "public,max-age=0,s-maxage=31536000,must-revalidate",
|
|
390
|
-
* },
|
|
391
|
-
* {
|
|
392
|
-
* exclude: "*",
|
|
393
|
-
* include: "[{non_versioned_dir_1}/*, {non_versioned_dir_2}/*, ...]",
|
|
394
|
-
* cacheControl: "public,max-age=0,s-maxage=31536000,must-revalidate",
|
|
395
|
-
* },
|
|
396
|
-
* ]
|
|
397
|
-
*/
|
|
398
|
-
fileOptions?: SsrSiteFileOptionsDeprecated[];
|
|
399
366
|
}
|
|
367
|
+
type SsrSiteInvalidationNormalizedProps = Exclude<SsrSiteProps["invalidation"], undefined>;
|
|
400
368
|
export type SsrSiteNormalizedProps = SsrSiteProps & {
|
|
401
369
|
path: Exclude<SsrSiteProps["path"], undefined>;
|
|
402
370
|
typesPath: Exclude<SsrSiteProps["typesPath"], undefined>;
|
|
403
371
|
runtime: Exclude<SsrSiteProps["runtime"], undefined>;
|
|
404
372
|
timeout: Exclude<SsrSiteProps["timeout"], undefined>;
|
|
405
373
|
memorySize: Exclude<SsrSiteProps["memorySize"], undefined>;
|
|
406
|
-
|
|
374
|
+
invalidation: Exclude<SsrSiteProps["invalidation"], undefined> & {
|
|
375
|
+
paths: Exclude<SsrSiteInvalidationNormalizedProps["paths"], undefined>;
|
|
376
|
+
};
|
|
407
377
|
};
|
|
408
378
|
/**
|
|
409
379
|
* The `SsrSite` construct is a higher level CDK construct that makes it easy to create modern web apps with Server Side Rendering capabilities.
|