@awsless/awsless 0.0.47 → 0.0.49
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/dist/bin.js +9 -3
- package/dist/features/upload-bucket-asset.js +13 -6
- package/dist/index.d.ts +181 -0
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1239,8 +1239,10 @@ var FunctionSchema = z6.union([
|
|
|
1239
1239
|
z6.object({
|
|
1240
1240
|
/** The file path of the function code. */
|
|
1241
1241
|
file: LocalFileSchema,
|
|
1242
|
-
|
|
1243
|
-
|
|
1242
|
+
/** The name of the exported method within your code that Lambda calls to run your function.
|
|
1243
|
+
* @default 'default'
|
|
1244
|
+
*/
|
|
1245
|
+
handler: z6.string().optional(),
|
|
1244
1246
|
/** Put the function inside your global VPC.
|
|
1245
1247
|
* @default false
|
|
1246
1248
|
*/
|
|
@@ -1302,6 +1304,10 @@ var isFunctionProps = (input) => {
|
|
|
1302
1304
|
var schema = z6.object({
|
|
1303
1305
|
defaults: z6.object({
|
|
1304
1306
|
function: z6.object({
|
|
1307
|
+
/** The name of the exported method within your code that Lambda calls to run your function.
|
|
1308
|
+
* @default 'default'
|
|
1309
|
+
*/
|
|
1310
|
+
handler: z6.string().default("default"),
|
|
1305
1311
|
/** Put the function inside your global VPC.
|
|
1306
1312
|
* @default false
|
|
1307
1313
|
*/
|
|
@@ -1426,7 +1432,7 @@ var toLambdaFunction = (ctx, id, fileOrProps) => {
|
|
|
1426
1432
|
const props = typeof fileOrProps === "string" ? { ...config.defaults?.function, file: fileOrProps } : { ...config.defaults?.function, ...fileOrProps };
|
|
1427
1433
|
const lambda = new Function(id, {
|
|
1428
1434
|
name: `${config.name}-${stack.name}-${id}`,
|
|
1429
|
-
code: Code.fromFile(id, props.file),
|
|
1435
|
+
code: Code.fromFile(id, props.file, rollupBundle({ handler: `index.${props.handler}` })),
|
|
1430
1436
|
...props,
|
|
1431
1437
|
vpc: void 0
|
|
1432
1438
|
});
|
|
@@ -9,7 +9,7 @@ import require$$0$2 from 'buffer';
|
|
|
9
9
|
import require$$0$3 from 'constants';
|
|
10
10
|
import require$$6 from 'assert';
|
|
11
11
|
import require$$0$5, { join as join$1, extname } from 'path';
|
|
12
|
-
import { readdir } from 'fs/promises';
|
|
12
|
+
import { readdir, stat } from 'fs/promises';
|
|
13
13
|
import { createHash } from 'crypto';
|
|
14
14
|
import { Upload } from '@aws-sdk/lib-storage';
|
|
15
15
|
|
|
@@ -28335,15 +28335,22 @@ const createETag = async (file)=>{
|
|
|
28335
28335
|
return hash.digest('hex');
|
|
28336
28336
|
};
|
|
28337
28337
|
const listLocalFiles = async (localDirectory)=>{
|
|
28338
|
-
const
|
|
28338
|
+
const paths = await readdir(localDirectory, {
|
|
28339
28339
|
recursive: true
|
|
28340
28340
|
});
|
|
28341
|
-
|
|
28342
|
-
|
|
28341
|
+
const files = [];
|
|
28342
|
+
await Promise.all(paths.map(async (key)=>{
|
|
28343
|
+
const file = join$1(localDirectory, key);
|
|
28344
|
+
const stats = await stat(file);
|
|
28345
|
+
if (!stats.isFile()) {
|
|
28346
|
+
return;
|
|
28347
|
+
}
|
|
28348
|
+
files.push({
|
|
28343
28349
|
key,
|
|
28344
|
-
etag: await createETag(
|
|
28345
|
-
};
|
|
28350
|
+
etag: await createETag(file)
|
|
28351
|
+
});
|
|
28346
28352
|
}));
|
|
28353
|
+
return files;
|
|
28347
28354
|
};
|
|
28348
28355
|
const listRemoteFiles = async (bucketName)=>{
|
|
28349
28356
|
const files = [];
|