MCPcopy Create free account
hub / github.com/devcontainers/cli / mergeForwardPorts

Function mergeForwardPorts

src/spec-node/imageMetadata.ts:202–210  ·  view source on GitHub ↗
(imageMetadata: ImageMetadataEntry[])

Source from the content-addressed store, hash-verified

200}
201
202function mergeForwardPorts(imageMetadata: ImageMetadataEntry[]): (number | string)[] | undefined {
203 const forwardPorts = [
204 ...new Set(
205 ([] as (number | string)[]).concat(...imageMetadata.map(entry => entry.forwardPorts || []))
206 .map(port => typeof port === 'number' ? `localhost:${port}` : port)
207 )
208 ].map(port => /localhost:\d+/.test(port) ? parseInt(port.substring('localhost:'.length)) : port);
209 return forwardPorts.length ? forwardPorts : undefined;
210}
211
212function mergeHostRequirements(imageMetadata: ImageMetadataEntry[]) {
213 const cpus = Math.max(...imageMetadata.map(m => m.hostRequirements?.cpus || 0));

Callers 1

mergeConfigurationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected