@schematics/angular 20.0.1 → 20.0.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/application/index.js +11 -3
- 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/server/index.js +8 -0
- package/utility/find-module.d.ts +4 -2
- package/utility/find-module.js +23 -12
- package/utility/latest-versions.js +3 -3
package/application/index.js
CHANGED
|
@@ -31,10 +31,10 @@ function addTsProjectReference(...paths) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function default_1(options) {
|
|
34
|
-
return async (host
|
|
34
|
+
return async (host) => {
|
|
35
35
|
const { appDir, appRootSelector, componentOptions, folderName, sourceDir } = await getAppOptions(host, options);
|
|
36
36
|
return (0, schematics_1.chain)([
|
|
37
|
-
addAppToWorkspaceFile(options, appDir
|
|
37
|
+
addAppToWorkspaceFile(options, appDir),
|
|
38
38
|
addTsProjectReference('./' + (0, core_1.join)((0, core_1.normalize)(appDir), 'tsconfig.app.json')),
|
|
39
39
|
options.skipTests || options.minimal
|
|
40
40
|
? (0, schematics_1.noop)()
|
|
@@ -49,6 +49,7 @@ function default_1(options) {
|
|
|
49
49
|
routingScope: 'Root',
|
|
50
50
|
path: sourceDir,
|
|
51
51
|
project: options.name,
|
|
52
|
+
typeSeparator: undefined,
|
|
52
53
|
}),
|
|
53
54
|
(0, schematics_1.schematic)('component', {
|
|
54
55
|
name: 'app',
|
|
@@ -128,13 +129,20 @@ function addDependenciesToPackageJson(options) {
|
|
|
128
129
|
version: latest_versions_1.latestVersions['zone.js'],
|
|
129
130
|
});
|
|
130
131
|
}
|
|
132
|
+
if (options.style === schema_1.Style.Less) {
|
|
133
|
+
(0, dependencies_1.addPackageJsonDependency)(host, {
|
|
134
|
+
type: dependencies_1.NodeDependencyType.Dev,
|
|
135
|
+
name: 'less',
|
|
136
|
+
version: latest_versions_1.latestVersions['less'],
|
|
137
|
+
});
|
|
138
|
+
}
|
|
131
139
|
if (!options.skipInstall) {
|
|
132
140
|
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
133
141
|
}
|
|
134
142
|
return host;
|
|
135
143
|
};
|
|
136
144
|
}
|
|
137
|
-
function addAppToWorkspaceFile(options, appDir
|
|
145
|
+
function addAppToWorkspaceFile(options, appDir) {
|
|
138
146
|
let projectRoot = appDir;
|
|
139
147
|
if (projectRoot) {
|
|
140
148
|
projectRoot += '/';
|
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.0.3",
|
|
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.0.3",
|
|
26
|
+
"@angular-devkit/schematics": "20.0.3",
|
|
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/server/index.js
CHANGED
|
@@ -95,6 +95,14 @@ function updateConfigFileApplicationBuilder(options) {
|
|
|
95
95
|
function updateTsConfigFile(tsConfigPath) {
|
|
96
96
|
return (host) => {
|
|
97
97
|
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
98
|
+
// Skip adding the files entry if the server entry would already be included.
|
|
99
|
+
const include = json.get(['include']);
|
|
100
|
+
if (!Array.isArray(include) || !include.includes('src/**/*.ts')) {
|
|
101
|
+
const filesPath = ['files'];
|
|
102
|
+
const files = new Set(json.get(filesPath) ?? []);
|
|
103
|
+
files.add('src/' + serverMainEntryName);
|
|
104
|
+
json.modify(filesPath, [...files]);
|
|
105
|
+
}
|
|
98
106
|
const typePath = ['compilerOptions', 'types'];
|
|
99
107
|
const types = new Set(json.get(typePath) ?? []);
|
|
100
108
|
types.add('node');
|
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]);
|
|
@@ -16,7 +16,7 @@ exports.latestVersions = {
|
|
|
16
16
|
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
|
|
17
17
|
Angular: '^20.0.0',
|
|
18
18
|
NgPackagr: '^20.0.0',
|
|
19
|
-
DevkitBuildAngular: '^20.0.
|
|
20
|
-
AngularBuild: '^20.0.
|
|
21
|
-
AngularSSR: '^20.0.
|
|
19
|
+
DevkitBuildAngular: '^20.0.3',
|
|
20
|
+
AngularBuild: '^20.0.3',
|
|
21
|
+
AngularSSR: '^20.0.3',
|
|
22
22
|
};
|