cdk-local 0.15.0 → 0.16.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.
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { M as createLocalInvokeCommand, a as createLocalStartApiCommand, i as createLocalRunTaskCommand, t as createLocalStartServiceCommand } from "./local-start-service-DtFvSHSK.js";
2
+ import { M as createLocalInvokeCommand, a as createLocalStartApiCommand, i as createLocalRunTaskCommand, t as createLocalStartServiceCommand } from "./local-start-service-DwK7mB45.js";
3
3
  import { Command } from "commander";
4
4
 
5
5
  //#region src/cli/index.ts
6
6
  const program = new Command();
7
- program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.15.0");
7
+ program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.16.0");
8
8
  program.addCommand(createLocalInvokeCommand());
9
9
  program.addCommand(createLocalStartApiCommand());
10
10
  program.addCommand(createLocalRunTaskCommand());
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as pickRefLogicalId, B as resolveCfnStackName, C as applyAuthorizerOverlay, D as discoverWebSocketApisOrThrow, E as discoverWebSocketApis, F as createLocalStateProvider, I as isCfnFlagPresent, L as rejectExplicitCfnStackWithMultipleStacks, M as createLocalInvokeCommand, N as resolveEnvVars, O as parseSelectionExpressionPath, P as LocalStateSourceError, R as resolveCfnFallbackRegion, S as translateLambdaResponse, T as buildRestV1Event, V as CfnLocalStateProvider, _ as computeRequestIdentityHash, a as createLocalStartApiCommand, b as invokeTokenAuthorizer, c as buildStageMap, d as buildCognitoJwksUrl, f as buildJwksUrlFromIssuer, g as buildMethodArn, h as verifyJwtAuthorizer, i as createLocalRunTaskCommand, j as resolveLambdaArnIntrinsic, k as discoverRoutes, l as resolveSelectionExpression, m as verifyCognitoJwt, n as CloudMapRegistry, o as createAuthorizerCache, p as createJwksCache, r as getContainerNetworkIp, s as attachStageContext, t as createLocalStartServiceCommand, u as resolveServiceIntegrationParameters, v as evaluateCachedLambdaPolicy, w as buildHttpApiV2Event, x as matchRoute, y as invokeRequestAuthorizer, z as resolveCfnRegion } from "./local-start-service-DtFvSHSK.js";
1
+ import { A as pickRefLogicalId, B as resolveCfnStackName, C as applyAuthorizerOverlay, D as discoverWebSocketApisOrThrow, E as discoverWebSocketApis, F as createLocalStateProvider, I as isCfnFlagPresent, L as rejectExplicitCfnStackWithMultipleStacks, M as createLocalInvokeCommand, N as resolveEnvVars, O as parseSelectionExpressionPath, P as LocalStateSourceError, R as resolveCfnFallbackRegion, S as translateLambdaResponse, T as buildRestV1Event, V as CfnLocalStateProvider, _ as computeRequestIdentityHash, a as createLocalStartApiCommand, b as invokeTokenAuthorizer, c as buildStageMap, d as buildCognitoJwksUrl, f as buildJwksUrlFromIssuer, g as buildMethodArn, h as verifyJwtAuthorizer, i as createLocalRunTaskCommand, j as resolveLambdaArnIntrinsic, k as discoverRoutes, l as resolveSelectionExpression, m as verifyCognitoJwt, n as CloudMapRegistry, o as createAuthorizerCache, p as createJwksCache, r as getContainerNetworkIp, s as attachStageContext, t as createLocalStartServiceCommand, u as resolveServiceIntegrationParameters, v as evaluateCachedLambdaPolicy, w as buildHttpApiV2Event, x as matchRoute, y as invokeRequestAuthorizer, z as resolveCfnRegion } from "./local-start-service-DwK7mB45.js";
2
2
 
3
3
  export { CfnLocalStateProvider, CloudMapRegistry, LocalStateSourceError, applyAuthorizerOverlay, attachStageContext, buildCognitoJwksUrl, buildHttpApiV2Event, buildJwksUrlFromIssuer, buildMethodArn, buildRestV1Event, buildStageMap, computeRequestIdentityHash, createAuthorizerCache, createJwksCache, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, evaluateCachedLambdaPolicy, getContainerNetworkIp, invokeRequestAuthorizer, invokeTokenAuthorizer, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, resolveCfnRegion, resolveCfnStackName, resolveEnvVars, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse, verifyCognitoJwt, verifyJwtAuthorizer };
@@ -16901,6 +16901,28 @@ function groupSecretsByContainer(resolved) {
16901
16901
  return out;
16902
16902
  }
16903
16903
  /**
16904
+ * Resolve the HOST port to publish a container port on.
16905
+ *
16906
+ * On macOS, Docker Desktop binds host ports below 1024 through a
16907
+ * privileged helper (`com.docker.vmnetd`) that prompts for an admin
16908
+ * password — and fails outright when that helper isn't running. A
16909
+ * container that declares e.g. port 80 would otherwise force that prompt
16910
+ * on every `run-task` / `start-service`. To keep the local run
16911
+ * password-free, remap a privileged host port to a non-privileged one by
16912
+ * adding 8000 (80 -> 8080, 443 -> 8443). The container port is unchanged
16913
+ * — only the host side moves — and the caller logs where to reach it.
16914
+ *
16915
+ * Only macOS is affected: on Linux the Docker daemon runs as root and
16916
+ * binds privileged ports directly, so the host port is left as-is to
16917
+ * preserve the `host == container` mapping users expect.
16918
+ *
16919
+ * Exported for unit testing with an explicit `platform`.
16920
+ */
16921
+ function resolvePublishHostPort(hostPort, platform) {
16922
+ if (platform === "darwin" && hostPort < 1024) return hostPort + 8e3;
16923
+ return hostPort;
16924
+ }
16925
+ /**
16904
16926
  * Build the full `docker run -d` argument list for one container.
16905
16927
  * Exported (no-leading-underscore) so the unit tests can assert against
16906
16928
  * the shape directly without spawning a process.
@@ -16923,7 +16945,9 @@ function buildDockerRunArgs(opts) {
16923
16945
  else if (task.runtimePlatform) args.push("--platform", task.runtimePlatform.cpuArchitecture === "ARM64" ? "linux/arm64" : "linux/amd64");
16924
16946
  if (!opts.skipHostPortPublish) for (const pm of container.portMappings) {
16925
16947
  const hostPort = pm.hostPort ?? pm.containerPort;
16926
- args.push("-p", `${containerHost}:${hostPort}:${pm.containerPort}/${pm.protocol}`);
16948
+ const publishHostPort = resolvePublishHostPort(hostPort, process.platform);
16949
+ if (publishHostPort !== hostPort) getLogger().child("ecs").info(`Container '${container.name}' container port ${pm.containerPort} published on ${containerHost}:${publishHostPort} (remapped from privileged host port ${hostPort}; macOS Docker Desktop needs an admin helper to bind ports < 1024). Reach it at ${containerHost}:${publishHostPort}.`);
16950
+ args.push("-p", `${containerHost}:${publishHostPort}:${pm.containerPort}/${pm.protocol}`);
16927
16951
  }
16928
16952
  if (opts.profileCredentialsFile) args.push("-v", `${opts.profileCredentialsFile.hostPath}:${opts.profileCredentialsFile.containerPath}:ro`);
16929
16953
  for (const mp of container.mountPoints) {
@@ -18704,4 +18728,4 @@ function createLocalStartServiceCommand(opts = {}) {
18704
18728
 
18705
18729
  //#endregion
18706
18730
  export { pickRefLogicalId as A, resolveCfnStackName as B, applyAuthorizerOverlay as C, discoverWebSocketApisOrThrow as D, discoverWebSocketApis as E, createLocalStateProvider as F, isCfnFlagPresent as I, rejectExplicitCfnStackWithMultipleStacks as L, createLocalInvokeCommand as M, resolveEnvVars as N, parseSelectionExpressionPath as O, LocalStateSourceError as P, resolveCfnFallbackRegion as R, translateLambdaResponse as S, buildRestV1Event as T, CfnLocalStateProvider as V, computeRequestIdentityHash as _, createLocalStartApiCommand as a, invokeTokenAuthorizer as b, buildStageMap as c, buildCognitoJwksUrl as d, buildJwksUrlFromIssuer as f, buildMethodArn as g, verifyJwtAuthorizer as h, createLocalRunTaskCommand as i, resolveLambdaArnIntrinsic as j, discoverRoutes as k, resolveSelectionExpression as l, verifyCognitoJwt as m, CloudMapRegistry as n, createAuthorizerCache as o, createJwksCache as p, getContainerNetworkIp as r, attachStageContext as s, createLocalStartServiceCommand as t, resolveServiceIntegrationParameters as u, evaluateCachedLambdaPolicy as v, buildHttpApiV2Event as w, matchRoute as x, invokeRequestAuthorizer as y, resolveCfnRegion as z };
18707
- //# sourceMappingURL=local-start-service-DtFvSHSK.js.map
18731
+ //# sourceMappingURL=local-start-service-DwK7mB45.js.map