@jxsuite/server 0.18.0 → 0.19.0
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/package.json +1 -1
- package/src/server.js +9 -0
- package/src/studio-api.js +6 -1
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -94,6 +94,15 @@ function resolveNpmPath(root, urlPath) {
|
|
|
94
94
|
// Fall back to direct path
|
|
95
95
|
const direct = join(pkgDir, subpath);
|
|
96
96
|
if (existsSync(direct)) return direct;
|
|
97
|
+
// CEM-relative: subpath may be relative to the custom elements manifest directory
|
|
98
|
+
try {
|
|
99
|
+
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
|
|
100
|
+
if (pkgJson.customElements) {
|
|
101
|
+
const cemDir = pkgJson.customElements.replace(/\/[^/]+$/, "");
|
|
102
|
+
const cemRelative = join(pkgDir, cemDir, subpath);
|
|
103
|
+
if (existsSync(cemRelative)) return cemRelative;
|
|
104
|
+
}
|
|
105
|
+
} catch {}
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
// Bare package (no subpath): resolve entry point
|
package/src/studio-api.js
CHANGED
|
@@ -817,7 +817,12 @@ export async function handleStudioApi(req, url, root, activeProjectRoot = null)
|
|
|
817
817
|
const { message } = await req.json();
|
|
818
818
|
if (!message || typeof message !== "string")
|
|
819
819
|
return Response.json({ error: "Missing message" }, { status: 400 });
|
|
820
|
-
const
|
|
820
|
+
const statusOut = await runGit(["status", "--porcelain"]);
|
|
821
|
+
const hasStaged = statusOut
|
|
822
|
+
.split("\n")
|
|
823
|
+
.some((l) => l.length > 0 && l[0] !== " " && l[0] !== "?");
|
|
824
|
+
const args = hasStaged ? ["commit", "-m", message] : ["commit", "-a", "-m", message];
|
|
825
|
+
const out = await runGit(args);
|
|
821
826
|
const hashMatch = out.match(/\[[\w/]+ ([a-f0-9]+)\]/);
|
|
822
827
|
return Response.json({ ok: true, hash: hashMatch?.[1] || "" });
|
|
823
828
|
}
|