@rexeus/typeweaver-aws-cdk 0.10.0 → 0.10.1
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 +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,7 @@ function createRoutePath(routePath) {
|
|
|
61
61
|
const moduleDir = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
62
62
|
var AwsCdkPlugin = class extends _rexeus_typeweaver_gen.BasePlugin {
|
|
63
63
|
name = "aws-cdk";
|
|
64
|
+
depends = ["types"];
|
|
64
65
|
generate(context) {
|
|
65
66
|
const libDir = node_path.default.join(moduleDir, "lib");
|
|
66
67
|
this.copyLibFiles(context, libDir, "aws-cdk");
|
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":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,OAAA;EAEA,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":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,YAAA,SAAqB,UAAA;EACzB,IAAA;EACS,OAAA;EAEA,QAAA,CAAS,OAAA,EAAS,gBAAA,GAAmB,OAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ function createRoutePath(routePath) {
|
|
|
37
37
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
38
38
|
var AwsCdkPlugin = class extends BasePlugin {
|
|
39
39
|
name = "aws-cdk";
|
|
40
|
+
depends = ["types"];
|
|
40
41
|
generate(context) {
|
|
41
42
|
const libDir = path.join(moduleDir, "lib");
|
|
42
43
|
this.copyLibFiles(context, libDir, "aws-cdk");
|
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 { 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"}
|
|
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 depends = [\"types\"];\n\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,UAA0B,CAAC,QAAQ;CAEnC,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.10.
|
|
3
|
+
"version": "0.10.1",
|
|
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,17 +47,17 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/rexeus/typeweaver#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@rexeus/typeweaver-core": "^0.10.
|
|
51
|
-
"@rexeus/typeweaver-gen": "^0.10.
|
|
50
|
+
"@rexeus/typeweaver-core": "^0.10.1",
|
|
51
|
+
"@rexeus/typeweaver-gen": "^0.10.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@rexeus/typeweaver-core": "^0.10.
|
|
55
|
-
"@rexeus/typeweaver-gen": "^0.10.
|
|
54
|
+
"@rexeus/typeweaver-core": "^0.10.1",
|
|
55
|
+
"@rexeus/typeweaver-gen": "^0.10.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"typecheck": "tsc --noEmit",
|
|
59
59
|
"format": "oxfmt",
|
|
60
|
-
"build": "tsdown
|
|
60
|
+
"build": "tsdown",
|
|
61
61
|
"preversion": "npm run build"
|
|
62
62
|
}
|
|
63
63
|
}
|