@rexeus/typeweaver-aws-cdk 0.5.0 → 0.6.0
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/README.md +1 -1
- package/dist/LICENSE +1 -1
- package/dist/NOTICE +1 -1
- package/dist/index.cjs +75 -70
- package/dist/index.d.cts +6 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +54 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -68
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
package/README.md
CHANGED
package/dist/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2026 Dennis Wentzien
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/dist/NOTICE
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,77 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
9
26
|
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
let node_path = require("node:path");
|
|
29
|
+
node_path = __toESM(node_path);
|
|
30
|
+
let node_url = require("node:url");
|
|
31
|
+
let _rexeus_typeweaver_gen = require("@rexeus/typeweaver-gen");
|
|
32
|
+
let case$1 = require("case");
|
|
33
|
+
case$1 = __toESM(case$1);
|
|
12
34
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
16
|
-
var moduleDir = path__default.default.dirname(node_url.fileURLToPath(importMetaUrl));
|
|
35
|
+
//#region src/HttpApiRouterGenerator.ts
|
|
36
|
+
const moduleDir$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
17
37
|
var HttpApiRouterGenerator = class {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
entityName,
|
|
48
|
-
pascalCaseEntityName,
|
|
49
|
-
routes,
|
|
50
|
-
coreDir: context.coreDir
|
|
51
|
-
});
|
|
52
|
-
const relativePath = path__default.default.relative(context.outputDir, outputFile);
|
|
53
|
-
context.writeFile(relativePath, content);
|
|
54
|
-
}
|
|
55
|
-
static createRoutePath(path3) {
|
|
56
|
-
const parts = path3.split("/").map((part) => {
|
|
57
|
-
if (part.startsWith(":")) {
|
|
58
|
-
return `{${part.slice(1)}}`;
|
|
59
|
-
}
|
|
60
|
-
return part;
|
|
61
|
-
});
|
|
62
|
-
return parts.join("/");
|
|
63
|
-
}
|
|
38
|
+
static generate(context) {
|
|
39
|
+
const templateFile = node_path.default.join(moduleDir$1, "templates", "HttpApiRouter.ejs");
|
|
40
|
+
for (const [entityName, entityResource] of Object.entries(context.resources.entityResources)) this.writeHttpApiRoutes(entityName, templateFile, entityResource.operations, context);
|
|
41
|
+
}
|
|
42
|
+
static writeHttpApiRoutes(entityName, templateFile, operationResources, context) {
|
|
43
|
+
const routes = {};
|
|
44
|
+
const pascalCaseEntityName = case$1.default.pascal(entityName);
|
|
45
|
+
const outputDir = operationResources[0].outputDir;
|
|
46
|
+
const outputFile = node_path.default.join(outputDir, `${pascalCaseEntityName}HttpApiRoutes.ts`);
|
|
47
|
+
for (const operation of operationResources) {
|
|
48
|
+
const path = this.createRoutePath(operation.definition.path);
|
|
49
|
+
if (!routes[path]) routes[path] = [];
|
|
50
|
+
routes[path].push(operation.definition.method);
|
|
51
|
+
}
|
|
52
|
+
const content = context.renderTemplate(templateFile, {
|
|
53
|
+
entityName,
|
|
54
|
+
pascalCaseEntityName,
|
|
55
|
+
routes,
|
|
56
|
+
coreDir: context.coreDir
|
|
57
|
+
});
|
|
58
|
+
const relativePath = node_path.default.relative(context.outputDir, outputFile);
|
|
59
|
+
context.writeFile(relativePath, content);
|
|
60
|
+
}
|
|
61
|
+
static createRoutePath(path) {
|
|
62
|
+
return path.split("/").map((part) => {
|
|
63
|
+
if (part.startsWith(":")) return `{${part.slice(1)}}`;
|
|
64
|
+
return part;
|
|
65
|
+
}).join("/");
|
|
66
|
+
}
|
|
64
67
|
};
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/index.ts
|
|
71
|
+
const moduleDir = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
72
|
+
var AwsCdkPlugin = class extends _rexeus_typeweaver_gen.BasePlugin {
|
|
73
|
+
name = "aws-cdk";
|
|
74
|
+
generate(context) {
|
|
75
|
+
const libDir = node_path.default.join(moduleDir, "lib");
|
|
76
|
+
this.copyLibFiles(context, libDir, "aws-cdk");
|
|
77
|
+
HttpApiRouterGenerator.generate(context);
|
|
78
|
+
}
|
|
75
79
|
};
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
module.exports = AwsCdkPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BasePlugin, GeneratorContext } from
|
|
1
|
+
import { BasePlugin, GeneratorContext } from "@rexeus/typeweaver-gen";
|
|
2
2
|
|
|
3
|
+
//#region src/index.d.ts
|
|
3
4
|
declare class AwsCdkPlugin extends BasePlugin {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
name: string;
|
|
6
|
+
generate(context: GeneratorContext): Promise<void> | void;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export = AwsCdkPlugin;
|
|
9
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQqB,YAAA,SAAqB,UAAA;EACjC,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA;AAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BasePlugin, GeneratorContext } from "@rexeus/typeweaver-gen";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare class AwsCdkPlugin extends BasePlugin {
|
|
5
|
+
name: string;
|
|
6
|
+
generate(context: GeneratorContext): Promise<void> | void;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { AwsCdkPlugin as default };
|
|
10
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQqB,YAAA,SAAqB,UAAA;EACjC,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { BasePlugin } from "@rexeus/typeweaver-gen";
|
|
4
|
+
import Case from "case";
|
|
5
|
+
|
|
6
|
+
//#region src/HttpApiRouterGenerator.ts
|
|
7
|
+
const moduleDir$1 = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
var HttpApiRouterGenerator = class {
|
|
9
|
+
static generate(context) {
|
|
10
|
+
const templateFile = path.join(moduleDir$1, "templates", "HttpApiRouter.ejs");
|
|
11
|
+
for (const [entityName, entityResource] of Object.entries(context.resources.entityResources)) this.writeHttpApiRoutes(entityName, templateFile, entityResource.operations, context);
|
|
12
|
+
}
|
|
13
|
+
static writeHttpApiRoutes(entityName, templateFile, operationResources, context) {
|
|
14
|
+
const routes = {};
|
|
15
|
+
const pascalCaseEntityName = Case.pascal(entityName);
|
|
16
|
+
const outputDir = operationResources[0].outputDir;
|
|
17
|
+
const outputFile = path.join(outputDir, `${pascalCaseEntityName}HttpApiRoutes.ts`);
|
|
18
|
+
for (const operation of operationResources) {
|
|
19
|
+
const path = this.createRoutePath(operation.definition.path);
|
|
20
|
+
if (!routes[path]) routes[path] = [];
|
|
21
|
+
routes[path].push(operation.definition.method);
|
|
22
|
+
}
|
|
23
|
+
const content = context.renderTemplate(templateFile, {
|
|
24
|
+
entityName,
|
|
25
|
+
pascalCaseEntityName,
|
|
26
|
+
routes,
|
|
27
|
+
coreDir: context.coreDir
|
|
28
|
+
});
|
|
29
|
+
const relativePath = path.relative(context.outputDir, outputFile);
|
|
30
|
+
context.writeFile(relativePath, content);
|
|
31
|
+
}
|
|
32
|
+
static createRoutePath(path) {
|
|
33
|
+
return path.split("/").map((part) => {
|
|
34
|
+
if (part.startsWith(":")) return `{${part.slice(1)}}`;
|
|
35
|
+
return part;
|
|
36
|
+
}).join("/");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/index.ts
|
|
42
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
43
|
+
var AwsCdkPlugin = class extends BasePlugin {
|
|
44
|
+
name = "aws-cdk";
|
|
45
|
+
generate(context) {
|
|
46
|
+
const libDir = path.join(moduleDir, "lib");
|
|
47
|
+
this.copyLibFiles(context, libDir, "aws-cdk");
|
|
48
|
+
HttpApiRouterGenerator.generate(context);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { AwsCdkPlugin as default };
|
|
54
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["moduleDir"],"sources":["../src/HttpApiRouterGenerator.ts","../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { HttpMethod } from \"@rexeus/typeweaver-core\";\nimport type {\n GeneratorContext,\n OperationResource,\n} from \"@rexeus/typeweaver-gen\";\nimport Case from \"case\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport class HttpApiRouterGenerator {\n public static generate(context: GeneratorContext): void {\n const templateFile = path.join(moduleDir, \"templates\", \"HttpApiRouter.ejs\");\n\n for (const [entityName, entityResource] of Object.entries(\n context.resources.entityResources\n )) {\n this.writeHttpApiRoutes(\n entityName,\n templateFile,\n entityResource.operations,\n context\n );\n }\n }\n\n private static writeHttpApiRoutes(\n entityName: string,\n templateFile: string,\n operationResources: OperationResource[],\n context: GeneratorContext\n ): void {\n const routes: Record<string, HttpMethod[]> = {};\n const pascalCaseEntityName = Case.pascal(entityName);\n const outputDir = operationResources[0]!.outputDir;\n const outputFile = path.join(\n outputDir,\n `${pascalCaseEntityName}HttpApiRoutes.ts`\n );\n\n for (const operation of operationResources) {\n const path = this.createRoutePath(operation.definition.path);\n\n if (!routes[path]) {\n routes[path] = [];\n }\n\n routes[path]!.push(operation.definition.method);\n }\n\n const content = context.renderTemplate(templateFile, {\n entityName,\n pascalCaseEntityName,\n routes,\n coreDir: context.coreDir,\n });\n\n const relativePath = path.relative(context.outputDir, outputFile);\n context.writeFile(relativePath, content);\n }\n\n private static createRoutePath(path: string): string {\n const parts = path.split(\"/\").map(part => {\n if (part.startsWith(\":\")) {\n return `{${part.slice(1)}}`;\n }\n return part;\n });\n\n return parts.join(\"/\");\n }\n}\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { BasePlugin } from \"@rexeus/typeweaver-gen\";\nimport type { GeneratorContext } from \"@rexeus/typeweaver-gen\";\nimport { HttpApiRouterGenerator } from \"./HttpApiRouterGenerator\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport default class AwsCdkPlugin extends BasePlugin {\n public name = \"aws-cdk\";\n public override generate(context: GeneratorContext): Promise<void> | void {\n // Copy lib files to lib/aws-cdk/ from dist folder\n const libDir = path.join(moduleDir, \"lib\");\n this.copyLibFiles(context, libDir, \"aws-cdk\");\n\n HttpApiRouterGenerator.generate(context);\n }\n}\n"],"mappings":";;;;;;AASA,MAAMA,cAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,IAAa,yBAAb,MAAoC;CAClC,OAAc,SAAS,SAAiC;EACtD,MAAM,eAAe,KAAK,KAAKA,aAAW,aAAa,oBAAoB;AAE3E,OAAK,MAAM,CAAC,YAAY,mBAAmB,OAAO,QAChD,QAAQ,UAAU,gBACnB,CACC,MAAK,mBACH,YACA,cACA,eAAe,YACf,QACD;;CAIL,OAAe,mBACb,YACA,cACA,oBACA,SACM;EACN,MAAM,SAAuC,EAAE;EAC/C,MAAM,uBAAuB,KAAK,OAAO,WAAW;EACpD,MAAM,YAAY,mBAAmB,GAAI;EACzC,MAAM,aAAa,KAAK,KACtB,WACA,GAAG,qBAAqB,kBACzB;AAED,OAAK,MAAM,aAAa,oBAAoB;GAC1C,MAAM,OAAO,KAAK,gBAAgB,UAAU,WAAW,KAAK;AAE5D,OAAI,CAAC,OAAO,MACV,QAAO,QAAQ,EAAE;AAGnB,UAAO,MAAO,KAAK,UAAU,WAAW,OAAO;;EAGjD,MAAM,UAAU,QAAQ,eAAe,cAAc;GACnD;GACA;GACA;GACA,SAAS,QAAQ;GAClB,CAAC;EAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,UAAQ,UAAU,cAAc,QAAQ;;CAG1C,OAAe,gBAAgB,MAAsB;AAQnD,SAPc,KAAK,MAAM,IAAI,CAAC,KAAI,SAAQ;AACxC,OAAI,KAAK,WAAW,IAAI,CACtB,QAAO,IAAI,KAAK,MAAM,EAAE,CAAC;AAE3B,UAAO;IACP,CAEW,KAAK,IAAI;;;;;;AChE1B,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,IAAqB,eAArB,cAA0C,WAAW;CACnD,AAAO,OAAO;CACd,AAAgB,SAAS,SAAiD;EAExE,MAAM,SAAS,KAAK,KAAK,WAAW,MAAM;AAC1C,OAAK,aAAa,SAAS,QAAQ,UAAU;AAE7C,yBAAuB,SAAS,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexeus/typeweaver-aws-cdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Generates AWS CDK helpers to provision the infrastructure your APIs need. Powered by Typeweaver 🧵✨",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.cjs",
|
|
8
|
-
"module": "dist/index.
|
|
9
|
-
"types": "dist/index.d.
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"types": "dist/index.d.mts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": {
|
|
13
|
-
"types": "./dist/index.d.
|
|
14
|
-
"default": "./dist/index.
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
|
+
"default": "./dist/index.mjs"
|
|
15
15
|
},
|
|
16
16
|
"require": {
|
|
17
17
|
"types": "./dist/index.d.cts",
|
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/rexeus/typeweaver#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@rexeus/typeweaver-core": "^0.
|
|
51
|
-
"@rexeus/typeweaver-gen": "^0.
|
|
50
|
+
"@rexeus/typeweaver-core": "^0.6.0",
|
|
51
|
+
"@rexeus/typeweaver-gen": "^0.6.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@rexeus/typeweaver-core": "^0.
|
|
55
|
-
"@rexeus/typeweaver-gen": "^0.
|
|
54
|
+
"@rexeus/typeweaver-core": "^0.6.0",
|
|
55
|
+
"@rexeus/typeweaver-gen": "^0.6.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"case": "^1.6.3"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"typecheck": "tsc --noEmit",
|
|
62
|
-
"format": "
|
|
63
|
-
"build": "
|
|
62
|
+
"format": "oxfmt",
|
|
63
|
+
"build": "tsdown && mkdir -p ./dist/templates ./dist/lib && cp -r ./src/templates/* ./dist/templates/ && cp -r ./src/lib/* ./dist/lib/ && cp ../../LICENSE ../../NOTICE ./dist/",
|
|
64
64
|
"preversion": "npm run build"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { BasePlugin } from '@rexeus/typeweaver-gen';
|
|
4
|
-
import Case from 'case';
|
|
5
|
-
|
|
6
|
-
// src/index.ts
|
|
7
|
-
var moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
var HttpApiRouterGenerator = class {
|
|
9
|
-
static generate(context) {
|
|
10
|
-
const templateFile = path.join(moduleDir, "templates", "HttpApiRouter.ejs");
|
|
11
|
-
for (const [entityName, entityResource] of Object.entries(
|
|
12
|
-
context.resources.entityResources
|
|
13
|
-
)) {
|
|
14
|
-
this.writeHttpApiRoutes(
|
|
15
|
-
entityName,
|
|
16
|
-
templateFile,
|
|
17
|
-
entityResource.operations,
|
|
18
|
-
context
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
static writeHttpApiRoutes(entityName, templateFile, operationResources, context) {
|
|
23
|
-
const routes = {};
|
|
24
|
-
const pascalCaseEntityName = Case.pascal(entityName);
|
|
25
|
-
const outputDir = operationResources[0].outputDir;
|
|
26
|
-
const outputFile = path.join(
|
|
27
|
-
outputDir,
|
|
28
|
-
`${pascalCaseEntityName}HttpApiRoutes.ts`
|
|
29
|
-
);
|
|
30
|
-
for (const operation of operationResources) {
|
|
31
|
-
const path3 = this.createRoutePath(operation.definition.path);
|
|
32
|
-
if (!routes[path3]) {
|
|
33
|
-
routes[path3] = [];
|
|
34
|
-
}
|
|
35
|
-
routes[path3].push(operation.definition.method);
|
|
36
|
-
}
|
|
37
|
-
const content = context.renderTemplate(templateFile, {
|
|
38
|
-
entityName,
|
|
39
|
-
pascalCaseEntityName,
|
|
40
|
-
routes,
|
|
41
|
-
coreDir: context.coreDir
|
|
42
|
-
});
|
|
43
|
-
const relativePath = path.relative(context.outputDir, outputFile);
|
|
44
|
-
context.writeFile(relativePath, content);
|
|
45
|
-
}
|
|
46
|
-
static createRoutePath(path3) {
|
|
47
|
-
const parts = path3.split("/").map((part) => {
|
|
48
|
-
if (part.startsWith(":")) {
|
|
49
|
-
return `{${part.slice(1)}}`;
|
|
50
|
-
}
|
|
51
|
-
return part;
|
|
52
|
-
});
|
|
53
|
-
return parts.join("/");
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/index.ts
|
|
58
|
-
var moduleDir2 = path.dirname(fileURLToPath(import.meta.url));
|
|
59
|
-
var AwsCdkPlugin = class extends BasePlugin {
|
|
60
|
-
name = "aws-cdk";
|
|
61
|
-
generate(context) {
|
|
62
|
-
const libDir = path.join(moduleDir2, "lib");
|
|
63
|
-
this.copyLibFiles(context, libDir, "aws-cdk");
|
|
64
|
-
HttpApiRouterGenerator.generate(context);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { AwsCdkPlugin as default };
|
package/dist/metafile-cjs.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/HttpApiRouterGenerator.ts":{"bytes":1966,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true},{"path":"/home/runner/work/typeweaver/typeweaver/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":689,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"src/HttpApiRouterGenerator.ts","kind":"import-statement","original":"./HttpApiRouterGenerator"},{"path":"/home/runner/work/typeweaver/typeweaver/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.cjs":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/index.ts","inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytesInOutput":314},"src/index.ts":{"bytesInOutput":449},"src/HttpApiRouterGenerator.ts":{"bytesInOutput":1635}},"bytes":2634}}}
|
package/dist/metafile-esm.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js":{"bytes":322,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true}],"format":"esm"},"src/HttpApiRouterGenerator.ts":{"bytes":1966,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true},{"path":"/home/runner/work/typeweaver/typeweaver/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":689,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"src/HttpApiRouterGenerator.ts","kind":"import-statement","original":"./HttpApiRouterGenerator"},{"path":"/home/runner/work/typeweaver/typeweaver/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"@rexeus/typeweaver-gen","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"case","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":451},"src/HttpApiRouterGenerator.ts":{"bytesInOutput":1637}},"bytes":2193}}}
|