@nx/angular 20.2.0-canary.20241130-ec5a5e6 → 20.2.0-canary.20241204-75b2080
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 +1 -1
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/fesm2022/nx-angular-testing.mjs.map +1 -1
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.json +1 -1
- package/migrations.json +160 -1
- package/package.json +12 -19
- package/src/builders/dev-server/lib/normalize-options.js +3 -0
- package/src/builders/dev-server/lib/validate-options.js +1 -9
- package/src/builders/dev-server/schema.json +3 -4
- package/src/executors/application/application.impl.d.ts +1 -1
- package/src/executors/application/application.impl.js +4 -1
- package/src/executors/application/schema.json +78 -6
- package/src/executors/application/utils/normalize-options.d.ts +2 -0
- package/src/executors/application/utils/normalize-options.js +33 -0
- package/src/executors/application/utils/validate-options.js +18 -4
- package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +1 -1
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +0 -9
- package/src/executors/browser-esbuild/schema.json +1 -1
- package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -1
- package/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
- package/src/executors/module-federation-dev-server/lib/index.js +0 -2
- package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -0
- package/src/executors/module-federation-dev-server/lib/start-dev-remotes.d.ts +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +2 -26
- package/src/executors/module-federation-dev-server/schema.d.ts +1 -0
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +2 -2
- package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +1 -0
- package/src/executors/module-federation-ssr-dev-server/lib/start-dev-remotes.d.ts +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +7 -33
- package/src/executors/module-federation-ssr-dev-server/schema.d.ts +8 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.d.ts +1 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +11 -20
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.d.ts +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +1 -1
- package/src/executors/ng-packagr-lite/schema.json +0 -8
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.d.ts +1 -2
- package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -21
- package/src/executors/package/package.impl.d.ts +2 -2
- package/src/executors/package/package.impl.js +1 -1
- package/src/executors/package/schema.d.ts +1 -3
- package/src/executors/package/schema.json +0 -10
- package/src/executors/utilities/ng-packagr/{stylesheet-processor.js → pre-v19/stylesheet-processor.js} +2 -2
- package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +11 -5
- package/src/executors/utilities/ng-packagr/tailwindcss.d.ts +0 -6
- package/src/executors/utilities/ng-packagr/tailwindcss.js +0 -32
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +23 -0
- package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +93 -0
- package/src/generators/application/application.js +1 -0
- package/src/generators/application/files/ng-module/src/app/app.component.ts__tpl__ +4 -5
- package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
- package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
- package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__ +4 -6
- package/src/generators/application/lib/add-serve-static-target.d.ts +1 -1
- package/src/generators/application/lib/add-serve-static-target.js +1 -3
- package/src/generators/application/lib/create-files.js +4 -1
- package/src/generators/application/lib/create-project.js +24 -31
- package/src/generators/application/lib/normalize-options.js +1 -6
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +7 -2
- package/src/generators/component/component.js +4 -0
- package/src/generators/component/files/__fileName__.spec.ts__tpl__ +1 -1
- package/src/generators/component/files/__fileName__.ts__tpl__ +5 -13
- package/src/generators/component/lib/normalize-options.js +2 -0
- package/src/generators/component/schema.d.ts +1 -0
- package/src/generators/component/schema.json +5 -0
- package/src/generators/convert-to-application-executor/convert-to-application-executor.js +1 -4
- package/src/generators/convert-to-application-executor/schema.json +1 -1
- package/src/generators/directive/directive.js +5 -0
- package/src/generators/directive/files/__fileName__.ts__tpl__ +2 -2
- package/src/generators/directive/lib/normalize-options.js +3 -1
- package/src/generators/host/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
- package/src/generators/host/lib/update-ssr-setup.js +2 -1
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +4 -0
- package/src/generators/pipe/files/__fileName__.ts__tpl__ +2 -2
- package/src/generators/pipe/lib/normalize-options.js +3 -1
- package/src/generators/pipe/pipe.js +5 -0
- package/src/generators/remote/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
- package/src/generators/remote/lib/update-ssr-setup.js +2 -1
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +4 -0
- package/src/generators/scam/lib/normalize-options.js +3 -1
- package/src/generators/scam-directive/lib/normalize-options.js +3 -1
- package/src/generators/scam-pipe/lib/normalize-options.js +3 -1
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +1 -1
- package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +5 -4
- package/src/generators/setup-mf/files/entry-module-files/entry.component.ts__tmpl__ +2 -1
- package/src/generators/setup-mf/files/standalone-entry-component-files/entry.component.ts__tmpl__ +2 -2
- package/src/generators/setup-mf/lib/add-remote-entry.js +5 -0
- package/src/generators/setup-ssr/files/{server → pre-v19/server}/application-builder/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/{server/server-builder/v17+ → pre-v19/server/server-builder}/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +13 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +66 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +14 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
- package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +65 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/__main__ +1 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/root/tsconfig.server.json.template +16 -0
- package/src/generators/setup-ssr/files/{server/server-builder/pre-v17 → v19+/server-builder/server}/__serverFileName__ +25 -15
- package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/__main__ +7 -0
- package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
- package/src/generators/setup-ssr/lib/add-dependencies.js +6 -17
- package/src/generators/setup-ssr/lib/add-hydration.d.ts +2 -2
- package/src/generators/setup-ssr/lib/add-hydration.js +10 -2
- package/src/generators/setup-ssr/lib/add-server-file.d.ts +2 -2
- package/src/generators/setup-ssr/lib/add-server-file.js +24 -10
- package/src/generators/setup-ssr/lib/generate-files.d.ts +2 -2
- package/src/generators/setup-ssr/lib/generate-files.js +20 -8
- package/src/generators/setup-ssr/lib/generate-server-ts-config.d.ts +3 -3
- package/src/generators/setup-ssr/lib/generate-server-ts-config.js +24 -3
- package/src/generators/setup-ssr/lib/normalize-options.d.ts +3 -14
- package/src/generators/setup-ssr/lib/normalize-options.js +23 -6
- package/src/generators/setup-ssr/lib/set-router-initial-navigation.d.ts +2 -2
- package/src/generators/setup-ssr/lib/update-project-config.d.ts +3 -3
- package/src/generators/setup-ssr/lib/update-project-config.js +36 -24
- package/src/generators/setup-ssr/lib/validate-options.js +5 -0
- package/src/generators/setup-ssr/schema.d.ts +5 -0
- package/src/generators/setup-ssr/schema.json +6 -8
- package/src/generators/setup-ssr/setup-ssr.js +6 -11
- package/src/generators/setup-tailwind/lib/index.d.ts +1 -1
- package/src/generators/setup-tailwind/lib/index.js +1 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +1 -1
- package/src/generators/setup-tailwind/lib/validate-build-target.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/{add-tailwind-config-path-to-project.js → validate-build-target.js} +4 -15
- package/src/generators/setup-tailwind/setup-tailwind.js +4 -1
- package/src/generators/utils/add-jest.js +4 -8
- package/src/generators/utils/storybook-ast/component-info.js +12 -2
- package/src/generators/utils/validations.d.ts +1 -0
- package/src/generators/utils/validations.js +10 -0
- package/src/generators/utils/version-utils.js +2 -2
- package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.d.ts +3 -0
- package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.js +48 -0
- package/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.d.ts +2 -0
- package/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.js +55 -0
- package/src/migrations/update-20-2-0/update-angular-cli.d.ts +3 -0
- package/src/migrations/update-20-2-0/update-angular-cli.js +23 -0
- package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.d.ts +2 -0
- package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.js +55 -0
- package/src/utils/backward-compatible-versions.d.ts +4 -4
- package/src/utils/backward-compatible-versions.js +20 -19
- package/src/utils/nx-devkit/ast-utils.d.ts +10 -1
- package/src/utils/nx-devkit/ast-utils.js +32 -9
- package/src/utils/versions.d.ts +7 -7
- package/src/utils/versions.js +7 -7
- package/esm2022/index.mjs +0 -2
- package/esm2022/mf/index.mjs +0 -2
- package/esm2022/mf/mf.mjs +0 -116
- package/esm2022/mf/nx-angular-mf.mjs +0 -5
- package/esm2022/nx-angular.mjs +0 -5
- package/esm2022/src/runtime/nx/data-persistence.mjs +0 -349
- package/esm2022/testing/index.mjs +0 -2
- package/esm2022/testing/nx-angular-testing.mjs +0 -5
- package/esm2022/testing/src/testing-utils.mjs +0 -38
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.js +0 -65
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.d.ts +0 -9
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +0 -51
- package/src/executors/module-federation-ssr-dev-server/lib/build-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-ssr-dev-server/lib/build-static-remotes.js +0 -65
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.d.ts +0 -4
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.js +0 -41
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.js +0 -27
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +0 -53
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.d.ts +0 -15
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.js +0 -28
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.d.ts +0 -30
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.js +0 -52
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.js +0 -20
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.d.ts +0 -9
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +0 -320
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +0 -35
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.d.ts +0 -14
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.js +0 -37
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +0 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +0 -178
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.d.ts +0 -42
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.d.ts +0 -10
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.js +0 -17
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +0 -201
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.js +0 -26
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +0 -71
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.d.ts +0 -13
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.js +0 -32
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +0 -35
- package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.d.ts +0 -14
- package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.js +0 -37
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +0 -13
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +0 -183
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.d.ts +0 -36
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.d.ts +0 -10
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.js +0 -17
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +0 -194
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.d.ts +0 -1
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +0 -9
- package/src/generators/host/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -66
- package/src/generators/remote/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -72
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.d.ts +0 -3
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.di.d.ts +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.di.js +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.transform.d.ts +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.transform.js +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.di.d.ts +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.di.js +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.transform.d.ts +0 -0
- /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.transform.js +0 -0
- /package/src/executors/utilities/ng-packagr/{stylesheet-processor.d.ts → pre-v19/stylesheet-processor.d.ts} +0 -0
- /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/app/__rootModuleFileName__ +0 -0
- /package/src/generators/setup-ssr/files/{root → pre-v19/root}/tsconfig.server.json__tpl__ +0 -0
- /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/__main__ +0 -0
- /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/app/app.config.server.ts__tpl__ +0 -0
|
@@ -9,8 +9,8 @@ import type { BuildAngularLibraryExecutorOptions } from './schema';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function createLibraryExecutor(initializeNgPackagr: (options: BuildAngularLibraryExecutorOptions, context: ExecutorContext, projectDependencies: DependentBuildableProjectNode[]) => Promise<NgPackagr>): (options: BuildAngularLibraryExecutorOptions, context: ExecutorContext) => AsyncGenerator<{
|
|
11
11
|
success: boolean;
|
|
12
|
-
}, any,
|
|
12
|
+
}, any, any>;
|
|
13
13
|
export declare const packageExecutor: (options: BuildAngularLibraryExecutorOptions, context: ExecutorContext) => AsyncGenerator<{
|
|
14
14
|
success: boolean;
|
|
15
|
-
}, any,
|
|
15
|
+
}, any, any>;
|
|
16
16
|
export default packageExecutor;
|
|
@@ -11,7 +11,7 @@ const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
|
11
11
|
const typescript_1 = require("../utilities/typescript");
|
|
12
12
|
const ng_packagr_1 = require("./ng-packagr-adjustments/ng-packagr");
|
|
13
13
|
async function initializeNgPackagr(options, context, projectDependencies) {
|
|
14
|
-
const ngPackagr = await (0, ng_packagr_1.getNgPackagrInstance)(
|
|
14
|
+
const ngPackagr = await (0, ng_packagr_1.getNgPackagrInstance)();
|
|
15
15
|
ngPackagr.forProject((0, path_1.resolve)(context.root, options.project));
|
|
16
16
|
if (options.tsConfig) {
|
|
17
17
|
const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(context.root, options.tsConfig), context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
"cli": "nx",
|
|
8
8
|
"type": "object",
|
|
9
9
|
"presets": [
|
|
10
|
-
{
|
|
11
|
-
"name": "Publishable Library with Tailwind",
|
|
12
|
-
"keys": ["project", "tailwindConfig"]
|
|
13
|
-
},
|
|
14
10
|
{
|
|
15
11
|
"name": "Updating Project Dependencies for Publishable Library",
|
|
16
12
|
"keys": ["project"]
|
|
@@ -36,12 +32,6 @@
|
|
|
36
32
|
"poll": {
|
|
37
33
|
"type": "number",
|
|
38
34
|
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
|
|
39
|
-
},
|
|
40
|
-
"tailwindConfig": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured. _Note: starting with Angular v17, this option is no longer used and the configuration will be picked up if exists at the project or workspace root_.",
|
|
43
|
-
"x-completion-type": "file",
|
|
44
|
-
"x-completion-glob": "tailwind.config@(.js|.cjs|.mjs|.ts)"
|
|
45
35
|
}
|
|
46
36
|
},
|
|
47
37
|
"additionalProperties": false,
|
|
@@ -15,10 +15,10 @@ const path_1 = require("path");
|
|
|
15
15
|
const Piscina = require('piscina');
|
|
16
16
|
const color_1 = require("ng-packagr/lib/utils/color");
|
|
17
17
|
// using this instead of the one from ng-packagr
|
|
18
|
-
const tailwindcss_1 = require("
|
|
18
|
+
const tailwindcss_1 = require("../tailwindcss");
|
|
19
19
|
const devkit_1 = require("@nx/devkit");
|
|
20
20
|
const semver_1 = require("semver");
|
|
21
|
-
const angular_version_utils_1 = require("
|
|
21
|
+
const angular_version_utils_1 = require("../../angular-version-utils");
|
|
22
22
|
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
23
23
|
const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
|
|
24
24
|
? +maxWorkersVariable
|
|
@@ -3,14 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.STYLESHEET_PROCESSOR = void 0;
|
|
4
4
|
const stylesheet_processor_di_1 = require("ng-packagr/lib/styles/stylesheet-processor.di");
|
|
5
5
|
const angular_version_utils_1 = require("../angular-version-utils");
|
|
6
|
-
const stylesheet_processor_1 = require("./stylesheet-processor");
|
|
7
6
|
exports.STYLESHEET_PROCESSOR = {
|
|
8
7
|
provide: stylesheet_processor_di_1.STYLESHEET_PROCESSOR_TOKEN,
|
|
9
8
|
useFactory: () => {
|
|
10
|
-
const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const { major: ngPackagrMajorVersion, version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
|
|
10
|
+
if (ngPackagrMajorVersion >= 19) {
|
|
11
|
+
const { StylesheetProcessor } = require('./v19+/stylesheet-processor');
|
|
12
|
+
return StylesheetProcessor;
|
|
13
|
+
}
|
|
14
|
+
if (ngPackagrVersion !== '17.2.0') {
|
|
15
|
+
const { StylesheetProcessor } = require('./pre-v19/stylesheet-processor');
|
|
16
|
+
return StylesheetProcessor;
|
|
17
|
+
}
|
|
18
|
+
const { AsyncStylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
|
|
19
|
+
return AsyncStylesheetProcessor;
|
|
14
20
|
},
|
|
15
21
|
deps: [],
|
|
16
22
|
};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export interface TailwindSetup {
|
|
2
|
-
tailwindConfigPath: string;
|
|
3
|
-
tailwindPackagePath: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function getTailwindSetup(basePath: string, tailwindConfig?: string): TailwindSetup | undefined;
|
|
6
1
|
export declare function getTailwindConfigPath(projectRoot: string, workspaceRoot: string): string | undefined;
|
|
7
|
-
export declare function getTailwindPostCssPlugin({ tailwindConfigPath, tailwindPackagePath, }: TailwindSetup): any;
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTailwindSetup = getTailwindSetup;
|
|
4
3
|
exports.getTailwindConfigPath = getTailwindConfigPath;
|
|
5
|
-
exports.getTailwindPostCssPlugin = getTailwindPostCssPlugin;
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const devkit_2 = require("@nx/devkit");
|
|
8
4
|
const fs_1 = require("fs");
|
|
9
5
|
const path_1 = require("path");
|
|
10
|
-
function getTailwindSetup(basePath, tailwindConfig) {
|
|
11
|
-
let tailwindConfigPath = tailwindConfig;
|
|
12
|
-
if (!tailwindConfigPath) {
|
|
13
|
-
tailwindConfigPath = getTailwindConfigPath(basePath, devkit_2.workspaceRoot);
|
|
14
|
-
}
|
|
15
|
-
// Only load Tailwind CSS plugin if configuration file was found.
|
|
16
|
-
if (!tailwindConfigPath) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
let tailwindPackagePath;
|
|
20
|
-
try {
|
|
21
|
-
tailwindPackagePath = require.resolve('tailwindcss');
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
const relativeTailwindConfigPath = (0, path_1.relative)(devkit_2.workspaceRoot, tailwindConfigPath);
|
|
25
|
-
devkit_1.logger.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
|
|
26
|
-
` but the 'tailwindcss' package is not installed.` +
|
|
27
|
-
` To enable Tailwind CSS, please install the 'tailwindcss' package.`);
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
if (!tailwindPackagePath) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return { tailwindConfigPath, tailwindPackagePath };
|
|
34
|
-
}
|
|
35
6
|
function getTailwindConfigPath(projectRoot, workspaceRoot) {
|
|
36
7
|
// valid tailwind config files https://github.com/tailwindlabs/tailwindcss/blob/master/src/util/resolveConfigPath.js#L4
|
|
37
8
|
const tailwindConfigFiles = [
|
|
@@ -50,6 +21,3 @@ function getTailwindConfigPath(projectRoot, workspaceRoot) {
|
|
|
50
21
|
}
|
|
51
22
|
return undefined;
|
|
52
23
|
}
|
|
53
|
-
function getTailwindPostCssPlugin({ tailwindConfigPath, tailwindPackagePath, }) {
|
|
54
|
-
return require(tailwindPackagePath)({ config: tailwindConfigPath });
|
|
55
|
-
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from the original ng-packagr source.
|
|
3
|
+
*
|
|
4
|
+
* Changes made:
|
|
5
|
+
* - Add the project root to the search directories.
|
|
6
|
+
*/
|
|
7
|
+
import { NgPackageEntryConfig } from 'ng-packagr/ng-entrypoint.schema';
|
|
8
|
+
import { ComponentStylesheetBundler } from 'ng-packagr/lib/styles/component-stylesheets';
|
|
9
|
+
export declare enum CssUrl {
|
|
10
|
+
inline = "inline",
|
|
11
|
+
none = "none"
|
|
12
|
+
}
|
|
13
|
+
export declare class StylesheetProcessor extends ComponentStylesheetBundler {
|
|
14
|
+
protected readonly projectBasePath: string;
|
|
15
|
+
protected readonly basePath: string;
|
|
16
|
+
protected readonly cssUrl?: CssUrl;
|
|
17
|
+
protected readonly includePaths?: string[];
|
|
18
|
+
protected readonly sass?: NgPackageEntryConfig['lib']['sass'];
|
|
19
|
+
protected readonly cacheDirectory?: string | false;
|
|
20
|
+
protected readonly watch?: boolean;
|
|
21
|
+
constructor(projectBasePath: string, basePath: string, cssUrl?: CssUrl, includePaths?: string[], sass?: NgPackageEntryConfig['lib']['sass'], cacheDirectory?: string | false, watch?: boolean);
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Adapted from the original ng-packagr source.
|
|
4
|
+
*
|
|
5
|
+
* Changes made:
|
|
6
|
+
* - Add the project root to the search directories.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.StylesheetProcessor = exports.CssUrl = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
|
|
12
|
+
const component_stylesheets_1 = require("ng-packagr/lib/styles/component-stylesheets");
|
|
13
|
+
const postcss_configuration_1 = require("ng-packagr/lib/styles/postcss-configuration");
|
|
14
|
+
const devkit_1 = require("@nx/devkit");
|
|
15
|
+
var CssUrl;
|
|
16
|
+
(function (CssUrl) {
|
|
17
|
+
CssUrl["inline"] = "inline";
|
|
18
|
+
CssUrl["none"] = "none";
|
|
19
|
+
})(CssUrl || (exports.CssUrl = CssUrl = {}));
|
|
20
|
+
class StylesheetProcessor extends component_stylesheets_1.ComponentStylesheetBundler {
|
|
21
|
+
constructor(projectBasePath, basePath, cssUrl, includePaths, sass, cacheDirectory, watch) {
|
|
22
|
+
// By default, browserslist defaults are too inclusive
|
|
23
|
+
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
|
|
24
|
+
// We change the default query to browsers that Angular support.
|
|
25
|
+
// https://angular.io/guide/browser-support
|
|
26
|
+
browserslist_1.default.defaults = [
|
|
27
|
+
'last 2 Chrome versions',
|
|
28
|
+
'last 1 Firefox version',
|
|
29
|
+
'last 2 Edge major versions',
|
|
30
|
+
'last 2 Safari major versions',
|
|
31
|
+
'last 2 iOS major versions',
|
|
32
|
+
'Firefox ESR',
|
|
33
|
+
];
|
|
34
|
+
const browserslistData = (0, browserslist_1.default)(undefined, { path: basePath });
|
|
35
|
+
let searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath]);
|
|
36
|
+
const postcssConfiguration = (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirs);
|
|
37
|
+
// (nx-specific): we support loading the TailwindCSS config from the root of the workspace
|
|
38
|
+
searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath, devkit_1.workspaceRoot]);
|
|
39
|
+
super({
|
|
40
|
+
cacheDirectory: cacheDirectory,
|
|
41
|
+
postcssConfiguration: postcssConfiguration,
|
|
42
|
+
tailwindConfiguration: postcssConfiguration
|
|
43
|
+
? undefined
|
|
44
|
+
: (0, postcss_configuration_1.getTailwindConfig)(searchDirs, projectBasePath),
|
|
45
|
+
sass: sass,
|
|
46
|
+
workspaceRoot: projectBasePath,
|
|
47
|
+
cssUrl: cssUrl,
|
|
48
|
+
target: transformSupportedBrowsersToTargets(browserslistData),
|
|
49
|
+
includePaths: includePaths,
|
|
50
|
+
}, 'css', watch);
|
|
51
|
+
this.projectBasePath = projectBasePath;
|
|
52
|
+
this.basePath = basePath;
|
|
53
|
+
this.cssUrl = cssUrl;
|
|
54
|
+
this.includePaths = includePaths;
|
|
55
|
+
this.sass = sass;
|
|
56
|
+
this.cacheDirectory = cacheDirectory;
|
|
57
|
+
this.watch = watch;
|
|
58
|
+
}
|
|
59
|
+
destroy() {
|
|
60
|
+
void super.dispose();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.StylesheetProcessor = StylesheetProcessor;
|
|
64
|
+
function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
|
65
|
+
const transformed = [];
|
|
66
|
+
// https://esbuild.github.io/api/#target
|
|
67
|
+
const esBuildSupportedBrowsers = new Set([
|
|
68
|
+
'safari',
|
|
69
|
+
'firefox',
|
|
70
|
+
'edge',
|
|
71
|
+
'chrome',
|
|
72
|
+
'ios',
|
|
73
|
+
]);
|
|
74
|
+
for (const browser of supportedBrowsers) {
|
|
75
|
+
let [browserName, version] = browser.split(' ');
|
|
76
|
+
// browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
|
|
77
|
+
if (browserName === 'ios_saf') {
|
|
78
|
+
browserName = 'ios';
|
|
79
|
+
}
|
|
80
|
+
// browserslist uses ranges `15.2-15.3` versions but only the lowest is required
|
|
81
|
+
// to perform minimum supported feature checks. esbuild also expects a single version.
|
|
82
|
+
[version] = version.split('-');
|
|
83
|
+
if (esBuildSupportedBrowsers.has(browserName)) {
|
|
84
|
+
if (browserName === 'safari' && version === 'tp') {
|
|
85
|
+
// esbuild only supports numeric versions so `TP` is converted to a high number (999) since
|
|
86
|
+
// a Technology Preview (TP) of Safari is assumed to support all currently known features.
|
|
87
|
+
version = '999';
|
|
88
|
+
}
|
|
89
|
+
transformed.push(browserName + version);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return transformed.length ? transformed : undefined;
|
|
93
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= rootSelector %>',<% if(
|
|
4
|
+
selector: '<%= rootSelector %>',<% if (setStandaloneFalse) { %>
|
|
5
|
+
standalone: false,<% } if(!inlineTemplate) { %>
|
|
5
6
|
templateUrl: './app.component.html',<% } else { %>
|
|
6
|
-
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if
|
|
7
|
-
styleUrls: ['./app.component.<%= style %>'],<% } else { %>
|
|
8
|
-
styles: [``],<% } %><% } else { if(!inlineStyle) { %>
|
|
7
|
+
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
9
8
|
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
10
|
-
styles: ``,<% } %><%
|
|
9
|
+
styles: ``,<% } %><% if(viewEncapsulation) { %>
|
|
11
10
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
12
11
|
})
|
|
13
12
|
export class AppComponent {<% if(!minimal) { %>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',<% if (setStandaloneFalse) { %>
|
|
5
|
+
standalone: false,<% } %>
|
|
5
6
|
template: `
|
|
6
7
|
<!--
|
|
7
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,8 @@ 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 %>',<% if (setStandaloneTrue) { %>
|
|
6
|
+
standalone: true,<% } %>
|
|
7
7
|
imports: [CommonModule],
|
|
8
8
|
template: `
|
|
9
9
|
<!--
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',<% if (setStandaloneFalse) { %>
|
|
5
|
+
standalone: false,<% } %>
|
|
5
6
|
template: `
|
|
6
7
|
<!--
|
|
7
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,8 @@ 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 %>',<% if (setStandaloneTrue) { %>
|
|
6
|
+
standalone: true,<% } %>
|
|
7
7
|
imports: [CommonModule],
|
|
8
8
|
template: `
|
|
9
9
|
<!--
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '<%= nxWelcomeSelector %>'
|
|
4
|
+
selector: '<%= nxWelcomeSelector %>',<% if (setStandaloneFalse) { %>
|
|
5
|
+
standalone: false,<% } %>
|
|
5
6
|
template: `
|
|
6
7
|
<!--
|
|
7
8
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
@@ -2,8 +2,8 @@ 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 %>',<% if (setStandaloneTrue) { %>
|
|
6
|
+
standalone: true,<% } %>
|
|
7
7
|
imports: [CommonModule],
|
|
8
8
|
template: `
|
|
9
9
|
<!--
|
package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__
CHANGED
|
@@ -2,16 +2,14 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
|
|
|
2
2
|
import { RouterModule } from '@angular/router';<% } %><% if(!minimal) { %>
|
|
3
3
|
import { NxWelcomeComponent } from './nx-welcome.component';<% } %>
|
|
4
4
|
|
|
5
|
-
@Component({
|
|
6
|
-
standalone: true
|
|
5
|
+
@Component({<% if (setStandaloneTrue) { %>
|
|
6
|
+
standalone: true,<% } %>
|
|
7
7
|
imports: [<% if(!minimal) { %>NxWelcomeComponent, <% } %><% if(routing) { %>RouterModule<% } %>],
|
|
8
8
|
selector: '<%= rootSelector %>',<% if(!inlineTemplate) { %>
|
|
9
9
|
templateUrl: './app.component.html',<% } else { %>
|
|
10
|
-
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if
|
|
11
|
-
styleUrls: ['./app.component.<%= style %>'],<% } else { %>
|
|
12
|
-
styles: [``],<% } %><% } else { if(!inlineStyle) { %>
|
|
10
|
+
template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
|
|
13
11
|
styleUrl: './app.component.<%= style %>',<% } else { %>
|
|
14
|
-
styles: ``,<% } %><%
|
|
12
|
+
styles: ``,<% } %><% if(viewEncapsulation) { %>
|
|
15
13
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
|
|
16
14
|
})
|
|
17
15
|
export class AppComponent {<% if(!minimal) { %>
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addServeStaticTarget = addServeStaticTarget;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../../utils/versions");
|
|
6
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
7
6
|
function addServeStaticTarget(tree, options, port) {
|
|
8
7
|
addFileServerTarget(tree, options, 'serve-static', port);
|
|
9
8
|
}
|
|
@@ -11,8 +10,7 @@ function addFileServerTarget(tree, options, targetName, e2ePort) {
|
|
|
11
10
|
if (!options.skipPackageJson) {
|
|
12
11
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
|
|
13
12
|
}
|
|
14
|
-
const
|
|
15
|
-
const isUsingApplicationBuilder = angularMajorVersion >= 17 && options.bundler === 'esbuild';
|
|
13
|
+
const isUsingApplicationBuilder = options.bundler === 'esbuild';
|
|
16
14
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.name);
|
|
17
15
|
projectConfig.targets[targetName] = {
|
|
18
16
|
executor: '@nx/web:file-server',
|
|
@@ -11,7 +11,7 @@ const version_utils_1 = require("../../utils/version-utils");
|
|
|
11
11
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
12
12
|
async function createFiles(tree, options, rootOffset) {
|
|
13
13
|
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
14
|
-
const isUsingApplicationBuilder =
|
|
14
|
+
const isUsingApplicationBuilder = options.bundler === 'esbuild';
|
|
15
15
|
const disableModernClassFieldsBehavior = (0, semver_1.lt)(angularVersion, '18.1.0-rc.0');
|
|
16
16
|
const rootSelector = `${options.prefix}-root`;
|
|
17
17
|
(0, selector_1.validateHtmlSelector)(rootSelector);
|
|
@@ -38,6 +38,9 @@ async function createFiles(tree, options, rootOffset) {
|
|
|
38
38
|
disableModernClassFieldsBehavior,
|
|
39
39
|
useEventCoalescing: angularMajorVersion >= 18,
|
|
40
40
|
useRouterTestingModule: angularMajorVersion < 18,
|
|
41
|
+
// Angular v19 or higher defaults to true, while v18 or lower defaults to false
|
|
42
|
+
setStandaloneFalse: angularMajorVersion >= 19,
|
|
43
|
+
setStandaloneTrue: angularMajorVersion < 19,
|
|
41
44
|
connectCloudUrl,
|
|
42
45
|
tutorialUrl: options.standalone
|
|
43
46
|
? 'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx-project'
|
|
@@ -8,36 +8,29 @@ function createProject(tree, options) {
|
|
|
8
8
|
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
9
9
|
const buildExecutor = options.bundler === 'webpack'
|
|
10
10
|
? '@angular-devkit/build-angular:browser'
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
: '@angular-devkit/build-angular:browser-esbuild';
|
|
14
|
-
const buildTargetOptionName = angularMajorVersion >= 17 ? 'buildTarget' : 'browserTarget';
|
|
15
|
-
const buildMainOptionName = angularMajorVersion >= 17 && options.bundler === 'esbuild'
|
|
16
|
-
? 'browser'
|
|
17
|
-
: 'main';
|
|
11
|
+
: '@angular-devkit/build-angular:application';
|
|
12
|
+
const buildMainOptionName = options.bundler === 'esbuild' ? 'browser' : 'main';
|
|
18
13
|
(0, target_defaults_utils_1.addBuildTargetDefaults)(tree, buildExecutor);
|
|
19
14
|
let budgets = undefined;
|
|
20
|
-
if (options.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
];
|
|
40
|
-
}
|
|
15
|
+
if (options.strict) {
|
|
16
|
+
budgets = [
|
|
17
|
+
{ type: 'initial', maximumWarning: '500kb', maximumError: '1mb' },
|
|
18
|
+
{
|
|
19
|
+
type: 'anyComponentStyle',
|
|
20
|
+
maximumWarning: '4kb',
|
|
21
|
+
maximumError: '8kb',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
budgets = [
|
|
27
|
+
{ type: 'initial', maximumWarning: '2mb', maximumError: '5mb' },
|
|
28
|
+
{
|
|
29
|
+
type: 'anyComponentStyle',
|
|
30
|
+
maximumWarning: '6kb',
|
|
31
|
+
maximumError: '10kb',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
41
34
|
}
|
|
42
35
|
const inlineStyleLanguage = options?.style !== 'css' ? options.style : undefined;
|
|
43
36
|
const project = {
|
|
@@ -97,10 +90,10 @@ function createProject(tree, options) {
|
|
|
97
90
|
: undefined,
|
|
98
91
|
configurations: {
|
|
99
92
|
production: {
|
|
100
|
-
|
|
93
|
+
buildTarget: `${options.name}:build:production`,
|
|
101
94
|
},
|
|
102
95
|
development: {
|
|
103
|
-
|
|
96
|
+
buildTarget: `${options.name}:build:development`,
|
|
104
97
|
},
|
|
105
98
|
},
|
|
106
99
|
defaultConfiguration: 'development',
|
|
@@ -108,7 +101,7 @@ function createProject(tree, options) {
|
|
|
108
101
|
'extract-i18n': {
|
|
109
102
|
executor: '@angular-devkit/build-angular:extract-i18n',
|
|
110
103
|
options: {
|
|
111
|
-
|
|
104
|
+
buildTarget: `${options.name}:build`,
|
|
112
105
|
},
|
|
113
106
|
},
|
|
114
107
|
},
|
|
@@ -5,7 +5,6 @@ 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 eslint_1 = require("@nx/eslint");
|
|
7
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
9
8
|
async function normalizeOptions(host, options) {
|
|
10
9
|
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
11
10
|
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -20,11 +19,7 @@ async function normalizeOptions(host, options) {
|
|
|
20
19
|
const parsedTags = options.tags
|
|
21
20
|
? options.tags.split(',').map((s) => s.trim())
|
|
22
21
|
: [];
|
|
23
|
-
|
|
24
|
-
if (!bundler) {
|
|
25
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
26
|
-
bundler = angularMajorVersion >= 17 ? 'esbuild' : 'webpack';
|
|
27
|
-
}
|
|
22
|
+
const bundler = options.bundler ?? 'esbuild';
|
|
28
23
|
// Set defaults and then overwrite with user options
|
|
29
24
|
return {
|
|
30
25
|
style: 'css',
|
|
@@ -169,9 +169,10 @@
|
|
|
169
169
|
"default": false
|
|
170
170
|
},
|
|
171
171
|
"bundler": {
|
|
172
|
-
"description": "Bundler to use to build the application.
|
|
172
|
+
"description": "Bundler to use to build the application.",
|
|
173
173
|
"type": "string",
|
|
174
|
-
"enum": ["
|
|
174
|
+
"enum": ["esbuild", "webpack"],
|
|
175
|
+
"default": "esbuild",
|
|
175
176
|
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
176
177
|
"x-priority": "important"
|
|
177
178
|
},
|
|
@@ -180,6 +181,10 @@
|
|
|
180
181
|
"type": "boolean",
|
|
181
182
|
"x-prompt": "Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?",
|
|
182
183
|
"default": false
|
|
184
|
+
},
|
|
185
|
+
"serverRouting": {
|
|
186
|
+
"description": "Creates a server application using the Server Routing and App Engine APIs (Developer Preview). _Note: this is only supported in Angular versions >= 19.0.0_.",
|
|
187
|
+
"type": "boolean"
|
|
183
188
|
}
|
|
184
189
|
},
|
|
185
190
|
"additionalProperties": false,
|
|
@@ -12,6 +12,7 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
12
12
|
name: options.name,
|
|
13
13
|
fileName: options.fileName,
|
|
14
14
|
symbolName: options.symbolName,
|
|
15
|
+
exportDefault: options.exportDefault,
|
|
15
16
|
style: options.style,
|
|
16
17
|
inlineStyle: options.inlineStyle,
|
|
17
18
|
inlineTemplate: options.inlineTemplate,
|
|
@@ -21,6 +22,9 @@ async function componentGenerator(tree, rawOptions) {
|
|
|
21
22
|
viewEncapsulation: options.viewEncapsulation,
|
|
22
23
|
displayBlock: options.displayBlock,
|
|
23
24
|
selector: options.selector,
|
|
25
|
+
// Angular v19 or higher defaults to true, while v18 or lower defaults to false
|
|
26
|
+
setStandalone: (angularMajorVersion >= 19 && !options.standalone) ||
|
|
27
|
+
(angularMajorVersion < 19 && options.standalone),
|
|
24
28
|
angularMajorVersion,
|
|
25
29
|
tpl: '',
|
|
26
30
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { <%= symbolName %> } from './<%= fileName %>';
|
|
2
|
+
import <% if (exportDefault) { %><%= symbolName %><% } else { %>{ <%= symbolName %> }<% } %> from './<%= fileName %>';
|
|
3
3
|
|
|
4
4
|
describe('<%= symbolName %>', () => {
|
|
5
5
|
let component: <%= symbolName %>;
|
|
@@ -2,26 +2,18 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
|
|
|
2
2
|
import { CommonModule } from '@angular/common';<% } %>
|
|
3
3
|
|
|
4
4
|
@Component({<% if(!skipSelector) {%>
|
|
5
|
-
selector: '<%= selector %>',<%}%><% if(
|
|
6
|
-
standalone:
|
|
5
|
+
selector: '<%= selector %>',<%}%><% if (setStandalone) { %>
|
|
6
|
+
standalone: <%= standalone %>,<% } %><% if(standalone) { %>
|
|
7
7
|
imports: [CommonModule],<%}%><% if(inlineTemplate) { %>
|
|
8
8
|
template: `<p><%= name %> works!</p>`<% } else { %>
|
|
9
|
-
templateUrl: './<%= fileName %>.html'<% } if
|
|
10
|
-
styles: [<% if(displayBlock){ %>
|
|
11
|
-
`
|
|
12
|
-
:host {
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
`<% } %>
|
|
16
|
-
]<% } else if (style !== 'none') { %>,
|
|
17
|
-
styleUrls: ['./<%= fileName %>.<%= style %>']<% } %><% } else { if(inlineStyle) { %>,
|
|
9
|
+
templateUrl: './<%= fileName %>.html'<% } if(inlineStyle) { %>,
|
|
18
10
|
styles: `<% if(displayBlock){ %>
|
|
19
11
|
:host {
|
|
20
12
|
display: block;
|
|
21
13
|
}
|
|
22
14
|
<% } %>`<% } else if (style !== 'none') { %>,
|
|
23
|
-
styleUrl: './<%= fileName %>.<%= style %>'<% } %><%
|
|
15
|
+
styleUrl: './<%= fileName %>.<%= style %>'<% } %><% if(!!viewEncapsulation) { %>,
|
|
24
16
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
|
|
25
17
|
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
|
|
26
18
|
})
|
|
27
|
-
export class <%= symbolName %> {}
|
|
19
|
+
export <% if (exportDefault) {%>default <%}%>class <%= symbolName %> {}
|