@nx/angular 19.1.0-canary.20240523-261b0ff → 19.1.0-canary.20240524-12c6a73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/executors.json +1 -1
  2. package/migrations.json +82 -0
  3. package/package.json +12 -12
  4. package/src/builders/dev-server/dev-server.impl.js +1 -1
  5. package/src/builders/dev-server/schema.json +1 -1
  6. package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -1
  7. package/src/builders/utilities/module-federation.d.ts +2 -1
  8. package/src/builders/utilities/module-federation.js +17 -3
  9. package/src/builders/webpack-browser/schema.json +4 -3
  10. package/src/builders/webpack-browser/webpack-browser.impl.js +1 -1
  11. package/src/builders/webpack-server/schema.json +7 -6
  12. package/src/builders/webpack-server/webpack-server.impl.js +3 -5
  13. package/src/executors/application/application.impl.d.ts +2 -1
  14. package/src/executors/application/application.impl.js +2 -2
  15. package/src/executors/application/schema.json +4 -3
  16. package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +2 -7
  17. package/src/executors/browser-esbuild/browser-esbuild.impl.js +2 -2
  18. package/src/executors/browser-esbuild/schema.json +4 -3
  19. package/src/executors/extract-i18n/extract-i18n.impl.js +2 -2
  20. package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +2 -1
  21. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +8 -4
  22. package/src/executors/module-federation-dev-server/schema.json +1 -1
  23. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +6 -6
  24. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +3 -2
  25. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +2 -1
  26. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +2 -1
  27. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +1 -2
  28. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +5 -4
  29. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +11 -11
  30. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/v17+/ng-package/entry-point/write-package.transform.js +2 -1
  31. package/src/executors/ng-packagr-lite/schema.json +1 -1
  32. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +5 -4
  33. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +2 -1
  34. package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -4
  35. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +1 -2
  36. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +5 -4
  37. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +11 -11
  38. package/src/executors/utilities/esbuild-extensions.d.ts +2 -4
  39. package/src/executors/utilities/module-loader.d.ts +1 -2
  40. package/src/executors/utilities/ng-packagr/stylesheet-processor.js +22 -8
  41. package/src/executors/utilities/typescript.d.ts +1 -2
  42. package/src/executors/utilities/typescript.js +4 -3
  43. package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
  44. package/src/generators/add-linting/schema.json +1 -1
  45. package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
  46. package/src/generators/application/files/ng-module/src/main.ts__tpl__ +3 -1
  47. package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +2 -2
  48. package/src/generators/application/lib/add-linting.js +2 -1
  49. package/src/generators/application/lib/create-files.js +7 -0
  50. package/src/generators/application/lib/create-project.js +12 -5
  51. package/src/generators/component-test/component-test.js +1 -1
  52. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -3
  53. package/src/generators/federate-module/lib/add-remote.js +2 -1
  54. package/src/generators/host/host.js +3 -2
  55. package/src/generators/library/library.js +4 -3
  56. package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +3 -2
  57. package/src/generators/ng-add/migrators/migrator.d.ts +1 -1
  58. package/src/generators/ng-add/migrators/migrator.js +7 -7
  59. package/src/generators/ng-add/migrators/projects/app.migrator.js +2 -2
  60. package/src/generators/ng-add/migrators/projects/e2e.migrator.js +1 -1
  61. package/src/generators/ng-add/utilities/validation-logging.js +2 -1
  62. package/src/generators/ngrx-root-store/ngrx-root-store.js +2 -1
  63. package/src/generators/setup-mf/lib/add-remote-to-host.js +13 -4
  64. package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +1 -1
  65. package/src/generators/setup-mf/lib/fix-bootstrap.js +12 -5
  66. package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +5 -1
  67. package/src/generators/setup-mf/setup-mf.js +1 -1
  68. package/src/generators/setup-ssr/files/server/application-builder/__serverFileName__ +4 -3
  69. package/src/generators/setup-ssr/files/server/server-builder/v17+/__serverFileName__ +4 -3
  70. package/src/generators/setup-ssr/lib/add-dependencies.js +2 -1
  71. package/src/generators/setup-ssr/lib/generate-files.js +1 -7
  72. package/src/generators/setup-ssr/lib/index.d.ts +0 -1
  73. package/src/generators/setup-ssr/lib/index.js +0 -1
  74. package/src/generators/setup-ssr/lib/validate-options.js +0 -13
  75. package/src/generators/setup-ssr/schema.json +4 -3
  76. package/src/generators/setup-ssr/setup-ssr.js +0 -3
  77. package/src/generators/stories/stories.js +3 -2
  78. package/src/generators/storybook-configuration/lib/generate-stories.js +1 -1
  79. package/src/generators/utils/storybook-ast/tree-utilities.js +2 -1
  80. package/src/generators/utils/version-utils.js +4 -3
  81. package/src/migrations/update-15-2-0/remove-browserlist-config.js +1 -1
  82. package/src/migrations/update-15-2-0/remove-platform-server-exports.js +2 -1
  83. package/src/migrations/update-15-2-0/update-karma-main-file.js +2 -1
  84. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +2 -1
  85. package/src/migrations/update-19-1-0/update-angular-cli.d.ts +3 -0
  86. package/src/migrations/update-19-1-0/update-angular-cli.js +23 -0
  87. package/src/utils/backward-compatible-versions.d.ts +10 -5
  88. package/src/utils/backward-compatible-versions.js +18 -19
  89. package/src/utils/file-change-recorder.js +2 -1
  90. package/src/utils/mf/with-module-federation.js +3 -2
  91. package/src/utils/version-utils.d.ts +2 -2
  92. package/src/utils/version-utils.js +2 -1
  93. package/src/utils/versions.d.ts +4 -4
  94. package/src/utils/versions.js +4 -4
  95. package/index.js +0 -8
  96. package/mf/index.js +0 -7
  97. package/mf/mf.js +0 -53
  98. package/src/builders/webpack-server/validate-options.d.ts +0 -2
  99. package/src/builders/webpack-server/validate-options.js +0 -33
  100. package/src/executors/utilities/ng-compiler-cli.d.ts +0 -1
  101. package/src/executors/utilities/ng-compiler-cli.js +0 -8
  102. package/src/generators/setup-ssr/files/ngmodule/pre-v15-2/src/main.ts__tpl__ +0 -14
  103. package/src/generators/setup-ssr/lib/update-app-module.d.ts +0 -3
  104. package/src/generators/setup-ssr/lib/update-app-module.js +0 -27
  105. package/src/runtime/nx/data-persistence.js +0 -350
  106. package/testing/index.js +0 -6
  107. package/testing/src/testing-utils.js +0 -40
  108. /package/src/generators/application/files/{base/src → base-18+/public}/favicon.ico +0 -0
  109. /package/src/generators/application/files/{base → base-pre18}/src/assets/.gitkeep__tpl__ +0 -0
  110. /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/__main__ +0 -0
  111. /package/src/generators/setup-ssr/files/ngmodule/{base/src → src}/app/__rootModuleFileName__ +0 -0
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.nxWritePackageTransform = void 0;
11
+ const tslib_1 = require("tslib");
11
12
  const devkit_1 = require("@nx/devkit");
12
13
  const node_1 = require("ng-packagr/lib/graph/node");
13
14
  const transform_1 = require("ng-packagr/lib/graph/transform");
@@ -15,7 +16,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
15
16
  const fs_1 = require("ng-packagr/lib/utils/fs");
16
17
  const glob_1 = require("ng-packagr/lib/utils/glob");
17
18
  const path_1 = require("ng-packagr/lib/utils/path");
18
- const path = require("path");
19
+ const path = tslib_1.__importStar(require("path"));
19
20
  const angular_version_utils_1 = require("../../../../../utilities/angular-version-utils");
20
21
  const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
21
22
  const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
@@ -7,7 +7,8 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
10
- const findCacheDirectory = require("find-cache-dir");
10
+ const tslib_1 = require("tslib");
11
+ const findCacheDirectory = tslib_1.__importStar(require("find-cache-dir"));
11
12
  const injection_js_1 = require("injection-js");
12
13
  const os_1 = require("os");
13
14
  const path_1 = require("path");
@@ -5,9 +5,8 @@
5
5
  * - Use custom StylesheetProcessor instead of the one provided by ng-packagr.
6
6
  * - Support Angular Compiler `incrementalDriver` for Angular < 16.
7
7
  */
8
- import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
9
8
  import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
10
9
  import * as ts from 'typescript';
11
10
  import { NgPackagrOptions } from '../ng-package/options.di';
12
11
  import { StylesheetProcessor } from '../styles/stylesheet-processor';
13
- export declare function compileSourceFiles(graph: BuildGraph, tsConfig: ParsedConfiguration, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<CompilerOptions>, stylesheetProcessor?: StylesheetProcessor): Promise<void>;
12
+ export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor): Promise<void>;
@@ -8,15 +8,16 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.compileSourceFiles = void 0;
11
+ const tslib_1 = require("tslib");
11
12
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
12
13
  const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
13
- const log = require("ng-packagr/lib/utils/log");
14
+ const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
14
15
  const node_path_1 = require("node:path");
15
- const ts = require("typescript");
16
+ const ts = tslib_1.__importStar(require("typescript"));
16
17
  const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
17
- const ng_compiler_cli_1 = require("../../../../utilities/ng-compiler-cli");
18
+ const module_loader_1 = require("../../../../utilities/module-loader");
18
19
  async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor) {
19
- const { NgtscProgram, formatDiagnostics } = await (0, ng_compiler_cli_1.ngCompilerCli)();
20
+ const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
20
21
  const { cacheDirectory, watch, cacheEnabled } = options;
21
22
  const tsConfigOptions = {
22
23
  ...tsConfig.options,
@@ -8,14 +8,14 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.StylesheetProcessor = exports.InlineStyleLanguage = exports.CssUrl = void 0;
11
- const browserslist = require("browserslist");
11
+ const tslib_1 = require("tslib");
12
+ const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
12
13
  const fs_1 = require("fs");
13
- const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
14
14
  const cache_1 = require("ng-packagr/lib/utils/cache");
15
- const log = require("ng-packagr/lib/utils/log");
15
+ const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
16
16
  const path_1 = require("path");
17
- const autoprefixer = require("autoprefixer");
18
- const postcssUrl = require("postcss-url");
17
+ const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
18
+ const postcssUrl = tslib_1.__importStar(require("postcss-url"));
19
19
  const node_url_1 = require("node:url");
20
20
  const tailwindcss_1 = require("../../../../utilities/ng-packagr/tailwindcss");
21
21
  const postcss = require('postcss');
@@ -39,12 +39,12 @@ class StylesheetProcessor {
39
39
  this.includePaths = includePaths;
40
40
  this.cacheDirectory = cacheDirectory;
41
41
  this.tailwindConfig = tailwindConfig;
42
- this.esbuild = new esbuild_executor_1.EsbuildExecutor();
42
+ this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
43
43
  // By default, browserslist defaults are too inclusive
44
44
  // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
45
45
  // We change the default query to browsers that Angular support.
46
46
  // https://angular.io/guide/browser-support
47
- browserslist.defaults = [
47
+ browserslist_1.default.defaults = [
48
48
  'last 2 Chrome versions',
49
49
  'last 1 Firefox version',
50
50
  'last 2 Edge major versions',
@@ -63,7 +63,7 @@ class StylesheetProcessor {
63
63
  prevDir = currentDir;
64
64
  currentDir = (0, path_1.dirname)(prevDir);
65
65
  }
66
- this.browserslistData = browserslist(undefined, { path: this.basePath });
66
+ this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
67
67
  this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
68
68
  const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
69
69
  if (tailwindSetup) {
@@ -137,7 +137,7 @@ class StylesheetProcessor {
137
137
  if (this.cssUrl !== CssUrl.none) {
138
138
  postCssPlugins.push(postcssUrl({ url: this.cssUrl }));
139
139
  }
140
- postCssPlugins.push(autoprefixer({
140
+ postCssPlugins.push((0, autoprefixer_1.default)({
141
141
  ignoreUnknownVersions: true,
142
142
  overrideBrowserslist: this.browserslistData,
143
143
  }));
@@ -148,14 +148,14 @@ class StylesheetProcessor {
148
148
  switch (ext) {
149
149
  case '.sass':
150
150
  case '.scss': {
151
- return (await Promise.resolve().then(() => require('sass'))).compileString(css, {
151
+ return (await import('sass')).compileString(css, {
152
152
  url: (0, node_url_1.pathToFileURL)(filePath),
153
153
  syntax: '.sass' === ext ? 'indented' : 'scss',
154
154
  loadPaths: this.styleIncludePaths,
155
155
  }).css;
156
156
  }
157
157
  case '.less': {
158
- const { css: content } = await (await Promise.resolve().then(() => require('less'))).render(css, {
158
+ const { css: content } = await (await import('less')).render(css, {
159
159
  filename: filePath,
160
160
  javascriptEnabled: true,
161
161
  paths: this.styleIncludePaths,
@@ -7,6 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.nxWritePackageTransform = void 0;
10
+ const tslib_1 = require("tslib");
10
11
  const devkit_1 = require("@nx/devkit");
11
12
  const node_1 = require("ng-packagr/lib/graph/node");
12
13
  const transform_1 = require("ng-packagr/lib/graph/transform");
@@ -14,7 +15,7 @@ const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
14
15
  const fs_1 = require("ng-packagr/lib/utils/fs");
15
16
  const glob_1 = require("ng-packagr/lib/utils/glob");
16
17
  const path_1 = require("ng-packagr/lib/utils/path");
17
- const path = require("path");
18
+ const path = tslib_1.__importStar(require("path"));
18
19
  const nxWritePackageTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
19
20
  const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
20
21
  const ngEntryPoint = entryPoint.data.entryPoint;
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "$schema": "https://json-schema.org/schema",
5
5
  "title": "ng-packagr Target",
6
- "description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16).",
6
+ "description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
7
7
  "cli": "nx",
8
8
  "type": "object",
9
9
  "presets": [
@@ -9,18 +9,19 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.compileNgcTransformFactory = void 0;
12
+ const tslib_1 = require("tslib");
12
13
  const transform_1 = require("ng-packagr/lib/graph/transform");
13
14
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
14
15
  const tsconfig_1 = require("ng-packagr/lib/ts/tsconfig");
15
- const ora = require("ora");
16
- const path = require("path");
17
- const ts = require("typescript");
16
+ const ora_1 = tslib_1.__importDefault(require("ora"));
17
+ const path = tslib_1.__importStar(require("path"));
18
+ const ts = tslib_1.__importStar(require("typescript"));
18
19
  const angular_version_utils_1 = require("../../../../utilities/angular-version-utils");
19
20
  const compile_source_files_1 = require("../../ngc/compile-source-files");
20
21
  const ng_compiler_cli_1 = require("../../utils/ng-compiler-cli");
21
22
  const compileNgcTransformFactory = (StylesheetProcessor, options) => {
22
23
  return (0, transform_1.transformFromPromise)(async (graph) => {
23
- const spinner = ora({
24
+ const spinner = (0, ora_1.default)({
24
25
  hideCursor: false,
25
26
  discardStdin: false,
26
27
  });
@@ -7,7 +7,8 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.NX_DEFAULT_OPTIONS_PROVIDER = exports.nxProvideOptions = exports.NX_OPTIONS_TOKEN = void 0;
10
- const findCacheDirectory = require("find-cache-dir");
10
+ const tslib_1 = require("tslib");
11
+ const findCacheDirectory = tslib_1.__importStar(require("find-cache-dir"));
11
12
  const injection_js_1 = require("injection-js");
12
13
  const os_1 = require("os");
13
14
  const path_1 = require("path");
@@ -6,14 +6,14 @@ const angular_version_utils_1 = require("../../utilities/angular-version-utils")
6
6
  async function getNgPackagrInstance(options) {
7
7
  const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
8
8
  if (angularMajorVersion >= 17) {
9
- const { STYLESHEET_PROCESSOR } = await Promise.resolve().then(() => require('../../utilities/ng-packagr/stylesheet-processor.di'));
9
+ const { STYLESHEET_PROCESSOR } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
10
10
  const packagr = (0, ng_packagr_1.ngPackagr)();
11
11
  packagr.withProviders([STYLESHEET_PROCESSOR]);
12
12
  return packagr;
13
13
  }
14
- const { NX_ENTRY_POINT_PROVIDERS } = await Promise.resolve().then(() => require('./ng-package/entry-point/entry-point.di'));
15
- const { nxProvideOptions } = await Promise.resolve().then(() => require('./ng-package/options.di'));
16
- const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await Promise.resolve().then(() => require('./ng-package/package.di'));
14
+ const { NX_ENTRY_POINT_PROVIDERS } = await import('./ng-package/entry-point/entry-point.di.js');
15
+ const { nxProvideOptions } = await import('./ng-package/options.di.js');
16
+ const { NX_PACKAGE_PROVIDERS, NX_PACKAGE_TRANSFORM } = await import('./ng-package/package.di.js');
17
17
  const packagr = new ng_packagr_1.NgPackagr([
18
18
  ...NX_PACKAGE_PROVIDERS,
19
19
  ...NX_ENTRY_POINT_PROVIDERS,
@@ -6,9 +6,8 @@
6
6
  * - Support ngcc for Angular < 16.
7
7
  * - Support Angular Compiler `incrementalDriver` for Angular < 16.
8
8
  */
9
- import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
10
9
  import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
11
10
  import * as ts from 'typescript';
12
11
  import { NgPackagrOptions } from '../ng-package/options.di';
13
12
  import { StylesheetProcessor } from '../styles/stylesheet-processor';
14
- export declare function compileSourceFiles(graph: BuildGraph, tsConfig: ParsedConfiguration, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<CompilerOptions>, stylesheetProcessor?: StylesheetProcessor, ngccProcessor?: any): Promise<void>;
13
+ export declare function compileSourceFiles(graph: BuildGraph, tsConfig: any, moduleResolutionCache: ts.ModuleResolutionCache, options: NgPackagrOptions, extraOptions?: Partial<ts.CompilerOptions>, stylesheetProcessor?: StylesheetProcessor, ngccProcessor?: any): Promise<void>;
@@ -9,15 +9,16 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.compileSourceFiles = void 0;
12
+ const tslib_1 = require("tslib");
12
13
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
13
- const log = require("ng-packagr/lib/utils/log");
14
+ const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
14
15
  const cache_compiler_host_1 = require("ng-packagr/lib/ts/cache-compiler-host");
15
16
  const node_path_1 = require("node:path");
16
- const ts = require("typescript");
17
+ const ts = tslib_1.__importStar(require("typescript"));
17
18
  const angular_version_utils_1 = require("../../../utilities/angular-version-utils");
18
- const ng_compiler_cli_1 = require("../../../utilities/ng-compiler-cli");
19
+ const module_loader_1 = require("../../../utilities/module-loader");
19
20
  async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, options, extraOptions, stylesheetProcessor, ngccProcessor) {
20
- const { NgtscProgram, formatDiagnostics } = await (0, ng_compiler_cli_1.ngCompilerCli)();
21
+ const { NgtscProgram, formatDiagnostics } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
21
22
  const { cacheDirectory, watch, cacheEnabled } = options;
22
23
  const tsConfigOptions = {
23
24
  ...tsConfig.options,
@@ -8,14 +8,14 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.StylesheetProcessor = exports.CssUrl = void 0;
11
- const browserslist = require("browserslist");
11
+ const tslib_1 = require("tslib");
12
+ const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
12
13
  const fs_1 = require("fs");
13
- const esbuild_executor_1 = require("ng-packagr/lib/esbuild/esbuild-executor");
14
14
  const cache_1 = require("ng-packagr/lib/utils/cache");
15
- const log = require("ng-packagr/lib/utils/log");
15
+ const log = tslib_1.__importStar(require("ng-packagr/lib/utils/log"));
16
16
  const path_1 = require("path");
17
- const autoprefixer = require("autoprefixer");
18
- const postcssUrl = require("postcss-url");
17
+ const autoprefixer_1 = tslib_1.__importDefault(require("autoprefixer"));
18
+ const postcssUrl = tslib_1.__importStar(require("postcss-url"));
19
19
  const node_url_1 = require("node:url");
20
20
  const tailwindcss_1 = require("../../../utilities/ng-packagr/tailwindcss");
21
21
  const postcss = require('postcss');
@@ -32,12 +32,12 @@ class StylesheetProcessor {
32
32
  this.includePaths = includePaths;
33
33
  this.cacheDirectory = cacheDirectory;
34
34
  this.tailwindConfig = tailwindConfig;
35
- this.esbuild = new esbuild_executor_1.EsbuildExecutor();
35
+ this.esbuild = new (require('ng-packagr/lib/esbuild/esbuild-executor').EsbuildExecutor)();
36
36
  // By default, browserslist defaults are too inclusive
37
37
  // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
38
38
  // We change the default query to browsers that Angular support.
39
39
  // https://angular.io/guide/browser-support
40
- browserslist.defaults = [
40
+ browserslist_1.default.defaults = [
41
41
  'last 2 Chrome versions',
42
42
  'last 1 Firefox version',
43
43
  'last 2 Edge major versions',
@@ -56,7 +56,7 @@ class StylesheetProcessor {
56
56
  prevDir = currentDir;
57
57
  currentDir = (0, path_1.dirname)(prevDir);
58
58
  }
59
- this.browserslistData = browserslist(undefined, { path: this.basePath });
59
+ this.browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
60
60
  this.targets = transformSupportedBrowsersToTargets(this.browserslistData);
61
61
  const tailwindSetup = (0, tailwindcss_1.getTailwindSetup)(this.projectBasePath, this.tailwindConfig);
62
62
  if (tailwindSetup) {
@@ -130,7 +130,7 @@ class StylesheetProcessor {
130
130
  if (this.cssUrl !== CssUrl.none) {
131
131
  postCssPlugins.push(postcssUrl({ url: this.cssUrl }));
132
132
  }
133
- postCssPlugins.push(autoprefixer({
133
+ postCssPlugins.push((0, autoprefixer_1.default)({
134
134
  ignoreUnknownVersions: true,
135
135
  overrideBrowserslist: this.browserslistData,
136
136
  }));
@@ -141,14 +141,14 @@ class StylesheetProcessor {
141
141
  switch (ext) {
142
142
  case '.sass':
143
143
  case '.scss': {
144
- return (await Promise.resolve().then(() => require('sass'))).compileString(css, {
144
+ return (await import('sass')).compileString(css, {
145
145
  url: (0, node_url_1.pathToFileURL)(filePath),
146
146
  syntax: '.sass' === ext ? 'indented' : 'scss',
147
147
  loadPaths: this.styleIncludePaths,
148
148
  }).css;
149
149
  }
150
150
  case '.less': {
151
- const { css: content } = await (await Promise.resolve().then(() => require('less'))).render(css, {
151
+ const { css: content } = await (await import('less')).render(css, {
152
152
  filename: filePath,
153
153
  javascriptEnabled: true,
154
154
  paths: this.styleIncludePaths,
@@ -1,10 +1,8 @@
1
- import type { IndexHtmlTransform } from '@angular-devkit/build-angular/src/utils/index-file/index-html-generator';
2
1
  import type { Plugin } from 'esbuild';
3
- import type { Connect } from 'vite';
4
2
  export type PluginSpec = {
5
3
  path: string;
6
4
  options: any;
7
5
  };
8
6
  export declare function loadPlugins(plugins: string[] | PluginSpec[] | undefined, tsConfig: string): Promise<Plugin[]>;
9
- export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<Connect.NextHandleFunction[]>;
10
- export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<IndexHtmlTransform>;
7
+ export declare function loadMiddleware(middlewareFns: string[] | undefined, tsConfig: string): Promise<any[]>;
8
+ export declare function loadIndexHtmlTransformer(indexHtmlTransformerPath: string, tsConfig: string): Promise<any>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function loadModule<T = any>(path: string): Promise<T>;
3
2
  /**
4
3
  * This uses a dynamic import to load a module which may be ESM.
@@ -12,4 +11,4 @@ export declare function loadModule<T = any>(path: string): Promise<T>;
12
11
  * @param modulePath The path of the module to load.
13
12
  * @returns A Promise that resolves to the dynamically imported module.
14
13
  */
15
- export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
14
+ export declare function loadEsmModule<T = any>(modulePath: string | URL): Promise<T>;
@@ -8,7 +8,8 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.AsyncStylesheetProcessor = exports.StylesheetProcessor = exports.CssUrl = void 0;
11
- const browserslist = require("browserslist");
11
+ const tslib_1 = require("tslib");
12
+ const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
12
13
  const fs_1 = require("fs");
13
14
  const path_1 = require("path");
14
15
  const Piscina = require('piscina');
@@ -38,7 +39,7 @@ class StylesheetProcessor {
38
39
  // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
39
40
  // We change the default query to browsers that Angular support.
40
41
  // https://angular.io/guide/browser-support
41
- browserslist.defaults = [
42
+ browserslist_1.default.defaults = [
42
43
  'last 2 Chrome versions',
43
44
  'last 1 Firefox version',
44
45
  'last 2 Edge major versions',
@@ -70,12 +71,25 @@ class StylesheetProcessor {
70
71
  prevDir = currentDir;
71
72
  currentDir = (0, path_1.dirname)(prevDir);
72
73
  }
73
- const browserslistData = browserslist(undefined, { path: this.basePath });
74
+ const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
74
75
  const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
76
+ let tailwindConfigPath;
75
77
  let postcssConfiguration;
76
- if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
78
+ if ((0, semver_1.gte)(ngPackagrVersion, '18.0.0')) {
79
+ const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
80
+ let searchDirs = generateSearchDirectories([this.projectBasePath]);
81
+ postcssConfiguration = loadPostcssConfiguration(searchDirs);
82
+ // (nx-specific): we support loading the TailwindCSS config from the root of the workspace
83
+ searchDirs = generateSearchDirectories([
84
+ this.projectBasePath,
85
+ devkit_1.workspaceRoot,
86
+ ]);
87
+ tailwindConfigPath = findTailwindConfiguration(searchDirs);
88
+ }
89
+ else if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
77
90
  const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
78
91
  postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
92
+ tailwindConfigPath = (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot);
79
93
  }
80
94
  this.renderWorker = new Piscina({
81
95
  filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
@@ -87,7 +101,7 @@ class StylesheetProcessor {
87
101
  },
88
102
  workerData: {
89
103
  postcssConfiguration,
90
- tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
104
+ tailwindConfigPath,
91
105
  projectBasePath: this.projectBasePath,
92
106
  browserslistData,
93
107
  targets: transformSupportedBrowsersToTargets(browserslistData),
@@ -116,7 +130,7 @@ class AsyncStylesheetProcessor {
116
130
  // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
117
131
  // We change the default query to browsers that Angular support.
118
132
  // https://angular.io/guide/browser-support
119
- browserslist.defaults = [
133
+ browserslist_1.default.defaults = [
120
134
  'last 2 Chrome versions',
121
135
  'last 1 Firefox version',
122
136
  'last 2 Edge major versions',
@@ -148,11 +162,11 @@ class AsyncStylesheetProcessor {
148
162
  prevDir = currentDir;
149
163
  currentDir = (0, path_1.dirname)(prevDir);
150
164
  }
151
- const browserslistData = browserslist(undefined, { path: this.basePath });
165
+ const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
152
166
  const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
153
167
  let postcssConfiguration;
154
168
  if (ngPackagrVersion === '17.2.0') {
155
- const { loadPostcssConfiguration } = await Promise.resolve().then(() => require('ng-packagr/lib/styles/postcss-configuration'));
169
+ const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
156
170
  postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
157
171
  }
158
172
  this.renderWorker = new Piscina({
@@ -6,8 +6,7 @@
6
6
  * - Added an extra function that updates the configFilePath in the returned parsed options
7
7
  * to be the original tsconfig file.
8
8
  */
9
- import type { ParsedConfiguration } from '@angular/compiler-cli';
10
9
  /**
11
10
  * Proxy function that ensures the configFilePath option points to the original file path.
12
11
  */
13
- export declare function parseRemappedTsConfigAndMergeDefaults(workspaceRoot: string, originalFilePath: string, remappedFilePath: string): Promise<ParsedConfiguration>;
12
+ export declare function parseRemappedTsConfigAndMergeDefaults(workspaceRoot: string, originalFilePath: string, remappedFilePath: string): Promise<any>;
@@ -9,9 +9,10 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.parseRemappedTsConfigAndMergeDefaults = void 0;
12
+ const tslib_1 = require("tslib");
12
13
  const path_1 = require("path");
13
- const ts = require("typescript");
14
- const ng_compiler_cli_1 = require("./ng-compiler-cli");
14
+ const ts = tslib_1.__importStar(require("typescript"));
15
+ const module_loader_1 = require("./module-loader");
15
16
  async function readDefaultTsConfig(fileName) {
16
17
  // these options are mandatory
17
18
  const extraOptions = {
@@ -29,7 +30,7 @@ async function readDefaultTsConfig(fileName) {
29
30
  flatModuleId: 'AUTOGENERATED',
30
31
  flatModuleOutFile: 'AUTOGENERATED',
31
32
  };
32
- const { readConfiguration } = await (0, ng_compiler_cli_1.ngCompilerCli)();
33
+ const { readConfiguration } = await (0, module_loader_1.loadEsmModule)('@angular/compiler-cli');
33
34
  return readConfiguration(fileName, extraOptions);
34
35
  }
35
36
  /**
@@ -29,7 +29,7 @@ export declare const extendAngularEslintJson: (json: Linter.Config, options: Esl
29
29
  [name: string]: boolean;
30
30
  };
31
31
  globals?: {
32
- [name: string]: boolean | "readable" | "off" | "readonly" | "writable" | "writeable";
32
+ [name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable";
33
33
  };
34
34
  noInlineConfig?: boolean;
35
35
  overrides?: Linter.ConfigOverride<Linter.RulesRecord>[];
@@ -61,7 +61,7 @@ export declare const extendAngularEslintJson: (json: Linter.Config, options: Esl
61
61
  };
62
62
  extends?: string | string[];
63
63
  globals?: {
64
- [name: string]: boolean | "readable" | "off" | "readonly" | "writable" | "writeable";
64
+ [name: string]: boolean | "off" | "readonly" | "readable" | "writable" | "writeable";
65
65
  };
66
66
  noInlineConfig?: boolean;
67
67
  parser?: string;
@@ -8,7 +8,7 @@
8
8
  "examples": [
9
9
  {
10
10
  "command": "nx g @nx/angular:add-linting --prefix=cool --projectName=cool-lib --projectRoot=libs/cool-lib",
11
- "description": "Adds ESLint with Angular-specific rules for an existing project named `cool-lib` with the [prefix](https://angular.io/guide/styleguide#style-02-07) `cool`"
11
+ "description": "Adds ESLint with Angular-specific rules for an existing project named `cool-lib` with the [prefix](https://angular.dev/style-guide#style-02-07) `cool`"
12
12
  }
13
13
  ],
14
14
  "properties": {
@@ -2,5 +2,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2
2
  import { AppModule } from './app/app.module';
3
3
 
4
4
  platformBrowserDynamic()
5
- .bootstrapModule(AppModule)
5
+ .bootstrapModule(AppModule<% if (useEventCoalescing) { %>, {
6
+ ngZoneEventCoalescing: true
7
+ }<% } %>)
6
8
  .catch((err) => console.error(err));
@@ -1,7 +1,7 @@
1
- import { ApplicationConfig } from <% if (angularMajorVersion >= 16) { %>'@angular/core';<% } else { %>'@angular/platform-browser';<% } %><% if (routing) { %>
1
+ import { ApplicationConfig<% if (useEventCoalescing) { %>, provideZoneChangeDetection<% } %> } from '@angular/core';<% if (routing) { %>
2
2
  import { provideRouter } from '@angular/router';
3
3
  import { appRoutes } from './app.routes';<% } %>
4
4
 
5
5
  export const appConfig: ApplicationConfig = {
6
- providers: [<% if (routing) { %>provideRouter(appRoutes) <% } %>]
6
+ providers: [<% if (useEventCoalescing) { %>provideZoneChangeDetection({ eventCoalescing: true }), <% } %><% if (routing) { %>provideRouter(appRoutes) <% } %>]
7
7
  };
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLinting = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const eslint_1 = require("@nx/eslint");
5
- const add_linting_1 = require("../../add-linting/add-linting");
6
+ const add_linting_1 = tslib_1.__importDefault(require("../../add-linting/add-linting"));
6
7
  async function addLinting(host, options) {
7
8
  if (options.linter === eslint_1.Linter.None) {
8
9
  return;
@@ -29,9 +29,16 @@ async function createFiles(tree, options, rootOffset) {
29
29
  angularMajorVersion,
30
30
  rootOffset,
31
31
  isUsingApplicationBuilder,
32
+ useEventCoalescing: angularMajorVersion >= 18,
32
33
  tpl: '',
33
34
  };
34
35
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base'), options.appProjectRoot, substitutions);
36
+ if (angularMajorVersion >= 18) {
37
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-18+'), options.appProjectRoot, substitutions);
38
+ }
39
+ else {
40
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base-pre18'), options.appProjectRoot, substitutions);
41
+ }
35
42
  if (options.standalone) {
36
43
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-components'), options.appProjectRoot, substitutions);
37
44
  }
@@ -56,12 +56,19 @@ function createProject(tree, options) {
56
56
  index: `${options.appProjectSourceRoot}/index.html`,
57
57
  [buildMainOptionName]: `${options.appProjectSourceRoot}/main.ts`,
58
58
  polyfills: ['zone.js'],
59
- tsConfig: `${options.appProjectRoot}/tsconfig.app.json`,
59
+ tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
60
60
  inlineStyleLanguage,
61
- assets: [
62
- `${options.appProjectSourceRoot}/favicon.ico`,
63
- `${options.appProjectSourceRoot}/assets`,
64
- ],
61
+ assets: angularMajorVersion >= 18
62
+ ? [
63
+ {
64
+ glob: '**/*',
65
+ input: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'public'),
66
+ },
67
+ ]
68
+ : [
69
+ `${options.appProjectSourceRoot}/favicon.ico`,
70
+ `${options.appProjectSourceRoot}/assets`,
71
+ ],
65
72
  styles: [`${options.appProjectSourceRoot}/styles.${options.style}`],
66
73
  scripts: [],
67
74
  },
@@ -6,7 +6,7 @@ const versions_1 = require("../../utils/versions");
6
6
  const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
7
7
  async function componentTestGenerator(tree, options) {
8
8
  (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
9
- const { assertMinimumCypressVersion } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/cypress-version'));
9
+ const { assertMinimumCypressVersion } = require('@nx/cypress/src/utils/cypress-version');
10
10
  assertMinimumCypressVersion(10);
11
11
  const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
12
12
  const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
@@ -41,7 +41,7 @@ async function cypressComponentConfigurationInternal(tree, options) {
41
41
  exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
42
42
  async function addFiles(tree, projectConfig, options) {
43
43
  const componentFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
44
- const { addMountDefinition } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
44
+ const { addMountDefinition } = require('@nx/cypress/src/utils/config');
45
45
  const updatedCmpContents = await addMountDefinition(tree.read(componentFile, 'utf-8'));
46
46
  tree.write(componentFile, `import { mount } from 'cypress/angular';\n${updatedCmpContents}`);
47
47
  if (options.generateTests) {
@@ -69,7 +69,7 @@ async function addFiles(tree, projectConfig, options) {
69
69
  async function configureCypressCT(tree, options) {
70
70
  let found = { target: options.buildTarget, config: undefined };
71
71
  if (!options.buildTarget) {
72
- const { findBuildConfig } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/find-target-options'));
72
+ const { findBuildConfig } = require('@nx/cypress/src/utils/find-target-options');
73
73
  found = await findBuildConfig(tree, {
74
74
  project: options.project,
75
75
  buildTarget: options.buildTarget,
@@ -95,7 +95,7 @@ async function configureCypressCT(tree, options) {
95
95
  else {
96
96
  ctConfigOptions.buildTarget = found.target;
97
97
  }
98
- const { addDefaultCTConfig, getProjectCypressConfigPath } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
98
+ const { addDefaultCTConfig, getProjectCypressConfigPath } = require('@nx/cypress/src/utils/config');
99
99
  const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
100
100
  const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
101
101
  tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);