sst 2.39.11 → 2.39.12
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/Function.js +28 -20
- package/package.json +2 -2
package/constructs/Function.js
CHANGED
|
@@ -207,22 +207,9 @@ export class Function extends CDKFunction {
|
|
|
207
207
|
...props,
|
|
208
208
|
...(props.runtime === "container"
|
|
209
209
|
? {
|
|
210
|
-
code: Code.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
: {}),
|
|
214
|
-
...(props.container?.cmd ? { cmd: props.container.cmd } : {}),
|
|
215
|
-
...(props.container?.file
|
|
216
|
-
? { file: props.container.file }
|
|
217
|
-
: {}),
|
|
218
|
-
...(props.container?.buildArgs
|
|
219
|
-
? { buildArgs: props.container.buildArgs }
|
|
220
|
-
: {}),
|
|
221
|
-
exclude: [".sst/dist", ".sst/artifacts"],
|
|
222
|
-
ignoreMode: IgnoreMode.GLOB,
|
|
223
|
-
}),
|
|
224
|
-
handler: CDKHandler.FROM_IMAGE,
|
|
225
|
-
runtime: CDKRuntime.FROM_IMAGE,
|
|
210
|
+
code: Code.fromInline("export function placeholder() {}"),
|
|
211
|
+
handler: "index.placeholder",
|
|
212
|
+
runtime: CDKRuntime.NODEJS_18_X,
|
|
226
213
|
layers: undefined,
|
|
227
214
|
}
|
|
228
215
|
: {
|
|
@@ -244,7 +231,6 @@ export class Function extends CDKFunction {
|
|
|
244
231
|
useDeferredTasks().add(async () => {
|
|
245
232
|
if (props.runtime === "container")
|
|
246
233
|
Colors.line(`➜ Building the container image for the "${this.node.id}" function...`);
|
|
247
|
-
const project = useProject();
|
|
248
234
|
// Build function
|
|
249
235
|
const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
|
|
250
236
|
if (result.type === "error") {
|
|
@@ -253,9 +239,32 @@ export class Function extends CDKFunction {
|
|
|
253
239
|
...result.errors,
|
|
254
240
|
].join("\n"));
|
|
255
241
|
}
|
|
256
|
-
//
|
|
257
|
-
|
|
242
|
+
// Update function code for container
|
|
243
|
+
const cfnFunction = this.node.defaultChild;
|
|
244
|
+
if (props.runtime === "container") {
|
|
245
|
+
const code = Code.fromAssetImage(props.handler, {
|
|
246
|
+
...(architecture?.dockerPlatform
|
|
247
|
+
? { platform: Platform.custom(architecture.dockerPlatform) }
|
|
248
|
+
: {}),
|
|
249
|
+
...(props.container?.cmd ? { cmd: props.container.cmd } : {}),
|
|
250
|
+
...(props.container?.file ? { file: props.container.file } : {}),
|
|
251
|
+
...(props.container?.buildArgs
|
|
252
|
+
? { buildArgs: props.container.buildArgs }
|
|
253
|
+
: {}),
|
|
254
|
+
exclude: [".sst/dist", ".sst/artifacts"],
|
|
255
|
+
ignoreMode: IgnoreMode.GLOB,
|
|
256
|
+
});
|
|
257
|
+
const codeConfig = code.bind(this);
|
|
258
|
+
cfnFunction.packageType = "Image";
|
|
259
|
+
cfnFunction.code = {
|
|
260
|
+
imageUri: codeConfig.image?.imageUri,
|
|
261
|
+
};
|
|
262
|
+
delete cfnFunction.runtime;
|
|
263
|
+
delete cfnFunction.handler;
|
|
264
|
+
code.bindToResource(cfnFunction);
|
|
258
265
|
return;
|
|
266
|
+
}
|
|
267
|
+
// Update function code for non-container
|
|
259
268
|
if (result.sourcemap) {
|
|
260
269
|
const data = await fs.readFile(result.sourcemap);
|
|
261
270
|
await fs.writeFile(result.sourcemap, zlib.gzipSync(data));
|
|
@@ -270,7 +279,6 @@ export class Function extends CDKFunction {
|
|
|
270
279
|
}
|
|
271
280
|
this.missingSourcemap = !result.sourcemap;
|
|
272
281
|
// Update code
|
|
273
|
-
const cfnFunction = this.node.defaultChild;
|
|
274
282
|
const code = AssetCode.fromAsset(result.out);
|
|
275
283
|
const codeConfig = code.bind(this);
|
|
276
284
|
cfnFunction.code = {
|
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.12",
|
|
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.12",
|
|
124
124
|
"async": "^3.2.4",
|
|
125
125
|
"tsx": "^3.12.1",
|
|
126
126
|
"typescript": "^5.2.2",
|