@trops/dash-core 0.1.426 → 0.1.427

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.
@@ -28219,10 +28219,26 @@ var schedulerController_1 = schedulerController$2;
28219
28219
  try {
28220
28220
  const dashJsonPath = path.join(pkgPath, "dash.json");
28221
28221
  let widgetsMeta = [];
28222
+ // Drop non-object provider entries before caching. A sparse array
28223
+ // in a widget's dash.json (trailing comma, conditional include
28224
+ // that returned undefined) otherwise propagates into every renderer
28225
+ // useMemo that iterates `widget.providers` and crashes on
28226
+ // `p.providerClass`. Sanitizing at install/enrich time keeps the
28227
+ // in-process cache clean regardless of what shipped in the ZIP.
28228
+ const sanitizeWidget = (w) => {
28229
+ if (!w || typeof w !== "object") return w;
28230
+ if (!Array.isArray(w.providers)) return w;
28231
+ const clean = w.providers.filter((p) => p && typeof p === "object");
28232
+ return clean.length === w.providers.length
28233
+ ? w
28234
+ : { ...w, providers: clean };
28235
+ };
28222
28236
  if (fs.existsSync(dashJsonPath)) {
28223
28237
  try {
28224
28238
  const manifest = JSON.parse(fs.readFileSync(dashJsonPath, "utf8"));
28225
- if (Array.isArray(manifest.widgets)) widgetsMeta = manifest.widgets;
28239
+ if (Array.isArray(manifest.widgets)) {
28240
+ widgetsMeta = manifest.widgets.map(sanitizeWidget);
28241
+ }
28226
28242
  if (!entry.displayName && manifest.displayName)
28227
28243
  entry.displayName = manifest.displayName;
28228
28244
  if (!entry.description && manifest.description)
@@ -64712,11 +64728,19 @@ function requireWidgetPublishManifest () {
64712
64728
  const version = options.version || packageJson.version || "1.0.0";
64713
64729
  const visibility = options.visibility === "private" ? "private" : "public";
64714
64730
 
64731
+ // Drop falsy / non-object entries from a providers array before we
64732
+ // iterate or reshape it. `.dash.js` configs occasionally ship sparse
64733
+ // arrays (trailing commas, stripped comments, conditional includes
64734
+ // that returned undefined) and those used to crash every consumer
64735
+ // that iterated the array with `p.providerClass`. Publish-side
64736
+ // sanitization means installed packages never carry the bad entry.
64737
+ const sanitizeProviderList = (list) =>
64738
+ Array.isArray(list) ? list.filter((p) => p && typeof p === "object") : [];
64739
+
64715
64740
  const providerKeys = new Set();
64716
64741
  const providers = [];
64717
64742
  for (const cfg of widgetConfigs || []) {
64718
- if (!Array.isArray(cfg.providers)) continue;
64719
- for (const p of cfg.providers) {
64743
+ for (const p of sanitizeProviderList(cfg.providers)) {
64720
64744
  const key = `${p.type}:${p.providerClass || "mcp"}`;
64721
64745
  if (providerKeys.has(key)) continue;
64722
64746
  providerKeys.add(key);
@@ -64733,13 +64757,11 @@ function requireWidgetPublishManifest () {
64733
64757
  displayName: cfg.name || cfg.component,
64734
64758
  description: cfg.description || "",
64735
64759
  icon: cfg.icon || "square",
64736
- providers: Array.isArray(cfg.providers)
64737
- ? cfg.providers.map((p) => ({
64738
- type: p.type,
64739
- required: p.required !== false,
64740
- providerClass: p.providerClass || "mcp",
64741
- }))
64742
- : [],
64760
+ providers: sanitizeProviderList(cfg.providers).map((p) => ({
64761
+ type: p.type,
64762
+ required: p.required !== false,
64763
+ providerClass: p.providerClass || "mcp",
64764
+ })),
64743
64765
  }));
64744
64766
 
64745
64767
  return {