@nrwl/angular 13.9.4 → 13.10.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/mfe/index.mjs +2 -0
- package/esm2020/mfe/mfe.mjs +45 -0
- package/esm2020/mfe/nrwl-angular-mfe.mjs +5 -0
- package/esm2020/src/runtime/nx/data-persistence.mjs +3 -3
- package/esm2020/src/runtime/nx/nx.module.mjs +4 -4
- package/executors.js +3 -3
- package/executors.js.map +1 -1
- package/executors.json +4 -4
- package/fesm2015/nrwl-angular-mfe.mjs +57 -0
- package/fesm2015/nrwl-angular-mfe.mjs.map +1 -0
- package/fesm2015/nrwl-angular.mjs +7 -7
- package/fesm2020/nrwl-angular-mfe.mjs +51 -0
- package/fesm2020/nrwl-angular-mfe.mjs.map +1 -0
- package/fesm2020/nrwl-angular.mjs +7 -7
- package/generators.js +26 -26
- package/generators.js.map +1 -1
- package/generators.json +32 -2
- package/mfe/index.d.ts +1 -0
- package/mfe/index.js +7 -0
- package/mfe/index.js.map +1 -0
- package/mfe/mfe.d.ts +4 -0
- package/mfe/mfe.js +56 -0
- package/mfe/mfe.js.map +1 -0
- package/mfe/ng-package.json +6 -0
- package/mfe/nrwl-angular-mfe.d.ts +5 -0
- package/mfe/package.json +10 -0
- package/migrations.json +89 -0
- package/module-federation/index.d.ts +1 -0
- package/module-federation/index.js +6 -0
- package/module-federation/index.js.map +1 -0
- package/package.json +17 -8
- package/scripts/nx-cli-warning.js +1 -1
- package/src/builders/webpack-browser/schema.json +3 -2
- package/src/builders/webpack-browser/webpack-browser.impl.js +11 -11
- package/src/builders/webpack-browser/webpack-browser.impl.js.map +1 -1
- package/src/builders/webpack-server/lib/index.js +1 -1
- package/src/builders/webpack-server/lib/index.js.map +1 -1
- package/src/builders/webpack-server/schema.json +3 -2
- package/src/builders/webpack-server/webpack-server.impl.js +9 -10
- package/src/builders/webpack-server/webpack-server.impl.js.map +1 -1
- package/src/executors/delegate-build/delegate-build.impl.js +6 -6
- package/src/executors/delegate-build/delegate-build.impl.js.map +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +3 -3
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +2 -2
- package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +1 -1
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +1 -1
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +1 -1
- package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +3 -3
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +2 -2
- package/src/executors/package/package.impl.js +9 -9
- package/src/executors/package/package.impl.js.map +1 -1
- package/src/executors/utilities/tailwindcss.js +3 -3
- package/src/executors/utilities/tailwindcss.js.map +1 -1
- package/src/generators/add-linting/add-linting.js +1 -1
- package/src/generators/application/application.js +1 -1
- package/src/generators/application/lib/add-e2e.js +1 -1
- package/src/generators/application/lib/add-linting.js +1 -1
- package/src/generators/application/lib/add-mfe.js +1 -1
- package/src/generators/application/lib/add-protractor.js +1 -1
- package/src/generators/application/lib/add-unit-test-runner.js +1 -1
- package/src/generators/application/lib/index.js +20 -20
- package/src/generators/application/lib/index.js.map +1 -1
- package/src/generators/application/lib/update-config-files.js +1 -1
- package/src/generators/application/lib/update-config-files.js.map +1 -1
- package/src/generators/component/component.compat.d.ts +2 -0
- package/src/generators/component/component.compat.js +6 -0
- package/src/generators/component/component.compat.js.map +1 -0
- package/src/generators/component/component.d.ts +4 -0
- package/src/generators/component/component.js +78 -0
- package/src/generators/component/component.js.map +1 -0
- package/src/generators/component/schema.d.ts +17 -0
- package/src/generators/component/schema.json +101 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.compat.d.ts +2 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.compat.js +6 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.compat.js.map +1 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.d.ts +3 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js +32 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.js.map +1 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.d.ts +5 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js +449 -0
- package/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/check-name-matches.d.ts +2 -0
- package/src/generators/convert-to-with-mf/lib/check-name-matches.js +24 -0
- package/src/generators/convert-to-with-mf/lib/check-name-matches.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.d.ts +2 -0
- package/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js +49 -0
- package/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.d.ts +2 -0
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +20 -0
- package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/index.d.ts +6 -0
- package/src/generators/convert-to-with-mf/lib/index.js +10 -0
- package/src/generators/convert-to-with-mf/lib/index.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/is-host-remote-config.d.ts +5 -0
- package/src/generators/convert-to-with-mf/lib/is-host-remote-config.js +63 -0
- package/src/generators/convert-to-with-mf/lib/is-host-remote-config.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.d.ts +2 -0
- package/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js +13 -0
- package/src/generators/convert-to-with-mf/lib/parse-ast-webpack-config.js.map +1 -0
- package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.d.ts +3 -0
- package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js +48 -0
- package/src/generators/convert-to-with-mf/lib/write-new-webpack-config.js.map +1 -0
- package/src/generators/convert-to-with-mf/schema.d.ts +3 -0
- package/src/generators/convert-to-with-mf/schema.json +20 -0
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +4 -4
- package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js.map +1 -1
- package/src/generators/downgrade-module/downgrade-module.js +1 -1
- package/src/generators/downgrade-module/lib/index.js +4 -4
- package/src/generators/downgrade-module/lib/index.js.map +1 -1
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +16 -2
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/schema.d.ts +2 -2
- package/src/generators/init/schema.json +5 -0
- package/src/generators/karma-project/karma-project.js +1 -1
- package/src/generators/library/lib/update-project.js +2 -2
- package/src/generators/library/lib/update-project.js.map +1 -1
- package/src/generators/library/library.js +3 -3
- package/src/generators/library-secondary-entry-point/lib/index.js +4 -4
- package/src/generators/library-secondary-entry-point/lib/index.js.map +1 -1
- package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +1 -1
- package/src/generators/mfe-host/mfe-host.js +1 -1
- package/src/generators/mfe-remote/mfe-remote.js +15 -2
- package/src/generators/mfe-remote/mfe-remote.js.map +1 -1
- package/src/generators/move/lib/update-ng-package.js +2 -2
- package/src/generators/move/lib/update-ng-package.js.map +1 -1
- package/src/generators/move/move.js +1 -1
- package/src/generators/ng-add/compat.d.ts +2 -0
- package/src/generators/ng-add/compat.js +6 -0
- package/src/generators/ng-add/compat.js.map +1 -0
- package/src/generators/ng-add/files/decorate-angular-cli/decorate-angular-cli.js__tmpl__ +69 -0
- package/src/generators/ng-add/files/prettier/__dot__prettierignore +1 -0
- package/src/generators/ng-add/files/root/karma.conf.js__tmpl__ +43 -0
- package/src/generators/ng-add/files/root/libs/__dot__gitkeep +0 -0
- package/src/generators/ng-add/files/root/nx.json__tmpl__ +29 -0
- package/src/generators/ng-add/files/root/tools/schematics/__dot__gitkeep +0 -0
- package/src/generators/ng-add/files/root/tools/tsconfig.tools.json__tmpl__ +12 -0
- package/src/generators/ng-add/migrate-from-angular-cli.d.ts +3 -0
- package/src/generators/ng-add/migrate-from-angular-cli.js +627 -0
- package/src/generators/ng-add/migrate-from-angular-cli.js.map +1 -0
- package/src/generators/ng-add/ng-add.d.ts +4 -0
- package/src/generators/ng-add/ng-add.js +20 -0
- package/src/generators/ng-add/ng-add.js.map +1 -0
- package/src/generators/ng-add/schema.d.ts +19 -0
- package/src/generators/ng-add/schema.json +71 -0
- package/src/generators/ngrx/ngrx.js +1 -1
- package/src/generators/scam/lib/create-module.js +1 -1
- package/src/generators/scam/lib/create-module.js.map +1 -1
- package/src/generators/scam/scam.js +4 -4
- package/src/generators/scam/scam.js.map +1 -1
- package/src/generators/scam-directive/lib/create-module.js +1 -1
- package/src/generators/scam-directive/lib/create-module.js.map +1 -1
- package/src/generators/scam-directive/scam-directive.js +4 -4
- package/src/generators/scam-directive/scam-directive.js.map +1 -1
- package/src/generators/scam-pipe/lib/create-module.js +1 -1
- package/src/generators/scam-pipe/lib/create-module.js.map +1 -1
- package/src/generators/scam-pipe/scam-pipe.js +4 -4
- package/src/generators/scam-pipe/scam-pipe.js.map +1 -1
- package/src/generators/setup-mfe/files/webpack/webpack.config.js__tmpl__ +8 -59
- package/src/generators/setup-mfe/lib/add-remote-to-host.d.ts +1 -0
- package/src/generators/setup-mfe/lib/add-remote-to-host.js +15 -6
- package/src/generators/setup-mfe/lib/add-remote-to-host.js.map +1 -1
- package/src/generators/setup-mfe/lib/generate-config.js +1 -12
- package/src/generators/setup-mfe/lib/generate-config.js.map +1 -1
- package/src/generators/setup-mfe/lib/index.js +10 -10
- package/src/generators/setup-mfe/lib/index.js.map +1 -1
- package/src/generators/setup-mfe/setup-mfe.d.ts +2 -2
- package/src/generators/setup-mfe/setup-mfe.js +1 -10
- package/src/generators/setup-mfe/setup-mfe.js.map +1 -1
- package/src/generators/setup-tailwind/lib/index.js +6 -6
- package/src/generators/setup-tailwind/lib/index.js.map +1 -1
- package/src/generators/setup-tailwind/setup-tailwind.js +1 -1
- package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +1 -1
- package/src/generators/storybook-configuration/storybook-configuration.js +1 -1
- package/src/generators/storybook-migrate-stories-to-6-2/migrate-stories-to-6-2.js +1 -1
- package/src/generators/upgrade-module/lib/index.js +4 -4
- package/src/generators/upgrade-module/lib/index.js.map +1 -1
- package/src/generators/upgrade-module/upgrade-module.js +1 -1
- package/src/generators/utils/index.js +1 -1
- package/src/generators/utils/index.js.map +1 -1
- package/src/generators/utils/path.d.ts +1 -0
- package/src/generators/utils/path.js +11 -0
- package/src/generators/utils/path.js.map +1 -0
- package/src/generators/utils/testing.js +1 -1
- package/src/generators/web-worker/lib/index.js +2 -2
- package/src/generators/web-worker/lib/index.js.map +1 -1
- package/src/generators/web-worker/web-worker.js +2 -2
- package/src/generators/web-worker/web-worker.js.map +1 -1
- package/src/migrations/update-10-3-0/update-10-3-0.js +1 -1
- package/src/migrations/update-10-4-0/update-10-4-0.js +1 -1
- package/src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint.js +3 -3
- package/src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint.js.map +1 -1
- package/src/migrations/update-12-3-0/convert-webpack-browser-build-target-to-delegate-build.js +3 -3
- package/src/migrations/update-12-3-0/convert-webpack-browser-build-target-to-delegate-build.js.map +1 -1
- package/src/migrations/update-12-3-0/update-angular-eslint-rules.js +1 -1
- package/src/migrations/update-12-3-0/update-storybook.js +1 -1
- package/src/migrations/update-12-3-0/update-webpack-browser-config.js +1 -1
- package/src/migrations/update-12-9-0/update-invalid-import-paths.js +1 -1
- package/src/migrations/update-13-0-0/add-postcss-packages.js +1 -1
- package/src/migrations/update-13-2-0/opt-out-testbed-teardown.js +1 -1
- package/src/migrations/update-13-2-0/update-angular-config.js +1 -1
- package/src/migrations/update-13-2-0/update-angular-jest-config.js +1 -1
- package/src/migrations/update-13-2-0/update-libraries.js +1 -1
- package/src/migrations/update-13-2-0/update-testing-imports.js +1 -1
- package/src/migrations/update-13-3-0/update-mfe-webpack-config.js +1 -1
- package/src/migrations/update-13-5-0/remove-library-generator-style-default.js +1 -1
- package/src/migrations/update-13-5-0/update-mfe-configs.js +1 -1
- package/src/migrations/update-13-8-1/add-cypress-mfe-workaround.js +1 -1
- package/src/migrations/update-13-8-4/migrate-karma-conf.js +1 -1
- package/src/migrations/update-13-9-0/set-build-libs-from-source.js +1 -1
- package/src/runtime/nx/data-persistence.js +2 -2
- package/src/runtime/nx/data-persistence.js.map +1 -1
- package/src/runtime/nx/nx.module.js +1 -1
- package/src/utils/get-mfe-projects.d.ts +3 -1
- package/src/utils/get-mfe-projects.js +5 -2
- package/src/utils/get-mfe-projects.js.map +1 -1
- package/src/utils/mfe/mfe-webpack.d.ts +17 -0
- package/src/utils/{mfe-webpack.js → mfe/mfe-webpack.js} +8 -8
- package/src/utils/mfe/mfe-webpack.js.map +1 -0
- package/src/utils/mfe/with-module-federation.d.ts +9 -0
- package/src/utils/mfe/with-module-federation.js +153 -0
- package/src/utils/mfe/with-module-federation.js.map +1 -0
- package/src/utils/versions.d.ts +3 -4
- package/src/utils/versions.js +5 -6
- package/src/utils/versions.js.map +1 -1
- package/src/utils/mfe-webpack.d.ts +0 -7
- package/src/utils/mfe-webpack.js.map +0 -1
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERROR_SHARED_PACKAGES_DOESNT_MATCH = exports.ERROR_NAME_DOESNT_MATCH = exports.OLD_OBJECT_SHARED_SYNTAX = exports.STANDARD_REMOTE_MFE_CONFIG = exports.STANDARD_HOST_MFE_CONFIG = void 0;
|
|
4
|
+
exports.STANDARD_HOST_MFE_CONFIG = `const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
5
|
+
const mf = require('@angular-architects/module-federation/webpack');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const share = mf.share;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* We use the NX_TSCONFIG_PATH environment variable when using the @nrwl/angular:webpack-browser
|
|
11
|
+
* builder as it will generate a temporary tsconfig file which contains any required remappings of
|
|
12
|
+
* shared libraries.
|
|
13
|
+
* A remapping will occur when a library is buildable, as webpack needs to know the location of the
|
|
14
|
+
* built files for the buildable library.
|
|
15
|
+
* This NX_TSCONFIG_PATH environment variable is set by the @nrwl/angular:webpack-browser and it contains
|
|
16
|
+
* the location of the generated temporary tsconfig file.
|
|
17
|
+
*/
|
|
18
|
+
const tsConfigPath =
|
|
19
|
+
process.env.NX_TSCONFIG_PATH ??
|
|
20
|
+
path.join(__dirname, '../../tsconfig.base.json');
|
|
21
|
+
|
|
22
|
+
const workspaceRootPath = path.join(__dirname, '../../');
|
|
23
|
+
const sharedMappings = new mf.SharedMappings();
|
|
24
|
+
sharedMappings.register(
|
|
25
|
+
tsConfigPath,
|
|
26
|
+
[
|
|
27
|
+
/* mapped paths to share */
|
|
28
|
+
],
|
|
29
|
+
workspaceRootPath
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
output: {
|
|
34
|
+
uniqueName: 'host1',
|
|
35
|
+
publicPath: 'auto',
|
|
36
|
+
},
|
|
37
|
+
optimization: {
|
|
38
|
+
runtimeChunk: false,
|
|
39
|
+
},
|
|
40
|
+
experiments: {
|
|
41
|
+
outputModule: true,
|
|
42
|
+
},
|
|
43
|
+
resolve: {
|
|
44
|
+
alias: {
|
|
45
|
+
...sharedMappings.getAliases(),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
plugins: [
|
|
49
|
+
new ModuleFederationPlugin({
|
|
50
|
+
remotes: {
|
|
51
|
+
remote1: 'http://localhost:4201/remoteEntry.mjs',
|
|
52
|
+
},
|
|
53
|
+
shared: share({
|
|
54
|
+
'@angular/core': {
|
|
55
|
+
singleton: true,
|
|
56
|
+
strictVersion: true,
|
|
57
|
+
requiredVersion: 'auto',
|
|
58
|
+
includeSecondaries: true,
|
|
59
|
+
},
|
|
60
|
+
'@angular/common': {
|
|
61
|
+
singleton: true,
|
|
62
|
+
strictVersion: true,
|
|
63
|
+
requiredVersion: 'auto',
|
|
64
|
+
includeSecondaries: true,
|
|
65
|
+
},
|
|
66
|
+
'@angular/common/http': {
|
|
67
|
+
singleton: true,
|
|
68
|
+
strictVersion: true,
|
|
69
|
+
requiredVersion: 'auto',
|
|
70
|
+
includeSecondaries: true,
|
|
71
|
+
},
|
|
72
|
+
'@angular/router': {
|
|
73
|
+
singleton: true,
|
|
74
|
+
strictVersion: true,
|
|
75
|
+
requiredVersion: 'auto',
|
|
76
|
+
includeSecondaries: true,
|
|
77
|
+
},
|
|
78
|
+
rxjs: {
|
|
79
|
+
singleton: true,
|
|
80
|
+
strictVersion: true,
|
|
81
|
+
requiredVersion: 'auto',
|
|
82
|
+
includeSecondaries: true,
|
|
83
|
+
},
|
|
84
|
+
...sharedMappings.getDescriptors(),
|
|
85
|
+
}),
|
|
86
|
+
library: {
|
|
87
|
+
type: 'module',
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
sharedMappings.getPlugin(),
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
`;
|
|
94
|
+
exports.STANDARD_REMOTE_MFE_CONFIG = `const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
95
|
+
const mf = require('@angular-architects/module-federation/webpack');
|
|
96
|
+
const path = require('path');
|
|
97
|
+
const share = mf.share;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* We use the NX_TSCONFIG_PATH environment variable when using the @nrwl/angular:webpack-browser
|
|
101
|
+
* builder as it will generate a temporary tsconfig file which contains any required remappings of
|
|
102
|
+
* shared libraries.
|
|
103
|
+
* A remapping will occur when a library is buildable, as webpack needs to know the location of the
|
|
104
|
+
* built files for the buildable library.
|
|
105
|
+
* This NX_TSCONFIG_PATH environment variable is set by the @nrwl/angular:webpack-browser and it contains
|
|
106
|
+
* the location of the generated temporary tsconfig file.
|
|
107
|
+
*/
|
|
108
|
+
const tsConfigPath =
|
|
109
|
+
process.env.NX_TSCONFIG_PATH ??
|
|
110
|
+
path.join(__dirname, '../../tsconfig.base.json');
|
|
111
|
+
|
|
112
|
+
const workspaceRootPath = path.join(__dirname, '../../');
|
|
113
|
+
const sharedMappings = new mf.SharedMappings();
|
|
114
|
+
sharedMappings.register(
|
|
115
|
+
tsConfigPath,
|
|
116
|
+
[
|
|
117
|
+
/* mapped paths to share */
|
|
118
|
+
],
|
|
119
|
+
workspaceRootPath
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
module.exports = {
|
|
123
|
+
output: {
|
|
124
|
+
uniqueName: 'remote1',
|
|
125
|
+
publicPath: 'auto',
|
|
126
|
+
},
|
|
127
|
+
optimization: {
|
|
128
|
+
runtimeChunk: false,
|
|
129
|
+
},
|
|
130
|
+
experiments: {
|
|
131
|
+
outputModule: true,
|
|
132
|
+
},
|
|
133
|
+
resolve: {
|
|
134
|
+
alias: {
|
|
135
|
+
...sharedMappings.getAliases(),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
plugins: [
|
|
139
|
+
new ModuleFederationPlugin({
|
|
140
|
+
name: 'remote1',
|
|
141
|
+
filename: 'remoteEntry.js',
|
|
142
|
+
exposes: {
|
|
143
|
+
'./Module': 'apps/remote1/src/app/remote-entry/entry.module.ts',
|
|
144
|
+
},
|
|
145
|
+
shared: share({
|
|
146
|
+
'@angular/core': {
|
|
147
|
+
singleton: true,
|
|
148
|
+
strictVersion: true,
|
|
149
|
+
requiredVersion: 'auto',
|
|
150
|
+
includeSecondaries: true,
|
|
151
|
+
},
|
|
152
|
+
'@angular/common': {
|
|
153
|
+
singleton: true,
|
|
154
|
+
strictVersion: true,
|
|
155
|
+
requiredVersion: 'auto',
|
|
156
|
+
includeSecondaries: true,
|
|
157
|
+
},
|
|
158
|
+
'@angular/common/http': {
|
|
159
|
+
singleton: true,
|
|
160
|
+
strictVersion: true,
|
|
161
|
+
requiredVersion: 'auto',
|
|
162
|
+
includeSecondaries: true,
|
|
163
|
+
},
|
|
164
|
+
'@angular/router': {
|
|
165
|
+
singleton: true,
|
|
166
|
+
strictVersion: true,
|
|
167
|
+
requiredVersion: 'auto',
|
|
168
|
+
includeSecondaries: true,
|
|
169
|
+
},
|
|
170
|
+
rxjs: {
|
|
171
|
+
singleton: true,
|
|
172
|
+
strictVersion: true,
|
|
173
|
+
requiredVersion: 'auto',
|
|
174
|
+
includeSecondaries: true,
|
|
175
|
+
},
|
|
176
|
+
...sharedMappings.getDescriptors(),
|
|
177
|
+
}),
|
|
178
|
+
library: {
|
|
179
|
+
type: 'module',
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
sharedMappings.getPlugin(),
|
|
183
|
+
],
|
|
184
|
+
};
|
|
185
|
+
`;
|
|
186
|
+
exports.OLD_OBJECT_SHARED_SYNTAX = `const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
187
|
+
const mf = require('@angular-architects/module-federation/webpack');
|
|
188
|
+
const path = require('path');
|
|
189
|
+
const share = mf.share;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* We use the NX_TSCONFIG_PATH environment variable when using the @nrwl/angular:webpack-browser
|
|
193
|
+
* builder as it will generate a temporary tsconfig file which contains any required remappings of
|
|
194
|
+
* shared libraries.
|
|
195
|
+
* A remapping will occur when a library is buildable, as webpack needs to know the location of the
|
|
196
|
+
* built files for the buildable library.
|
|
197
|
+
* This NX_TSCONFIG_PATH environment variable is set by the @nrwl/angular:webpack-browser and it contains
|
|
198
|
+
* the location of the generated temporary tsconfig file.
|
|
199
|
+
*/
|
|
200
|
+
const tsConfigPath =
|
|
201
|
+
process.env.NX_TSCONFIG_PATH ??
|
|
202
|
+
path.join(__dirname, '../../tsconfig.base.json');
|
|
203
|
+
|
|
204
|
+
const workspaceRootPath = path.join(__dirname, '../../');
|
|
205
|
+
const sharedMappings = new mf.SharedMappings();
|
|
206
|
+
sharedMappings.register(
|
|
207
|
+
tsConfigPath,
|
|
208
|
+
[
|
|
209
|
+
/* mapped paths to share */
|
|
210
|
+
],
|
|
211
|
+
workspaceRootPath
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
module.exports = {
|
|
215
|
+
output: {
|
|
216
|
+
uniqueName: 'remote1',
|
|
217
|
+
publicPath: 'auto',
|
|
218
|
+
},
|
|
219
|
+
optimization: {
|
|
220
|
+
runtimeChunk: false,
|
|
221
|
+
},
|
|
222
|
+
experiments: {
|
|
223
|
+
outputModule: true,
|
|
224
|
+
},
|
|
225
|
+
resolve: {
|
|
226
|
+
alias: {
|
|
227
|
+
...sharedMappings.getAliases(),
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
plugins: [
|
|
231
|
+
new ModuleFederationPlugin({
|
|
232
|
+
name: 'remote1',
|
|
233
|
+
filename: 'remoteEntry.js',
|
|
234
|
+
exposes: {
|
|
235
|
+
'./Module': 'apps/remote1/src/app/remote-entry/entry.module.ts',
|
|
236
|
+
},
|
|
237
|
+
shared: {
|
|
238
|
+
'@angular/core': {
|
|
239
|
+
singleton: true,
|
|
240
|
+
strictVersion: true,
|
|
241
|
+
},
|
|
242
|
+
'@angular/common': {
|
|
243
|
+
singleton: true,
|
|
244
|
+
strictVersion: true,
|
|
245
|
+
},
|
|
246
|
+
'@angular/common/http': {
|
|
247
|
+
singleton: true,
|
|
248
|
+
strictVersion: true,
|
|
249
|
+
},
|
|
250
|
+
'@angular/router': {
|
|
251
|
+
singleton: true,
|
|
252
|
+
strictVersion: true,
|
|
253
|
+
},
|
|
254
|
+
rxjs: {
|
|
255
|
+
singleton: true,
|
|
256
|
+
strictVersion: true,
|
|
257
|
+
},
|
|
258
|
+
...sharedMappings.getDescriptors(),
|
|
259
|
+
},
|
|
260
|
+
library: {
|
|
261
|
+
type: 'module',
|
|
262
|
+
},
|
|
263
|
+
}),
|
|
264
|
+
sharedMappings.getPlugin(),
|
|
265
|
+
],
|
|
266
|
+
};`;
|
|
267
|
+
exports.ERROR_NAME_DOESNT_MATCH = `const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
268
|
+
const mf = require('@angular-architects/module-federation/webpack');
|
|
269
|
+
const path = require('path');
|
|
270
|
+
const share = mf.share;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* We use the NX_TSCONFIG_PATH environment variable when using the @nrwl/angular:webpack-browser
|
|
274
|
+
* builder as it will generate a temporary tsconfig file which contains any required remappings of
|
|
275
|
+
* shared libraries.
|
|
276
|
+
* A remapping will occur when a library is buildable, as webpack needs to know the location of the
|
|
277
|
+
* built files for the buildable library.
|
|
278
|
+
* This NX_TSCONFIG_PATH environment variable is set by the @nrwl/angular:webpack-browser and it contains
|
|
279
|
+
* the location of the generated temporary tsconfig file.
|
|
280
|
+
*/
|
|
281
|
+
const tsConfigPath =
|
|
282
|
+
process.env.NX_TSCONFIG_PATH ??
|
|
283
|
+
path.join(__dirname, '../../tsconfig.base.json');
|
|
284
|
+
|
|
285
|
+
const workspaceRootPath = path.join(__dirname, '../../');
|
|
286
|
+
const sharedMappings = new mf.SharedMappings();
|
|
287
|
+
sharedMappings.register(
|
|
288
|
+
tsConfigPath,
|
|
289
|
+
[
|
|
290
|
+
/* mapped paths to share */
|
|
291
|
+
],
|
|
292
|
+
workspaceRootPath
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
module.exports = {
|
|
296
|
+
output: {
|
|
297
|
+
uniqueName: 'somethingelse',
|
|
298
|
+
publicPath: 'auto',
|
|
299
|
+
},
|
|
300
|
+
optimization: {
|
|
301
|
+
runtimeChunk: false,
|
|
302
|
+
},
|
|
303
|
+
experiments: {
|
|
304
|
+
outputModule: true,
|
|
305
|
+
},
|
|
306
|
+
resolve: {
|
|
307
|
+
alias: {
|
|
308
|
+
...sharedMappings.getAliases(),
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
plugins: [
|
|
312
|
+
new ModuleFederationPlugin({
|
|
313
|
+
name: 'remote1',
|
|
314
|
+
filename: 'remoteEntry.js',
|
|
315
|
+
exposes: {
|
|
316
|
+
'./Module': 'apps/remote1/src/app/remote-entry/entry.module.ts',
|
|
317
|
+
},
|
|
318
|
+
shared: share({
|
|
319
|
+
'@angular/core': {
|
|
320
|
+
singleton: true,
|
|
321
|
+
strictVersion: true,
|
|
322
|
+
requiredVersion: 'auto',
|
|
323
|
+
includeSecondaries: true,
|
|
324
|
+
},
|
|
325
|
+
'@angular/common': {
|
|
326
|
+
singleton: true,
|
|
327
|
+
strictVersion: true,
|
|
328
|
+
requiredVersion: 'auto',
|
|
329
|
+
includeSecondaries: true,
|
|
330
|
+
},
|
|
331
|
+
'@angular/common/http': {
|
|
332
|
+
singleton: true,
|
|
333
|
+
strictVersion: true,
|
|
334
|
+
requiredVersion: 'auto',
|
|
335
|
+
includeSecondaries: true,
|
|
336
|
+
},
|
|
337
|
+
'@angular/router': {
|
|
338
|
+
singleton: true,
|
|
339
|
+
strictVersion: true,
|
|
340
|
+
requiredVersion: 'auto',
|
|
341
|
+
includeSecondaries: true,
|
|
342
|
+
},
|
|
343
|
+
rxjs: {
|
|
344
|
+
singleton: true,
|
|
345
|
+
strictVersion: true,
|
|
346
|
+
requiredVersion: 'auto',
|
|
347
|
+
includeSecondaries: true,
|
|
348
|
+
},
|
|
349
|
+
...sharedMappings.getDescriptors(),
|
|
350
|
+
}),
|
|
351
|
+
library: {
|
|
352
|
+
type: 'module',
|
|
353
|
+
},
|
|
354
|
+
}),
|
|
355
|
+
sharedMappings.getPlugin(),
|
|
356
|
+
],
|
|
357
|
+
};
|
|
358
|
+
`;
|
|
359
|
+
exports.ERROR_SHARED_PACKAGES_DOESNT_MATCH = `const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
360
|
+
const mf = require('@angular-architects/module-federation/webpack');
|
|
361
|
+
const path = require('path');
|
|
362
|
+
const share = mf.share;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* We use the NX_TSCONFIG_PATH environment variable when using the @nrwl/angular:webpack-browser
|
|
366
|
+
* builder as it will generate a temporary tsconfig file which contains any required remappings of
|
|
367
|
+
* shared libraries.
|
|
368
|
+
* A remapping will occur when a library is buildable, as webpack needs to know the location of the
|
|
369
|
+
* built files for the buildable library.
|
|
370
|
+
* This NX_TSCONFIG_PATH environment variable is set by the @nrwl/angular:webpack-browser and it contains
|
|
371
|
+
* the location of the generated temporary tsconfig file.
|
|
372
|
+
*/
|
|
373
|
+
const tsConfigPath =
|
|
374
|
+
process.env.NX_TSCONFIG_PATH ??
|
|
375
|
+
path.join(__dirname, '../../tsconfig.base.json');
|
|
376
|
+
|
|
377
|
+
const workspaceRootPath = path.join(__dirname, '../../');
|
|
378
|
+
const sharedMappings = new mf.SharedMappings();
|
|
379
|
+
sharedMappings.register(
|
|
380
|
+
tsConfigPath,
|
|
381
|
+
[
|
|
382
|
+
/* mapped paths to share */
|
|
383
|
+
],
|
|
384
|
+
workspaceRootPath
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
module.exports = {
|
|
388
|
+
output: {
|
|
389
|
+
uniqueName: 'host1',
|
|
390
|
+
publicPath: 'auto',
|
|
391
|
+
},
|
|
392
|
+
optimization: {
|
|
393
|
+
runtimeChunk: false,
|
|
394
|
+
},
|
|
395
|
+
experiments: {
|
|
396
|
+
outputModule: true,
|
|
397
|
+
},
|
|
398
|
+
resolve: {
|
|
399
|
+
alias: {
|
|
400
|
+
...sharedMappings.getAliases(),
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
plugins: [
|
|
404
|
+
new ModuleFederationPlugin({
|
|
405
|
+
remotes: {
|
|
406
|
+
remote1: 'http://localhost:4201/remoteEntry.mjs',
|
|
407
|
+
},
|
|
408
|
+
shared: share({
|
|
409
|
+
'@angular/core': {
|
|
410
|
+
singleton: true,
|
|
411
|
+
strictVersion: true,
|
|
412
|
+
requiredVersion: '13.0.0',
|
|
413
|
+
includeSecondaries: true,
|
|
414
|
+
},
|
|
415
|
+
'@angular/common': {
|
|
416
|
+
singleton: true,
|
|
417
|
+
strictVersion: true,
|
|
418
|
+
requiredVersion: 'auto',
|
|
419
|
+
includeSecondaries: true,
|
|
420
|
+
},
|
|
421
|
+
'@angular/common/http': {
|
|
422
|
+
singleton: true,
|
|
423
|
+
strictVersion: false,
|
|
424
|
+
requiredVersion: 'auto',
|
|
425
|
+
includeSecondaries: true,
|
|
426
|
+
},
|
|
427
|
+
'@angular/router': {
|
|
428
|
+
singleton: true,
|
|
429
|
+
strictVersion: true,
|
|
430
|
+
requiredVersion: 'auto',
|
|
431
|
+
includeSecondaries: true,
|
|
432
|
+
},
|
|
433
|
+
rxjs: {
|
|
434
|
+
singleton: true,
|
|
435
|
+
strictVersion: true,
|
|
436
|
+
requiredVersion: 'auto',
|
|
437
|
+
includeSecondaries: true,
|
|
438
|
+
},
|
|
439
|
+
...sharedMappings.getDescriptors(),
|
|
440
|
+
}),
|
|
441
|
+
library: {
|
|
442
|
+
type: 'module',
|
|
443
|
+
},
|
|
444
|
+
}),
|
|
445
|
+
sharedMappings.getPlugin(),
|
|
446
|
+
],
|
|
447
|
+
};
|
|
448
|
+
`;
|
|
449
|
+
//# sourceMappingURL=convert-to-with-mf.test-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-to-with-mf.test-data.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.test-data.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFvC,CAAC;AAEW,QAAA,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FzC,CAAC;AAEW,QAAA,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFrC,CAAC;AAES,QAAA,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2FtC,CAAC;AAEW,QAAA,kCAAkC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFjD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkOutputNameMatchesProjectName = void 0;
|
|
4
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
|
+
function checkOutputNameMatchesProjectName(ast, projectName) {
|
|
6
|
+
const OUTPUT_SELECTOR = 'PropertyAssignment:has(Identifier[name=output]) > ObjectLiteralExpression:has(PropertyAssignment:has(Identifier[name=uniqueName]))';
|
|
7
|
+
const UNIQUENAME_SELECTOR = 'ObjectLiteralExpression > PropertyAssignment:has(Identifier[name=uniqueName]) > StringLiteral';
|
|
8
|
+
const outputNodes = (0, tsquery_1.tsquery)(ast, OUTPUT_SELECTOR, { visitAllChildren: true });
|
|
9
|
+
if (outputNodes.length === 0) {
|
|
10
|
+
// If the output isnt set in the config, then we can still set the project name correctly
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const uniqueNameNodes = (0, tsquery_1.tsquery)(outputNodes[0], UNIQUENAME_SELECTOR, {
|
|
14
|
+
visitAllChildren: true,
|
|
15
|
+
});
|
|
16
|
+
if (uniqueNameNodes.length === 0) {
|
|
17
|
+
// If the uniqeName isnt set in the config, then we can still set the project name correctly
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const uniqueName = uniqueNameNodes[0].getText().replace(/'/g, '');
|
|
21
|
+
return uniqueName === projectName;
|
|
22
|
+
}
|
|
23
|
+
exports.checkOutputNameMatchesProjectName = checkOutputNameMatchesProjectName;
|
|
24
|
+
//# sourceMappingURL=check-name-matches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-name-matches.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/convert-to-with-mf/lib/check-name-matches.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAEpD,SAAgB,iCAAiC,CAC/C,GAAe,EACf,WAAmB;IAEnB,MAAM,eAAe,GACnB,oIAAoI,CAAC;IACvI,MAAM,mBAAmB,GACvB,+FAA+F,CAAC;IAElG,MAAM,WAAW,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,eAAe,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,yFAAyF;QACzF,OAAO,IAAI,CAAC;KACb;IAED,MAAM,eAAe,GAAG,IAAA,iBAAO,EAAC,WAAW,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE;QACnE,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,4FAA4F;QAC5F,OAAO,IAAI,CAAC;KACb;IACD,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAElE,OAAO,UAAU,KAAK,WAAW,CAAC;AACpC,CAAC;AAzBD,8EAyBC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkSharedNpmPackagesMatchExpected = void 0;
|
|
4
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
|
+
function checkSharedNpmPackagesMatchExpected(ast) {
|
|
6
|
+
const SHARE_HELPER_SELECTOR = 'PropertyAssignment:has(Identifier[name=shared]) > CallExpression:has(Identifier[name=share])';
|
|
7
|
+
const SHARED_PACKAGE_CONFIG_SELECTOR = 'ObjectLiteralExpression > PropertyAssignment > ObjectLiteralExpression';
|
|
8
|
+
const shareHelperNodes = (0, tsquery_1.tsquery)(ast, SHARE_HELPER_SELECTOR, {
|
|
9
|
+
visitAllChildren: true,
|
|
10
|
+
});
|
|
11
|
+
let sharedPackageConfigNodes;
|
|
12
|
+
let settingsToMatch = [];
|
|
13
|
+
if (shareHelperNodes.length === 0) {
|
|
14
|
+
// if we arent sharing using share helper, check for standard object sharing syntax
|
|
15
|
+
const SHARED_OBJECT_SELECTOR = 'PropertyAssignment:has(Identifier[name=shared]) > ObjectLiteralExpression';
|
|
16
|
+
const sharedObjectNodes = (0, tsquery_1.tsquery)(ast, SHARED_OBJECT_SELECTOR, {
|
|
17
|
+
visitAllChildren: true,
|
|
18
|
+
});
|
|
19
|
+
if (sharedObjectNodes.length === 0) {
|
|
20
|
+
// nothing is being shared, we're safe to continue
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
sharedPackageConfigNodes = (0, tsquery_1.tsquery)(sharedObjectNodes[0], SHARED_PACKAGE_CONFIG_SELECTOR, { visitAllChildren: true });
|
|
24
|
+
settingsToMatch = [`singleton: true`, `strictVersion: true`];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
sharedPackageConfigNodes = (0, tsquery_1.tsquery)(shareHelperNodes[0], SHARED_PACKAGE_CONFIG_SELECTOR, { visitAllChildren: true });
|
|
28
|
+
settingsToMatch = [
|
|
29
|
+
`singleton: true`,
|
|
30
|
+
`strictVersion: true`,
|
|
31
|
+
`requiredVersion: 'auto'`,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
if (sharedPackageConfigNodes.length === 0) {
|
|
35
|
+
// we arent sharing configs with the share helper, so we can safely continue
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
let packagesMatch = true;
|
|
39
|
+
for (const configNode of sharedPackageConfigNodes) {
|
|
40
|
+
const configText = configNode.getText();
|
|
41
|
+
packagesMatch = settingsToMatch.every((setting) => configText.includes(setting));
|
|
42
|
+
if (!packagesMatch) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return packagesMatch;
|
|
47
|
+
}
|
|
48
|
+
exports.checkSharedNpmPackagesMatchExpected = checkSharedNpmPackagesMatchExpected;
|
|
49
|
+
//# sourceMappingURL=check-shared-npm-packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-shared-npm-packages.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/convert-to-with-mf/lib/check-shared-npm-packages.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAEpD,SAAgB,mCAAmC,CAAC,GAAe;IACjE,MAAM,qBAAqB,GACzB,8FAA8F,CAAC;IACjG,MAAM,8BAA8B,GAClC,wEAAwE,CAAC;IAE3E,MAAM,gBAAgB,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,qBAAqB,EAAE;QAC3D,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IAEH,IAAI,wBAAgC,CAAC;IACrC,IAAI,eAAe,GAAa,EAAE,CAAC;IACnC,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,mFAAmF;QACnF,MAAM,sBAAsB,GAC1B,2EAA2E,CAAC;QAC9E,MAAM,iBAAiB,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,sBAAsB,EAAE;YAC7D,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;QAEH,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,kDAAkD;YAClD,OAAO,IAAI,CAAC;SACb;QAED,wBAAwB,GAAG,IAAA,iBAAO,EAChC,iBAAiB,CAAC,CAAC,CAAC,EACpB,8BAA8B,EAC9B,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;QAEF,eAAe,GAAG,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;KAC9D;SAAM;QACL,wBAAwB,GAAG,IAAA,iBAAO,EAChC,gBAAgB,CAAC,CAAC,CAAC,EACnB,8BAA8B,EAC9B,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;QAEF,eAAe,GAAG;YAChB,iBAAiB;YACjB,qBAAqB;YACrB,yBAAyB;SAC1B,CAAC;KACH;IAED,IAAI,wBAAwB,CAAC,MAAM,KAAK,CAAC,EAAE;QACzC,4EAA4E;QAC5E,OAAO,IAAI,CAAC;KACb;IAED,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,KAAK,MAAM,UAAU,IAAI,wBAAwB,EAAE;QACjD,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;QACxC,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAChD,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC7B,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM;SACP;KACF;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAhED,kFAgEC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWebpackConfigPath = void 0;
|
|
4
|
+
function getWebpackConfigPath(project, projectName) {
|
|
5
|
+
var _a, _b, _c;
|
|
6
|
+
let pathToWebpackConfig = '';
|
|
7
|
+
for (const target of Object.values((_a = project.targets) !== null && _a !== void 0 ? _a : {})) {
|
|
8
|
+
if (target.executor === '@nrwl/angular:webpack-browser' &&
|
|
9
|
+
((_b = target.options.customWebpackConfig) === null || _b === void 0 ? void 0 : _b.path)) {
|
|
10
|
+
pathToWebpackConfig = (_c = target.options.customWebpackConfig) === null || _c === void 0 ? void 0 : _c.path;
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (!pathToWebpackConfig) {
|
|
15
|
+
throw new Error(`Could not find webpack config for \`${projectName}\` in your workspace.`);
|
|
16
|
+
}
|
|
17
|
+
return pathToWebpackConfig;
|
|
18
|
+
}
|
|
19
|
+
exports.getWebpackConfigPath = getWebpackConfigPath;
|
|
20
|
+
//# sourceMappingURL=get-webpack-config-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-webpack-config-path.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/convert-to-with-mf/lib/get-webpack-config-path.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAClC,OAA6B,EAC7B,WAAmB;;IAEnB,IAAI,mBAAmB,GAAG,EAAE,CAAC;IAC7B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC,EAAE;QACzD,IACE,MAAM,CAAC,QAAQ,KAAK,+BAA+B;aACnD,MAAA,MAAM,CAAC,OAAO,CAAC,mBAAmB,0CAAE,IAAI,CAAA,EACxC;YACA,mBAAmB,GAAG,MAAA,MAAM,CAAC,OAAO,CAAC,mBAAmB,0CAAE,IAAI,CAAC;YAC/D,MAAM;SACP;KACF;IAED,IAAI,CAAC,mBAAmB,EAAE;QACxB,MAAM,IAAI,KAAK,CACb,uCAAuC,WAAW,uBAAuB,CAC1E,CAAC;KACH;IAED,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAtBD,oDAsBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./check-name-matches"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./check-shared-npm-packages"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./get-webpack-config-path"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./is-host-remote-config"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./parse-ast-webpack-config"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./write-new-webpack-config"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/convert-to-with-mf/lib/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,sEAA4C;AAC5C,oEAA0C;AAC1C,kEAAwC;AACxC,qEAA2C;AAC3C,qEAA2C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SourceFile } from 'typescript';
|
|
2
|
+
export declare type IsHostRemoteConfigResult = 'host' | 'remote' | 'both' | false;
|
|
3
|
+
export declare function isHostRemoteConfig(ast: SourceFile): IsHostRemoteConfigResult;
|
|
4
|
+
export declare function getRemotesFromHost(ast: SourceFile): any[];
|
|
5
|
+
export declare function getExposedModulesFromRemote(ast: SourceFile): {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExposedModulesFromRemote = exports.getRemotesFromHost = exports.isHostRemoteConfig = void 0;
|
|
4
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
|
+
const REMOTES_EXPRESSION_SELECTOR = 'PropertyAssignment:has(Identifier[name=remotes]) > ObjectLiteralExpression';
|
|
6
|
+
const EXPOSES_EXPRESSION_SELECTOR = 'PropertyAssignment:has(Identifier[name=exposes]) > ObjectLiteralExpression';
|
|
7
|
+
const PROPERTY_SELECTOR = 'ObjectLiteralExpression > PropertyAssignment';
|
|
8
|
+
function isHostRemoteConfig(ast) {
|
|
9
|
+
let isHost = false;
|
|
10
|
+
let isRemote = false;
|
|
11
|
+
const remotesNodes = (0, tsquery_1.tsquery)(ast, REMOTES_EXPRESSION_SELECTOR, {
|
|
12
|
+
visitAllChildren: true,
|
|
13
|
+
});
|
|
14
|
+
if (remotesNodes.length > 0) {
|
|
15
|
+
isHost = true;
|
|
16
|
+
}
|
|
17
|
+
const exposesNodes = (0, tsquery_1.tsquery)(ast, EXPOSES_EXPRESSION_SELECTOR, {
|
|
18
|
+
visitAllChildren: true,
|
|
19
|
+
});
|
|
20
|
+
if (exposesNodes.length > 0) {
|
|
21
|
+
isRemote = true;
|
|
22
|
+
}
|
|
23
|
+
let result = isHost && isRemote ? 'both' : isHost ? 'host' : isRemote ? 'remote' : false;
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
exports.isHostRemoteConfig = isHostRemoteConfig;
|
|
27
|
+
function getRemotesFromHost(ast) {
|
|
28
|
+
const remotesObjectNodes = (0, tsquery_1.tsquery)(ast, REMOTES_EXPRESSION_SELECTOR, {
|
|
29
|
+
visitAllChildren: true,
|
|
30
|
+
});
|
|
31
|
+
if (remotesObjectNodes.length === 0) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
const remotesNodes = (0, tsquery_1.tsquery)(remotesObjectNodes[0], PROPERTY_SELECTOR, {
|
|
35
|
+
visitAllChildren: true,
|
|
36
|
+
});
|
|
37
|
+
if (remotesNodes.length === 0) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const remotes = [];
|
|
41
|
+
for (const remoteNode of remotesNodes) {
|
|
42
|
+
const remoteText = remoteNode.getText();
|
|
43
|
+
const remoteParts = remoteText
|
|
44
|
+
.split(':')
|
|
45
|
+
.map((part) => part.trim().replace(/'/g, ''));
|
|
46
|
+
const remoteName = remoteParts.shift();
|
|
47
|
+
const remoteLocation = remoteParts.join(':').replace(/\/[^\/]+$/, '');
|
|
48
|
+
remotes.push([remoteName, remoteLocation]);
|
|
49
|
+
}
|
|
50
|
+
return remotes;
|
|
51
|
+
}
|
|
52
|
+
exports.getRemotesFromHost = getRemotesFromHost;
|
|
53
|
+
function getExposedModulesFromRemote(ast) {
|
|
54
|
+
const exposesObjectNodes = (0, tsquery_1.tsquery)(ast, EXPOSES_EXPRESSION_SELECTOR, {
|
|
55
|
+
visitAllChildren: true,
|
|
56
|
+
});
|
|
57
|
+
if (exposesObjectNodes.length === 0) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
return exposesObjectNodes[0].getText();
|
|
61
|
+
}
|
|
62
|
+
exports.getExposedModulesFromRemote = getExposedModulesFromRemote;
|
|
63
|
+
//# sourceMappingURL=is-host-remote-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-host-remote-config.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/convert-to-with-mf/lib/is-host-remote-config.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAIpD,MAAM,2BAA2B,GAC/B,4EAA4E,CAAC;AAC/E,MAAM,2BAA2B,GAC/B,4EAA4E,CAAC;AAC/E,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,kBAAkB,CAAC,GAAe;IAChD,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,MAAM,YAAY,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,2BAA2B,EAAE;QAC7D,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,MAAM,GAAG,IAAI,CAAC;KACf;IAED,MAAM,YAAY,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,2BAA2B,EAAE;QAC7D,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,QAAQ,GAAG,IAAI,CAAC;KACjB;IAED,IAAI,MAAM,GACR,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9E,OAAO,MAAM,CAAC;AAChB,CAAC;AArBD,gDAqBC;AAED,SAAgB,kBAAkB,CAAC,GAAe;IAChD,MAAM,kBAAkB,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,2BAA2B,EAAE;QACnE,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,YAAY,GAAG,IAAA,iBAAO,EAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE;QACrE,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IAEH,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE;QACrC,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,UAAU;aAC3B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAChD,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;QACvC,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AA3BD,gDA2BC;AAED,SAAgB,2BAA2B,CAAC,GAAe;IACzD,MAAM,kBAAkB,GAAG,IAAA,iBAAO,EAAC,GAAG,EAAE,2BAA2B,EAAE;QACnE,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;IACH,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC;KACX;IAED,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACzC,CAAC;AATD,kEASC"}
|