@awsless/awsless 0.0.591 → 0.0.593
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 +139 -147
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +1 -1
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -750,13 +750,6 @@ import { basename as basename2, dirname as dirname3, join as join5 } from "path"
|
|
|
750
750
|
|
|
751
751
|
// src/cli/debug.ts
|
|
752
752
|
var queue = [];
|
|
753
|
-
var debugError = (error) => {
|
|
754
|
-
queue.push({
|
|
755
|
-
date: /* @__PURE__ */ new Date(),
|
|
756
|
-
type: color.error.dim("error"),
|
|
757
|
-
message: typeof error === "string" ? error : error instanceof Error ? color.error(error.message || "") : JSON.stringify(error)
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
753
|
var debug = (...parts) => {
|
|
761
754
|
queue.push({
|
|
762
755
|
date: /* @__PURE__ */ new Date(),
|
|
@@ -2353,8 +2346,8 @@ import { readFile as readFile2 } from "fs/promises";
|
|
|
2353
2346
|
import { basename, dirname as dirname2, extname, join as join4 } from "path";
|
|
2354
2347
|
var readConfig = async (file) => {
|
|
2355
2348
|
try {
|
|
2356
|
-
const
|
|
2357
|
-
const data = Bun.JSON5.parse(
|
|
2349
|
+
const json2 = await readFile2(file, "utf8");
|
|
2350
|
+
const data = Bun.JSON5.parse(json2);
|
|
2358
2351
|
return data;
|
|
2359
2352
|
} catch (error) {
|
|
2360
2353
|
if (error instanceof Error) {
|
|
@@ -3072,7 +3065,7 @@ import { aws as aws5 } from "@terraforge/aws";
|
|
|
3072
3065
|
// src/feature/function/util.ts
|
|
3073
3066
|
import { generateFileHash } from "@awsless/ts-file-cache";
|
|
3074
3067
|
import { aws as aws4 } from "@terraforge/aws";
|
|
3075
|
-
import {
|
|
3068
|
+
import { findInputDeps, Group as Group3, Output as Output4, resolveInputs } from "@terraforge/core";
|
|
3076
3069
|
import deepmerge from "deepmerge";
|
|
3077
3070
|
import { basename as basename3 } from "path";
|
|
3078
3071
|
|
|
@@ -3147,96 +3140,6 @@ var getGlobalOnFailure = (ctx) => {
|
|
|
3147
3140
|
return ctx.shared.get("on-failure", "queue-arn");
|
|
3148
3141
|
};
|
|
3149
3142
|
|
|
3150
|
-
// src/feature/function/build/typescript/bundle.ts
|
|
3151
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
3152
|
-
import json from "@rollup/plugin-json";
|
|
3153
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
3154
|
-
import { createHash } from "crypto";
|
|
3155
|
-
import { dirname as dirname5 } from "path";
|
|
3156
|
-
import { rollup } from "rollup";
|
|
3157
|
-
import natives from "rollup-plugin-natives";
|
|
3158
|
-
import { importAsString } from "rollup-plugin-string-import";
|
|
3159
|
-
import { swc, minify as swcMinify } from "rollup-plugin-swc3";
|
|
3160
|
-
var bundleTypeScript = async ({
|
|
3161
|
-
format: format2 = "esm",
|
|
3162
|
-
minify = true,
|
|
3163
|
-
file,
|
|
3164
|
-
nativeDir,
|
|
3165
|
-
external,
|
|
3166
|
-
importAsString: importAsStringList
|
|
3167
|
-
}) => {
|
|
3168
|
-
const bundle = await rollup({
|
|
3169
|
-
input: file,
|
|
3170
|
-
external: (importee) => {
|
|
3171
|
-
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
3172
|
-
},
|
|
3173
|
-
onwarn: (error) => {
|
|
3174
|
-
debugError(error.message);
|
|
3175
|
-
},
|
|
3176
|
-
treeshake: {
|
|
3177
|
-
preset: "smallest",
|
|
3178
|
-
moduleSideEffects: (id) => file === id
|
|
3179
|
-
},
|
|
3180
|
-
plugins: [
|
|
3181
|
-
commonjs({ sourceMap: true }),
|
|
3182
|
-
nodeResolve({ preferBuiltins: true }),
|
|
3183
|
-
// @ts-ignore
|
|
3184
|
-
nativeDir ? natives({
|
|
3185
|
-
copyTo: nativeDir,
|
|
3186
|
-
targetEsm: format2 === "esm",
|
|
3187
|
-
sourcemap: true
|
|
3188
|
-
}) : void 0,
|
|
3189
|
-
swc({
|
|
3190
|
-
// minify,
|
|
3191
|
-
// module: true,
|
|
3192
|
-
jsc: {
|
|
3193
|
-
baseUrl: dirname5(file),
|
|
3194
|
-
minify: { sourceMap: true }
|
|
3195
|
-
},
|
|
3196
|
-
sourceMaps: true
|
|
3197
|
-
}),
|
|
3198
|
-
minify ? swcMinify({
|
|
3199
|
-
module: format2 === "esm",
|
|
3200
|
-
sourceMap: true,
|
|
3201
|
-
compress: true
|
|
3202
|
-
}) : void 0,
|
|
3203
|
-
json(),
|
|
3204
|
-
importAsStringList ? importAsString({
|
|
3205
|
-
include: importAsStringList
|
|
3206
|
-
}) : void 0
|
|
3207
|
-
]
|
|
3208
|
-
});
|
|
3209
|
-
const ext = format2 === "esm" ? "mjs" : "js";
|
|
3210
|
-
const result = await bundle.generate({
|
|
3211
|
-
format: format2,
|
|
3212
|
-
sourcemap: "hidden",
|
|
3213
|
-
exports: "auto",
|
|
3214
|
-
manualChunks: {},
|
|
3215
|
-
entryFileNames: `index.${ext}`,
|
|
3216
|
-
chunkFileNames: `[name].${ext}`
|
|
3217
|
-
});
|
|
3218
|
-
const hash = createHash("sha1");
|
|
3219
|
-
const files = [];
|
|
3220
|
-
for (const item of result.output) {
|
|
3221
|
-
if (item.type !== "chunk") {
|
|
3222
|
-
continue;
|
|
3223
|
-
}
|
|
3224
|
-
const code = Buffer.from(item.code, "utf8");
|
|
3225
|
-
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
3226
|
-
item.map?.version;
|
|
3227
|
-
hash.update(code);
|
|
3228
|
-
files.push({
|
|
3229
|
-
name: item.fileName,
|
|
3230
|
-
code,
|
|
3231
|
-
map
|
|
3232
|
-
});
|
|
3233
|
-
}
|
|
3234
|
-
return {
|
|
3235
|
-
hash: hash.digest("hex"),
|
|
3236
|
-
files
|
|
3237
|
-
};
|
|
3238
|
-
};
|
|
3239
|
-
|
|
3240
3143
|
// src/feature/function/build/zip.ts
|
|
3241
3144
|
import { createReadStream } from "fs";
|
|
3242
3145
|
import JSZip from "jszip";
|
|
@@ -3264,7 +3167,7 @@ import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
|
3264
3167
|
import { pascalCase } from "change-case";
|
|
3265
3168
|
|
|
3266
3169
|
// src/util/cache.ts
|
|
3267
|
-
import { createHash
|
|
3170
|
+
import { createHash } from "node:crypto";
|
|
3268
3171
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
3269
3172
|
import { lstat as lstat2, readdir } from "node:fs/promises";
|
|
3270
3173
|
import { join as join7 } from "node:path";
|
|
@@ -3274,11 +3177,11 @@ var generateCacheKey = async (directories2) => {
|
|
|
3274
3177
|
for (const file of files) {
|
|
3275
3178
|
hashes[file] = await createHashFromFile(file);
|
|
3276
3179
|
}
|
|
3277
|
-
return
|
|
3180
|
+
return createHash("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
3278
3181
|
};
|
|
3279
3182
|
var createHashFromFile = (file) => {
|
|
3280
3183
|
return new Promise((resolve) => {
|
|
3281
|
-
const hash =
|
|
3184
|
+
const hash = createHash("md5");
|
|
3282
3185
|
const stream = createReadStream2(file);
|
|
3283
3186
|
stream.on("data", (data) => hash.update(data));
|
|
3284
3187
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
@@ -3302,9 +3205,9 @@ var listAllFiles = async (list3) => {
|
|
|
3302
3205
|
};
|
|
3303
3206
|
|
|
3304
3207
|
// src/util/id.ts
|
|
3305
|
-
import { createHash as
|
|
3208
|
+
import { createHash as createHash2 } from "crypto";
|
|
3306
3209
|
var shortId = (ns) => {
|
|
3307
|
-
return
|
|
3210
|
+
return createHash2("md5").update(ns).digest("hex").substring(0, 10);
|
|
3308
3211
|
};
|
|
3309
3212
|
|
|
3310
3213
|
// src/util/temp.ts
|
|
@@ -3365,6 +3268,76 @@ var zipBundle = async ({ directory }) => {
|
|
|
3365
3268
|
});
|
|
3366
3269
|
};
|
|
3367
3270
|
|
|
3271
|
+
// src/feature/function/build/typescript/bun.ts
|
|
3272
|
+
import { minify as swcMinify } from "@swc/core";
|
|
3273
|
+
import { createHash as createHash3 } from "crypto";
|
|
3274
|
+
var bundleTypeScriptWithBun = async ({
|
|
3275
|
+
format: format2 = "esm",
|
|
3276
|
+
minify = true,
|
|
3277
|
+
file,
|
|
3278
|
+
nativeDir,
|
|
3279
|
+
external,
|
|
3280
|
+
importAsString: importAsStringList
|
|
3281
|
+
}) => {
|
|
3282
|
+
const build3 = await Bun.build({
|
|
3283
|
+
entrypoints: [file],
|
|
3284
|
+
target: "node",
|
|
3285
|
+
format: format2,
|
|
3286
|
+
sourcemap: "none",
|
|
3287
|
+
// sourcemap: 'external',
|
|
3288
|
+
// minify: false,
|
|
3289
|
+
external: ["@aws-sdk/*", "aws-sdk", ...external ?? []],
|
|
3290
|
+
naming: {
|
|
3291
|
+
entry: `index.js`,
|
|
3292
|
+
chunk: `[name].js`
|
|
3293
|
+
},
|
|
3294
|
+
plugins: [
|
|
3295
|
+
{
|
|
3296
|
+
name: "string-loader",
|
|
3297
|
+
setup(build4) {
|
|
3298
|
+
if (importAsStringList) {
|
|
3299
|
+
build4.onLoad({ filter: new RegExp(importAsStringList.join("|")) }, async (args) => {
|
|
3300
|
+
return {
|
|
3301
|
+
contents: `export default ${JSON.stringify(await Bun.file(args.path).text())};`,
|
|
3302
|
+
loader: "js"
|
|
3303
|
+
};
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
// nativesPlugin(nativeDir),
|
|
3309
|
+
]
|
|
3310
|
+
});
|
|
3311
|
+
if (!build3.success) {
|
|
3312
|
+
throw new Error("Bun build error");
|
|
3313
|
+
}
|
|
3314
|
+
const hash = createHash3("sha1");
|
|
3315
|
+
const files = [];
|
|
3316
|
+
for await (const artifact of build3.outputs) {
|
|
3317
|
+
if (artifact.kind === "asset" || artifact.kind === "sourcemap") {
|
|
3318
|
+
continue;
|
|
3319
|
+
}
|
|
3320
|
+
const originalCode = await artifact.text();
|
|
3321
|
+
const { code } = await swcMinify(originalCode, {
|
|
3322
|
+
toplevel: true,
|
|
3323
|
+
module: true,
|
|
3324
|
+
compress: true,
|
|
3325
|
+
mangle: true,
|
|
3326
|
+
sourceMap: false
|
|
3327
|
+
});
|
|
3328
|
+
hash.update(code);
|
|
3329
|
+
files.push({
|
|
3330
|
+
name: artifact.path.split("/").pop(),
|
|
3331
|
+
code: Buffer.from(code)
|
|
3332
|
+
// map: map ? Buffer.from(map) : undefined,
|
|
3333
|
+
});
|
|
3334
|
+
}
|
|
3335
|
+
return {
|
|
3336
|
+
hash: hash.digest("hex"),
|
|
3337
|
+
files
|
|
3338
|
+
};
|
|
3339
|
+
};
|
|
3340
|
+
|
|
3368
3341
|
// src/feature/function/util.ts
|
|
3369
3342
|
var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
3370
3343
|
let name;
|
|
@@ -3400,7 +3373,7 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3400
3373
|
const fingerprint = await generateFileHash(workspace, fileCode.file);
|
|
3401
3374
|
return build3(fingerprint, async (write) => {
|
|
3402
3375
|
const temp = await createTempFolder(`function--${name}`);
|
|
3403
|
-
const bundle = await
|
|
3376
|
+
const bundle = await bundleTypeScriptWithBun({
|
|
3404
3377
|
file: fileCode.file,
|
|
3405
3378
|
external: [
|
|
3406
3379
|
...fileCode.external ?? [],
|
|
@@ -3476,8 +3449,12 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3476
3449
|
})
|
|
3477
3450
|
});
|
|
3478
3451
|
const statements = [];
|
|
3452
|
+
const statementDeps = /* @__PURE__ */ new Set();
|
|
3479
3453
|
const addPermission = (...permissions) => {
|
|
3480
3454
|
statements.push(...permissions);
|
|
3455
|
+
for (const dep of findInputDeps(permissions)) {
|
|
3456
|
+
statementDeps.add(dep);
|
|
3457
|
+
}
|
|
3481
3458
|
};
|
|
3482
3459
|
ctx.onPermission((statement) => {
|
|
3483
3460
|
addPermission(statement);
|
|
@@ -3485,7 +3462,7 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3485
3462
|
const policy = new aws4.iam.RolePolicy(group, "policy", {
|
|
3486
3463
|
role: role.name,
|
|
3487
3464
|
name: "lambda-policy",
|
|
3488
|
-
policy: new
|
|
3465
|
+
policy: new Output4(statementDeps, async (resolve) => {
|
|
3489
3466
|
const list3 = await resolveInputs(statements);
|
|
3490
3467
|
resolve(
|
|
3491
3468
|
JSON.stringify({
|
|
@@ -4565,14 +4542,14 @@ import { camelCase as camelCase5, kebabCase as kebabCase6 } from "change-case";
|
|
|
4565
4542
|
import { Group as Group13 } from "@terraforge/core";
|
|
4566
4543
|
import { aws as aws14 } from "@terraforge/aws";
|
|
4567
4544
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
4568
|
-
import { dirname as
|
|
4545
|
+
import { dirname as dirname5, join as join10, relative as relative5 } from "path";
|
|
4569
4546
|
import { fileURLToPath } from "node:url";
|
|
4570
4547
|
|
|
4571
4548
|
// src/feature/function/prebuild.ts
|
|
4572
4549
|
import { days as days6, seconds as seconds6, toDays as toDays5, toSeconds as toSeconds5 } from "@awsless/duration";
|
|
4573
4550
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes3 } from "@awsless/size";
|
|
4574
4551
|
import { aws as aws13 } from "@terraforge/aws";
|
|
4575
|
-
import {
|
|
4552
|
+
import { Output as Output5, findInputDeps as findInputDeps2, resolveInputs as resolveInputs2 } from "@terraforge/core";
|
|
4576
4553
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
4577
4554
|
var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
4578
4555
|
let name;
|
|
@@ -4627,8 +4604,12 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4627
4604
|
})
|
|
4628
4605
|
});
|
|
4629
4606
|
const statements = [];
|
|
4607
|
+
const statementDeps = /* @__PURE__ */ new Set();
|
|
4630
4608
|
const addPermission = (...permissions) => {
|
|
4631
4609
|
statements.push(...permissions);
|
|
4610
|
+
for (const dep of findInputDeps2(permissions)) {
|
|
4611
|
+
statementDeps.add(dep);
|
|
4612
|
+
}
|
|
4632
4613
|
};
|
|
4633
4614
|
ctx.onPermission((statement) => {
|
|
4634
4615
|
addPermission(statement);
|
|
@@ -4636,7 +4617,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4636
4617
|
const policy = new aws13.iam.RolePolicy(group, "policy", {
|
|
4637
4618
|
role: role.name,
|
|
4638
4619
|
name: "lambda-policy",
|
|
4639
|
-
policy: new
|
|
4620
|
+
policy: new Output5(statementDeps, async (resolve) => {
|
|
4640
4621
|
const list3 = await resolveInputs2(statements);
|
|
4641
4622
|
resolve(
|
|
4642
4623
|
JSON.stringify({
|
|
@@ -4753,7 +4734,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4753
4734
|
|
|
4754
4735
|
// src/feature/rpc/index.ts
|
|
4755
4736
|
import { toSeconds as toSeconds6 } from "@awsless/duration";
|
|
4756
|
-
var __dirname =
|
|
4737
|
+
var __dirname = dirname5(fileURLToPath(import.meta.url));
|
|
4757
4738
|
var rpcFeature = defineFeature({
|
|
4758
4739
|
name: "rpc",
|
|
4759
4740
|
async onTypeGen(ctx) {
|
|
@@ -5073,7 +5054,7 @@ var searchFeature = defineFeature({
|
|
|
5073
5054
|
import { Group as Group15 } from "@terraforge/core";
|
|
5074
5055
|
import { aws as aws16 } from "@terraforge/aws";
|
|
5075
5056
|
import { glob as glob2 } from "glob";
|
|
5076
|
-
import { dirname as
|
|
5057
|
+
import { dirname as dirname6, join as join11 } from "path";
|
|
5077
5058
|
|
|
5078
5059
|
// src/feature/site/util.ts
|
|
5079
5060
|
import { contentType, lookup } from "mime-types";
|
|
@@ -5133,7 +5114,7 @@ var siteFeature = defineFeature({
|
|
|
5133
5114
|
return build3(fingerprint, async (write) => {
|
|
5134
5115
|
const credentialProvider = await getCredentials(ctx.appConfig.profile);
|
|
5135
5116
|
const credentials = await credentialProvider();
|
|
5136
|
-
const cwd = join11(directories.root,
|
|
5117
|
+
const cwd = join11(directories.root, dirname6(ctx.stackConfig.file));
|
|
5137
5118
|
const env = {
|
|
5138
5119
|
// Pass the app config name
|
|
5139
5120
|
APP: ctx.appConfig.name,
|
|
@@ -6160,12 +6141,12 @@ var layerFeature = defineFeature({
|
|
|
6160
6141
|
// src/feature/image/index.ts
|
|
6161
6142
|
import { Group as Group23 } from "@terraforge/core";
|
|
6162
6143
|
import { aws as aws24 } from "@terraforge/aws";
|
|
6163
|
-
import { join as join13, dirname as
|
|
6144
|
+
import { join as join13, dirname as dirname7 } from "path";
|
|
6164
6145
|
import { mebibytes as mebibytes4 } from "@awsless/size";
|
|
6165
6146
|
import { seconds as seconds7, toDays as toDays6 } from "@awsless/duration";
|
|
6166
6147
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6167
6148
|
import { glob as glob4 } from "glob";
|
|
6168
|
-
var __dirname2 =
|
|
6149
|
+
var __dirname2 = dirname7(fileURLToPath2(import.meta.url));
|
|
6169
6150
|
var imageFeature = defineFeature({
|
|
6170
6151
|
name: "image",
|
|
6171
6152
|
onApp(ctx) {
|
|
@@ -6348,12 +6329,12 @@ var imageFeature = defineFeature({
|
|
|
6348
6329
|
// src/feature/icon/index.ts
|
|
6349
6330
|
import { Group as Group24 } from "@terraforge/core";
|
|
6350
6331
|
import { aws as aws25 } from "@terraforge/aws";
|
|
6351
|
-
import { join as join14, dirname as
|
|
6332
|
+
import { join as join14, dirname as dirname8 } from "path";
|
|
6352
6333
|
import { mebibytes as mebibytes5 } from "@awsless/size";
|
|
6353
6334
|
import { seconds as seconds8, toDays as toDays7 } from "@awsless/duration";
|
|
6354
6335
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6355
6336
|
import { glob as glob5 } from "glob";
|
|
6356
|
-
var __dirname3 =
|
|
6337
|
+
var __dirname3 = dirname8(fileURLToPath3(import.meta.url));
|
|
6357
6338
|
var iconFeature = defineFeature({
|
|
6358
6339
|
name: "icon",
|
|
6359
6340
|
onStack(ctx) {
|
|
@@ -6502,7 +6483,7 @@ import { toDays as toDays8, toSeconds as toSeconds8 } from "@awsless/duration";
|
|
|
6502
6483
|
import { toMebibytes as toMebibytes4 } from "@awsless/size";
|
|
6503
6484
|
import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
|
|
6504
6485
|
import { aws as aws26 } from "@terraforge/aws";
|
|
6505
|
-
import {
|
|
6486
|
+
import { Group as Group25, Output as Output7, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
|
|
6506
6487
|
import { constantCase as constantCase11, pascalCase as pascalCase3 } from "change-case";
|
|
6507
6488
|
import deepmerge4 from "deepmerge";
|
|
6508
6489
|
import { join as join16 } from "path";
|
|
@@ -6633,10 +6614,11 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6633
6614
|
}
|
|
6634
6615
|
);
|
|
6635
6616
|
const statements = [];
|
|
6617
|
+
const statementDeps = /* @__PURE__ */ new Set();
|
|
6636
6618
|
const policy = new aws26.iam.RolePolicy(group, "policy", {
|
|
6637
6619
|
role: role.name,
|
|
6638
6620
|
name: "task-policy",
|
|
6639
|
-
policy: new
|
|
6621
|
+
policy: new Output7(statementDeps, async (resolve) => {
|
|
6640
6622
|
const list3 = await resolveInputs3(statements);
|
|
6641
6623
|
resolve(
|
|
6642
6624
|
JSON.stringify({
|
|
@@ -6650,8 +6632,14 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6650
6632
|
);
|
|
6651
6633
|
})
|
|
6652
6634
|
});
|
|
6635
|
+
const addPermission = (...permissions) => {
|
|
6636
|
+
statements.push(...permissions);
|
|
6637
|
+
for (const dep of findInputDeps3(permissions)) {
|
|
6638
|
+
statementDeps.add(dep);
|
|
6639
|
+
}
|
|
6640
|
+
};
|
|
6653
6641
|
ctx.onPermission((statement) => {
|
|
6654
|
-
|
|
6642
|
+
addPermission(statement);
|
|
6655
6643
|
});
|
|
6656
6644
|
let logGroup;
|
|
6657
6645
|
if (props.log.retention && props.log.retention.value > 0n) {
|
|
@@ -6677,6 +6665,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6677
6665
|
STACK: ctx.stackConfig.name
|
|
6678
6666
|
};
|
|
6679
6667
|
const variables = {};
|
|
6668
|
+
const variableDeps = /* @__PURE__ */ new Set();
|
|
6680
6669
|
const task2 = new aws26.ecs.TaskDefinition(
|
|
6681
6670
|
group,
|
|
6682
6671
|
"task",
|
|
@@ -6693,7 +6682,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6693
6682
|
operatingSystemFamily: "LINUX"
|
|
6694
6683
|
},
|
|
6695
6684
|
trackLatest: true,
|
|
6696
|
-
containerDefinitions: new
|
|
6685
|
+
containerDefinitions: new Output7(variableDeps, async (resolve) => {
|
|
6697
6686
|
const data = await resolveInputs3(variables);
|
|
6698
6687
|
const { s3Bucket, s3Key } = await resolveInputs3({
|
|
6699
6688
|
s3Bucket: code.bucket,
|
|
@@ -6838,6 +6827,9 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
6838
6827
|
);
|
|
6839
6828
|
ctx.onEnv((name2, value) => {
|
|
6840
6829
|
variables[name2] = value;
|
|
6830
|
+
for (const dep of findInputDeps3([value])) {
|
|
6831
|
+
variableDeps.add(dep);
|
|
6832
|
+
}
|
|
6841
6833
|
});
|
|
6842
6834
|
variables.APP = ctx.appConfig.name;
|
|
6843
6835
|
variables.APP_ID = ctx.appId;
|
|
@@ -7023,7 +7015,7 @@ var metricFeature = defineFeature({
|
|
|
7023
7015
|
|
|
7024
7016
|
// src/feature/router/index.ts
|
|
7025
7017
|
import { days as days7, seconds as seconds9, toSeconds as toSeconds10, years } from "@awsless/duration";
|
|
7026
|
-
import { Future
|
|
7018
|
+
import { Future, Group as Group28 } from "@terraforge/core";
|
|
7027
7019
|
import { aws as aws29 } from "@terraforge/aws";
|
|
7028
7020
|
import { camelCase as camelCase7, constantCase as constantCase13 } from "change-case";
|
|
7029
7021
|
|
|
@@ -7578,7 +7570,7 @@ var routerFeature = defineFeature({
|
|
|
7578
7570
|
{
|
|
7579
7571
|
distributionId: distribution.id,
|
|
7580
7572
|
paths,
|
|
7581
|
-
version: new
|
|
7573
|
+
version: new Future((resolve) => {
|
|
7582
7574
|
$combine(...versions).then((versions2) => {
|
|
7583
7575
|
const combined = versions2.filter((v) => !!v).sort().join(",");
|
|
7584
7576
|
const version = createHash5("sha1").update(combined).digest("hex");
|
|
@@ -8635,7 +8627,7 @@ import wildstring3 from "wildstring";
|
|
|
8635
8627
|
// src/build/__fingerprint.ts
|
|
8636
8628
|
import { createHash as createHash6 } from "crypto";
|
|
8637
8629
|
import { readdir as readdir4, readFile as readFile5, stat as stat4 } from "fs/promises";
|
|
8638
|
-
import { basename as basename4, dirname as
|
|
8630
|
+
import { basename as basename4, dirname as dirname9, extname as extname4, join as join17 } from "path";
|
|
8639
8631
|
import parseStaticImports from "parse-static-imports";
|
|
8640
8632
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
8641
8633
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -8691,25 +8683,25 @@ var readFiles = async (files) => {
|
|
|
8691
8683
|
};
|
|
8692
8684
|
var findDependencies = async (file, code) => {
|
|
8693
8685
|
const imports = await parseStaticImports(code);
|
|
8694
|
-
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join17(
|
|
8686
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join17(dirname9(file), value) : value);
|
|
8695
8687
|
};
|
|
8696
8688
|
|
|
8697
8689
|
// src/cli/ui/complex/run-tests.ts
|
|
8698
8690
|
import { parse as parse4, stringify } from "@awsless/json";
|
|
8699
8691
|
|
|
8700
8692
|
// src/test/start.ts
|
|
8701
|
-
import
|
|
8702
|
-
import
|
|
8703
|
-
import
|
|
8704
|
-
import { dirname as
|
|
8705
|
-
import { swc
|
|
8693
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
8694
|
+
import json from "@rollup/plugin-json";
|
|
8695
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
8696
|
+
import { dirname as dirname10, join as join18 } from "path";
|
|
8697
|
+
import { swc } from "rollup-plugin-swc3";
|
|
8706
8698
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8707
8699
|
import { configDefaults } from "vitest/config";
|
|
8708
8700
|
import { startVitest } from "vitest/node";
|
|
8709
8701
|
var NullReporter = class {
|
|
8710
8702
|
};
|
|
8711
8703
|
var startTest = async (props) => {
|
|
8712
|
-
const __dirname4 =
|
|
8704
|
+
const __dirname4 = dirname10(fileURLToPath4(import.meta.url));
|
|
8713
8705
|
const startTime = process.hrtime.bigint();
|
|
8714
8706
|
process.noDeprecation = true;
|
|
8715
8707
|
const vitest = await startVitest(
|
|
@@ -8756,10 +8748,10 @@ var startTest = async (props) => {
|
|
|
8756
8748
|
{
|
|
8757
8749
|
plugins: [
|
|
8758
8750
|
// @ts-ignore
|
|
8759
|
-
|
|
8751
|
+
commonjs({ sourceMap: true }),
|
|
8760
8752
|
// @ts-ignore
|
|
8761
|
-
|
|
8762
|
-
|
|
8753
|
+
nodeResolve({ preferBuiltins: true }),
|
|
8754
|
+
swc({
|
|
8763
8755
|
jsc: {
|
|
8764
8756
|
// baseUrl: dirname(input),
|
|
8765
8757
|
minify: { sourceMap: true }
|
|
@@ -8767,7 +8759,7 @@ var startTest = async (props) => {
|
|
|
8767
8759
|
sourceMaps: true
|
|
8768
8760
|
}),
|
|
8769
8761
|
// @ts-ignore
|
|
8770
|
-
|
|
8762
|
+
json()
|
|
8771
8763
|
]
|
|
8772
8764
|
}
|
|
8773
8765
|
);
|
|
@@ -9286,7 +9278,7 @@ import { log as log20 } from "@awsless/clui";
|
|
|
9286
9278
|
|
|
9287
9279
|
// src/type-gen/generate.ts
|
|
9288
9280
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
9289
|
-
import { dirname as
|
|
9281
|
+
import { dirname as dirname11, join as join20, relative as relative7 } from "path";
|
|
9290
9282
|
var generateTypes = async (props) => {
|
|
9291
9283
|
const files = [];
|
|
9292
9284
|
await Promise.all(
|
|
@@ -9300,7 +9292,7 @@ var generateTypes = async (props) => {
|
|
|
9300
9292
|
if (include) {
|
|
9301
9293
|
files.push(relative7(directories.root, path));
|
|
9302
9294
|
}
|
|
9303
|
-
await mkdir5(
|
|
9295
|
+
await mkdir5(dirname11(path), { recursive: true });
|
|
9304
9296
|
await writeFile4(path, code);
|
|
9305
9297
|
}
|
|
9306
9298
|
}
|
|
@@ -9773,28 +9765,28 @@ var formatLog = (level, date, group, message) => {
|
|
|
9773
9765
|
);
|
|
9774
9766
|
};
|
|
9775
9767
|
var parseJsonLog = (message) => {
|
|
9776
|
-
let
|
|
9768
|
+
let json2;
|
|
9777
9769
|
try {
|
|
9778
|
-
|
|
9770
|
+
json2 = JSON.parse(message);
|
|
9779
9771
|
} catch (error) {
|
|
9780
9772
|
}
|
|
9781
|
-
if ("level" in
|
|
9773
|
+
if ("level" in json2 && typeof json2.level === "string" && "timestamp" in json2 && typeof json2.timestamp === "string" && "message" in json2) {
|
|
9782
9774
|
return {
|
|
9783
|
-
level:
|
|
9784
|
-
message: typeof
|
|
9785
|
-
date: new Date(
|
|
9775
|
+
level: json2.level,
|
|
9776
|
+
message: typeof json2.message === "string" ? json2.message : JSON.stringify(json2.message, void 0, 2),
|
|
9777
|
+
date: new Date(json2.timestamp)
|
|
9786
9778
|
};
|
|
9787
9779
|
}
|
|
9788
|
-
if ("type" in
|
|
9780
|
+
if ("type" in json2 && typeof json2.type === "string" && json2.type.startsWith("platform") && "time" in json2 && typeof json2.time === "string" && "record" in json2) {
|
|
9789
9781
|
return {
|
|
9790
9782
|
level: "SYSTEM",
|
|
9791
|
-
message: JSON.stringify(
|
|
9792
|
-
date: new Date(
|
|
9783
|
+
message: JSON.stringify(json2.record, void 0, 2),
|
|
9784
|
+
date: new Date(json2.time)
|
|
9793
9785
|
};
|
|
9794
9786
|
}
|
|
9795
9787
|
return {
|
|
9796
9788
|
level: "INFO",
|
|
9797
|
-
message: JSON.stringify(
|
|
9789
|
+
message: JSON.stringify(json2, void 0, 2)
|
|
9798
9790
|
};
|
|
9799
9791
|
};
|
|
9800
9792
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/prebuild.js
CHANGED
|
@@ -6,7 +6,7 @@ import { join as join2 } from "path";
|
|
|
6
6
|
import { days, seconds, toDays, toSeconds } from "@awsless/duration";
|
|
7
7
|
import { mebibytes, toMebibytes } from "@awsless/size";
|
|
8
8
|
import { aws } from "@terraforge/aws";
|
|
9
|
-
import {
|
|
9
|
+
import { Output, findInputDeps, resolveInputs } from "@terraforge/core";
|
|
10
10
|
import { pascalCase } from "change-case";
|
|
11
11
|
import { writeFile } from "fs/promises";
|
|
12
12
|
import { join } from "path";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.593",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.5",
|
|
37
|
-
"@awsless/clui": "^0.0.8",
|
|
38
|
-
"@awsless/duration": "^0.0.4",
|
|
39
37
|
"@awsless/cloudwatch": "^0.0.1",
|
|
38
|
+
"@awsless/duration": "^0.0.4",
|
|
40
39
|
"@awsless/dynamodb": "^0.3.8",
|
|
41
|
-
"@awsless/lambda": "^0.0.35",
|
|
42
40
|
"@awsless/json": "^0.0.10",
|
|
41
|
+
"@awsless/clui": "^0.0.8",
|
|
43
42
|
"@awsless/iot": "^0.0.3",
|
|
43
|
+
"@awsless/lambda": "^0.0.35",
|
|
44
|
+
"@awsless/s3": "^0.0.21",
|
|
44
45
|
"@awsless/mqtt": "^0.0.2",
|
|
46
|
+
"@awsless/redis": "^0.0.14",
|
|
47
|
+
"@awsless/sns": "^0.0.10",
|
|
45
48
|
"@awsless/open-search": "^0.0.21",
|
|
46
|
-
"@awsless/s3": "^0.0.21",
|
|
47
49
|
"@awsless/validate": "^0.1.3",
|
|
48
|
-
"@awsless/
|
|
50
|
+
"@awsless/ssm": "^0.0.7",
|
|
49
51
|
"@awsless/weak-cache": "^0.0.1",
|
|
50
|
-
"@awsless/
|
|
51
|
-
"@awsless/sqs": "^0.0.16",
|
|
52
|
-
"@awsless/ssm": "^0.0.7"
|
|
52
|
+
"@awsless/sqs": "^0.0.16"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -143,12 +143,12 @@
|
|
|
143
143
|
"@awsless/cloudwatch": "^0.0.1",
|
|
144
144
|
"@awsless/clui": "^0.0.8",
|
|
145
145
|
"@awsless/duration": "^0.0.4",
|
|
146
|
-
"@awsless/
|
|
146
|
+
"@awsless/scheduler": "^0.0.4",
|
|
147
147
|
"@awsless/graphql": "^0.0.9",
|
|
148
148
|
"@awsless/json": "^0.0.10",
|
|
149
|
-
"@awsless/
|
|
150
|
-
"@awsless/
|
|
151
|
-
"@awsless/
|
|
149
|
+
"@awsless/validate": "^0.1.3",
|
|
150
|
+
"@awsless/size": "^0.0.2",
|
|
151
|
+
"@awsless/ts-file-cache": "^0.0.12"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
154
|
"@node-rs/bcrypt": "^1.10.5",
|