@plexus-ms/cli 0.129.1 → 0.130.0

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.
Files changed (2) hide show
  1. package/dist/plx.js +15 -4
  2. package/package.json +2 -2
package/dist/plx.js CHANGED
@@ -11574,7 +11574,7 @@ import { dirname as dirname3, join as join7, relative as relative2, resolve } fr
11574
11574
 
11575
11575
  // ../lib/dist/standard-index.json
11576
11576
  var standard_index_default = {
11577
- version: "0.129.1",
11577
+ version: "0.130.0",
11578
11578
  citable: [
11579
11579
  "\xA7 1 PLX",
11580
11580
  "\xA7 1.1 PLX",
@@ -11894,9 +11894,10 @@ function singlePort(compose) {
11894
11894
  ports.length === 0 ? `the ${APP_SERVICE} service publishes no port` : `the ${APP_SERVICE} service publishes ${ports.length} ports, not one`
11895
11895
  ];
11896
11896
  }
11897
- var LOOPBACK_PORT = `\${PLEXUS_LOOPBACK_PORT}`;
11897
+ var LOOPBACK_PORT = `\${PLEXUS_LOOPBACK_PORT:?<message>}`;
11898
11898
  var LOOPBACK_FORM = `127.0.0.1:${LOOPBACK_PORT}:<container-port>`;
11899
- var isLoopbackVar = (host) => /^(?:\$\{PLEXUS_LOOPBACK_PORT(?::\?[^}]*)?\}|\$PLEXUS_LOOPBACK_PORT)$/.test(host);
11899
+ var isLoopbackVar = (host) => /^\$\{PLEXUS_LOOPBACK_PORT:\?[^}]*\}$/.test(host);
11900
+ var namesLoopbackVar = (host) => /^(?:\$\{PLEXUS_LOOPBACK_PORT(?::?\?[^}]*)?\}|\$PLEXUS_LOOPBACK_PORT)$/.test(host);
11900
11901
  function loopbackPort(compose) {
11901
11902
  const problems = [];
11902
11903
  const own = portsOf(compose.services[APP_SERVICE] ?? {});
@@ -11906,11 +11907,15 @@ function loopbackPort(compose) {
11906
11907
  if (!isLoopback(port))
11907
11908
  problems.push(`the ${APP_SERVICE} service publishes \`${renderPort(port)}\`, not ${LOOPBACK_FORM}`);
11908
11909
  for (const [name, service] of Object.entries(compose.services)) {
11910
+ if (service.network_mode === "host")
11911
+ problems.push(`service \`${name}\` runs in the host's network (\`network_mode: host\`), reachable beyond loopback`);
11909
11912
  if (name === APP_SERVICE)
11910
11913
  continue;
11911
11914
  for (const port of portsOf(service)) {
11915
+ if (hostIpOf(port) !== "127.0.0.1")
11916
+ problems.push(`service \`${name}\` publishes \`${renderPort(port)}\` beyond 127.0.0.1`);
11912
11917
  const host = hostPortOf(port);
11913
- if (host && !isLoopbackVar(host))
11918
+ if (host && !namesLoopbackVar(host))
11914
11919
  problems.push(`service \`${name}\` fixes host port \`${host}\` (\`${renderPort(port)}\`)`);
11915
11920
  }
11916
11921
  }
@@ -12212,6 +12217,12 @@ function partsOf(spec) {
12212
12217
  }
12213
12218
  return parts2;
12214
12219
  }
12220
+ function hostIpOf(port) {
12221
+ if (isMapping(port))
12222
+ return port.host_ip == null ? void 0 : String(port.host_ip);
12223
+ const parts2 = partsOf(String(port));
12224
+ return parts2.length >= 3 ? parts2[0] : void 0;
12225
+ }
12215
12226
  function hostPortOf(port) {
12216
12227
  if (isMapping(port))
12217
12228
  return port.published == null ? void 0 : String(port.published);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexus-ms/cli",
3
- "version": "0.129.1",
3
+ "version": "0.130.0",
4
4
  "description": "plx, the Plexus command-line tool: a single-script adapter over @plexus-ms/lib",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@inquirer/prompts": "^8.8.0",
27
- "@plexus-ms/lib": "0.129.1",
27
+ "@plexus-ms/lib": "0.130.0",
28
28
  "commander": "^15.1.0"
29
29
  },
30
30
  "devDependencies": {