replicas-cli 0.3.227 → 0.3.228

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/index.cjs +12 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -18067,11 +18067,12 @@ function serializePosixEnvFile(env, unsetKeys = []) {
18067
18067
  ].join("\n")}
18068
18068
  `;
18069
18069
  }
18070
- function parsePosixEnvUnsetKeys(content) {
18071
- return content.split("\n").filter((line) => line.startsWith("unset ")).map((line) => line.slice("unset ".length).trim());
18072
- }
18073
18070
  function parsePosixEnvFile(content) {
18071
+ return parsePosixEnv(content).values;
18072
+ }
18073
+ function parsePosixEnv(content) {
18074
18074
  const result = {};
18075
+ const unsetKeys = [];
18075
18076
  let pos = 0;
18076
18077
  while (pos < content.length) {
18077
18078
  let lineStart;
@@ -18084,6 +18085,9 @@ function parsePosixEnvFile(content) {
18084
18085
  }
18085
18086
  if (!content.startsWith("export ", lineStart)) {
18086
18087
  const nl2 = content.indexOf("\n", lineStart);
18088
+ if (content.startsWith("unset ", lineStart)) {
18089
+ unsetKeys.push(content.slice(lineStart + "unset ".length, nl2 === -1 ? void 0 : nl2).trim());
18090
+ }
18087
18091
  if (nl2 === -1) break;
18088
18092
  pos = nl2 + 1;
18089
18093
  continue;
@@ -18122,7 +18126,7 @@ function parsePosixEnvFile(content) {
18122
18126
  const nl = content.indexOf("\n", cursor);
18123
18127
  pos = nl === -1 ? content.length : nl + 1;
18124
18128
  }
18125
- return result;
18129
+ return { values: result, unsetKeys };
18126
18130
  }
18127
18131
  var init_runtime_env = __esm({
18128
18132
  "../shared/src/runtime-env.ts"() {
@@ -31399,7 +31403,7 @@ var CLI_VERSION;
31399
31403
  var init_cli_version = __esm({
31400
31404
  "../shared/src/cli-version.ts"() {
31401
31405
  "use strict";
31402
- CLI_VERSION = "0.3.227";
31406
+ CLI_VERSION = "0.3.228";
31403
31407
  }
31404
31408
  });
31405
31409
 
@@ -35690,10 +35694,10 @@ async function envVarsRequestCommand(requiredKeys, options) {
35690
35694
  if (request.status === "provided") {
35691
35695
  const loaded = await orgAuthenticatedFetch(`/v1/variable-requests/${request.id}/load`, { method: "POST" });
35692
35696
  const variables = loaded.variables.filter((variable) => !variable.key.startsWith("REPLICAS_"));
35693
- const existing = readRuntimeEnv();
35694
- const env = { ...parsePosixEnvFile(existing), ...Object.fromEntries(variables.map((variable) => [variable.key, variable.value])) };
35697
+ const existing = parsePosixEnv(readRuntimeEnv());
35698
+ const env = { ...existing.values, ...Object.fromEntries(variables.map((variable) => [variable.key, variable.value])) };
35695
35699
  import_fs4.default.mkdirSync(import_path5.default.dirname(RUNTIME_ENV_FILE), { recursive: true });
35696
- import_fs4.default.writeFileSync(RUNTIME_ENV_FILE, serializePosixEnvFile(env, parsePosixEnvUnsetKeys(existing).filter((key) => !env[key])), { mode: 384 });
35700
+ import_fs4.default.writeFileSync(RUNTIME_ENV_FILE, serializePosixEnvFile(env, existing.unsetKeys.filter((key) => !env[key])), { mode: 384 });
35697
35701
  import_fs4.default.chmodSync(RUNTIME_ENV_FILE, 384);
35698
35702
  exported = [...variables.map((variable) => variable.key), ...loaded.already_loaded];
35699
35703
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.227",
3
+ "version": "0.3.228",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {