@trops/dash-core 0.1.444 → 0.1.446

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.
@@ -27191,6 +27191,10 @@ var widgetRegistry$1 = {exports: {}};
27191
27191
 
27192
27192
  var dynamicWidgetLoader$3 = {exports: {}};
27193
27193
 
27194
+ function commonjsRequire(path) {
27195
+ throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
27196
+ }
27197
+
27194
27198
  /**
27195
27199
  * Widget Compiler
27196
27200
  *
@@ -27204,6 +27208,90 @@ var dynamicWidgetLoader$3 = {exports: {}};
27204
27208
  const fs$7 = require$$0$2;
27205
27209
  const path$b = require$$1$2;
27206
27210
 
27211
+ /**
27212
+ * Structured error thrown by compileWidget() when the underlying
27213
+ * esbuild spawn fails (typically ENOENT — the native helper binary is
27214
+ * missing on this arch in a packaged build). The renderer surfaces
27215
+ * `.code` + `.diagnostics` to give the user something actionable
27216
+ * instead of a raw "spawn ENOENT".
27217
+ */
27218
+ class WidgetCompileError extends Error {
27219
+ constructor(message, code, diagnostics) {
27220
+ super(message);
27221
+ this.name = "WidgetCompileError";
27222
+ this.code = code;
27223
+ this.diagnostics = diagnostics;
27224
+ }
27225
+ }
27226
+
27227
+ /**
27228
+ * Probe the on-disk state of esbuild + its arch-specific native helper.
27229
+ * Returns a flat object suitable for logging/UI display. Never throws.
27230
+ */
27231
+ function getEsbuildDiagnostics() {
27232
+ const diagnostics = {
27233
+ platform: process.platform,
27234
+ arch: process.arch,
27235
+ esbuildVersion: null,
27236
+ esbuildPackageDir: null,
27237
+ archPackage: `@esbuild/${process.platform}-${process.arch}`,
27238
+ nativeBinaryPath: null,
27239
+ nativeBinaryExists: false,
27240
+ };
27241
+
27242
+ try {
27243
+ const pkgJsonPath = require.resolve("esbuild/package.json");
27244
+ diagnostics.esbuildPackageDir = path$b.dirname(pkgJsonPath);
27245
+ diagnostics.esbuildVersion = commonjsRequire(pkgJsonPath).version;
27246
+ } catch (err) {
27247
+ diagnostics.esbuildResolveError = err.message;
27248
+ }
27249
+
27250
+ try {
27251
+ const archPkgJson = require.resolve(
27252
+ `${diagnostics.archPackage}/package.json`,
27253
+ );
27254
+ const archDir = path$b.dirname(archPkgJson);
27255
+ // esbuild's native binary on macOS/Linux is bin/esbuild;
27256
+ // on Windows it's esbuild.exe at the package root.
27257
+ const candidate =
27258
+ process.platform === "win32"
27259
+ ? path$b.join(archDir, "esbuild.exe")
27260
+ : path$b.join(archDir, "bin", "esbuild");
27261
+ diagnostics.nativeBinaryPath = candidate;
27262
+ diagnostics.nativeBinaryExists = fs$7.existsSync(candidate);
27263
+ } catch (err) {
27264
+ diagnostics.archResolveError = err.message;
27265
+ }
27266
+
27267
+ return diagnostics;
27268
+ }
27269
+
27270
+ /**
27271
+ * Quick liveness probe for the widget compiler. Runs a no-op
27272
+ * `esbuild.transform("")` so any missing-native-binary failure surfaces
27273
+ * before the user tries to compile a real widget. Returns
27274
+ * `{ ok, error?, code?, diagnostics }` — never throws.
27275
+ */
27276
+ async function healthCheck() {
27277
+ const diagnostics = getEsbuildDiagnostics();
27278
+ try {
27279
+ const esbuild = require("esbuild");
27280
+ await esbuild.transform("", { loader: "js" });
27281
+ return { ok: true, diagnostics };
27282
+ } catch (err) {
27283
+ return {
27284
+ ok: false,
27285
+ error: err.message,
27286
+ code:
27287
+ err.code === "ENOENT" || /spawn|ENOENT/i.test(err.message || "")
27288
+ ? "ESBUILD_SPAWN_FAILED"
27289
+ : "ESBUILD_UNAVAILABLE",
27290
+ diagnostics,
27291
+ };
27292
+ }
27293
+ }
27294
+
27207
27295
  /**
27208
27296
  * Find the widgets/ directory, handling nested ZIP extraction.
27209
27297
  *
@@ -27385,6 +27473,18 @@ async function compileWidget$1(widgetPath) {
27385
27473
  `[WidgetCompiler] Compilation failed for ${widgetPath}:`,
27386
27474
  error,
27387
27475
  );
27476
+ // ENOENT on the esbuild path means the native helper binary
27477
+ // wasn't found — usually a packaging issue (wrong arch in the
27478
+ // universal asar, asar-unpacked glob missing the arch package,
27479
+ // dev install never ran for the runtime arch). Wrap with
27480
+ // diagnostics so the UI can show something useful.
27481
+ if (error.code === "ENOENT" || /spawn|ENOENT/i.test(error.message || "")) {
27482
+ throw new WidgetCompileError(
27483
+ `Widget compiler unavailable: ${error.message}`,
27484
+ "ESBUILD_SPAWN_FAILED",
27485
+ getEsbuildDiagnostics(),
27486
+ );
27487
+ }
27388
27488
  throw error;
27389
27489
  } finally {
27390
27490
  // Clean up temporary entry file
@@ -27402,7 +27502,13 @@ async function compileWidget$1(widgetPath) {
27402
27502
  }
27403
27503
  }
27404
27504
 
27405
- var widgetCompiler$1 = { compileWidget: compileWidget$1, findWidgetsDir: findWidgetsDir$2 };
27505
+ var widgetCompiler$1 = {
27506
+ compileWidget: compileWidget$1,
27507
+ findWidgetsDir: findWidgetsDir$2,
27508
+ healthCheck,
27509
+ getEsbuildDiagnostics,
27510
+ WidgetCompileError,
27511
+ };
27406
27512
 
27407
27513
  /**
27408
27514
  * Dynamic Widget Loader
@@ -66642,6 +66748,7 @@ async function installDashboardFromRegistry$1(
66642
66748
  appId,
66643
66749
  packageName,
66644
66750
  widgetRegistry = null,
66751
+ installOptions = {},
66645
66752
  ) {
66646
66753
  try {
66647
66754
  // 1. Look up the dashboard package in the registry
@@ -66808,7 +66915,9 @@ async function installDashboardFromRegistry$1(
66808
66915
  };
66809
66916
  }
66810
66917
 
66811
- // 6. Delegate to shared import pipeline
66918
+ // 6. Delegate to shared import pipeline. User overrides (name /
66919
+ // menuId from the install-time options modal) are forwarded so
66920
+ // the workspace is named + filed where the user wants it.
66812
66921
  return await processDashboardConfig(
66813
66922
  win,
66814
66923
  appId,
@@ -66818,6 +66927,9 @@ async function installDashboardFromRegistry$1(
66818
66927
  source: "registry",
66819
66928
  registryPackage: packageName,
66820
66929
  installedVersion: registryPkg.version || null,
66930
+ name: installOptions.name,
66931
+ menuId: installOptions.menuId,
66932
+ themeKey: installOptions.themeKey,
66821
66933
  },
66822
66934
  );
66823
66935
  } catch (error) {
@@ -76431,12 +76543,19 @@ const dashboardConfigApi$2 = {
76431
76543
  *
76432
76544
  * @param {string} appId - Application identifier
76433
76545
  * @param {string} packageName - Registry package name
76546
+ * @param {Object} [options]
76547
+ * @param {string} [options.name] - Override the workspace name
76548
+ * (defaults to the publisher's name). Does NOT change the
76549
+ * published scope.
76550
+ * @param {string|number} [options.menuId] - Override the destination
76551
+ * folder. Defaults to the publisher's menuId.
76434
76552
  * @returns {Promise<Object>} Result with success, workspace, and summary
76435
76553
  */
76436
- installDashboardFromRegistry: (appId, packageName) =>
76554
+ installDashboardFromRegistry: (appId, packageName, options = {}) =>
76437
76555
  ipcRenderer$9.invoke(DASHBOARD_CONFIG_INSTALL, {
76438
76556
  appId,
76439
76557
  packageName,
76558
+ options,
76440
76559
  }),
76441
76560
 
76442
76561
  /**