@nx/angular 18.0.0-beta.2 → 18.0.0-beta.3

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 CHANGED
@@ -40,7 +40,7 @@
40
40
  "dev-server": {
41
41
  "implementation": "./src/builders/dev-server/dev-server.impl",
42
42
  "schema": "./src/builders/dev-server/schema.json",
43
- "description": "The `dev-server` executor is very similar to the standard `dev-server` builder provided by the Angular Devkit. It is usually used in tandem with `@nrwl/angular:webpack-browser` when your Angular application uses a custom webpack configuration."
43
+ "description": "Serves an Angular application using [Webpack](https://webpack.js.org/) when the build target is using a Webpack-based executor, or [Vite](https://vitejs.dev/) when the build target uses an esbuild-based executor."
44
44
  },
45
45
  "webpack-server": {
46
46
  "implementation": "./src/builders/webpack-server/webpack-server.impl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "18.0.0-beta.2",
3
+ "version": "18.0.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -78,16 +78,16 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "18.0.0-beta.2",
82
- "@nx/cypress": "18.0.0-beta.2",
83
- "@nx/jest": "18.0.0-beta.2",
84
- "@nx/js": "18.0.0-beta.2",
85
- "@nx/eslint": "18.0.0-beta.2",
86
- "@nx/webpack": "18.0.0-beta.2",
87
- "@nx/web": "18.0.0-beta.2",
88
- "@nx/workspace": "18.0.0-beta.2",
81
+ "@nx/devkit": "18.0.0-beta.3",
82
+ "@nx/cypress": "18.0.0-beta.3",
83
+ "@nx/jest": "18.0.0-beta.3",
84
+ "@nx/js": "18.0.0-beta.3",
85
+ "@nx/eslint": "18.0.0-beta.3",
86
+ "@nx/webpack": "18.0.0-beta.3",
87
+ "@nx/web": "18.0.0-beta.3",
88
+ "@nx/workspace": "18.0.0-beta.3",
89
89
  "piscina": "^4.2.1",
90
- "@nrwl/angular": "18.0.0-beta.2"
90
+ "@nrwl/angular": "18.0.0-beta.3"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -54,9 +54,11 @@ function executeDevServerBuilder(rawOptions, context) {
54
54
  throw new Error(`Custom Webpack Config File Not Found!\nTo use a custom webpack config, please ensure the path to the custom webpack file is correct: \n${pathToWebpackConfig}`);
55
55
  }
56
56
  }
57
+ const normalizedIndexHtmlTransformer = buildTargetOptions.indexHtmlTransformer ??
58
+ buildTargetOptions.indexFileTransformer;
57
59
  let pathToIndexFileTransformer;
58
- if (buildTargetOptions.indexFileTransformer) {
59
- pathToIndexFileTransformer = (0, devkit_1.joinPathFragments)(context.workspaceRoot, buildTargetOptions.indexFileTransformer);
60
+ if (normalizedIndexHtmlTransformer) {
61
+ pathToIndexFileTransformer = (0, devkit_1.joinPathFragments)(context.workspaceRoot, normalizedIndexHtmlTransformer);
60
62
  if (pathToIndexFileTransformer && !(0, fs_1.existsSync)(pathToIndexFileTransformer)) {
61
63
  throw new Error(`File containing Index File Transformer function Not Found!\n Please ensure the path to the file containing the function is correct: \n${pathToIndexFileTransformer}`);
62
64
  }
@@ -184,6 +186,7 @@ function patchBuilderContext(context, isUsingEsbuildBuilder, buildTarget) {
184
186
  function cleanBuildTargetOptions(options) {
185
187
  delete options.buildLibsFromSource;
186
188
  delete options.customWebpackConfig;
189
+ delete options.indexHtmlTransformer;
187
190
  delete options.indexFileTransformer;
188
191
  delete options.plugins;
189
192
  return options;
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "$schema": "http://json-schema.org/draft-07/schema",
5
5
  "title": "Schema for Webpack Dev Server",
6
- "description": "The dev-server executor is very similar to the standard dev server builder provided by the Angular Devkit. It is usually used in tandem with `@nx/angular:webpack-browser` when your Angular application uses a custom webpack configuration.",
6
+ "description": "Serves an Angular application using [Webpack](https://webpack.js.org/) when the build target is using a Webpack-based executor, or [Vite](https://vitejs.dev/) when the build target uses an esbuild-based executor.",
7
7
  "examplesFile": "../../../docs/dev-server-examples.md",
8
8
  "type": "object",
9
9
  "presets": [
@@ -4,6 +4,10 @@ export type BrowserBuilderSchema = Schema & {
4
4
  customWebpackConfig?: {
5
5
  path: string;
6
6
  };
7
- indexFileTransformer?: string;
7
+ indexHtmlTransformer?: string;
8
8
  buildLibsFromSource?: boolean;
9
+ /**
10
+ * @deprecated Use `indexHtmlTransformer` instead. It will be removed in Nx 19.
11
+ */
12
+ indexFileTransformer?: string;
9
13
  };
@@ -458,9 +458,10 @@
458
458
  "x-priority": "important",
459
459
  "additionalProperties": false
460
460
  },
461
- "indexFileTransformer": {
461
+ "indexHtmlTransformer": {
462
462
  "description": "Path to transformer function to transform the index.html",
463
- "type": "string"
463
+ "type": "string",
464
+ "alias": "indexFileTransformer"
464
465
  },
465
466
  "buildLibsFromSource": {
466
467
  "type": "boolean",
@@ -24,7 +24,7 @@ function shouldSkipInitialTargetRun(projectGraph, project, target) {
24
24
  }
25
25
  function executeWebpackBrowserBuilder(options, context) {
26
26
  options.buildLibsFromSource ??= true;
27
- const { buildLibsFromSource, customWebpackConfig, indexFileTransformer, ...delegateBuilderOptions } = options;
27
+ const { buildLibsFromSource, customWebpackConfig, indexHtmlTransformer, indexFileTransformer, ...delegateBuilderOptions } = options;
28
28
  process.env.NX_BUILD_LIBS_FROM_SOURCE = `${buildLibsFromSource}`;
29
29
  process.env.NX_BUILD_TARGET = (0, devkit_1.targetToTargetString)({ ...context.target });
30
30
  const pathToWebpackConfig = customWebpackConfig?.path &&
@@ -32,8 +32,9 @@ function executeWebpackBrowserBuilder(options, context) {
32
32
  if (pathToWebpackConfig && !(0, fs_1.existsSync)(pathToWebpackConfig)) {
33
33
  throw new Error(`Custom Webpack Config File Not Found!\nTo use a custom webpack config, please ensure the path to the custom webpack file is correct: \n${pathToWebpackConfig}`);
34
34
  }
35
- const pathToIndexFileTransformer = indexFileTransformer &&
36
- (0, devkit_1.joinPathFragments)(context.workspaceRoot, indexFileTransformer);
35
+ const normalizedIndexHtmlTransformer = indexHtmlTransformer ?? indexFileTransformer;
36
+ const pathToIndexFileTransformer = normalizedIndexHtmlTransformer &&
37
+ (0, devkit_1.joinPathFragments)(context.workspaceRoot, normalizedIndexHtmlTransformer);
37
38
  if (pathToIndexFileTransformer && !(0, fs_1.existsSync)(pathToIndexFileTransformer)) {
38
39
  throw new Error(`File containing Index File Transformer function Not Found!\n Please ensure the path to the file containing the function is correct: \n${pathToIndexFileTransformer}`);
39
40
  }
@@ -13,7 +13,7 @@ exports.default = default_1;
13
13
  function isWebpackBrowserUsed(tree) {
14
14
  const projects = (0, devkit_1.getProjects)(tree);
15
15
  for (const project of projects.values()) {
16
- const targets = project.targets;
16
+ const targets = project.targets || {};
17
17
  for (const [_, target] of Object.entries(targets)) {
18
18
  if (target.executor === '@nx/angular:webpack-browser' &&
19
19
  (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||