@awsless/awsless 0.0.175 → 0.0.177
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 -19
- package/package.json +6 -6
package/dist/bin.js
CHANGED
|
@@ -1062,8 +1062,8 @@ var Cancelled = class extends Error {
|
|
|
1062
1062
|
// src/config/load/read.ts
|
|
1063
1063
|
var readConfig = async (file) => {
|
|
1064
1064
|
try {
|
|
1065
|
-
const
|
|
1066
|
-
const data = JSON5.parse(
|
|
1065
|
+
const json4 = await readFile(file, "utf8");
|
|
1066
|
+
const data = JSON5.parse(json4);
|
|
1067
1067
|
return data;
|
|
1068
1068
|
} catch (error) {
|
|
1069
1069
|
if (error instanceof Error) {
|
|
@@ -2568,6 +2568,66 @@ var findDependencies2 = async (file, code) => {
|
|
|
2568
2568
|
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join7(dirname6(file), value) : value);
|
|
2569
2569
|
};
|
|
2570
2570
|
|
|
2571
|
+
// src/feature/graphql/build/typescript/resolver.ts
|
|
2572
|
+
import { rollup as rollup2 } from "rollup";
|
|
2573
|
+
import { swc as swc2, minify as swcMinify2 } from "rollup-plugin-swc3";
|
|
2574
|
+
import json2 from "@rollup/plugin-json";
|
|
2575
|
+
import commonjs2 from "@rollup/plugin-commonjs";
|
|
2576
|
+
import nodeResolve2 from "@rollup/plugin-node-resolve";
|
|
2577
|
+
import { dirname as dirname7 } from "path";
|
|
2578
|
+
var buildTypeScriptResolver = async (input, { minify = true } = {}) => {
|
|
2579
|
+
const bundle = await rollup2({
|
|
2580
|
+
input,
|
|
2581
|
+
external: (importee) => {
|
|
2582
|
+
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || importee.startsWith("@aws-appsync/utils");
|
|
2583
|
+
},
|
|
2584
|
+
onwarn: (error) => {
|
|
2585
|
+
debugError(error.message);
|
|
2586
|
+
},
|
|
2587
|
+
treeshake: {
|
|
2588
|
+
moduleSideEffects: (id) => input === id
|
|
2589
|
+
},
|
|
2590
|
+
plugins: [
|
|
2591
|
+
// @ts-ignore
|
|
2592
|
+
commonjs2({ sourceMap: true }),
|
|
2593
|
+
// @ts-ignore
|
|
2594
|
+
nodeResolve2({ preferBuiltins: true }),
|
|
2595
|
+
swc2({
|
|
2596
|
+
// minify,
|
|
2597
|
+
// module: true,
|
|
2598
|
+
jsc: {
|
|
2599
|
+
baseUrl: dirname7(input),
|
|
2600
|
+
minify: { sourceMap: true }
|
|
2601
|
+
},
|
|
2602
|
+
sourceMaps: true
|
|
2603
|
+
}),
|
|
2604
|
+
minify ? swcMinify2({
|
|
2605
|
+
module: true,
|
|
2606
|
+
sourceMap: true,
|
|
2607
|
+
compress: true
|
|
2608
|
+
}) : void 0,
|
|
2609
|
+
// @ts-ignore
|
|
2610
|
+
json2()
|
|
2611
|
+
]
|
|
2612
|
+
});
|
|
2613
|
+
const result = await bundle.generate({
|
|
2614
|
+
format: "esm",
|
|
2615
|
+
sourcemap: "hidden",
|
|
2616
|
+
exports: "auto",
|
|
2617
|
+
manualChunks: {},
|
|
2618
|
+
entryFileNames: `index.mjs`,
|
|
2619
|
+
chunkFileNames: `[name].mjs`
|
|
2620
|
+
});
|
|
2621
|
+
let code;
|
|
2622
|
+
for (const item of result.output) {
|
|
2623
|
+
if (item.type !== "chunk") {
|
|
2624
|
+
continue;
|
|
2625
|
+
}
|
|
2626
|
+
code = item.code;
|
|
2627
|
+
}
|
|
2628
|
+
return Buffer.from(code, "utf8");
|
|
2629
|
+
};
|
|
2630
|
+
|
|
2571
2631
|
// src/feature/graphql/index.ts
|
|
2572
2632
|
var defaultResolver = `
|
|
2573
2633
|
export function request(ctx) {
|
|
@@ -2684,17 +2744,13 @@ var graphqlFeature = defineFeature({
|
|
|
2684
2744
|
const resolver = props.resolver;
|
|
2685
2745
|
const version = await fingerprintFromFile2(resolver);
|
|
2686
2746
|
return build3(version, async (write) => {
|
|
2687
|
-
const
|
|
2688
|
-
const file = bundle.files[0];
|
|
2747
|
+
const file = await buildTypeScriptResolver(resolver);
|
|
2689
2748
|
if (!file) {
|
|
2690
2749
|
throw new FileError(resolver, `Failed to build a graphql resolver.`);
|
|
2691
2750
|
}
|
|
2692
|
-
await write("resolver.js", file
|
|
2693
|
-
if (file.map) {
|
|
2694
|
-
await write("resolver.map", file.map);
|
|
2695
|
-
}
|
|
2751
|
+
await write("resolver.js", file);
|
|
2696
2752
|
return {
|
|
2697
|
-
size: formatByteSize(file.
|
|
2753
|
+
size: formatByteSize(file.byteLength)
|
|
2698
2754
|
};
|
|
2699
2755
|
});
|
|
2700
2756
|
});
|
|
@@ -4264,12 +4320,12 @@ var CustomReporter = class {
|
|
|
4264
4320
|
};
|
|
4265
4321
|
|
|
4266
4322
|
// src/test/start.ts
|
|
4267
|
-
import { swc as
|
|
4323
|
+
import { swc as swc3 } from "rollup-plugin-swc3";
|
|
4268
4324
|
import { configDefaults } from "vitest/config";
|
|
4269
4325
|
import { startVitest } from "vitest/node";
|
|
4270
|
-
import
|
|
4271
|
-
import
|
|
4272
|
-
import
|
|
4326
|
+
import commonjs3 from "@rollup/plugin-commonjs";
|
|
4327
|
+
import nodeResolve3 from "@rollup/plugin-node-resolve";
|
|
4328
|
+
import json3 from "@rollup/plugin-json";
|
|
4273
4329
|
var startTest = async (props) => {
|
|
4274
4330
|
const result = await startVitest(
|
|
4275
4331
|
"test",
|
|
@@ -4291,10 +4347,10 @@ var startTest = async (props) => {
|
|
|
4291
4347
|
{
|
|
4292
4348
|
plugins: [
|
|
4293
4349
|
// @ts-ignore
|
|
4294
|
-
|
|
4350
|
+
commonjs3({ sourceMap: true }),
|
|
4295
4351
|
// @ts-ignore
|
|
4296
|
-
|
|
4297
|
-
|
|
4352
|
+
nodeResolve3({ preferBuiltins: true }),
|
|
4353
|
+
swc3({
|
|
4298
4354
|
jsc: {
|
|
4299
4355
|
// baseUrl: dirname(input),
|
|
4300
4356
|
minify: { sourceMap: true }
|
|
@@ -4302,7 +4358,7 @@ var startTest = async (props) => {
|
|
|
4302
4358
|
sourceMaps: true
|
|
4303
4359
|
}),
|
|
4304
4360
|
// @ts-ignore
|
|
4305
|
-
|
|
4361
|
+
json3()
|
|
4306
4362
|
]
|
|
4307
4363
|
}
|
|
4308
4364
|
);
|
|
@@ -4574,7 +4630,7 @@ import { log as log8 } from "@clack/prompts";
|
|
|
4574
4630
|
|
|
4575
4631
|
// src/type-gen/generate.ts
|
|
4576
4632
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "fs/promises";
|
|
4577
|
-
import { dirname as
|
|
4633
|
+
import { dirname as dirname8, join as join10, relative as relative4 } from "path";
|
|
4578
4634
|
var generateTypes = async (props) => {
|
|
4579
4635
|
const files = [];
|
|
4580
4636
|
await Promise.all(
|
|
@@ -4588,7 +4644,7 @@ var generateTypes = async (props) => {
|
|
|
4588
4644
|
if (include) {
|
|
4589
4645
|
files.push(relative4(directories.root, path));
|
|
4590
4646
|
}
|
|
4591
|
-
await mkdir3(
|
|
4647
|
+
await mkdir3(dirname8(path), { recursive: true });
|
|
4592
4648
|
await writeFile3(path, code);
|
|
4593
4649
|
}
|
|
4594
4650
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.177",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
+
"@awsless/lambda": "^0.0.18",
|
|
31
32
|
"@awsless/redis": "^0.0.12",
|
|
32
33
|
"@awsless/s3": "^0.0.10",
|
|
33
|
-
"@awsless/
|
|
34
|
-
"@awsless/validate": "^0.0.13",
|
|
34
|
+
"@awsless/sqs": "^0.0.7",
|
|
35
35
|
"@awsless/ssm": "^0.0.7",
|
|
36
|
+
"@awsless/validate": "^0.0.13",
|
|
36
37
|
"@awsless/sns": "^0.0.7",
|
|
37
|
-
"@awsless/sqs": "^0.0.7",
|
|
38
38
|
"@awsless/weak-cache": "^0.0.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
"wrap-ansi": "^8.1.0",
|
|
97
97
|
"zod": "^3.21.4",
|
|
98
98
|
"zod-to-json-schema": "^3.22.3",
|
|
99
|
+
"@awsless/duration": "^0.0.1",
|
|
100
|
+
"@awsless/formation": "^0.0.6",
|
|
99
101
|
"@awsless/graphql": "^0.0.9",
|
|
100
102
|
"@awsless/size": "^0.0.1",
|
|
101
|
-
"@awsless/duration": "^0.0.1",
|
|
102
|
-
"@awsless/formation": "^0.0.5",
|
|
103
103
|
"@awsless/validate": "^0.0.13",
|
|
104
104
|
"@awsless/code": "^0.0.10"
|
|
105
105
|
},
|