@awsless/awsless 0.0.109 → 0.0.111
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 +26 -21
- package/dist/features/cognito-client-secret/bundle.zip +0 -0
- package/dist/features/delete-bucket/bundle.zip +0 -0
- package/dist/features/delete-hosted-zone/bundle.zip +0 -0
- package/dist/features/global-exports/bundle.zip +0 -0
- package/dist/features/invalidate-cache/bundle.zip +0 -0
- package/dist/features/upload-bucket-asset/bundle.zip +0 -0
- package/dist/index.js +18 -4
- package/package.json +6 -4
package/dist/bin.js
CHANGED
|
@@ -995,7 +995,7 @@ import { join as join2 } from "path";
|
|
|
995
995
|
import { createHash as createHash2 } from "crypto";
|
|
996
996
|
import { readFile, readdir, stat as stat2 } from "fs/promises";
|
|
997
997
|
import { basename, dirname as dirname2, extname, join } from "path";
|
|
998
|
-
import
|
|
998
|
+
import parseStaticImports from "parse-static-imports";
|
|
999
999
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
1000
1000
|
var generateFileHashes = async (file, hashes) => {
|
|
1001
1001
|
if (hashes.has(file)) {
|
|
@@ -1055,8 +1055,8 @@ var readFiles = async (files) => {
|
|
|
1055
1055
|
throw new Error(`No such file: ${files.join(", ")}`);
|
|
1056
1056
|
};
|
|
1057
1057
|
var findDependencies = async (file, code) => {
|
|
1058
|
-
const imports =
|
|
1059
|
-
return imports.map((entry) => entry.
|
|
1058
|
+
const imports = await parseStaticImports(code);
|
|
1059
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join(dirname2(file), value) : value);
|
|
1060
1060
|
};
|
|
1061
1061
|
|
|
1062
1062
|
// src/formation/resource/lambda/code.ts
|
|
@@ -1672,6 +1672,7 @@ type Func = (...args: any[]) => any
|
|
|
1672
1672
|
type Invoke<Name extends string, F extends Func> = {
|
|
1673
1673
|
readonly name: Name
|
|
1674
1674
|
readonly async: (payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
1675
|
+
readonly cached: (payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload' | 'type'>) => InvokeResponse<F>
|
|
1675
1676
|
(payload: Parameters<F>[0], options?: Omit<InvokeOptions, 'name' | 'payload'>): InvokeResponse<F>
|
|
1676
1677
|
}
|
|
1677
1678
|
|
|
@@ -8308,8 +8309,8 @@ import { startVitest } from "vitest/node";
|
|
|
8308
8309
|
import commonjs3 from "@rollup/plugin-commonjs";
|
|
8309
8310
|
import nodeResolve3 from "@rollup/plugin-node-resolve";
|
|
8310
8311
|
import { swc as swc4 } from "rollup-plugin-swc3";
|
|
8311
|
-
import { getTests } from "@vitest/runner/utils";
|
|
8312
|
-
import { basename as basename3, extname as extname2, join as join11, relative as relative4 } from "path";
|
|
8312
|
+
import { getSuites, getTests } from "@vitest/runner/utils";
|
|
8313
|
+
import { basename as basename3, dirname as dirname6, extname as extname2, join as join11, relative as relative4 } from "path";
|
|
8313
8314
|
|
|
8314
8315
|
// src/cli/ui/layout/text-box.ts
|
|
8315
8316
|
import wrapAnsi3 from "wrap-ansi";
|
|
@@ -8344,16 +8345,18 @@ var CustomReporter = class {
|
|
|
8344
8345
|
onFinished() {
|
|
8345
8346
|
clearInterval(this.interval);
|
|
8346
8347
|
this.interval = void 0;
|
|
8348
|
+
const suites = getSuites(this.tasks);
|
|
8347
8349
|
const tests = getTests(this.tasks);
|
|
8348
|
-
const
|
|
8349
|
-
const
|
|
8350
|
-
const
|
|
8350
|
+
const tasks = [...suites, ...tests];
|
|
8351
|
+
const passed = tasks.filter((t) => t.result?.state === "pass").length;
|
|
8352
|
+
const failed = tasks.filter((t) => t.result?.state === "fail").length;
|
|
8353
|
+
const errors = [...suites, ...tests].map((test2) => {
|
|
8351
8354
|
if (!test2.result?.errors || test2.result.errors.length === 0) {
|
|
8352
8355
|
return [];
|
|
8353
8356
|
}
|
|
8354
8357
|
return test2.result.errors.map((error) => ({
|
|
8355
|
-
file: test2.file?.name,
|
|
8356
|
-
test: test2.name,
|
|
8358
|
+
file: test2.type === "suite" ? test2.name : test2.file?.name,
|
|
8359
|
+
test: test2.type === "test" ? test2.name : void 0,
|
|
8357
8360
|
diff: error.showDiff && error.diff ? error.diff : void 0,
|
|
8358
8361
|
type: error.name,
|
|
8359
8362
|
message: error.message
|
|
@@ -8396,8 +8399,10 @@ var singleTester = (stack, dir) => {
|
|
|
8396
8399
|
path = join11(process.cwd(), path);
|
|
8397
8400
|
path = relative4(dir, path);
|
|
8398
8401
|
const ext = extname2(path);
|
|
8399
|
-
const
|
|
8400
|
-
|
|
8402
|
+
const name = basename3(path, ext);
|
|
8403
|
+
const base = dirname6(path);
|
|
8404
|
+
const start = base === "." ? "" : style.placeholder(base + "/");
|
|
8405
|
+
return `${start}${name}${style.placeholder(ext)}`;
|
|
8401
8406
|
};
|
|
8402
8407
|
const formatLogs = (logs2, width) => {
|
|
8403
8408
|
const length2 = logs2.length;
|
|
@@ -8408,14 +8413,14 @@ var singleTester = (stack, dir) => {
|
|
|
8408
8413
|
const lineSize = (width - 2) / 2 - header2.length / 2;
|
|
8409
8414
|
return [
|
|
8410
8415
|
" ",
|
|
8411
|
-
style.
|
|
8412
|
-
style.
|
|
8413
|
-
style.
|
|
8416
|
+
style.info(symbol.line.repeat(lineSize)),
|
|
8417
|
+
style.info.inverse.bold(header2),
|
|
8418
|
+
style.info(symbol.line.repeat(lineSize + (header2.length % 2 ? 0 : 1))),
|
|
8414
8419
|
br(),
|
|
8415
8420
|
br(),
|
|
8416
8421
|
...logs2.map((log) => {
|
|
8417
8422
|
return [
|
|
8418
|
-
textWrap([style.
|
|
8423
|
+
textWrap([style.info(`${symbol.dot} `), log].join(""), width, {
|
|
8419
8424
|
skipFirstLine: true,
|
|
8420
8425
|
indent: 2
|
|
8421
8426
|
}),
|
|
@@ -8441,11 +8446,14 @@ var singleTester = (stack, dir) => {
|
|
|
8441
8446
|
...errors.map((error, i) => {
|
|
8442
8447
|
const [message, ...comment] = error.message.split("//");
|
|
8443
8448
|
const errorMessage = [
|
|
8444
|
-
style.error
|
|
8449
|
+
style.error.bold(error.type + ":"),
|
|
8450
|
+
" ",
|
|
8451
|
+
message,
|
|
8445
8452
|
comment.length > 0 ? style.placeholder(`//${comment}`) : "",
|
|
8446
8453
|
br()
|
|
8447
8454
|
].join("");
|
|
8448
8455
|
const pagination = `[${i + 1}/${length2}]${symbol.line}`;
|
|
8456
|
+
const name = error.test ? [" ", style.placeholder(symbol.pointerSmall), " ", error.test] : [];
|
|
8449
8457
|
return [
|
|
8450
8458
|
br(),
|
|
8451
8459
|
style.error(`${symbol.error} `),
|
|
@@ -8454,10 +8462,7 @@ var singleTester = (stack, dir) => {
|
|
|
8454
8462
|
style.placeholder(symbol.pointerSmall),
|
|
8455
8463
|
" ",
|
|
8456
8464
|
formatFileName(error.file),
|
|
8457
|
-
|
|
8458
|
-
style.placeholder(symbol.pointerSmall),
|
|
8459
|
-
" ",
|
|
8460
|
-
error.test,
|
|
8465
|
+
...name,
|
|
8461
8466
|
br(),
|
|
8462
8467
|
br(),
|
|
8463
8468
|
textWrap(errorMessage, width, { indent: 2 }),
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -19,18 +19,20 @@ import { invoke } from "@awsless/lambda";
|
|
|
19
19
|
|
|
20
20
|
// src/node/util.ts
|
|
21
21
|
var createProxy = /* @__NO_SIDE_EFFECTS__ */ (cb) => {
|
|
22
|
-
const
|
|
22
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
23
23
|
return new Proxy({}, {
|
|
24
24
|
get(_, name) {
|
|
25
|
-
if (!
|
|
26
|
-
|
|
25
|
+
if (!cache2.has(name)) {
|
|
26
|
+
cache2.set(name, cb(name));
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return cache2.get(name);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/node/function.ts
|
|
34
|
+
import { WeakCache } from "@awsless/weak-cache";
|
|
35
|
+
var cache = new WeakCache();
|
|
34
36
|
var getFunctionName = (stack, name) => {
|
|
35
37
|
return getLocalResourceName(name, stack);
|
|
36
38
|
};
|
|
@@ -55,6 +57,18 @@ var Function = /* @__PURE__ */ createProxy((stackName) => {
|
|
|
55
57
|
payload
|
|
56
58
|
});
|
|
57
59
|
};
|
|
60
|
+
call.cached = async (payload, options = {}) => {
|
|
61
|
+
const cacheKey = JSON.stringify({ name, payload, options });
|
|
62
|
+
if (!cache.has(cacheKey)) {
|
|
63
|
+
const result = await invoke({
|
|
64
|
+
...options,
|
|
65
|
+
name,
|
|
66
|
+
payload
|
|
67
|
+
});
|
|
68
|
+
cache.set(cacheKey, result);
|
|
69
|
+
}
|
|
70
|
+
return cache.get(cacheKey);
|
|
71
|
+
};
|
|
58
72
|
return call;
|
|
59
73
|
});
|
|
60
74
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@awsless/lambda": "^0.0.13",
|
|
28
27
|
"@awsless/redis": "^0.0.8",
|
|
28
|
+
"@awsless/lambda": "^0.0.13",
|
|
29
29
|
"@awsless/sns": "^0.0.7",
|
|
30
|
-
"@awsless/validate": "^0.0.7",
|
|
31
30
|
"@awsless/sqs": "^0.0.7",
|
|
32
|
-
"@awsless/ssm": "^0.0.7"
|
|
31
|
+
"@awsless/ssm": "^0.0.7",
|
|
32
|
+
"@awsless/validate": "^0.0.7",
|
|
33
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@aws-appsync/utils": "^1.5.0",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"jszip": "^3.10.1",
|
|
68
69
|
"mime-types": "^2.1.35",
|
|
69
70
|
"parse-imports": "^1.1.2",
|
|
71
|
+
"parse-static-imports": "^1.1.0",
|
|
70
72
|
"pretty-hrtime": "^1.0.3",
|
|
71
73
|
"rollup": "^4.0.2",
|
|
72
74
|
"rollup-plugin-replace": "^2.2.0",
|