@nx/angular 16.8.0-beta.4 → 16.8.0-beta.6
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/package.json +10 -10
- package/plugins/component-testing.d.ts +0 -1
- package/plugins/component-testing.js +48 -40
- 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 -74
- 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/host.js +77 -67
- package/src/generators/host/lib/add-ssr.js +32 -35
- 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/lib/add-ssr.js +46 -47
- 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 +11 -4
- 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 -139
- 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/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/version-utils.js +2 -4
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/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.6",
|
|
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.6",
|
|
70
|
+
"@nx/cypress": "16.8.0-beta.6",
|
|
71
|
+
"@nx/devkit": "16.8.0-beta.6",
|
|
72
|
+
"@nx/jest": "16.8.0-beta.6",
|
|
73
|
+
"@nx/js": "16.8.0-beta.6",
|
|
74
|
+
"@nx/linter": "16.8.0-beta.6",
|
|
75
|
+
"@nx/webpack": "16.8.0-beta.6",
|
|
76
|
+
"@nx/workspace": "16.8.0-beta.6",
|
|
77
77
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
78
78
|
"@typescript-eslint/type-utils": "^5.36.1",
|
|
79
79
|
"chalk": "^4.1.0",
|
|
@@ -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": "0cc6ba996f2ef09f00b932c8eacf42de642457f3"
|
|
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,27 +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'],
|
|
62
|
+
specPattern: ['src/**/*.cy.ts', 'src/**/*.cy.js'],
|
|
63
63
|
// Cy v12.17.0+ does not work with aboslute paths for index file
|
|
64
64
|
// but does with relative pathing, since relative path is the default location, we can omit it
|
|
65
65
|
indexHtmlFile: requiresAbsolutePath()
|
|
66
66
|
? (0, devkit_1.joinPathFragments)(ctContext.root, ctProjectConfig.root, 'cypress', 'support', 'component-index.html')
|
|
67
|
-
: undefined,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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: {
|
|
71
76
|
projectConfig: buildableProjectConfig,
|
|
72
|
-
}
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
73
80
|
}
|
|
74
81
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
75
82
|
function getBuildableTarget(ctContext) {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
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];
|
|
79
85
|
if (!targetConfig) {
|
|
80
86
|
throw new Error((0, devkit_1.stripIndents) `Unable to find component testing target configuration in project '${ctContext.projectName}'.
|
|
81
87
|
Has targets? ${!!targets}
|
|
@@ -94,7 +100,6 @@ function getBuildableTarget(ctContext) {
|
|
|
94
100
|
return (0, devkit_1.parseTargetString)(cypressCtOptions.devServerTarget, ctContext.projectGraph);
|
|
95
101
|
}
|
|
96
102
|
function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
97
|
-
var _a, _b;
|
|
98
103
|
const options = (0, devkit_1.readTargetOptions)({
|
|
99
104
|
project: buildContext.projectName,
|
|
100
105
|
target: buildContext.targetName,
|
|
@@ -127,7 +132,10 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
127
132
|
buildOptions.index =
|
|
128
133
|
typeof buildOptions.index === 'string'
|
|
129
134
|
? (0, devkit_1.joinPathFragments)(offset, buildOptions.index)
|
|
130
|
-
:
|
|
135
|
+
: {
|
|
136
|
+
...buildOptions.index,
|
|
137
|
+
input: (0, devkit_1.joinPathFragments)(offset, buildOptions.index.input),
|
|
138
|
+
};
|
|
131
139
|
buildOptions.fileReplacements = buildOptions.fileReplacements.map((fr) => {
|
|
132
140
|
fr.replace = (0, devkit_1.joinPathFragments)(offset, fr.replace);
|
|
133
141
|
fr.with = (0, devkit_1.joinPathFragments)(offset, fr.with);
|
|
@@ -143,19 +151,19 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
143
151
|
buildOptions.assets = buildOptions.assets.map((asset) => {
|
|
144
152
|
return typeof asset === 'string'
|
|
145
153
|
? (0, devkit_1.joinPathFragments)(offset, asset)
|
|
146
|
-
:
|
|
154
|
+
: { ...asset, input: (0, devkit_1.joinPathFragments)(offset, asset.input) };
|
|
147
155
|
});
|
|
148
156
|
buildOptions.styles = buildOptions.styles.map((style) => {
|
|
149
157
|
return typeof style === 'string'
|
|
150
158
|
? (0, devkit_1.joinPathFragments)(offset, style)
|
|
151
|
-
:
|
|
159
|
+
: { ...style, input: (0, devkit_1.joinPathFragments)(offset, style.input) };
|
|
152
160
|
});
|
|
153
161
|
buildOptions.scripts = buildOptions.scripts.map((script) => {
|
|
154
162
|
return typeof script === 'string'
|
|
155
163
|
? (0, devkit_1.joinPathFragments)(offset, script)
|
|
156
|
-
:
|
|
164
|
+
: { ...script, input: (0, devkit_1.joinPathFragments)(offset, script.input) };
|
|
157
165
|
});
|
|
158
|
-
if (
|
|
166
|
+
if (buildOptions.stylePreprocessorOptions?.includePaths.length > 0) {
|
|
159
167
|
buildOptions.stylePreprocessorOptions = {
|
|
160
168
|
includePaths: buildOptions.stylePreprocessorOptions.includePaths.map((path) => {
|
|
161
169
|
return (0, devkit_1.joinPathFragments)(offset, path);
|
|
@@ -171,7 +179,7 @@ function normalizeBuildTargetOptions(buildContext, ctContext, offset) {
|
|
|
171
179
|
buildOptions.scripts = [];
|
|
172
180
|
buildOptions.stylePreprocessorOptions = { includePaths: [] };
|
|
173
181
|
}
|
|
174
|
-
const config =
|
|
182
|
+
const config = buildContext.projectGraph.nodes[buildContext.projectName]?.data;
|
|
175
183
|
if (!config.sourceRoot) {
|
|
176
184
|
devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to find the 'sourceRoot' in the project configuration.
|
|
177
185
|
Will set 'sourceRoot' to '${config.root}/src'
|
|
@@ -183,13 +191,14 @@ Note: this may fail, setting the correct 'sourceRoot' for ${buildContext.project
|
|
|
183
191
|
sourceRoot: offset
|
|
184
192
|
? (0, devkit_1.joinPathFragments)(offset, config.sourceRoot)
|
|
185
193
|
: config.sourceRoot,
|
|
186
|
-
buildOptions:
|
|
194
|
+
buildOptions: {
|
|
195
|
+
...buildOptions,
|
|
187
196
|
// this property is only valid for cy v12.9.0+
|
|
188
|
-
workspaceRoot: offset ? undefined : ctContext.root
|
|
197
|
+
workspaceRoot: offset ? undefined : ctContext.root,
|
|
198
|
+
},
|
|
189
199
|
};
|
|
190
200
|
}
|
|
191
201
|
function withSchemaDefaults(options) {
|
|
192
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
193
202
|
if (!options.main) {
|
|
194
203
|
throw new Error('Missing executor options "main"');
|
|
195
204
|
}
|
|
@@ -203,19 +212,19 @@ function withSchemaDefaults(options) {
|
|
|
203
212
|
// otherwise the 'buildOptimizer' cannot be used without 'aot' error is thrown
|
|
204
213
|
options.buildOptimizer = false;
|
|
205
214
|
options.aot = false;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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 ??= [];
|
|
219
228
|
return options;
|
|
220
229
|
}
|
|
221
230
|
/**
|
|
@@ -224,8 +233,7 @@ function withSchemaDefaults(options) {
|
|
|
224
233
|
* this file should get cleaned up via the cypress executor
|
|
225
234
|
*/
|
|
226
235
|
function getTempStylesForTailwind(ctExecutorContext) {
|
|
227
|
-
|
|
228
|
-
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;
|
|
229
237
|
// angular only supports `tailwind.config.{js,cjs}`
|
|
230
238
|
const ctProjectTailwindConfig = (0, path_1.join)(ctExecutorContext.root, ctProjectConfig.root, 'tailwind.config');
|
|
231
239
|
const exts = ['js', 'cjs'];
|
|
@@ -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;
|