@awsless/awsless 0.0.10 → 0.0.12
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.cjs +10 -5
- package/dist/bin.js +10 -5
- package/dist/index.cjs +22 -20
- package/dist/index.d.ts +6 -6
- package/dist/index.js +18 -16
- package/package.json +2 -1
package/dist/bin.cjs
CHANGED
|
@@ -522,6 +522,7 @@ var formatByteSize = (size) => {
|
|
|
522
522
|
var import_rollup = require("rollup");
|
|
523
523
|
var import_crypto = require("crypto");
|
|
524
524
|
var import_rollup_plugin_swc3 = require("rollup-plugin-swc3");
|
|
525
|
+
var import_plugin_json = __toESM(require("@rollup/plugin-json"), 1);
|
|
525
526
|
var import_plugin_commonjs = __toESM(require("@rollup/plugin-commonjs"), 1);
|
|
526
527
|
var import_plugin_node_resolve = __toESM(require("@rollup/plugin-node-resolve"), 1);
|
|
527
528
|
var rollupBuild = async (input) => {
|
|
@@ -545,22 +546,26 @@ var rollupBuild = async (input) => {
|
|
|
545
546
|
minify: true,
|
|
546
547
|
jsc: { minify: { sourceMap: true } },
|
|
547
548
|
sourceMaps: true
|
|
548
|
-
})
|
|
549
|
+
}),
|
|
550
|
+
(0, import_plugin_json.default)()
|
|
549
551
|
]
|
|
550
552
|
});
|
|
551
|
-
const
|
|
553
|
+
const result = await bundle.generate({
|
|
552
554
|
format: "esm",
|
|
553
555
|
sourcemap: "hidden",
|
|
554
556
|
exports: "default"
|
|
555
557
|
});
|
|
556
|
-
const
|
|
558
|
+
const output = result.output[0];
|
|
559
|
+
const code = output.code;
|
|
560
|
+
const map = output.map?.toString();
|
|
561
|
+
const hash = (0, import_crypto.createHash)("sha1").update(code).digest("hex");
|
|
557
562
|
return {
|
|
558
563
|
handler: "index.default",
|
|
559
564
|
hash,
|
|
560
565
|
files: [{
|
|
561
566
|
name: "index.mjs",
|
|
562
|
-
code
|
|
563
|
-
map
|
|
567
|
+
code,
|
|
568
|
+
map
|
|
564
569
|
}]
|
|
565
570
|
};
|
|
566
571
|
};
|
package/dist/bin.js
CHANGED
|
@@ -499,6 +499,7 @@ var formatByteSize = (size) => {
|
|
|
499
499
|
import { rollup } from "rollup";
|
|
500
500
|
import { createHash } from "crypto";
|
|
501
501
|
import { swc } from "rollup-plugin-swc3";
|
|
502
|
+
import json from "@rollup/plugin-json";
|
|
502
503
|
import commonjs from "@rollup/plugin-commonjs";
|
|
503
504
|
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
504
505
|
var rollupBuild = async (input) => {
|
|
@@ -522,22 +523,26 @@ var rollupBuild = async (input) => {
|
|
|
522
523
|
minify: true,
|
|
523
524
|
jsc: { minify: { sourceMap: true } },
|
|
524
525
|
sourceMaps: true
|
|
525
|
-
})
|
|
526
|
+
}),
|
|
527
|
+
json()
|
|
526
528
|
]
|
|
527
529
|
});
|
|
528
|
-
const
|
|
530
|
+
const result = await bundle.generate({
|
|
529
531
|
format: "esm",
|
|
530
532
|
sourcemap: "hidden",
|
|
531
533
|
exports: "default"
|
|
532
534
|
});
|
|
533
|
-
const
|
|
535
|
+
const output = result.output[0];
|
|
536
|
+
const code = output.code;
|
|
537
|
+
const map = output.map?.toString();
|
|
538
|
+
const hash = createHash("sha1").update(code).digest("hex");
|
|
534
539
|
return {
|
|
535
540
|
handler: "index.default",
|
|
536
541
|
hash,
|
|
537
542
|
files: [{
|
|
538
543
|
name: "index.mjs",
|
|
539
|
-
code
|
|
540
|
-
map
|
|
544
|
+
code,
|
|
545
|
+
map
|
|
541
546
|
}]
|
|
542
547
|
};
|
|
543
548
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -20,12 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
-
Queue: () => Queue,
|
|
24
|
-
Store: () => Store,
|
|
25
|
-
Table: () => Table,
|
|
26
23
|
definePlugin: () => definePlugin,
|
|
24
|
+
getFunctionName: () => getFunctionName,
|
|
25
|
+
getQueueName: () => getQueueName,
|
|
27
26
|
getResourceName: () => getResourceName,
|
|
28
|
-
|
|
27
|
+
getStoreName: () => getStoreName,
|
|
28
|
+
getTableName: () => getTableName
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(src_exports);
|
|
31
31
|
|
|
@@ -33,30 +33,32 @@ module.exports = __toCommonJS(src_exports);
|
|
|
33
33
|
var definePlugin = (plugin) => plugin;
|
|
34
34
|
|
|
35
35
|
// src/node/resource.ts
|
|
36
|
-
var getResourceName = (type, id) => {
|
|
37
|
-
const key = `RESOURCE_${type.toUpperCase()}_${id}`;
|
|
36
|
+
var getResourceName = (type, id, stack = process.env.STACK || "default") => {
|
|
37
|
+
const key = `RESOURCE_${type.toUpperCase()}_${stack}_${id}`;
|
|
38
38
|
const value = process.env[key];
|
|
39
39
|
if (!value) {
|
|
40
|
-
throw new TypeError(`Resource type: "${type}" id: "${id}" doesn't exist.`);
|
|
40
|
+
throw new TypeError(`Resource type: "${type}" stack: "${stack}" id: "${id}" doesn't exist.`);
|
|
41
41
|
}
|
|
42
42
|
return value;
|
|
43
43
|
};
|
|
44
|
-
var
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
var getFunctionName = (id, stack) => {
|
|
45
|
+
return getResourceName("function", id, stack);
|
|
46
|
+
};
|
|
47
|
+
var getTableName = (id, stack) => {
|
|
48
|
+
return getResourceName("table", id, stack);
|
|
49
|
+
};
|
|
50
|
+
var getQueueName = (id, stack) => {
|
|
51
|
+
return getResourceName("queue", id, stack);
|
|
52
|
+
};
|
|
53
|
+
var getStoreName = (id, stack) => {
|
|
54
|
+
return getResourceName("store", id, stack);
|
|
50
55
|
};
|
|
51
|
-
var Table = /* @__PURE__ */ getResourceProxy("TABLE");
|
|
52
|
-
var Queue = /* @__PURE__ */ getResourceProxy("QUEUE");
|
|
53
|
-
var Store = /* @__PURE__ */ getResourceProxy("STORE");
|
|
54
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
57
|
0 && (module.exports = {
|
|
56
|
-
Queue,
|
|
57
|
-
Store,
|
|
58
|
-
Table,
|
|
59
58
|
definePlugin,
|
|
59
|
+
getFunctionName,
|
|
60
|
+
getQueueName,
|
|
60
61
|
getResourceName,
|
|
61
|
-
|
|
62
|
+
getStoreName,
|
|
63
|
+
getTableName
|
|
62
64
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1361,13 +1361,13 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1361
1361
|
}>>)[];
|
|
1362
1362
|
type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<typeof defaultPlugins[number]['schema']>;
|
|
1363
1363
|
|
|
1364
|
-
declare const getResourceName: (type: string, id: string) => string;
|
|
1365
|
-
declare const
|
|
1366
|
-
declare const
|
|
1367
|
-
declare const
|
|
1368
|
-
declare const
|
|
1364
|
+
declare const getResourceName: (type: string, id: string, stack?: string) => string;
|
|
1365
|
+
declare const getFunctionName: (id: string, stack?: string) => string;
|
|
1366
|
+
declare const getTableName: (id: string, stack?: string) => string;
|
|
1367
|
+
declare const getQueueName: (id: string, stack?: string) => string;
|
|
1368
|
+
declare const getStoreName: (id: string, stack?: string) => string;
|
|
1369
1369
|
|
|
1370
1370
|
type AppConfig = CombinedDefaultPluginsConfigInput;
|
|
1371
1371
|
type StackConfig = CombinedDefaultPluginsConfigInput['stacks'][number];
|
|
1372
1372
|
|
|
1373
|
-
export { AppConfig, Plugin,
|
|
1373
|
+
export { AppConfig, Plugin, StackConfig, definePlugin, getFunctionName, getQueueName, getResourceName, getStoreName, getTableName };
|
package/dist/index.js
CHANGED
|
@@ -3,29 +3,31 @@ import {
|
|
|
3
3
|
} from "./chunk-PFTL6L4F.js";
|
|
4
4
|
|
|
5
5
|
// src/node/resource.ts
|
|
6
|
-
var getResourceName = (type, id) => {
|
|
7
|
-
const key = `RESOURCE_${type.toUpperCase()}_${id}`;
|
|
6
|
+
var getResourceName = (type, id, stack = process.env.STACK || "default") => {
|
|
7
|
+
const key = `RESOURCE_${type.toUpperCase()}_${stack}_${id}`;
|
|
8
8
|
const value = process.env[key];
|
|
9
9
|
if (!value) {
|
|
10
|
-
throw new TypeError(`Resource type: "${type}" id: "${id}" doesn't exist.`);
|
|
10
|
+
throw new TypeError(`Resource type: "${type}" stack: "${stack}" id: "${id}" doesn't exist.`);
|
|
11
11
|
}
|
|
12
12
|
return value;
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
var getFunctionName = (id, stack) => {
|
|
15
|
+
return getResourceName("function", id, stack);
|
|
16
|
+
};
|
|
17
|
+
var getTableName = (id, stack) => {
|
|
18
|
+
return getResourceName("table", id, stack);
|
|
19
|
+
};
|
|
20
|
+
var getQueueName = (id, stack) => {
|
|
21
|
+
return getResourceName("queue", id, stack);
|
|
22
|
+
};
|
|
23
|
+
var getStoreName = (id, stack) => {
|
|
24
|
+
return getResourceName("store", id, stack);
|
|
20
25
|
};
|
|
21
|
-
var Table = /* @__PURE__ */ getResourceProxy("TABLE");
|
|
22
|
-
var Queue = /* @__PURE__ */ getResourceProxy("QUEUE");
|
|
23
|
-
var Store = /* @__PURE__ */ getResourceProxy("STORE");
|
|
24
26
|
export {
|
|
25
|
-
Queue,
|
|
26
|
-
Store,
|
|
27
|
-
Table,
|
|
28
27
|
definePlugin,
|
|
28
|
+
getFunctionName,
|
|
29
|
+
getQueueName,
|
|
29
30
|
getResourceName,
|
|
30
|
-
|
|
31
|
+
getStoreName,
|
|
32
|
+
getTableName
|
|
31
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@aws-sdk/credential-providers": "^3.369.0",
|
|
33
33
|
"@graphql-tools/merge": "^9.0.0",
|
|
34
34
|
"@rollup/plugin-commonjs": "^24.0.1",
|
|
35
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
35
36
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
36
37
|
"@swc/core": "^1.3.70",
|
|
37
38
|
"@types/pretty-hrtime": "^1.0.1",
|