@igniteui/angular-templates 18.0.1400-beta.0 → 18.0.1400-beta.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.
|
@@ -45,6 +45,20 @@ export declare class AngularTypeScriptFileUpdate extends TypeScriptFileUpdate {
|
|
|
45
45
|
*/
|
|
46
46
|
provideHttpClientForStandaloneAppConfig(): void;
|
|
47
47
|
protected buildRouteStructure(route: AngularRouteLike, multiline: boolean): RouteEntry[];
|
|
48
|
+
/**
|
|
49
|
+
* Add an imort declaration for the dependency.
|
|
50
|
+
* @param meta The metadata to use for the import declaration.
|
|
51
|
+
* @param moduleName The name of the module to import from.
|
|
52
|
+
* @param variables Variables to replace in the dependency strings.
|
|
53
|
+
*/
|
|
54
|
+
private addImportDeclarationForDependency;
|
|
55
|
+
/**
|
|
56
|
+
* Applies mutations to an Angular decorator's metadata.
|
|
57
|
+
* @param decoratorName The name of the decorator to update.
|
|
58
|
+
* @param meta The metadata to use for the mutations.
|
|
59
|
+
* @param multiline Whether to format the new entry as multiline.
|
|
60
|
+
*/
|
|
61
|
+
private applyDecoratorMutations;
|
|
48
62
|
/**
|
|
49
63
|
* Updates an Angular decorator's metadata.
|
|
50
64
|
* @param name The name of the decorator to update.
|
|
@@ -46,32 +46,14 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
|
|
|
46
46
|
if (!this.standalone || !dep.standalone)
|
|
47
47
|
return;
|
|
48
48
|
const copy = {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
imports: this.asArray(dep.import || [], variables || {}),
|
|
50
|
+
providers: this.asArray(dep.provide || [], variables || {}),
|
|
51
51
|
schemas: this.asArray(dep.schema || [], variables || {}),
|
|
52
52
|
};
|
|
53
53
|
if (dep.from) {
|
|
54
|
-
|
|
55
|
-
const uniqueIdentifiers = new Set([
|
|
56
|
-
...copy.import,
|
|
57
|
-
...copy.provide,
|
|
58
|
-
...copy.schemas,
|
|
59
|
-
]);
|
|
60
|
-
const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
|
|
61
|
-
this.astTransformer.requestNewImportDeclaration({
|
|
62
|
-
identifiers,
|
|
63
|
-
moduleName: this.applyConfigTransformation(dep.from, variables),
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
if (copy.import.length > 0) {
|
|
67
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
|
|
68
|
-
}
|
|
69
|
-
if (copy.provide.length > 0) {
|
|
70
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
|
|
71
|
-
}
|
|
72
|
-
if (copy.schemas.length > 0) {
|
|
73
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.schemas, types_1.AngularDecoratorMetaTarget.Schemas, multiline);
|
|
54
|
+
this.addImportDeclarationForDependency(copy, dep.from, variables);
|
|
74
55
|
}
|
|
56
|
+
this.applyDecoratorMutations(cli_core_1.NG_SA_DECORATOR_NAME, copy, multiline);
|
|
75
57
|
}
|
|
76
58
|
/**
|
|
77
59
|
* Adds metadata to an NgModule decorator.
|
|
@@ -83,46 +65,20 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
|
|
|
83
65
|
if (this.standalone || dep.standalone)
|
|
84
66
|
return;
|
|
85
67
|
const copy = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
68
|
+
imports: this.asArray(dep.import || [], variables || {}),
|
|
69
|
+
declarations: this.asArray(dep.declare || [], variables || {}),
|
|
70
|
+
providers: this.asArray(dep.provide || [], variables || {}),
|
|
71
|
+
exports: this.asArray(dep.export || [], variables || {}),
|
|
90
72
|
schemas: this.asArray(dep.schema || [], variables || {}),
|
|
91
73
|
};
|
|
92
74
|
if (dep.from) {
|
|
93
|
-
|
|
94
|
-
const uniqueIdentifiers = new Set([
|
|
95
|
-
...copy.import,
|
|
96
|
-
...copy.declare,
|
|
97
|
-
...copy.provide,
|
|
98
|
-
...copy.export,
|
|
99
|
-
...copy.schemas,
|
|
100
|
-
]);
|
|
101
|
-
const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
|
|
102
|
-
this.astTransformer.requestNewImportDeclaration({
|
|
103
|
-
identifiers,
|
|
104
|
-
moduleName: this.applyConfigTransformation(dep.from, variables),
|
|
105
|
-
});
|
|
75
|
+
this.addImportDeclarationForDependency(copy, dep.from, variables);
|
|
106
76
|
}
|
|
107
|
-
if (dep.root && copy.
|
|
77
|
+
if (dep.root && copy.imports.length > 0) {
|
|
108
78
|
// add forRoot to the module
|
|
109
|
-
copy.
|
|
110
|
-
}
|
|
111
|
-
if (copy.declare.length > 0) {
|
|
112
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.declare, types_1.AngularDecoratorMetaTarget.Declarations, multiline);
|
|
113
|
-
}
|
|
114
|
-
if (copy.import.length > 0) {
|
|
115
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
|
|
116
|
-
}
|
|
117
|
-
if (copy.provide.length > 0) {
|
|
118
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
|
|
119
|
-
}
|
|
120
|
-
if (copy.export.length > 0) {
|
|
121
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.export, types_1.AngularDecoratorMetaTarget.Exports, multiline);
|
|
122
|
-
}
|
|
123
|
-
if (copy.schemas.length > 0) {
|
|
124
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.schemas, types_1.AngularDecoratorMetaTarget.Schemas, multiline);
|
|
79
|
+
copy.imports = copy.imports.map((i) => this.astTransformer.printer.printNode(ts.EmitHint.Unspecified, this.astTransformer.createCallExpression(i, cli_core_1.NG_FOR_ROOT_IDENTIFIER_NAME), this.astTransformer.sourceFile));
|
|
125
80
|
}
|
|
81
|
+
this.applyDecoratorMutations(cli_core_1.NG_MODULE_DECORATOR_NAME, copy, multiline);
|
|
126
82
|
}
|
|
127
83
|
/**
|
|
128
84
|
* Includes `{ bindToComponentInputs: true }` for a `forRoot` call in an `NgModule`'s `imports` member.
|
|
@@ -233,6 +189,36 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
|
|
|
233
189
|
}
|
|
234
190
|
//#endregion
|
|
235
191
|
//#region Internals
|
|
192
|
+
/**
|
|
193
|
+
* Add an imort declaration for the dependency.
|
|
194
|
+
* @param meta The metadata to use for the import declaration.
|
|
195
|
+
* @param moduleName The name of the module to import from.
|
|
196
|
+
* @param variables Variables to replace in the dependency strings.
|
|
197
|
+
*/
|
|
198
|
+
addImportDeclarationForDependency(meta, moduleName, variables) {
|
|
199
|
+
// add an import declaration for the dependency
|
|
200
|
+
const uniqueIdentifiers = new Set(Object.keys(meta)
|
|
201
|
+
.map((key) => meta[key])
|
|
202
|
+
.flat());
|
|
203
|
+
const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
|
|
204
|
+
this.astTransformer.requestNewImportDeclaration({
|
|
205
|
+
identifiers,
|
|
206
|
+
moduleName: this.applyConfigTransformation(moduleName, variables),
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Applies mutations to an Angular decorator's metadata.
|
|
211
|
+
* @param decoratorName The name of the decorator to update.
|
|
212
|
+
* @param meta The metadata to use for the mutations.
|
|
213
|
+
* @param multiline Whether to format the new entry as multiline.
|
|
214
|
+
*/
|
|
215
|
+
applyDecoratorMutations(decoratorName, meta, multiline = false) {
|
|
216
|
+
for (const key of Object.keys(meta)) {
|
|
217
|
+
if (meta[key].length > 0) {
|
|
218
|
+
this.mutateNgDecoratorMeta(decoratorName, meta[key], key, multiline);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
236
222
|
/**
|
|
237
223
|
* Updates an Angular decorator's metadata.
|
|
238
224
|
* @param name The name of the decorator to update.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-templates",
|
|
3
|
-
"version": "18.0.1400-beta.
|
|
3
|
+
"version": "18.0.1400-beta.1",
|
|
4
4
|
"description": "Templates for Ignite UI for Angular projects and components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "Infragistics",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@igniteui/cli-core": "~14.0.0-beta.
|
|
15
|
+
"@igniteui/cli-core": "~14.0.0-beta.1",
|
|
16
16
|
"typescript": "~5.4.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
|
|
1
2
|
/** Represents possible meta data members in an Angular decorator. */
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export interface AngularDecoratorMetaTarget {
|
|
4
|
+
imports?: string[];
|
|
5
|
+
declarations?: string[];
|
|
6
|
+
providers?: string[];
|
|
7
|
+
exports?: string[];
|
|
8
|
+
schemas?: string[];
|
|
8
9
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AngularDecoratorMetaTarget = void 0;
|
|
4
|
-
/** Represents possible meta data members in an Angular decorator. */
|
|
5
|
-
var AngularDecoratorMetaTarget;
|
|
6
|
-
(function (AngularDecoratorMetaTarget) {
|
|
7
|
-
AngularDecoratorMetaTarget["Imports"] = "imports";
|
|
8
|
-
AngularDecoratorMetaTarget["Declarations"] = "declarations";
|
|
9
|
-
AngularDecoratorMetaTarget["Providers"] = "providers";
|
|
10
|
-
AngularDecoratorMetaTarget["Exports"] = "exports";
|
|
11
|
-
AngularDecoratorMetaTarget["Schemas"] = "schemas";
|
|
12
|
-
})(AngularDecoratorMetaTarget || (exports.AngularDecoratorMetaTarget = AngularDecoratorMetaTarget = {}));
|