@memberjunction/codegen-lib 3.2.0 → 3.4.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 +45 -1
- package/dist/Angular/angular-codegen.d.ts.map +1 -1
- package/dist/Angular/angular-codegen.js +2 -1
- package/dist/Angular/angular-codegen.js.map +1 -1
- package/dist/Config/config.d.ts +79 -0
- package/dist/Config/config.d.ts.map +1 -1
- package/dist/Config/config.js +19 -1
- package/dist/Config/config.js.map +1 -1
- package/dist/Database/manage-metadata.d.ts +22 -6
- package/dist/Database/manage-metadata.d.ts.map +1 -1
- package/dist/Database/manage-metadata.js +175 -25
- package/dist/Database/manage-metadata.js.map +1 -1
- package/dist/Database/sql_codegen.d.ts +3 -0
- package/dist/Database/sql_codegen.d.ts.map +1 -1
- package/dist/Database/sql_codegen.js +141 -37
- package/dist/Database/sql_codegen.js.map +1 -1
- package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts +99 -0
- package/dist/Manifest/GenerateClassRegistrationsManifest.d.ts.map +1 -0
- package/dist/Manifest/GenerateClassRegistrationsManifest.js +630 -0
- package/dist/Manifest/GenerateClassRegistrationsManifest.js.map +1 -0
- package/dist/Misc/sql_logging.d.ts +6 -0
- package/dist/Misc/sql_logging.d.ts.map +1 -1
- package/dist/Misc/sql_logging.js +24 -7
- package/dist/Misc/sql_logging.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/runCodeGen.d.ts.map +1 -1
- package/dist/runCodeGen.js +2 -1
- package/dist/runCodeGen.js.map +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build-time tool to generate an import manifest that prevents tree-shaking of
|
|
3
|
+
* @RegisterClass decorated classes.
|
|
4
|
+
*
|
|
5
|
+
* The tool starts from the current app's package.json, walks its full transitive
|
|
6
|
+
* dependency tree, scans each dependency's source for @RegisterClass decorators,
|
|
7
|
+
* and generates a manifest importing only the packages that contain them.
|
|
8
|
+
*
|
|
9
|
+
* Usage (via MJCLI):
|
|
10
|
+
* mj codegen manifest --output ./src/generated/class-registrations-manifest.ts
|
|
11
|
+
*
|
|
12
|
+
* Or programmatically:
|
|
13
|
+
* import { generateClassRegistrationsManifest } from '@memberjunction/codegen-lib';
|
|
14
|
+
* await generateClassRegistrationsManifest({ outputPath: './src/generated/class-manifest.ts' });
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Information about a class decorated with @RegisterClass
|
|
18
|
+
*/
|
|
19
|
+
export interface RegisteredClassInfo {
|
|
20
|
+
/** The class name */
|
|
21
|
+
className: string;
|
|
22
|
+
/** Absolute path to the source file */
|
|
23
|
+
filePath: string;
|
|
24
|
+
/** The npm package name (e.g., @memberjunction/core) */
|
|
25
|
+
packageName: string;
|
|
26
|
+
/** The base class name from the decorator (first argument) */
|
|
27
|
+
baseClassName?: string;
|
|
28
|
+
/** The key from the decorator (second argument) */
|
|
29
|
+
key?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options for the manifest generator
|
|
33
|
+
*/
|
|
34
|
+
export interface GenerateManifestOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Output path for the generated manifest file.
|
|
37
|
+
*/
|
|
38
|
+
outputPath: string;
|
|
39
|
+
/**
|
|
40
|
+
* Directory containing the app's package.json.
|
|
41
|
+
* Defaults to process.cwd().
|
|
42
|
+
*/
|
|
43
|
+
appDir?: string;
|
|
44
|
+
/**
|
|
45
|
+
* If true, logs progress to console. Default: true
|
|
46
|
+
*/
|
|
47
|
+
verbose?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If provided, only include classes registered with these base classes.
|
|
50
|
+
* Example: ['BaseEngine', 'BaseAction']
|
|
51
|
+
*/
|
|
52
|
+
filterBaseClasses?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Glob patterns to exclude from scanning.
|
|
55
|
+
*/
|
|
56
|
+
excludePatterns?: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Result of the manifest generation
|
|
60
|
+
*/
|
|
61
|
+
export interface GenerateManifestResult {
|
|
62
|
+
/** Whether generation was successful */
|
|
63
|
+
success: boolean;
|
|
64
|
+
/** Path to the generated manifest file */
|
|
65
|
+
outputPath: string;
|
|
66
|
+
/** All classes found */
|
|
67
|
+
classes: RegisteredClassInfo[];
|
|
68
|
+
/** Unique packages that will be imported */
|
|
69
|
+
packages: string[];
|
|
70
|
+
/** Total packages in the dependency tree */
|
|
71
|
+
totalDepsWalked: number;
|
|
72
|
+
/** Any errors encountered */
|
|
73
|
+
errors: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generates a class registrations manifest for the app in the given directory.
|
|
77
|
+
*
|
|
78
|
+
* Walks the app's dependency tree from its package.json, scans each dependency
|
|
79
|
+
* for @RegisterClass decorators, and writes an import manifest that prevents
|
|
80
|
+
* tree-shaking from removing those classes.
|
|
81
|
+
*
|
|
82
|
+
* @param options - Configuration options
|
|
83
|
+
* @returns Result with discovered classes and generated manifest path
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* import { generateClassRegistrationsManifest } from '@memberjunction/codegen-lib';
|
|
88
|
+
*
|
|
89
|
+
* const result = await generateClassRegistrationsManifest({
|
|
90
|
+
* outputPath: './src/generated/class-manifest.ts'
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* if (result.success) {
|
|
94
|
+
* console.log(`Manifest: ${result.packages.length} packages, ${result.classes.length} classes`);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function generateClassRegistrationsManifest(options: GenerateManifestOptions): Promise<GenerateManifestResult>;
|
|
99
|
+
//# sourceMappingURL=GenerateClassRegistrationsManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerateClassRegistrationsManifest.d.ts","sourceRoot":"","sources":["../../src/Manifest/GenerateClassRegistrationsManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAolBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,kCAAkC,CACpD,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,sBAAsB,CAAC,CAsFjC"}
|