@schematics/angular 20.0.1 → 20.1.0-next.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/component/index.js +1 -10
- package/directive/index.js +1 -10
- package/module/index.js +4 -13
- package/package.json +3 -3
- package/pipe/index.js +1 -10
- package/utility/find-module.d.ts +4 -2
- package/utility/find-module.js +23 -12
- package/utility/latest-versions.js +5 -5
package/component/index.js
CHANGED
|
@@ -35,16 +35,7 @@ function default_1(options) {
|
|
|
35
35
|
if (options.path === undefined) {
|
|
36
36
|
options.path = (0, workspace_1.buildDefaultPath)(project);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, {
|
|
43
|
-
...options,
|
|
44
|
-
moduleExt: '-module.ts',
|
|
45
|
-
routingModuleExt: '-routing-module.ts',
|
|
46
|
-
});
|
|
47
|
-
}
|
|
38
|
+
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
48
39
|
// Schematic templates require a defined type value
|
|
49
40
|
options.type ??= '';
|
|
50
41
|
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
package/directive/index.js
CHANGED
|
@@ -35,16 +35,7 @@ function default_1(options) {
|
|
|
35
35
|
if (options.path === undefined) {
|
|
36
36
|
options.path = (0, workspace_1.buildDefaultPath)(project);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, {
|
|
43
|
-
...options,
|
|
44
|
-
moduleExt: '-module.ts',
|
|
45
|
-
routingModuleExt: '-routing-module.ts',
|
|
46
|
-
});
|
|
47
|
-
}
|
|
38
|
+
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
48
39
|
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
49
40
|
options.name = parsedPath.name;
|
|
50
41
|
options.path = parsedPath.path;
|
package/module/index.js
CHANGED
|
@@ -99,11 +99,11 @@ function addRouteDeclarationToNgModule(options, routingModulePath) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function getRoutingModulePath(host, modulePath) {
|
|
102
|
-
const routingModulePath = modulePath.endsWith(find_module_1.
|
|
102
|
+
const routingModulePath = modulePath.endsWith(find_module_1.ROUTING_MODULE_EXT_LEGACY) || modulePath.endsWith(find_module_1.ROUTING_MODULE_EXT)
|
|
103
103
|
? modulePath
|
|
104
104
|
: modulePath
|
|
105
|
-
.replace(find_module_1.
|
|
106
|
-
.replace(
|
|
105
|
+
.replace(find_module_1.MODULE_EXT_LEGACY, find_module_1.ROUTING_MODULE_EXT_LEGACY)
|
|
106
|
+
.replace(find_module_1.MODULE_EXT, find_module_1.ROUTING_MODULE_EXT);
|
|
107
107
|
return host.exists(routingModulePath) ? routingModulePath : undefined;
|
|
108
108
|
}
|
|
109
109
|
function buildRoute(options, modulePath) {
|
|
@@ -118,16 +118,7 @@ function default_1(options) {
|
|
|
118
118
|
options.path = await (0, workspace_1.createDefaultPath)(host, options.project);
|
|
119
119
|
}
|
|
120
120
|
if (options.module) {
|
|
121
|
-
|
|
122
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, {
|
|
126
|
-
...options,
|
|
127
|
-
moduleExt: '-module.ts',
|
|
128
|
-
routingModuleExt: '-routing-module.ts',
|
|
129
|
-
});
|
|
130
|
-
}
|
|
121
|
+
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
131
122
|
}
|
|
132
123
|
let routingModulePath;
|
|
133
124
|
const isLazyLoadedModuleGen = !!(options.route && options.module);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematics/angular",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.1.0-next.0",
|
|
4
4
|
"description": "Schematics specific to Angular",
|
|
5
5
|
"homepage": "https://github.com/angular/angular-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"schematics": "./collection.json",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@angular-devkit/core": "20.0.
|
|
26
|
-
"@angular-devkit/schematics": "20.0.
|
|
25
|
+
"@angular-devkit/core": "20.1.0-next.0",
|
|
26
|
+
"@angular-devkit/schematics": "20.1.0-next.0",
|
|
27
27
|
"jsonc-parser": "3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
package/pipe/index.js
CHANGED
|
@@ -18,16 +18,7 @@ const workspace_1 = require("../utility/workspace");
|
|
|
18
18
|
function default_1(options) {
|
|
19
19
|
return async (host) => {
|
|
20
20
|
options.path ??= await (0, workspace_1.createDefaultPath)(host, options.project);
|
|
21
|
-
|
|
22
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, {
|
|
26
|
-
...options,
|
|
27
|
-
moduleExt: '-module.ts',
|
|
28
|
-
routingModuleExt: '-routing-module.ts',
|
|
29
|
-
});
|
|
30
|
-
}
|
|
21
|
+
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
31
22
|
const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
|
|
32
23
|
options.name = parsedPath.name;
|
|
33
24
|
options.path = parsedPath.path;
|
package/utility/find-module.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ export interface ModuleOptions {
|
|
|
17
17
|
routingModuleExt?: string;
|
|
18
18
|
standalone?: boolean;
|
|
19
19
|
}
|
|
20
|
-
export declare const MODULE_EXT = "
|
|
21
|
-
export declare const ROUTING_MODULE_EXT = "-routing
|
|
20
|
+
export declare const MODULE_EXT = "-module.ts";
|
|
21
|
+
export declare const ROUTING_MODULE_EXT = "-routing-module.ts";
|
|
22
|
+
export declare const MODULE_EXT_LEGACY = ".module.ts";
|
|
23
|
+
export declare const ROUTING_MODULE_EXT_LEGACY = "-routing.module.ts";
|
|
22
24
|
/**
|
|
23
25
|
* Find the module referred by a set of options passed to the schematics.
|
|
24
26
|
*/
|
package/utility/find-module.js
CHANGED
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0;
|
|
10
|
+
exports.ROUTING_MODULE_EXT_LEGACY = exports.MODULE_EXT_LEGACY = exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0;
|
|
11
11
|
exports.findModuleFromOptions = findModuleFromOptions;
|
|
12
12
|
exports.findModule = findModule;
|
|
13
13
|
exports.buildRelativePath = buildRelativePath;
|
|
14
14
|
const core_1 = require("@angular-devkit/core");
|
|
15
|
-
exports.MODULE_EXT = '
|
|
16
|
-
exports.ROUTING_MODULE_EXT = '-routing
|
|
15
|
+
exports.MODULE_EXT = '-module.ts';
|
|
16
|
+
exports.ROUTING_MODULE_EXT = '-routing-module.ts';
|
|
17
|
+
exports.MODULE_EXT_LEGACY = '.module.ts';
|
|
18
|
+
exports.ROUTING_MODULE_EXT_LEGACY = '-routing.module.ts';
|
|
17
19
|
/**
|
|
18
20
|
* Find the module referred by a set of options passed to the schematics.
|
|
19
21
|
*/
|
|
@@ -21,11 +23,9 @@ function findModuleFromOptions(host, options) {
|
|
|
21
23
|
if (options.standalone || options.skipImport) {
|
|
22
24
|
return undefined;
|
|
23
25
|
}
|
|
24
|
-
const moduleExt = options.moduleExt || exports.MODULE_EXT;
|
|
25
|
-
const routingModuleExt = options.routingModuleExt || exports.ROUTING_MODULE_EXT;
|
|
26
26
|
if (!options.module) {
|
|
27
27
|
const pathToCheck = (options.path || '') + '/' + options.name;
|
|
28
|
-
return (0, core_1.normalize)(findModule(host, pathToCheck, moduleExt, routingModuleExt));
|
|
28
|
+
return (0, core_1.normalize)(findModule(host, pathToCheck, options.moduleExt, options.routingModuleExt));
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
const modulePath = (0, core_1.normalize)(`/${options.path}/${options.module}`);
|
|
@@ -39,11 +39,18 @@ function findModuleFromOptions(host, options) {
|
|
|
39
39
|
candidateSet.add(dir);
|
|
40
40
|
}
|
|
41
41
|
const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
|
|
42
|
+
const candidateFiles = ['', `${moduleBaseName}.ts`];
|
|
43
|
+
if (options.moduleExt) {
|
|
44
|
+
candidateFiles.push(`${moduleBaseName}${options.moduleExt}`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
candidateFiles.push(`${moduleBaseName}${exports.MODULE_EXT}`, `${moduleBaseName}${exports.MODULE_EXT_LEGACY}`);
|
|
48
|
+
}
|
|
42
49
|
for (const c of candidatesDirs) {
|
|
43
|
-
const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map((x) => (0, core_1.join)(c, x));
|
|
44
50
|
for (const sc of candidateFiles) {
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const scPath = (0, core_1.join)(c, sc);
|
|
52
|
+
if (host.exists(scPath) && host.readText(scPath).includes('@NgModule')) {
|
|
53
|
+
return (0, core_1.normalize)(scPath);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
}
|
|
@@ -54,12 +61,16 @@ function findModuleFromOptions(host, options) {
|
|
|
54
61
|
/**
|
|
55
62
|
* Function to find the "closest" module to a generated file's path.
|
|
56
63
|
*/
|
|
57
|
-
function findModule(host, generateDir, moduleExt
|
|
64
|
+
function findModule(host, generateDir, moduleExt, routingModuleExt) {
|
|
58
65
|
let dir = host.getDir('/' + generateDir);
|
|
59
66
|
let foundRoutingModule = false;
|
|
67
|
+
const moduleExtensions = moduleExt ? [moduleExt] : [exports.MODULE_EXT, exports.MODULE_EXT_LEGACY];
|
|
68
|
+
const routingModuleExtensions = routingModuleExt
|
|
69
|
+
? [routingModuleExt]
|
|
70
|
+
: [exports.ROUTING_MODULE_EXT, exports.ROUTING_MODULE_EXT_LEGACY];
|
|
60
71
|
while (dir) {
|
|
61
|
-
const allMatches = dir.subfiles.filter((p) => p.endsWith(
|
|
62
|
-
const filteredMatches = allMatches.filter((p) => !p.endsWith(
|
|
72
|
+
const allMatches = dir.subfiles.filter((p) => moduleExtensions.some((m) => p.endsWith(m)));
|
|
73
|
+
const filteredMatches = allMatches.filter((p) => !routingModuleExtensions.some((m) => p.endsWith(m)));
|
|
63
74
|
foundRoutingModule = foundRoutingModule || allMatches.length !== filteredMatches.length;
|
|
64
75
|
if (filteredMatches.length == 1) {
|
|
65
76
|
return (0, core_1.join)(dir.path, filteredMatches[0]);
|
|
@@ -14,9 +14,9 @@ const dependencies = require('./latest-versions/package.json')['dependencies'];
|
|
|
14
14
|
exports.latestVersions = {
|
|
15
15
|
...dependencies,
|
|
16
16
|
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
|
|
17
|
-
Angular: '^20.0.0',
|
|
18
|
-
NgPackagr: '^20.0.0',
|
|
19
|
-
DevkitBuildAngular: '^20.0.
|
|
20
|
-
AngularBuild: '^20.0.
|
|
21
|
-
AngularSSR: '^20.0.
|
|
17
|
+
Angular: '^20.1.0-next.0',
|
|
18
|
+
NgPackagr: '^20.1.0-next.0',
|
|
19
|
+
DevkitBuildAngular: '^20.1.0-next.0',
|
|
20
|
+
AngularBuild: '^20.1.0-next.0',
|
|
21
|
+
AngularSSR: '^20.1.0-next.0',
|
|
22
22
|
};
|