@nx/angular 21.1.1 → 21.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/index.d.ts +2 -1
- package/mf/index.d.ts +71 -1
- package/migrations.json +106 -0
- package/ng-package.json +0 -1
- package/package.json +28 -16
- package/plugins/component-testing.js +8 -3
- package/src/builders/dev-server/dev-server.impl.js +4 -7
- package/src/builders/dev-server/lib/normalize-options.js +0 -6
- package/src/builders/dev-server/lib/validate-options.js +0 -4
- package/src/builders/dev-server/schema.d.ts +3 -15
- package/src/builders/dev-server/schema.json +3 -9
- package/src/builders/webpack-browser/webpack-browser.impl.js +2 -0
- package/src/builders/webpack-server/webpack-server.impl.d.ts +3 -1
- package/src/builders/webpack-server/webpack-server.impl.js +2 -0
- package/src/executors/application/application.impl.d.ts +2 -2
- package/src/executors/application/application.impl.js +11 -6
- package/src/executors/application/schema.d.ts +1 -1
- package/src/executors/application/schema.json +21 -10
- package/src/executors/application/utils/normalize-options.js +8 -1
- package/src/executors/application/utils/validate-options.js +10 -40
- package/src/executors/extract-i18n/extract-i18n.impl.js +6 -14
- package/src/executors/extract-i18n/schema.d.ts +1 -6
- package/src/executors/extract-i18n/schema.json +5 -0
- package/src/executors/extract-i18n/utils/validate-options.d.ts +2 -0
- package/src/executors/extract-i18n/utils/validate-options.js +13 -0
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -7
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -15
- package/src/executors/module-federation-dev-server/schema.json +2 -15
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +10 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +46 -8
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.d.ts +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.d.ts +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +22 -6
- package/src/executors/ng-packagr-lite/schema.json +2 -3
- package/src/executors/package/package.impl.js +1 -5
- package/src/executors/package/schema.d.ts +3 -1
- package/src/executors/package/schema.json +2 -3
- package/src/executors/utilities/builder-package.d.ts +1 -0
- package/src/executors/utilities/builder-package.js +11 -0
- package/src/executors/utilities/esbuild-extensions.d.ts +2 -1
- package/src/executors/utilities/ng-packagr/package-imports.d.ts +3 -1
- package/src/executors/utilities/ng-packagr/package-imports.js +2 -2
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +2 -24
- package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +40 -107
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +4 -8
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +1 -1
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +18 -11
- package/src/generators/add-linting/add-linting.js +8 -0
- package/src/generators/application/application.js +22 -8
- package/src/generators/application/files/base/tsconfig.app.json__tpl__ +10 -1
- package/src/generators/application/files/base/tsconfig.json__tpl__ +5 -6
- package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +28 -0
- package/src/generators/application/files/ng-module/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +4 -4
- package/src/generators/application/files/ng-module/src/app/app__moduleTypeSeparator__module.ts__tpl__ +17 -0
- package/src/generators/application/files/ng-module/src/main.ts__tpl__ +11 -3
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
- package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +6 -2
- package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +27 -0
- package/src/generators/application/files/standalone-components/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +6 -6
- package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +2 -2
- package/src/generators/application/lib/create-files.d.ts +1 -1
- package/src/generators/application/lib/create-files.js +18 -19
- package/src/generators/application/lib/create-project.d.ts +1 -1
- package/src/generators/application/lib/create-project.js +119 -26
- package/src/generators/application/lib/enable-strict-type-checking.js +4 -2
- package/src/generators/application/lib/index.d.ts +1 -2
- package/src/generators/application/lib/index.js +1 -2
- package/src/generators/application/lib/set-generator-defaults.js +1 -0
- package/src/generators/application/lib/{update-editor-tsconfig.d.ts → update-tsconfig-files.d.ts} +1 -1
- package/src/generators/application/lib/update-tsconfig-files.js +76 -0
- package/src/generators/application/schema.json +1 -1
- package/src/generators/component/component.js +13 -2
- package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
- package/src/generators/component/lib/component.js +11 -1
- package/src/generators/component/lib/module.d.ts +7 -2
- package/src/generators/component/lib/module.js +7 -5
- package/src/generators/component/lib/normalize-options.js +7 -3
- package/src/generators/component/schema.d.ts +1 -0
- package/src/generators/component/schema.json +6 -2
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +37 -24
- package/src/generators/convert-to-rspack/convert-to-rspack.js +2 -6
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +1 -1
- package/src/generators/directive/directive.js +1 -1
- package/src/generators/directive/lib/normalize-options.js +7 -2
- package/src/generators/directive/schema.d.ts +1 -0
- package/src/generators/directive/schema.json +10 -2
- package/src/generators/host/host.js +21 -1
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +7 -1
- package/src/generators/init/init.js +1 -1
- package/src/generators/library/files/base/tsconfig.json__tpl__ +5 -5
- package/src/generators/library/files/ng-module/src/index.ts__tpl__ +1 -1
- package/src/generators/library/files/standalone-components/src/lib/lib.routes.ts__tpl__ +2 -2
- package/src/generators/library/lib/add-standalone-component.js +1 -0
- package/src/generators/library/lib/create-files.js +10 -3
- package/src/generators/library/lib/normalize-options.d.ts +3 -3
- package/src/generators/library/lib/normalize-options.js +6 -1
- package/src/generators/library/lib/normalized-schema.d.ts +2 -0
- package/src/generators/library/lib/set-generator-defaults.js +1 -0
- package/src/generators/library/lib/update-tsconfig-files.d.ts +3 -0
- package/src/generators/library/lib/update-tsconfig-files.js +85 -0
- package/src/generators/library/library.js +19 -33
- package/src/generators/library-secondary-entry-point/files/src/index.ts__tmpl__ +1 -1
- package/src/generators/library-secondary-entry-point/lib/add-files.js +2 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.d.ts +2 -2
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +3 -0
- package/src/generators/library-secondary-entry-point/schema.d.ts +1 -0
- package/src/generators/move/lib/update-module-name.js +17 -10
- package/src/generators/move/lib/update-secondary-entry-points.js +0 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
- package/src/generators/ng-add/migrators/projects/app.migrator.js +43 -8
- package/src/generators/ngrx/schema.json +3 -3
- package/src/generators/ngrx-root-store/lib/normalize-options.js +9 -2
- package/src/generators/pipe/lib/normalize-options.js +4 -0
- package/src/generators/pipe/pipe.js +1 -1
- package/src/generators/pipe/schema.d.ts +1 -0
- package/src/generators/pipe/schema.json +11 -2
- package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +4 -4
- package/src/generators/remote/lib/update-ssr-setup.js +5 -0
- package/src/generators/remote/remote.js +23 -0
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +7 -1
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -3
- package/src/generators/scam/lib/normalize-options.js +11 -3
- package/src/generators/scam/schema.d.ts +1 -0
- package/src/generators/scam/schema.json +1 -2
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +1 -3
- package/src/generators/scam-directive/lib/normalize-options.js +11 -2
- package/src/generators/scam-directive/schema.d.ts +2 -0
- package/src/generators/scam-directive/schema.json +10 -2
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +1 -3
- package/src/generators/scam-pipe/lib/normalize-options.js +8 -0
- package/src/generators/scam-pipe/schema.d.ts +2 -0
- package/src/generators/scam-pipe/schema.json +5 -0
- package/src/generators/setup-mf/files/entry-module-files/{entry.module.ts__tmpl__ → __entryModuleFileName__.ts__tmpl__} +4 -4
- package/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/entry-module-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +1 -1
- package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +43 -0
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/files/standalone-entry-component-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +3 -3
- package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
- package/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +1 -1
- package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
- package/src/generators/setup-mf/lib/add-remote-entry.d.ts +2 -2
- package/src/generators/setup-mf/lib/add-remote-entry.js +9 -3
- package/src/generators/setup-mf/lib/add-remote-to-host.js +11 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +2 -2
- package/src/generators/setup-mf/lib/fix-bootstrap.js +4 -4
- package/src/generators/setup-mf/lib/generate-config.d.ts +2 -2
- package/src/generators/setup-mf/lib/generate-config.js +1 -0
- package/src/generators/setup-mf/lib/normalize-options.d.ts +1 -1
- package/src/generators/setup-mf/lib/normalize-options.js +13 -0
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +18 -14
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -5
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +2 -2
- package/src/generators/setup-mf/lib/setup-tspath-for-remote.js +1 -1
- package/src/generators/setup-mf/lib/update-host-app-routes.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-host-app-routes.js +12 -9
- package/src/generators/setup-mf/lib/update-tsconfig.d.ts +2 -2
- package/src/generators/setup-mf/lib/update-tsconfig.js +5 -5
- package/src/generators/setup-mf/schema.d.ts +7 -0
- package/src/generators/setup-mf/setup-mf.d.ts +2 -2
- package/src/generators/setup-mf/setup-mf.js +16 -6
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/__rootModuleFileName__ +12 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +66 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +12 -0
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/root/tsconfig.server.json.template +18 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +69 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
- package/src/generators/setup-ssr/lib/add-dependencies.js +11 -8
- package/src/generators/setup-ssr/lib/add-hydration.js +10 -3
- package/src/generators/setup-ssr/lib/add-server-file.js +7 -2
- package/src/generators/setup-ssr/lib/generate-files.js +17 -4
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +32 -6
- package/src/generators/setup-ssr/lib/normalize-options.js +5 -3
- package/src/generators/setup-ssr/lib/update-project-config.js +5 -0
- package/src/generators/setup-ssr/lib/validate-options.js +2 -2
- package/src/generators/setup-ssr/schema.d.ts +1 -0
- package/src/generators/setup-ssr/schema.json +1 -1
- package/src/generators/utils/add-jest.js +6 -1
- package/src/generators/utils/app-components-info.d.ts +9 -0
- package/src/generators/utils/app-components-info.js +39 -0
- package/src/generators/utils/artifact-types.d.ts +3 -0
- package/src/generators/utils/artifact-types.js +33 -0
- package/src/generators/utils/assert-mf-utils.d.ts +1 -0
- package/src/generators/utils/assert-mf-utils.js +11 -0
- package/src/generators/utils/ensure-angular-dependencies.js +6 -3
- package/src/generators/utils/export-scam.d.ts +1 -0
- package/src/generators/utils/export-scam.js +1 -2
- package/src/generators/utils/find-module.js +18 -13
- package/src/generators/utils/storybook-ast/component-info.js +40 -24
- package/src/generators/utils/storybook-ast/module-info.d.ts +1 -1
- package/src/generators/utils/storybook-ast/module-info.js +3 -8
- package/src/generators/utils/testing.js +28 -28
- package/src/generators/utils/version-utils.js +2 -2
- package/src/generators/web-worker/lib/add-snippet.js +3 -3
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.d.ts +2 -0
- package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +110 -0
- package/src/migrations/update-21-2-0/replace-provide-server-routing.d.ts +2 -0
- package/src/migrations/update-21-2-0/replace-provide-server-routing.js +103 -0
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.d.ts +2 -0
- package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.js +47 -0
- package/src/migrations/update-21-2-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-21-2-0/update-angular-cli.js +23 -0
- package/src/migrations/update-21-2-0/update-module-resolution.d.ts +2 -0
- package/src/migrations/update-21-2-0/update-module-resolution.js +45 -0
- package/src/plugins/plugin.js +22 -13
- package/src/utils/backward-compatible-versions.d.ts +2 -2
- package/src/utils/backward-compatible-versions.js +22 -19
- package/src/utils/nx-devkit/ast-utils.js +17 -3
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/targets.d.ts +2 -1
- package/src/utils/targets.js +6 -0
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +5 -4
- package/mf/mf.d.ts +0 -69
- package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
- package/src/generators/application/files/ng-module/src/app/app.component.spec.ts__tpl__ +0 -29
- package/src/generators/application/files/ng-module/src/app/app.module.ts__tpl__ +0 -17
- package/src/generators/application/files/standalone-components/src/app/app.component.__style__ +0 -0
- package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__ +0 -28
- package/src/generators/application/lib/set-app-strict-default.d.ts +0 -2
- package/src/generators/application/lib/set-app-strict-default.js +0 -13
- package/src/generators/application/lib/update-editor-tsconfig.js +0 -21
- package/src/generators/library/lib/enable-strict-type-checking.d.ts +0 -7
- package/src/generators/library/lib/enable-strict-type-checking.js +0 -47
- package/src/generators/library/lib/update-tsconfig.d.ts +0 -3
- package/src/generators/library/lib/update-tsconfig.js +0 -36
- package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +0 -47
- /package/src/generators/application/files/{base-18+ → base}/public/favicon.ico +0 -0
- /package/src/generators/application/files/{base-pre18/src/assets/.gitkeep__tpl__ → ng-module/src/app/app__componentFileSuffix__.__style__} +0 -0
- /package/src/generators/application/files/ng-module/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
- /package/src/generators/application/files/{ng-module/src/app/app.component.__style__ → standalone-components/src/app/app__componentFileSuffix__.__style__} +0 -0
- /package/src/generators/application/files/standalone-components/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
- /package/src/generators/component/files/{__fileName__.html__tpl__ → __fileName____ngext__.html__tpl__} +0 -0
- /package/src/generators/library/files/ng-module/src/lib/{__libFileName__.module.ts__tpl__ → __libFileName____moduleTypeSeparator__module.ts__tpl__} +0 -0
- /package/src/generators/library-secondary-entry-point/files/src/lib/{__fileName__.module.ts__tmpl__ → __fileName____moduleTypeSeparator__module.ts__tmpl__} +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder-common-engine/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/root/tsconfig.server.json.template +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/server/__serverFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/app/app.config.server.ts.template +0 -0
@@ -3,10 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addJest = addJest;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const versions_1 = require("../../utils/versions");
|
6
|
+
const version_utils_1 = require("./version-utils");
|
6
7
|
async function addJest(tree, options) {
|
7
8
|
if (!options.skipPackageJson) {
|
8
9
|
process.env.npm_config_legacy_peer_deps ??= 'true';
|
9
|
-
(0,
|
10
|
+
const pkgVersions = (0, version_utils_1.versions)(tree);
|
11
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
12
|
+
// TODO(leo): jest-preset-angular still needs this until https://github.com/thymikee/jest-preset-angular/pull/3079 is merged
|
13
|
+
'@angular/platform-browser-dynamic': pkgVersions.angularVersion,
|
14
|
+
}, { 'jest-preset-angular': pkgVersions.jestPresetAngularVersion }, undefined, true);
|
10
15
|
}
|
11
16
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
|
12
17
|
await configurationGenerator(tree, {
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { type ProjectConfiguration, type Tree } from '@nx/devkit';
|
2
|
+
export type ComponentMetadata = {
|
3
|
+
fileName: string;
|
4
|
+
extensionlessFileName: string;
|
5
|
+
path: string;
|
6
|
+
symbolName: string;
|
7
|
+
};
|
8
|
+
export declare function getAppComponentInfo(tree: Tree, componentFileSuffix: string, project: ProjectConfiguration): ComponentMetadata;
|
9
|
+
export declare function getNxWelcomeComponentInfo(tree: Tree, componentFileSuffix: string, project: ProjectConfiguration): ComponentMetadata;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getAppComponentInfo = getAppComponentInfo;
|
4
|
+
exports.getNxWelcomeComponentInfo = getNxWelcomeComponentInfo;
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
6
|
+
const node_path_1 = require("node:path");
|
7
|
+
const version_utils_1 = require("./version-utils");
|
8
|
+
function getAppComponentInfo(tree, componentFileSuffix, project) {
|
9
|
+
return getComponentInfo(tree, 'app', componentFileSuffix, project);
|
10
|
+
}
|
11
|
+
function getNxWelcomeComponentInfo(tree, componentFileSuffix, project) {
|
12
|
+
return getComponentInfo(tree, 'nx-welcome', componentFileSuffix, project);
|
13
|
+
}
|
14
|
+
// TODO(leo): follow this up and improve it by using static analysis
|
15
|
+
function getComponentInfo(tree, component, componentFileSuffix, project) {
|
16
|
+
let componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}.component.ts`);
|
17
|
+
if (!tree.exists(componentPath)) {
|
18
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}.ts`);
|
19
|
+
}
|
20
|
+
if (!tree.exists(componentPath)) {
|
21
|
+
if (componentFileSuffix) {
|
22
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, `app/${component}${componentFileSuffix}.ts`);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
if (!tree.exists(componentPath)) {
|
26
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
27
|
+
componentPath = (0, devkit_1.joinPathFragments)(project.sourceRoot, angularMajorVersion >= 20
|
28
|
+
? `app/${component}.ts`
|
29
|
+
: `app/${component}.component.ts`);
|
30
|
+
}
|
31
|
+
const fileName = (0, node_path_1.basename)(componentPath);
|
32
|
+
const extensionlessFileName = fileName.slice(0, -3);
|
33
|
+
return {
|
34
|
+
fileName,
|
35
|
+
extensionlessFileName,
|
36
|
+
path: componentPath,
|
37
|
+
symbolName: (0, devkit_1.names)(extensionlessFileName).className,
|
38
|
+
};
|
39
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getComponentType = getComponentType;
|
4
|
+
exports.getModuleTypeSeparator = getModuleTypeSeparator;
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
6
|
+
const version_utils_1 = require("./version-utils");
|
7
|
+
function getComponentType(tree) {
|
8
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
9
|
+
let componentType = nxJson.generators?.['@nx/angular:component']?.type ??
|
10
|
+
nxJson.generators?.['@nx/angular']?.component?.type;
|
11
|
+
if (!componentType) {
|
12
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
13
|
+
if (angularMajorVersion < 20) {
|
14
|
+
componentType = 'component';
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return componentType;
|
18
|
+
}
|
19
|
+
function getModuleTypeSeparator(tree) {
|
20
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
21
|
+
// We don't have a "module" generator but the @nx/angular collection extends
|
22
|
+
// from the @schematics/angular collection so the "module" generator is
|
23
|
+
// available there. We check for a generator default for each collection.
|
24
|
+
let typeSeparator = nxJson.generators?.['@nx/angular:module']?.typeSeparator ??
|
25
|
+
nxJson.generators?.['@nx/angular']?.module?.typeSeparator ??
|
26
|
+
nxJson.generators?.['@schematics/angular:module']?.typeSeparator ??
|
27
|
+
nxJson.generators?.['@schematics/angular']?.module?.typeSeparator;
|
28
|
+
if (!typeSeparator) {
|
29
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
30
|
+
typeSeparator = angularMajorVersion >= 20 ? '-' : '.';
|
31
|
+
}
|
32
|
+
return typeSeparator;
|
33
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function assertRspackIsCSR(bundler: 'webpack' | 'rspack', ssr: boolean, serverRouting: boolean): void;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.assertRspackIsCSR = assertRspackIsCSR;
|
4
|
+
function assertRspackIsCSR(bundler, ssr, serverRouting) {
|
5
|
+
if (bundler === 'rspack' && serverRouting) {
|
6
|
+
throw new Error('Server Routing is not currently supported for Angular Rspack Module Federation. Please use webpack instead.');
|
7
|
+
}
|
8
|
+
if (bundler === 'rspack' && ssr) {
|
9
|
+
throw new Error('SSR is not currently supported for Angular Rspack Module Federation. Please use webpack instead.');
|
10
|
+
}
|
11
|
+
}
|
@@ -24,13 +24,12 @@ function ensureAngularDependencies(tree) {
|
|
24
24
|
dependencies['@angular/core'] = angularVersion;
|
25
25
|
dependencies['@angular/forms'] = angularVersion;
|
26
26
|
dependencies['@angular/platform-browser'] = angularVersion;
|
27
|
-
dependencies['@angular/platform-browser-dynamic'] = angularVersion;
|
28
27
|
dependencies['@angular/router'] = angularVersion;
|
29
28
|
dependencies.rxjs = rxjsVersion;
|
30
29
|
dependencies.tslib = tsLibVersion;
|
31
30
|
dependencies['zone.js'] = zoneJsVersion;
|
32
31
|
}
|
33
|
-
const installedAngularDevkitVersion = (0, version_utils_1.
|
32
|
+
const installedAngularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree);
|
34
33
|
if (!installedAngularDevkitVersion) {
|
35
34
|
/**
|
36
35
|
* If `@angular-devkit/build-angular` is already installed, we assume the workspace
|
@@ -43,8 +42,12 @@ function ensureAngularDependencies(tree) {
|
|
43
42
|
}
|
44
43
|
// Ensure the `@nx/angular` peer dependencies are always installed.
|
45
44
|
const angularDevkitVersion = installedAngularDevkitVersion ?? pkgVersions.angularDevkitVersion;
|
46
|
-
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
47
45
|
devDependencies['@angular-devkit/schematics'] = angularDevkitVersion;
|
48
46
|
devDependencies['@schematics/angular'] = angularDevkitVersion;
|
47
|
+
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
48
|
+
if (angularMajorVersion < 20) {
|
49
|
+
devDependencies['@angular/build'] = angularDevkitVersion;
|
50
|
+
devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
51
|
+
}
|
49
52
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies, undefined, true);
|
50
53
|
}
|
@@ -27,8 +27,7 @@ function exportScam(tree, options) {
|
|
27
27
|
let updatedEntryPointContent = (0, devkit_1.stripIndents) `${entryPointContent}
|
28
28
|
export * from '${relativePathFromEntryPoint}';`;
|
29
29
|
if (!options.inlineScam) {
|
30
|
-
const
|
31
|
-
const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, moduleFilePath);
|
30
|
+
const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, options.modulePath);
|
32
31
|
updatedEntryPointContent = (0, devkit_1.stripIndents) `${updatedEntryPointContent}
|
33
32
|
export * from '${relativePathFromModule}';`;
|
34
33
|
}
|
@@ -9,38 +9,43 @@ const js_1 = require("@nx/js");
|
|
9
9
|
const insert_ngmodule_import_1 = require("./insert-ngmodule-import");
|
10
10
|
let tsModule;
|
11
11
|
function findModule(tree, path, module) {
|
12
|
-
|
12
|
+
const candidatePaths = [];
|
13
13
|
let pathToSearch = path;
|
14
14
|
while (pathToSearch !== '.' && pathToSearch !== '/') {
|
15
15
|
if (module) {
|
16
16
|
const pathToModule = (0, devkit_1.joinPathFragments)(pathToSearch, module);
|
17
17
|
if (tree.exists(pathToModule)) {
|
18
|
-
|
18
|
+
candidatePaths.push(pathToModule);
|
19
19
|
break;
|
20
20
|
}
|
21
21
|
}
|
22
22
|
else {
|
23
23
|
const potentialOptions = tree
|
24
24
|
.children(pathToSearch)
|
25
|
-
.filter((f) => f.endsWith('.module.ts'));
|
26
|
-
if (potentialOptions.length >
|
27
|
-
|
28
|
-
}
|
29
|
-
else if (potentialOptions.length === 1) {
|
30
|
-
modulePath = (0, devkit_1.joinPathFragments)(pathToSearch, potentialOptions[0]);
|
25
|
+
.filter((f) => f.endsWith('.module.ts') || f.endsWith('-module.ts'));
|
26
|
+
if (potentialOptions.length > 0) {
|
27
|
+
candidatePaths.push(...potentialOptions.map((p) => (0, devkit_1.joinPathFragments)(pathToSearch, p)));
|
31
28
|
break;
|
32
29
|
}
|
33
30
|
}
|
34
31
|
pathToSearch = (0, path_1.dirname)(pathToSearch);
|
35
32
|
}
|
36
|
-
if (
|
33
|
+
if (candidatePaths.length === 0) {
|
37
34
|
throw new Error('Could not find a declaring module file.');
|
38
35
|
}
|
39
|
-
const
|
40
|
-
|
41
|
-
|
36
|
+
const modules = candidatePaths.filter((p) => {
|
37
|
+
const moduleContents = tree.read(p, 'utf-8');
|
38
|
+
return moduleContents.includes('@NgModule');
|
39
|
+
});
|
40
|
+
if (modules.length === 0) {
|
41
|
+
throw new Error(candidatePaths.length === 1
|
42
|
+
? `Declaring module file (${candidatePaths[0]}) does not contain an @NgModule Declaration.`
|
43
|
+
: `Declaring module files (${candidatePaths.join(', ')}) do not contain an @NgModule Declaration.`);
|
44
|
+
}
|
45
|
+
if (modules.length > 1) {
|
46
|
+
throw new Error(`More than one NgModule was found. Please provide the NgModule you wish to use.`);
|
42
47
|
}
|
43
|
-
return
|
48
|
+
return modules[0];
|
44
49
|
}
|
45
50
|
function addToNgModule(tree, path, modulePath, name, className, fileName, ngModuleProperty,
|
46
51
|
// TODO(leo): remove once all consumers are updated
|
@@ -14,15 +14,15 @@ function getComponentsInfo(tree, entryPoint, moduleFilePaths, projectName) {
|
|
14
14
|
return moduleFilePaths
|
15
15
|
.flatMap((moduleFilePath) => {
|
16
16
|
const file = (0, ast_utils_1.getTsSourceFile)(tree, moduleFilePath);
|
17
|
-
const
|
18
|
-
if (
|
17
|
+
const moduleDeclarations = (0, module_info_1.getModuleDeclarations)(file, moduleFilePath, projectName);
|
18
|
+
if (moduleDeclarations.length === 0) {
|
19
19
|
return undefined;
|
20
20
|
}
|
21
21
|
if (!tsModule) {
|
22
22
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
23
23
|
}
|
24
24
|
const imports = file.statements.filter((statement) => statement.kind === tsModule.SyntaxKind.ImportDeclaration);
|
25
|
-
const componentsInfo =
|
25
|
+
const componentsInfo = moduleDeclarations.map((maybeComponentName) => tryGetComponentInfo(tree, entryPoint, file, imports, moduleFilePath, maybeComponentName));
|
26
26
|
return componentsInfo;
|
27
27
|
})
|
28
28
|
.filter((f) => f !== undefined);
|
@@ -100,7 +100,7 @@ function getComponentImportPath(componentName, imports) {
|
|
100
100
|
.slice(1, -1);
|
101
101
|
return importPath;
|
102
102
|
}
|
103
|
-
function
|
103
|
+
function tryGetComponentInfo(tree, entryPoint, sourceFile, imports, moduleFilePath, symbolName) {
|
104
104
|
try {
|
105
105
|
if (!tsquery) {
|
106
106
|
(0, ensure_typescript_1.ensureTypescript)();
|
@@ -108,38 +108,53 @@ function getComponentInfo(tree, entryPoint, sourceFile, imports, moduleFilePath,
|
|
108
108
|
}
|
109
109
|
const moduleFolderPath = (0, path_1.dirname)(moduleFilePath);
|
110
110
|
// try to get the component from the same file (inline scam)
|
111
|
-
const node = tsquery(sourceFile, `ClassDeclaration:has(Decorator > CallExpression > Identifier[name=Component]):has(Identifier[name=${
|
111
|
+
const node = tsquery(sourceFile, `ClassDeclaration:has(Decorator > CallExpression > Identifier[name=Component]):has(Identifier[name=${symbolName}])`, { visitAllChildren: true })[0];
|
112
112
|
if (node) {
|
113
113
|
return {
|
114
114
|
componentFileName: (0, path_1.basename)(moduleFilePath, '.ts'),
|
115
115
|
moduleFolderPath,
|
116
|
-
name:
|
116
|
+
name: symbolName,
|
117
117
|
path: '.',
|
118
118
|
entryPointName: entryPoint.name,
|
119
119
|
};
|
120
120
|
}
|
121
121
|
// try to get the component from the imports
|
122
|
-
const
|
123
|
-
|
124
|
-
if (tree.exists(
|
125
|
-
return
|
122
|
+
const symbolFilePathRelativeToModule = getComponentImportPath(symbolName, imports);
|
123
|
+
let symbolImportPath = getFullComponentFilePath(moduleFolderPath, symbolFilePathRelativeToModule);
|
124
|
+
if (tree.exists(symbolImportPath) && !tree.isFile(symbolImportPath)) {
|
125
|
+
return tryGetComponentInfoFromDir(tree, entryPoint, symbolImportPath, symbolName, moduleFolderPath);
|
126
126
|
}
|
127
|
-
const
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
127
|
+
const candidatePaths = [
|
128
|
+
symbolImportPath,
|
129
|
+
`${symbolImportPath}.ts`,
|
130
|
+
`${symbolImportPath}.js`,
|
131
|
+
];
|
132
|
+
for (const candidatePath of candidatePaths) {
|
133
|
+
if (!tree.exists(candidatePath)) {
|
134
|
+
continue;
|
135
|
+
}
|
136
|
+
const content = tree.read(candidatePath, 'utf-8');
|
137
|
+
const classAndComponentRegex = new RegExp(`@Component[\\s\\S\n]*?\\bclass ${symbolName}\\b`, 'g');
|
138
|
+
if (content.match(classAndComponentRegex)) {
|
139
|
+
const path = (0, path_1.dirname)(symbolFilePathRelativeToModule);
|
140
|
+
const componentFileName = (0, path_1.basename)(symbolFilePathRelativeToModule);
|
141
|
+
return {
|
142
|
+
componentFileName,
|
143
|
+
moduleFolderPath,
|
144
|
+
name: symbolName,
|
145
|
+
path,
|
146
|
+
entryPointName: entryPoint.name,
|
147
|
+
};
|
148
|
+
}
|
149
|
+
}
|
150
|
+
return undefined;
|
136
151
|
}
|
137
152
|
catch (ex) {
|
138
|
-
devkit_1.logger.warn(`Could not generate a story for ${
|
153
|
+
devkit_1.logger.warn(`Could not generate a story for ${symbolName}. Error: ${ex}`);
|
139
154
|
return undefined;
|
140
155
|
}
|
141
156
|
}
|
142
|
-
function
|
157
|
+
function tryGetComponentInfoFromDir(tree, entryPoint, dir, symbolName, moduleFolderPath) {
|
143
158
|
let path = null;
|
144
159
|
let componentFileName = null;
|
145
160
|
const componentImportPathChildren = [];
|
@@ -149,7 +164,7 @@ function getComponentInfoFromDir(tree, entryPoint, dir, componentName, moduleFol
|
|
149
164
|
for (const candidateFile of componentImportPathChildren) {
|
150
165
|
if (candidateFile.endsWith('.ts')) {
|
151
166
|
const content = tree.read(candidateFile, 'utf-8');
|
152
|
-
const classAndComponentRegex = new RegExp(`@Component[\\s\\S\n]*?\\bclass ${
|
167
|
+
const classAndComponentRegex = new RegExp(`@Component[\\s\\S\n]*?\\bclass ${symbolName}\\b`, 'g');
|
153
168
|
if (content.match(classAndComponentRegex)) {
|
154
169
|
path = candidateFile
|
155
170
|
.slice(0, candidateFile.lastIndexOf('/'))
|
@@ -160,12 +175,13 @@ function getComponentInfoFromDir(tree, entryPoint, dir, componentName, moduleFol
|
|
160
175
|
}
|
161
176
|
}
|
162
177
|
if (path === null) {
|
163
|
-
|
178
|
+
console.warn(`Couldn't resolve "${symbolName}" imported from ${dir} relative to ${moduleFolderPath}.`);
|
179
|
+
return undefined;
|
164
180
|
}
|
165
181
|
return {
|
166
182
|
componentFileName,
|
167
183
|
moduleFolderPath,
|
168
|
-
name:
|
184
|
+
name: symbolName,
|
169
185
|
path,
|
170
186
|
entryPointName: entryPoint.name,
|
171
187
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
2
2
|
import type { SourceFile } from 'typescript';
|
3
3
|
import type { EntryPoint } from './entry-point';
|
4
|
-
export declare function
|
4
|
+
export declare function getModuleDeclarations(file: SourceFile, moduleFilePath: string, projectName: string): string[];
|
5
5
|
export declare function getModuleFilePaths(tree: Tree, entryPoint: EntryPoint): string[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.getModuleDeclarations = getModuleDeclarations;
|
4
4
|
exports.getModuleFilePaths = getModuleFilePaths;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
6
|
const js_1 = require("@nx/js");
|
@@ -8,7 +8,7 @@ const path_1 = require("path");
|
|
8
8
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
9
9
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
10
10
|
let tsModule;
|
11
|
-
function
|
11
|
+
function getModuleDeclarations(file, moduleFilePath, projectName) {
|
12
12
|
const ngModuleDecorator = getNgModuleDecorator(file, moduleFilePath);
|
13
13
|
const declarationsPropertyAssignment = getNgModuleDeclarationsPropertyAssignment(ngModuleDecorator, moduleFilePath, projectName);
|
14
14
|
if (!declarationsPropertyAssignment) {
|
@@ -18,7 +18,7 @@ function getModuleDeclaredComponents(file, moduleFilePath, projectName) {
|
|
18
18
|
if (!declarationsArray) {
|
19
19
|
return [];
|
20
20
|
}
|
21
|
-
return
|
21
|
+
return getDeclaredComponentNodes(declarationsArray).map((node) => node.getText());
|
22
22
|
}
|
23
23
|
function getModuleFilePaths(tree, entryPoint) {
|
24
24
|
let moduleFilePaths = [];
|
@@ -43,11 +43,6 @@ function hasNgModule(tree, filePath) {
|
|
43
43
|
const ngModule = tsquery(ast, 'ClassDeclaration > Decorator > CallExpression > Identifier[name=NgModule]', { visitAllChildren: true });
|
44
44
|
return ngModule.length > 0;
|
45
45
|
}
|
46
|
-
function getDeclaredComponentsInDeclarations(declarationsArray) {
|
47
|
-
return getDeclaredComponentNodes(declarationsArray)
|
48
|
-
.map((node) => node.getText())
|
49
|
-
.filter((name) => name.endsWith('Component'));
|
50
|
-
}
|
51
46
|
function getDeclaredComponentNodes(declarationsArray) {
|
52
47
|
if (!tsModule) {
|
53
48
|
tsModule = (0, ensure_typescript_1.ensureTypescript)();
|
@@ -52,24 +52,24 @@ async function createStorybookTestWorkspaceForLib(libName) {
|
|
52
52
|
standalone: false,
|
53
53
|
skipFormat: true,
|
54
54
|
});
|
55
|
-
tree.write(`${libName}/src/lib/test-button/test-button.
|
55
|
+
tree.write(`${libName}/src/lib/test-button/test-button.ts`, `import { Component, Input } from '@angular/core';
|
56
56
|
|
57
57
|
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
58
58
|
|
59
59
|
@Component({
|
60
60
|
selector: 'proj-test-button',
|
61
|
-
templateUrl: './test-button.
|
62
|
-
styleUrls: ['./test-button.
|
61
|
+
templateUrl: './test-button.html',
|
62
|
+
styleUrls: ['./test-button.css']
|
63
63
|
})
|
64
|
-
export class
|
64
|
+
export class TestButton {
|
65
65
|
@Input('buttonType') type = 'button';
|
66
66
|
@Input() style: ButtonStyle = 'default';
|
67
67
|
@Input() age?: number;
|
68
68
|
@Input() isOn = false;
|
69
69
|
}`);
|
70
|
-
tree.write(`${libName}/src/lib/test-button/test-button.
|
71
|
-
const modulePath = `${libName}/src/lib/${libName}
|
72
|
-
tree.write(modulePath, `import * as ButtonExports from './test-button/test-button
|
70
|
+
tree.write(`${libName}/src/lib/test-button/test-button.html`, `<button [attr.type]="type" [ngClass]="style"></button>`);
|
71
|
+
const modulePath = `${libName}/src/lib/${libName}-module.ts`;
|
72
|
+
tree.write(modulePath, `import * as ButtonExports from './test-button/test-button';
|
73
73
|
${tree.read(modulePath)}`);
|
74
74
|
// create a module with component that gets exported in a barrel file
|
75
75
|
generateModule(tree, {
|
@@ -83,14 +83,14 @@ export class TestButtonComponent {
|
|
83
83
|
standalone: false,
|
84
84
|
skipFormat: true,
|
85
85
|
});
|
86
|
-
tree.write(`${libName}/src/lib/barrel/barrel-button/index.ts`, `export * from './barrel-button
|
87
|
-
tree.write(`${libName}/src/lib/barrel/barrel
|
86
|
+
tree.write(`${libName}/src/lib/barrel/barrel-button/index.ts`, `export * from './barrel-button';`);
|
87
|
+
tree.write(`${libName}/src/lib/barrel/barrel-module.ts`, `import { NgModule } from '@angular/core';
|
88
88
|
import { CommonModule } from '@angular/common';
|
89
|
-
import {
|
89
|
+
import { BarrelButton } from './barrel-button';
|
90
90
|
|
91
91
|
@NgModule({
|
92
92
|
imports: [CommonModule],
|
93
|
-
declarations: [
|
93
|
+
declarations: [BarrelButton],
|
94
94
|
})
|
95
95
|
export class BarrelModule {}`);
|
96
96
|
// create a module with components that get Angular exported and declared by variable
|
@@ -112,14 +112,14 @@ export class BarrelModule {}`);
|
|
112
112
|
standalone: false,
|
113
113
|
skipFormat: true,
|
114
114
|
});
|
115
|
-
tree.write(`${libName}/src/lib/variable-declare/variable-declare
|
115
|
+
tree.write(`${libName}/src/lib/variable-declare/variable-declare-module.ts`, `import { NgModule } from '@angular/core';
|
116
116
|
import { CommonModule } from '@angular/common';
|
117
|
-
import {
|
118
|
-
import {
|
117
|
+
import { VariableDeclareButton } from './variable-declare-button/variable-declare-button';
|
118
|
+
import { VariableDeclareView } from './variable-declare-view/variable-declare-view';
|
119
119
|
|
120
120
|
const COMPONENTS = [
|
121
|
-
|
122
|
-
|
121
|
+
VariableDeclareButton,
|
122
|
+
VariableDeclareView
|
123
123
|
]
|
124
124
|
|
125
125
|
@NgModule({
|
@@ -154,20 +154,20 @@ export class VariableDeclareModule {}`);
|
|
154
154
|
standalone: false,
|
155
155
|
skipFormat: true,
|
156
156
|
});
|
157
|
-
tree.write(`${libName}/src/lib/variable-spread-declare/variable-spread-declare
|
157
|
+
tree.write(`${libName}/src/lib/variable-spread-declare/variable-spread-declare-module.ts`, `import { NgModule } from '@angular/core';
|
158
158
|
import { CommonModule } from '@angular/common';
|
159
|
-
import {
|
160
|
-
import {
|
161
|
-
import {
|
159
|
+
import { VariableSpreadDeclareButton } from './variable-spread-declare-button/variable-spread-declare-button';
|
160
|
+
import { VariableSpreadDeclareView } from './variable-spread-declare-view/variable-spread-declare-view';
|
161
|
+
import { VariableSpreadDeclareAnotherview } from './variable-spread-declare-anotherview/variable-spread-declare-anotherview';
|
162
162
|
|
163
163
|
const COMPONENTS = [
|
164
|
-
|
165
|
-
|
164
|
+
VariableSpreadDeclareButton,
|
165
|
+
VariableSpreadDeclareView
|
166
166
|
]
|
167
167
|
|
168
168
|
@NgModule({
|
169
169
|
imports: [CommonModule],
|
170
|
-
declarations: [...COMPONENTS,
|
170
|
+
declarations: [...COMPONENTS, VariableSpreadDeclareAnotherview],
|
171
171
|
})
|
172
172
|
export class VariableSpreadDeclareModule {}`);
|
173
173
|
// create a module where declared components are pulled from a static member of the module
|
@@ -189,10 +189,10 @@ export class VariableSpreadDeclareModule {}`);
|
|
189
189
|
standalone: false,
|
190
190
|
skipFormat: true,
|
191
191
|
});
|
192
|
-
tree.write(`${libName}/src/lib/static-member-declarations/static-member-declarations
|
192
|
+
tree.write(`${libName}/src/lib/static-member-declarations/static-member-declarations-module.ts`, `import { NgModule } from '@angular/core';
|
193
193
|
import { CommonModule } from '@angular/common';
|
194
|
-
import {
|
195
|
-
import {
|
194
|
+
import { Cmp1 } from './cmp1/cmp1';
|
195
|
+
import { Cmp2 } from './cmp2/cmp2';
|
196
196
|
|
197
197
|
@NgModule({
|
198
198
|
imports: [CommonModule],
|
@@ -200,7 +200,7 @@ import { Cmp2Component } from './cmp2/cmp2.component';
|
|
200
200
|
exports: StaticMemberDeclarationsModule.COMPONENTS
|
201
201
|
})
|
202
202
|
export class StaticMemberDeclarationsModule {
|
203
|
-
static readonly COMPONENTS = [
|
203
|
+
static readonly COMPONENTS = [Cmp1, Cmp2];
|
204
204
|
}`);
|
205
205
|
// create another button in a nested subpath
|
206
206
|
generateModule(tree, {
|
@@ -231,7 +231,7 @@ function generateModule(tree, options) {
|
|
231
231
|
options.path = `${sourceRoot}/${projectDirName}`;
|
232
232
|
}
|
233
233
|
const moduleNames = (0, devkit_1.names)(options.name);
|
234
|
-
const moduleFilePath = `${options.path}/${moduleNames.fileName}/${moduleNames.fileName}
|
234
|
+
const moduleFilePath = `${options.path}/${moduleNames.fileName}/${moduleNames.fileName}-module.ts`;
|
235
235
|
tree.write(moduleFilePath, `import { NgModule } from '@angular/core';
|
236
236
|
import { CommonModule } from '@angular/common';
|
237
237
|
|
@@ -49,10 +49,10 @@ function getInstalledPackageVersionInfo(tree, pkgName) {
|
|
49
49
|
function versions(tree) {
|
50
50
|
const majorAngularVersion = getInstalledAngularMajorVersion(tree);
|
51
51
|
switch (majorAngularVersion) {
|
52
|
-
case 17:
|
53
|
-
return backward_compatible_versions_1.backwardCompatibleVersions.angularV17;
|
54
52
|
case 18:
|
55
53
|
return backward_compatible_versions_1.backwardCompatibleVersions.angularV18;
|
54
|
+
case 19:
|
55
|
+
return backward_compatible_versions_1.backwardCompatibleVersions.angularV19;
|
56
56
|
default:
|
57
57
|
return latestVersions;
|
58
58
|
}
|
@@ -4,9 +4,9 @@ exports.addSnippet = addSnippet;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
function addSnippet(tree, name, path) {
|
6
6
|
const fileRegExp = new RegExp(`^${name}.*\\.ts`);
|
7
|
-
const
|
8
|
-
|
9
|
-
.filter((f) => fileRegExp.test(f) && !/(module|spec)\.ts$/.test(f))
|
7
|
+
const siblingModules = tree
|
8
|
+
.children(path)
|
9
|
+
.filter((f) => fileRegExp.test(f) && !/(module|spec|config|routes)\.ts$/.test(f))
|
10
10
|
.sort();
|
11
11
|
if (siblingModules.length === 0) {
|
12
12
|
return;
|