@trops/dash-core 0.1.370 → 0.1.372

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.
@@ -65244,49 +65244,9 @@ async function prepareDashboardForPublish$1(
65244
65244
 
65245
65245
  // 6. Check which widgets exist in the registry (soft warning, not blocking)
65246
65246
  const { fetchRegistryIndex } = registryController$3;
65247
- let registryPackages = [];
65248
- let registryCheckFailed = false;
65249
- try {
65250
- const index = await fetchRegistryIndex();
65251
- registryPackages = index.packages || [];
65252
- } catch (err) {
65253
- console.warn(
65254
- `[DashboardConfigController] Unable to verify registry: ${err.message}`,
65255
- );
65256
- registryCheckFailed = true;
65257
- }
65258
-
65259
- let missingFromRegistry = [];
65260
- if (!registryCheckFailed) {
65261
- const registryNames = new Set(registryPackages.map((p) => p.name));
65262
- const registryWidgetNames = new Set();
65263
- for (const pkg of registryPackages) {
65264
- if (pkg.widgets) {
65265
- for (const w of pkg.widgets) {
65266
- if (w.name) registryWidgetNames.add(w.name);
65267
- }
65268
- }
65269
- }
65270
- const missingWidgets = widgets.filter(
65271
- (w) =>
65272
- w.required !== false &&
65273
- !registryNames.has(w.package) &&
65274
- !registryWidgetNames.has(w.package),
65275
- );
65276
- const grouped = {};
65277
- for (const w of missingWidgets) {
65278
- if (!grouped[w.package]) grouped[w.package] = [];
65279
- const widgetName = w.id.includes(".") ? w.id.split(".")[1] : w.id;
65280
- if (!grouped[w.package].includes(widgetName)) {
65281
- grouped[w.package].push(widgetName);
65282
- }
65283
- }
65284
- missingFromRegistry = Object.entries(grouped).map(
65285
- ([pkg, widgetNames]) => ({ package: pkg, widgets: widgetNames }),
65286
- );
65287
- }
65288
-
65289
- // 7. Resolve registry username for scope
65247
+ // 7. Resolve registry username for scope (needed by the missing-widget
65248
+ // check so we look up each dep under the caller's actual scope,
65249
+ // not the local scope from the package.json).
65290
65250
  let registryUsername = options.githubUser || "";
65291
65251
  if (!registryUsername) {
65292
65252
  try {
@@ -65298,6 +65258,65 @@ async function prepareDashboardForPublish$1(
65298
65258
  }
65299
65259
  }
65300
65260
 
65261
+ // Check each widget dep's existence in the registry via the dynamic
65262
+ // resolve endpoint (static registry-index.json lags behind freshly-
65263
+ // published packages). Auth-scoped so private packages owned by the
65264
+ // caller surface as existing.
65265
+ let missingFromRegistry = [];
65266
+ let registryCheckFailed = false;
65267
+ try {
65268
+ const { resolvePackages } = registryApiController$3;
65269
+ const seen = new Set();
65270
+ const refs = [];
65271
+ for (const w of widgets) {
65272
+ if (w.required === false) continue;
65273
+ const scope = w.scope || registryUsername;
65274
+ const name = w.package || w.packageName;
65275
+ if (!scope || !name) continue;
65276
+ const key = `${scope}/${name}`;
65277
+ if (seen.has(key)) continue;
65278
+ seen.add(key);
65279
+ // Resolve under the caller's scope — that's where the package
65280
+ // would have been published regardless of the local scope on disk.
65281
+ refs.push({ scope: registryUsername || scope, name });
65282
+ }
65283
+ if (refs.length > 0) {
65284
+ const res = await resolvePackages(refs);
65285
+ if (!res.success) {
65286
+ registryCheckFailed = true;
65287
+ } else {
65288
+ const existsByKey = new Map();
65289
+ for (const r of res.resolved || []) {
65290
+ existsByKey.set(`${r.scope}/${r.name}`, r.exists);
65291
+ }
65292
+ const grouped = {};
65293
+ for (const w of widgets) {
65294
+ if (w.required === false) continue;
65295
+ const name = w.package || w.packageName;
65296
+ if (!name) continue;
65297
+ const resolveKey = `${registryUsername || w.scope}/${name}`;
65298
+ const exists = existsByKey.get(resolveKey);
65299
+ if (exists) continue;
65300
+ const widgetName = w.id?.includes(".")
65301
+ ? w.id.split(".")[1]
65302
+ : w.id || name;
65303
+ if (!grouped[name]) grouped[name] = [];
65304
+ if (!grouped[name].includes(widgetName)) {
65305
+ grouped[name].push(widgetName);
65306
+ }
65307
+ }
65308
+ missingFromRegistry = Object.entries(grouped).map(
65309
+ ([pkg, widgetNames]) => ({ package: pkg, widgets: widgetNames }),
65310
+ );
65311
+ }
65312
+ }
65313
+ } catch (err) {
65314
+ console.warn(
65315
+ `[DashboardConfigController] Unable to verify registry: ${err.message}`,
65316
+ );
65317
+ registryCheckFailed = true;
65318
+ }
65319
+
65301
65320
  // 8. Generate registry manifest
65302
65321
  const manifest = generateRegistryManifest(dashboardConfig, {
65303
65322
  githubUser: registryUsername,