@nx/angular 23.0.0-beta.11 → 23.0.0-beta.13
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/migrations.json +0 -533
- package/package.json +8 -8
- package/plugins/component-testing.js +2 -2
- package/src/builders/utilities/buildable-libs.d.ts +1 -1
- package/src/builders/utilities/buildable-libs.d.ts.map +1 -1
- package/src/builders/utilities/buildable-libs.js +3 -3
- package/src/builders/utilities/module-federation.d.ts.map +1 -1
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +1 -1
- package/src/executors/delegate-build/delegate-build.impl.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +2 -2
- package/src/executors/package/package.impl.d.ts +1 -1
- package/src/executors/package/package.impl.d.ts.map +1 -1
- package/src/executors/package/package.impl.js +3 -3
- package/src/executors/utilities/buildable-libs.d.ts +1 -1
- package/src/executors/utilities/buildable-libs.d.ts.map +1 -1
- package/src/executors/utilities/buildable-libs.js +3 -3
- package/src/executors/utilities/esbuild-extensions.js +1 -1
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/add-e2e.js +4 -6
- package/src/generators/application/lib/update-tsconfig-files.js +3 -3
- package/src/generators/component/lib/component.js +2 -2
- package/src/generators/convert-to-with-mf/lib/check-name-matches.js +2 -2
- package/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +2 -2
- package/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +4 -4
- package/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +2 -2
- package/src/generators/federate-module/lib/add-path-to-exposes.js +6 -6
- package/src/generators/host/lib/update-ssr-setup.js +2 -2
- package/src/generators/library/lib/add-children.js +2 -2
- package/src/generators/library/lib/add-load-children.js +2 -2
- package/src/generators/library/lib/add-project.js +2 -2
- package/src/generators/library/lib/create-files.js +2 -2
- package/src/generators/library/lib/update-tsconfig-files.js +3 -3
- package/src/generators/library/library.js +2 -2
- package/src/generators/move/lib/update-module-name.js +2 -2
- package/src/generators/ng-add/migrators/migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/migrator.js +10 -5
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +6 -6
- package/src/generators/ng-add/utilities/workspace.js +6 -6
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +2 -2
- package/src/generators/ngrx-feature-store/lib/add-imports.js +2 -2
- package/src/generators/ngrx-root-store/lib/add-imports.js +2 -2
- package/src/generators/ngrx-root-store/lib/normalize-options.js +2 -2
- package/src/generators/remote/lib/update-ssr-setup.js +2 -2
- package/src/generators/remote/remote.js +2 -2
- package/src/generators/scam/lib/convert-component-to-scam.js +2 -2
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +2 -2
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +2 -2
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +2 -2
- package/src/generators/setup-mf/lib/add-remote-to-host.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +5 -6
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +2 -2
- package/src/generators/setup-ssr/lib/add-hydration.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-hydration.js +3 -4
- package/src/generators/setup-ssr/lib/add-server-file.js +2 -2
- package/src/generators/setup-ssr/lib/generate-files.js +2 -2
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +19 -7
- package/src/generators/utils/add-mf-env-to-inputs.d.ts.map +1 -1
- package/src/generators/utils/add-mf-env-to-inputs.js +16 -9
- package/src/generators/utils/add-vitest.d.ts.map +1 -1
- package/src/generators/utils/add-vitest.js +16 -9
- package/src/generators/utils/app-components-info.js +2 -2
- package/src/generators/utils/find-module.js +2 -2
- package/src/generators/utils/insert-ngmodule-import.js +6 -6
- package/src/generators/utils/storybook-ast/component-info.js +5 -5
- package/src/generators/utils/storybook-ast/module-info.js +9 -9
- package/src/generators/utils/storybook-ast/storybook-inputs.js +4 -4
- package/src/generators/utils/testing.js +2 -2
- package/src/generators/utils/tsconfig-utils.js +2 -2
- package/src/generators/utils/validations.js +2 -2
- package/src/migrations/update-19-6-1/ensure-depends-on-for-mf.d.ts.map +1 -1
- package/src/migrations/update-19-6-1/ensure-depends-on-for-mf.js +25 -18
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.d.ts.map +1 -1
- package/src/migrations/update-20-2-0/remove-tailwind-config-from-ng-packagr-executors.js +43 -10
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +2 -2
- package/src/migrations/update-21-5-0/utils/karma-config-analyzer.js +2 -2
- package/src/migrations/update-22-3-0/update-module-resolution.js +2 -2
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.js +2 -2
- package/src/utils/nx-devkit/ast-utils.d.ts.map +1 -1
- package/src/utils/nx-devkit/ast-utils.js +17 -18
- package/src/utils/nx-devkit/route-utils.js +3 -3
- package/tailwind.js +2 -2
- package/src/migrations/update-17-1-0/browser-target-to-build-target.d.ts +0 -4
- package/src/migrations/update-17-1-0/browser-target-to-build-target.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/browser-target-to-build-target.js +0 -50
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.d.ts +0 -3
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/replace-nguniversal-builders.js +0 -75
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.d.ts +0 -3
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/replace-nguniversal-engines.js +0 -184
- package/src/migrations/update-17-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-17-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/update-angular-cli.js +0 -14
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.d.ts +0 -3
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.d.ts.map +0 -1
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.js +0 -37
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.d.ts +0 -3
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.d.ts.map +0 -1
- package/src/migrations/update-17-2-0/rename-webpack-dev-server.js +0 -40
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.d.ts +0 -3
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/add-autoprefixer-dependency.js +0 -25
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.d.ts +0 -3
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/add-browser-sync-dependency.js +0 -25
- package/src/migrations/update-17-3-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-17-3-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-17-3-0/update-angular-cli.js +0 -14
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +0 -3
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts.map +0 -1
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +0 -26
- package/src/migrations/update-18-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-18-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-18-1-0/update-angular-cli.js +0 -14
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +0 -3
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts.map +0 -1
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +0 -53
- package/src/migrations/update-18-2-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-18-2-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-18-2-0/update-angular-cli.js +0 -14
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-19-1-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-19-1-0/update-angular-cli.js +0 -14
package/tailwind.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/js/internal");
|
|
5
5
|
let hasWarned = false;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated `@nx/angular/tailwind` will be removed in Nx 24. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
|
|
@@ -15,7 +15,7 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/!(*.s
|
|
|
15
15
|
`See: https://nx.dev/docs/technologies/angular/guides/using-tailwind-css-with-angular\n`);
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, internal_1.createGlobPatternsForDependencies)(dirPath, fileGlobPattern);
|
|
19
19
|
}
|
|
20
20
|
catch (e) {
|
|
21
21
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser-target-to-build-target.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-1-0/browser-target-to-build-target.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,SAAS,UAKrB,CAAC;AAEF,yBAA+B,IAAI,EAAE,IAAI,iBA8CxC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executors = void 0;
|
|
4
|
-
exports.default = default_1;
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
exports.executors = [
|
|
8
|
-
'@angular-devkit/build-angular:dev-server',
|
|
9
|
-
'@angular-devkit/build-angular:extract-i18n',
|
|
10
|
-
'@nx/angular:module-federation-dev-server',
|
|
11
|
-
'@nx/angular:webpack-dev-server',
|
|
12
|
-
];
|
|
13
|
-
async function default_1(tree) {
|
|
14
|
-
// update options from project configs
|
|
15
|
-
exports.executors.forEach((executor) => {
|
|
16
|
-
(0, internal_1.forEachExecutorOptions)(tree, executor, (_, project, target, configuration) => {
|
|
17
|
-
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
18
|
-
const config = configuration
|
|
19
|
-
? projectConfiguration.targets[target].configurations[configuration]
|
|
20
|
-
: projectConfiguration.targets[target].options;
|
|
21
|
-
updateConfig(config);
|
|
22
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfiguration);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
// update options from nx.json target defaults
|
|
26
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
27
|
-
if (!nxJson.targetDefaults) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
31
|
-
if (!exports.executors.includes(targetOrExecutor) &&
|
|
32
|
-
!exports.executors.includes(targetConfig.executor)) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (targetConfig.options) {
|
|
36
|
-
updateConfig(targetConfig.options);
|
|
37
|
-
}
|
|
38
|
-
Object.values(targetConfig.configurations ?? {}).forEach((config) => {
|
|
39
|
-
updateConfig(config);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
43
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
44
|
-
}
|
|
45
|
-
function updateConfig(config) {
|
|
46
|
-
if (config && config.browserTarget) {
|
|
47
|
-
config.buildTarget ??= config.browserTarget;
|
|
48
|
-
delete config.browserTarget;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replace-nguniversal-builders.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-1-0/replace-nguniversal-builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAEpB,yBAA+B,IAAI,EAAE,IAAI,iBAyDxC"}
|
|
@@ -1,75 +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
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
7
|
-
for (const [, project] of projects) {
|
|
8
|
-
if (project.projectType !== 'application') {
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
for (const target of Object.values(project.targets ?? {})) {
|
|
12
|
-
if (target.executor === '@nguniversal/builders:ssr-dev-server') {
|
|
13
|
-
target.executor = '@angular-devkit/build-angular:ssr-dev-server';
|
|
14
|
-
}
|
|
15
|
-
else if (target.executor === '@nguniversal/builders:prerender') {
|
|
16
|
-
target.executor = '@angular-devkit/build-angular:prerender';
|
|
17
|
-
updatePrerenderOptions(target);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
21
|
-
}
|
|
22
|
-
// update options from nx.json target defaults
|
|
23
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
24
|
-
if (!nxJson.targetDefaults) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
28
|
-
if (targetOrExecutor === '@nguniversal/builders:ssr-dev-server') {
|
|
29
|
-
nxJson.targetDefaults['@angular-devkit/build-angular:ssr-dev-server'] =
|
|
30
|
-
targetConfig;
|
|
31
|
-
delete nxJson.targetDefaults['@nguniversal/builders:ssr-dev-server'];
|
|
32
|
-
}
|
|
33
|
-
else if (targetOrExecutor === '@nguniversal/builders:prerender') {
|
|
34
|
-
nxJson.targetDefaults['@angular-devkit/build-angular:prerender'] =
|
|
35
|
-
targetConfig;
|
|
36
|
-
delete nxJson.targetDefaults['@nguniversal/builders:prerender'];
|
|
37
|
-
updatePrerenderOptions(targetConfig);
|
|
38
|
-
}
|
|
39
|
-
else if (targetConfig.executor === '@nguniversal/builders:ssr-dev-server') {
|
|
40
|
-
targetConfig.executor = '@angular-devkit/build-angular:ssr-dev-server';
|
|
41
|
-
}
|
|
42
|
-
else if (targetConfig.executor === '@nguniversal/builders:prerender') {
|
|
43
|
-
targetConfig.executor = '@angular-devkit/build-angular:prerender';
|
|
44
|
-
updatePrerenderOptions(targetConfig);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
48
|
-
// remove @nguniversal/builders from package.json
|
|
49
|
-
(0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nguniversal/builders'], ['@nguniversal/builders']);
|
|
50
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
51
|
-
}
|
|
52
|
-
function* allTargetOptions(target) {
|
|
53
|
-
if (target.options) {
|
|
54
|
-
yield [undefined, target.options];
|
|
55
|
-
}
|
|
56
|
-
if (!target.configurations) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
for (const [name, options] of Object.entries(target.configurations)) {
|
|
60
|
-
if (options !== undefined) {
|
|
61
|
-
yield [name, options];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function updatePrerenderOptions(config) {
|
|
66
|
-
for (const [, options] of allTargetOptions(config)) {
|
|
67
|
-
if (options.guessRoutes !== undefined) {
|
|
68
|
-
options.discoverRoutes = options.guessRoutes;
|
|
69
|
-
delete options.guessRoutes;
|
|
70
|
-
}
|
|
71
|
-
if (options.numProcesses !== undefined) {
|
|
72
|
-
delete options.numProcesses;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replace-nguniversal-engines.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-1-0/replace-nguniversal-engines.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA2BpB,yBAA+B,IAAI,EAAE,IAAI,iBA2GxC"}
|
|
@@ -1,184 +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 path_1 = require("path");
|
|
6
|
-
const version_utils_1 = require("../../generators/utils/version-utils");
|
|
7
|
-
const targets_1 = require("../../utils/targets");
|
|
8
|
-
const projects_1 = require("../utils/projects");
|
|
9
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
|
-
const UNIVERSAL_PACKAGES = [
|
|
11
|
-
'@nguniversal/common',
|
|
12
|
-
'@nguniversal/express-engine',
|
|
13
|
-
];
|
|
14
|
-
/**
|
|
15
|
-
* Regexp to match Universal packages.
|
|
16
|
-
* @nguniversal/common/engine
|
|
17
|
-
* @nguniversal/common
|
|
18
|
-
* @nguniversal/express-engine
|
|
19
|
-
**/
|
|
20
|
-
const NGUNIVERSAL_PACKAGE_REGEXP = /@nguniversal\/(common(\/engine)?|express-engine)/g;
|
|
21
|
-
const serverExecutors = [
|
|
22
|
-
'@angular-devkit/build-angular:server',
|
|
23
|
-
'@nx/angular:webpack-server',
|
|
24
|
-
];
|
|
25
|
-
async function default_1(tree) {
|
|
26
|
-
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
27
|
-
if (!UNIVERSAL_PACKAGES.some((pkg) => packageJson.dependencies?.[pkg] || packageJson.devDependencies?.[pkg])) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const projects = await (0, projects_1.getProjectsFilteredByDependencies)([
|
|
31
|
-
'npm:@nguniversal/common',
|
|
32
|
-
'npm:@nguniversal/express-engine',
|
|
33
|
-
]);
|
|
34
|
-
for (const { data: project } of projects) {
|
|
35
|
-
if (project.projectType !== 'application') {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const serverMainFiles = new Map();
|
|
39
|
-
for (const target of Object.values(project.targets ?? {})) {
|
|
40
|
-
if (!serverExecutors.includes(target.executor)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const outputPath = project.targets.build?.options?.outputPath;
|
|
44
|
-
for (const [, { main }] of (0, targets_1.allTargetOptions)(target)) {
|
|
45
|
-
if (typeof main === 'string' &&
|
|
46
|
-
typeof outputPath === 'string' &&
|
|
47
|
-
tree.read(main, 'utf-8').includes('ngExpressEngine')) {
|
|
48
|
-
serverMainFiles.set(main, outputPath);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Replace all import specifiers in all files.
|
|
53
|
-
let hasExpressTokens = false;
|
|
54
|
-
const root = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
|
|
55
|
-
const tokensFilePath = `${root}/express.tokens.ts`;
|
|
56
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, root, (path) => {
|
|
57
|
-
if (!path.endsWith('.ts') || path.endsWith('.d.ts')) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
let content = tree.read(path, 'utf8');
|
|
61
|
-
if (!content.includes('@nguniversal/')) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
// Check if file is importing tokens
|
|
65
|
-
if (content.includes('@nguniversal/express-engine/tokens')) {
|
|
66
|
-
hasExpressTokens ||= true;
|
|
67
|
-
let tokensFileRelativePath = (0, devkit_1.normalizePath)((0, path_1.relative)((0, path_1.dirname)(path), tokensFilePath));
|
|
68
|
-
if (tokensFileRelativePath.charAt(0) !== '.') {
|
|
69
|
-
tokensFileRelativePath = './' + tokensFileRelativePath;
|
|
70
|
-
}
|
|
71
|
-
content = content.replaceAll('@nguniversal/express-engine/tokens', tokensFileRelativePath.slice(0, -3));
|
|
72
|
-
}
|
|
73
|
-
content = content.replaceAll(NGUNIVERSAL_PACKAGE_REGEXP, '@angular/ssr');
|
|
74
|
-
tree.write(path, content);
|
|
75
|
-
});
|
|
76
|
-
// Replace server file and add tokens file if needed
|
|
77
|
-
for (const [path, outputPath] of serverMainFiles.entries()) {
|
|
78
|
-
tree.rename(path, path + '.bak');
|
|
79
|
-
tree.write(path, getServerFileContents(outputPath, hasExpressTokens));
|
|
80
|
-
if (hasExpressTokens) {
|
|
81
|
-
tree.write(tokensFilePath, TOKENS_FILE_CONTENT);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// Remove universal packages from deps
|
|
86
|
-
for (const name of UNIVERSAL_PACKAGES) {
|
|
87
|
-
(0, devkit_1.removeDependenciesFromPackageJson)(tree, [name], [name]);
|
|
88
|
-
}
|
|
89
|
-
const pkgVersions = (0, version_utils_1.versions)(tree);
|
|
90
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
91
|
-
'@angular/ssr': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@angular-devkit/build-angular')
|
|
92
|
-
?.version ?? pkgVersions.angularDevkitVersion,
|
|
93
|
-
}, {});
|
|
94
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
95
|
-
}
|
|
96
|
-
const TOKENS_FILE_CONTENT = `
|
|
97
|
-
import { InjectionToken } from '@angular/core';
|
|
98
|
-
import { Request, Response } from 'express';
|
|
99
|
-
|
|
100
|
-
export const REQUEST = new InjectionToken<Request>('REQUEST');
|
|
101
|
-
export const RESPONSE = new InjectionToken<Response>('RESPONSE');
|
|
102
|
-
`;
|
|
103
|
-
function getServerFileContents(outputPath, hasExpressTokens) {
|
|
104
|
-
return (`
|
|
105
|
-
import 'zone.js/node';
|
|
106
|
-
|
|
107
|
-
import { APP_BASE_HREF } from '@angular/common';
|
|
108
|
-
import { CommonEngine } from '@angular/ssr';
|
|
109
|
-
import * as express from 'express';
|
|
110
|
-
import { existsSync } from 'node:fs';
|
|
111
|
-
import { join } from 'node:path';
|
|
112
|
-
import bootstrap from './src/main.server';` +
|
|
113
|
-
(hasExpressTokens
|
|
114
|
-
? `\nimport { REQUEST, RESPONSE } from './src/express.tokens';`
|
|
115
|
-
: '') +
|
|
116
|
-
`
|
|
117
|
-
|
|
118
|
-
// The Express app is exported so that it can be used by serverless Functions.
|
|
119
|
-
export function app(): express.Express {
|
|
120
|
-
const server = express();
|
|
121
|
-
const distFolder = join(process.cwd(), '${outputPath}');
|
|
122
|
-
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
|
123
|
-
? join(distFolder, 'index.original.html')
|
|
124
|
-
: join(distFolder, 'index.html');
|
|
125
|
-
|
|
126
|
-
const commonEngine = new CommonEngine();
|
|
127
|
-
|
|
128
|
-
server.set('view engine', 'html');
|
|
129
|
-
server.set('views', distFolder);
|
|
130
|
-
|
|
131
|
-
// Example Express Rest API endpoints
|
|
132
|
-
// server.get('/api/**', (req, res) => { });
|
|
133
|
-
// Serve static files from /browser
|
|
134
|
-
server.get('*.*', express.static(distFolder, {
|
|
135
|
-
maxAge: '1y'
|
|
136
|
-
}));
|
|
137
|
-
|
|
138
|
-
// All regular routes use the Angular engine
|
|
139
|
-
server.get('*', (req, res, next) => {
|
|
140
|
-
const { protocol, originalUrl, baseUrl, headers } = req;
|
|
141
|
-
|
|
142
|
-
commonEngine
|
|
143
|
-
.render({
|
|
144
|
-
bootstrap,
|
|
145
|
-
documentFilePath: indexHtml,
|
|
146
|
-
url: \`\${protocol}://\${headers.host}\${originalUrl}\`,
|
|
147
|
-
publicPath: distFolder,
|
|
148
|
-
providers: [
|
|
149
|
-
{ provide: APP_BASE_HREF, useValue: baseUrl },` +
|
|
150
|
-
(hasExpressTokens
|
|
151
|
-
? '\n { provide: RESPONSE, useValue: res },\n { provide: REQUEST, useValue: req }\n'
|
|
152
|
-
: '') +
|
|
153
|
-
`],
|
|
154
|
-
})
|
|
155
|
-
.then((html) => res.send(html))
|
|
156
|
-
.catch((err) => next(err));
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
return server;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function run(): void {
|
|
163
|
-
const port = process.env['PORT'] || 4000;
|
|
164
|
-
|
|
165
|
-
// Start up the Node server
|
|
166
|
-
const server = app();
|
|
167
|
-
server.listen(port, () => {
|
|
168
|
-
console.log(\`Node Express server listening on http://localhost:\${port}\`);
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Webpack will replace 'require' with '__webpack_require__'
|
|
173
|
-
// '__non_webpack_require__' is a proxy to Node 'require'
|
|
174
|
-
// The below code is to ensure that the server is run only when not requiring the bundle.
|
|
175
|
-
declare const __non_webpack_require__: NodeRequire;
|
|
176
|
-
const mainModule = __non_webpack_require__.main;
|
|
177
|
-
const moduleFilename = mainModule && mainModule.filename || '';
|
|
178
|
-
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
|
|
179
|
-
run();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export default bootstrap;
|
|
183
|
-
`);
|
|
184
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-1-0/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAaxC"}
|
|
@@ -1,14 +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 = '~17.0.0';
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
const { devDependencies, dependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
9
|
-
const hasAngularCli = devDependencies?.['@angular/cli'] || dependencies?.['@angular/cli'];
|
|
10
|
-
if (hasAngularCli) {
|
|
11
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@angular/cli': exports.angularCliVersion });
|
|
12
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-zone-js-deep-import.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-1-0/update-zone-js-deep-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAG1E,yBAA+B,IAAI,EAAE,IAAI,iBAyCxC"}
|
|
@@ -1,37 +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 projects_1 = require("../utils/projects");
|
|
6
|
-
async function default_1(tree) {
|
|
7
|
-
const angularProjects = await (0, projects_1.getProjectsFilteredByDependencies)([
|
|
8
|
-
'npm:@angular/core',
|
|
9
|
-
]);
|
|
10
|
-
if (!angularProjects.length) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const zoneJsImportRegex = /(['"`])zone\.js\/dist\/zone(['"`])/g;
|
|
14
|
-
const zoneJsTestingImportRegex = /(['"`])zone\.js\/dist\/zone-testing(['"`])/g;
|
|
15
|
-
for (const graphNode of angularProjects) {
|
|
16
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, graphNode.data.root, (file) => {
|
|
17
|
-
// we are only interested in .ts files
|
|
18
|
-
if (!file.endsWith('.ts')) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
let content = tree.read(file, 'utf-8');
|
|
22
|
-
let wasUpdated = false;
|
|
23
|
-
if (zoneJsImportRegex.test(content)) {
|
|
24
|
-
content = content.replace(zoneJsImportRegex, '$1zone.js$2');
|
|
25
|
-
wasUpdated = true;
|
|
26
|
-
}
|
|
27
|
-
if (zoneJsTestingImportRegex.test(content)) {
|
|
28
|
-
content = content.replace(zoneJsTestingImportRegex, '$1zone.js/testing$2');
|
|
29
|
-
wasUpdated = true;
|
|
30
|
-
}
|
|
31
|
-
if (wasUpdated) {
|
|
32
|
-
tree.write(file, content);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
37
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-webpack-dev-server.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-2-0/rename-webpack-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,yBAA+B,IAAI,EAAE,IAAI,iBA6CxC"}
|
|
@@ -1,40 +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
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
7
|
-
for (const [, project] of projects) {
|
|
8
|
-
if (project.projectType !== 'application') {
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
for (const target of Object.values(project.targets ?? {})) {
|
|
12
|
-
if (target.executor === '@nx/angular:webpack-dev-server' ||
|
|
13
|
-
target.executor === '@nrwl/angular:webpack-dev-server') {
|
|
14
|
-
target.executor = '@nx/angular:dev-server';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
|
|
18
|
-
}
|
|
19
|
-
// update options from nx.json target defaults
|
|
20
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
21
|
-
if (!nxJson.targetDefaults) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
for (const [targetOrExecutor, targetConfig] of Object.entries(nxJson.targetDefaults)) {
|
|
25
|
-
if (targetOrExecutor === '@nx/angular:webpack-dev-server') {
|
|
26
|
-
nxJson.targetDefaults['@nx/angular:dev-server'] = targetConfig;
|
|
27
|
-
delete nxJson.targetDefaults['@nx/angular:webpack-dev-server'];
|
|
28
|
-
}
|
|
29
|
-
else if (targetOrExecutor === '@nrwl/angular:webpack-dev-server') {
|
|
30
|
-
nxJson.targetDefaults['@nx/angular:dev-server'] = targetConfig;
|
|
31
|
-
delete nxJson.targetDefaults['@nrwl/angular:webpack-dev-server'];
|
|
32
|
-
}
|
|
33
|
-
else if (targetConfig.executor === '@nx/angular:webpack-dev-server' ||
|
|
34
|
-
targetConfig.executor === '@nrwl/angular:webpack-dev-server') {
|
|
35
|
-
targetConfig.executor = '@nx/angular:dev-server';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
39
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-autoprefixer-dependency.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-3-0/add-autoprefixer-dependency.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,yBAA+B,IAAI,EAAE,IAAI,iBA6BxC"}
|
|
@@ -1,25 +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
|
-
const autprefixerVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'autoprefixer');
|
|
7
|
-
if (autprefixerVersion) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
-
for (const project of projects.values()) {
|
|
12
|
-
if (project.projectType !== 'library') {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
for (const target of Object.values(project.targets ?? {})) {
|
|
16
|
-
if (target.executor !== '@nx/angular:ng-packagr-lite' &&
|
|
17
|
-
target.executor !== '@nx/angular:package') {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { autoprefixer: '^10.4.0' });
|
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-browser-sync-dependency.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-3-0/add-browser-sync-dependency.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,yBAA+B,IAAI,EAAE,IAAI,iBA6BxC"}
|
|
@@ -1,25 +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
|
-
const browserSyncVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'browser-sync');
|
|
7
|
-
if (browserSyncVersion) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
-
for (const project of projects.values()) {
|
|
12
|
-
if (project.projectType !== 'application') {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
for (const target of Object.values(project.targets ?? {})) {
|
|
16
|
-
if (target.executor !== '@angular-devkit/build-angular:ssr-dev-server' &&
|
|
17
|
-
target.executor !== '@nx/angular:module-federation-dev-ssr') {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'browser-sync': '^3.0.0' });
|
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-17-3-0/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAaxC"}
|
|
@@ -1,14 +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 = '~17.1.0';
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
const { devDependencies, dependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
9
|
-
const hasAngularCli = devDependencies?.['@angular/cli'] || dependencies?.['@angular/cli'];
|
|
10
|
-
if (hasAngularCli) {
|
|
11
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@angular/cli': exports.angularCliVersion });
|
|
12
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-mf-env-var-to-target-defaults.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAIV,MAAM,YAAY,CAAC;AAGpB,yBAA+B,IAAI,EAAE,IAAI,iBAOxC"}
|
|
@@ -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 add_mf_env_to_inputs_1 = require("../../generators/utils/add-mf-env-to-inputs");
|
|
6
|
-
async function default_1(tree) {
|
|
7
|
-
if (!isWebpackBrowserUsed(tree)) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(tree);
|
|
11
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
12
|
-
}
|
|
13
|
-
function isWebpackBrowserUsed(tree) {
|
|
14
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
15
|
-
for (const project of projects.values()) {
|
|
16
|
-
const targets = project.targets || {};
|
|
17
|
-
for (const [_, target] of Object.entries(targets)) {
|
|
18
|
-
if (target.executor === '@nx/angular:webpack-browser' &&
|
|
19
|
-
(tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
|
20
|
-
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-18-1-0/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAaxC"}
|
|
@@ -1,14 +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 = '~17.2.0';
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
const { devDependencies, dependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
9
|
-
const hasAngularCli = devDependencies?.['@angular/cli'] || dependencies?.['@angular/cli'];
|
|
10
|
-
if (hasAngularCli) {
|
|
11
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@angular/cli': exports.angularCliVersion });
|
|
12
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fix-target-defaults-inputs.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-18-1-1/fix-target-defaults-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,IAAI,EAMV,MAAM,YAAY,CAAC;AAEpB,yBAA+B,IAAI,EAAE,IAAI,iBAOxC"}
|