@nx/webpack 19.6.0-beta.1 → 19.6.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/migrations.json CHANGED
@@ -31,6 +31,15 @@
31
31
  "alwaysAddToPackageJson": false
32
32
  }
33
33
  }
34
+ },
35
+ "19.6.0": {
36
+ "version": "19.6.0-beta.1",
37
+ "packages": {
38
+ "webpack-dev-server": {
39
+ "version": "^5.0.4",
40
+ "alwaysAddToPackageJson": false
41
+ }
42
+ }
34
43
  }
35
44
  }
36
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "19.6.0-beta.1",
3
+ "version": "19.6.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
6
6
  "repository": {
@@ -66,12 +66,12 @@
66
66
  "tsconfig-paths-webpack-plugin": "4.0.0",
67
67
  "tslib": "^2.3.0",
68
68
  "webpack": "^5.80.0",
69
- "webpack-dev-server": "^4.9.3",
69
+ "webpack-dev-server": "^5.0.4",
70
70
  "webpack-node-externals": "^3.0.0",
71
71
  "webpack-subresource-integrity": "^5.1.0",
72
- "@nx/devkit": "19.6.0-beta.1",
73
- "@nx/js": "19.6.0-beta.1",
74
- "@nrwl/webpack": "19.6.0-beta.1"
72
+ "@nx/devkit": "19.6.0-beta.3",
73
+ "@nx/js": "19.6.0-beta.3",
74
+ "@nrwl/webpack": "19.6.0-beta.3"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
@@ -1,2 +1,5 @@
1
1
  import { StaticRemotesConfig } from './parse-static-remotes-config';
2
- export declare function startRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>): void;
2
+ export declare function startRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
3
+ pathToCert: string;
4
+ pathToKey: string;
5
+ }): void;
@@ -2,17 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startRemoteProxies = startRemoteProxies;
4
4
  const devkit_1 = require("@nx/devkit");
5
- function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes) {
5
+ const fs_1 = require("fs");
6
+ function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions) {
6
7
  const { createProxyMiddleware } = require('http-proxy-middleware');
7
8
  const express = require('express');
9
+ let sslCert;
10
+ let sslKey;
11
+ if (sslOptions && sslOptions.pathToCert && sslOptions.pathToKey) {
12
+ if ((0, fs_1.existsSync)(sslOptions.pathToCert) && (0, fs_1.existsSync)(sslOptions.pathToKey)) {
13
+ sslCert = (0, fs_1.readFileSync)(sslOptions.pathToCert);
14
+ sslKey = (0, fs_1.readFileSync)(sslOptions.pathToKey);
15
+ }
16
+ else {
17
+ devkit_1.logger.warn(`Encountered SSL options in project.json, however, the certificate files do not exist in the filesystem. Using http.`);
18
+ devkit_1.logger.warn(`Attempted to find '${sslOptions.pathToCert}' and '${sslOptions.pathToKey}'.`);
19
+ }
20
+ }
21
+ const http = require('http');
22
+ const https = require('https');
8
23
  devkit_1.logger.info(`NX Starting static remotes proxies...`);
9
24
  for (const app of staticRemotesConfig.remotes) {
10
25
  const expressProxy = express();
11
26
  expressProxy.use(createProxyMiddleware({
12
27
  target: mappedLocationsOfRemotes[app],
13
28
  changeOrigin: true,
29
+ secure: sslCert ? false : undefined,
14
30
  }));
15
- const proxyServer = expressProxy.listen(staticRemotesConfig.config[app].port);
31
+ const proxyServer = (sslCert ? https : http)
32
+ .createServer({ cert: sslCert, key: sslKey }, expressProxy)
33
+ .listen(staticRemotesConfig.config[app].port);
16
34
  process.on('SIGTERM', () => proxyServer.close());
17
35
  process.on('exit', () => proxyServer.close());
18
36
  }