rafters 0.0.24 → 0.0.26
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/index.js +32 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61341,6 +61341,38 @@ function studioApiPlugin() {
|
|
|
61341
61341
|
next();
|
|
61342
61342
|
return;
|
|
61343
61343
|
}
|
|
61344
|
+
if ((pathname === "/api/" || pathname === "/api") && req.method === "GET") {
|
|
61345
|
+
res.setHeader("Content-Type", "application/json");
|
|
61346
|
+
res.end(
|
|
61347
|
+
JSON.stringify({
|
|
61348
|
+
name: "Rafters Studio API",
|
|
61349
|
+
initialized,
|
|
61350
|
+
tokenCount: registry2.list().length,
|
|
61351
|
+
rules: {
|
|
61352
|
+
whyGate: "Every POST to /api/tokens/:name requires userOverride.reason.",
|
|
61353
|
+
gets: "Returns full Token with all intelligence metadata.",
|
|
61354
|
+
sets: "Value + reason in. API fills the Token shape. CSS updates via HMR.",
|
|
61355
|
+
colors: "POST /api/color/build with OKLCH to get a ColorValue."
|
|
61356
|
+
},
|
|
61357
|
+
endpoints: {
|
|
61358
|
+
"GET /api/tokens": "All tokens (optional ?namespace= filter)",
|
|
61359
|
+
"GET /api/tokens/:name": "One token with full data",
|
|
61360
|
+
"POST /api/tokens/:name": "Update token (namespace-validated patch)",
|
|
61361
|
+
"POST /api/tokens": "Batch update tokens",
|
|
61362
|
+
"POST /api/color/build": "OKLCH -> full ColorValue",
|
|
61363
|
+
"POST /api/shutdown": "Gracefully stop the studio"
|
|
61364
|
+
}
|
|
61365
|
+
})
|
|
61366
|
+
);
|
|
61367
|
+
return;
|
|
61368
|
+
}
|
|
61369
|
+
if (pathname === "/api/shutdown" && req.method === "POST") {
|
|
61370
|
+
res.setHeader("Content-Type", "application/json");
|
|
61371
|
+
res.end(JSON.stringify({ ok: true, message: "Shutting down" }));
|
|
61372
|
+
console.log("[rafters] Studio shutting down...");
|
|
61373
|
+
setTimeout(() => server.close(), 100);
|
|
61374
|
+
return;
|
|
61375
|
+
}
|
|
61344
61376
|
if (pathname === "/api/color/build") {
|
|
61345
61377
|
res.setHeader("Content-Type", "application/json");
|
|
61346
61378
|
if (req.method !== "POST") {
|