@theholocron/cli 5.0.0-alpha.331 → 5.0.0-alpha.333

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/dist/cli.mjs CHANGED
@@ -5255,6 +5255,14 @@ const deployCommand = {
5255
5255
  };
5256
5256
  // ../dagobah/dist/index.mjs
5257
5257
  /**
5258
+ * Wrap an unquoted PEM block in double quotes. `op environment secret list --format=dotenv` prints a multi-line
5259
+ * value (a private key) unquoted, which `dotenv` reads as its first line only; quoted, it reads the whole block.
5260
+ * A PEM holds no quote or backslash, so nothing needs escaping.
5261
+ */
5262
+ function quotePem(text) {
5263
+ return text.replace(/^([A-Za-z_][A-Za-z0-9_]*)=(-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----)[ \t]*$/gm, "$1=\"$2\"");
5264
+ }
5265
+ /**
5258
5266
  * The environment a local app runs with: the variables already in the process, and what the 1Password
5259
5267
  * Environment `environment` holds for the rest (read with `op environment secret list`, the way the 1Password
5260
5268
  * plugin reads one, so Touch ID asks once). The process wins, so a variable exported for one run overrides the
@@ -5287,7 +5295,7 @@ function loadDevEnv(input) {
5287
5295
  throw new Error(`could not read the 1Password Environment "${input.environment}": ${why || "op failed"}`);
5288
5296
  }
5289
5297
  merged = {
5290
- ...parse(String(result.stdout)),
5298
+ ...parse(quotePem(String(result.stdout))),
5291
5299
  ...Object.fromEntries(Object.entries(env).filter(([, v]) => v !== void 0 && v !== ""))
5292
5300
  };
5293
5301
  }
@@ -5375,7 +5383,8 @@ async function serveHandler(input) {
5375
5383
  const env = loadDevEnv({
5376
5384
  environment: input.environment,
5377
5385
  required: input.required,
5378
- env: settings
5386
+ env: settings,
5387
+ ...input.spawn ? { spawn: input.spawn } : {}
5379
5388
  });
5380
5389
  Object.assign(process.env, env);
5381
5390
  const server = await startDevServer({