@nrwl/react 15.3.0 → 15.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [15.3.0](https://github.com/nrwl/nx/compare/15.2.0...15.3.0) (2022-12-06)
6
+ ## [15.3.3](https://github.com/nrwl/nx/compare/15.3.2...15.3.3) (2022-12-12)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/react
package/executors.json CHANGED
@@ -4,6 +4,11 @@
4
4
  "implementation": "./src/executors/module-federation-dev-server/compat",
5
5
  "schema": "./src/executors/module-federation-dev-server/schema.json",
6
6
  "description": "Serve a host or remote application."
7
+ },
8
+ "module-federation-ssr-dev-server": {
9
+ "implementation": "./src/executors/module-federation-ssr-dev-server/compat",
10
+ "schema": "./src/executors/module-federation-ssr-dev-server/schema.json",
11
+ "description": "Serve a host application along with it's known remotes."
7
12
  }
8
13
  },
9
14
  "executors": {
@@ -11,6 +16,11 @@
11
16
  "implementation": "./src/executors/module-federation-dev-server/module-federation-dev-server.impl",
12
17
  "schema": "./src/executors/module-federation-dev-server/schema.json",
13
18
  "description": "Serve a host or remote application."
19
+ },
20
+ "module-federation-ssr-dev-server": {
21
+ "implementation": "./src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl",
22
+ "schema": "./src/executors/module-federation-ssr-dev-server/schema.json",
23
+ "description": "Serve a host application along with it's known remotes."
14
24
  }
15
25
  }
16
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/react",
3
- "version": "15.3.0",
3
+ "version": "15.3.3",
4
4
  "private": false,
5
5
  "description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -31,9 +31,9 @@
31
31
  "migrations": "./migrations.json"
32
32
  },
33
33
  "dependencies": {
34
- "@nrwl/devkit": "15.3.0",
35
- "@nrwl/linter": "15.3.0",
36
- "@nrwl/workspace": "15.3.0",
34
+ "@nrwl/devkit": "15.3.3",
35
+ "@nrwl/linter": "15.3.3",
36
+ "@nrwl/workspace": "15.3.3",
37
37
  "@phenomnomnominal/tsquery": "4.1.1",
38
38
  "chalk": "4.1.0",
39
39
  "minimatch": "3.0.5",
@@ -43,5 +43,5 @@
43
43
  "access": "public"
44
44
  },
45
45
  "types": "./index.d.ts",
46
- "gitHead": "42618c7e1dc6e14dc9f1eabb636de0023bcd8ba2"
46
+ "gitHead": "486516ea1384d15ea74fe8334687355d1aa98f51"
47
47
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const module_federation_ssr_dev_server_impl_1 = require("./module-federation-ssr-dev-server.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(module_federation_ssr_dev_server_impl_1.default);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/module-federation-ssr-dev-server/compat.ts"],"names":[],"mappings":";;AAAA,yCAAiD;AAEjD,mGAAmE;AAEnE,kBAAe,IAAA,0BAAiB,EAAC,+CAAY,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ExecutorContext } from '@nrwl/devkit';
2
+ import { WebSsrDevServerOptions } from '@nrwl/webpack/src/executors/ssr-dev-server/schema';
3
+ declare type ModuleFederationDevServerOptions = WebSsrDevServerOptions & {
4
+ devRemotes?: string | string[];
5
+ skipRemotes?: string[];
6
+ host: string;
7
+ };
8
+ export default function moduleFederationSsrDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncGenerator<{
9
+ baseUrl: string;
10
+ success: boolean;
11
+ options: import("@nrwl/webpack/src/executors/ssr-dev-server/schema").TargetOptions;
12
+ }, any, undefined>;
13
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const ssr_dev_server_impl_1 = require("@nrwl/webpack/src/executors/ssr-dev-server/ssr-dev-server.impl");
6
+ const path_1 = require("path");
7
+ const chalk = require("chalk");
8
+ const async_iterable_1 = require("@nrwl/devkit/src/utils/async-iterable");
9
+ function moduleFederationSsrDevServer(options, context) {
10
+ var _a, _b;
11
+ return tslib_1.__asyncGenerator(this, arguments, function* moduleFederationSsrDevServer_1() {
12
+ let iter = (0, ssr_dev_server_impl_1.default)(options, context);
13
+ const p = context.workspace.projects[context.projectName];
14
+ const moduleFederationConfigPath = (0, path_1.join)(context.root, p.root, 'module-federation.config.js');
15
+ let moduleFederationConfig;
16
+ try {
17
+ moduleFederationConfig = require(moduleFederationConfigPath);
18
+ }
19
+ catch (_c) {
20
+ // TODO(jack): Add a link to guide
21
+ throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nrwl/react:host"?`);
22
+ }
23
+ const remotesToSkip = new Set((_a = options.skipRemotes) !== null && _a !== void 0 ? _a : []);
24
+ const knownRemotes = ((_b = moduleFederationConfig.remotes) !== null && _b !== void 0 ? _b : []).filter((r) => !remotesToSkip.has(r));
25
+ const devServeApps = !options.devRemotes
26
+ ? []
27
+ : Array.isArray(options.devRemotes)
28
+ ? options.devRemotes
29
+ : [options.devRemotes];
30
+ for (const app of knownRemotes) {
31
+ const [appName] = Array.isArray(app) ? app : [app];
32
+ const isDev = devServeApps.includes(appName);
33
+ iter = (0, async_iterable_1.combineAsyncIterableIterators)(iter, yield tslib_1.__await((0, devkit_1.runExecutor)({
34
+ project: appName,
35
+ target: isDev ? 'serve' : 'serve-server',
36
+ configuration: context.configurationName,
37
+ }, {
38
+ watch: isDev,
39
+ }, context)));
40
+ }
41
+ let numAwaiting = knownRemotes.length + 1; // remotes + host
42
+ return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, async_iterable_1.tapAsyncIterable)(iter, (x) => {
43
+ var _a, _b;
44
+ numAwaiting--;
45
+ if (numAwaiting === 0) {
46
+ devkit_1.logger.info(`[ ${chalk.green('ready')} ] http://${(_a = options.host) !== null && _a !== void 0 ? _a : 'localhost'}:${(_b = options.port) !== null && _b !== void 0 ? _b : 4200}`);
47
+ }
48
+ })))));
49
+ });
50
+ }
51
+ exports.default = moduleFederationSsrDevServer;
52
+ //# sourceMappingURL=module-federation-ssr-dev-server.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-federation-ssr-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAoE;AACpE,wGAAkG;AAElG,+BAA4B;AAC5B,+BAA+B;AAC/B,0EAG+C;AAQ/C,SAA+B,4BAA4B,CACzD,OAAyC,EACzC,OAAwB;;;QAExB,IAAI,IAAI,GAAG,IAAA,6BAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1D,MAAM,0BAA0B,GAAG,IAAA,WAAI,EACrC,OAAO,CAAC,IAAI,EACZ,CAAC,CAAC,IAAI,EACN,6BAA6B,CAC9B,CAAC;QAEF,IAAI,sBAA2B,CAAC;QAChC,IAAI;YACF,sBAAsB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;SAC9D;QAAC,WAAM;YACN,kCA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BAAA,sBAAA,IAAA,iCAAgB,EAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;;YACzC,WAAW,EAAE,CAAC;YACd,IAAI,WAAW,KAAK,CAAC,EAAE;gBACrB,eAAM,CAAC,IAAI,CACT,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,MAAA,OAAO,CAAC,IAAI,mCAAI,WAAW,IAC/D,MAAA,OAAO,CAAC,IAAI,mCAAI,IAClB,EAAE,CACH,CAAC;aACH;QACH,CAAC,CAAC,CAAA,CAAA,CAAA,EAAC;;CACJ;AAhED,+CAgEC"}
@@ -0,0 +1,43 @@
1
+ {
2
+ "version": 2,
3
+ "outputCapture": "direct-nodejs",
4
+ "title": "Module Federation SSR Dev Server",
5
+ "description": "Serve a SSR host application along with its known remotes.",
6
+ "cli": "nx",
7
+ "type": "object",
8
+ "properties": {
9
+ "browserTarget": {
10
+ "type": "string",
11
+ "description": "Target which builds the browser application."
12
+ },
13
+ "serverTarget": {
14
+ "type": "string",
15
+ "description": "Target which builds the server application."
16
+ },
17
+ "port": {
18
+ "type": "number",
19
+ "description": "The port to be set on `process.env.PORT` for use in the server.",
20
+ "default": 4200
21
+ },
22
+ "devRemotes": {
23
+ "type": "array",
24
+ "items": {
25
+ "type": "string"
26
+ },
27
+ "description": "List of remote applications to run in development mode (i.e. using serve target)."
28
+ },
29
+ "skipRemotes": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "string"
33
+ },
34
+ "description": "List of remote applications to not automatically serve, either statically or in development mode. This can be useful for multi-repository module federation setups where the host application uses a remote application from an external repository."
35
+ },
36
+ "host": {
37
+ "type": "string",
38
+ "description": "Host to listen on.",
39
+ "default": "localhost"
40
+ }
41
+ },
42
+ "required": ["browserTarget", "serverTarget"]
43
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.app.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/server",
5
+ "target": "es2019",
6
+ "types": [
7
+ "node"
8
+ ]
9
+ },
10
+ "include": [
11
+ "src/remotes.d.ts",
12
+ "src/main.server.tsx",
13
+ "server.ts"
14
+ ]
15
+ }
@@ -7,9 +7,9 @@ const utils_1 = require("./utils");
7
7
  function determineRemoteUrl(remote) {
8
8
  var _a, _b, _c, _d, _e;
9
9
  const remoteConfiguration = (0, project_graph_1.readCachedProjectConfiguration)(remote);
10
- const serveTarget = (_a = remoteConfiguration === null || remoteConfiguration === void 0 ? void 0 : remoteConfiguration.targets) === null || _a === void 0 ? void 0 : _a.serve;
10
+ const serveTarget = (_a = remoteConfiguration === null || remoteConfiguration === void 0 ? void 0 : remoteConfiguration.targets) === null || _a === void 0 ? void 0 : _a['serve-server'];
11
11
  if (!serveTarget) {
12
- throw new Error(`Cannot automatically determine URL of remote (${remote}). Looked for property "host" in the project's "serve" target.\n
12
+ throw new Error(`Cannot automatically determine URL of remote (${remote}). Looked for property "host" in the project's "serve-server" target.\n
13
13
  You can also use the tuple syntax in your webpack config to configure your remotes. e.g. \`remotes: [['remote1', '//localhost:4201']]\``);
14
14
  }
15
15
  const host = (_c = (_b = serveTarget.options) === null || _b === void 0 ? void 0 : _b.host) !== null && _c !== void 0 ? _c : '//localhost';
@@ -1 +1 @@
1
- {"version":3,"file":"with-module-federation-ssr.js","sourceRoot":"","sources":["../../../../../packages/react/src/module-federation/with-module-federation-ssr.ts"],"names":[],"mappings":";;;;AACA,sEAAoF;AACpF,mCAAoD;AAEpD,SAAS,kBAAkB,CAAC,MAAc;;IACxC,MAAM,mBAAmB,GAAG,IAAA,8CAA8B,EAAC,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,OAAO,0CAAE,KAAK,CAAC;IAExD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,iDAAiD,MAAM;8IACiF,CACzI,CAAC;KACH;IAED,MAAM,IAAI,GAAG,MAAA,MAAA,WAAW,C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B,EAAE,CACvC,CAAC;YAEF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC;CAAA;AAzCD,gEAyCC"}
1
+ {"version":3,"file":"with-module-federation-ssr.js","sourceRoot":"","sources":["../../../../../packages/react/src/module-federation/with-module-federation-ssr.ts"],"names":[],"mappings":";;;;AACA,sEAAoF;AACpF,mCAAoD;AAEpD,SAAS,kBAAkB,CAAC,MAAc;;IACxC,MAAM,mBAAmB,GAAG,IAAA,8CAA8B,EAAC,MAAM,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,OAAO,0CAAG,cAAc,CAAC,CAAC;IAEnE,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CACb,iDAAiD,MAAM;8IACiF,CACzI,CAAC;KACH;IAED,MAAM,IAAI,GAAG,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,IAAI,mCAAI,aAAa,CAAC;IACxD,MAAM,IAAI,GAAG,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,IAAI,mCAAI,IAAI,CAAC;IAC/C,OAAO,GACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAC3C,IAAI,IAAI,wBAAwB,CAAC;AACnC,CAAC;AAED,SAAsB,0BAA0B,CAC9C,OAA+B;;QAE/B,MAAM,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAE5D,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAC1D,MAAM,IAAA,iCAAyB,EAAC,OAAO,EAAE,kBAAkB,EAAE;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEL,OAAO,CAAC,MAAM,EAAE,EAAE;YAChB,MAAM,GAAG,kBAAkB,CAAC,MAAM,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