@schematics/angular 20.2.2 → 21.0.0-next.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.
- package/app-shell/index.d.ts +2 -1
- package/app-shell/index.js +16 -24
- package/application/index.js +9 -0
- package/application/schema.d.ts +2 -1
- package/application/schema.js +1 -0
- package/application/schema.json +6 -2
- package/collection.json +7 -0
- package/component/index.d.ts +2 -1
- package/component/index.js +45 -53
- package/config/.browserslistrc +5 -5
- package/config/index.d.ts +2 -1
- package/config/index.js +12 -19
- package/directive/index.d.ts +2 -1
- package/directive/index.js +20 -27
- package/migrations/migration-collection.json +2 -22
- package/module/index.d.ts +2 -1
- package/module/index.js +48 -50
- package/ng-new/schema.d.ts +2 -2
- package/ng-new/schema.js +1 -1
- package/ng-new/schema.json +2 -2
- package/package.json +4 -4
- package/pipe/index.d.ts +2 -2
- package/pipe/index.js +16 -18
- package/server/index.d.ts +2 -1
- package/server/index.js +67 -71
- package/service-worker/index.d.ts +2 -1
- package/service-worker/index.js +44 -81
- package/ssr/index.d.ts +2 -1
- package/ssr/index.js +32 -40
- package/tailwind/files/.postcssrc.json.template +5 -0
- package/{migrations/previous-style-guide/migration.d.ts → tailwind/index.d.ts} +5 -2
- package/tailwind/index.js +51 -0
- package/tailwind/schema.d.ts +7 -0
- package/tailwind/schema.js +4 -0
- package/tailwind/schema.json +15 -0
- package/utility/ast-utils.js +10 -7
- package/utility/latest-versions/package.json +2 -0
- package/utility/latest-versions.js +5 -5
- package/utility/project.d.ts +25 -0
- package/utility/project.js +30 -0
- package/utility/standalone/rules.js +2 -3
- package/web-worker/index.d.ts +2 -1
- package/web-worker/index.js +60 -70
- package/workspace/schema.d.ts +0 -1
- package/workspace/schema.js +0 -1
- package/workspace/schema.json +1 -1
- package/migrations/previous-style-guide/migration.js +0 -42
- package/migrations/replace-provide-server-rendering-import/migration.d.ts +0 -9
- package/migrations/replace-provide-server-rendering-import/migration.js +0 -98
- package/migrations/replace-provide-server-routing/migration.d.ts +0 -9
- package/migrations/replace-provide-server-routing/migration.js +0 -125
- package/migrations/update-module-resolution/migration.d.ts +0 -9
- package/migrations/update-module-resolution/migration.js +0 -52
|
@@ -1,125 +0,0 @@
|
|
|
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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.default = default_1;
|
|
44
|
-
const ts = __importStar(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
45
|
-
const dependencies_1 = require("../../utility/dependencies");
|
|
46
|
-
function* visit(directory) {
|
|
47
|
-
for (const path of directory.subfiles) {
|
|
48
|
-
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
|
|
49
|
-
const entry = directory.file(path);
|
|
50
|
-
if (entry) {
|
|
51
|
-
const content = entry.content;
|
|
52
|
-
if ((content.includes('provideServerRouting') ||
|
|
53
|
-
content.includes('provideServerRoutesConfig')) &&
|
|
54
|
-
content.includes('@angular/ssr')) {
|
|
55
|
-
// Only need to rename the import so we can just string replacements.
|
|
56
|
-
yield [entry.path, content.toString()];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
for (const path of directory.subdirs) {
|
|
62
|
-
if (path === 'node_modules' || path.startsWith('.')) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
yield* visit(directory.dir(path));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function default_1() {
|
|
69
|
-
return async (tree) => {
|
|
70
|
-
if (!(0, dependencies_1.getPackageJsonDependency)(tree, '@angular/ssr')) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
for (const [filePath, content] of visit(tree.root)) {
|
|
74
|
-
const recorder = tree.beginUpdate(filePath);
|
|
75
|
-
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
76
|
-
function visit(node) {
|
|
77
|
-
if (ts.isPropertyAssignment(node) &&
|
|
78
|
-
ts.isIdentifier(node.name) &&
|
|
79
|
-
node.name.text === 'providers' &&
|
|
80
|
-
ts.isArrayLiteralExpression(node.initializer)) {
|
|
81
|
-
const providersArray = node.initializer;
|
|
82
|
-
const newProviders = providersArray.elements
|
|
83
|
-
.filter((el) => {
|
|
84
|
-
return !(ts.isCallExpression(el) &&
|
|
85
|
-
ts.isIdentifier(el.expression) &&
|
|
86
|
-
el.expression.text === 'provideServerRendering');
|
|
87
|
-
})
|
|
88
|
-
.map((el) => {
|
|
89
|
-
if (ts.isCallExpression(el) &&
|
|
90
|
-
ts.isIdentifier(el.expression) &&
|
|
91
|
-
(el.expression.text === 'provideServerRouting' ||
|
|
92
|
-
el.expression.text === 'provideServerRoutesConfig')) {
|
|
93
|
-
const [withRouteVal, ...others] = el.arguments.map((arg) => arg.getText());
|
|
94
|
-
return `provideServerRendering(withRoutes(${withRouteVal})${others.length ? ', ' + others.join(', ') : ''})`;
|
|
95
|
-
}
|
|
96
|
-
return el.getText();
|
|
97
|
-
});
|
|
98
|
-
// Update the 'providers' array in the source file
|
|
99
|
-
recorder.remove(providersArray.getStart(), providersArray.getWidth());
|
|
100
|
-
recorder.insertRight(providersArray.getStart(), `[${newProviders.join(', ')}]`);
|
|
101
|
-
}
|
|
102
|
-
ts.forEachChild(node, visit);
|
|
103
|
-
}
|
|
104
|
-
// Visit all nodes to update 'providers'
|
|
105
|
-
visit(sourceFile);
|
|
106
|
-
// Update imports by removing 'provideServerRouting'
|
|
107
|
-
const importDecl = sourceFile.statements.find((stmt) => ts.isImportDeclaration(stmt) &&
|
|
108
|
-
ts.isStringLiteral(stmt.moduleSpecifier) &&
|
|
109
|
-
stmt.moduleSpecifier.text === '@angular/ssr');
|
|
110
|
-
if (importDecl?.importClause?.namedBindings) {
|
|
111
|
-
const namedBindings = importDecl?.importClause.namedBindings;
|
|
112
|
-
if (ts.isNamedImports(namedBindings)) {
|
|
113
|
-
const elements = namedBindings.elements;
|
|
114
|
-
const updatedElements = elements
|
|
115
|
-
.map((el) => el.getText())
|
|
116
|
-
.filter((x) => x !== 'provideServerRouting' && x !== 'provideServerRoutesConfig');
|
|
117
|
-
updatedElements.push('withRoutes');
|
|
118
|
-
recorder.remove(namedBindings.getStart(), namedBindings.getWidth());
|
|
119
|
-
recorder.insertLeft(namedBindings.getStart(), `{ ${updatedElements.sort().join(', ')} }`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
tree.commitUpdate(recorder);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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 { Rule } from '@angular-devkit/schematics';
|
|
9
|
-
export default function (): Rule;
|
|
@@ -1,52 +0,0 @@
|
|
|
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.default = default_1;
|
|
11
|
-
const json_file_1 = require("../../utility/json-file");
|
|
12
|
-
const workspace_1 = require("../../utility/workspace");
|
|
13
|
-
function default_1() {
|
|
14
|
-
return async (host) => {
|
|
15
|
-
const uniqueTsConfigs = new Set();
|
|
16
|
-
if (host.exists('tsconfig.json')) {
|
|
17
|
-
// Workspace level tsconfig
|
|
18
|
-
uniqueTsConfigs.add('tsconfig.json');
|
|
19
|
-
}
|
|
20
|
-
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
21
|
-
for (const [, target] of (0, workspace_1.allWorkspaceTargets)(workspace)) {
|
|
22
|
-
for (const [, opt] of (0, workspace_1.allTargetOptions)(target)) {
|
|
23
|
-
if (typeof opt?.tsConfig === 'string') {
|
|
24
|
-
uniqueTsConfigs.add(opt.tsConfig);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
for (const tsConfig of uniqueTsConfigs) {
|
|
29
|
-
if (host.exists(tsConfig)) {
|
|
30
|
-
updateModuleResolution(host, tsConfig);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function updateModuleResolution(host, tsConfigPath) {
|
|
36
|
-
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
37
|
-
const jsonPath = ['compilerOptions'];
|
|
38
|
-
const compilerOptions = json.get(jsonPath);
|
|
39
|
-
if (compilerOptions && typeof compilerOptions === 'object') {
|
|
40
|
-
const { moduleResolution, module } = compilerOptions;
|
|
41
|
-
if (typeof moduleResolution !== 'string' || moduleResolution.toLowerCase() === 'bundler') {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (typeof module === 'string' && module.toLowerCase() === 'preserve') {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
json.modify(jsonPath, {
|
|
48
|
-
...compilerOptions,
|
|
49
|
-
'moduleResolution': 'bundler',
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|