sst 2.1.1 → 2.1.2
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/package.json +1 -1
- package/runtime/handlers/pythonBundling.js +9 -24
- package/sst.mjs +8 -24
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import url from "url";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import {
|
|
7
|
+
import { DockerImage, FileSystem, } from "aws-cdk-lib";
|
|
8
8
|
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
9
9
|
/**
|
|
10
10
|
* Dependency files to exclude from the asset hash.
|
|
@@ -22,13 +22,6 @@ export function bundle(options) {
|
|
|
22
22
|
const stagedir = FileSystem.mkdtemp("python-bundling-");
|
|
23
23
|
const hasDeps = stageDependencies(entry, stagedir);
|
|
24
24
|
const hasInstallCommands = stageInstallCommands(installCommands || [], stagedir);
|
|
25
|
-
const depsCommand = chain([
|
|
26
|
-
hasDeps || hasInstallCommands
|
|
27
|
-
? `rsync -r ${BUNDLER_DEPENDENCIES_CACHE}/. ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}`
|
|
28
|
-
: "",
|
|
29
|
-
`rsync -r . ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}`,
|
|
30
|
-
]);
|
|
31
|
-
console.log("Commands", depsCommand);
|
|
32
25
|
// Determine which dockerfile to use. When dependencies are present, we use a
|
|
33
26
|
// Dockerfile that can create a cacheable layer. We can't use this Dockerfile
|
|
34
27
|
// if there aren't dependencies or the Dockerfile will complain about missing
|
|
@@ -46,19 +39,14 @@ export function bundle(options) {
|
|
|
46
39
|
},
|
|
47
40
|
file: dockerfile,
|
|
48
41
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
hostPath: options.out,
|
|
59
|
-
containerPath: AssetStaging.BUNDLING_OUTPUT_DIR,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
42
|
+
const outputPath = path.join(options.out, outputPathSuffix);
|
|
43
|
+
// Copy dependencies to the bundle if applicable.
|
|
44
|
+
if (hasDeps || hasInstallCommands) {
|
|
45
|
+
image.cp(`${BUNDLER_DEPENDENCIES_CACHE}/.`, outputPath);
|
|
46
|
+
}
|
|
47
|
+
// Copy source code to the bundle.
|
|
48
|
+
fs.cpSync(entry, outputPath, {
|
|
49
|
+
recursive: true,
|
|
62
50
|
});
|
|
63
51
|
}
|
|
64
52
|
/**
|
|
@@ -88,6 +76,3 @@ function stageInstallCommands(installCommands, stagedir) {
|
|
|
88
76
|
}
|
|
89
77
|
return found;
|
|
90
78
|
}
|
|
91
|
-
function chain(commands) {
|
|
92
|
-
return commands.filter((c) => !!c).join(" && ");
|
|
93
|
-
}
|
package/sst.mjs
CHANGED
|
@@ -1695,7 +1695,7 @@ var init_credentials = __esm({
|
|
|
1695
1695
|
Logger.debug("Loading v2 AWS SDK");
|
|
1696
1696
|
const project = useProject();
|
|
1697
1697
|
const creds = await useAWSCredentials();
|
|
1698
|
-
const
|
|
1698
|
+
const chain = new CredentialProviderChain([
|
|
1699
1699
|
() => ({
|
|
1700
1700
|
...creds,
|
|
1701
1701
|
get(cb) {
|
|
@@ -1718,7 +1718,7 @@ var init_credentials = __esm({
|
|
|
1718
1718
|
secretAccessKey: creds.secretAccessKey
|
|
1719
1719
|
})
|
|
1720
1720
|
]);
|
|
1721
|
-
const provider = new SdkProvider(
|
|
1721
|
+
const provider = new SdkProvider(chain, project.config.region, {
|
|
1722
1722
|
maxRetries: 1e4,
|
|
1723
1723
|
region: project.config.region
|
|
1724
1724
|
});
|
|
@@ -5292,7 +5292,6 @@ import fs13 from "fs";
|
|
|
5292
5292
|
import url6 from "url";
|
|
5293
5293
|
import path13 from "path";
|
|
5294
5294
|
import {
|
|
5295
|
-
AssetStaging,
|
|
5296
5295
|
DockerImage,
|
|
5297
5296
|
FileSystem
|
|
5298
5297
|
} from "aws-cdk-lib";
|
|
@@ -5304,11 +5303,6 @@ function bundle(options) {
|
|
|
5304
5303
|
installCommands || [],
|
|
5305
5304
|
stagedir
|
|
5306
5305
|
);
|
|
5307
|
-
const depsCommand = chain([
|
|
5308
|
-
hasDeps || hasInstallCommands ? `rsync -r ${BUNDLER_DEPENDENCIES_CACHE}/. ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}` : "",
|
|
5309
|
-
`rsync -r . ${AssetStaging.BUNDLING_OUTPUT_DIR}/${outputPathSuffix}`
|
|
5310
|
-
]);
|
|
5311
|
-
console.log("Commands", depsCommand);
|
|
5312
5306
|
const dockerfile = hasInstallCommands ? "Dockerfile.custom" : hasDeps ? "Dockerfile.dependencies" : "Dockerfile";
|
|
5313
5307
|
fs13.copyFileSync(
|
|
5314
5308
|
path13.join(__dirname2, "../../support/python-runtime", dockerfile),
|
|
@@ -5320,19 +5314,12 @@ function bundle(options) {
|
|
|
5320
5314
|
},
|
|
5321
5315
|
file: dockerfile
|
|
5322
5316
|
});
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
containerPath: AssetStaging.BUNDLING_INPUT_DIR
|
|
5330
|
-
},
|
|
5331
|
-
{
|
|
5332
|
-
hostPath: options.out,
|
|
5333
|
-
containerPath: AssetStaging.BUNDLING_OUTPUT_DIR
|
|
5334
|
-
}
|
|
5335
|
-
]
|
|
5317
|
+
const outputPath = path13.join(options.out, outputPathSuffix);
|
|
5318
|
+
if (hasDeps || hasInstallCommands) {
|
|
5319
|
+
image.cp(`${BUNDLER_DEPENDENCIES_CACHE}/.`, outputPath);
|
|
5320
|
+
}
|
|
5321
|
+
fs13.cpSync(entry, outputPath, {
|
|
5322
|
+
recursive: true
|
|
5336
5323
|
});
|
|
5337
5324
|
}
|
|
5338
5325
|
function stageDependencies(entry, stagedir) {
|
|
@@ -5358,9 +5345,6 @@ function stageInstallCommands(installCommands, stagedir) {
|
|
|
5358
5345
|
}
|
|
5359
5346
|
return found;
|
|
5360
5347
|
}
|
|
5361
|
-
function chain(commands) {
|
|
5362
|
-
return commands.filter((c) => !!c).join(" && ");
|
|
5363
|
-
}
|
|
5364
5348
|
var __dirname2, BUNDLER_DEPENDENCIES_CACHE;
|
|
5365
5349
|
var init_pythonBundling = __esm({
|
|
5366
5350
|
"src/runtime/handlers/pythonBundling.ts"() {
|