@trops/dash-core 0.1.613 → 0.1.615

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.
@@ -74127,6 +74127,43 @@ function addDirToZip(zip, absDir, relDir = "") {
74127
74127
  }
74128
74128
  }
74129
74129
 
74130
+ /**
74131
+ * Persist a version string to a widget package's metadata files.
74132
+ *
74133
+ * Writes the version to BOTH package.json and dash.json when each is present —
74134
+ * never one or the other. They must stay in sync: the registry manifest version
74135
+ * is generated from package.json, while the installed/on-disk version is read
74136
+ * back from dash.json (widgetRegistry.js `enrichEntryFromDisk`). Bumping only
74137
+ * package.json left dash.json stale, so the installed version never advanced —
74138
+ * the registry update check prompted forever and the post-install verify failed
74139
+ * with "on-disk version is X (expected Y)". Each file is best-effort: a
74140
+ * malformed dash.json is skipped (it surfaces later during manifest generation).
74141
+ *
74142
+ * @param {string} pkgJsonPath - Absolute path to the package's package.json
74143
+ * @param {string} dashJsonPath - Absolute path to the package's dash.json
74144
+ * @param {string} version - Version string to write to both files
74145
+ */
74146
+ function writeWidgetMetadataVersion(pkgJsonPath, dashJsonPath, version) {
74147
+ if (fs$1.existsSync(pkgJsonPath)) {
74148
+ try {
74149
+ const pkg = JSON.parse(fs$1.readFileSync(pkgJsonPath, "utf8"));
74150
+ pkg.version = version;
74151
+ fs$1.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2) + "\n");
74152
+ } catch {
74153
+ /* best-effort */
74154
+ }
74155
+ }
74156
+ if (fs$1.existsSync(dashJsonPath)) {
74157
+ try {
74158
+ const dash = JSON.parse(fs$1.readFileSync(dashJsonPath, "utf8"));
74159
+ dash.version = version;
74160
+ fs$1.writeFileSync(dashJsonPath, JSON.stringify(dash, null, 2) + "\n");
74161
+ } catch {
74162
+ /* best-effort */
74163
+ }
74164
+ }
74165
+ }
74166
+
74130
74167
  // ─── Orchestration ───────────────────────────────────────────────────────────
74131
74168
 
74132
74169
  /**
@@ -74253,17 +74290,14 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
74253
74290
  const newVersion = resolveNextVersion(previousVersion, options);
74254
74291
  if (newVersion !== previousVersion) {
74255
74292
  pkgJson.version = newVersion;
74256
- // Persist to whichever metadata file exists
74257
- if (fs$1.existsSync(pkgJsonPath)) {
74258
- fs$1.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + "\n");
74259
- } else if (fs$1.existsSync(dashJsonPath)) {
74260
- const dashJson = JSON.parse(fs$1.readFileSync(dashJsonPath, "utf8"));
74261
- dashJson.version = newVersion;
74262
- fs$1.writeFileSync(
74263
- dashJsonPath,
74264
- JSON.stringify(dashJson, null, 2) + "\n",
74265
- );
74266
- }
74293
+ // Persist the bump to BOTH metadata files when present — NOT one or the
74294
+ // other. The registry manifest version is read from package.json while
74295
+ // the installed/on-disk version is read back from dash.json
74296
+ // (widgetRegistry.js enrichEntryFromDisk). Bumping only package.json
74297
+ // left dash.json stale, so the installed version never advanced: the
74298
+ // registry update check prompted forever and the post-install verify
74299
+ // failed with "on-disk version is X (expected Y)".
74300
+ writeWidgetMetadataVersion(pkgJsonPath, dashJsonPath, newVersion);
74267
74301
  }
74268
74302
 
74269
74303
  // 5. Normalize dash.json's author field. The AI Widget Builder
@@ -74394,18 +74428,15 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
74394
74428
  manifest,
74395
74429
  );
74396
74430
 
74397
- // 9. On failure: revert package.json (if we bumped) and surface details
74431
+ // 9. On failure: revert package.json + dash.json (if we bumped) and surface details
74398
74432
  if (!registryResult.success) {
74399
74433
  if (newVersion !== previousVersion) {
74400
- try {
74401
- pkgJson.version = previousVersion;
74402
- fs$1.writeFileSync(
74403
- pkgJsonPath,
74404
- JSON.stringify(pkgJson, null, 2) + "\n",
74405
- );
74406
- } catch {
74407
- /* best effort */
74408
- }
74434
+ pkgJson.version = previousVersion;
74435
+ writeWidgetMetadataVersion(
74436
+ pkgJsonPath,
74437
+ dashJsonPath,
74438
+ previousVersion,
74439
+ );
74409
74440
  }
74410
74441
  return {
74411
74442
  success: false,
@@ -74506,6 +74537,7 @@ var widgetRegistryController = {
74506
74537
  prepareWidgetForPublish: prepareWidgetForPublish$1,
74507
74538
  inspectWidgetPackage: inspectWidgetPackage$1,
74508
74539
  scanWidgetDefaults: scanWidgetDefaults$1,
74540
+ writeWidgetMetadataVersion,
74509
74541
  };
74510
74542
 
74511
74543
  /**