sst 2.39.8 → 2.39.9
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/AstroSite.d.ts +0 -4
- package/constructs/NextjsSite.d.ts +0 -4
- package/constructs/NextjsSite.js +0 -3
- package/constructs/RemixSite.d.ts +0 -4
- package/constructs/SolidStartSite.d.ts +0 -4
- package/constructs/SsrFunction.js +2 -2
- package/constructs/SsrSite.d.ts +3 -9
- package/constructs/SsrSite.js +21 -13
- package/constructs/SvelteKitSite.d.ts +0 -4
- package/package.json +2 -2
|
@@ -64,10 +64,6 @@ export declare class AstroSite extends SsrSite {
|
|
|
64
64
|
allowedHeaders?: string[] | undefined;
|
|
65
65
|
} | undefined;
|
|
66
66
|
buildId?: string | undefined;
|
|
67
|
-
warmerConfig?: {
|
|
68
|
-
function: string;
|
|
69
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
70
|
-
} | undefined;
|
|
71
67
|
};
|
|
72
68
|
getConstructMetadata(): {
|
|
73
69
|
data: {
|
|
@@ -221,10 +221,6 @@ export declare class NextjsSite extends SsrSite {
|
|
|
221
221
|
allowedHeaders?: string[] | undefined;
|
|
222
222
|
} | undefined;
|
|
223
223
|
buildId?: string | undefined;
|
|
224
|
-
warmerConfig?: {
|
|
225
|
-
function: string;
|
|
226
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
227
|
-
} | undefined;
|
|
228
224
|
};
|
|
229
225
|
private createRevalidationQueue;
|
|
230
226
|
private createRevalidationTable;
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -237,9 +237,6 @@ export class NextjsSite extends SsrSite {
|
|
|
237
237
|
allowedHeaders: DEFAULT_CACHE_POLICY_ALLOWED_HEADERS,
|
|
238
238
|
},
|
|
239
239
|
buildId: this.getBuildId(),
|
|
240
|
-
warmerConfig: {
|
|
241
|
-
function: path.join(sitePath, ".open-next", "warmer-function"),
|
|
242
|
-
},
|
|
243
240
|
});
|
|
244
241
|
}
|
|
245
242
|
createRevalidationQueue() {
|
|
@@ -90,10 +90,6 @@ export declare class RemixSite extends SsrSite {
|
|
|
90
90
|
allowedHeaders?: string[] | undefined;
|
|
91
91
|
} | undefined;
|
|
92
92
|
buildId?: string | undefined;
|
|
93
|
-
warmerConfig?: {
|
|
94
|
-
function: string;
|
|
95
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
96
|
-
} | undefined;
|
|
97
93
|
};
|
|
98
94
|
protected getServerModuleFormat(): "cjs" | "esm";
|
|
99
95
|
private createServerLambdaBundle;
|
|
@@ -72,10 +72,6 @@ export declare class SolidStartSite extends SsrSite {
|
|
|
72
72
|
allowedHeaders?: string[] | undefined;
|
|
73
73
|
} | undefined;
|
|
74
74
|
buildId?: string | undefined;
|
|
75
|
-
warmerConfig?: {
|
|
76
|
-
function: string;
|
|
77
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
78
|
-
} | undefined;
|
|
79
75
|
};
|
|
80
76
|
getConstructMetadata(): {
|
|
81
77
|
data: {
|
|
@@ -274,10 +274,10 @@ export class SsrFunction extends Construct {
|
|
|
274
274
|
const newHandlerFunction = "handler";
|
|
275
275
|
await fs.writeFile(path.join(bundle, handlerDir, `${newHandlerName}.mjs`), streaming
|
|
276
276
|
? [
|
|
277
|
-
`export const ${newHandlerFunction} = awslambda.streamifyResponse(async (event, context) => {`,
|
|
277
|
+
`export const ${newHandlerFunction} = awslambda.streamifyResponse(async (event, responseStream, context) => {`,
|
|
278
278
|
...injections,
|
|
279
279
|
` const { ${oldHandlerFunction}: rawHandler} = await import("./${oldHandlerName}.mjs");`,
|
|
280
|
-
` return rawHandler(event,
|
|
280
|
+
` return rawHandler(event, responseStream);`,
|
|
281
281
|
`});`,
|
|
282
282
|
].join("\n")
|
|
283
283
|
: [
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Bucket, BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
|
|
|
3
3
|
import { Function as CdkFunction, FunctionProps as CdkFunctionProps } from "aws-cdk-lib/aws-lambda";
|
|
4
4
|
import { ICachePolicy, IResponseHeadersPolicy, ViewerProtocolPolicy, AllowedMethods, CachePolicyProps, ErrorResponse } from "aws-cdk-lib/aws-cloudfront";
|
|
5
5
|
import { S3OriginProps } from "aws-cdk-lib/aws-cloudfront-origins";
|
|
6
|
-
import { Schedule } from "aws-cdk-lib/aws-events";
|
|
7
6
|
import { DistributionDomainProps } from "./Distribution.js";
|
|
8
7
|
import { SSTConstruct } from "./Construct.js";
|
|
9
8
|
import { NodeJSProps, FunctionProps } from "./Function.js";
|
|
@@ -391,6 +390,9 @@ export interface SsrSiteProps {
|
|
|
391
390
|
*/
|
|
392
391
|
viewerProtocolPolicy?: ViewerProtocolPolicy;
|
|
393
392
|
server?: Pick<CdkFunctionProps, "layers" | "vpc" | "vpcSubnets" | "securityGroups" | "allowAllOutbound" | "allowPublicSubnet" | "architecture" | "logRetention"> & Pick<FunctionProps, "copyFiles">;
|
|
393
|
+
/**
|
|
394
|
+
* @hidden Need to fix tsdoc generation to support the `Plan` type
|
|
395
|
+
*/
|
|
394
396
|
transform?: (args: Plan) => void;
|
|
395
397
|
};
|
|
396
398
|
}
|
|
@@ -493,10 +495,6 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
|
|
|
493
495
|
allowedHeaders?: string[];
|
|
494
496
|
};
|
|
495
497
|
buildId?: string;
|
|
496
|
-
warmerConfig?: {
|
|
497
|
-
function: string;
|
|
498
|
-
schedule?: Schedule;
|
|
499
|
-
};
|
|
500
498
|
}): {
|
|
501
499
|
cloudFrontFunctions?: CloudFrontFunctions | undefined;
|
|
502
500
|
edgeFunctions?: EdgeFunctions | undefined;
|
|
@@ -515,10 +513,6 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
|
|
|
515
513
|
allowedHeaders?: string[] | undefined;
|
|
516
514
|
} | undefined;
|
|
517
515
|
buildId?: string | undefined;
|
|
518
|
-
warmerConfig?: {
|
|
519
|
-
function: string;
|
|
520
|
-
schedule?: Schedule | undefined;
|
|
521
|
-
} | undefined;
|
|
522
516
|
};
|
|
523
517
|
}
|
|
524
518
|
export declare const useSites: () => {
|
package/constructs/SsrSite.js
CHANGED
|
@@ -223,8 +223,7 @@ export class SsrSite extends Construct {
|
|
|
223
223
|
// Create warmer function
|
|
224
224
|
const warmer = new CdkFunction(self, "WarmerFunction", {
|
|
225
225
|
description: "SSR warmer",
|
|
226
|
-
code: Code.fromAsset(
|
|
227
|
-
path.join(__dirname, "../support/ssr-warmer")),
|
|
226
|
+
code: Code.fromAsset(path.join(__dirname, "../support/ssr-warmer")),
|
|
228
227
|
runtime: Runtime.NODEJS_18_X,
|
|
229
228
|
handler: "index.handler",
|
|
230
229
|
timeout: CdkDuration.minutes(15),
|
|
@@ -237,7 +236,7 @@ export class SsrSite extends Construct {
|
|
|
237
236
|
ssrFunctions[0].grantInvoke(warmer);
|
|
238
237
|
// Create cron job
|
|
239
238
|
new Rule(self, "WarmerRule", {
|
|
240
|
-
schedule:
|
|
239
|
+
schedule: Schedule.rate(CdkDuration.minutes(5)),
|
|
241
240
|
targets: [new LambdaFunction(warmer, { retryAttempts: 0 })],
|
|
242
241
|
});
|
|
243
242
|
// Create custom resource to prewarm on deploy
|
|
@@ -456,7 +455,7 @@ function handler(event) {
|
|
|
456
455
|
...cdk?.server,
|
|
457
456
|
streaming: props.streaming,
|
|
458
457
|
injections: [
|
|
459
|
-
...(warm ? [useServerFunctionWarmingInjection()] : []),
|
|
458
|
+
...(warm ? [useServerFunctionWarmingInjection(props.streaming)] : []),
|
|
460
459
|
...(props.injections || []),
|
|
461
460
|
],
|
|
462
461
|
prefetchSecrets: regional?.prefetchSecrets,
|
|
@@ -649,15 +648,24 @@ function handler(event) {
|
|
|
649
648
|
OriginRequestPolicy.fromOriginRequestPolicyId(self, "ServerOriginRequestPolicy", "b689b0a8-53d0-40ab-baf2-68738e2966ac");
|
|
650
649
|
return singletonOriginRequestPolicy;
|
|
651
650
|
}
|
|
652
|
-
function useServerFunctionWarmingInjection() {
|
|
653
|
-
return
|
|
654
|
-
if (event.type === "warmer") {
|
|
655
|
-
|
|
656
|
-
setTimeout(() => {
|
|
657
|
-
resolve({ serverId: "server-" + Math.random().toString(36).slice(2, 8) })
|
|
658
|
-
}, event.delay)
|
|
659
|
-
})
|
|
660
|
-
|
|
651
|
+
function useServerFunctionWarmingInjection(streaming) {
|
|
652
|
+
return [
|
|
653
|
+
`if (event.type === "warmer") {`,
|
|
654
|
+
` const p = new Promise((resolve) => {`,
|
|
655
|
+
` setTimeout(() => {`,
|
|
656
|
+
` resolve({ serverId: "server-" + Math.random().toString(36).slice(2, 8) });`,
|
|
657
|
+
` }, event.delay);`,
|
|
658
|
+
` });`,
|
|
659
|
+
...(streaming
|
|
660
|
+
? [
|
|
661
|
+
` const response = await p;`,
|
|
662
|
+
` responseStream.write(JSON.stringify(response));`,
|
|
663
|
+
` responseStream.end();`,
|
|
664
|
+
` return;`,
|
|
665
|
+
]
|
|
666
|
+
: [` return p;`]),
|
|
667
|
+
`}`,
|
|
668
|
+
].join("\n");
|
|
661
669
|
}
|
|
662
670
|
function getS3FileOptions(copy) {
|
|
663
671
|
const fileOptions = [];
|
|
@@ -103,10 +103,6 @@ export declare class SvelteKitSite extends SsrSite {
|
|
|
103
103
|
allowedHeaders?: string[] | undefined;
|
|
104
104
|
} | undefined;
|
|
105
105
|
buildId?: string | undefined;
|
|
106
|
-
warmerConfig?: {
|
|
107
|
-
function: string;
|
|
108
|
-
schedule?: import("aws-cdk-lib/aws-events").Schedule | undefined;
|
|
109
|
-
} | undefined;
|
|
110
106
|
};
|
|
111
107
|
getConstructMetadata(): {
|
|
112
108
|
data: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "sst",
|
|
4
|
-
"version": "2.39.
|
|
4
|
+
"version": "2.39.9",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sst": "cli/sst.js"
|
|
7
7
|
},
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"@types/ws": "^8.5.3",
|
|
121
121
|
"@types/yargs": "^17.0.13",
|
|
122
122
|
"archiver": "^5.3.1",
|
|
123
|
-
"astro-sst": "2.39.
|
|
123
|
+
"astro-sst": "2.39.9",
|
|
124
124
|
"async": "^3.2.4",
|
|
125
125
|
"tsx": "^3.12.1",
|
|
126
126
|
"typescript": "^5.2.2",
|