@abp/ng.schematics 9.2.0-rc.2 → 9.2.0-rc.3
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/commands/change-theme/index.d.ts +7 -3
- package/commands/change-theme/index.js +264 -70
- package/commands/change-theme/index.js.map +1 -1
- package/commands/change-theme/style-map.d.ts +1 -0
- package/commands/change-theme/style-map.js +90 -9
- package/commands/change-theme/style-map.js.map +1 -1
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/.eslintrc.json.template +44 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/ng-package.json.template +7 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/src/enums/index.ts.template +1 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/src/enums/route-names.ts.template +3 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/src/providers/index.ts.template +1 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/src/providers/route.provider.ts.template +30 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/config/src/public-api.ts.template +2 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/karma.conf.js.template +44 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/ng-package.json.template +7 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/package.json.template +11 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/src/lib/__libraryName@kebab__.component.ts.template +11 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/src/lib/__libraryName@kebab__.routes.ts.template +9 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/src/lib/index.ts.template +1 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/src/public-api.ts.template +4 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/src/test.ts.template +26 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/tsconfig.lib.json.template +20 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/tsconfig.lib.prod.json.template +10 -0
- package/commands/create-lib/files-package-standalone/__libraryName@kebab__/tsconfig.spec.json.template +17 -0
- package/commands/create-lib/files-secondary-entrypoint-standalone/__libraryName@kebab__/ng-package.json.template +6 -0
- package/commands/create-lib/files-secondary-entrypoint-standalone/__libraryName@kebab__/src/lib/__target@kebab__-__libraryName@kebab__.ts.template +7 -0
- package/commands/create-lib/files-secondary-entrypoint-standalone/__libraryName@kebab__/src/lib/index.ts.template +1 -0
- package/commands/create-lib/files-secondary-entrypoint-standalone/__libraryName@kebab__/src/public-api.ts.template +1 -0
- package/commands/create-lib/index.d.ts +7 -3
- package/commands/create-lib/index.js +161 -58
- package/commands/create-lib/index.js.map +1 -1
- package/commands/create-lib/models/generate-lib-schema.d.ts +8 -1
- package/commands/create-lib/models/generate-lib-schema.js +6 -0
- package/commands/create-lib/models/generate-lib-schema.js.map +1 -1
- package/commands/create-lib/schema.json +13 -9
- package/package.json +1 -1
- package/utils/angular/add-declaration-to-ng-module.d.ts +2 -1
- package/utils/angular/add-declaration-to-ng-module.js +4 -4
- package/utils/angular/add-declaration-to-ng-module.js.map +1 -1
- package/utils/angular/ast-utils.d.ts +18 -8
- package/utils/angular/ast-utils.js +70 -41
- package/utils/angular/ast-utils.js.map +1 -1
- package/utils/angular/change.d.ts +1 -1
- package/utils/angular/change.js +4 -4
- package/utils/angular/change.js.map +1 -1
- package/utils/angular/dependencies.d.ts +1 -1
- package/utils/angular/dependencies.js +1 -1
- package/utils/angular/dependency.d.ts +1 -1
- package/utils/angular/dependency.js +2 -2
- package/utils/angular/dependency.js.map +1 -1
- package/utils/angular/eol.d.ts +8 -0
- package/utils/angular/eol.js +24 -0
- package/utils/angular/eol.js.map +1 -0
- package/utils/angular/find-module.d.ts +1 -1
- package/utils/angular/find-module.js +5 -5
- package/utils/angular/find-module.js.map +1 -1
- package/utils/angular/generate-from-files.d.ts +3 -1
- package/utils/angular/generate-from-files.js +15 -2
- package/utils/angular/generate-from-files.js.map +1 -1
- package/utils/angular/index.d.ts +1 -0
- package/utils/angular/index.js +1 -0
- package/utils/angular/index.js.map +1 -1
- package/utils/angular/json-file.d.ts +3 -2
- package/utils/angular/json-file.js +6 -3
- package/utils/angular/json-file.js.map +1 -1
- package/utils/angular/ng-ast-utils.d.ts +2 -2
- package/utils/angular/ng-ast-utils.js +19 -7
- package/utils/angular/ng-ast-utils.js.map +1 -1
- package/utils/angular/parse-name.d.ts +1 -1
- package/utils/angular/parse-name.js +1 -1
- package/utils/angular/paths.d.ts +1 -1
- package/utils/angular/paths.js +4 -7
- package/utils/angular/paths.js.map +1 -1
- package/utils/angular/project-targets.d.ts +3 -1
- package/utils/angular/project-targets.js +9 -2
- package/utils/angular/project-targets.js.map +1 -1
- package/utils/angular/standalone/app_component.d.ts +29 -0
- package/utils/angular/standalone/app_component.js +108 -0
- package/utils/angular/standalone/app_component.js.map +1 -0
- package/utils/angular/standalone/app_config.d.ts +23 -0
- package/utils/angular/standalone/app_config.js +90 -0
- package/utils/angular/standalone/app_config.js.map +1 -0
- package/utils/angular/standalone/code_block.d.ts +53 -0
- package/utils/angular/standalone/code_block.js +80 -0
- package/utils/angular/standalone/code_block.js.map +1 -0
- package/utils/angular/standalone/index.d.ts +9 -0
- package/utils/angular/standalone/index.js +14 -0
- package/utils/angular/standalone/index.js.map +1 -0
- package/utils/angular/standalone/rules.d.ts +45 -0
- package/utils/angular/standalone/rules.js +189 -0
- package/utils/angular/standalone/rules.js.map +1 -0
- package/utils/angular/standalone/util.d.ts +35 -0
- package/utils/angular/standalone/util.js +136 -0
- package/utils/angular/standalone/util.js.map +1 -0
- package/utils/angular/validation.d.ts +1 -1
- package/utils/angular/validation.js +2 -2
- package/utils/angular/validation.js.map +1 -1
- package/utils/angular/workspace-models.d.ts +12 -6
- package/utils/angular/workspace-models.js +11 -3
- package/utils/angular/workspace-models.js.map +1 -1
- package/utils/angular/workspace.d.ts +12 -1
- package/utils/angular/workspace.js +6 -6
- package/utils/angular/workspace.js.map +1 -1
- package/utils/ast.d.ts +1 -0
- package/utils/ast.js +6 -1
- package/utils/ast.js.map +1 -1
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/utils/ng-module.d.ts +46 -0
- package/utils/ng-module.js +126 -0
- package/utils/ng-module.js.map +1 -0
- package/utils/standalone.d.ts +59 -0
- package/utils/standalone.js +146 -0
- package/utils/standalone.js.map +1 -0
- package/utils/workspace.js +1 -1
- package/utils/workspace.js.map +1 -1
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.addDependency = exports.ExistingBehavior = exports.InstallBehavior = exports.DependencyType = void 0;
|
|
11
11
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
12
|
-
const path = require("path");
|
|
12
|
+
const path = require("node:path");
|
|
13
13
|
const installTasks = new WeakMap();
|
|
14
14
|
/**
|
|
15
15
|
* An enum used to specify the type of a dependency found within a package manifest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/dependency.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,4DAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/dependency.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,4DAA0E;AAC1E,kCAAkC;AAElC,MAAM,YAAY,GAAG,IAAI,OAAO,EAAiC,CAAC;AAQlE;;;GAGG;AACH,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,0CAAwB,CAAA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,CAAC,CAAC;AACJ,CAAC;AAvFD,sCAuFC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export declare function getEOL(content: string): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getEOL = void 0;
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const CRLF = '\r\n';
|
|
13
|
+
const LF = '\n';
|
|
14
|
+
function getEOL(content) {
|
|
15
|
+
const newlines = content.match(/(?:\r?\n)/g);
|
|
16
|
+
if (newlines?.length) {
|
|
17
|
+
const crlf = newlines.filter(l => l === CRLF).length;
|
|
18
|
+
const lf = newlines.length - crlf;
|
|
19
|
+
return crlf > lf ? CRLF : LF;
|
|
20
|
+
}
|
|
21
|
+
return node_os_1.EOL;
|
|
22
|
+
}
|
|
23
|
+
exports.getEOL = getEOL;
|
|
24
|
+
//# sourceMappingURL=eol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eol.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/eol.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qCAA8B;AAE9B,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,EAAE,GAAG,IAAI,CAAC;AAEhB,SAAgB,MAAM,CAAC,OAAe;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7C,IAAI,QAAQ,EAAE,MAAM,EAAE;QACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACrD,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QAElC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B;IAED,OAAO,aAAG,CAAC;AACb,CAAC;AAXD,wBAWC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Path } from '@angular-devkit/core';
|
|
9
9
|
import { Tree } from '@angular-devkit/schematics';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.buildRelativePath = exports.findModule = exports.findModuleFromOptions = exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0;
|
|
@@ -37,9 +37,9 @@ function findModuleFromOptions(host, options) {
|
|
|
37
37
|
}
|
|
38
38
|
const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
|
|
39
39
|
for (const c of candidatesDirs) {
|
|
40
|
-
const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map(
|
|
40
|
+
const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map(x => (0, core_1.join)(c, x));
|
|
41
41
|
for (const sc of candidateFiles) {
|
|
42
|
-
if (host.exists(sc)) {
|
|
42
|
+
if (host.exists(sc) && host.readText(sc).includes('@NgModule')) {
|
|
43
43
|
return (0, core_1.normalize)(sc);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -56,8 +56,8 @@ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingMo
|
|
|
56
56
|
let dir = host.getDir('/' + generateDir);
|
|
57
57
|
let foundRoutingModule = false;
|
|
58
58
|
while (dir) {
|
|
59
|
-
const allMatches = dir.subfiles.filter(
|
|
60
|
-
const filteredMatches = allMatches.filter(
|
|
59
|
+
const allMatches = dir.subfiles.filter(p => p.endsWith(moduleExt));
|
|
60
|
+
const filteredMatches = allMatches.filter(p => !p.endsWith(routingModuleExt));
|
|
61
61
|
foundRoutingModule = foundRoutingModule || allMatches.length !== filteredMatches.length;
|
|
62
62
|
if (filteredMatches.length == 1) {
|
|
63
63
|
return (0, core_1.join)(dir.path, filteredMatches[0]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/find-module.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAgG;AAcnF,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAU,EAAE,OAAsB;IACtE,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAU,CAAC;IAClD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,0BAAkB,CAAC;IAExE,IAAI,CAAC,O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gBAAS,EAAC,IAAI,CAAC,CAAC;IACvB,EAAE,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,CAAC;IAEnB,qBAAqB;IACrB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,IAAA,eAAQ,EAC3B,IAAA,gBAAS,EAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EACrC,IAAA,gBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CACpC,CAAC;IACF,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,6EAA6E;IAC7E,IAAI,CAAC,YAAY,EAAE;QACjB,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,UAAU,GAAG,IAAI,CAAC;KACnB;IACD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,IAAI,GAAG,CAAC;KACnB;IAED,OAAO,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AAC5E,CAAC;AA7BD,8CA6BC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
9
9
|
export interface GenerateFromFilesOptions {
|
|
@@ -13,5 +13,7 @@ export interface GenerateFromFilesOptions {
|
|
|
13
13
|
prefix?: string;
|
|
14
14
|
project: string;
|
|
15
15
|
skipTests?: boolean;
|
|
16
|
+
templateFilesDirectory?: string;
|
|
17
|
+
type?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.generateFromFiles = void 0;
|
|
@@ -17,17 +17,30 @@ function generateFromFiles(options, extraTemplateValues = {}) {
|
|
|
17
17
|
options.path ?? (options.path = await (0, workspace_1.createDefaultPath)(host, options.project));
|
|
18
18
|
options.prefix ?? (options.prefix = '');
|
|
19
19
|
options.flat ?? (options.flat = true);
|
|
20
|
+
// Schematic templates require a defined type value
|
|
21
|
+
options.type ?? (options.type = '');
|
|
20
22
|
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
21
23
|
options.name = parsedPath.name;
|
|
22
24
|
options.path = parsedPath.path;
|
|
23
25
|
(0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
|
|
24
|
-
const
|
|
26
|
+
const templateFilesDirectory = options.templateFilesDirectory ?? './files';
|
|
27
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)(templateFilesDirectory), [
|
|
25
28
|
options.skipTests ? (0, schematics_1.filter)(path => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
|
|
26
29
|
(0, schematics_1.applyTemplates)({
|
|
27
30
|
...schematics_1.strings,
|
|
28
31
|
...options,
|
|
29
32
|
...extraTemplateValues,
|
|
30
33
|
}),
|
|
34
|
+
!options.type
|
|
35
|
+
? (0, schematics_1.forEach)((file => {
|
|
36
|
+
return file.path.includes('..')
|
|
37
|
+
? {
|
|
38
|
+
content: file.content,
|
|
39
|
+
path: file.path.replace('..', '.'),
|
|
40
|
+
}
|
|
41
|
+
: file;
|
|
42
|
+
}))
|
|
43
|
+
: (0, schematics_1.noop)(),
|
|
31
44
|
(0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + schematics_1.strings.dasherize(options.name))),
|
|
32
45
|
]);
|
|
33
46
|
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-from-files.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/generate-from-files.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"generate-from-files.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/generate-from-files.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAcoC;AACpC,6CAAyC;AACzC,6CAAiD;AACjD,2CAAgD;AAahD,SAAgB,iBAAiB,CAC/B,OAAiC,EACjC,sBAAwE,EAAE;IAE1E,OAAO,KAAK,EAAE,IAAU,EAAE,EAAE;QAC1B,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,MAAM,IAAA,6BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAC;QAChE,OAAO,CAAC,MAAM,KAAd,OAAO,CAAC,MAAM,GAAK,EAAE,EAAC;QACtB,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,IAAI,EAAC;QAEtB,mDAAmD;QACnD,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,EAAE,EAAC;QAEpB,MA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AC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACpF,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,sBAAS,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAzCD,8CAyCC"}
|
package/utils/angular/index.d.ts
CHANGED
package/utils/angular/index.js
CHANGED
|
@@ -27,4 +27,5 @@ __exportStar(require("./project-targets"), exports);
|
|
|
27
27
|
__exportStar(require("./validation"), exports);
|
|
28
28
|
__exportStar(require("./workspace"), exports);
|
|
29
29
|
__exportStar(require("./workspace-models"), exports);
|
|
30
|
+
__exportStar(require("./standalone"), exports);
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,0CAAwB;AACxB,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,0CAAwB;AACxB,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B"}
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { JsonValue } from '@angular-devkit/core';
|
|
9
9
|
import { Tree } from '@angular-devkit/schematics';
|
|
10
10
|
export declare type InsertionIndex = (properties: string[]) => number;
|
|
11
11
|
export declare type JSONPath = (string | number)[];
|
|
12
|
-
/** @
|
|
12
|
+
/** @private */
|
|
13
13
|
export declare class JSONFile {
|
|
14
14
|
private readonly host;
|
|
15
15
|
private readonly path;
|
|
16
16
|
content: string;
|
|
17
|
+
private eol;
|
|
17
18
|
constructor(host: Tree, path: string);
|
|
18
19
|
private _jsonAst;
|
|
19
20
|
private get JsonAst();
|
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.JSONFile = void 0;
|
|
11
11
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
12
|
-
|
|
12
|
+
const eol_1 = require("./eol");
|
|
13
|
+
/** @private */
|
|
13
14
|
class JSONFile {
|
|
14
15
|
constructor(host, path) {
|
|
15
16
|
this.host = host;
|
|
16
17
|
this.path = path;
|
|
17
18
|
this.content = this.host.readText(this.path);
|
|
19
|
+
this.eol = (0, eol_1.getEOL)(this.content);
|
|
18
20
|
}
|
|
19
21
|
get JsonAst() {
|
|
20
22
|
if (this._jsonAst) {
|
|
@@ -43,7 +45,7 @@ class JSONFile {
|
|
|
43
45
|
let getInsertionIndex;
|
|
44
46
|
if (insertInOrder === undefined) {
|
|
45
47
|
const property = jsonPath.slice(-1)[0];
|
|
46
|
-
getInsertionIndex =
|
|
48
|
+
getInsertionIndex = properties => [...properties, property].sort().findIndex(p => p === property);
|
|
47
49
|
}
|
|
48
50
|
else if (insertInOrder !== false) {
|
|
49
51
|
getInsertionIndex = insertInOrder;
|
|
@@ -51,6 +53,7 @@ class JSONFile {
|
|
|
51
53
|
const edits = (0, jsonc_parser_1.modify)(this.content, jsonPath, value, {
|
|
52
54
|
getInsertionIndex,
|
|
53
55
|
formattingOptions: {
|
|
56
|
+
eol: this.eol,
|
|
54
57
|
insertSpaces: true,
|
|
55
58
|
tabSize: 2,
|
|
56
59
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/json-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,+CASsB;
|
|
1
|
+
{"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/json-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,+CASsB;AACtB,+BAA+B;AAK/B,eAAe;AACf,MAAa,QAAQ;IAInB,YACmB,IAAU,EACV,IAAY;QADZ,SAAI,GAAJ,IAAI,CAAM;QACV,SAAI,GAAJ,IAAI,CAAQ;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,GAAG,IAAA,YAAM,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAGD,IAAY,OAAO;QACjB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QAED,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MA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AK,EAAE;YAClD,iBAAiB;YAEjB,iBAAiB,EAAE;gBACjB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,YAAY,EAAE,IAAI;gBAClB,OAAO,EAAE,CAAC;aACX;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,IAAA,yBAAU,EAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,QAAkB;QACvB,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;SAClC;IACH,CAAC;CACF;AAjFD,4BAiFC"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Tree } from '@angular-devkit/schematics';
|
|
9
9
|
import * as ts from 'typescript';
|
|
10
10
|
export declare function findBootstrapModuleCall(host: Tree, mainPath: string): ts.CallExpression | null;
|
|
11
|
-
export declare function findBootstrapModulePath(host: Tree, mainPath: string): string;
|
|
12
11
|
export declare function getAppModulePath(host: Tree, mainPath: string): string;
|
|
12
|
+
export declare function isStandaloneApp(host: Tree, mainPath: string): boolean;
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
10
|
+
exports.isStandaloneApp = exports.getAppModulePath = exports.findBootstrapModuleCall = void 0;
|
|
12
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
-
const
|
|
12
|
+
const posix_1 = require("node:path/posix");
|
|
14
13
|
const ts = require("typescript");
|
|
15
14
|
const ast_utils_1 = require("./ast-utils");
|
|
15
|
+
const util_1 = require("./standalone/util");
|
|
16
16
|
function findBootstrapModuleCall(host, mainPath) {
|
|
17
17
|
const mainText = host.readText(mainPath);
|
|
18
18
|
const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
|
|
@@ -57,12 +57,24 @@ function findBootstrapModulePath(host, mainPath) {
|
|
|
57
57
|
})[0];
|
|
58
58
|
return bootstrapModuleRelativePath;
|
|
59
59
|
}
|
|
60
|
-
exports.findBootstrapModulePath = findBootstrapModulePath;
|
|
61
60
|
function getAppModulePath(host, mainPath) {
|
|
62
61
|
const moduleRelativePath = findBootstrapModulePath(host, mainPath);
|
|
63
|
-
const mainDir = (0,
|
|
64
|
-
const modulePath = (0,
|
|
62
|
+
const mainDir = (0, posix_1.dirname)(mainPath);
|
|
63
|
+
const modulePath = (0, posix_1.join)(mainDir, `${moduleRelativePath}.ts`);
|
|
65
64
|
return modulePath;
|
|
66
65
|
}
|
|
67
66
|
exports.getAppModulePath = getAppModulePath;
|
|
67
|
+
function isStandaloneApp(host, mainPath) {
|
|
68
|
+
try {
|
|
69
|
+
(0, util_1.findBootstrapApplicationCall)(host, mainPath);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof schematics_1.SchematicsException) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.isStandaloneApp = isStandaloneApp;
|
|
68
80
|
//# sourceMappingURL=ng-ast-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-ast-utils.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/ng-ast-utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH
|
|
1
|
+
{"version":3,"file":"ng-ast-utils.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/ng-ast-utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAAuE;AACvE,2CAAgD;AAChD,iCAAiC;AACjC,2CAAuD;AACvD,4CAAiE;AAEjE,SAAgB,uBAAuB,CAAC,IAAU,EAAE,QAAgB;IAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAErF,MAAM,QAAQ,GAAG,IAAA,0BAAc,EAAC,MAAM,CAAC,CAAC;IAExC,IAAI,aAAa,GAA6B,IAAI,CAAC;IAEnD,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;QAC3B,IAAI,iBAAiB,GAAmB,IAAI,CAAC;QAC7C,iBAAiB,GAAG,IAAA,oBAAQ,EAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEhF,oDAAoD;QACpD,OACE,iBAAiB;YACjB,iBAAiB,CAAC,MAAM;YACxB,iBAAiB,CAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,EAC9D;YACA,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC;SAC9C;QAED,IACE,iBAAiB,KAAK,IAAI;YAC1B,iBAAiB,CAAC,MAAM,KAAK,SA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,QAAgB;IAC3D,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,IAAA,YAAI,EAAC,OAAO,EAAE,GAAG,kBAAkB,KAAK,CAAC,CAAC;IAE7D,OAAO,UAAU,CAAC;AACpB,CAAC;AAND,4CAMC;AAED,SAAgB,eAAe,CAAC,IAAU,EAAE,QAAgB;IAC1D,IAAI;QACF,IAAA,mCAA4B,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,YAAY,gCAAmB,EAAE;YACxC,OAAO,KAAK,CAAC;SACd;QAED,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AAZD,0CAYC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Path } from '@angular-devkit/core';
|
|
9
9
|
export interface Location {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.parseName = void 0;
|
package/utils/angular/paths.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
export declare function relativePathToWorkspaceRoot(projectRoot: string | undefined): string;
|
package/utils/angular/paths.js
CHANGED
|
@@ -4,19 +4,16 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.relativePathToWorkspaceRoot = void 0;
|
|
11
|
-
const
|
|
11
|
+
const posix_1 = require("node:path/posix");
|
|
12
12
|
function relativePathToWorkspaceRoot(projectRoot) {
|
|
13
|
-
|
|
14
|
-
if (normalizedPath.length === 0 || !normalizedPath[0]) {
|
|
13
|
+
if (!projectRoot) {
|
|
15
14
|
return '.';
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
return normalizedPath.map(() => '..').join('/');
|
|
19
|
-
}
|
|
16
|
+
return (0, posix_1.relative)((0, posix_1.join)('/', projectRoot), '/') || '.';
|
|
20
17
|
}
|
|
21
18
|
exports.relativePathToWorkspaceRoot = relativePathToWorkspaceRoot;
|
|
22
19
|
//# sourceMappingURL=paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/paths.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/paths.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAiD;AAEjD,SAAgB,2BAA2B,CAAC,WAA+B;IACzE,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,IAAA,gBAAQ,EAAC,IAAA,YAAI,EAAC,GAAG,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC;AACtD,CAAC;AAND,kEAMC"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { SchematicsException } from '@angular-devkit/schematics';
|
|
9
|
+
import { ProjectDefinition } from './workspace';
|
|
9
10
|
export declare function targetBuildNotFoundError(): SchematicsException;
|
|
11
|
+
export declare function isUsingApplicationBuilder(project: ProjectDefinition): boolean;
|
|
@@ -4,13 +4,20 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.targetBuildNotFoundError = void 0;
|
|
10
|
+
exports.isUsingApplicationBuilder = exports.targetBuildNotFoundError = void 0;
|
|
11
11
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
+
const workspace_models_1 = require("./workspace-models");
|
|
12
13
|
function targetBuildNotFoundError() {
|
|
13
14
|
return new schematics_1.SchematicsException(`Project target "build" not found.`);
|
|
14
15
|
}
|
|
15
16
|
exports.targetBuildNotFoundError = targetBuildNotFoundError;
|
|
17
|
+
function isUsingApplicationBuilder(project) {
|
|
18
|
+
const buildBuilder = project.targets.get('build')?.builder;
|
|
19
|
+
const isUsingApplicationBuilder = buildBuilder === workspace_models_1.Builders.Application || buildBuilder === workspace_models_1.Builders.BuildApplication;
|
|
20
|
+
return isUsingApplicationBuilder;
|
|
21
|
+
}
|
|
22
|
+
exports.isUsingApplicationBuilder = isUsingApplicationBuilder;
|
|
16
23
|
//# sourceMappingURL=project-targets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-targets.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/project-targets.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAAiE;AAEjE,SAAgB,wBAAwB;IACtC,OAAO,IAAI,gCAAmB,CAAC,mCAAmC,CAAC,CAAC;AACtE,CAAC;AAFD,4DAEC"}
|
|
1
|
+
{"version":3,"file":"project-targets.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/project-targets.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAAiE;AAEjE,yDAA8C;AAE9C,SAAgB,wBAAwB;IACtC,OAAO,IAAI,gCAAmB,CAAC,mCAAmC,CAAC,CAAC;AACtE,CAAC;AAFD,4DAEC;AAED,SAAgB,yBAAyB,CAAC,OAA0B;IAClE,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3D,MAAM,yBAAyB,GAC7B,YAAY,KAAK,2BAAQ,CAAC,WAAW,IAAI,YAAY,KAAK,2BAAQ,CAAC,gBAAgB,CAAC;IAEtF,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAND,8DAMC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/** Data resolved for a bootstrapped component. */
|
|
10
|
+
interface BootstrappedComponentData {
|
|
11
|
+
/** Original name of the component class. */
|
|
12
|
+
componentName: string;
|
|
13
|
+
/** Path under which the component was imported in the main entrypoint. */
|
|
14
|
+
componentImportPathInSameFile: string;
|
|
15
|
+
/** Original name of the NgModule being bootstrapped, null if the app isn't module-based. */
|
|
16
|
+
moduleName: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Path under which the module was imported in the main entrypoint,
|
|
19
|
+
* null if the app isn't module-based.
|
|
20
|
+
*/
|
|
21
|
+
moduleImportPathInSameFile: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Finds the original name and path relative to the `main.ts` of the bootrstrapped app component.
|
|
25
|
+
* @param tree File tree in which to look for the component.
|
|
26
|
+
* @param mainFilePath Path of the `main` file.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveBootstrappedComponentData(tree: Tree, mainFilePath: string): BootstrappedComponentData | null;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.resolveBootstrappedComponentData = void 0;
|
|
11
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
+
const ts = require("typescript");
|
|
13
|
+
const ast_utils_1 = require("../ast-utils");
|
|
14
|
+
const ng_ast_utils_1 = require("../ng-ast-utils");
|
|
15
|
+
const util_1 = require("./util");
|
|
16
|
+
/**
|
|
17
|
+
* Finds the original name and path relative to the `main.ts` of the bootrstrapped app component.
|
|
18
|
+
* @param tree File tree in which to look for the component.
|
|
19
|
+
* @param mainFilePath Path of the `main` file.
|
|
20
|
+
*/
|
|
21
|
+
function resolveBootstrappedComponentData(tree, mainFilePath) {
|
|
22
|
+
// First try to resolve for a standalone app.
|
|
23
|
+
try {
|
|
24
|
+
const call = (0, util_1.findBootstrapApplicationCall)(tree, mainFilePath);
|
|
25
|
+
if (call.arguments.length > 0 && ts.isIdentifier(call.arguments[0])) {
|
|
26
|
+
const resolved = resolveIdentifier(call.arguments[0]);
|
|
27
|
+
if (resolved) {
|
|
28
|
+
return {
|
|
29
|
+
componentName: resolved.name,
|
|
30
|
+
componentImportPathInSameFile: resolved.path,
|
|
31
|
+
moduleName: null,
|
|
32
|
+
moduleImportPathInSameFile: null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
// `findBootstrapApplicationCall` will throw if it can't find the `bootrstrapApplication` call.
|
|
39
|
+
// Catch so we can continue to the fallback logic.
|
|
40
|
+
if (!(e instanceof schematics_1.SchematicsException)) {
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Otherwise fall back to resolving an NgModule-based app.
|
|
45
|
+
return resolveNgModuleBasedData(tree, mainFilePath);
|
|
46
|
+
}
|
|
47
|
+
exports.resolveBootstrappedComponentData = resolveBootstrappedComponentData;
|
|
48
|
+
/** Resolves the bootstrap data for a NgModule-based app. */
|
|
49
|
+
function resolveNgModuleBasedData(tree, mainFilePath) {
|
|
50
|
+
const appModulePath = (0, ng_ast_utils_1.getAppModulePath)(tree, mainFilePath);
|
|
51
|
+
const appModuleFile = (0, util_1.getSourceFile)(tree, appModulePath);
|
|
52
|
+
const metadataNodes = (0, ast_utils_1.getDecoratorMetadata)(appModuleFile, 'NgModule', '@angular/core');
|
|
53
|
+
for (const node of metadataNodes) {
|
|
54
|
+
if (!ts.isObjectLiteralExpression(node)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const bootstrapProp = (0, ast_utils_1.getMetadataField)(node, 'bootstrap').find(prop => {
|
|
58
|
+
return (ts.isArrayLiteralExpression(prop.initializer) &&
|
|
59
|
+
prop.initializer.elements.length > 0 &&
|
|
60
|
+
ts.isIdentifier(prop.initializer.elements[0]));
|
|
61
|
+
});
|
|
62
|
+
const componentIdentifier = (bootstrapProp?.initializer)
|
|
63
|
+
.elements[0];
|
|
64
|
+
const componentResult = componentIdentifier ? resolveIdentifier(componentIdentifier) : null;
|
|
65
|
+
const bootstrapCall = (0, ng_ast_utils_1.findBootstrapModuleCall)(tree, mainFilePath);
|
|
66
|
+
if (componentResult &&
|
|
67
|
+
bootstrapCall &&
|
|
68
|
+
bootstrapCall.arguments.length > 0 &&
|
|
69
|
+
ts.isIdentifier(bootstrapCall.arguments[0])) {
|
|
70
|
+
const moduleResult = resolveIdentifier(bootstrapCall.arguments[0]);
|
|
71
|
+
if (moduleResult) {
|
|
72
|
+
return {
|
|
73
|
+
componentName: componentResult.name,
|
|
74
|
+
componentImportPathInSameFile: componentResult.path,
|
|
75
|
+
moduleName: moduleResult.name,
|
|
76
|
+
moduleImportPathInSameFile: moduleResult.path,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
/** Resolves an identifier to its original name and path that it was imported from. */
|
|
84
|
+
function resolveIdentifier(identifier) {
|
|
85
|
+
const sourceFile = identifier.getSourceFile();
|
|
86
|
+
// Try to resolve the import path by looking at the top-level named imports of the file.
|
|
87
|
+
for (const node of sourceFile.statements) {
|
|
88
|
+
if (!ts.isImportDeclaration(node) ||
|
|
89
|
+
!ts.isStringLiteral(node.moduleSpecifier) ||
|
|
90
|
+
!node.importClause ||
|
|
91
|
+
!node.importClause.namedBindings ||
|
|
92
|
+
!ts.isNamedImports(node.importClause.namedBindings)) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
for (const element of node.importClause.namedBindings.elements) {
|
|
96
|
+
if (element.name.text === identifier.text) {
|
|
97
|
+
return {
|
|
98
|
+
// Note that we use `propertyName` if available, because it contains
|
|
99
|
+
// the real name in the case where the import is aliased.
|
|
100
|
+
name: (element.propertyName || element.name).text,
|
|
101
|
+
path: node.moduleSpecifier.text,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=app_component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app_component.js","sourceRoot":"","sources":["../../../../../../packages/schematics/src/utils/angular/standalone/app_component.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAAuE;AACvE,iCAAiC;AACjC,4CAAsE;AACtE,kDAA4E;AAC5E,iCAAqE;AAoBrE;;;;GAIG;AACH,SAAgB,gCAAgC,CAC9C,IAAU,EACV,YAAoB;IAEpB,6CAA6C;IAC7C,IAAI;QACF,MAAM,IAAI,GAAG,IAAA,mCAA4B,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAE9D,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;YACnE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAEtD,IAAI,QAAQ,EAAE;gBACZ,OAAO;oBACL,aAAa,EAAE,QAAQ,CAAC,IAAI;oBAC5B,6BAA6B,EAAE,QAAQ,CAAC,IAAI;oBAC5C,UAAU,EAAE,IAAI;oBAChB,0BAA0B,EAAE,IAAI;iBACjC,CAAC;aACH;SACF;KACF;IAAC,OAAO,CAAC,EAAE;QACV,+FAA+F;QAC/F,kDAAkD;QAClD,IAAI,CAAC,CAAC,CAAC,YAAY,gCAAmB,CAAC,EAAE;YACvC,MAAM,CAAC,CAAC;SACT;KACF;IAED,0DAA0D;IAC1D,OAAO,wBAAwB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACtD,CAAC;AA9BD,4EA8BC;AA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