@solid-stack/builder 1.1.5 → 1.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/service/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,eAAO,MAAM,sBAAsB,QAAS,OAAO,KAAG,IA8BrD,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/service/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,eAAO,MAAM,sBAAsB,QAAS,OAAO,KAAG,IAmCrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Command } from "commander";
2
+ export declare function registerExportCommand(service: Command): void;
3
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/export/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAGnD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqB5D"}
@@ -0,0 +1,9 @@
1
+ export interface ExportEnvOptions {
2
+ projectDir?: string | undefined;
3
+ full?: boolean | undefined;
4
+ silenceWarnings?: boolean | undefined;
5
+ /** Optional prompt adapter for embedding the command or testing interactions. */
6
+ prompt?: ((question: string) => Promise<string>) | undefined;
7
+ }
8
+ export declare function handleExportEnv(rawStage?: string, options?: ExportEnvOptions): Promise<string[]>;
9
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/export/handler.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,iFAAiF;IACjF,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED,wBAAsB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsD1G"}
@@ -0,0 +1,7 @@
1
+ import type { Environment } from "../types/index.js";
2
+ import { type CompileEnvironmentOptions } from "./compileEnvironment.js";
3
+ /** Resolve the same compiled configuration that service runners send to Compose. */
4
+ export declare function compileApplicationEnv(stage: Environment, projectDir: string, options?: CompileEnvironmentOptions): Record<string, string>;
5
+ /** Compose dotenv quoting preserves literal dollars, whitespace and multiline values. */
6
+ export declare function serializeApplicationEnv(environment: Record<string, string>): string;
7
+ //# sourceMappingURL=compileApplicationEnv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileApplicationEnv.d.ts","sourceRoot":"","sources":["../../src/core/compileApplicationEnv.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAE7F,oFAAoF;AACpF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB;AAED,yFAAyF;AACzF,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAgBnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,gBAChB,WAAW,eACZ,MAAM,YACT,yBAAyB,KACjC,MA6UF,CAAC"}
1
+ {"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,gBAChB,WAAW,eACZ,MAAM,YACT,yBAAyB,KACjC,MAkXF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compileMeshEnvironment.d.ts","sourceRoot":"","sources":["../../../src/core/mesh/compileMeshEnvironment.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,GAAG,MAAM,EACpB,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAm0BnB"}
1
+ {"version":3,"file":"compileMeshEnvironment.d.ts","sourceRoot":"","sources":["../../../src/core/mesh/compileMeshEnvironment.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,GAAG,MAAM,EACpB,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CA+1BnB"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./types/index.js";
2
2
  export { createCli, runCli } from "./cli.js";
3
3
  export { compileEnvironment, type CompileEnvironmentOptions, } from "./core/compileEnvironment.js";
4
4
  export { compileMeshEnvironment } from "./core/mesh/compileMeshEnvironment.js";
5
+ export { compileApplicationEnv, serializeApplicationEnv } from "./core/compileApplicationEnv.js";
5
6
  export { teardownCompose } from "./core/teardownCompose.js";
6
7
  export { runCompose } from "./core/runCompose.js";
7
8
  export { buildJsonSchema } from "./core/buildSchema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { Command } from 'commander';
1
+ import { Command, Argument } from 'commander';
2
2
  import pc22 from 'picocolors';
3
- import fs, { existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync } from 'fs';
3
+ import fs, { existsSync, readFileSync, mkdirSync, writeFileSync, unlinkSync, statSync } from 'fs';
4
4
  import path13 from 'path';
5
5
  import { spawnSync, spawn } from 'child_process';
6
6
  import { parse, stringify, parseAllDocuments } from 'yaml';
@@ -9,6 +9,7 @@ import 'crypto';
9
9
  import os from 'os';
10
10
  import net from 'net';
11
11
  import { fileURLToPath } from 'url';
12
+ import { createInterface } from 'readline/promises';
12
13
  import { createRequire } from 'module';
13
14
 
14
15
  // src/types/index.ts
@@ -388,7 +389,7 @@ function checkInfra(projectDir = process.cwd()) {
388
389
  checkComposeContract(buildJson, absProjectDir);
389
390
  console.log(pc22.green("\n\u2705 All infrastructure and contract checks passed.\n"));
390
391
  }
391
- function checkDependencies() {
392
+ function checkComposeAvailability() {
392
393
  const composeCheck = spawnSync(
393
394
  "docker",
394
395
  ["compose", "version", "--short"],
@@ -411,6 +412,9 @@ function checkDependencies() {
411
412
  `Error: Docker Compose version >= 2.24.0 is required (found ${rawVersion}). Please upgrade Docker Compose to support optional env_file syntax.`
412
413
  );
413
414
  }
415
+ }
416
+ function checkDependencies() {
417
+ checkComposeAvailability();
414
418
  const daemonCheck = spawnSync("docker", ["info"], {
415
419
  stdio: "pipe",
416
420
  encoding: "utf-8"
@@ -1240,12 +1244,13 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1240
1244
  let overrideVolumes = [];
1241
1245
  let overrideHealthcheck = void 0;
1242
1246
  let overrideCommand = void 0;
1247
+ let overrideApp = void 0;
1243
1248
  const stageOverride = serviceOverrides[mode];
1244
1249
  if (stageOverride && existsSync(stageOverride.path)) {
1245
1250
  try {
1246
1251
  const overrideYaml = parse(readFileSync(stageOverride.path, "utf-8"));
1247
1252
  mergeTopLevelResources(overrideYaml);
1248
- const overrideApp = overrideYaml?.services?.app || overrideYaml?.services?.[serviceName];
1253
+ overrideApp = overrideYaml?.services?.app || overrideYaml?.services?.[serviceName];
1249
1254
  if (!overrideApp && overrideYaml?.services && Object.keys(overrideYaml.services).length > 0) {
1250
1255
  throw new ScriptError(
1251
1256
  `Override file "${stageOverride.path}" must define service "app" or "${serviceName}".`
@@ -1285,16 +1290,41 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1285
1290
  }
1286
1291
  }
1287
1292
  environment.PORT = String(INTERNAL_PORT);
1293
+ const buildArgs = {};
1294
+ if (overrideApp?.build?.args) {
1295
+ if (Array.isArray(overrideApp.build.args)) {
1296
+ for (const item of overrideApp.build.args) {
1297
+ if (typeof item === "string") {
1298
+ const eqIdx = item.indexOf("=");
1299
+ if (eqIdx !== -1) {
1300
+ buildArgs[item.slice(0, eqIdx)] = item.slice(eqIdx + 1);
1301
+ } else {
1302
+ buildArgs[item] = process.env[item] ?? null;
1303
+ }
1304
+ }
1305
+ }
1306
+ } else if (typeof overrideApp.build.args === "object") {
1307
+ Object.assign(buildArgs, overrideApp.build.args);
1308
+ }
1309
+ }
1310
+ if (serviceBuildJson.envOverrides) {
1311
+ for (const [k, v] of Object.entries(serviceBuildJson.envOverrides)) {
1312
+ buildArgs[k] = interpolateEnvTemplates(v, `Service build.json: ${serviceName}`);
1313
+ }
1314
+ }
1288
1315
  if (serviceConfig.envOverrides) {
1289
1316
  for (const [k, v] of Object.entries(serviceConfig.envOverrides)) {
1290
- environment[k] = interpolateEnvTemplates(v, `Service: ${serviceName}`);
1317
+ const interpolated = interpolateEnvTemplates(v, `Service: ${serviceName}`);
1318
+ environment[k] = interpolated;
1319
+ buildArgs[k] = interpolated;
1291
1320
  }
1292
1321
  }
1293
1322
  const serviceDef = {
1294
1323
  build: {
1295
1324
  context: relServiceDir,
1296
1325
  dockerfile,
1297
- target: mode
1326
+ target: mode,
1327
+ ...Object.keys(buildArgs).length > 0 ? { args: buildArgs } : {}
1298
1328
  },
1299
1329
  init: true,
1300
1330
  logging: {
@@ -2802,16 +2832,51 @@ ${explanation}`);
2802
2832
  serviceConfig.environment = {};
2803
2833
  }
2804
2834
  };
2835
+ const normalizeBuildArgs = (serviceConfig) => {
2836
+ if (typeof serviceConfig.build === "string") {
2837
+ serviceConfig.build = {
2838
+ context: serviceConfig.build
2839
+ };
2840
+ }
2841
+ if (serviceConfig.build && typeof serviceConfig.build === "object") {
2842
+ if (Array.isArray(serviceConfig.build.args)) {
2843
+ const argsObj = {};
2844
+ for (const item of serviceConfig.build.args) {
2845
+ if (typeof item === "string") {
2846
+ const eqIdx = item.indexOf("=");
2847
+ if (eqIdx !== -1) {
2848
+ argsObj[item.slice(0, eqIdx)] = item.slice(eqIdx + 1);
2849
+ } else {
2850
+ argsObj[item] = process.env[item] ?? null;
2851
+ }
2852
+ }
2853
+ }
2854
+ serviceConfig.build.args = argsObj;
2855
+ } else if (!serviceConfig.build.args || typeof serviceConfig.build.args !== "object") {
2856
+ serviceConfig.build.args = {};
2857
+ }
2858
+ }
2859
+ };
2805
2860
  if (buildJson.envOverrides && yml.services && yml.services.app) {
2806
2861
  normalizeEnvironment(yml.services.app);
2862
+ normalizeBuildArgs(yml.services.app);
2807
2863
  for (const [k, v] of Object.entries(buildJson.envOverrides)) {
2808
- yml.services.app.environment[k] = interpolateEnv(v, "App EnvOverrides");
2864
+ const val = interpolateEnv(v, "App EnvOverrides");
2865
+ yml.services.app.environment[k] = val;
2866
+ if (yml.services.app.build?.args) {
2867
+ yml.services.app.build.args[k] = val;
2868
+ }
2809
2869
  }
2810
2870
  }
2811
2871
  if (buildJson.tester?.envOverrides && yml.services && yml.services.tester) {
2812
2872
  normalizeEnvironment(yml.services.tester);
2873
+ normalizeBuildArgs(yml.services.tester);
2813
2874
  for (const [k, v] of Object.entries(buildJson.tester.envOverrides)) {
2814
- yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
2875
+ const val = interpolateEnv(v, "Tester EnvOverrides");
2876
+ yml.services.tester.environment[k] = val;
2877
+ if (yml.services.tester.build?.args) {
2878
+ yml.services.tester.build.args[k] = val;
2879
+ }
2815
2880
  }
2816
2881
  }
2817
2882
  if (yml.services) {
@@ -3566,11 +3631,127 @@ Examples:
3566
3631
  }
3567
3632
  );
3568
3633
  };
3634
+ function compileApplicationEnv(stage, projectDir, options = {}) {
3635
+ const dir = resolveProjectDir(projectDir);
3636
+ const yaml = compileEnvironment(stage, dir, options);
3637
+ const result = spawnSync("docker", [
3638
+ "compose",
3639
+ "--project-directory",
3640
+ dir,
3641
+ "-f",
3642
+ "-",
3643
+ "config",
3644
+ "--format",
3645
+ "json"
3646
+ ], { cwd: dir, encoding: "utf-8", input: yaml });
3647
+ if (result.error || result.status !== 0) {
3648
+ throw new ScriptError(`Failed to resolve ${stage} application environment: ${result.error?.message || result.stderr || result.stdout}`);
3649
+ }
3650
+ const config = JSON.parse(result.stdout);
3651
+ if (!config.services?.app) {
3652
+ throw new ScriptError(`The ${stage} configuration has no application service ('app').`);
3653
+ }
3654
+ const environment = {};
3655
+ for (const [key, value] of Object.entries(config.services.app.environment ?? {})) {
3656
+ if (value !== null && value !== void 0) {
3657
+ environment[key] = String(value).replace(/\$\$/g, "$");
3658
+ }
3659
+ }
3660
+ return environment;
3661
+ }
3662
+ function serializeApplicationEnv(environment) {
3663
+ return Object.keys(environment).sort().map((key) => {
3664
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
3665
+ throw new ScriptError(`Cannot export invalid environment variable name: ${key}`);
3666
+ }
3667
+ const value = environment[key];
3668
+ if (value.includes("\0")) throw new ScriptError(`Cannot export a NUL character in ${key}.`);
3669
+ const quoted = /'|\\$|\r/.test(value) ? `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\$/g, () => "$$")}"` : `'${value}'`;
3670
+ return `${key}=${quoted}`;
3671
+ }).join("\n") + "\n";
3672
+ }
3673
+
3674
+ // src/commands/service/commands/export/handler.ts
3675
+ var STAGES = ["dev", "prod", "test", "e2e"];
3676
+ async function handleExportEnv(rawStage, options = {}) {
3677
+ const stage = rawStage?.toLowerCase();
3678
+ if (stage !== void 0 && !STAGES.includes(stage)) {
3679
+ throw new ScriptError(`Unknown environment stage: "${rawStage}". Supported stages: ${STAGES.join(", ")}`);
3680
+ }
3681
+ const projectDir = resolveProjectDir(options.projectDir);
3682
+ const stages = stage === void 0 ? STAGES : [stage];
3683
+ const snapshots = stages.map((stage2) => ({
3684
+ stage: stage2,
3685
+ content: serializeApplicationEnv(compileApplicationEnv(stage2, projectDir, options))
3686
+ }));
3687
+ let reader;
3688
+ const ask = async (question) => {
3689
+ if (options.prompt) return options.prompt(question);
3690
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3691
+ throw new ScriptError("An existing export needs confirmation. Run this command in an interactive terminal to overwrite it or choose another filename.");
3692
+ }
3693
+ reader ??= createInterface({ input: process.stdin, output: process.stdout });
3694
+ return reader.question(question);
3695
+ };
3696
+ const files = [];
3697
+ try {
3698
+ for (const snapshot of snapshots) {
3699
+ let filename = path13.join(projectDir, `env.${snapshot.stage}`);
3700
+ while (true) {
3701
+ let overwrite = false;
3702
+ if (existsSync(filename)) {
3703
+ const answer = (await ask(`${filename} already exists. Overwrite? [y/N] `)).trim().toLowerCase();
3704
+ overwrite = answer === "y" || answer === "yes";
3705
+ if (!overwrite) {
3706
+ const name = (await ask(`New filename for ${snapshot.stage} (relative to the service directory): `)).trim();
3707
+ if (!name) continue;
3708
+ filename = path13.resolve(projectDir, name);
3709
+ continue;
3710
+ }
3711
+ }
3712
+ mkdirSync(path13.dirname(filename), { recursive: true });
3713
+ try {
3714
+ writeFileSync(filename, snapshot.content, { encoding: "utf-8", flag: overwrite ? "w" : "wx", mode: 384 });
3715
+ } catch (error) {
3716
+ if (!overwrite && error.code === "EEXIST") continue;
3717
+ throw error;
3718
+ }
3719
+ files.push(filename);
3720
+ console.log(pc22.green(`Exported ${snapshot.stage} application environment to ${filename}`));
3721
+ break;
3722
+ }
3723
+ }
3724
+ } finally {
3725
+ reader?.close();
3726
+ }
3727
+ return files;
3728
+ }
3729
+
3730
+ // src/commands/service/commands/export/command.ts
3731
+ function registerExportCommand(service) {
3732
+ const command = service.command("export").description("Export service configuration");
3733
+ command.command("env").description("Export the application's resolved environment for one or all stages").addArgument(new Argument("[stage]", "Stage to export (defaults to all four)").choices(["dev", "prod", "test", "e2e"])).option("-C, --project-dir <dir>", "Service project directory (defaults to cwd)").option("--full", "Export dev with mock dependencies and integrated infra mode").option("--integrated", "Alias for --full").option("--silence-warnings", "Silence non-critical URL templating warnings").addHelpText("after", `
3734
+ Examples:
3735
+ $ builder service export env
3736
+ $ builder service export env dev
3737
+ $ builder service export env e2e -C ./services/backend
3738
+ $ builder service export env dev --full`).action(async (stage, options) => {
3739
+ await handleExportEnv(stage, {
3740
+ projectDir: options.projectDir,
3741
+ full: Boolean(options.full || options.integrated),
3742
+ silenceWarnings: options.silenceWarnings
3743
+ });
3744
+ });
3745
+ }
3569
3746
 
3570
3747
  // src/commands/service/command.ts
3571
3748
  var registerServiceCommand = (cmd) => {
3572
3749
  const service = cmd.command("service").description("Manage and run services");
3573
3750
  service.hook("preAction", async (_thisCommand, actionCommand) => {
3751
+ if (actionCommand.name() === "env" && actionCommand.parent?.name() === "export") {
3752
+ checkComposeAvailability();
3753
+ return;
3754
+ }
3574
3755
  checkDependencies();
3575
3756
  if (actionCommand.name() === "up") {
3576
3757
  const options = actionCommand.opts();
@@ -3586,6 +3767,7 @@ var registerServiceCommand = (cmd) => {
3586
3767
  });
3587
3768
  registerUpCommand(service);
3588
3769
  registerDownCommand(service);
3770
+ registerExportCommand(service);
3589
3771
  };
3590
3772
  var require2 = createRequire(import.meta.url);
3591
3773
  var pkg = require2("../package.json");
@@ -3696,6 +3878,6 @@ var buildJsonSchema = z.object({
3696
3878
  tester: buildTesterSchema.optional()
3697
3879
  }).strict().describe("Solid Stack service build and deployment configuration");
3698
3880
 
3699
- export { NotFoundError, SERVICE_STAGES, ScriptError, buildJsonSchema, compileEnvironment, compileMeshEnvironment, createCli, meshSchema, runCli, runCompose, teardownCompose, version };
3881
+ export { NotFoundError, SERVICE_STAGES, ScriptError, buildJsonSchema, compileApplicationEnv, compileEnvironment, compileMeshEnvironment, createCli, meshSchema, runCli, runCompose, serializeApplicationEnv, teardownCompose, version };
3700
3882
  //# sourceMappingURL=index.js.map
3701
3883
  //# sourceMappingURL=index.js.map