@mxpicture/gcp-functions-generator 1.1.92 → 1.2.2
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/4testing/templates/template.example.d.ts +4 -3
- package/dist/4testing/templates/template.example.d.ts.map +1 -1
- package/dist/4testing/templates/template.example.js.map +1 -1
- package/dist/4testing/templates/template.medication.d.ts +2 -1
- package/dist/4testing/templates/template.medication.d.ts.map +1 -1
- package/dist/4testing/templates/template.medication.js.map +1 -1
- package/dist/4testing/templates/template.settings.d.ts +2 -1
- package/dist/4testing/templates/template.settings.d.ts.map +1 -1
- package/dist/4testing/templates/template.settings.js.map +1 -1
- package/dist/4testing/utils.d.ts +1 -1
- package/dist/4testing/utils.d.ts.map +1 -1
- package/dist/4testing/utils.js +24 -2
- package/dist/4testing/utils.js.map +1 -1
- package/dist/common/file.common.d.ts +11 -2
- package/dist/common/file.common.d.ts.map +1 -1
- package/dist/common/file.common.js +44 -8
- package/dist/common/file.common.js.map +1 -1
- package/dist/common/index.d.ts +1 -6
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -6
- package/dist/common/index.js.map +1 -1
- package/dist/common/job.common.d.ts +1 -1
- package/dist/common/job.common.d.ts.map +1 -1
- package/dist/common/resolve.common.d.ts +17 -0
- package/dist/common/resolve.common.d.ts.map +1 -0
- package/dist/common/resolve.common.js +46 -0
- package/dist/common/resolve.common.js.map +1 -0
- package/dist/common/types.common.d.ts +42 -2
- package/dist/common/types.common.d.ts.map +1 -1
- package/dist/decorator/DecoExtractor.d.ts +22 -0
- package/dist/decorator/DecoExtractor.d.ts.map +1 -0
- package/dist/{common/Extractor.js → decorator/DecoExtractor.js} +2 -23
- package/dist/decorator/DecoExtractor.js.map +1 -0
- package/dist/decorator/deco.names.d.ts +4 -3
- package/dist/decorator/deco.names.d.ts.map +1 -1
- package/dist/decorator/deco.names.js +6 -6
- package/dist/decorator/deco.names.js.map +1 -1
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.d.ts.map +1 -1
- package/dist/decorator/index.js +1 -1
- package/dist/decorator/index.js.map +1 -1
- package/dist/exports.gen.json +1357 -0
- package/dist/generator/Generator.d.ts +20 -106
- package/dist/generator/Generator.d.ts.map +1 -1
- package/dist/generator/Generator.js +84 -169
- package/dist/generator/Generator.js.map +1 -1
- package/dist/generator/GeneratorAnnotations.d.ts +3 -4
- package/dist/generator/GeneratorAnnotations.d.ts.map +1 -1
- package/dist/generator/GeneratorAnnotations.js +20 -46
- package/dist/generator/GeneratorAnnotations.js.map +1 -1
- package/dist/generator/GeneratorBackend.d.ts +11 -30
- package/dist/generator/GeneratorBackend.d.ts.map +1 -1
- package/dist/generator/GeneratorBackend.js +68 -177
- package/dist/generator/GeneratorBackend.js.map +1 -1
- package/dist/generator/GeneratorDoc.d.ts +8 -9
- package/dist/generator/GeneratorDoc.d.ts.map +1 -1
- package/dist/generator/GeneratorDoc.js +34 -35
- package/dist/generator/GeneratorDoc.js.map +1 -1
- package/dist/generator/GeneratorEnum.d.ts +6 -7
- package/dist/generator/GeneratorEnum.d.ts.map +1 -1
- package/dist/generator/GeneratorEnum.js +26 -15
- package/dist/generator/GeneratorEnum.js.map +1 -1
- package/dist/generator/GeneratorFrontend.d.ts +5 -6
- package/dist/generator/GeneratorFrontend.d.ts.map +1 -1
- package/dist/generator/GeneratorFrontend.js +28 -48
- package/dist/generator/GeneratorFrontend.js.map +1 -1
- package/dist/generator/GeneratorRoutes.d.ts +6 -7
- package/dist/generator/GeneratorRoutes.d.ts.map +1 -1
- package/dist/generator/GeneratorRoutes.js +26 -31
- package/dist/generator/GeneratorRoutes.js.map +1 -1
- package/dist/generator/GeneratorZod.d.ts +9 -10
- package/dist/generator/GeneratorZod.d.ts.map +1 -1
- package/dist/generator/GeneratorZod.js +29 -25
- package/dist/generator/GeneratorZod.js.map +1 -1
- package/dist/run/GeneratorBarrel.d.ts +11 -0
- package/dist/run/GeneratorBarrel.d.ts.map +1 -0
- package/dist/run/GeneratorBarrel.js +22 -0
- package/dist/run/GeneratorBarrel.js.map +1 -0
- package/dist/run/GeneratorBase.d.ts +6 -0
- package/dist/run/GeneratorBase.d.ts.map +1 -0
- package/dist/run/GeneratorBase.js +4 -0
- package/dist/run/GeneratorBase.js.map +1 -0
- package/dist/run/GeneratorBaseFile.d.ts +16 -0
- package/dist/run/GeneratorBaseFile.d.ts.map +1 -0
- package/dist/run/GeneratorBaseFile.js +36 -0
- package/dist/run/GeneratorBaseFile.js.map +1 -0
- package/dist/run/GeneratorDirectory.d.ts +18 -0
- package/dist/run/GeneratorDirectory.d.ts.map +1 -0
- package/dist/run/GeneratorDirectory.js +42 -0
- package/dist/run/GeneratorDirectory.js.map +1 -0
- package/dist/run/GeneratorFile.d.ts +12 -0
- package/dist/run/GeneratorFile.d.ts.map +1 -0
- package/dist/run/GeneratorFile.js +31 -0
- package/dist/run/GeneratorFile.js.map +1 -0
- package/dist/run/GeneratorFs.d.ts +27 -0
- package/dist/run/GeneratorFs.d.ts.map +1 -0
- package/dist/run/GeneratorFs.js +81 -0
- package/dist/run/GeneratorFs.js.map +1 -0
- package/dist/run/GeneratorPackage.d.ts +21 -0
- package/dist/run/GeneratorPackage.d.ts.map +1 -0
- package/dist/run/GeneratorPackage.js +57 -0
- package/dist/run/GeneratorPackage.js.map +1 -0
- package/dist/run/GeneratorRun.d.ts +27 -0
- package/dist/run/GeneratorRun.d.ts.map +1 -0
- package/dist/run/GeneratorRun.js +60 -0
- package/dist/run/GeneratorRun.js.map +1 -0
- package/dist/run/GeneratorTemplate.d.ts +10 -0
- package/dist/run/GeneratorTemplate.d.ts.map +1 -0
- package/dist/run/GeneratorTemplate.js +27 -0
- package/dist/run/GeneratorTemplate.js.map +1 -0
- package/dist/run/index.d.ts +10 -0
- package/dist/run/index.d.ts.map +1 -0
- package/dist/run/index.js +11 -0
- package/dist/run/index.js.map +1 -0
- package/package.json +7 -6
- package/dist/common/Barrel.d.ts +0 -75
- package/dist/common/Barrel.d.ts.map +0 -1
- package/dist/common/Barrel.js +0 -119
- package/dist/common/Barrel.js.map +0 -1
- package/dist/common/CodeCollector.d.ts +0 -11
- package/dist/common/CodeCollector.d.ts.map +0 -1
- package/dist/common/CodeCollector.js +0 -29
- package/dist/common/CodeCollector.js.map +0 -1
- package/dist/common/Collector.d.ts +0 -70
- package/dist/common/Collector.d.ts.map +0 -1
- package/dist/common/Collector.js +0 -77
- package/dist/common/Collector.js.map +0 -1
- package/dist/common/Directories.d.ts +0 -60
- package/dist/common/Directories.d.ts.map +0 -1
- package/dist/common/Directories.js +0 -76
- package/dist/common/Directories.js.map +0 -1
- package/dist/common/Extractor.d.ts +0 -36
- package/dist/common/Extractor.d.ts.map +0 -1
- package/dist/common/Extractor.js.map +0 -1
- package/dist/common/generator.common.d.ts +0 -80
- package/dist/common/generator.common.d.ts.map +0 -1
- package/dist/common/generator.common.js +0 -138
- package/dist/common/generator.common.js.map +0 -1
- package/dist/decorator/deco.imports.d.ts +0 -31
- package/dist/decorator/deco.imports.d.ts.map +0 -1
- package/dist/decorator/deco.imports.js +0 -71
- package/dist/decorator/deco.imports.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
2
|
+
import { GeneratorBaseFile } from "./GeneratorBaseFile.js";
|
|
3
|
+
import type { GeneratorExportNode } from "@mxpicture/gcp-functions-common/types";
|
|
4
|
+
export declare class GeneratorBarrel extends GeneratorBaseFile {
|
|
5
|
+
constructor(parent: GeneratorDirectory);
|
|
6
|
+
get code(): string[];
|
|
7
|
+
get importsCode(): string[];
|
|
8
|
+
get exports(): GeneratorExportNode[];
|
|
9
|
+
load(): Promise<this>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=GeneratorBarrel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBarrel.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorBarrel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,iBAAiB;gBACjC,MAAM,EAAE,kBAAkB;IAI7C,IAAoB,IAAI,IAAI,MAAM,EAAE,CAOnC;IAED,IAAoB,WAAW,IAAI,MAAM,EAAE,CAE1C;IAED,IAAoB,OAAO,IAAI,mBAAmB,EAAE,CAEnD;IAEqB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GeneratorBaseFile } from "./GeneratorBaseFile.js";
|
|
2
|
+
export class GeneratorBarrel extends GeneratorBaseFile {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super("index.ts", parent);
|
|
5
|
+
}
|
|
6
|
+
get code() {
|
|
7
|
+
return [
|
|
8
|
+
"// This file is auto-generated by build-cli. Do not edit manually.",
|
|
9
|
+
...this.parent.files.map((file) => `export * from "./${file.filename.replace(/\.ts$/, ".js")}";`),
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
get importsCode() {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
get exports() {
|
|
16
|
+
return this.parent.files.flatMap((file) => file.exports);
|
|
17
|
+
}
|
|
18
|
+
async load() {
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=GeneratorBarrel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBarrel.js","sourceRoot":"","sources":["../../src/run/GeneratorBarrel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IACpD,YAAmB,MAA0B;QAC3C,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,IAAoB,IAAI;QACtB,OAAO;YACL,oEAAoE;YACpE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CACtB,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CACxE;SACF,CAAC;IACJ,CAAC;IAED,IAAoB,WAAW;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAoB,OAAO;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBase.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorBase.ts"],"names":[],"mappings":"AAAA,8BAAsB,aAAa;;aAGjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;aACrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBase.js","sourceRoot":"","sources":["../../src/run/GeneratorBase.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,aAAa;IACjC,gBAAsB,CAAC;CAIxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
2
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
3
|
+
import type { GeneratorExportNode } from "@mxpicture/gcp-functions-common/types";
|
|
4
|
+
export declare abstract class GeneratorBaseFile extends GeneratorBase {
|
|
5
|
+
readonly filename: string;
|
|
6
|
+
parent: GeneratorDirectory;
|
|
7
|
+
readonly ext: string;
|
|
8
|
+
constructor(filename: string, parent: GeneratorDirectory);
|
|
9
|
+
get realPath(): string;
|
|
10
|
+
get virtualPath(): string;
|
|
11
|
+
abstract get code(): string[];
|
|
12
|
+
abstract get importsCode(): string[];
|
|
13
|
+
abstract get exports(): GeneratorExportNode[];
|
|
14
|
+
persist(): Promise<this>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=GeneratorBaseFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBaseFile.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorBaseFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAQjF,8BAAsB,iBAAkB,SAAQ,aAAa;aAIzC,QAAQ,EAAE,MAAM;IACzB,MAAM,EAAE,kBAAkB;IAJnC,SAAgB,GAAG,EAAE,MAAM,CAAC;gBAGV,QAAQ,EAAE,MAAM,EACzB,MAAM,EAAE,kBAAkB;IAMnC,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED,aAAoB,IAAI,IAAI,MAAM,EAAE,CAAC;IACrC,aAAoB,WAAW,IAAI,MAAM,EAAE,CAAC;IAC5C,aAAoB,OAAO,IAAI,mBAAmB,EAAE,CAAC;IAE/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAe/C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { extname } from "node:path";
|
|
2
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
3
|
+
import { writeFile } from "node:fs/promises";
|
|
4
|
+
import { DecoFileExtension } from "@mxpicture/gcp-functions-common/decorator";
|
|
5
|
+
import { fixCodeTypes, formatCode, formatJson, } from "@mxpicture/build-api/code";
|
|
6
|
+
export class GeneratorBaseFile extends GeneratorBase {
|
|
7
|
+
filename;
|
|
8
|
+
parent;
|
|
9
|
+
ext;
|
|
10
|
+
constructor(filename, parent) {
|
|
11
|
+
super();
|
|
12
|
+
this.filename = filename;
|
|
13
|
+
this.parent = parent;
|
|
14
|
+
this.ext = extname(filename);
|
|
15
|
+
}
|
|
16
|
+
get realPath() {
|
|
17
|
+
return `${this.parent.realPath}/${this.filename}`;
|
|
18
|
+
}
|
|
19
|
+
get virtualPath() {
|
|
20
|
+
return `${this.parent.virtualPath}/${this.filename}`;
|
|
21
|
+
}
|
|
22
|
+
async persist() {
|
|
23
|
+
let code = [...this.importsCode, "", ...this.code].join("\n");
|
|
24
|
+
code =
|
|
25
|
+
this.ext === DecoFileExtension.ts
|
|
26
|
+
? await formatCode(await fixCodeTypes(code))
|
|
27
|
+
: this.ext === DecoFileExtension.json
|
|
28
|
+
? await formatJson(code)
|
|
29
|
+
: code;
|
|
30
|
+
await writeFile(this.realPath, code, {
|
|
31
|
+
encoding: "utf-8",
|
|
32
|
+
});
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=GeneratorBaseFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorBaseFile.js","sourceRoot":"","sources":["../../src/run/GeneratorBaseFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,MAAM,OAAgB,iBAAkB,SAAQ,aAAa;IAIzC;IACT;IAJO,GAAG,CAAS;IAE5B,YACkB,QAAgB,EACzB,MAA0B;QAEjC,KAAK,EAAE,CAAC;QAHQ,aAAQ,GAAR,QAAQ,CAAQ;QACzB,WAAM,GAAN,MAAM,CAAoB;QAGjC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpD,CAAC;IAED,IAAW,WAAW;QACpB,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;IACvD,CAAC;IAMe,KAAK,CAAC,OAAO;QAC3B,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9D,IAAI;YACF,IAAI,CAAC,GAAG,KAAK,iBAAiB,CAAC,EAAE;gBAC/B,CAAC,CAAC,MAAM,UAAU,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;gBAC5C,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,iBAAiB,CAAC,IAAI;oBACnC,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC;oBACxB,CAAC,CAAC,IAAI,CAAC;QAEb,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE;YACnC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DecoFileType } from "@mxpicture/gcp-functions-common/decorator";
|
|
2
|
+
import type { GeneratorPackage } from "./GeneratorPackage.js";
|
|
3
|
+
import { GeneratorFile } from "./GeneratorFile.js";
|
|
4
|
+
import { GeneratorBarrel } from "./GeneratorBarrel.js";
|
|
5
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
6
|
+
export declare class GeneratorDirectory extends GeneratorBase {
|
|
7
|
+
readonly fileType: DecoFileType;
|
|
8
|
+
parent: GeneratorPackage;
|
|
9
|
+
readonly files: GeneratorFile[];
|
|
10
|
+
readonly barrel: GeneratorBarrel;
|
|
11
|
+
constructor(fileType: DecoFileType, parent: GeneratorPackage);
|
|
12
|
+
get realPath(): string;
|
|
13
|
+
get virtualPath(): string;
|
|
14
|
+
file(filename: string): GeneratorFile;
|
|
15
|
+
load(): Promise<this>;
|
|
16
|
+
persist(): Promise<this>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=GeneratorDirectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorDirectory.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,qBAAa,kBAAmB,SAAQ,aAAa;aAKjC,QAAQ,EAAE,YAAY;IAC/B,MAAM,EAAE,gBAAgB;IALjC,SAAgB,KAAK,EAAE,aAAa,EAAE,CAAM;IAC5C,SAAgB,MAAM,EAAE,eAAe,CAAC;gBAGtB,QAAQ,EAAE,YAAY,EAC/B,MAAM,EAAE,gBAAgB;IAMjC,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,WAAW,IAAI,MAAM,CAE/B;IAEM,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ/C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GeneratorFile } from "./GeneratorFile.js";
|
|
2
|
+
import { GeneratorBarrel } from "./GeneratorBarrel.js";
|
|
3
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
4
|
+
import { mkdir } from "node:fs/promises";
|
|
5
|
+
export class GeneratorDirectory extends GeneratorBase {
|
|
6
|
+
fileType;
|
|
7
|
+
parent;
|
|
8
|
+
files = [];
|
|
9
|
+
barrel;
|
|
10
|
+
constructor(fileType, parent) {
|
|
11
|
+
super();
|
|
12
|
+
this.fileType = fileType;
|
|
13
|
+
this.parent = parent;
|
|
14
|
+
this.barrel = new GeneratorBarrel(this);
|
|
15
|
+
}
|
|
16
|
+
get realPath() {
|
|
17
|
+
return `${this.parent.realPath}/src/${this.fileType}`;
|
|
18
|
+
}
|
|
19
|
+
get virtualPath() {
|
|
20
|
+
return `${this.parent.virtualPath}/src/${this.fileType}`;
|
|
21
|
+
}
|
|
22
|
+
file(filename) {
|
|
23
|
+
let file = this.files.find((file) => file.filename === filename);
|
|
24
|
+
if (!file) {
|
|
25
|
+
file = new GeneratorFile(filename, this);
|
|
26
|
+
this.files.push(file);
|
|
27
|
+
}
|
|
28
|
+
return file;
|
|
29
|
+
}
|
|
30
|
+
async load() {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
async persist() {
|
|
34
|
+
await mkdir(this.realPath, { recursive: true });
|
|
35
|
+
await Promise.all([
|
|
36
|
+
this.barrel.persist(),
|
|
37
|
+
...this.files.map((file) => file.persist()),
|
|
38
|
+
]);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=GeneratorDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorDirectory.js","sourceRoot":"","sources":["../../src/run/Generator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AM,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;SAC5C,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
2
|
+
import { GeneratorBaseFile } from "./GeneratorBaseFile.js";
|
|
3
|
+
import type { GeneratorFsExport } from "@mxpicture/gcp-functions-common/types";
|
|
4
|
+
export declare class GeneratorFile extends GeneratorBaseFile {
|
|
5
|
+
code: string[];
|
|
6
|
+
missingImports: string[];
|
|
7
|
+
importsCode: string[];
|
|
8
|
+
constructor(filename: string, parent: GeneratorDirectory);
|
|
9
|
+
get exports(): GeneratorFsExport[];
|
|
10
|
+
load(): Promise<this>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=GeneratorFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorFile.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,qBAAa,aAAc,SAAQ,iBAAiB;IAC3C,IAAI,EAAE,MAAM,EAAE,CAAM;IACpB,cAAc,EAAE,MAAM,EAAE,CAAM;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAM;gBAEf,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB;IAI/D,IAAoB,OAAO,IAAI,iBAAiB,EAAE,CAmBjD;IAEqB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { extractExportsString } from "@mxpicture/build-api/exp";
|
|
2
|
+
import { GeneratorBaseFile } from "./GeneratorBaseFile.js";
|
|
3
|
+
export class GeneratorFile extends GeneratorBaseFile {
|
|
4
|
+
code = [];
|
|
5
|
+
missingImports = [];
|
|
6
|
+
importsCode = [];
|
|
7
|
+
constructor(filename, parent) {
|
|
8
|
+
super(filename, parent);
|
|
9
|
+
}
|
|
10
|
+
get exports() {
|
|
11
|
+
const expNodes = extractExportsString({
|
|
12
|
+
code: this.code,
|
|
13
|
+
source: this.virtualPath,
|
|
14
|
+
});
|
|
15
|
+
return expNodes.map((expNode) => ({
|
|
16
|
+
name: expNode.name,
|
|
17
|
+
kind: expNode.kind,
|
|
18
|
+
directVirtualPath: this.virtualPath.replace(/\.ts$/, ".js"),
|
|
19
|
+
barrelVirtualPath: `${this.parent.virtualPath}/index.js`,
|
|
20
|
+
packagePath: `${this.parent.parent.name}/${this.parent.fileType}`,
|
|
21
|
+
packageName: this.parent.parent.name,
|
|
22
|
+
filename: this.filename,
|
|
23
|
+
fileType: this.parent.fileType,
|
|
24
|
+
pkgType: this.parent.parent.pkgType,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
async load() {
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=GeneratorFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorFile.js","sourceRoot":"","sources":["../../src/run/GeneratorFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAC3C,IAAI,GAAa,EAAE,CAAC;IACpB,cAAc,GAAa,EAAE,CAAC;IAC9B,WAAW,GAAa,EAAE,CAAC;IAElC,YAAmB,QAAgB,EAAE,MAA0B;QAC7D,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,IAAoB,OAAO;QACzB,MAAM,QAAQ,GAAG,oBAAoB,CAAC;YACpC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,WAAW;SACzB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,GAAG,CACjB,CAAC,OAAO,EAAqB,EAAE,CAAC,CAAC;YAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,iBAAiB,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC;YAC3D,iBAAiB,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,WAAW;YACxD,WAAW,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YACjE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;YACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;SACpC,CAAC,CACH,CAAC;IACJ,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GeneratorPackage } from "./GeneratorPackage.js";
|
|
2
|
+
import { type DecoFileType, type DecoPackageType } from "@mxpicture/gcp-functions-common/decorator";
|
|
3
|
+
import type { GeneratorFile } from "./GeneratorFile.js";
|
|
4
|
+
import type { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
5
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
6
|
+
import type { GeneratorFsExport } from "@mxpicture/gcp-functions-common/types";
|
|
7
|
+
export declare class GeneratorFs extends GeneratorBase {
|
|
8
|
+
readonly rootPath: string;
|
|
9
|
+
readonly tsConfigFilePath: string;
|
|
10
|
+
readonly pkgsDir: string;
|
|
11
|
+
protected _pkgs: GeneratorPackage[] | null;
|
|
12
|
+
constructor(rootPath: string, tsConfigFilePath: string, pkgsDir?: string);
|
|
13
|
+
get realPath(): string;
|
|
14
|
+
get virtualPath(): string;
|
|
15
|
+
get pkgs(): GeneratorPackage[];
|
|
16
|
+
pkg(pkgType: DecoPackageType): GeneratorPackage;
|
|
17
|
+
dir(pkgType: DecoPackageType, fileType: DecoFileType): GeneratorDirectory;
|
|
18
|
+
file(pkgType: DecoPackageType, fileType: DecoFileType, filename: string): GeneratorFile;
|
|
19
|
+
setCode(pkgType: DecoPackageType, fileType: DecoFileType, filename: string, code: string[]): void;
|
|
20
|
+
setImportsCode(pkgType: DecoPackageType, fileType: DecoFileType, filename: string, importsCode: string[]): void;
|
|
21
|
+
get exps(): GeneratorFsExport[];
|
|
22
|
+
get files(): GeneratorFile[];
|
|
23
|
+
determineMissingImports(): GeneratorFile[];
|
|
24
|
+
load(): Promise<this>;
|
|
25
|
+
persist(): Promise<this>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=GeneratorFs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorFs.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorFs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,o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AI,CAAC;CAK/C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { mkdir, readdir } from "node:fs/promises";
|
|
2
|
+
import { GeneratorPackage } from "./GeneratorPackage.js";
|
|
3
|
+
import { guardDecoPackageType, guardThrow, } from "@mxpicture/gcp-functions-common/decorator";
|
|
4
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
5
|
+
import { MissingImports } from "@mxpicture/build-api/imp";
|
|
6
|
+
export class GeneratorFs extends GeneratorBase {
|
|
7
|
+
rootPath;
|
|
8
|
+
tsConfigFilePath;
|
|
9
|
+
pkgsDir;
|
|
10
|
+
_pkgs = null;
|
|
11
|
+
constructor(rootPath, tsConfigFilePath, pkgsDir = "packages") {
|
|
12
|
+
super();
|
|
13
|
+
this.rootPath = rootPath;
|
|
14
|
+
this.tsConfigFilePath = tsConfigFilePath;
|
|
15
|
+
this.pkgsDir = pkgsDir;
|
|
16
|
+
}
|
|
17
|
+
get realPath() {
|
|
18
|
+
return `${this.rootPath}${this.virtualPath}`;
|
|
19
|
+
}
|
|
20
|
+
get virtualPath() {
|
|
21
|
+
return `/${this.pkgsDir}`;
|
|
22
|
+
}
|
|
23
|
+
get pkgs() {
|
|
24
|
+
if (!this._pkgs)
|
|
25
|
+
throw new Error(`Packages not yet loaded. ${this.rootPath}`);
|
|
26
|
+
return this._pkgs;
|
|
27
|
+
}
|
|
28
|
+
pkg(pkgType) {
|
|
29
|
+
let pkg = this.pkgs.find((pkg) => pkg.pkgType === pkgType);
|
|
30
|
+
if (!pkg) {
|
|
31
|
+
pkg = new GeneratorPackage(pkgType, this);
|
|
32
|
+
this.pkgs.push(pkg);
|
|
33
|
+
}
|
|
34
|
+
return pkg;
|
|
35
|
+
}
|
|
36
|
+
dir(pkgType, fileType) {
|
|
37
|
+
return this.pkg(pkgType).dir(fileType);
|
|
38
|
+
}
|
|
39
|
+
file(pkgType, fileType, filename) {
|
|
40
|
+
return this.dir(pkgType, fileType).file(filename);
|
|
41
|
+
}
|
|
42
|
+
setCode(pkgType, fileType, filename, code) {
|
|
43
|
+
this.file(pkgType, fileType, filename).code = code;
|
|
44
|
+
}
|
|
45
|
+
setImportsCode(pkgType, fileType, filename, importsCode) {
|
|
46
|
+
this.file(pkgType, fileType, filename).importsCode = importsCode;
|
|
47
|
+
}
|
|
48
|
+
get exps() {
|
|
49
|
+
return this.files.flatMap((file) => file.exports);
|
|
50
|
+
}
|
|
51
|
+
get files() {
|
|
52
|
+
return this.pkgs.flatMap((pkg) => pkg.dirs.flatMap((dir) => dir.files));
|
|
53
|
+
}
|
|
54
|
+
determineMissingImports() {
|
|
55
|
+
const files = this.files;
|
|
56
|
+
const virtualFiles = {};
|
|
57
|
+
for (const file of files)
|
|
58
|
+
virtualFiles[file.virtualPath] = file.code.join("\n");
|
|
59
|
+
const imps = new MissingImports(this.tsConfigFilePath, virtualFiles);
|
|
60
|
+
for (const [virtualPath, missingImports] of Object.entries(imps.missingNames)) {
|
|
61
|
+
const file = files.find((file) => file.virtualPath === virtualPath);
|
|
62
|
+
if (!file)
|
|
63
|
+
continue;
|
|
64
|
+
file.missingImports = missingImports;
|
|
65
|
+
}
|
|
66
|
+
return files;
|
|
67
|
+
}
|
|
68
|
+
async load() {
|
|
69
|
+
const pkgDirs = await readdir(this.realPath);
|
|
70
|
+
this._pkgs = (await Promise.allSettled(pkgDirs.map(async (pkgDir) => new GeneratorPackage(guardThrow(pkgDir, guardDecoPackageType), this).load())))
|
|
71
|
+
.filter((p) => p.status === "fulfilled")
|
|
72
|
+
.map((p) => p.value);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
async persist() {
|
|
76
|
+
await mkdir(this.realPath, { recursive: true });
|
|
77
|
+
await Promise.all(this.pkgs.map((pkg) => pkg.persist()));
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=GeneratorFs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorFs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GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PackageJson } from "@mxpicture/build-api/types";
|
|
2
|
+
import type { DecoFileType, DecoPackageType } from "@mxpicture/gcp-functions-common/decorator";
|
|
3
|
+
import type { GeneratorFs } from "./GeneratorFs.js";
|
|
4
|
+
import { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
5
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
6
|
+
export declare class GeneratorPackage extends GeneratorBase {
|
|
7
|
+
readonly pkgType: DecoPackageType;
|
|
8
|
+
readonly parent: GeneratorFs;
|
|
9
|
+
readonly dirs: GeneratorDirectory[];
|
|
10
|
+
protected _json: PackageJson | null;
|
|
11
|
+
constructor(pkgType: DecoPackageType, parent: GeneratorFs);
|
|
12
|
+
get json(): PackageJson;
|
|
13
|
+
get name(): string;
|
|
14
|
+
get realPath(): string;
|
|
15
|
+
get virtualPath(): string;
|
|
16
|
+
get pkgExports(): Record<string, string>;
|
|
17
|
+
dir(fileType: DecoFileType): GeneratorDirectory;
|
|
18
|
+
load(): Promise<this>;
|
|
19
|
+
persist(): Promise<this>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=GeneratorPackage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorPackage.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorPackage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EAChB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,qBAAa,gBAAiB,SAAQ,aAAa;aAK/B,OAAO,EAAE,eAAe;aACxB,MAAM,EAAE,WAAW;IALrC,SAAgB,IAAI,EAAE,kBAAkB,EAAE,CAAM;IAChD,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAQ;gBAGzB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,WAAW;IAKrC,IAAW,IAAI,IAAI,WAAW,CAI7B;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED,IAAW,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS9C;IAEM,GAAG,CAAC,QAAQ,EAAE,YAAY,GAAG,kBAAkB;IAShC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ/C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { readPackageJson, writePackageJson } from "@mxpicture/build-api/pkg";
|
|
2
|
+
import { GeneratorDirectory } from "./GeneratorDirectory.js";
|
|
3
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
4
|
+
import { mkdir } from "node:fs/promises";
|
|
5
|
+
export class GeneratorPackage extends GeneratorBase {
|
|
6
|
+
pkgType;
|
|
7
|
+
parent;
|
|
8
|
+
dirs = [];
|
|
9
|
+
_json = null;
|
|
10
|
+
constructor(pkgType, parent) {
|
|
11
|
+
super();
|
|
12
|
+
this.pkgType = pkgType;
|
|
13
|
+
this.parent = parent;
|
|
14
|
+
}
|
|
15
|
+
get json() {
|
|
16
|
+
if (!this._json)
|
|
17
|
+
throw new Error(`Package not yet loaded. ${this.realPath}`);
|
|
18
|
+
return this._json;
|
|
19
|
+
}
|
|
20
|
+
get name() {
|
|
21
|
+
return this.json.name;
|
|
22
|
+
}
|
|
23
|
+
get realPath() {
|
|
24
|
+
return `${this.parent.realPath}/${this.pkgType}`;
|
|
25
|
+
}
|
|
26
|
+
get virtualPath() {
|
|
27
|
+
return `${this.parent.virtualPath}/${this.pkgType}`;
|
|
28
|
+
}
|
|
29
|
+
get pkgExports() {
|
|
30
|
+
const result = {
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
};
|
|
33
|
+
for (const dir of this.dirs)
|
|
34
|
+
result[`./${dir.fileType}`] = `./dist/${dir.fileType}/index.js`;
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
dir(fileType) {
|
|
38
|
+
let dir = this.dirs.find((dir) => dir.fileType === fileType);
|
|
39
|
+
if (!dir) {
|
|
40
|
+
dir = new GeneratorDirectory(fileType, this);
|
|
41
|
+
this.dirs.push(dir);
|
|
42
|
+
}
|
|
43
|
+
return dir;
|
|
44
|
+
}
|
|
45
|
+
async load() {
|
|
46
|
+
this._json = await readPackageJson(`${this.realPath}/package.json`);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
async persist() {
|
|
50
|
+
await mkdir(this.realPath, { recursive: true });
|
|
51
|
+
await Promise.all(this.dirs.map((dir) => dir.persist()));
|
|
52
|
+
this.json.exports = this.pkgExports;
|
|
53
|
+
await writePackageJson(`${this.realPath}/package.json`, this.json);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=GeneratorPackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorPackage.js","sourceRoot":"","sources":["../../src/run/GeneratorPackage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,C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AAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,IAAI,CAAC,KAAK,GAAG,MAAM,eAAe,CAAC,GAAG,IAAI,CAAC,QAAQ,eAAe,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,OAAO;QAC3B,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;QACpC,MAAM,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GeneratorTemplate } from "./GeneratorTemplate.js";
|
|
2
|
+
import type { DecoFile } from "@mxpicture/gcp-functions-common/types";
|
|
3
|
+
import type { GeneratorFs } from "./GeneratorFs.js";
|
|
4
|
+
import type { GeneratorEnv, GeneratorRunFile } from "../common/types.common.js";
|
|
5
|
+
import type { DecoResolveFileMode, DecoResolvePkgMode } from "@mxpicture/gcp-functions-common/decorator";
|
|
6
|
+
export declare class GeneratorRun {
|
|
7
|
+
readonly rootPath: string;
|
|
8
|
+
readonly templatesPath: string;
|
|
9
|
+
readonly fs: GeneratorFs;
|
|
10
|
+
readonly env: GeneratorEnv;
|
|
11
|
+
readonly pkgMode: DecoResolvePkgMode;
|
|
12
|
+
readonly fileMode: DecoResolveFileMode;
|
|
13
|
+
readonly template: GeneratorTemplate;
|
|
14
|
+
constructor(rootPath: string, templatesPath: string, fs: GeneratorFs, env: GeneratorEnv, pkgMode: DecoResolvePkgMode, fileMode: DecoResolveFileMode);
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
runDeco(): Promise<DecoFile[]>;
|
|
17
|
+
runCode(decoFiles: DecoFile[]): Promise<void>;
|
|
18
|
+
runImpExports(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Dynamically imports a generator file and returns a cached {@link GeneratorRunFile}.
|
|
21
|
+
*
|
|
22
|
+
* @param file - The generator file to import.
|
|
23
|
+
* @returns The generator entry, or `null` if the default export is not a {@link Generator}.
|
|
24
|
+
*/
|
|
25
|
+
createGenerators(): Promise<GeneratorRunFile[]>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=GeneratorRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorRun.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAInD,qBAAa,YAAY;aAIL,QAAQ,EAAE,MAAM;aAChB,aAAa,EAAE,MAAM;aACrB,EAAE,EAAE,WAAW;aACf,GAAG,EAAE,YAAY;aACjB,OAAO,EAAE,kBAAkB;aAC3B,QAAQ,EAAE,mBAAmB;IAR/C,SAAgB,QAAQ,EAAE,iBAAiB,CAAC;gBAG1B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,mBAAmB;IAKlC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAOpB,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAQ9B,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3C;;;;;OAKG;IACU,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAY7D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { GeneratorTemplate } from "./GeneratorTemplate.js";
|
|
2
|
+
import { Generator } from "../generator/Generator.js";
|
|
3
|
+
import { DecoExtractor } from "../decorator/DecoExtractor.js";
|
|
4
|
+
import { exportsToCode } from "../common/resolve.common.js";
|
|
5
|
+
import { readGeneratorRunFiles } from "../common/file.common.js";
|
|
6
|
+
export class GeneratorRun {
|
|
7
|
+
rootPath;
|
|
8
|
+
templatesPath;
|
|
9
|
+
fs;
|
|
10
|
+
env;
|
|
11
|
+
pkgMode;
|
|
12
|
+
fileMode;
|
|
13
|
+
template;
|
|
14
|
+
constructor(rootPath, templatesPath, fs, env, pkgMode, fileMode) {
|
|
15
|
+
this.rootPath = rootPath;
|
|
16
|
+
this.templatesPath = templatesPath;
|
|
17
|
+
this.fs = fs;
|
|
18
|
+
this.env = env;
|
|
19
|
+
this.pkgMode = pkgMode;
|
|
20
|
+
this.fileMode = fileMode;
|
|
21
|
+
this.template = new GeneratorTemplate(templatesPath);
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
await this.fs.load();
|
|
25
|
+
const decoFiles = await this.runDeco();
|
|
26
|
+
await this.runCode(decoFiles);
|
|
27
|
+
await this.runImpExports();
|
|
28
|
+
}
|
|
29
|
+
async runDeco() {
|
|
30
|
+
await this.template.load();
|
|
31
|
+
const extractors = this.template.templatePaths.map((filePath) => new DecoExtractor(filePath, this.rootPath));
|
|
32
|
+
return await Promise.all(extractors.map((extr) => extr.run()));
|
|
33
|
+
}
|
|
34
|
+
async runCode(decoFiles) {
|
|
35
|
+
const entries = await this.createGenerators();
|
|
36
|
+
await Promise.all(entries.map((entry) => entry.gen.run4codes(decoFiles, this.env, this.fs)));
|
|
37
|
+
}
|
|
38
|
+
async runImpExports() {
|
|
39
|
+
const exps = this.fs.exps;
|
|
40
|
+
const files = this.fs.determineMissingImports();
|
|
41
|
+
for (const file of files)
|
|
42
|
+
file.importsCode = exportsToCode(file, this.pkgMode, this.fileMode, exps);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Dynamically imports a generator file and returns a cached {@link GeneratorRunFile}.
|
|
46
|
+
*
|
|
47
|
+
* @param file - The generator file to import.
|
|
48
|
+
* @returns The generator entry, or `null` if the default export is not a {@link Generator}.
|
|
49
|
+
*/
|
|
50
|
+
async createGenerators() {
|
|
51
|
+
const files = await readGeneratorRunFiles();
|
|
52
|
+
return (await Promise.all(files.map(async (file) => {
|
|
53
|
+
const gen = (await import(file.filePath)).default;
|
|
54
|
+
if (gen instanceof Generator)
|
|
55
|
+
return { ...file, gen };
|
|
56
|
+
return null;
|
|
57
|
+
}))).filter((entry) => !!entry);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=GeneratorRun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorRun.js","sourceRoot":"","sources":["../../src/run/GeneratorRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAItD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+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plate extends GeneratorBase {
|
|
3
|
+
readonly templatesPath: string;
|
|
4
|
+
protected _templatePaths: string[] | null;
|
|
5
|
+
constructor(templatesPath: string);
|
|
6
|
+
get templatePaths(): string[];
|
|
7
|
+
load(): Promise<this>;
|
|
8
|
+
persist(): Promise<this>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=GeneratorTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorTemplate.d.ts","sourceRoot":"","sources":["../../src/run/GeneratorTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,qBAAa,iBAAkB,SAAQ,aAAa;aAGf,aAAa,EAAE,MAAM;IAFxD,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAQ;gBAEd,aAAa,EAAE,MAAM;IAIxD,IAAW,aAAa,IAAI,MAAM,EAAE,CAInC;IAEqB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GeneratorBase } from "./GeneratorBase.js";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { isTemplateFile } from "../common/file.common.js";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
export class GeneratorTemplate extends GeneratorBase {
|
|
6
|
+
templatesPath;
|
|
7
|
+
_templatePaths = null;
|
|
8
|
+
constructor(templatesPath) {
|
|
9
|
+
super();
|
|
10
|
+
this.templatesPath = templatesPath;
|
|
11
|
+
}
|
|
12
|
+
get templatePaths() {
|
|
13
|
+
if (!this._templatePaths)
|
|
14
|
+
throw new Error(`Templates not yet loaded. ${this.templatesPath}`);
|
|
15
|
+
return this._templatePaths;
|
|
16
|
+
}
|
|
17
|
+
async load() {
|
|
18
|
+
this._templatePaths = (await readdir(this.templatesPath))
|
|
19
|
+
.filter(isTemplateFile)
|
|
20
|
+
.map((name) => join(this.templatesPath, name));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
async persist() {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=GeneratorTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeneratorTemplate.js","sourceRoot":"","sources":["../../src/run/GeneratorTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAGf;IAFzB,cAAc,GAAoB,IAAI,CAAC;IAEjD,YAAmC,aAAqB;QACtD,KAAK,EAAE,CAAC;QADyB,kBAAa,GAAb,aAAa,CAAQ;IAExD,CAAC;IAED,IAAW,aAAa;QACtB,IAAI,CAAC,IAAI,CAAC,cAAc;YACtB,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,IAAI,CAAC,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACtD,MAAM,CAAC,cAAc,CAAC;aACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,OAAO;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./GeneratorBarrel.js";
|
|
2
|
+
export * from "./GeneratorBase.js";
|
|
3
|
+
export * from "./GeneratorBaseFile.js";
|
|
4
|
+
export * from "./GeneratorDirectory.js";
|
|
5
|
+
export * from "./GeneratorFile.js";
|
|
6
|
+
export * from "./GeneratorFs.js";
|
|
7
|
+
export * from "./GeneratorPackage.js";
|
|
8
|
+
export * from "./GeneratorRun.js";
|
|
9
|
+
export * from "./GeneratorTemplate.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|