@rexeus/typeweaver-aws-cdk 0.9.1 → 0.10.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/dist/index.cjs +3 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -8
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -24,8 +25,6 @@ let node_path = require("node:path");
|
|
|
24
25
|
node_path = __toESM(node_path);
|
|
25
26
|
let node_url = require("node:url");
|
|
26
27
|
let _rexeus_typeweaver_gen = require("@rexeus/typeweaver-gen");
|
|
27
|
-
let case$1 = require("case");
|
|
28
|
-
case$1 = __toESM(case$1);
|
|
29
28
|
//#region src/httpApiRouterGenerator.ts
|
|
30
29
|
const moduleDir$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
31
30
|
function generate(context) {
|
|
@@ -34,7 +33,7 @@ function generate(context) {
|
|
|
34
33
|
}
|
|
35
34
|
function writeHttpApiRoutes(resource, templateFile, context) {
|
|
36
35
|
const routes = {};
|
|
37
|
-
const pascalCaseEntityName =
|
|
36
|
+
const pascalCaseEntityName = (0, _rexeus_typeweaver_gen.toPascalCase)(resource.name);
|
|
38
37
|
const outputDir = context.getResourceOutputDir(resource.name);
|
|
39
38
|
const outputFile = node_path.default.join(outputDir, `${pascalCaseEntityName}HttpApiRoutes.ts`);
|
|
40
39
|
for (const operation of resource.operations) {
|
|
@@ -69,4 +68,4 @@ var AwsCdkPlugin = class extends _rexeus_typeweaver_gen.BasePlugin {
|
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
//#endregion
|
|
72
|
-
|
|
71
|
+
exports.AwsCdkPlugin = AwsCdkPlugin;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { BasePlugin } from "@rexeus/typeweaver-gen";
|
|
4
|
-
import Case from "case";
|
|
3
|
+
import { BasePlugin, toPascalCase } from "@rexeus/typeweaver-gen";
|
|
5
4
|
//#region src/httpApiRouterGenerator.ts
|
|
6
5
|
const moduleDir$1 = path.dirname(fileURLToPath(import.meta.url));
|
|
7
6
|
function generate(context) {
|
|
@@ -10,7 +9,7 @@ function generate(context) {
|
|
|
10
9
|
}
|
|
11
10
|
function writeHttpApiRoutes(resource, templateFile, context) {
|
|
12
11
|
const routes = {};
|
|
13
|
-
const pascalCaseEntityName =
|
|
12
|
+
const pascalCaseEntityName = toPascalCase(resource.name);
|
|
14
13
|
const outputDir = context.getResourceOutputDir(resource.name);
|
|
15
14
|
const outputFile = path.join(outputDir, `${pascalCaseEntityName}HttpApiRoutes.ts`);
|
|
16
15
|
for (const operation of resource.operations) {
|
|
@@ -45,6 +44,6 @@ var AwsCdkPlugin = class extends BasePlugin {
|
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
//#endregion
|
|
48
|
-
export { AwsCdkPlugin
|
|
47
|
+
export { AwsCdkPlugin };
|
|
49
48
|
|
|
50
49
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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 NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\nimport
|
|
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 NormalizedResource,\n} from \"@rexeus/typeweaver-gen\";\nimport { toPascalCase } from \"@rexeus/typeweaver-gen\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport function generate(context: GeneratorContext): void {\n const templateFile = path.join(moduleDir, \"templates\", \"HttpApiRouter.ejs\");\n\n for (const resource of context.normalizedSpec.resources) {\n writeHttpApiRoutes(resource, templateFile, context);\n }\n}\n\nfunction writeHttpApiRoutes(\n resource: NormalizedResource,\n templateFile: string,\n context: GeneratorContext\n): void {\n const routes: Record<string, HttpMethod[]> = {};\n const pascalCaseEntityName = toPascalCase(resource.name);\n const outputDir = context.getResourceOutputDir(resource.name);\n const outputFile = path.join(\n outputDir,\n `${pascalCaseEntityName}HttpApiRoutes.ts`\n );\n\n for (const operation of resource.operations) {\n const routePath = createRoutePath(operation.path);\n\n if (!routes[routePath]) {\n routes[routePath] = [];\n }\n\n routes[routePath]!.push(operation.method);\n }\n\n const content = context.renderTemplate(templateFile, {\n entityName: resource.name,\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\nfunction createRoutePath(routePath: string): string {\n const parts = routePath.split(\"/\").map(part => {\n if (part.startsWith(\":\")) {\n return `{${part.slice(1)}}`;\n }\n return part;\n });\n\n return parts.join(\"/\");\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 { generate as generateHttpApiRoutes } from \"./httpApiRouterGenerator\";\n\nconst moduleDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport 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 generateHttpApiRoutes(context);\n }\n}\n"],"mappings":";;;;AASA,MAAMA,cAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,SAAgB,SAAS,SAAiC;CACxD,MAAM,eAAe,KAAK,KAAKA,aAAW,aAAa,oBAAoB;AAE3E,MAAK,MAAM,YAAY,QAAQ,eAAe,UAC5C,oBAAmB,UAAU,cAAc,QAAQ;;AAIvD,SAAS,mBACP,UACA,cACA,SACM;CACN,MAAM,SAAuC,EAAE;CAC/C,MAAM,uBAAuB,aAAa,SAAS,KAAK;CACxD,MAAM,YAAY,QAAQ,qBAAqB,SAAS,KAAK;CAC7D,MAAM,aAAa,KAAK,KACtB,WACA,GAAG,qBAAqB,kBACzB;AAED,MAAK,MAAM,aAAa,SAAS,YAAY;EAC3C,MAAM,YAAY,gBAAgB,UAAU,KAAK;AAEjD,MAAI,CAAC,OAAO,WACV,QAAO,aAAa,EAAE;AAGxB,SAAO,WAAY,KAAK,UAAU,OAAO;;CAG3C,MAAM,UAAU,QAAQ,eAAe,cAAc;EACnD,YAAY,SAAS;EACrB;EACA;EACA,SAAS,QAAQ;EAClB,CAAC;CAEF,MAAM,eAAe,KAAK,SAAS,QAAQ,WAAW,WAAW;AACjE,SAAQ,UAAU,cAAc,QAAQ;;AAG1C,SAAS,gBAAgB,WAA2B;AAQlD,QAPc,UAAU,MAAM,IAAI,CAAC,KAAI,SAAQ;AAC7C,MAAI,KAAK,WAAW,IAAI,CACtB,QAAO,IAAI,KAAK,MAAM,EAAE,CAAC;AAE3B,SAAO;GACP,CAEW,KAAK,IAAI;;;;ACvDxB,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAE9D,IAAa,eAAb,cAAkC,WAAW;CAC3C,OAAc;CACd,SAAyB,SAAiD;EAExE,MAAM,SAAS,KAAK,KAAK,WAAW,MAAM;AAC1C,OAAK,aAAa,SAAS,QAAQ,UAAU;AAE7C,WAAsB,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexeus/typeweaver-aws-cdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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,
|
|
@@ -47,15 +47,12 @@
|
|
|
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.10.0",
|
|
51
|
+
"@rexeus/typeweaver-gen": "^0.10.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@rexeus/typeweaver-core": "^0.
|
|
55
|
-
"@rexeus/typeweaver-gen": "^0.
|
|
56
|
-
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"case": "^1.6.3"
|
|
54
|
+
"@rexeus/typeweaver-core": "^0.10.0",
|
|
55
|
+
"@rexeus/typeweaver-gen": "^0.10.0"
|
|
59
56
|
},
|
|
60
57
|
"scripts": {
|
|
61
58
|
"typecheck": "tsc --noEmit",
|