@simplysm/sd-cli 7.0.249 → 7.0.267
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 +95 -0
- package/assets/client-files/assets/icons/icon-128x128.png +0 -0
- package/assets/client-files/assets/icons/icon-144x144.png +0 -0
- package/assets/client-files/assets/icons/icon-152x152.png +0 -0
- package/assets/client-files/assets/icons/icon-192x192.png +0 -0
- package/assets/client-files/assets/icons/icon-384x384.png +0 -0
- package/assets/client-files/assets/icons/icon-512x512.png +0 -0
- package/assets/client-files/assets/icons/icon-72x72.png +0 -0
- package/assets/client-files/assets/icons/icon-96x96.png +0 -0
- package/assets/client-files/favicon.ico +0 -0
- package/dist/bin/sd-cli.mjs +212 -15
- package/dist/build-tool/SdCliCordova.mjs +3 -3
- package/dist/build-tool/SdCliElectron.mjs +3 -2
- package/dist/build-tool/SdCliIndexFileGenerator.mjs +2 -3
- package/dist/builder/SdCliClientBuilder.d.ts +2 -0
- package/dist/builder/SdCliClientBuilder.mjs +57 -20
- package/dist/builder/SdCliServerBuilder.d.ts +2 -0
- package/dist/builder/SdCliServerBuilder.mjs +27 -13
- package/dist/builder/SdCliTsLibBuilder.mjs +18 -12
- package/dist/commons.d.ts +6 -1
- package/dist/entry-points/SdCliPrepare.mjs +34 -34
- package/dist/entry-points/SdCliProjectGenerator.d.ts +44 -0
- package/dist/entry-points/SdCliProjectGenerator.mjs +320 -0
- package/dist/entry-points/SdCliWorkspace.d.ts +6 -6
- package/dist/entry-points/SdCliWorkspace.mjs +61 -107
- package/dist/entry-points/file/base/fc_package_eslintrc.d.ts +3 -0
- package/dist/entry-points/file/base/fc_package_eslintrc.mjs +31 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.d.ts +9 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.mjs +32 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +5 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.mjs +13 -0
- package/dist/entry-points/file/client/fc_package_AppModule.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppModule.mjs +37 -0
- package/dist/entry-points/file/client/fc_package_AppPage.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppPage.mjs +14 -0
- package/dist/entry-points/file/client/fc_package_Page.d.ts +4 -0
- package/dist/entry-points/file/client/fc_package_Page.mjs +19 -0
- package/dist/entry-points/file/client/fc_package_client_main.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_client_main.mjs +19 -0
- package/dist/entry-points/file/client/fc_package_index.d.ts +3 -0
- package/dist/entry-points/file/client/fc_package_index.mjs +88 -0
- package/dist/entry-points/file/client/fc_package_manifest.d.ts +5 -0
- package/dist/entry-points/file/client/fc_package_manifest.mjs +54 -0
- package/dist/entry-points/file/client/fc_package_polyfills.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_polyfills.mjs +11 -0
- package/dist/entry-points/file/client/fc_package_styles.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_styles.mjs +7 -0
- package/dist/entry-points/file/db/fc_package_DbContext.d.ts +3 -0
- package/dist/entry-points/file/db/fc_package_DbContext.mjs +14 -0
- package/dist/entry-points/file/db/fc_package_DbModel.d.ts +4 -0
- package/dist/entry-points/file/db/fc_package_DbModel.mjs +12 -0
- package/dist/entry-points/file/project/fc_project_editor_config.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_editor_config.mjs +22 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.mjs +30 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.mjs +6 -0
- package/dist/entry-points/file/project/fc_project_gitignore.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitignore.mjs +17 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.d.ts +7 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.mjs +35 -0
- package/dist/entry-points/file/project/fc_project_readme.d.ts +3 -0
- package/dist/entry-points/file/project/fc_project_readme.mjs +13 -0
- package/dist/entry-points/file/project/fc_project_simplysm.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_simplysm.mjs +2 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +25 -0
- package/dist/entry-points/file/server/fc_package_server_main.d.ts +4 -0
- package/dist/entry-points/file/server/fc_package_server_main.mjs +60 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.mjs +24 -1
- package/dist/ng-tools/SdCliNgModuleGenerator.mjs +35 -36
- package/dist/packages/SdCliPackage.d.ts +1 -0
- package/dist/packages/SdCliPackage.mjs +69 -63
- package/dist/utils/SdCliBuildResultUtil.mjs +2 -2
- package/docs/client-add-page.md +8 -0
- package/docs/client-router.md +85 -0
- package/docs/client-sw.md +101 -0
- package/docs/conf-orm.md +81 -0
- package/docs/conf-usage.md +5 -0
- package/docs/lib-local-update.md +50 -0
- package/docs/lib-ts-paths.md +25 -0
- package/package.json +10 -8
- package/src/SdCliBuildResultError.ts +9 -9
- package/src/bin/sd-cli.ts +244 -15
- package/src/build-tool/SdCliCacheCompilerHost.ts +77 -77
- package/src/build-tool/SdCliCordova.ts +2 -2
- package/src/build-tool/SdCliElectron.ts +2 -1
- package/src/build-tool/SdCliGithubApi.ts +110 -110
- package/src/build-tool/SdCliIndexFileGenerator.ts +79 -80
- package/src/build-tool/SdCliNgCacheCompilerHost.ts +58 -58
- package/src/build-tool/SdCliPackageLinter.ts +74 -74
- package/src/builder/SdCliClientBuilder.ts +73 -22
- package/src/builder/SdCliJsLibBuilder.ts +70 -70
- package/src/builder/SdCliServerBuilder.ts +34 -14
- package/src/builder/SdCliTsLibBuilder.ts +450 -445
- package/src/commons.ts +6 -1
- package/src/entry-points/SdCliFileCrypto.ts +87 -87
- package/src/entry-points/SdCliPrepare.ts +55 -55
- package/src/entry-points/SdCliProjectGenerator.ts +395 -0
- package/src/entry-points/SdCliWorkspace.ts +74 -122
- package/src/entry-points/file/base/fc_package_eslintrc.ts +30 -0
- package/src/entry-points/file/base/fc_package_npmconfig.ts +43 -0
- package/src/entry-points/file/base/fc_package_tsconfig.ts +12 -0
- package/src/entry-points/file/client/fc_package_AppModule.ts +36 -0
- package/src/entry-points/file/client/fc_package_AppPage.ts +13 -0
- package/src/entry-points/file/client/fc_package_Page.ts +19 -0
- package/src/entry-points/file/client/fc_package_client_main.ts +18 -0
- package/src/entry-points/file/client/fc_package_index.ts +87 -0
- package/src/entry-points/file/client/fc_package_manifest.ts +53 -0
- package/src/entry-points/file/client/fc_package_polyfills.ts +10 -0
- package/src/entry-points/file/client/fc_package_styles.ts +6 -0
- package/src/entry-points/file/db/fc_package_DbContext.ts +14 -0
- package/src/entry-points/file/db/fc_package_DbModel.ts +11 -0
- package/src/entry-points/file/project/fc_project_editor_config.ts +21 -0
- package/src/entry-points/file/project/fc_project_eslintrc.ts +29 -0
- package/src/entry-points/file/project/fc_project_gitattributes.ts +5 -0
- package/src/entry-points/file/project/fc_project_gitignore.ts +16 -0
- package/src/entry-points/file/project/fc_project_npmconfig.ts +34 -0
- package/src/entry-points/file/project/fc_project_readme.ts +12 -0
- package/src/entry-points/file/project/fc_project_simplysm.ts +1 -0
- package/src/entry-points/file/project/fc_project_tsconfig.ts +24 -0
- package/src/entry-points/file/server/fc_package_server_main.ts +62 -0
- package/src/index.ts +55 -32
- package/src/ng-tools/SdCliNgModuleGenerator.ts +639 -640
- package/src/ng-tools/babel/SdCliBbFileMetadata.ts +568 -568
- package/src/ng-tools/babel/SdCliBbRootMetadata.ts +239 -239
- package/src/ng-tools/babel/SdCliBbUtil.ts +15 -15
- package/src/ng-tools/babel/TSdCliBbNgMetadata.ts +234 -234
- package/src/ng-tools/babel/TSdCliBbTypeMetadata.ts +177 -177
- package/src/ng-tools/commons.ts +3 -3
- package/src/ng-tools/typescript/SdCliTsFileMetadata.ts +384 -384
- package/src/ng-tools/typescript/SdCliTsRootMetadata.ts +32 -32
- package/src/ng-tools/typescript/SdCliTsUtil.ts +29 -29
- package/src/packages/SdCliPackage.ts +76 -59
- package/src/utils/SdCliBuildResultUtil.ts +76 -76
- package/src/utils/SdCliConfigUtil.ts +94 -94
- package/src/utils/SdCliNpmConfigUtil.ts +16 -16
|
@@ -1,234 +1,234 @@
|
|
|
1
|
-
import { NeverEntryError } from "@simplysm/sd-core-common";
|
|
2
|
-
import { SdCliBbFileMetadata } from "./SdCliBbFileMetadata";
|
|
3
|
-
import { SdCliBbArrayMetadata, SdCliBbVariableMetadata } from "./TSdCliBbTypeMetadata";
|
|
4
|
-
import { TSdCliBbMetadata } from "./SdCliBbRootMetadata";
|
|
5
|
-
|
|
6
|
-
export type TSdCliBbNgMetadata =
|
|
7
|
-
SdCliBbNgModuleMetadata
|
|
8
|
-
| SdCliBbNgInjectableMetadata
|
|
9
|
-
| SdCliBbNgDirectiveMetadata
|
|
10
|
-
| SdCliBbNgComponentMetadata
|
|
11
|
-
| SdCliBbNgPipeMetadata;
|
|
12
|
-
|
|
13
|
-
export class SdCliBbNgModuleMetadata {
|
|
14
|
-
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
15
|
-
private readonly _className: string) {
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private _defCache?: ISdCliBbNgModuleDef;
|
|
19
|
-
|
|
20
|
-
public get def(): ISdCliBbNgModuleDef {
|
|
21
|
-
if (this._defCache) return this._defCache;
|
|
22
|
-
|
|
23
|
-
const result: ISdCliBbNgModuleDef = {
|
|
24
|
-
exports: [],
|
|
25
|
-
providers: []
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
29
|
-
|
|
30
|
-
const expVal = argObjMeta?.getPropValue("exports") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵmod", "exports");
|
|
31
|
-
if (expVal !== undefined) {
|
|
32
|
-
const expMetas = this._getExportAndProviderMetas(expVal);
|
|
33
|
-
result.exports.push(...expMetas);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const provVal = argObjMeta?.getPropValue("providers") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵmod", "providers");
|
|
37
|
-
if (provVal !== undefined) {
|
|
38
|
-
const provMetas = this._getExportAndProviderMetas(provVal);
|
|
39
|
-
result.providers.push(...provMetas);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/*for (const meta of this._fileMeta.rawMetas) {
|
|
43
|
-
if (
|
|
44
|
-
isExpressionStatement(meta) &&
|
|
45
|
-
isAssignmentExpression(meta.expression) &&
|
|
46
|
-
isMemberExpression(meta.expression.left) &&
|
|
47
|
-
isIdentifier(meta.expression.left.object) &&
|
|
48
|
-
meta.expression.left.object.name === this._className &&
|
|
49
|
-
isIdentifier(meta.expression.left.property)
|
|
50
|
-
) {
|
|
51
|
-
if (meta.expression.left.property.name === "ɵmod") {
|
|
52
|
-
if (
|
|
53
|
-
isCallExpression(meta.expression.right) &&
|
|
54
|
-
meta.expression.right.arguments.length > 0 &&
|
|
55
|
-
isObjectExpression(meta.expression.right.arguments[0])
|
|
56
|
-
) {
|
|
57
|
-
const expObjMeta = new SdCliBbObjectMetadata(this._fileMeta, meta.expression.right.arguments[0]);
|
|
58
|
-
const expVal = expObjMeta.getPropValue("exports");
|
|
59
|
-
if (expVal !== undefined) {
|
|
60
|
-
if (expVal instanceof SdCliBbArrayMetadata) {
|
|
61
|
-
for (const expMeta of expVal.value.filterExists()) {
|
|
62
|
-
result.exports.push(expMeta);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
throw new NeverEntryError();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new NeverEntryError();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (meta.expression.left.property.name === "ɵinj") {
|
|
76
|
-
if (
|
|
77
|
-
isCallExpression(meta.expression.right) &&
|
|
78
|
-
meta.expression.right.arguments.length > 0 &&
|
|
79
|
-
isObjectExpression(meta.expression.right.arguments[0])
|
|
80
|
-
) {
|
|
81
|
-
const provObjMeta = new SdCliBbObjectMetadata(this._fileMeta, meta.expression.right.arguments[0]);
|
|
82
|
-
const provVal = provObjMeta.getPropValue("providers");
|
|
83
|
-
if (provVal !== undefined) {
|
|
84
|
-
const provMetas = this._getProviderMetas(provVal);
|
|
85
|
-
for (const provMeta of provMetas) {
|
|
86
|
-
result.providers.push(provMeta);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
throw new NeverEntryError();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}*/
|
|
96
|
-
|
|
97
|
-
this._defCache = result;
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private _getExportAndProviderMetas(meta: TSdCliBbMetadata): TSdCliBbMetadata[] {
|
|
102
|
-
const result: TSdCliBbMetadata[] = [];
|
|
103
|
-
|
|
104
|
-
if (meta instanceof SdCliBbArrayMetadata) {
|
|
105
|
-
for (const metaItem of meta.value.filterExists()) {
|
|
106
|
-
result.push(...this._getExportAndProviderMetas(metaItem));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else if (meta instanceof SdCliBbVariableMetadata) {
|
|
110
|
-
if (meta.value !== undefined) {
|
|
111
|
-
result.push(...this._getExportAndProviderMetas(meta.value));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
result.push(meta);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export class SdCliBbNgInjectableMetadata {
|
|
123
|
-
|
|
124
|
-
public constructor(
|
|
125
|
-
// @ts-expect-error
|
|
126
|
-
private readonly _fileMeta: SdCliBbFileMetadata,
|
|
127
|
-
// @ts-expect-error
|
|
128
|
-
private readonly _className: string) {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export class SdCliBbNgDirectiveMetadata {
|
|
133
|
-
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
134
|
-
private readonly _className: string) {
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private _selectorCache?: string;
|
|
138
|
-
|
|
139
|
-
public get selector(): string {
|
|
140
|
-
if (this._selectorCache !== undefined) return this._selectorCache;
|
|
141
|
-
|
|
142
|
-
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
143
|
-
const val = argObjMeta?.getPropValue("selector") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵdir", "selector");
|
|
144
|
-
if (typeof val === "string") {
|
|
145
|
-
this._selectorCache = val;
|
|
146
|
-
return this._selectorCache;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
throw new NeverEntryError();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export class SdCliBbNgComponentMetadata {
|
|
155
|
-
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
156
|
-
private readonly _className: string) {
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
private _selectorCache?: string;
|
|
160
|
-
|
|
161
|
-
public get selector(): string {
|
|
162
|
-
if (this._selectorCache !== undefined) return this._selectorCache;
|
|
163
|
-
|
|
164
|
-
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
165
|
-
const val = argObjMeta?.getPropValue("selector") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵcmp", "selector");
|
|
166
|
-
if (typeof val === "string") {
|
|
167
|
-
this._selectorCache = val;
|
|
168
|
-
return this._selectorCache;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
throw new NeverEntryError();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export class SdCliBbNgPipeMetadata {
|
|
177
|
-
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
178
|
-
private readonly _className: string) {
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
private _pipeNameCache?: string;
|
|
182
|
-
|
|
183
|
-
public get pipeName(): string {
|
|
184
|
-
if (this._pipeNameCache !== undefined) return this._pipeNameCache;
|
|
185
|
-
|
|
186
|
-
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
187
|
-
const val = argObjMeta?.getPropValue("name") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵpipe", "name");
|
|
188
|
-
if (typeof val === "string") {
|
|
189
|
-
this._pipeNameCache = val;
|
|
190
|
-
return val;
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
throw new NeverEntryError();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
interface ISdCliBbNgModuleDef {
|
|
199
|
-
exports: TSdCliBbMetadata[];
|
|
200
|
-
providers: TSdCliBbMetadata[];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/*
|
|
204
|
-
class SdCliNgMetadataUtil {
|
|
205
|
-
public static getDecoPropValue(fileMeta: SdCliBbFileMetadata, className: string, decoName: string, propName: string): TSdCliBbMetadata | undefined {
|
|
206
|
-
for (const meta of fileMeta.rawMetas) {
|
|
207
|
-
if (
|
|
208
|
-
isExpressionStatement(meta) &&
|
|
209
|
-
isAssignmentExpression(meta.expression) &&
|
|
210
|
-
isMemberExpression(meta.expression.left) &&
|
|
211
|
-
isIdentifier(meta.expression.left.object) &&
|
|
212
|
-
meta.expression.left.object.name === className &&
|
|
213
|
-
isIdentifier(meta.expression.left.property)
|
|
214
|
-
) {
|
|
215
|
-
if (meta.expression.left.property.name === decoName) {
|
|
216
|
-
if (
|
|
217
|
-
isCallExpression(meta.expression.right) &&
|
|
218
|
-
meta.expression.right.arguments.length > 0 &&
|
|
219
|
-
isObjectExpression(meta.expression.right.arguments[0])
|
|
220
|
-
) {
|
|
221
|
-
const dirObjMeta = new SdCliBbObjectMetadata(fileMeta, meta.expression.right.arguments[0]);
|
|
222
|
-
return dirObjMeta.getPropValue(propName);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
throw new NeverEntryError();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
throw new NeverEntryError();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
*/
|
|
1
|
+
import { NeverEntryError } from "@simplysm/sd-core-common";
|
|
2
|
+
import { SdCliBbFileMetadata } from "./SdCliBbFileMetadata";
|
|
3
|
+
import { SdCliBbArrayMetadata, SdCliBbVariableMetadata } from "./TSdCliBbTypeMetadata";
|
|
4
|
+
import { TSdCliBbMetadata } from "./SdCliBbRootMetadata";
|
|
5
|
+
|
|
6
|
+
export type TSdCliBbNgMetadata =
|
|
7
|
+
SdCliBbNgModuleMetadata
|
|
8
|
+
| SdCliBbNgInjectableMetadata
|
|
9
|
+
| SdCliBbNgDirectiveMetadata
|
|
10
|
+
| SdCliBbNgComponentMetadata
|
|
11
|
+
| SdCliBbNgPipeMetadata;
|
|
12
|
+
|
|
13
|
+
export class SdCliBbNgModuleMetadata {
|
|
14
|
+
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
15
|
+
private readonly _className: string) {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private _defCache?: ISdCliBbNgModuleDef;
|
|
19
|
+
|
|
20
|
+
public get def(): ISdCliBbNgModuleDef {
|
|
21
|
+
if (this._defCache) return this._defCache;
|
|
22
|
+
|
|
23
|
+
const result: ISdCliBbNgModuleDef = {
|
|
24
|
+
exports: [],
|
|
25
|
+
providers: []
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
29
|
+
|
|
30
|
+
const expVal = argObjMeta?.getPropValue("exports") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵmod", "exports");
|
|
31
|
+
if (expVal !== undefined) {
|
|
32
|
+
const expMetas = this._getExportAndProviderMetas(expVal);
|
|
33
|
+
result.exports.push(...expMetas);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const provVal = argObjMeta?.getPropValue("providers") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵmod", "providers");
|
|
37
|
+
if (provVal !== undefined) {
|
|
38
|
+
const provMetas = this._getExportAndProviderMetas(provVal);
|
|
39
|
+
result.providers.push(...provMetas);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*for (const meta of this._fileMeta.rawMetas) {
|
|
43
|
+
if (
|
|
44
|
+
isExpressionStatement(meta) &&
|
|
45
|
+
isAssignmentExpression(meta.expression) &&
|
|
46
|
+
isMemberExpression(meta.expression.left) &&
|
|
47
|
+
isIdentifier(meta.expression.left.object) &&
|
|
48
|
+
meta.expression.left.object.name === this._className &&
|
|
49
|
+
isIdentifier(meta.expression.left.property)
|
|
50
|
+
) {
|
|
51
|
+
if (meta.expression.left.property.name === "ɵmod") {
|
|
52
|
+
if (
|
|
53
|
+
isCallExpression(meta.expression.right) &&
|
|
54
|
+
meta.expression.right.arguments.length > 0 &&
|
|
55
|
+
isObjectExpression(meta.expression.right.arguments[0])
|
|
56
|
+
) {
|
|
57
|
+
const expObjMeta = new SdCliBbObjectMetadata(this._fileMeta, meta.expression.right.arguments[0]);
|
|
58
|
+
const expVal = expObjMeta.getPropValue("exports");
|
|
59
|
+
if (expVal !== undefined) {
|
|
60
|
+
if (expVal instanceof SdCliBbArrayMetadata) {
|
|
61
|
+
for (const expMeta of expVal.value.filterExists()) {
|
|
62
|
+
result.exports.push(expMeta);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw new NeverEntryError();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
throw new NeverEntryError();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (meta.expression.left.property.name === "ɵinj") {
|
|
76
|
+
if (
|
|
77
|
+
isCallExpression(meta.expression.right) &&
|
|
78
|
+
meta.expression.right.arguments.length > 0 &&
|
|
79
|
+
isObjectExpression(meta.expression.right.arguments[0])
|
|
80
|
+
) {
|
|
81
|
+
const provObjMeta = new SdCliBbObjectMetadata(this._fileMeta, meta.expression.right.arguments[0]);
|
|
82
|
+
const provVal = provObjMeta.getPropValue("providers");
|
|
83
|
+
if (provVal !== undefined) {
|
|
84
|
+
const provMetas = this._getProviderMetas(provVal);
|
|
85
|
+
for (const provMeta of provMetas) {
|
|
86
|
+
result.providers.push(provMeta);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
throw new NeverEntryError();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}*/
|
|
96
|
+
|
|
97
|
+
this._defCache = result;
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private _getExportAndProviderMetas(meta: TSdCliBbMetadata): TSdCliBbMetadata[] {
|
|
102
|
+
const result: TSdCliBbMetadata[] = [];
|
|
103
|
+
|
|
104
|
+
if (meta instanceof SdCliBbArrayMetadata) {
|
|
105
|
+
for (const metaItem of meta.value.filterExists()) {
|
|
106
|
+
result.push(...this._getExportAndProviderMetas(metaItem));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else if (meta instanceof SdCliBbVariableMetadata) {
|
|
110
|
+
if (meta.value !== undefined) {
|
|
111
|
+
result.push(...this._getExportAndProviderMetas(meta.value));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
result.push(meta);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export class SdCliBbNgInjectableMetadata {
|
|
123
|
+
|
|
124
|
+
public constructor(
|
|
125
|
+
// @ts-expect-error
|
|
126
|
+
private readonly _fileMeta: SdCliBbFileMetadata,
|
|
127
|
+
// @ts-expect-error
|
|
128
|
+
private readonly _className: string) {
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export class SdCliBbNgDirectiveMetadata {
|
|
133
|
+
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
134
|
+
private readonly _className: string) {
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private _selectorCache?: string;
|
|
138
|
+
|
|
139
|
+
public get selector(): string {
|
|
140
|
+
if (this._selectorCache !== undefined) return this._selectorCache;
|
|
141
|
+
|
|
142
|
+
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
143
|
+
const val = argObjMeta?.getPropValue("selector") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵdir", "selector");
|
|
144
|
+
if (typeof val === "string") {
|
|
145
|
+
this._selectorCache = val;
|
|
146
|
+
return this._selectorCache;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
throw new NeverEntryError();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export class SdCliBbNgComponentMetadata {
|
|
155
|
+
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
156
|
+
private readonly _className: string) {
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private _selectorCache?: string;
|
|
160
|
+
|
|
161
|
+
public get selector(): string {
|
|
162
|
+
if (this._selectorCache !== undefined) return this._selectorCache;
|
|
163
|
+
|
|
164
|
+
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
165
|
+
const val = argObjMeta?.getPropValue("selector") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵcmp", "selector");
|
|
166
|
+
if (typeof val === "string") {
|
|
167
|
+
this._selectorCache = val;
|
|
168
|
+
return this._selectorCache;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw new NeverEntryError();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export class SdCliBbNgPipeMetadata {
|
|
177
|
+
public constructor(private readonly _fileMeta: SdCliBbFileMetadata,
|
|
178
|
+
private readonly _className: string) {
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private _pipeNameCache?: string;
|
|
182
|
+
|
|
183
|
+
public get pipeName(): string {
|
|
184
|
+
if (this._pipeNameCache !== undefined) return this._pipeNameCache;
|
|
185
|
+
|
|
186
|
+
const argObjMeta = this._fileMeta.getNgDecoArg(this._className);
|
|
187
|
+
const val = argObjMeta?.getPropValue("name") ?? this._fileMeta.getNgDecoPropValue(this._className, "ɵpipe", "name");
|
|
188
|
+
if (typeof val === "string") {
|
|
189
|
+
this._pipeNameCache = val;
|
|
190
|
+
return val;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw new NeverEntryError();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface ISdCliBbNgModuleDef {
|
|
199
|
+
exports: TSdCliBbMetadata[];
|
|
200
|
+
providers: TSdCliBbMetadata[];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/*
|
|
204
|
+
class SdCliNgMetadataUtil {
|
|
205
|
+
public static getDecoPropValue(fileMeta: SdCliBbFileMetadata, className: string, decoName: string, propName: string): TSdCliBbMetadata | undefined {
|
|
206
|
+
for (const meta of fileMeta.rawMetas) {
|
|
207
|
+
if (
|
|
208
|
+
isExpressionStatement(meta) &&
|
|
209
|
+
isAssignmentExpression(meta.expression) &&
|
|
210
|
+
isMemberExpression(meta.expression.left) &&
|
|
211
|
+
isIdentifier(meta.expression.left.object) &&
|
|
212
|
+
meta.expression.left.object.name === className &&
|
|
213
|
+
isIdentifier(meta.expression.left.property)
|
|
214
|
+
) {
|
|
215
|
+
if (meta.expression.left.property.name === decoName) {
|
|
216
|
+
if (
|
|
217
|
+
isCallExpression(meta.expression.right) &&
|
|
218
|
+
meta.expression.right.arguments.length > 0 &&
|
|
219
|
+
isObjectExpression(meta.expression.right.arguments[0])
|
|
220
|
+
) {
|
|
221
|
+
const dirObjMeta = new SdCliBbObjectMetadata(fileMeta, meta.expression.right.arguments[0]);
|
|
222
|
+
return dirObjMeta.getPropValue(propName);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
throw new NeverEntryError();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
throw new NeverEntryError();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
*/
|