@nx/angular 16.8.0-beta.3 → 16.8.0-beta.5
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/mf/mf.js +31 -36
- package/migrations.json +9 -0
- package/package.json +11 -11
- package/plugins/component-testing.js +82 -44
- package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
- package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
- package/src/builders/utilities/buildable-libs.js +1 -2
- package/src/builders/utilities/module-federation.js +2 -3
- package/src/builders/utilities/webpack.js +16 -21
- package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
- package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
- package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
- package/src/builders/webpack-server/webpack-server.impl.js +5 -7
- package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
- package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
- package/src/executors/delegate-build/delegate-build.impl.js +9 -12
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
- package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
- package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
- package/src/executors/package/package.impl.js +33 -38
- package/src/executors/utilities/angular-version-utils.js +1 -1
- package/src/executors/utilities/tailwindcss.js +2 -2
- package/src/executors/utilities/typescript.js +23 -28
- package/src/generators/add-linting/add-linting.js +76 -69
- package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +2 -0
- package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
- package/src/generators/application/application.js +56 -55
- package/src/generators/application/lib/add-e2e.js +36 -40
- package/src/generators/application/lib/add-linting.js +12 -15
- package/src/generators/application/lib/add-proxy-config.js +4 -1
- package/src/generators/application/lib/add-unit-test-runner.js +15 -18
- package/src/generators/application/lib/create-files.js +44 -47
- package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
- package/src/generators/application/lib/normalize-options.js +37 -25
- package/src/generators/application/lib/set-app-strict-default.js +1 -2
- package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
- package/src/generators/component/component.js +40 -43
- package/src/generators/component/lib/normalize-options.js +15 -5
- package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
- package/src/generators/component-story/component-story.js +19 -22
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
- package/src/generators/directive/directive.js +21 -24
- package/src/generators/directive/lib/normalize-options.js +11 -5
- package/src/generators/host/files/src/main.server.ts__tmpl__ +1 -1
- package/src/generators/host/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -33
- package/src/generators/init/init.js +101 -92
- package/src/generators/library/lib/add-standalone-component.js +18 -13
- package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
- package/src/generators/library/lib/normalize-options.js +68 -53
- package/src/generators/library/library.js +89 -92
- package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
- package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
- package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
- package/src/generators/move/lib/normalize-schema.js +5 -1
- package/src/generators/move/lib/update-module-name.js +1 -1
- package/src/generators/move/lib/update-ng-package.js +1 -2
- package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
- package/src/generators/move/move.js +9 -12
- package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
- package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
- package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
- package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
- package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
- package/src/generators/ng-add/migrators/migrator.js +7 -11
- package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
- package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
- package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
- package/src/generators/ng-add/ng-add.js +5 -8
- package/src/generators/ng-add/utilities/dependencies.js +2 -3
- package/src/generators/ng-add/utilities/format-files-task.js +1 -1
- package/src/generators/ng-add/utilities/projects.js +1 -1
- package/src/generators/ng-add/utilities/workspace.js +25 -36
- package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
- package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx/lib/generate-files.js +11 -2
- package/src/generators/ngrx/lib/normalize-options.js +9 -4
- package/src/generators/ngrx/lib/validate-options.js +3 -3
- package/src/generators/ngrx/ngrx.js +18 -21
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
- package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
- package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
- package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
- package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
- package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
- package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
- package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
- package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
- package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
- package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
- package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
- package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
- package/src/generators/pipe/lib/normalize-options.js +9 -3
- package/src/generators/pipe/pipe.js +21 -24
- package/src/generators/remote/files/base/src/main.server.ts__tmpl__ +2 -2
- package/src/generators/remote/lib/add-ssr.js +46 -43
- package/src/generators/remote/lib/find-next-available-port.js +1 -2
- package/src/generators/remote/remote.js +52 -49
- package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
- package/src/generators/scam/lib/normalize-options.js +11 -4
- package/src/generators/scam/scam.js +15 -12
- package/src/generators/scam-directive/lib/normalize-options.js +12 -4
- package/src/generators/scam-directive/scam-directive.js +13 -10
- package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
- package/src/generators/scam-pipe/scam-pipe.js +13 -10
- package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
- package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
- package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
- package/src/generators/setup-mf/lib/change-build-target.js +10 -4
- package/src/generators/setup-mf/lib/generate-config.js +1 -1
- package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
- package/src/generators/setup-mf/lib/normalize-options.js +5 -2
- package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js +10 -3
- package/src/generators/setup-mf/setup-mf.js +32 -35
- package/src/generators/setup-ssr/lib/generate-files.js +8 -5
- package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
- package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
- package/src/generators/setup-ssr/setup-ssr.js +26 -27
- package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
- package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
- package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
- package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
- package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
- package/src/generators/stories/lib/get-e2e-project.js +1 -1
- package/src/generators/stories/stories.js +43 -50
- package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
- package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
- package/src/generators/utils/create-ts-config.js +1 -1
- package/src/generators/utils/entry-point.js +1 -2
- package/src/generators/utils/export-scam.js +1 -1
- package/src/generators/utils/insert-ngmodule-import.js +1 -1
- package/src/generators/utils/path.js +3 -3
- package/src/generators/utils/project.js +2 -3
- package/src/generators/utils/selector.js +1 -1
- package/src/generators/utils/storybook-ast/component-info.js +1 -2
- package/src/generators/utils/storybook-ast/entry-point.js +1 -2
- package/src/generators/utils/storybook-ast/module-info.js +1 -2
- package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
- package/src/generators/utils/testing.js +141 -138
- package/src/generators/utils/validations.js +1 -1
- package/src/generators/utils/version-utils.js +5 -7
- package/src/generators/web-worker/lib/normalize-options.js +6 -3
- package/src/generators/web-worker/web-worker.js +25 -28
- package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
- package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
- package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
- package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
- package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
- package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
- package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
- package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
- package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
- package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
- package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
- package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
- package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
- package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
- package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
- package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
- package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
- package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
- package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
- package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
- package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
- package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
- package/src/migrations/utils/projects.js +9 -15
- package/src/utils/backward-compatible-versions.js +2 -0
- package/src/utils/get-mf-projects.js +1 -2
- package/src/utils/mf/utils.js +43 -44
- package/src/utils/mf/with-module-federation-ssr.js +39 -24
- package/src/utils/mf/with-module-federation.js +40 -21
- package/src/utils/nx-devkit/ast-utils.js +2 -3
- package/src/utils/nx-devkit/testing.js +9 -9
- package/src/utils/version-utils.js +2 -4
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +2 -1
package/mf/mf.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadRemoteModule = exports.setRemoteDefinitions = exports.setRemoteUrlResolver = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
let resolveRemoteUrl;
|
|
6
5
|
function setRemoteUrlResolver(_resolveRemoteUrl) {
|
|
7
6
|
resolveRemoteUrl = _resolveRemoteUrl;
|
|
@@ -14,45 +13,41 @@ function setRemoteDefinitions(definitions) {
|
|
|
14
13
|
exports.setRemoteDefinitions = setRemoteDefinitions;
|
|
15
14
|
let remoteModuleMap = new Map();
|
|
16
15
|
let remoteContainerMap = new Map();
|
|
17
|
-
function loadRemoteModule(remoteName, moduleName) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return Module;
|
|
30
|
-
});
|
|
16
|
+
async function loadRemoteModule(remoteName, moduleName) {
|
|
17
|
+
const remoteModuleKey = `${remoteName}:${moduleName}`;
|
|
18
|
+
if (remoteModuleMap.has(remoteModuleKey)) {
|
|
19
|
+
return remoteModuleMap.get(remoteModuleKey);
|
|
20
|
+
}
|
|
21
|
+
const container = remoteContainerMap.has(remoteName)
|
|
22
|
+
? remoteContainerMap.get(remoteName)
|
|
23
|
+
: await loadRemoteContainer(remoteName);
|
|
24
|
+
const factory = await container.get(moduleName);
|
|
25
|
+
const Module = factory();
|
|
26
|
+
remoteModuleMap.set(remoteModuleKey, Module);
|
|
27
|
+
return Module;
|
|
31
28
|
}
|
|
32
29
|
exports.loadRemoteModule = loadRemoteModule;
|
|
33
30
|
function loadModule(url) {
|
|
34
31
|
return Promise.resolve(`${url}`).then(s => require(s));
|
|
35
32
|
}
|
|
36
33
|
let initialSharingScopeCreated = false;
|
|
37
|
-
function loadRemoteContainer(remoteName) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return container;
|
|
57
|
-
});
|
|
34
|
+
async function loadRemoteContainer(remoteName) {
|
|
35
|
+
if (!resolveRemoteUrl && !remoteUrlDefinitions) {
|
|
36
|
+
throw new Error('Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.');
|
|
37
|
+
}
|
|
38
|
+
if (!initialSharingScopeCreated) {
|
|
39
|
+
initialSharingScopeCreated = true;
|
|
40
|
+
await __webpack_init_sharing__('default');
|
|
41
|
+
}
|
|
42
|
+
const remoteUrl = remoteUrlDefinitions
|
|
43
|
+
? remoteUrlDefinitions[remoteName]
|
|
44
|
+
: await resolveRemoteUrl(remoteName);
|
|
45
|
+
let containerUrl = remoteUrl;
|
|
46
|
+
if (!remoteUrl.endsWith('.mjs') && !remoteUrl.endsWith('.js')) {
|
|
47
|
+
containerUrl = `${remoteUrl}${remoteUrl.endsWith('/') ? '' : '/'}remoteEntry.mjs`;
|
|
48
|
+
}
|
|
49
|
+
const container = await loadModule(containerUrl);
|
|
50
|
+
await container.init(__webpack_share_scopes__.default);
|
|
51
|
+
remoteContainerMap.set(remoteName, container);
|
|
52
|
+
return container;
|
|
58
53
|
}
|
package/migrations.json
CHANGED
|
@@ -1345,6 +1345,15 @@
|
|
|
1345
1345
|
"alwaysAddToPackageJson": false
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
+
},
|
|
1349
|
+
"16.8.0": {
|
|
1350
|
+
"version": "16.8.0-beta.2",
|
|
1351
|
+
"packages": {
|
|
1352
|
+
"esbuild": {
|
|
1353
|
+
"version": "^0.19.2",
|
|
1354
|
+
"alwaysAddToPackageJson": false
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1348
1357
|
}
|
|
1349
1358
|
}
|
|
1350
1359
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "16.8.0-beta.
|
|
3
|
+
"version": "16.8.0-beta.5",
|
|
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": {
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"migrations": "./migrations.json"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@nrwl/angular": "16.8.0-beta.
|
|
70
|
-
"@nx/cypress": "16.8.0-beta.
|
|
71
|
-
"@nx/devkit": "16.8.0-beta.
|
|
72
|
-
"@nx/jest": "16.8.0-beta.
|
|
73
|
-
"@nx/js": "16.8.0-beta.
|
|
74
|
-
"@nx/linter": "16.8.0-beta.
|
|
75
|
-
"@nx/webpack": "16.8.0-beta.
|
|
76
|
-
"@nx/workspace": "16.8.0-beta.
|
|
69
|
+
"@nrwl/angular": "16.8.0-beta.5",
|
|
70
|
+
"@nx/cypress": "16.8.0-beta.5",
|
|
71
|
+
"@nx/devkit": "16.8.0-beta.5",
|
|
72
|
+
"@nx/jest": "16.8.0-beta.5",
|
|
73
|
+
"@nx/js": "16.8.0-beta.5",
|
|
74
|
+
"@nx/linter": "16.8.0-beta.5",
|
|
75
|
+
"@nx/webpack": "16.8.0-beta.5",
|
|
76
|
+
"@nx/workspace": "16.8.0-beta.5",
|
|
77
77
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
78
78
|
"@typescript-eslint/type-utils": "^5.36.1",
|
|
79
79
|
"chalk": "^4.1.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@angular-devkit/schematics": ">= 14.0.0 < 17.0.0",
|
|
94
94
|
"@nguniversal/builders": ">= 14.0.0 < 17.0.0",
|
|
95
95
|
"@schematics/angular": ">= 14.0.0 < 17.0.0",
|
|
96
|
-
"esbuild": "^0.
|
|
96
|
+
"esbuild": "^0.19.2",
|
|
97
97
|
"rxjs": "^6.5.3 || ^7.5.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependenciesMeta": {
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"module": "fesm2022/nx-angular.mjs",
|
|
111
111
|
"typings": "index.d.ts",
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "ad2d1e8a55b2d1b358bb5e7483343d9757ff2c53"
|
|
114
114
|
}
|
|
@@ -26,7 +26,6 @@ const semver_1 = require("semver");
|
|
|
26
26
|
* @param options override options
|
|
27
27
|
*/
|
|
28
28
|
function nxComponentTestingPreset(pathToConfig, options) {
|
|
29
|
-
var _a, _b, _c, _d, _e;
|
|
30
29
|
let graph;
|
|
31
30
|
try {
|
|
32
31
|
graph = (0, devkit_1.readCachedProjectGraph)();
|
|
@@ -41,12 +40,12 @@ ${e.stack ? e.stack : e}`);
|
|
|
41
40
|
}
|
|
42
41
|
const ctProjectConfig = (0, ct_helpers_1.getProjectConfigByPath)(graph, pathToConfig);
|
|
43
42
|
const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
|
|
44
|
-
const ctContext = (0, ct_helpers_1.createExecutorContext)(graph, ctProjectConfig.targets, ctProjectConfig.name,
|
|
43
|
+
const ctContext = (0, ct_helpers_1.createExecutorContext)(graph, ctProjectConfig.targets, ctProjectConfig.name, options?.ctTargetName || 'component-test', ctConfigurationName);
|
|
45
44
|
const buildTarget = getBuildableTarget(ctContext);
|
|
46
|
-
if (!buildTarget.project && !
|
|
45
|
+
if (!buildTarget.project && !graph.nodes?.[buildTarget.project]?.data) {
|
|
47
46
|
throw new Error((0, devkit_1.stripIndents) `Unable to find project configuration for build target.
|
|
48
47
|
Project Name? ${buildTarget.project}
|
|
49
|
-
Has project config? ${!!
|
|
48
|
+
Has project config? ${!!graph.nodes?.[buildTarget.project]?.data}`);
|
|
50
49
|
}
|
|
51
50
|
const fromWorkspaceRoot = (0, path_1.relative)(ctContext.root, pathToConfig);
|
|
52
51
|
const normalizedFromWorkspaceRootPath = (0, fs_1.lstatSync)(pathToConfig).isFile()
|
|
@@ -55,25 +54,34 @@ ${e.stack ? e.stack : e}`);
|
|
|
55
54
|
const offset = isOffsetNeeded(ctContext, ctProjectConfig)
|
|
56
55
|
? (0, devkit_1.offsetFromRoot)(normalizedFromWorkspaceRootPath)
|
|
57
56
|
: undefined;
|
|
58
|
-
const buildContext = (0, ct_helpers_1.createExecutorContext)(graph,
|
|
57
|
+
const buildContext = (0, ct_helpers_1.createExecutorContext)(graph, graph.nodes[buildTarget.project]?.data.targets, buildTarget.project, buildTarget.target, buildTarget.configuration);
|
|
59
58
|
const buildableProjectConfig = normalizeBuildTargetOptions(buildContext, ctContext, offset);
|
|
60
|
-
return
|
|
59
|
+
return {
|
|
60
|
+
...(0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig, { testingType: 'component' }),
|
|
61
61
|
// NOTE: cannot use a glob pattern since it will break cypress generated tsconfig.
|
|
62
|
-
specPattern: ['src/**/*.cy.ts', 'src/**/*.cy.js'],
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
indexHtmlFile: (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
specPattern: ['src/**/*.cy.ts', 'src/**/*.cy.js'],
|
|
63
|
+
// Cy v12.17.0+ does not work with aboslute paths for index file
|
|
64
|
+
// but does with relative pathing, since relative path is the default location, we can omit it
|
|
65
|
+
indexHtmlFile: requiresAbsolutePath()
|
|
66
|
+
? (0, devkit_1.joinPathFragments)(ctContext.root, ctProjectConfig.root, 'cypress', 'support', 'component-index.html')
|
|
67
|
+
: undefined,
|
|
68
|
+
devServer: {
|
|
69
|
+
// cypress uses string union type,
|
|
70
|
+
// need to use const to prevent typing to string
|
|
71
|
+
...{
|
|
72
|
+
framework: 'angular',
|
|
73
|
+
bundler: 'webpack',
|
|
74
|
+
},
|
|
75
|
+
options: {
|
|
69
76
|
projectConfig: buildableProjectConfig,
|
|
70
|
-
}
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
71
80
|
}
|
|
72
81
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
73
82
|
function getBuildableTarget(ctContext) {
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const targetConfig = targets === null || targets === void 0 ? void 0 : targets[ctContext.targetName];
|
|
83
|
+
const targets = ctContext.projectGraph.nodes[ctContext.projectName]?.data?.targets;
|
|
84
|
+
const targetConfig = targets?.[ctContext.targetName];
|
|
77
85
|
if (!targetConfig) {
|
|
78
86
|
throw new Error((0, devkit_1.stripIndents) `Unable to find component testing target configuration in project '${ctContext.projectName}'.
|
|
79
87
|
Has targets? ${!!targets}
|
|
@@ -92,7 +100,6 @@ function getBuildableTarget(ctContext) {
|
|
|
92
100
|
return (0, devkit_1.parseTargetString)(cypressCtOptions.devServerTarget, ctContext.projectGraph);
|
|
93
101
|
}
|
|
94
102
|
function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
95
|
-
var _a, _b;
|
|
96
103
|
const options = (0, devkit_1.readTargetOptions)({
|
|
97
104
|
project: buildContext.projectName,
|
|
98
105
|
target: buildContext.targetName,
|
|
@@ -125,7 +132,10 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
125
132
|
buildOptions.index =
|
|
126
133
|
typeof buildOptions.index === 'string'
|
|
127
134
|
? (0, devkit_1.joinPathFragments)(offset, buildOptions.index)
|
|
128
|
-
:
|
|
135
|
+
: {
|
|
136
|
+
...buildOptions.index,
|
|
137
|
+
input: (0, devkit_1.joinPathFragments)(offset, buildOptions.index.input),
|
|
138
|
+
};
|
|
129
139
|
buildOptions.fileReplacements = buildOptions.fileReplacements.map((fr) => {
|
|
130
140
|
fr.replace = (0, devkit_1.joinPathFragments)(offset, fr.replace);
|
|
131
141
|
fr.with = (0, devkit_1.joinPathFragments)(offset, fr.with);
|
|
@@ -141,19 +151,19 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
141
151
|
buildOptions.assets = buildOptions.assets.map((asset) => {
|
|
142
152
|
return typeof asset === 'string'
|
|
143
153
|
? (0, devkit_1.joinPathFragments)(offset, asset)
|
|
144
|
-
:
|
|
154
|
+
: { ...asset, input: (0, devkit_1.joinPathFragments)(offset, asset.input) };
|
|
145
155
|
});
|
|
146
156
|
buildOptions.styles = buildOptions.styles.map((style) => {
|
|
147
157
|
return typeof style === 'string'
|
|
148
158
|
? (0, devkit_1.joinPathFragments)(offset, style)
|
|
149
|
-
:
|
|
159
|
+
: { ...style, input: (0, devkit_1.joinPathFragments)(offset, style.input) };
|
|
150
160
|
});
|
|
151
161
|
buildOptions.scripts = buildOptions.scripts.map((script) => {
|
|
152
162
|
return typeof script === 'string'
|
|
153
163
|
? (0, devkit_1.joinPathFragments)(offset, script)
|
|
154
|
-
:
|
|
164
|
+
: { ...script, input: (0, devkit_1.joinPathFragments)(offset, script.input) };
|
|
155
165
|
});
|
|
156
|
-
if (
|
|
166
|
+
if (buildOptions.stylePreprocessorOptions?.includePaths.length > 0) {
|
|
157
167
|
buildOptions.stylePreprocessorOptions = {
|
|
158
168
|
includePaths: buildOptions.stylePreprocessorOptions.includePaths.map((path) => {
|
|
159
169
|
return (0, devkit_1.joinPathFragments)(offset, path);
|
|
@@ -169,7 +179,7 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
169
179
|
buildOptions.scripts = [];
|
|
170
180
|
buildOptions.stylePreprocessorOptions = { includePaths: [] };
|
|
171
181
|
}
|
|
172
|
-
const config =
|
|
182
|
+
const config = buildContext.projectGraph.nodes[buildContext.projectName]?.data;
|
|
173
183
|
if (!config.sourceRoot) {
|
|
174
184
|
devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to find the 'sourceRoot' in the project configuration.
|
|
175
185
|
Will set 'sourceRoot' to '${config.root}/src'
|
|
@@ -181,13 +191,14 @@ Note: this may fail, setting the correct 'sourceRoot' for ${buildContext.project
|
|
|
181
191
|
sourceRoot: offset
|
|
182
192
|
? (0, devkit_1.joinPathFragments)(offset, config.sourceRoot)
|
|
183
193
|
: config.sourceRoot,
|
|
184
|
-
buildOptions:
|
|
194
|
+
buildOptions: {
|
|
195
|
+
...buildOptions,
|
|
185
196
|
// this property is only valid for cy v12.9.0+
|
|
186
|
-
workspaceRoot: offset ? undefined : ctContext.root
|
|
197
|
+
workspaceRoot: offset ? undefined : ctContext.root,
|
|
198
|
+
},
|
|
187
199
|
};
|
|
188
200
|
}
|
|
189
201
|
function withSchemaDefaults(options) {
|
|
190
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
191
202
|
if (!options.main) {
|
|
192
203
|
throw new Error('Missing executor options "main"');
|
|
193
204
|
}
|
|
@@ -201,19 +212,19 @@ function withSchemaDefaults(options) {
|
|
|
201
212
|
// otherwise the 'buildOptimizer' cannot be used without 'aot' error is thrown
|
|
202
213
|
options.buildOptimizer = false;
|
|
203
214
|
options.aot = false;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
options.assets ??= [];
|
|
216
|
+
options.allowedCommonJsDependencies ??= [];
|
|
217
|
+
options.budgets ??= [];
|
|
218
|
+
options.commonChunk ??= true;
|
|
219
|
+
options.crossOrigin ??= 'none';
|
|
220
|
+
options.deleteOutputPath ??= true;
|
|
221
|
+
options.extractLicenses ??= true;
|
|
222
|
+
options.fileReplacements ??= [];
|
|
223
|
+
options.inlineStyleLanguage ??= 'css';
|
|
224
|
+
options.i18nDuplicateTranslation ??= 'warning';
|
|
225
|
+
options.outputHashing ??= 'none';
|
|
226
|
+
options.progress ??= true;
|
|
227
|
+
options.scripts ??= [];
|
|
217
228
|
return options;
|
|
218
229
|
}
|
|
219
230
|
/**
|
|
@@ -222,8 +233,7 @@ function withSchemaDefaults(options) {
|
|
|
222
233
|
* this file should get cleaned up via the cypress executor
|
|
223
234
|
*/
|
|
224
235
|
function getTempStylesForTailwind(ctExecutorContext) {
|
|
225
|
-
|
|
226
|
-
const ctProjectConfig = (_a = ctExecutorContext.projectGraph.nodes[ctExecutorContext.projectName]) === null || _a === void 0 ? void 0 : _a.data;
|
|
236
|
+
const ctProjectConfig = ctExecutorContext.projectGraph.nodes[ctExecutorContext.projectName]?.data;
|
|
227
237
|
// angular only supports `tailwind.config.{js,cjs}`
|
|
228
238
|
const ctProjectTailwindConfig = (0, path_1.join)(ctExecutorContext.root, ctProjectConfig.root, 'tailwind.config');
|
|
229
239
|
const exts = ['js', 'cjs'];
|
|
@@ -250,8 +260,7 @@ function getTempStylesForTailwind(ctExecutorContext) {
|
|
|
250
260
|
}
|
|
251
261
|
function isOffsetNeeded(ctExecutorContext, ctProjectConfig) {
|
|
252
262
|
try {
|
|
253
|
-
const
|
|
254
|
-
const supportsWorkspaceRoot = !!version && (0, semver_1.gte)(version, '12.9.0');
|
|
263
|
+
const supportsWorkspaceRoot = isCyVersionGreaterThanOrEqual('12.9.0');
|
|
255
264
|
// if using cypress <v12.9.0 then we require the offset
|
|
256
265
|
if (!supportsWorkspaceRoot) {
|
|
257
266
|
return true;
|
|
@@ -274,3 +283,32 @@ function isOffsetNeeded(ctExecutorContext, ctProjectConfig) {
|
|
|
274
283
|
return true;
|
|
275
284
|
}
|
|
276
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* check if the cypress version is able to understand absolute paths to the indexHtmlFile option
|
|
288
|
+
* this is required for nx to work with cypress <v12.17.0 since the relative pathing is causes issues
|
|
289
|
+
* with invalid pathing.
|
|
290
|
+
* v12.17.0+ works with relative pathing
|
|
291
|
+
*
|
|
292
|
+
* if there is an error thrown then we assume it is an older version of cypress and use the absolute path
|
|
293
|
+
* as that was supported for longer.
|
|
294
|
+
*
|
|
295
|
+
* */
|
|
296
|
+
function requiresAbsolutePath() {
|
|
297
|
+
try {
|
|
298
|
+
return !isCyVersionGreaterThanOrEqual('12.17.0');
|
|
299
|
+
}
|
|
300
|
+
catch (e) {
|
|
301
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
302
|
+
devkit_1.logger.error(e);
|
|
303
|
+
}
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Checks if the install cypress version is greater than or equal to the provided version.
|
|
309
|
+
* Does not catch errors as any custom logic for error handling is required on consumer side.
|
|
310
|
+
* */
|
|
311
|
+
function isCyVersionGreaterThanOrEqual(version) {
|
|
312
|
+
const { version: cyVersion = null } = require('cypress/package.json');
|
|
313
|
+
return !!cyVersion && (0, semver_1.gte)(cyVersion, version);
|
|
314
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeModuleFederationDevServerBuilder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
7
6
|
const webpack_dev_server_impl_1 = require("../webpack-dev-server/webpack-dev-server.impl");
|
|
@@ -12,8 +11,7 @@ const fs_1 = require("fs");
|
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const find_matching_projects_1 = require("nx/src/utils/find-matching-projects");
|
|
14
13
|
function executeModuleFederationDevServerBuilder(schema, context) {
|
|
15
|
-
|
|
16
|
-
const options = tslib_1.__rest(schema, []);
|
|
14
|
+
const { ...options } = schema;
|
|
17
15
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
18
16
|
const { projects: workspaceProjects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
19
17
|
const project = workspaceProjects[context.target.project];
|
|
@@ -29,7 +27,7 @@ function executeModuleFederationDevServerBuilder(schema, context) {
|
|
|
29
27
|
pathToManifestFile = userPathToManifestFile;
|
|
30
28
|
}
|
|
31
29
|
(0, module_federation_1.validateDevRemotes)(options, workspaceProjects);
|
|
32
|
-
const remotesToSkip = new Set((
|
|
30
|
+
const remotesToSkip = new Set((0, find_matching_projects_1.findMatchingProjects)(options.skipRemotes, projectGraph.nodes) ?? []);
|
|
33
31
|
if (remotesToSkip.size > 0) {
|
|
34
32
|
devkit_1.logger.info(`Remotes not served automatically: ${[...remotesToSkip].join(', ')}`);
|
|
35
33
|
}
|
|
@@ -44,10 +42,10 @@ function executeModuleFederationDevServerBuilder(schema, context) {
|
|
|
44
42
|
for (const remote of remotes) {
|
|
45
43
|
const isDev = devServeRemotes.includes(remote);
|
|
46
44
|
const target = isDev ? 'serve' : 'serve-static';
|
|
47
|
-
if (!
|
|
45
|
+
if (!workspaceProjects[remote].targets?.[target]) {
|
|
48
46
|
throw new Error(`Could not find "${target}" target in "${remote}" project.`);
|
|
49
47
|
}
|
|
50
|
-
else if (!
|
|
48
|
+
else if (!workspaceProjects[remote].targets?.[target].executor) {
|
|
51
49
|
throw new Error(`Could not find executor for "${target}" target in "${remote}" project.`);
|
|
52
50
|
}
|
|
53
51
|
const runOptions = {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeModuleFederationDevSSRBuilder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
6
5
|
const executor_utils_1 = require("nx/src/command-line/run/executor-utils");
|
|
7
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -13,8 +12,7 @@ const child_process_1 = require("child_process");
|
|
|
13
12
|
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
14
13
|
const fs_1 = require("fs");
|
|
15
14
|
function executeModuleFederationDevSSRBuilder(schema, context) {
|
|
16
|
-
|
|
17
|
-
const options = tslib_1.__rest(schema, []);
|
|
15
|
+
const { ...options } = schema;
|
|
18
16
|
const projectGraph = (0, devkit_1.readCachedProjectGraph)();
|
|
19
17
|
const { projects: workspaceProjects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
20
18
|
const project = workspaceProjects[context.target.project];
|
|
@@ -30,7 +28,7 @@ function executeModuleFederationDevSSRBuilder(schema, context) {
|
|
|
30
28
|
pathToManifestFile = userPathToManifestFile;
|
|
31
29
|
}
|
|
32
30
|
(0, module_federation_1.validateDevRemotes)(options, workspaceProjects);
|
|
33
|
-
const remotesToSkip = new Set(
|
|
31
|
+
const remotesToSkip = new Set(options.skipRemotes ?? []);
|
|
34
32
|
const staticRemotes = (0, module_federation_1.getStaticRemotes)(project, context, workspaceProjects, remotesToSkip);
|
|
35
33
|
const dynamicRemotes = (0, module_federation_1.getDynamicRemotes)(project, context, workspaceProjects, remotesToSkip, pathToManifestFile);
|
|
36
34
|
const remotes = [...staticRemotes, ...dynamicRemotes];
|
|
@@ -43,10 +41,10 @@ function executeModuleFederationDevSSRBuilder(schema, context) {
|
|
|
43
41
|
for (const remote of remotes) {
|
|
44
42
|
const isDev = devServeRemotes.includes(remote);
|
|
45
43
|
const target = isDev ? 'serve-ssr' : 'static-server';
|
|
46
|
-
if (!
|
|
44
|
+
if (!workspaceProjects[remote].targets?.[target]) {
|
|
47
45
|
throw new Error(`Could not find "${target}" target in "${remote}" project.`);
|
|
48
46
|
}
|
|
49
|
-
else if (!
|
|
47
|
+
else if (!workspaceProjects[remote].targets?.[target].executor) {
|
|
50
48
|
throw new Error(`Could not find executor for "${target}" target in "${remote}" project.`);
|
|
51
49
|
}
|
|
52
50
|
const runOptions = {};
|
|
@@ -5,9 +5,8 @@ const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
function createTmpTsConfigForBuildableLibs(tsConfigPath, context, options) {
|
|
8
|
-
var _a, _b;
|
|
9
8
|
let dependencies;
|
|
10
|
-
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(
|
|
9
|
+
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)(options?.projectGraph ?? (0, devkit_1.readCachedProjectGraph)(), context.workspaceRoot, context.target.project, options?.target ?? context.target.target, context.target.configuration);
|
|
11
10
|
dependencies = result.dependencies;
|
|
12
11
|
const tmpTsConfigPath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(context.workspaceRoot, tsConfigPath), context.workspaceRoot, result.target.data.root, dependencies);
|
|
13
12
|
process.env.NX_TSCONFIG_PATH = tmpTsConfigPath;
|
|
@@ -56,7 +56,7 @@ function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot) {
|
|
|
56
56
|
mfConfigPath: moduleFederationConfigPath,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
catch
|
|
59
|
+
catch {
|
|
60
60
|
throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/angular:host"?`);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -83,8 +83,7 @@ function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
|
|
|
83
83
|
}
|
|
84
84
|
exports.getStaticRemotes = getStaticRemotes;
|
|
85
85
|
function validateDevRemotes(options, workspaceProjects) {
|
|
86
|
-
|
|
87
|
-
const invalidDevRemotes = (_a = options.devRemotes) === null || _a === void 0 ? void 0 : _a.filter((remote) => !workspaceProjects[remote]);
|
|
86
|
+
const invalidDevRemotes = options.devRemotes?.filter((remote) => !workspaceProjects[remote]);
|
|
88
87
|
if (invalidDevRemotes.length) {
|
|
89
88
|
throw new Error(invalidDevRemotes.length === 1
|
|
90
89
|
? `Invalid dev remote provided: ${invalidDevRemotes[0]}.`
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveIndexHtmlTransformer = exports.resolveCustomWebpackConfig = exports.mergeCustomWebpackConfig = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const webpack_merge_1 = require("webpack-merge");
|
|
6
5
|
const tsnode_register_1 = require("@nx/js/src/utils/typescript/tsnode-register");
|
|
7
|
-
function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
});
|
|
6
|
+
async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
|
|
7
|
+
const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig, options.tsConfig);
|
|
8
|
+
// The extra Webpack configuration file can also export a Promise, for instance:
|
|
9
|
+
// `module.exports = new Promise(...)`. If it exports a single object, but not a Promise,
|
|
10
|
+
// then await will just resolve that object.
|
|
11
|
+
const config = await customWebpackConfiguration;
|
|
12
|
+
// The extra Webpack configuration file can export a synchronous or asynchronous function,
|
|
13
|
+
// for instance: `module.exports = async config => { ... }`.
|
|
14
|
+
if (typeof config === 'function') {
|
|
15
|
+
return config(baseWebpackConfig, options, target);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (0, webpack_merge_1.merge)(baseWebpackConfig, config);
|
|
19
|
+
}
|
|
23
20
|
}
|
|
24
21
|
exports.mergeCustomWebpackConfig = mergeCustomWebpackConfig;
|
|
25
22
|
function resolveCustomWebpackConfig(path, tsConfig) {
|
|
26
|
-
var _a;
|
|
27
23
|
(0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
|
|
28
24
|
const customWebpackConfig = require(path);
|
|
29
25
|
// If the user provides a configuration in TS file
|
|
@@ -31,14 +27,13 @@ function resolveCustomWebpackConfig(path, tsConfig) {
|
|
|
31
27
|
// `module.exports = { ... }`. And the second one is:
|
|
32
28
|
// `export default { ... }`. The ESM format is compiled into:
|
|
33
29
|
// `{ default: { ... } }`
|
|
34
|
-
return
|
|
30
|
+
return customWebpackConfig.default ?? customWebpackConfig;
|
|
35
31
|
}
|
|
36
32
|
exports.resolveCustomWebpackConfig = resolveCustomWebpackConfig;
|
|
37
33
|
function resolveIndexHtmlTransformer(path, tsConfig, target) {
|
|
38
|
-
var _a;
|
|
39
34
|
(0, tsnode_register_1.tsNodeRegister)(path, tsConfig);
|
|
40
35
|
const indexTransformer = require(path);
|
|
41
|
-
const transform =
|
|
36
|
+
const transform = indexTransformer.default ?? indexTransformer;
|
|
42
37
|
return (indexHtml) => transform(target, indexHtml);
|
|
43
38
|
}
|
|
44
39
|
exports.resolveIndexHtmlTransformer = resolveIndexHtmlTransformer;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeWebpackBrowserBuilder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const webpack_nx_build_coordination_plugin_1 = require("@nx/webpack/src/plugins/webpack-nx-build-coordination-plugin");
|
|
7
6
|
const fs_1 = require("fs");
|
|
@@ -14,9 +13,8 @@ const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
|
14
13
|
const webpack_1 = require("../utilities/webpack");
|
|
15
14
|
const validate_options_1 = require("./validate-options");
|
|
16
15
|
function shouldSkipInitialTargetRun(projectGraph, project, target) {
|
|
17
|
-
var _a;
|
|
18
16
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
19
|
-
const defaultDependencyConfigs = Object.entries(
|
|
17
|
+
const defaultDependencyConfigs = Object.entries(nxJson.targetDefaults ?? {}).reduce((acc, [targetName, dependencyConfig]) => {
|
|
20
18
|
acc[targetName] = dependencyConfig.dependsOn;
|
|
21
19
|
return acc;
|
|
22
20
|
}, {});
|
|
@@ -25,11 +23,10 @@ function shouldSkipInitialTargetRun(projectGraph, project, target) {
|
|
|
25
23
|
return projectDependencyConfigs.some((d) => d.target === target && d.projects === 'dependencies');
|
|
26
24
|
}
|
|
27
25
|
function executeWebpackBrowserBuilder(options, context) {
|
|
28
|
-
var _a;
|
|
29
26
|
(0, validate_options_1.validateOptions)(options);
|
|
30
|
-
|
|
31
|
-
const { buildLibsFromSource, customWebpackConfig, indexFileTransformer
|
|
32
|
-
const pathToWebpackConfig =
|
|
27
|
+
options.buildLibsFromSource ??= true;
|
|
28
|
+
const { buildLibsFromSource, customWebpackConfig, indexFileTransformer, ...delegateBuilderOptions } = options;
|
|
29
|
+
const pathToWebpackConfig = customWebpackConfig?.path &&
|
|
33
30
|
(0, devkit_1.joinPathFragments)(context.workspaceRoot, customWebpackConfig.path);
|
|
34
31
|
if (pathToWebpackConfig && !(0, fs_1.existsSync)(pathToWebpackConfig)) {
|
|
35
32
|
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}`);
|
|
@@ -47,7 +44,8 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
47
44
|
dependencies = foundDependencies;
|
|
48
45
|
delegateBuilderOptions.tsConfig = tsConfigPath;
|
|
49
46
|
}
|
|
50
|
-
return (0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))).pipe((0, operators_2.switchMap)(({ executeBrowserBuilder }) => executeBrowserBuilder(delegateBuilderOptions, context,
|
|
47
|
+
return (0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))).pipe((0, operators_2.switchMap)(({ executeBrowserBuilder }) => executeBrowserBuilder(delegateBuilderOptions, context, {
|
|
48
|
+
webpackConfiguration: (baseWebpackConfig) => {
|
|
51
49
|
if (!buildLibsFromSource && delegateBuilderOptions.watch) {
|
|
52
50
|
const workspaceDependencies = dependencies
|
|
53
51
|
.filter((dep) => !(0, operators_1.isNpmProject)(dep.node))
|
|
@@ -67,11 +65,13 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
67
65
|
return baseWebpackConfig;
|
|
68
66
|
}
|
|
69
67
|
return (0, webpack_1.mergeCustomWebpackConfig)(baseWebpackConfig, pathToWebpackConfig, delegateBuilderOptions, context.target);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
},
|
|
69
|
+
...(pathToIndexFileTransformer
|
|
70
|
+
? {
|
|
71
|
+
indexHtml: (0, webpack_1.resolveIndexHtmlTransformer)(pathToIndexFileTransformer, delegateBuilderOptions.tsConfig, context.target),
|
|
72
|
+
}
|
|
73
|
+
: {}),
|
|
74
|
+
})));
|
|
75
75
|
}
|
|
76
76
|
exports.executeWebpackBrowserBuilder = executeWebpackBrowserBuilder;
|
|
77
77
|
exports.default = require('@angular-devkit/architect').createBuilder(executeWebpackBrowserBuilder);
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
function normalizeOptions(schema) {
|
|
5
|
-
return
|
|
5
|
+
return {
|
|
6
|
+
host: 'localhost',
|
|
7
|
+
port: 4200,
|
|
8
|
+
liveReload: true,
|
|
9
|
+
open: false,
|
|
10
|
+
ssl: false,
|
|
11
|
+
...schema,
|
|
12
|
+
};
|
|
6
13
|
}
|
|
7
14
|
exports.normalizeOptions = normalizeOptions;
|