@nx/angular 21.0.0-beta.4 → 21.0.0-beta.6
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/fesm2022/nx-angular.mjs +0 -352
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.json +2 -2
- package/index.d.ts +1 -1
- package/migrations.json +18 -69
- package/package.json +9 -14
- package/src/builders/dev-server/schema.d.ts +3 -0
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/webpack-browser/schema.d.ts +0 -5
- package/src/builders/webpack-browser/webpack-browser.impl.js +3 -4
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -0
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
- package/src/generators/application/application.js +6 -0
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
- package/src/generators/application/lib/add-e2e.js +0 -7
- package/src/generators/convert-to-rspack/convert-to-rspack.js +20 -10
- package/src/generators/convert-to-rspack/lib/create-config.js +14 -17
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +5 -3
- package/src/generators/move/move.d.ts +3 -0
- package/src/generators/move/move.js +3 -0
- package/src/generators/ngrx/ngrx.d.ts +3 -0
- package/src/generators/ngrx/ngrx.js +3 -0
- package/src/generators/ngrx/schema.json +1 -1
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
- package/src/migrations/{update-16-1-0/remove-ngcc-invocation.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
- package/src/utils/nx-devkit/ast-utils.d.ts +0 -8
- package/src/utils/nx-devkit/ast-utils.js +7 -12
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/fesm2022/nx-angular-testing.mjs +0 -45
- package/fesm2022/nx-angular-testing.mjs.map +0 -1
- package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
- package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
- package/src/migrations/update-16-1-0/update-angular-cli.d.ts +0 -3
- package/src/migrations/update-16-1-0/update-angular-cli.js +0 -23
- package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
- package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
- package/src/runtime/nx/data-persistence.d.ts +0 -276
- package/testing/index.d.ts +0 -1
- package/testing/ng-package.json +0 -6
- package/testing/src/testing-utils.d.ts +0 -33
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = removeKarmaDefaults;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const GENERATORS = ['application', 'library', 'host', 'remote'];
|
6
|
-
const CANDIDATE_GENERATOR_COLLECTIONS = ['@nrwl/angular', '@nx/angular'];
|
7
|
-
async function removeKarmaDefaults(tree) {
|
8
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
9
|
-
if (nxJson.generators) {
|
10
|
-
const updatedConfig = updateUnitTestRunner(nxJson.generators);
|
11
|
-
if (updatedConfig) {
|
12
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
16
|
-
for (const [projectName, projectConfig] of projects) {
|
17
|
-
if (projectConfig.generators) {
|
18
|
-
const updatedProject = updateUnitTestRunner(projectConfig.generators);
|
19
|
-
if (updatedProject) {
|
20
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
await (0, devkit_1.formatFiles)(tree);
|
25
|
-
}
|
26
|
-
function updateUnitTestRunner(generatorsConfig) {
|
27
|
-
const generators = Object.entries(generatorsConfig);
|
28
|
-
let updatedConfig = false;
|
29
|
-
for (const [generatorName, generatorDefaults] of generators) {
|
30
|
-
if (CANDIDATE_GENERATOR_COLLECTIONS.includes(generatorName)) {
|
31
|
-
for (const possibleGenerator of GENERATORS) {
|
32
|
-
if (generatorDefaults[possibleGenerator] &&
|
33
|
-
generatorDefaults[possibleGenerator]['unitTestRunner'] &&
|
34
|
-
generatorDefaults[possibleGenerator]['unitTestRunner'] === 'karma') {
|
35
|
-
generatorsConfig[generatorName][possibleGenerator]['unitTestRunner'] =
|
36
|
-
undefined;
|
37
|
-
updatedConfig = true;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
if (!GENERATORS.map((v) => `@nrwl/angular:${v}`).includes(generatorName) &&
|
42
|
-
!GENERATORS.map((v) => `@nx/angular:${v}`).includes(generatorName)) {
|
43
|
-
continue;
|
44
|
-
}
|
45
|
-
if (generatorDefaults['unitTestRunner'] &&
|
46
|
-
generatorDefaults['unitTestRunner'] === 'karma') {
|
47
|
-
generatorsConfig[generatorName]['unitTestRunner'] = undefined;
|
48
|
-
updatedConfig = true;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
return updatedConfig;
|
52
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = removeLibraryGeneratorSimpleModuleNameOption;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
async function removeLibraryGeneratorSimpleModuleNameOption(tree) {
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
7
|
-
// update global config
|
8
|
-
const nxJsonUpdated = replaceSimpleModuleNameInConfig(nxJson);
|
9
|
-
if (nxJsonUpdated) {
|
10
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
11
|
-
}
|
12
|
-
// update project configs
|
13
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
14
|
-
for (const [name, project] of projects) {
|
15
|
-
const projectUpdated = replaceSimpleModuleNameInConfig(project);
|
16
|
-
if (projectUpdated) {
|
17
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, project);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
await (0, devkit_1.formatFiles)(tree);
|
21
|
-
}
|
22
|
-
function replaceSimpleModuleNameInConfig(configObject) {
|
23
|
-
if (!configObject?.generators) {
|
24
|
-
return false;
|
25
|
-
}
|
26
|
-
let updated = false;
|
27
|
-
if (configObject.generators['@nrwl/angular']?.['library']?.simpleModuleName) {
|
28
|
-
configObject.generators['@nrwl/angular']['library'].simpleName ??=
|
29
|
-
configObject.generators['@nrwl/angular']['library'].simpleModuleName;
|
30
|
-
delete configObject.generators['@nrwl/angular']['library'].simpleModuleName;
|
31
|
-
updated = true;
|
32
|
-
}
|
33
|
-
else if (configObject.generators['@nrwl/angular:library']?.simpleModuleName) {
|
34
|
-
configObject.generators['@nrwl/angular:library'].simpleName ??=
|
35
|
-
configObject.generators['@nrwl/angular:library'].simpleModuleName;
|
36
|
-
delete configObject.generators['@nrwl/angular:library'].simpleModuleName;
|
37
|
-
updated = true;
|
38
|
-
}
|
39
|
-
return updated;
|
40
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = removeProtractorDefaults;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const GENERATORS = ['application', 'host', 'remote'];
|
6
|
-
const CANDIDATE_GENERATOR_COLLECTIONS = ['@nrwl/angular', '@nx/angular'];
|
7
|
-
async function removeProtractorDefaults(tree) {
|
8
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
9
|
-
if (nxJson.generators) {
|
10
|
-
const updatedConfig = updateE2ETestRunner(nxJson.generators);
|
11
|
-
if (updatedConfig) {
|
12
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
16
|
-
for (const [projectName, projectConfig] of projects) {
|
17
|
-
if (projectConfig.generators) {
|
18
|
-
const updatedProject = updateE2ETestRunner(projectConfig.generators);
|
19
|
-
if (updatedProject) {
|
20
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
await (0, devkit_1.formatFiles)(tree);
|
25
|
-
}
|
26
|
-
function updateE2ETestRunner(generatorsConfig) {
|
27
|
-
const generators = Object.entries(generatorsConfig);
|
28
|
-
let updatedConfig = false;
|
29
|
-
for (const [generatorName, generatorDefaults] of generators) {
|
30
|
-
if (CANDIDATE_GENERATOR_COLLECTIONS.includes(generatorName)) {
|
31
|
-
for (const possibleGenerator of GENERATORS) {
|
32
|
-
if (generatorDefaults[possibleGenerator] &&
|
33
|
-
generatorDefaults[possibleGenerator]['e2eTestRunner'] &&
|
34
|
-
generatorDefaults[possibleGenerator]['e2eTestRunner'] === 'protractor') {
|
35
|
-
generatorsConfig[generatorName][possibleGenerator]['e2eTestRunner'] =
|
36
|
-
undefined;
|
37
|
-
updatedConfig = true;
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
if (!GENERATORS.map((v) => `@nrwl/angular:${v}`).includes(generatorName) &&
|
42
|
-
!GENERATORS.map((v) => `@nx/angular:${v}`).includes(generatorName)) {
|
43
|
-
continue;
|
44
|
-
}
|
45
|
-
if (generatorDefaults['e2eTestRunner'] &&
|
46
|
-
generatorDefaults['e2eTestRunner'] === 'protractor') {
|
47
|
-
generatorsConfig[generatorName]['e2eTestRunner'] = undefined;
|
48
|
-
updatedConfig = true;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
return updatedConfig;
|
52
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = replacePackage;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
6
|
-
async function replacePackage(tree) {
|
7
|
-
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/angular', '@nx/angular');
|
8
|
-
await (0, devkit_1.formatFiles)(tree);
|
9
|
-
}
|
@@ -1,127 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = extractStandaloneConfig;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
-
const path_1 = require("path");
|
7
|
-
const projects_1 = require("../utils/projects");
|
8
|
-
let tsModule;
|
9
|
-
let tsquery;
|
10
|
-
function getBootstrapCallFileInfo(tree, project, mainFilePath) {
|
11
|
-
const IMPORT_BOOTSTRAP_FILE = 'CallExpression:has(ImportKeyword) > StringLiteral';
|
12
|
-
let bootstrapCallFilePath = mainFilePath;
|
13
|
-
let bootstrapCallFileContents = tree.read(bootstrapCallFilePath, 'utf-8');
|
14
|
-
const ast = tsquery.ast(bootstrapCallFileContents);
|
15
|
-
const importBootstrapNodes = tsquery(ast, IMPORT_BOOTSTRAP_FILE, {
|
16
|
-
visitAllChildren: true,
|
17
|
-
});
|
18
|
-
if (importBootstrapNodes.length > 0 &&
|
19
|
-
importBootstrapNodes[0].getText().includes('./bootstrap')) {
|
20
|
-
bootstrapCallFilePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'bootstrap.ts');
|
21
|
-
bootstrapCallFileContents = tree.read(bootstrapCallFilePath, 'utf-8');
|
22
|
-
}
|
23
|
-
return { bootstrapCallFilePath, bootstrapCallFileContents };
|
24
|
-
}
|
25
|
-
function getImportTokenMap(bootstrapCallFileContentsAst) {
|
26
|
-
const importTokenMap = new Map();
|
27
|
-
const importedTokensNodes = tsquery(bootstrapCallFileContentsAst, 'ImportDeclaration > ImportClause', { visitAllChildren: true });
|
28
|
-
for (const node of importedTokensNodes) {
|
29
|
-
importTokenMap.set(node.getText(), node.parent.getText());
|
30
|
-
}
|
31
|
-
return importTokenMap;
|
32
|
-
}
|
33
|
-
function getImportsRequiredForAppConfig(importTokenMap, appConfigNode, oldSourceFilePath, newSourceFilePath) {
|
34
|
-
const identifiers = tsquery.query(appConfigNode, 'Identifier:not(PropertyAssignment > Identifier)', { visitAllChildren: true });
|
35
|
-
const appConfigImports = new Set();
|
36
|
-
const originalImportsToRemove = new Set();
|
37
|
-
for (const identifier of identifiers) {
|
38
|
-
for (const key of importTokenMap.keys()) {
|
39
|
-
if (!key.includes(identifier.getText())) {
|
40
|
-
continue;
|
41
|
-
}
|
42
|
-
let importText = importTokenMap.get(key);
|
43
|
-
originalImportsToRemove.add(importText);
|
44
|
-
if (oldSourceFilePath === newSourceFilePath ||
|
45
|
-
oldSourceFilePath.split('/').length ===
|
46
|
-
newSourceFilePath.split('/').length) {
|
47
|
-
appConfigImports.add(importText);
|
48
|
-
continue;
|
49
|
-
}
|
50
|
-
const importPath = tsquery
|
51
|
-
.query(importText, 'StringLiteral', {
|
52
|
-
visitAllChildren: true,
|
53
|
-
})[0]
|
54
|
-
.getText()
|
55
|
-
.replace(/'/g, '')
|
56
|
-
.replace(/"/g, '');
|
57
|
-
if (importPath.startsWith('.')) {
|
58
|
-
const resolvedImportPath = (0, path_1.resolve)((0, path_1.dirname)(oldSourceFilePath), importPath);
|
59
|
-
const newRelativeImportPath = (0, path_1.relative)((0, path_1.dirname)(newSourceFilePath), resolvedImportPath);
|
60
|
-
importText = importText.replace(importPath, newRelativeImportPath.startsWith('.')
|
61
|
-
? newRelativeImportPath
|
62
|
-
: `./${newRelativeImportPath}`);
|
63
|
-
}
|
64
|
-
appConfigImports.add(importText);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return {
|
68
|
-
appConfigImports: Array.from(appConfigImports),
|
69
|
-
importsToRemoveFromSource: Array.from(originalImportsToRemove),
|
70
|
-
};
|
71
|
-
}
|
72
|
-
function getAppConfigFileContents(importsRequiredForAppConfig, appConfigText) {
|
73
|
-
const buildAppConfigFileContents = (importStatements, appConfig) => `import { ApplicationConfig } from '@angular/core';${importStatements.join('\n')}
|
74
|
-
export const appConfig: ApplicationConfig = ${appConfig}`;
|
75
|
-
const appConfigFileContents = buildAppConfigFileContents(importsRequiredForAppConfig, appConfigText);
|
76
|
-
return appConfigFileContents;
|
77
|
-
}
|
78
|
-
function getBootstrapCallFileContents(bootstrapCallFileContents, appConfigNode, importsRequiredForAppConfig) {
|
79
|
-
let newBootstrapCallFileContents = `import { appConfig } from './app/app.config';
|
80
|
-
${bootstrapCallFileContents.slice(0, appConfigNode.getStart())}appConfig${bootstrapCallFileContents.slice(appConfigNode.getEnd())}`;
|
81
|
-
for (const importStatement of importsRequiredForAppConfig) {
|
82
|
-
newBootstrapCallFileContents = newBootstrapCallFileContents.replace(importStatement, '');
|
83
|
-
}
|
84
|
-
return newBootstrapCallFileContents;
|
85
|
-
}
|
86
|
-
async function extractStandaloneConfig(tree) {
|
87
|
-
if (!tsModule) {
|
88
|
-
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
89
|
-
}
|
90
|
-
if (!tsquery) {
|
91
|
-
tsquery = require('@phenomnomnominal/tsquery').tsquery;
|
92
|
-
}
|
93
|
-
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
|
94
|
-
'npm:@angular/core',
|
95
|
-
]);
|
96
|
-
const BOOTSTRAP_APPLICATION_CALL_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication])';
|
97
|
-
const BOOTSTRAP_APPLICATION_CALL_CONFIG_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication]) > ObjectLiteralExpression';
|
98
|
-
for (const { project } of projects) {
|
99
|
-
if (project.projectType !== 'application') {
|
100
|
-
continue;
|
101
|
-
}
|
102
|
-
if (project.targets?.build?.options?.main === undefined) {
|
103
|
-
continue;
|
104
|
-
}
|
105
|
-
const { bootstrapCallFilePath, bootstrapCallFileContents } = getBootstrapCallFileInfo(tree, project, project.targets.build.options.main);
|
106
|
-
const bootstrapCallFileContentsAst = tsquery.ast(bootstrapCallFileContents);
|
107
|
-
const nodes = tsquery(bootstrapCallFileContentsAst, BOOTSTRAP_APPLICATION_CALL_SELECTOR, { visitAllChildren: true });
|
108
|
-
if (nodes.length === 0) {
|
109
|
-
continue;
|
110
|
-
}
|
111
|
-
const importTokenMap = getImportTokenMap(bootstrapCallFileContentsAst);
|
112
|
-
const bootstrapCallNode = nodes[0];
|
113
|
-
const appConfigNodes = tsquery(bootstrapCallNode, BOOTSTRAP_APPLICATION_CALL_CONFIG_SELECTOR, { visitAllChildren: true });
|
114
|
-
if (appConfigNodes.length === 0) {
|
115
|
-
continue;
|
116
|
-
}
|
117
|
-
const appConfigNode = appConfigNodes[0];
|
118
|
-
const appConfigText = appConfigNode.getText();
|
119
|
-
const appConfigFilePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.config.ts');
|
120
|
-
const { appConfigImports, importsToRemoveFromSource } = getImportsRequiredForAppConfig(importTokenMap, appConfigNode, bootstrapCallFilePath, appConfigFilePath);
|
121
|
-
const appConfigFileContents = getAppConfigFileContents(appConfigImports, appConfigText);
|
122
|
-
tree.write(appConfigFilePath, appConfigFileContents);
|
123
|
-
let newBootstrapCallFileContents = getBootstrapCallFileContents(bootstrapCallFileContents, appConfigNode, importsToRemoveFromSource);
|
124
|
-
tree.write(bootstrapCallFilePath, newBootstrapCallFileContents);
|
125
|
-
}
|
126
|
-
await (0, devkit_1.formatFiles)(tree);
|
127
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
async function default_1(tree) {
|
6
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
7
|
-
if (!json.scripts?.postinstall?.includes('ngcc ')) {
|
8
|
-
return json;
|
9
|
-
}
|
10
|
-
json.scripts.postinstall = json.scripts.postinstall
|
11
|
-
// special case when ngcc is at the start so we remove the && as well
|
12
|
-
.replace(/^(ngcc.*?&& *)(.*)/, '$2')
|
13
|
-
// everything else
|
14
|
-
.replace(/(.*?)((&& *)?ngcc.*?)((?=&)|$)(.*)/, '$1$5')
|
15
|
-
.trim();
|
16
|
-
if (json.scripts.postinstall === '') {
|
17
|
-
json.scripts.postinstall = undefined;
|
18
|
-
}
|
19
|
-
return json;
|
20
|
-
});
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
22
|
-
}
|
@@ -1,62 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
6
|
-
const ts = tslib_1.__importStar(require("typescript"));
|
7
|
-
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
8
|
-
async function default_1(tree) {
|
9
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
|
10
|
-
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
|
11
|
-
const content = tree.read(path, 'utf8');
|
12
|
-
if (content.includes('@angular/platform-server') &&
|
13
|
-
content.includes('renderModule')) {
|
14
|
-
const source = ts.createSourceFile(path, content.toString().replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
|
15
|
-
let recorder;
|
16
|
-
let printer;
|
17
|
-
ts.forEachChild(source, function analyze(node) {
|
18
|
-
if (!(ts.isExportDeclaration(node) &&
|
19
|
-
node.moduleSpecifier &&
|
20
|
-
ts.isStringLiteral(node.moduleSpecifier) &&
|
21
|
-
node.moduleSpecifier.text === '@angular/platform-server' &&
|
22
|
-
node.exportClause &&
|
23
|
-
ts.isNamedExports(node.exportClause))) {
|
24
|
-
// Not a @angular/platform-server named export.
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
const exportClause = node.exportClause;
|
28
|
-
const newElements = [];
|
29
|
-
for (const element of exportClause.elements) {
|
30
|
-
if (element.name.text !== 'renderModule') {
|
31
|
-
newElements.push(element);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
if (newElements.length === exportClause.elements.length) {
|
35
|
-
// No changes
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
recorder ??= new file_change_recorder_1.FileChangeRecorder(tree, path);
|
39
|
-
if (newElements.length) {
|
40
|
-
// Update named exports as there are leftovers.
|
41
|
-
const newExportClause = ts.factory.updateNamedExports(exportClause, newElements);
|
42
|
-
printer ??= ts.createPrinter();
|
43
|
-
const fix = printer.printNode(ts.EmitHint.Unspecified, newExportClause, source);
|
44
|
-
const index = exportClause.getStart();
|
45
|
-
const length = exportClause.getWidth();
|
46
|
-
recorder.remove(index, index + length);
|
47
|
-
recorder.insertLeft(index, fix);
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
// Delete export as no exports remain.
|
51
|
-
recorder.remove(node.getStart(), node.getStart() + node.getWidth());
|
52
|
-
}
|
53
|
-
ts.forEachChild(node, analyze);
|
54
|
-
});
|
55
|
-
if (recorder) {
|
56
|
-
recorder.applyChanges();
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
});
|
61
|
-
await (0, devkit_1.formatFiles)(tree);
|
62
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.angularCliVersion = void 0;
|
4
|
-
exports.default = default_1;
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
6
|
-
exports.angularCliVersion = '~16.0.0';
|
7
|
-
async function default_1(tree) {
|
8
|
-
let shouldFormat = false;
|
9
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
10
|
-
if (json.devDependencies?.['@angular/cli']) {
|
11
|
-
json.devDependencies['@angular/cli'] = exports.angularCliVersion;
|
12
|
-
shouldFormat = true;
|
13
|
-
}
|
14
|
-
else if (json.dependencies?.['@angular/cli']) {
|
15
|
-
json.dependencies['@angular/cli'] = exports.angularCliVersion;
|
16
|
-
shouldFormat = true;
|
17
|
-
}
|
18
|
-
return json;
|
19
|
-
});
|
20
|
-
if (shouldFormat) {
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
22
|
-
}
|
23
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
-
const executors = [
|
7
|
-
'@angular-devkit/build-angular:server',
|
8
|
-
'@nx/angular:server',
|
9
|
-
'@nrwl/angular:server',
|
10
|
-
];
|
11
|
-
async function default_1(tree) {
|
12
|
-
executors.forEach((executor) => {
|
13
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, executor, (_options, projectName, targetName, configurationName) => {
|
14
|
-
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
15
|
-
const configToUpdate = configurationName
|
16
|
-
? projectConfiguration.targets[targetName].configurations[configurationName]
|
17
|
-
: projectConfiguration.targets[targetName].options;
|
18
|
-
if (configToUpdate?.buildOptimizer === undefined &&
|
19
|
-
configToUpdate?.optimization !== undefined) {
|
20
|
-
configToUpdate.buildOptimizer = !!configToUpdate.optimization;
|
21
|
-
}
|
22
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
23
|
-
});
|
24
|
-
});
|
25
|
-
await (0, devkit_1.formatFiles)(tree);
|
26
|
-
}
|