@trops/dash-core 0.1.369 → 0.1.370

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.
@@ -64891,13 +64891,21 @@ async function collectDashboardDependencies$1(
64891
64891
  const installedWidgets = widgetRegistry ? widgetRegistry.getWidgets() : [];
64892
64892
 
64893
64893
  const widgets = deps.map((dep) => {
64894
- // Find the installed widget whose componentNames contains this dep's widgetName
64894
+ // Match by componentName OR by any shape of the package id.
64895
+ // Registry packages are stored as `@scope/name` but callers may
64896
+ // synthesize `scope/name`; try both before giving up.
64897
+ const candidateIds = new Set();
64898
+ if (dep.scope && dep.packageName) {
64899
+ candidateIds.add(`@${dep.scope}/${dep.packageName}`);
64900
+ candidateIds.add(`${dep.scope}/${dep.packageName}`);
64901
+ }
64895
64902
  const match = installedWidgets.find(
64896
64903
  (w) =>
64897
64904
  (w.componentNames && w.componentNames.includes(dep.widgetName)) ||
64898
64905
  (w.scope === dep.scope &&
64899
64906
  (w.name === dep.packageName ||
64900
- w.packageId === `${dep.scope}/${dep.packageName}`)),
64907
+ candidateIds.has(w.packageId) ||
64908
+ candidateIds.has(w.name))),
64901
64909
  );
64902
64910
 
64903
64911
  return {
@@ -64907,7 +64915,11 @@ async function collectDashboardDependencies$1(
64907
64915
  component: dep.widgetName,
64908
64916
  localVersion: dep.version,
64909
64917
  packageDir: match?.path || null,
64910
- packageId: match?.packageId || null,
64918
+ packageId:
64919
+ match?.packageId ||
64920
+ (dep.scope && dep.packageName
64921
+ ? `@${dep.scope}/${dep.packageName}`
64922
+ : null),
64911
64923
  author: dep.author || "",
64912
64924
  hasLocalPackage: !!match?.path,
64913
64925
  };
@@ -71949,6 +71961,29 @@ const {
71949
71961
  generateWidgetRegistryManifest,
71950
71962
  } = widgetPublishManifest;
71951
71963
 
71964
+ /**
71965
+ * Resilient widget lookup. Callers pass identifiers in different shapes —
71966
+ * `@scope/name`, `scope/name`, sometimes bare `name`. Try a few common
71967
+ * variants so the batch-publish dialog (which synthesizes a fallback
71968
+ * packageId from scope/packageName without the `@` prefix) still finds
71969
+ * the registered package.
71970
+ */
71971
+ function findWidget(registry, packageId) {
71972
+ if (!packageId) return null;
71973
+ const candidates = new Set();
71974
+ candidates.add(packageId);
71975
+ if (packageId.startsWith("@")) {
71976
+ candidates.add(packageId.slice(1));
71977
+ } else if (packageId.includes("/")) {
71978
+ candidates.add(`@${packageId}`);
71979
+ }
71980
+ for (const id of candidates) {
71981
+ const w = registry.getWidget(id);
71982
+ if (w) return w;
71983
+ }
71984
+ return null;
71985
+ }
71986
+
71952
71987
  /**
71953
71988
  * Scan a widget package directory for `.dash.js` component configs and
71954
71989
  * return the parsed configs. Used when the widget registry's cached
@@ -72055,7 +72090,7 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
72055
72090
 
72056
72091
  // 2. Look up widget in local registry
72057
72092
  const registry = widgetRegistryModule.getWidgetRegistry();
72058
- const widget = registry.getWidget(packageId);
72093
+ const widget = findWidget(registry, packageId);
72059
72094
  if (!widget || !widget.path) {
72060
72095
  return {
72061
72096
  success: false,
@@ -72181,7 +72216,7 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
72181
72216
  async function inspectWidgetPackage$1(packageId) {
72182
72217
  try {
72183
72218
  const registry = widgetRegistryModule.getWidgetRegistry();
72184
- const widget = registry.getWidget(packageId);
72219
+ const widget = findWidget(registry, packageId);
72185
72220
  if (!widget || !widget.path) {
72186
72221
  return {
72187
72222
  success: false,