@nx/angular 0.0.0-pr-28229-afe192c → 0.0.0-pr-28453-54fa63c

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "0.0.0-pr-28229-afe192c",
3
+ "version": "0.0.0-pr-28453-54fa63c",
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, Playwright 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- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -79,13 +79,13 @@
79
79
  "tslib": "^2.3.0",
80
80
  "webpack-merge": "^5.8.0",
81
81
  "webpack": "^5.88.0",
82
- "@module-federation/enhanced": "0.6.6",
83
- "@nx/devkit": "0.0.0-pr-28229-afe192c",
84
- "@nx/js": "0.0.0-pr-28229-afe192c",
85
- "@nx/eslint": "0.0.0-pr-28229-afe192c",
86
- "@nx/webpack": "0.0.0-pr-28229-afe192c",
87
- "@nx/web": "0.0.0-pr-28229-afe192c",
88
- "@nx/workspace": "0.0.0-pr-28229-afe192c",
82
+ "@module-federation/enhanced": "0.6.9",
83
+ "@nx/devkit": "0.0.0-pr-28453-54fa63c",
84
+ "@nx/js": "0.0.0-pr-28453-54fa63c",
85
+ "@nx/eslint": "0.0.0-pr-28453-54fa63c",
86
+ "@nx/webpack": "0.0.0-pr-28453-54fa63c",
87
+ "@nx/web": "0.0.0-pr-28453-54fa63c",
88
+ "@nx/workspace": "0.0.0-pr-28453-54fa63c",
89
89
  "piscina": "^4.4.0"
90
90
  },
91
91
  "peerDependencies": {
@@ -16,15 +16,19 @@ const patch_builder_context_1 = require("../../executors/utilities/patch-builder
16
16
  const buildable_libs_1 = require("../utilities/buildable-libs");
17
17
  const webpack_1 = require("../utilities/webpack");
18
18
  const lib_1 = require("./lib");
19
+ const configuration_1 = require("nx/src/config/configuration");
19
20
  function executeDevServerBuilder(rawOptions, context) {
20
21
  (0, lib_1.validateOptions)(rawOptions);
21
22
  process.env.NX_TSCONFIG_PATH = (0, js_1.getRootTsConfigPath)();
22
23
  const options = (0, lib_1.normalizeOptions)(rawOptions);
24
+ const projectGraph = (0, devkit_1.readCachedProjectGraph)();
23
25
  const parsedBuildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, {
24
26
  cwd: context.currentDirectory,
25
- projectGraph: (0, devkit_1.readCachedProjectGraph)(),
27
+ projectGraph,
26
28
  projectName: context.target.project,
29
+ projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
27
30
  root: context.workspaceRoot,
31
+ nxJsonConfiguration: (0, configuration_1.readNxJson)(devkit_1.workspaceRoot),
28
32
  isVerbose: false,
29
33
  });
30
34
  const browserTargetProjectConfiguration = (0, project_graph_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
@@ -2,13 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addAngularEsLintDependencies = addAngularEsLintDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
6
+ const versions_1 = require("@nx/eslint/src/utils/versions");
5
7
  const version_utils_1 = require("../../utils/version-utils");
6
8
  const buildable_project_1 = require("./buildable-project");
7
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
8
9
  function addAngularEsLintDependencies(tree, projectName) {
9
10
  const compatVersions = (0, version_utils_1.versions)(tree);
10
11
  const angularEslintVersionToInstall = compatVersions.angularEslintVersion;
11
- const devDependencies = (0, flat_config_1.useFlatConfig)(tree)
12
+ const usesEslintFlatConfig = (0, flat_config_1.useFlatConfig)(tree);
13
+ const devDependencies = usesEslintFlatConfig
12
14
  ? {
13
15
  'angular-eslint': angularEslintVersionToInstall,
14
16
  }
@@ -18,8 +20,9 @@ function addAngularEsLintDependencies(tree, projectName) {
18
20
  '@angular-eslint/template-parser': angularEslintVersionToInstall,
19
21
  };
20
22
  if ('typescriptEslintVersion' in compatVersions) {
21
- devDependencies['@typescript-eslint/utils'] =
22
- compatVersions.typescriptEslintVersion;
23
+ devDependencies['@typescript-eslint/utils'] = usesEslintFlatConfig
24
+ ? versions_1.eslint9__typescriptESLintVersion
25
+ : compatVersions.typescriptEslintVersion;
23
26
  }
24
27
  if ((0, buildable_project_1.isBuildableLibraryProject)(tree, projectName)) {
25
28
  const jsoncEslintParserVersionToInstall = (0, version_utils_1.versions)(tree).jsoncEslintParserVersion;
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGenerator = applicationGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
5
6
  const js_1 = require("@nx/js");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
8
  const init_1 = require("../init/init");
7
9
  const setup_ssr_1 = require("../setup-ssr/setup-ssr");
8
10
  const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
9
11
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
10
12
  const lib_1 = require("./lib");
11
- const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
12
13
  async function applicationGenerator(tree, schema) {
14
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
13
15
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
14
16
  const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
15
17
  await (0, js_1.initGenerator)(tree, {
@@ -4,14 +4,16 @@ exports.host = host;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
7
+ const js_1 = require("@nx/js");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
9
  const test_runners_1 = require("../../utils/test-runners");
8
10
  const application_1 = tslib_1.__importDefault(require("../application/application"));
9
11
  const remote_1 = tslib_1.__importDefault(require("../remote/remote"));
10
12
  const setup_mf_1 = require("../setup-mf/setup-mf");
11
- const lib_1 = require("./lib");
12
13
  const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
13
- const js_1 = require("@nx/js");
14
+ const lib_1 = require("./lib");
14
15
  async function host(tree, schema) {
16
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'host');
15
17
  const { typescriptConfiguration = true, ...options } = schema;
16
18
  options.standalone = options.standalone ?? true;
17
19
  const projects = (0, devkit_1.getProjects)(tree);
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.angularInitGenerator = angularInitGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
6
- const version_utils_1 = require("../utils/version-utils");
6
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
+ const version_utils_1 = require("../utils/version-utils");
8
9
  async function angularInitGenerator(tree, options) {
10
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'init');
9
11
  ignoreAngularCacheDirectory(tree);
10
12
  const installTask = installAngularDevkitCoreIfMissing(tree, options);
11
13
  // For Angular inference plugin, we only want it during import since our
@@ -22,7 +22,9 @@ const add_jest_1 = require("../utils/add-jest");
22
22
  const set_generator_defaults_1 = require("./lib/set-generator-defaults");
23
23
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
24
24
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
25
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
25
26
  async function libraryGenerator(tree, schema) {
27
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'library');
26
28
  // Do some validation checks
27
29
  if (!schema.routing && schema.lazy) {
28
30
  throw new Error(`To use "--lazy" option, "--routing" must also be set.`);
@@ -87,14 +87,14 @@ function addImportsToModule(tree, options) {
87
87
  sourceFile = addImport(sourceFile, 'StoreModule', '@ngrx/store');
88
88
  sourceFile = addImport(sourceFile, 'EffectsModule', '@ngrx/effects');
89
89
  }
90
- sourceFile = addRootStoreImport(tree, isParentStandalone, sourceFile, parentPath, provideRootStore, storeForRoot);
91
90
  sourceFile = addRootEffectsImport(tree, isParentStandalone, sourceFile, parentPath, provideRootEffects, effectsForEmptyRoot);
91
+ if (options.addDevTools) {
92
+ sourceFile = addStoreDevTools(tree, sourceFile, parentPath, isParentStandalone, addImport);
93
+ }
94
+ sourceFile = addRootStoreImport(tree, isParentStandalone, sourceFile, parentPath, provideRootStore, storeForRoot);
92
95
  // this is just a heuristic
93
96
  const hasRouter = sourceText.indexOf('RouterModule') > -1;
94
97
  if (hasRouter && !isParentStandalone) {
95
98
  sourceFile = addRouterStoreImport(tree, sourceFile, addImport, parentPath, storeRouterModule);
96
99
  }
97
- if (options.addDevTools) {
98
- sourceFile = addStoreDevTools(tree, sourceFile, parentPath, isParentStandalone, addImport);
99
- }
100
100
  }
@@ -3,13 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.remote = remote;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const versions_1 = require("@nx/js/src/utils/versions");
6
8
  const test_runners_1 = require("../../utils/test-runners");
7
9
  const application_1 = require("../application/application");
8
10
  const setup_mf_1 = require("../setup-mf/setup-mf");
9
- const lib_1 = require("./lib");
10
- const versions_1 = require("@nx/js/src/utils/versions");
11
11
  const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
12
+ const lib_1 = require("./lib");
12
13
  async function remote(tree, schema) {
14
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'remote');
13
15
  const { typescriptConfiguration = true, ...options } = schema;
14
16
  options.standalone = options.standalone ?? true;
15
17
  const projects = (0, devkit_1.getProjects)(tree);
@@ -22,6 +24,14 @@ async function remote(tree, schema) {
22
24
  projectType: 'application',
23
25
  directory: options.directory,
24
26
  });
27
+ const REMOTE_NAME_REGEX = '^[a-zA-Z_$][a-zA-Z_$0-9]*$';
28
+ const remoteNameRegex = new RegExp(REMOTE_NAME_REGEX);
29
+ if (!remoteNameRegex.test(remoteProjectName)) {
30
+ throw new Error((0, devkit_1.stripIndents) `Invalid remote name: ${remoteProjectName}. Remote project names must:
31
+ - Start with a letter, dollar sign ($) or underscore (_)
32
+ - Followed by any valid character (letters, digits, underscores, or dollar signs)
33
+ The regular expression used is ${REMOTE_NAME_REGEX}.`);
34
+ }
25
35
  const port = options.port ?? (0, lib_1.findNextAvailablePort)(tree);
26
36
  const appInstallTask = await (0, application_1.applicationGenerator)(tree, {
27
37
  ...options,
@@ -86,8 +86,8 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
86
86
  ? 'remoteRoutes'
87
87
  : 'RemoteEntryModule';
88
88
  const routeToAdd = hostFederationType === 'dynamic'
89
- ? `loadRemoteModule('${options.appName}', './${routePathName}')`
90
- : `import('${options.appName}/${routePathName}')`;
89
+ ? `loadRemoteModule('${options.appName.replace(/-/g, '_')}', './${routePathName}')`
90
+ : `import('${options.appName.replace(/-/g, '_')}/${routePathName}')`;
91
91
  (0, route_utils_1.addRoute)(tree, pathToHostRootRouting, `{
92
92
  path: '${options.appName}',
93
93
  loadChildren: () => ${routeToAdd}.then(m => m.${exportedRemote})
@@ -9,7 +9,7 @@ function setupTspathForRemote(tree, options) {
9
9
  ? `./src/app/remote-entry/entry.routes.ts`
10
10
  : `./src/app/remote-entry/entry.module.ts`;
11
11
  const exportName = options.standalone ? 'Routes' : 'Module';
12
- (0, js_1.addTsConfigPath)(tree, `${options.appName}/${exportName}`, [
12
+ (0, js_1.addTsConfigPath)(tree, `${options.appName.replace(/-/g, '_')}/${exportName}`, [
13
13
  (0, devkit_1.joinPathFragments)(project.root, exportPath),
14
14
  ]);
15
15
  }
@@ -31,7 +31,7 @@ async function withModuleFederationForSSR(options, configOverride) {
31
31
  plugins: [
32
32
  ...(config.plugins ?? []),
33
33
  new (require('@module-federation/enhanced').ModuleFederationPlugin)({
34
- name: options.name,
34
+ name: options.name.replace(/-/g, '_'),
35
35
  filename: 'remoteEntry.js',
36
36
  exposes: options.exposes,
37
37
  remotes: mappedRemotes,
@@ -34,7 +34,7 @@ async function withModuleFederation(options, configOverride) {
34
34
  plugins: [
35
35
  ...(config.plugins ?? []),
36
36
  new webpack_1.ModuleFederationPlugin({
37
- name: options.name,
37
+ name: options.name.replace(/-/g, '_'),
38
38
  filename: 'remoteEntry.mjs',
39
39
  exposes: options.exposes,
40
40
  remotes: mappedRemotes,
@@ -13,7 +13,7 @@ export declare const expressVersion = "~4.18.2";
13
13
  export declare const typesExpressVersion = "4.17.14";
14
14
  export declare const browserSyncVersion = "^3.0.0";
15
15
  export declare const moduleFederationNodeVersion = "~2.5.0";
16
- export declare const moduleFederationEnhancedVersion = "0.6.6";
16
+ export declare const moduleFederationEnhancedVersion = "0.6.9";
17
17
  export declare const angularEslintVersion = "^18.3.0";
18
18
  export declare const typescriptEslintVersion = "^7.16.0";
19
19
  export declare const tailwindVersion = "^3.0.2";
@@ -16,7 +16,7 @@ exports.expressVersion = '~4.18.2';
16
16
  exports.typesExpressVersion = '4.17.14';
17
17
  exports.browserSyncVersion = '^3.0.0';
18
18
  exports.moduleFederationNodeVersion = '~2.5.0';
19
- exports.moduleFederationEnhancedVersion = '0.6.6';
19
+ exports.moduleFederationEnhancedVersion = '0.6.9';
20
20
  exports.angularEslintVersion = '^18.3.0';
21
21
  exports.typescriptEslintVersion = '^7.16.0';
22
22
  exports.tailwindVersion = '^3.0.2';