@nx/angular 22.3.0-canary.20251211-205daee → 22.3.0-canary.20251216-71bfc21
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/executors.json +5 -0
- package/migrations.json +206 -289
- package/package.json +18 -18
- package/src/builders/dev-server/lib/normalize-options.d.ts.map +1 -1
- package/src/builders/dev-server/lib/normalize-options.js +1 -3
- package/src/builders/dev-server/lib/validate-options.d.ts.map +1 -1
- package/src/builders/dev-server/lib/validate-options.js +6 -5
- package/src/builders/dev-server/schema.d.ts +1 -0
- package/src/builders/dev-server/schema.json +9 -2
- package/src/executors/application/application.impl.js +1 -1
- package/src/executors/application/schema.json +11 -9
- package/src/executors/application/utils/normalize-options.d.ts.map +1 -1
- package/src/executors/application/utils/normalize-options.js +1 -27
- package/src/executors/application/utils/validate-options.d.ts.map +1 -1
- package/src/executors/application/utils/validate-options.js +0 -17
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +1 -1
- package/src/executors/extract-i18n/extract-i18n.impl.js +1 -1
- package/src/executors/unit-test/schema.d.ts +7 -0
- package/src/executors/unit-test/schema.json +320 -0
- package/src/executors/unit-test/unit-test.impl.d.ts +5 -0
- package/src/executors/unit-test/unit-test.impl.d.ts.map +1 -0
- package/src/executors/unit-test/unit-test.impl.js +111 -0
- package/src/executors/utilities/ng-packagr/stylesheet-processor.d.ts.map +1 -0
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.d.ts.map +1 -1
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +2 -6
- package/src/executors/utilities/ng-packagr/{v19+/stylesheet-processor.js → stylesheet-processor.js} +2 -2
- package/src/generators/application/application.d.ts +1 -1
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +6 -1
- package/src/generators/application/files/base/tsconfig.app.json__tpl__ +2 -4
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +2 -2
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +1 -3
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/nx-welcome__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +6 -0
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +3 -3
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +2 -2
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.ts__tpl__ +1 -2
- package/src/generators/application/lib/add-unit-test-runner.d.ts +1 -1
- package/src/generators/application/lib/add-unit-test-runner.d.ts.map +1 -1
- package/src/generators/application/lib/add-unit-test-runner.js +13 -2
- package/src/generators/application/lib/create-files.d.ts.map +1 -1
- package/src/generators/application/lib/create-files.js +1 -3
- package/src/generators/application/lib/create-project.js +12 -10
- package/src/generators/application/lib/enable-strict-type-checking.js +1 -1
- package/src/generators/application/lib/index.d.ts +2 -1
- package/src/generators/application/lib/index.d.ts.map +1 -1
- package/src/generators/application/lib/index.js +2 -1
- package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/application/lib/normalize-options.js +12 -2
- package/src/generators/application/lib/update-tsconfig-files.d.ts.map +1 -1
- package/src/generators/application/lib/update-tsconfig-files.js +6 -17
- package/src/generators/application/lib/validate-options.d.ts +4 -0
- package/src/generators/application/lib/validate-options.d.ts.map +1 -0
- package/src/generators/application/lib/validate-options.js +26 -0
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +7 -4
- package/src/generators/component/component.d.ts.map +1 -1
- package/src/generators/component/component.js +4 -3
- package/src/generators/component/files/__fileName__.spec.ts__tpl__ +1 -1
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component-test/component-test.d.ts +3 -3
- package/src/generators/component-test/component-test.d.ts.map +1 -1
- package/src/generators/component-test/component-test.js +9 -0
- package/src/generators/component-test/schema.d.ts +1 -0
- package/src/generators/component-test/schema.json +6 -0
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts.map +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.js +1 -4
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +80 -33
- package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
- package/src/generators/cypress-component-configuration/schema.json +6 -0
- package/src/generators/directive/directive.d.ts.map +1 -1
- package/src/generators/directive/directive.js +0 -3
- package/src/generators/directive/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/federate-module/federate-module.d.ts +1 -1
- package/src/generators/federate-module/federate-module.d.ts.map +1 -1
- package/src/generators/federate-module/federate-module.js +8 -0
- package/src/generators/federate-module/lib/add-remote.js +1 -1
- package/src/generators/federate-module/schema.d.ts +2 -2
- package/src/generators/federate-module/schema.json +3 -4
- package/src/generators/host/files/common/src/main.server.ts__tmpl__ +8 -1
- package/src/generators/host/host.d.ts.map +1 -1
- package/src/generators/host/host.js +5 -1
- package/src/generators/host/lib/index.d.ts +1 -0
- package/src/generators/host/lib/index.d.ts.map +1 -1
- package/src/generators/host/lib/index.js +1 -0
- package/src/generators/host/lib/update-ssr-setup.d.ts.map +1 -1
- package/src/generators/host/lib/update-ssr-setup.js +6 -4
- package/src/generators/host/lib/validate-options.d.ts +4 -0
- package/src/generators/host/lib/validate-options.d.ts.map +1 -0
- package/src/generators/host/lib/validate-options.js +12 -0
- package/src/generators/host/schema.d.ts +2 -2
- package/src/generators/host/schema.json +5 -6
- package/src/generators/library/files/base/tsconfig.lib.json__tpl__ +3 -5
- package/src/generators/library/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/library/lib/normalize-options.js +10 -3
- package/src/generators/library/lib/update-tsconfig-files.d.ts.map +1 -1
- package/src/generators/library/lib/update-tsconfig-files.js +15 -6
- package/src/generators/library/lib/validate-options.d.ts +4 -0
- package/src/generators/library/lib/validate-options.d.ts.map +1 -0
- package/src/generators/library/lib/validate-options.js +27 -0
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +20 -13
- package/src/generators/library/schema.json +3 -4
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.d.ts +16 -0
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.d.ts.map +1 -0
- package/src/generators/ng-add/migrators/builders/angular-build-unit-test.migrator.js +161 -0
- package/src/generators/ng-add/migrators/builders/index.d.ts +1 -0
- package/src/generators/ng-add/migrators/builders/index.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/builders/index.js +1 -0
- package/src/generators/ng-add/migrators/projects/app.migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +1 -0
- package/src/generators/ng-add/migrators/projects/lib.migrator.d.ts.map +1 -1
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +1 -0
- package/src/generators/pipe/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/pipe/pipe.d.ts.map +1 -1
- package/src/generators/pipe/pipe.js +0 -5
- package/src/generators/remote/files/common/src/main.server.ts__tmpl__ +8 -1
- package/src/generators/remote/lib/index.d.ts +1 -0
- package/src/generators/remote/lib/index.d.ts.map +1 -1
- package/src/generators/remote/lib/index.js +1 -0
- package/src/generators/remote/lib/update-ssr-setup.d.ts +2 -1
- package/src/generators/remote/lib/update-ssr-setup.d.ts.map +1 -1
- package/src/generators/remote/lib/update-ssr-setup.js +7 -7
- package/src/generators/remote/lib/validate-options.d.ts +4 -0
- package/src/generators/remote/lib/validate-options.d.ts.map +1 -0
- package/src/generators/remote/lib/validate-options.js +12 -0
- package/src/generators/remote/remote.d.ts.map +1 -1
- package/src/generators/remote/remote.js +6 -1
- package/src/generators/remote/schema.d.ts +2 -2
- package/src/generators/remote/schema.json +5 -6
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +1 -1
- package/src/generators/setup-mf/files/entry-module-files/entry__componentFileSuffix__.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +5 -6
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry__componentFileSuffix__.ts__tmpl__ +1 -2
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.js +0 -5
- package/src/generators/setup-mf/lib/update-host-app-routes.d.ts.map +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.js +9 -6
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +2 -2
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +6 -0
- package/src/generators/setup-ssr/lib/add-hydration.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-hydration.js +2 -8
- package/src/generators/setup-ssr/lib/add-server-file.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/add-server-file.js +7 -7
- package/src/generators/setup-ssr/lib/generate-files.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/generate-files.js +2 -7
- package/src/generators/setup-ssr/lib/generate-server-ts-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +26 -12
- package/src/generators/setup-ssr/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/normalize-options.js +1 -5
- package/src/generators/setup-ssr/lib/update-project-config.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +6 -17
- package/src/generators/setup-ssr/lib/validate-options.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/validate-options.js +9 -0
- package/src/generators/utils/add-jest.d.ts +2 -0
- package/src/generators/utils/add-jest.d.ts.map +1 -1
- package/src/generators/utils/add-jest.js +41 -11
- package/src/generators/utils/add-vitest.d.ts +11 -2
- package/src/generators/utils/add-vitest.d.ts.map +1 -1
- package/src/generators/utils/add-vitest.js +173 -6
- package/src/generators/utils/assert-mf-utils.d.ts +1 -1
- package/src/generators/utils/assert-mf-utils.d.ts.map +1 -1
- package/src/generators/utils/assert-mf-utils.js +1 -4
- package/src/generators/utils/ensure-angular-dependencies.d.ts +1 -1
- package/src/generators/utils/ensure-angular-dependencies.d.ts.map +1 -1
- package/src/generators/utils/ensure-angular-dependencies.js +6 -4
- package/src/generators/utils/storybook-ast/component-info.js +2 -10
- package/src/generators/utils/tsconfig-utils.d.ts +13 -0
- package/src/generators/utils/tsconfig-utils.d.ts.map +1 -0
- package/src/generators/utils/tsconfig-utils.js +29 -0
- package/src/generators/utils/version-utils.d.ts +13 -3
- package/src/generators/utils/version-utils.d.ts.map +1 -1
- package/src/generators/utils/version-utils.js +11 -18
- package/src/migrations/update-21-2-0/update-module-resolution.d.ts.map +1 -1
- package/src/migrations/update-21-2-0/update-module-resolution.js +17 -4
- package/src/migrations/update-22-3-0/set-isolated-modules.d.ts +3 -0
- package/src/migrations/update-22-3-0/set-isolated-modules.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/set-isolated-modules.js +52 -0
- package/src/migrations/update-22-3-0/update-angular-cli.d.ts +4 -0
- package/src/migrations/update-22-3-0/update-angular-cli.d.ts.map +1 -0
- package/src/migrations/{update-16-4-0 → update-22-3-0}/update-angular-cli.js +1 -1
- package/src/migrations/update-22-3-0/update-module-resolution.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-module-resolution.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-module-resolution.js +61 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-ssr-webpack-config.js +111 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-typescript-lib.js +98 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.d.ts +3 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.d.ts.map +1 -0
- package/src/migrations/update-22-3-0/update-unit-test-runner-option.js +44 -0
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +40 -24
- package/src/utils/backward-compatible-versions.d.ts +7 -9
- package/src/utils/backward-compatible-versions.d.ts.map +1 -1
- package/src/utils/backward-compatible-versions.js +20 -14
- package/src/utils/nx-devkit/ast-utils.d.ts.map +1 -1
- package/src/utils/nx-devkit/ast-utils.js +2 -13
- package/src/utils/targets.d.ts +6 -1
- package/src/utils/targets.d.ts.map +1 -1
- package/src/utils/targets.js +20 -3
- package/src/utils/test-runners.d.ts +2 -1
- package/src/utils/test-runners.d.ts.map +1 -1
- package/src/utils/test-runners.js +2 -1
- package/src/utils/version-utils.d.ts +2 -2
- package/src/utils/version-utils.d.ts.map +1 -1
- package/src/utils/version-utils.js +3 -2
- package/src/utils/versions.d.ts +7 -6
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +8 -7
- package/src/utils/zoneless.d.ts +3 -0
- package/src/utils/zoneless.d.ts.map +1 -0
- package/src/utils/zoneless.js +28 -0
- package/{mf/index.d.ts → types/nx-angular-mf.d.ts} +1 -1
- package/types/nx-angular-mf.d.ts.map +1 -0
- package/types/nx-angular.d.ts +3 -0
- package/types/nx-angular.d.ts.map +1 -0
- package/index.d.ts +0 -3
- package/index.d.ts.map +0 -1
- package/mf/index.d.ts.map +0 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +0 -28
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts.map +0 -1
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +0 -159
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts.map +0 -1
- package/src/generators/setup-ssr/files/pre-v19/ngmodule-src/__main__ +0 -1
- package/src/generators/setup-ssr/files/pre-v19/ngmodule-src/app/__rootModuleFileName__ +0 -14
- package/src/generators/setup-ssr/files/pre-v19/root/tsconfig.server.json__tpl__ +0 -15
- package/src/generators/setup-ssr/files/pre-v19/server/application-builder/__serverFileName__ +0 -57
- package/src/generators/setup-ssr/files/pre-v19/server/server-builder/__serverFileName__ +0 -72
- package/src/generators/setup-ssr/files/pre-v19/standalone-src/__main__ +0 -12
- package/src/generators/setup-ssr/files/pre-v19/standalone-src/app/app.config.server.ts__tpl__ +0 -11
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.d.ts +0 -3
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.d.ts.map +0 -1
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +0 -122
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.d.ts +0 -3
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.d.ts.map +0 -1
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +0 -34
- package/src/migrations/update-16-4-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-16-4-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts +0 -3
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.d.ts.map +0 -1
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +0 -34
- package/src/migrations/update-16-7-0/update-angular-cli.d.ts +0 -4
- package/src/migrations/update-16-7-0/update-angular-cli.d.ts.map +0 -1
- package/src/migrations/update-16-7-0/update-angular-cli.js +0 -14
- /package/src/executors/utilities/ng-packagr/{v19+/stylesheet-processor.d.ts → stylesheet-processor.d.ts} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.default = unitTestExecutor;
|
|
37
|
+
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
38
|
+
const targets_1 = require("../../utils/targets");
|
|
39
|
+
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
40
|
+
const builder_package_1 = require("../utilities/builder-package");
|
|
41
|
+
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
42
|
+
async function* unitTestExecutor(options, context) {
|
|
43
|
+
validateOptions();
|
|
44
|
+
const { plugins: pluginPaths, indexHtmlTransformer: indexHtmlTransformerPath, ...delegateExecutorOptions } = options;
|
|
45
|
+
const plugins = await (0, esbuild_extensions_1.loadPlugins)(pluginPaths, options.tsConfig);
|
|
46
|
+
const indexHtmlTransformer = indexHtmlTransformerPath
|
|
47
|
+
? await (0, esbuild_extensions_1.loadIndexHtmlTransformer)(indexHtmlTransformerPath, options.tsConfig)
|
|
48
|
+
: undefined;
|
|
49
|
+
const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
|
|
50
|
+
builderName: '@nx/angular:unit-test',
|
|
51
|
+
description: 'Run application unit tests.',
|
|
52
|
+
optionSchema: require('./schema.json'),
|
|
53
|
+
}, context);
|
|
54
|
+
const buildTargetSpecifier = options.buildTarget ?? `::development`;
|
|
55
|
+
const buildTarget = (0, targets_1.targetFromTargetString)(buildTargetSpecifier, context.projectName, 'build');
|
|
56
|
+
patchBuilderContext(builderContext, buildTarget);
|
|
57
|
+
(0, builder_package_1.assertBuilderPackageIsInstalled)('@angular/build');
|
|
58
|
+
const { executeUnitTestBuilder } = await Promise.resolve().then(() => __importStar(require('@angular/build')));
|
|
59
|
+
return yield* executeUnitTestBuilder(delegateExecutorOptions, builderContext, {
|
|
60
|
+
codePlugins: plugins,
|
|
61
|
+
indexHtmlTransformer,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function validateOptions() {
|
|
65
|
+
const { version: angularVersion, major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
|
|
66
|
+
if (angularMajorVersion < 21) {
|
|
67
|
+
throw new Error(`The "unit-test" executor is only available for Angular versions >= 21.0.0. You are currently using version ${angularVersion}.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The Angular CLI unit-test builder only accepts the `@angular/build:application`
|
|
72
|
+
* and `@angular/build:ng-packagr` builders. We need to patch the builder context
|
|
73
|
+
* so that it accepts the `@nx/angular:*` executors.
|
|
74
|
+
*
|
|
75
|
+
* https://github.com/angular/angular-cli/blob/f9de11d67d3e0e0524372819583bc77756596d4f/packages/angular/build/src/builders/unit-test/builder.ts#L246-L262
|
|
76
|
+
*/
|
|
77
|
+
function patchBuilderContext(context, buildTarget) {
|
|
78
|
+
const executorToBuilderMap = new Map([
|
|
79
|
+
['@nx/angular:application', '@angular/build:application'],
|
|
80
|
+
['@nx/angular:ng-packagr-lite', '@angular/build:ng-packagr'],
|
|
81
|
+
['@nx/angular:package', '@angular/build:ng-packagr'],
|
|
82
|
+
]);
|
|
83
|
+
const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
|
|
84
|
+
context.getBuilderNameForTarget = async (target) => {
|
|
85
|
+
const builderName = await originalGetBuilderNameForTarget(target);
|
|
86
|
+
if (executorToBuilderMap.has(builderName)) {
|
|
87
|
+
return executorToBuilderMap.get(builderName);
|
|
88
|
+
}
|
|
89
|
+
return builderName;
|
|
90
|
+
};
|
|
91
|
+
const originalGetTargetOptions = context.getTargetOptions;
|
|
92
|
+
context.getTargetOptions = async (target) => {
|
|
93
|
+
const options = await originalGetTargetOptions(target);
|
|
94
|
+
if (target.project === buildTarget.project &&
|
|
95
|
+
target.target === buildTarget.target &&
|
|
96
|
+
target.configuration === buildTarget.configuration) {
|
|
97
|
+
cleanBuildTargetOptions(options);
|
|
98
|
+
}
|
|
99
|
+
return options;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function cleanBuildTargetOptions(options) {
|
|
103
|
+
if ('buildLibsFromSource' in options ||
|
|
104
|
+
'indexHtmlTransformer' in options ||
|
|
105
|
+
'plugins' in options) {
|
|
106
|
+
delete options.buildLibsFromSource;
|
|
107
|
+
delete options.indexHtmlTransformer;
|
|
108
|
+
delete options.plugins;
|
|
109
|
+
}
|
|
110
|
+
return options;
|
|
111
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylesheet-processor.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/executors/utilities/ng-packagr/stylesheet-processor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAIhF,oBAAY,MAAM;IAChB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,wBAAgB,sBAAsB,IAAI,KACxC,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,EAAE,EACvB,IAAI,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,EAC1C,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,EAC/B,KAAK,CAAC,EAAE,OAAO,KACZ;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAuEA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-processor.di.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/executors/utilities/ng-packagr/stylesheet-processor.di.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,wBAAgB,qCAAqC,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"stylesheet-processor.di.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/executors/utilities/ng-packagr/stylesheet-processor.di.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,wBAAgB,qCAAqC,IAAI,eAAe,CAevE"}
|
|
@@ -9,12 +9,8 @@ function getStylesheetProcessorFactoryProvider() {
|
|
|
9
9
|
return {
|
|
10
10
|
provide: STYLESHEET_PROCESSOR_TOKEN,
|
|
11
11
|
useFactory: () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return getStylesheetProcessor();
|
|
15
|
-
}
|
|
16
|
-
const { StylesheetProcessor } = require('./pre-v19/stylesheet-processor');
|
|
17
|
-
return StylesheetProcessor;
|
|
12
|
+
const { getStylesheetProcessor } = require('./stylesheet-processor');
|
|
13
|
+
return getStylesheetProcessor();
|
|
18
14
|
},
|
|
19
15
|
deps: [],
|
|
20
16
|
};
|
package/src/executors/utilities/ng-packagr/{v19+/stylesheet-processor.js → stylesheet-processor.js}
RENAMED
|
@@ -11,8 +11,8 @@ exports.getStylesheetProcessor = getStylesheetProcessor;
|
|
|
11
11
|
const tslib_1 = require("tslib");
|
|
12
12
|
const devkit_1 = require("@nx/devkit");
|
|
13
13
|
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
14
|
-
const ng_packagr_version_1 = require("
|
|
15
|
-
const package_imports_1 = require("
|
|
14
|
+
const ng_packagr_version_1 = require("./ng-packagr-version");
|
|
15
|
+
const package_imports_1 = require("./package-imports");
|
|
16
16
|
var CssUrl;
|
|
17
17
|
(function (CssUrl) {
|
|
18
18
|
CssUrl["inline"] = "inline";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
|
-
export declare function applicationGenerator(tree: Tree, schema:
|
|
3
|
+
export declare function applicationGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export default applicationGenerator;
|
|
5
5
|
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AA2BpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAsI5B;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -14,6 +14,7 @@ const version_utils_1 = require("../utils/version-utils");
|
|
|
14
14
|
const lib_1 = require("./lib");
|
|
15
15
|
async function applicationGenerator(tree, schema) {
|
|
16
16
|
(0, validations_1.assertNotUsingTsSolutionSetup)(tree, 'application');
|
|
17
|
+
(0, lib_1.validateOptions)(tree, schema);
|
|
17
18
|
const isRspack = schema.bundler === 'rspack';
|
|
18
19
|
if (isRspack) {
|
|
19
20
|
schema.bundler = 'webpack';
|
|
@@ -32,7 +33,7 @@ async function applicationGenerator(tree, schema) {
|
|
|
32
33
|
addPlugin: options.addPlugin,
|
|
33
34
|
});
|
|
34
35
|
if (!options.skipPackageJson) {
|
|
35
|
-
(0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
|
|
36
|
+
(0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree, options.zoneless);
|
|
36
37
|
}
|
|
37
38
|
(0, lib_1.createProject)(tree, options);
|
|
38
39
|
await (0, lib_1.createFiles)(tree, options, rootOffset);
|
|
@@ -72,8 +73,12 @@ async function applicationGenerator(tree, schema) {
|
|
|
72
73
|
skipFormat: true,
|
|
73
74
|
});
|
|
74
75
|
if (options.ssr) {
|
|
76
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
75
77
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/rspack-ssr'), options.appProjectSourceRoot, {
|
|
76
78
|
pathToDistFolder: (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), options.outputPath, 'browser'),
|
|
79
|
+
zoneless: options.zoneless,
|
|
80
|
+
useDefaultImport: angularMajorVersion >= 21,
|
|
81
|
+
angularMajorVersion,
|
|
77
82
|
tmpl: '',
|
|
78
83
|
});
|
|
79
84
|
}
|
package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__
CHANGED
|
@@ -11,9 +11,9 @@ describe('App<%= componentType %>', () => {
|
|
|
11
11
|
}).compileComponents();
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
it('should render title', () => {
|
|
14
|
+
it('should render title', <% if (zoneless) { %>async <% } %>() => {
|
|
15
15
|
const fixture = TestBed.createComponent(App<%= componentType %>);
|
|
16
|
-
fixture.detectChanges();
|
|
16
|
+
<%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %>
|
|
17
17
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
18
18
|
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
19
19
|
'Welcome <%= appName %>'
|
package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.ts__tpl__
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= rootSelector %>'
|
|
5
|
-
standalone: false,<%
|
|
4
|
+
selector: '<%= rootSelector %>',
|
|
5
|
+
standalone: false,<% if(!inlineTemplate) { %>
|
|
6
6
|
templateUrl: './app<%= componentFileSuffix %>.html',<% } else { %>
|
|
7
7
|
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
8
8
|
styleUrl: './app<%= componentFileSuffix %>.<%= style %>',<% } else { %>
|
|
@@ -10,7 +10,5 @@ platformBrowserDynamic()
|
|
|
10
10
|
<%_ } else { _%>
|
|
11
11
|
platformBrowser()
|
|
12
12
|
<%_ } _%>
|
|
13
|
-
.bootstrapModule(AppModule
|
|
14
|
-
ngZoneEventCoalescing: true
|
|
15
|
-
})
|
|
13
|
+
.bootstrapModule(AppModule<% if (!zoneless) { %>, { ngZoneEventCoalescing: true }<% } %>)
|
|
16
14
|
.catch((err) => console.error(err));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
5
|
-
standalone: false
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
5
|
+
standalone: false,
|
|
6
6
|
template: `
|
|
7
7
|
<!--
|
|
8
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
6
|
-
standalone: true,<% } %>
|
|
5
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
7
6
|
imports: [CommonModule],
|
|
8
7
|
template: `
|
|
9
8
|
<!--
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
5
|
-
standalone: false
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
5
|
+
standalone: false,
|
|
6
6
|
template: `
|
|
7
7
|
<!--
|
|
8
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
6
|
-
standalone: true,<% } %>
|
|
5
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
7
6
|
imports: [CommonModule],
|
|
8
7
|
template: `
|
|
9
8
|
<!--
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
5
|
-
standalone: false
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
5
|
+
standalone: false,
|
|
6
6
|
template: `
|
|
7
7
|
<!--
|
|
8
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
6
|
-
standalone: true,<% } %>
|
|
5
|
+
selector: '<%= nxWelcomeSelector %>',
|
|
7
6
|
imports: [CommonModule],
|
|
8
7
|
template: `
|
|
9
8
|
<!--
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
<%_ if (!zoneless && angularMajorVersion < 21) { _%>
|
|
1
2
|
import 'zone.js/node';
|
|
2
3
|
|
|
4
|
+
<%_ } _%>
|
|
3
5
|
import { APP_BASE_HREF } from '@angular/common';
|
|
4
6
|
import { CommonEngine } from '@angular/ssr/node';
|
|
7
|
+
<%_ if (useDefaultImport) { _%>
|
|
8
|
+
import express from 'express';
|
|
9
|
+
<%_ } else { _%>
|
|
5
10
|
import * as express from 'express';
|
|
11
|
+
<%_ } _%>
|
|
6
12
|
import { existsSync } from 'node:fs';
|
|
7
13
|
import { join } from 'node:path';
|
|
8
14
|
import bootstrap from './main.server';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ApplicationConfig<% if (provideGlobalErrorListener) { %>, provideBrowserGlobalErrorListeners<% } %>, provideZoneChangeDetection } from '@angular/core';<% if (routing) { %>
|
|
1
|
+
import { ApplicationConfig<% if (provideGlobalErrorListener) { %>, provideBrowserGlobalErrorListeners<% } %><% if (!zoneless) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
|
|
2
2
|
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { appRoutes } from './app.routes';<% } %>
|
|
4
4
|
|
|
5
5
|
export const appConfig: ApplicationConfig = {
|
|
6
6
|
providers: [<% if (provideGlobalErrorListener) { %>
|
|
7
|
-
provideBrowserGlobalErrorListeners(),<% } %>
|
|
8
|
-
provideZoneChangeDetection({ eventCoalescing: true })
|
|
7
|
+
provideBrowserGlobalErrorListeners(),<% } %><% if (!zoneless) { %>
|
|
8
|
+
provideZoneChangeDetection({ eventCoalescing: true }),<% } %><% if (routing) { %>
|
|
9
9
|
provideRouter(appRoutes)<% } %>
|
|
10
10
|
]
|
|
11
11
|
};
|
|
@@ -9,9 +9,9 @@ describe('App<%= componentType %>', () => {
|
|
|
9
9
|
}).compileComponents();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it('should render title', () => {
|
|
12
|
+
it('should render title', <% if (zoneless) { %>async <% } %>() => {
|
|
13
13
|
const fixture = TestBed.createComponent(App<%= componentType %>);
|
|
14
|
-
fixture.detectChanges();
|
|
14
|
+
<%= zoneless ? 'await fixture.whenStable();' : 'fixture.detectChanges();' %>
|
|
15
15
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
16
16
|
expect(compiled.querySelector('h1')?.textContent).toContain(
|
|
17
17
|
'Welcome <%= appName %>'
|
|
@@ -2,8 +2,7 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
|
|
|
2
2
|
import { RouterModule } from '@angular/router';<% } %><% if(!minimal) { %>
|
|
3
3
|
import { NxWelcome<%= componentType %> } from './nx-welcome<%= componentFileSuffix %>';<% } %>
|
|
4
4
|
|
|
5
|
-
@Component({
|
|
6
|
-
standalone: true,<% } %>
|
|
5
|
+
@Component({
|
|
7
6
|
imports: [<% if(!minimal) { %>NxWelcome<%= componentType %>, <% } %><% if(routing) { %>RouterModule<% } %>],
|
|
8
7
|
selector: '<%= rootSelector %>',<% if(!inlineTemplate) { %>
|
|
9
8
|
templateUrl: './app<%= componentFileSuffix %>.html',<% } else { %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import type { NormalizedSchema } from './normalized-schema';
|
|
3
3
|
export declare function addUnitTestRunner(host: Tree, options: NormalizedSchema): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=add-unit-test-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-unit-test-runner.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/add-unit-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"add-unit-test-runner.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/add-unit-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,iBAgC5E"}
|
|
@@ -13,15 +13,26 @@ async function addUnitTestRunner(host, options) {
|
|
|
13
13
|
skipPackageJson: options.skipPackageJson,
|
|
14
14
|
strict: options.strict,
|
|
15
15
|
addPlugin: options.addPlugin,
|
|
16
|
+
runtimeTsconfigFileName: 'tsconfig.app.json',
|
|
17
|
+
zoneless: options.zoneless,
|
|
16
18
|
});
|
|
17
19
|
break;
|
|
18
|
-
case test_runners_1.UnitTestRunner.
|
|
19
|
-
await (0, add_vitest_1.
|
|
20
|
+
case test_runners_1.UnitTestRunner.VitestAngular:
|
|
21
|
+
await (0, add_vitest_1.addVitestAngular)(host, {
|
|
20
22
|
name: options.name,
|
|
21
23
|
projectRoot: options.appProjectRoot,
|
|
22
24
|
skipPackageJson: options.skipPackageJson,
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
case test_runners_1.UnitTestRunner.VitestAnalog:
|
|
28
|
+
await (0, add_vitest_1.addVitestAnalog)(host, {
|
|
29
|
+
name: options.name,
|
|
30
|
+
projectRoot: options.appProjectRoot,
|
|
31
|
+
skipFormat: options.skipFormat,
|
|
32
|
+
skipPackageJson: options.skipPackageJson,
|
|
23
33
|
strict: options.strict,
|
|
24
34
|
addPlugin: options.addPlugin,
|
|
35
|
+
zoneless: options.zoneless,
|
|
25
36
|
});
|
|
26
37
|
break;
|
|
27
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/create-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAchF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"create-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/create-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAchF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,MAAM,iBA4InB"}
|
|
@@ -35,14 +35,12 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
35
35
|
rootTsConfig: (0, devkit_1.joinPathFragments)(rootOffset, (0, js_1.getRootTsConfigFileName)(tree)),
|
|
36
36
|
angularMajorVersion,
|
|
37
37
|
rootOffset,
|
|
38
|
-
// Angular v19 or higher defaults to true, while lower versions default to false
|
|
39
|
-
setStandaloneFalse: angularMajorVersion >= 19,
|
|
40
|
-
setStandaloneTrue: angularMajorVersion < 19,
|
|
41
38
|
provideGlobalErrorListener: angularMajorVersion >= 20,
|
|
42
39
|
usePlatformBrowserDynamic: angularMajorVersion < 20,
|
|
43
40
|
componentType: componentType ? (0, devkit_1.names)(componentType).className : '',
|
|
44
41
|
componentFileSuffix,
|
|
45
42
|
moduleTypeSeparator,
|
|
43
|
+
zoneless: options.zoneless,
|
|
46
44
|
connectCloudUrl,
|
|
47
45
|
tutorialUrl: options.standalone
|
|
48
46
|
? 'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx-project'
|
|
@@ -59,7 +59,7 @@ function createProjectForEsbuild(tree, options) {
|
|
|
59
59
|
? undefined
|
|
60
60
|
: `${options.appProjectSourceRoot}/index.html`,
|
|
61
61
|
browser: `${options.appProjectSourceRoot}/main.ts`,
|
|
62
|
-
polyfills: ['zone.js'],
|
|
62
|
+
polyfills: options.zoneless ? undefined : ['zone.js'],
|
|
63
63
|
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
64
64
|
inlineStyleLanguage,
|
|
65
65
|
assets: [
|
|
@@ -99,14 +99,16 @@ function createProjectForEsbuild(tree, options) {
|
|
|
99
99
|
},
|
|
100
100
|
defaultConfiguration: 'development',
|
|
101
101
|
},
|
|
102
|
-
'extract-i18n':
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
'extract-i18n': angularMajorVersion < 21
|
|
103
|
+
? {
|
|
104
|
+
executor: angularMajorVersion >= 20
|
|
105
|
+
? '@angular/build:extract-i18n'
|
|
106
|
+
: '@angular-devkit/build-angular:extract-i18n',
|
|
107
|
+
options: {
|
|
108
|
+
buildTarget: `${options.name}:build`,
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
: undefined,
|
|
110
112
|
},
|
|
111
113
|
};
|
|
112
114
|
return project;
|
|
@@ -151,7 +153,7 @@ function createProjectForWebpack(tree, options) {
|
|
|
151
153
|
outputPath: options.outputPath,
|
|
152
154
|
index: `${options.appProjectSourceRoot}/index.html`,
|
|
153
155
|
main: `${options.appProjectSourceRoot}/main.ts`,
|
|
154
|
-
polyfills: ['zone.js'],
|
|
156
|
+
polyfills: options.zoneless ? undefined : ['zone.js'],
|
|
155
157
|
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
156
158
|
inlineStyleLanguage,
|
|
157
159
|
assets: [
|
|
@@ -21,7 +21,7 @@ function enableStrictTypeChecking(host, options) {
|
|
|
21
21
|
...json.angularCompilerOptions,
|
|
22
22
|
strictInjectionParameters: true,
|
|
23
23
|
strictInputAccessModifiers: true,
|
|
24
|
-
typeCheckHostBindings: angularMajorVersion
|
|
24
|
+
typeCheckHostBindings: angularMajorVersion === 20 ? true : undefined,
|
|
25
25
|
strictTemplates: true,
|
|
26
26
|
};
|
|
27
27
|
return json;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './add-e2e';
|
|
2
2
|
export * from './add-linting';
|
|
3
3
|
export * from './add-proxy-config';
|
|
4
|
+
export * from './add-serve-static-target';
|
|
4
5
|
export * from './add-unit-test-runner';
|
|
5
6
|
export * from './create-files';
|
|
6
7
|
export * from './create-project';
|
|
@@ -9,5 +10,5 @@ export * from './normalize-options';
|
|
|
9
10
|
export * from './normalized-schema';
|
|
10
11
|
export * from './set-generator-defaults';
|
|
11
12
|
export * from './update-tsconfig-files';
|
|
12
|
-
export * from './
|
|
13
|
+
export * from './validate-options';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./add-e2e"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./add-linting"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./add-proxy-config"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./add-serve-static-target"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./add-unit-test-runner"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./create-files"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./create-project"), exports);
|
|
@@ -12,4 +13,4 @@ tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
|
12
13
|
tslib_1.__exportStar(require("./normalized-schema"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./set-generator-defaults"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./update-tsconfig-files"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./
|
|
16
|
+
tslib_1.__exportStar(require("./validate-options"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAOtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAiB5D,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,EACxB,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAgE3B"}
|
|
@@ -4,6 +4,7 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
7
|
+
const version_utils_1 = require("../../utils/version-utils");
|
|
7
8
|
function arePluginsExplicitlyDisabled(host) {
|
|
8
9
|
const { useInferencePlugins } = (0, devkit_1.readNxJson)(host);
|
|
9
10
|
const addPluginEnvVar = process.env.NX_ADD_PLUGINS;
|
|
@@ -31,6 +32,14 @@ async function normalizeOptions(host, options, isRspack) {
|
|
|
31
32
|
: [];
|
|
32
33
|
const bundler = validateBundler(options.bundler ?? 'esbuild');
|
|
33
34
|
const addPlugin = options.addPlugin ?? (!arePluginsExplicitlyDisabled(host) && isRspack);
|
|
35
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
36
|
+
const zonelessDefaultValue = angularMajorVersion >= 21 ? true : false;
|
|
37
|
+
const unitTestRunner = options.unitTestRunner ??
|
|
38
|
+
(angularMajorVersion >= 21 && bundler === 'esbuild'
|
|
39
|
+
? test_runners_1.UnitTestRunner.VitestAngular
|
|
40
|
+
: angularMajorVersion >= 21
|
|
41
|
+
? test_runners_1.UnitTestRunner.VitestAnalog
|
|
42
|
+
: test_runners_1.UnitTestRunner.Jest);
|
|
34
43
|
// Set defaults and then overwrite with user options
|
|
35
44
|
return {
|
|
36
45
|
addPlugin,
|
|
@@ -38,7 +47,7 @@ async function normalizeOptions(host, options, isRspack) {
|
|
|
38
47
|
routing: true,
|
|
39
48
|
inlineStyle: false,
|
|
40
49
|
inlineTemplate: false,
|
|
41
|
-
skipTests:
|
|
50
|
+
skipTests: unitTestRunner === test_runners_1.UnitTestRunner.None,
|
|
42
51
|
skipFormat: false,
|
|
43
52
|
e2eTestRunner: test_runners_1.E2eTestRunner.Playwright,
|
|
44
53
|
linter: 'eslint',
|
|
@@ -56,6 +65,7 @@ async function normalizeOptions(host, options, isRspack) {
|
|
|
56
65
|
bundler,
|
|
57
66
|
outputPath: (0, devkit_1.joinPathFragments)('dist', !options.rootProject ? appProjectRoot : appProjectName),
|
|
58
67
|
ssr: options.ssr ?? false,
|
|
59
|
-
unitTestRunner
|
|
68
|
+
unitTestRunner,
|
|
69
|
+
zoneless: options.zoneless ?? zonelessDefaultValue,
|
|
60
70
|
};
|
|
61
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-tsconfig-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/update-tsconfig-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS5D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"update-tsconfig-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/update-tsconfig-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS5D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA8ExE"}
|