@youtyan/code-viewer 0.5.2 → 0.5.3

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.
@@ -3766,6 +3766,7 @@ function parseComposeContent(content, filepath, composeDir, cwd, composeDirEnv,
3766
3766
  const image = imageMatch ? imageMatch[1] : null;
3767
3767
  const env = parseComposeEnv(svcBlock, composeDirEnv);
3768
3768
  const containerPort = parseComposeContainerPort(svcBlock);
3769
+ const profiled = /^\s+profiles:/m.test(svcBlock);
3769
3770
  const kind = (image ? detectDbKind(image, env) : null) ?? detectDbKindFromEnv(env) ?? detectDbKindFromContainerPort(containerPort) ?? detectDbKindFromServiceName(svc.name);
3770
3771
  if (!kind)
3771
3772
  continue;
@@ -3797,7 +3798,8 @@ function parseComposeContent(content, filepath, composeDir, cwd, composeDirEnv,
3797
3798
  composeDir,
3798
3799
  relDirSlash,
3799
3800
  ...hostPort ? { hostPort } : {},
3800
- containerPort: serviceContainerPort
3801
+ containerPort: serviceContainerPort,
3802
+ ...profiled ? { profiled: true } : {}
3801
3803
  });
3802
3804
  }
3803
3805
  }
@@ -4327,10 +4329,13 @@ function summarizeDockerSources(discovery) {
4327
4329
  const entry = byComposeDir.get(source.composeDir);
4328
4330
  if (entry) {
4329
4331
  entry.services.push(source.serviceName);
4332
+ if (source.profiled)
4333
+ entry.profiledServices.add(source.serviceName);
4330
4334
  } else {
4331
4335
  byComposeDir.set(source.composeDir, {
4332
4336
  compose: source.composeDir,
4333
- services: [source.serviceName]
4337
+ services: [source.serviceName],
4338
+ profiledServices: new Set(source.profiled ? [source.serviceName] : [])
4334
4339
  });
4335
4340
  }
4336
4341
  }
@@ -4404,7 +4409,7 @@ async function checkDocker(signal, discoveryResult) {
4404
4409
  if (compose.cmd && dockerInfo?.code === 0) {
4405
4410
  for (const entry of summary.byComposeDir.values()) {
4406
4411
  const composeKey = entry.compose;
4407
- const configRow = await checkComposeConfig(compose.cmd, composeKey, entry.services, signal);
4412
+ const configRow = await checkComposeConfig(compose.cmd, composeKey, entry.services, entry.profiledServices, signal);
4408
4413
  rows.push(configRow);
4409
4414
  const psRow = await checkComposePs(compose.cmd, composeKey, entry.services, signal);
4410
4415
  rows.push(...psRow);
@@ -4412,7 +4417,7 @@ async function checkDocker(signal, discoveryResult) {
4412
4417
  }
4413
4418
  return { id: "docker", title: "Docker / Compose", rows };
4414
4419
  }
4415
- async function checkComposeConfig(cmd, composeDir, discoveredServices, signal) {
4420
+ async function checkComposeConfig(cmd, composeDir, discoveredServices, profiledServices, signal) {
4416
4421
  const cacheKey = `${cmd.binary}|${composeDir}`;
4417
4422
  const now = Date.now();
4418
4423
  const cached = composeConfigCache.get(cacheKey);
@@ -4480,13 +4485,15 @@ async function checkComposeConfig(cmd, composeDir, discoveredServices, signal) {
4480
4485
  };
4481
4486
  }
4482
4487
  if (services) {
4483
- const missing = discoveredServices.filter((s) => !services?.includes(s));
4488
+ const missing = discoveredServices.filter((s) => !services?.includes(s) && !profiledServices.has(s));
4489
+ const skippedProfiled = discoveredServices.filter((s) => profiledServices.has(s) && !services?.includes(s));
4484
4490
  if (missing.length === 0) {
4491
+ const summary = skippedProfiled.length ? `OK (${services.length} active, ${skippedProfiled.length} profile-gated)` : `OK (${services.length} services)`;
4485
4492
  return {
4486
4493
  id: `docker.compose-config:${composeDir}`,
4487
4494
  title: `compose config — ${composeDir}`,
4488
4495
  status: "ok",
4489
- detail: `OK (${services.length} services)`
4496
+ detail: summary
4490
4497
  };
4491
4498
  }
4492
4499
  return {
@@ -4494,7 +4501,7 @@ async function checkComposeConfig(cmd, composeDir, discoveredServices, signal) {
4494
4501
  title: `compose config — ${composeDir}`,
4495
4502
  status: "warn",
4496
4503
  detail: `discovered services not resolved by compose: ${missing.join(", ")}`,
4497
- hint: "These services were found by scanning the compose file but `docker compose config --services` did not return them. They may be guarded by an inactive profile or overridden by a sibling compose file."
4504
+ hint: "These services were found by scanning the compose file but `docker compose config --services` did not return them. They may be overridden by a sibling compose file. (profile-gated services with `profiles:` are intentionally ignored.)"
4498
4505
  };
4499
4506
  }
4500
4507
  return {
@@ -15059,6 +15066,7 @@ data: ${watchLimitReached}
15059
15066
  return text("not found", 404);
15060
15067
  }
15061
15068
  });
15069
+ listenPort = server.port;
15062
15070
  if (openAfterStart) {
15063
15071
  openBrowser(`http://127.0.0.1:${server.port}/`);
15064
15072
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youtyan/code-viewer",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Local browser-based code and git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {