@trops/dash-core 0.1.412 → 0.1.413
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.
- package/dist/electron/index.js +68 -8
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +7 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -63467,6 +63467,29 @@ function extractEventWiring$1(layout) {
|
|
|
63467
63467
|
return wiring;
|
|
63468
63468
|
}
|
|
63469
63469
|
|
|
63470
|
+
/**
|
|
63471
|
+
* Strip a `<scope>/` or `@<scope>/` prefix from a potentially-scoped
|
|
63472
|
+
* package name. Widgets installed from the registry carry
|
|
63473
|
+
* `w.name = "@scope/pkg"` alongside `w.scope = "scope"`; downstream
|
|
63474
|
+
* code builds `${scope}/${packageName}` for display and for registry
|
|
63475
|
+
* keys, so `packageName` must be the bare name or the scope doubles
|
|
63476
|
+
* (e.g. `@trops/@ai-built/pipeline` instead of `@trops/pipeline`).
|
|
63477
|
+
*
|
|
63478
|
+
* @param {string} fullName Potentially scoped (e.g. "@ai-built/pipeline" or "ai-built/pipeline")
|
|
63479
|
+
* @param {string} scope Scope to strip (e.g. "ai-built" or "@ai-built")
|
|
63480
|
+
* @returns {string} The bare package name
|
|
63481
|
+
*/
|
|
63482
|
+
function stripScopePrefix(fullName, scope) {
|
|
63483
|
+
if (!fullName) return fullName || "";
|
|
63484
|
+
if (!scope) return fullName;
|
|
63485
|
+
const bareScope = scope.startsWith("@") ? scope.slice(1) : scope;
|
|
63486
|
+
const variants = [`@${bareScope}/`, `${bareScope}/`];
|
|
63487
|
+
for (const v of variants) {
|
|
63488
|
+
if (fullName.startsWith(v)) return fullName.slice(v.length);
|
|
63489
|
+
}
|
|
63490
|
+
return fullName;
|
|
63491
|
+
}
|
|
63492
|
+
|
|
63470
63493
|
/**
|
|
63471
63494
|
* Build the widget dependencies array from component names and
|
|
63472
63495
|
* installed widget metadata.
|
|
@@ -63508,7 +63531,9 @@ function buildWidgetDependencies$1(
|
|
|
63508
63531
|
for (const w of installedWidgets) {
|
|
63509
63532
|
if (w.componentNames && w.componentNames.includes(name)) {
|
|
63510
63533
|
if (!scope && w.scope) scope = w.scope;
|
|
63511
|
-
if (!packageName || packageName === name)
|
|
63534
|
+
if (!packageName || packageName === name) {
|
|
63535
|
+
packageName = stripScopePrefix(w.name, w.scope || scope) || "";
|
|
63536
|
+
}
|
|
63512
63537
|
version = w.version || "*";
|
|
63513
63538
|
author =
|
|
63514
63539
|
typeof w.author === "string" ? w.author : w.author?.name || "";
|
|
@@ -63521,8 +63546,9 @@ function buildWidgetDependencies$1(
|
|
|
63521
63546
|
if (componentConfigs && componentConfigs[name]) {
|
|
63522
63547
|
const config = componentConfigs[name];
|
|
63523
63548
|
if (!scope && config.scope) scope = config.scope;
|
|
63524
|
-
if ((!packageName || packageName === name) && config.packageName)
|
|
63525
|
-
packageName = config.packageName;
|
|
63549
|
+
if ((!packageName || packageName === name) && config.packageName) {
|
|
63550
|
+
packageName = stripScopePrefix(config.packageName, scope);
|
|
63551
|
+
}
|
|
63526
63552
|
if (config.id && !scope) {
|
|
63527
63553
|
const idParts = config.id.split(".");
|
|
63528
63554
|
if (idParts.length === 3) {
|
|
@@ -73193,7 +73219,38 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
|
|
|
73193
73219
|
}
|
|
73194
73220
|
}
|
|
73195
73221
|
|
|
73196
|
-
// 5.
|
|
73222
|
+
// 5. Normalize dash.json's author field. The AI Widget Builder
|
|
73223
|
+
// scaffolds new @ai-built/* widgets with `author: "AI Assistant"`
|
|
73224
|
+
// as the placeholder, which ships unchanged to the registry and
|
|
73225
|
+
// is what installers see under the package's author — regardless
|
|
73226
|
+
// of who actually published it. If dash.json exists and its
|
|
73227
|
+
// author is blank or that placeholder, rewrite with the
|
|
73228
|
+
// publisher's registry display name (or username) before we zip
|
|
73229
|
+
// the package. Any other user-set author is preserved.
|
|
73230
|
+
const authorOverride =
|
|
73231
|
+
(options.authorName && options.authorName.trim()) ||
|
|
73232
|
+
profile?.displayName ||
|
|
73233
|
+
profile?.username ||
|
|
73234
|
+
"";
|
|
73235
|
+
if (authorOverride && fs.existsSync(dashJsonPath)) {
|
|
73236
|
+
try {
|
|
73237
|
+
const dashJson = JSON.parse(fs.readFileSync(dashJsonPath, "utf8"));
|
|
73238
|
+
const current = (dashJson.author || "").trim();
|
|
73239
|
+
const isPlaceholder = !current || current === "AI Assistant";
|
|
73240
|
+
if (isPlaceholder && dashJson.author !== authorOverride) {
|
|
73241
|
+
dashJson.author = authorOverride;
|
|
73242
|
+
fs.writeFileSync(
|
|
73243
|
+
dashJsonPath,
|
|
73244
|
+
JSON.stringify(dashJson, null, 2) + "\n",
|
|
73245
|
+
);
|
|
73246
|
+
}
|
|
73247
|
+
} catch {
|
|
73248
|
+
// Best-effort only — a malformed dash.json will surface later
|
|
73249
|
+
// during manifest generation with a clearer error.
|
|
73250
|
+
}
|
|
73251
|
+
}
|
|
73252
|
+
|
|
73253
|
+
// 6. Build manifest using the widget's component configs. The
|
|
73197
73254
|
// registry cache may be missing widgets (orphaned / locally-
|
|
73198
73255
|
// registered packages), so fall back to scanning the package's
|
|
73199
73256
|
// .dash.js files from disk.
|
|
@@ -73217,24 +73274,27 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
|
|
|
73217
73274
|
tags: options.tags,
|
|
73218
73275
|
icon: options.icon,
|
|
73219
73276
|
category: options.category,
|
|
73220
|
-
authorName
|
|
73277
|
+
// Prefer the caller-supplied authorName; otherwise fall back to
|
|
73278
|
+
// the publisher's registry profile so the manifest author matches
|
|
73279
|
+
// the (now-rewritten) dash.json we just zipped.
|
|
73280
|
+
authorName: options.authorName || authorOverride || undefined,
|
|
73221
73281
|
appOrigin: appId,
|
|
73222
73282
|
});
|
|
73223
73283
|
|
|
73224
|
-
//
|
|
73284
|
+
// 7. Zip the widget directory to a temp file
|
|
73225
73285
|
const zipName = `widget-${manifest.scope}-${manifest.name}-v${manifest.version}.zip`;
|
|
73226
73286
|
const zipPath = path.join(app.getPath("temp"), zipName);
|
|
73227
73287
|
const zip = new AdmZip();
|
|
73228
73288
|
addDirToZip(zip, widget.path);
|
|
73229
73289
|
zip.writeZip(zipPath);
|
|
73230
73290
|
|
|
73231
|
-
//
|
|
73291
|
+
// 8. Publish to registry
|
|
73232
73292
|
const registryResult = await registryApiController$1.publishToRegistry(
|
|
73233
73293
|
zipPath,
|
|
73234
73294
|
manifest,
|
|
73235
73295
|
);
|
|
73236
73296
|
|
|
73237
|
-
//
|
|
73297
|
+
// 9. On failure: revert package.json (if we bumped) and surface details
|
|
73238
73298
|
if (!registryResult.success) {
|
|
73239
73299
|
if (newVersion !== previousVersion) {
|
|
73240
73300
|
try {
|