@awsless/awsless 0.0.549 → 0.0.551
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 +75 -34
- package/dist/build-json-schema.js +1 -2
- 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/stack.json +1 -1
- package/package.json +13 -13
package/dist/bin.js
CHANGED
|
@@ -370,7 +370,7 @@ var createWorkSpace = async (props) => {
|
|
|
370
370
|
if (process.env.VERBOSE) {
|
|
371
371
|
enableDebug();
|
|
372
372
|
}
|
|
373
|
-
const aws = await terraform.install("hashicorp", "aws", "
|
|
373
|
+
const aws = await terraform.install("hashicorp", "aws", "6.9.0");
|
|
374
374
|
const workspace = new WorkSpace({
|
|
375
375
|
providers: [
|
|
376
376
|
createLambdaProvider(props),
|
|
@@ -1790,8 +1790,7 @@ var StoresSchema = z35.union([
|
|
|
1790
1790
|
z35.record(
|
|
1791
1791
|
ResourceIdSchema,
|
|
1792
1792
|
z35.object({
|
|
1793
|
-
|
|
1794
|
-
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1793
|
+
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1795
1794
|
versioning: z35.boolean().default(false).describe("Enable versioning of your store."),
|
|
1796
1795
|
events: z35.object({
|
|
1797
1796
|
// create
|
|
@@ -5431,6 +5430,30 @@ var siteFeature = defineFeature({
|
|
|
5431
5430
|
import { Group as Group16 } from "@awsless/formation";
|
|
5432
5431
|
import { kebabCase as kebabCase7 } from "change-case";
|
|
5433
5432
|
import { $ as $16 } from "@awsless/formation";
|
|
5433
|
+
import { glob as glob3 } from "glob";
|
|
5434
|
+
|
|
5435
|
+
// src/feature/store/util.ts
|
|
5436
|
+
import { contentType as contentType2, lookup as lookup2 } from "mime-types";
|
|
5437
|
+
import { extname as extname3 } from "path";
|
|
5438
|
+
var getCacheControl2 = (file) => {
|
|
5439
|
+
switch (lookup2(file)) {
|
|
5440
|
+
case false:
|
|
5441
|
+
case "text/html":
|
|
5442
|
+
case "application/json":
|
|
5443
|
+
case "application/manifest+json":
|
|
5444
|
+
case "application/manifest":
|
|
5445
|
+
case "text/markdown":
|
|
5446
|
+
return "s-maxage=31536000, max-age=0";
|
|
5447
|
+
default:
|
|
5448
|
+
return `public, max-age=31536000, immutable`;
|
|
5449
|
+
}
|
|
5450
|
+
};
|
|
5451
|
+
var getContentType2 = (file) => {
|
|
5452
|
+
return contentType2(extname3(file)) || "text/html; charset=utf-8";
|
|
5453
|
+
};
|
|
5454
|
+
|
|
5455
|
+
// src/feature/store/index.ts
|
|
5456
|
+
import { join as join12 } from "path";
|
|
5434
5457
|
var typeGenCode5 = `
|
|
5435
5458
|
import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
|
|
5436
5459
|
|
|
@@ -5523,6 +5546,24 @@ var storeFeature = defineFeature({
|
|
|
5523
5546
|
import: ctx.import ? name : void 0
|
|
5524
5547
|
}
|
|
5525
5548
|
);
|
|
5549
|
+
ctx.onReady(() => {
|
|
5550
|
+
if (typeof props.static === "string" && bucket) {
|
|
5551
|
+
const files = glob3.sync("**", {
|
|
5552
|
+
cwd: props.static,
|
|
5553
|
+
nodir: true
|
|
5554
|
+
});
|
|
5555
|
+
for (const file of files) {
|
|
5556
|
+
new $16.aws.s3.BucketObject(group, file, {
|
|
5557
|
+
bucket: bucket.bucket,
|
|
5558
|
+
key: file,
|
|
5559
|
+
cacheControl: getCacheControl2(file),
|
|
5560
|
+
contentType: getContentType2(file),
|
|
5561
|
+
source: join12(props.static, file),
|
|
5562
|
+
sourceHash: $hash(join12(props.static, file))
|
|
5563
|
+
});
|
|
5564
|
+
}
|
|
5565
|
+
}
|
|
5566
|
+
});
|
|
5526
5567
|
const eventMap = {
|
|
5527
5568
|
"created:*": "s3:ObjectCreated:*",
|
|
5528
5569
|
"created:put": "s3:ObjectCreated:Put",
|
|
@@ -6213,12 +6254,12 @@ var layerFeature = defineFeature({
|
|
|
6213
6254
|
|
|
6214
6255
|
// src/feature/image/index.ts
|
|
6215
6256
|
import { $ as $23, Group as Group23 } from "@awsless/formation";
|
|
6216
|
-
import { join as
|
|
6257
|
+
import { join as join13, dirname as dirname8 } from "path";
|
|
6217
6258
|
import { mebibytes as mebibytes4 } from "@awsless/size";
|
|
6218
6259
|
import { days as days7, seconds as seconds9, toDays as toDays6, toSeconds as toSeconds8 } from "@awsless/duration";
|
|
6219
6260
|
import { constantCase as constantCase12 } from "change-case";
|
|
6220
6261
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6221
|
-
import { glob as
|
|
6262
|
+
import { glob as glob4 } from "glob";
|
|
6222
6263
|
var __dirname2 = dirname8(fileURLToPath2(import.meta.url));
|
|
6223
6264
|
var imageFeature = defineFeature({
|
|
6224
6265
|
name: "image",
|
|
@@ -6230,7 +6271,7 @@ var imageFeature = defineFeature({
|
|
|
6230
6271
|
return;
|
|
6231
6272
|
}
|
|
6232
6273
|
const group = new Group23(ctx.base, "image", "layer");
|
|
6233
|
-
const path =
|
|
6274
|
+
const path = join13(__dirname2, "/layers/sharp-arm.zip");
|
|
6234
6275
|
const layerId = formatGlobalResourceName({
|
|
6235
6276
|
appName: ctx.appConfig.name,
|
|
6236
6277
|
resourceType: "layer",
|
|
@@ -6313,8 +6354,8 @@ var imageFeature = defineFeature({
|
|
|
6313
6354
|
resourceName: "sharp"
|
|
6314
6355
|
});
|
|
6315
6356
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "image", id, {
|
|
6316
|
-
bundleFile:
|
|
6317
|
-
bundleHash:
|
|
6357
|
+
bundleFile: join13(__dirname2, "/prebuild/image/bundle.zip"),
|
|
6358
|
+
bundleHash: join13(__dirname2, "/prebuild/image/HASH"),
|
|
6318
6359
|
memorySize: mebibytes4(512),
|
|
6319
6360
|
timeout: seconds9(10),
|
|
6320
6361
|
handler: "index.default",
|
|
@@ -6372,7 +6413,7 @@ var imageFeature = defineFeature({
|
|
|
6372
6413
|
}
|
|
6373
6414
|
ctx.onReady(() => {
|
|
6374
6415
|
if (props.origin.static && s3Origin) {
|
|
6375
|
-
const files =
|
|
6416
|
+
const files = glob4.sync("**", {
|
|
6376
6417
|
cwd: props.origin.static,
|
|
6377
6418
|
nodir: true
|
|
6378
6419
|
});
|
|
@@ -6380,8 +6421,8 @@ var imageFeature = defineFeature({
|
|
|
6380
6421
|
new $23.aws.s3.BucketObject(group, `static-${file}`, {
|
|
6381
6422
|
bucket: s3Origin.bucket,
|
|
6382
6423
|
key: file,
|
|
6383
|
-
source:
|
|
6384
|
-
sourceHash: $hash(
|
|
6424
|
+
source: join13(props.origin.static, file),
|
|
6425
|
+
sourceHash: $hash(join13(props.origin.static, file))
|
|
6385
6426
|
});
|
|
6386
6427
|
}
|
|
6387
6428
|
}
|
|
@@ -6533,12 +6574,12 @@ var imageFeature = defineFeature({
|
|
|
6533
6574
|
|
|
6534
6575
|
// src/feature/icon/index.ts
|
|
6535
6576
|
import { $ as $24, Group as Group24 } from "@awsless/formation";
|
|
6536
|
-
import { join as
|
|
6577
|
+
import { join as join14, dirname as dirname9 } from "path";
|
|
6537
6578
|
import { mebibytes as mebibytes5 } from "@awsless/size";
|
|
6538
6579
|
import { days as days8, seconds as seconds10, toDays as toDays7, toSeconds as toSeconds9 } from "@awsless/duration";
|
|
6539
6580
|
import { constantCase as constantCase13 } from "change-case";
|
|
6540
6581
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6541
|
-
import { glob as
|
|
6582
|
+
import { glob as glob5 } from "glob";
|
|
6542
6583
|
var __dirname3 = dirname9(fileURLToPath3(import.meta.url));
|
|
6543
6584
|
var iconFeature = defineFeature({
|
|
6544
6585
|
name: "icon",
|
|
@@ -6591,8 +6632,8 @@ var iconFeature = defineFeature({
|
|
|
6591
6632
|
} : {}
|
|
6592
6633
|
});
|
|
6593
6634
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "icon", id, {
|
|
6594
|
-
bundleFile:
|
|
6595
|
-
bundleHash:
|
|
6635
|
+
bundleFile: join14(__dirname3, "/prebuild/icon/bundle.zip"),
|
|
6636
|
+
bundleHash: join14(__dirname3, "/prebuild/icon/HASH"),
|
|
6596
6637
|
memorySize: mebibytes5(512),
|
|
6597
6638
|
timeout: seconds10(10),
|
|
6598
6639
|
handler: "index.default",
|
|
@@ -6648,7 +6689,7 @@ var iconFeature = defineFeature({
|
|
|
6648
6689
|
}
|
|
6649
6690
|
ctx.onReady(() => {
|
|
6650
6691
|
if (props.origin.static && s3Origin) {
|
|
6651
|
-
const files =
|
|
6692
|
+
const files = glob5.sync("**", {
|
|
6652
6693
|
cwd: props.origin.static,
|
|
6653
6694
|
nodir: true
|
|
6654
6695
|
});
|
|
@@ -6659,8 +6700,8 @@ var iconFeature = defineFeature({
|
|
|
6659
6700
|
new $24.aws.s3.BucketObject(group, `static-${file}`, {
|
|
6660
6701
|
bucket: s3Origin.bucket,
|
|
6661
6702
|
key: file,
|
|
6662
|
-
source:
|
|
6663
|
-
sourceHash: $hash(
|
|
6703
|
+
source: join14(props.origin.static, file),
|
|
6704
|
+
sourceHash: $hash(join14(props.origin.static, file))
|
|
6664
6705
|
});
|
|
6665
6706
|
}
|
|
6666
6707
|
}
|
|
@@ -6820,15 +6861,15 @@ import { toMebibytes as toMebibytes4 } from "@awsless/size";
|
|
|
6820
6861
|
import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
|
|
6821
6862
|
import { constantCase as constantCase14, pascalCase as pascalCase3 } from "change-case";
|
|
6822
6863
|
import deepmerge4 from "deepmerge";
|
|
6823
|
-
import { join as
|
|
6864
|
+
import { join as join16 } from "path";
|
|
6824
6865
|
|
|
6825
6866
|
// src/feature/instance/build/executable.ts
|
|
6826
6867
|
import { createHash as createHash4 } from "crypto";
|
|
6827
6868
|
import { readFile as readFile4 } from "fs/promises";
|
|
6828
|
-
import { join as
|
|
6869
|
+
import { join as join15 } from "path";
|
|
6829
6870
|
import { exec as exec2 } from "promisify-child-process";
|
|
6830
6871
|
var buildExecutable = async (input, outputPath) => {
|
|
6831
|
-
const filePath =
|
|
6872
|
+
const filePath = join15(outputPath, "program");
|
|
6832
6873
|
const args = ["build", input, "--compile", "--target", "bun-linux-x64-modern", "--outfile", filePath];
|
|
6833
6874
|
try {
|
|
6834
6875
|
await exec2(`bun ${args.join(" ")}`);
|
|
@@ -7048,7 +7089,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
7048
7089
|
healthCheck: props.healthCheck ? {
|
|
7049
7090
|
command: [
|
|
7050
7091
|
"CMD-SHELL",
|
|
7051
|
-
`curl -f http://${
|
|
7092
|
+
`curl -f http://${join16("localhost", props.healthCheck.path)} || exit 1`
|
|
7052
7093
|
],
|
|
7053
7094
|
interval: toSeconds10(props.healthCheck.interval),
|
|
7054
7095
|
retries: props.healthCheck.retries,
|
|
@@ -8249,13 +8290,13 @@ import wildstring4 from "wildstring";
|
|
|
8249
8290
|
import { log as log15 } from "@awsless/clui";
|
|
8250
8291
|
import chalk4 from "chalk";
|
|
8251
8292
|
import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
|
|
8252
|
-
import { join as
|
|
8293
|
+
import { join as join19 } from "path";
|
|
8253
8294
|
import wildstring3 from "wildstring";
|
|
8254
8295
|
|
|
8255
8296
|
// src/build/__fingerprint.ts
|
|
8256
8297
|
import { createHash as createHash5 } from "crypto";
|
|
8257
8298
|
import { readdir as readdir4, readFile as readFile5, stat as stat4 } from "fs/promises";
|
|
8258
|
-
import { basename as basename4, dirname as dirname10, extname as
|
|
8299
|
+
import { basename as basename4, dirname as dirname10, extname as extname4, join as join17 } from "path";
|
|
8259
8300
|
import parseStaticImports from "parse-static-imports";
|
|
8260
8301
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
8261
8302
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -8276,8 +8317,8 @@ var fingerprintFromDirectory = async (dir) => {
|
|
|
8276
8317
|
const hashes = /* @__PURE__ */ new Map();
|
|
8277
8318
|
const files = await readdir4(dir, { recursive: true });
|
|
8278
8319
|
for (const file of files) {
|
|
8279
|
-
if (extensions.includes(
|
|
8280
|
-
await generateFileHashes(
|
|
8320
|
+
if (extensions.includes(extname4(file).substring(1)) && file.at(0) !== "_") {
|
|
8321
|
+
await generateFileHashes(join17(dir, file), hashes);
|
|
8281
8322
|
}
|
|
8282
8323
|
}
|
|
8283
8324
|
const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
|
|
@@ -8291,7 +8332,7 @@ var readModuleFile = (file) => {
|
|
|
8291
8332
|
return readFiles([
|
|
8292
8333
|
file,
|
|
8293
8334
|
...extensions.map((exp) => `${file}.${exp}`),
|
|
8294
|
-
...extensions.map((exp) =>
|
|
8335
|
+
...extensions.map((exp) => join17(file, `/index.${exp}`))
|
|
8295
8336
|
]);
|
|
8296
8337
|
}
|
|
8297
8338
|
return readFile5(file, "utf8");
|
|
@@ -8311,7 +8352,7 @@ var readFiles = async (files) => {
|
|
|
8311
8352
|
};
|
|
8312
8353
|
var findDependencies = async (file, code) => {
|
|
8313
8354
|
const imports = await parseStaticImports(code);
|
|
8314
|
-
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ?
|
|
8355
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join17(dirname10(file), value) : value);
|
|
8315
8356
|
};
|
|
8316
8357
|
|
|
8317
8358
|
// src/test/reporter.ts
|
|
@@ -8391,7 +8432,7 @@ var CustomReporter = class {
|
|
|
8391
8432
|
import commonjs2 from "@rollup/plugin-commonjs";
|
|
8392
8433
|
import json2 from "@rollup/plugin-json";
|
|
8393
8434
|
import nodeResolve2 from "@rollup/plugin-node-resolve";
|
|
8394
|
-
import { dirname as dirname11, join as
|
|
8435
|
+
import { dirname as dirname11, join as join18 } from "path";
|
|
8395
8436
|
import { swc as swc2 } from "rollup-plugin-swc3";
|
|
8396
8437
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8397
8438
|
import { configDefaults } from "vitest/config";
|
|
@@ -8413,7 +8454,7 @@ var startTest = async (props) => {
|
|
|
8413
8454
|
reporters: props.reporter,
|
|
8414
8455
|
setupFiles: [
|
|
8415
8456
|
//
|
|
8416
|
-
|
|
8457
|
+
join18(__dirname4, "test-global-setup.js")
|
|
8417
8458
|
]
|
|
8418
8459
|
// globalSetup: [
|
|
8419
8460
|
// //
|
|
@@ -8503,7 +8544,7 @@ var logTestErrors = (event) => {
|
|
|
8503
8544
|
var runTest = async (stack, dir, filters, opts) => {
|
|
8504
8545
|
await mkdir4(directories.test, { recursive: true });
|
|
8505
8546
|
const fingerprint = await fingerprintFromDirectory(dir);
|
|
8506
|
-
const file =
|
|
8547
|
+
const file = join19(directories.test, `${stack}.json`);
|
|
8507
8548
|
const exists = await fileExist(file);
|
|
8508
8549
|
if (exists && !process.env.NO_CACHE) {
|
|
8509
8550
|
const raw = await readFile6(file, { encoding: "utf8" });
|
|
@@ -8841,7 +8882,7 @@ import { log as log18 } from "@awsless/clui";
|
|
|
8841
8882
|
|
|
8842
8883
|
// src/type-gen/generate.ts
|
|
8843
8884
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
8844
|
-
import { dirname as dirname12, join as
|
|
8885
|
+
import { dirname as dirname12, join as join20, relative as relative7 } from "path";
|
|
8845
8886
|
var generateTypes = async (props) => {
|
|
8846
8887
|
const files = [];
|
|
8847
8888
|
await Promise.all(
|
|
@@ -8850,7 +8891,7 @@ var generateTypes = async (props) => {
|
|
|
8850
8891
|
...props,
|
|
8851
8892
|
async write(file, data, include = false) {
|
|
8852
8893
|
const code = data?.toString("utf8");
|
|
8853
|
-
const path =
|
|
8894
|
+
const path = join20(directories.types, file);
|
|
8854
8895
|
if (code) {
|
|
8855
8896
|
if (include) {
|
|
8856
8897
|
files.push(relative7(directories.root, path));
|
|
@@ -8864,7 +8905,7 @@ var generateTypes = async (props) => {
|
|
|
8864
8905
|
);
|
|
8865
8906
|
if (files.length) {
|
|
8866
8907
|
const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
|
|
8867
|
-
await writeFile4(
|
|
8908
|
+
await writeFile4(join20(directories.root, `awsless.d.ts`), code);
|
|
8868
8909
|
}
|
|
8869
8910
|
};
|
|
8870
8911
|
|
|
@@ -1182,8 +1182,7 @@ var StoresSchema = z32.union([
|
|
|
1182
1182
|
z32.record(
|
|
1183
1183
|
ResourceIdSchema,
|
|
1184
1184
|
z32.object({
|
|
1185
|
-
|
|
1186
|
-
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1185
|
+
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
1187
1186
|
versioning: z32.boolean().default(false).describe("Enable versioning of your store."),
|
|
1188
1187
|
events: z32.object({
|
|
1189
1188
|
// create
|
|
Binary file
|
|
Binary file
|
|
Binary file
|