@agimon-ai/po-style-system-tooling 0.2.14-alpha.17 → 0.2.14-alpha.19
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/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +26 -7
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +26 -7
- package/dist/{stdio-Ct8hi-0t.mjs → stdio-BSPlpcZN.mjs} +4 -2
- package/dist/{stdio-C3M-wkpx.cjs → stdio-DZTgEb3-.cjs} +4 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as resolveStyleSystemThemePath, B as STYLE_SYSTEM_TYPES, F as TailwindCSSClassesService, P as DEFAULT_STYLE_SYSTEM_CONFIG, a as STYLE_SYSTEM_CLI_NAME, i as createServer$1, o as STYLE_SYSTEM_VERSION, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, w as getAppDesignSystemConfig, y as getBundlerServiceFromConfig, z as log } from "./stdio-
|
|
2
|
+
import { A as resolveStyleSystemThemePath, B as STYLE_SYSTEM_TYPES, F as TailwindCSSClassesService, P as DEFAULT_STYLE_SYSTEM_CONFIG, a as STYLE_SYSTEM_CLI_NAME, i as createServer$1, o as STYLE_SYSTEM_VERSION, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, w as getAppDesignSystemConfig, y as getBundlerServiceFromConfig, z as log } from "./stdio-BSPlpcZN.mjs";
|
|
3
3
|
import { promises } from "node:fs";
|
|
4
4
|
import path, { join } from "node:path";
|
|
5
5
|
import { z } from "zod";
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_stdio = require("./stdio-
|
|
2
|
+
const require_stdio = require("./stdio-DZTgEb3-.cjs");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_stdio.__toESM(node_path, 1);
|
|
@@ -146,6 +146,11 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
146
146
|
if (bundler.isServerRunning()) await bundler.cleanup();
|
|
147
147
|
await bundler.startDevServer(resolved);
|
|
148
148
|
};
|
|
149
|
+
const reset = async () => {
|
|
150
|
+
const open = browser;
|
|
151
|
+
browser = void 0;
|
|
152
|
+
await Promise.allSettled([open?.then((instance) => instance.close()), ...[...bundlers.values()].map((pending) => pending.then((bundler) => bundler.cleanup()))]);
|
|
153
|
+
};
|
|
149
154
|
const run = async (tool, input) => {
|
|
150
155
|
if (disposed) throw new Error("The story renderer is shut down.");
|
|
151
156
|
if (workspaceRoot && typeof input.appPath === "string") {
|
|
@@ -156,9 +161,20 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
156
161
|
appPath
|
|
157
162
|
};
|
|
158
163
|
}
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
164
|
+
const visualAppPath = tool === "get_component_visual" && typeof input.appPath === "string" ? input.appPath : void 0;
|
|
165
|
+
const execute = async () => {
|
|
166
|
+
if (visualAppPath) await ensureDevServer(visualAppPath);
|
|
167
|
+
const result = await container.get(WARM_RENDERER_TOOLS[tool]).execute(input);
|
|
168
|
+
return {
|
|
169
|
+
result,
|
|
170
|
+
text: result.content.flatMap((item) => item.type === "text" && item.text ? [item.text] : []).join("\n\n")
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
let { result, text } = await execute();
|
|
174
|
+
if (visualAppPath && result.isError && text.includes("Failed to render component")) {
|
|
175
|
+
await reset();
|
|
176
|
+
({result, text} = await execute());
|
|
177
|
+
}
|
|
162
178
|
const images = [];
|
|
163
179
|
if (tool === "get_component_visual" && !result.isError) {
|
|
164
180
|
const imagePath = /"imagePath":\s*"([^"]+)"/u.exec(text)?.[1];
|
|
@@ -179,12 +195,15 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
179
195
|
queue = next.catch(() => void 0);
|
|
180
196
|
return next;
|
|
181
197
|
},
|
|
198
|
+
restart() {
|
|
199
|
+
const next = queue.then(reset);
|
|
200
|
+
queue = next.catch(() => void 0);
|
|
201
|
+
return next;
|
|
202
|
+
},
|
|
182
203
|
async dispose() {
|
|
183
204
|
disposed = true;
|
|
184
205
|
await queue;
|
|
185
|
-
|
|
186
|
-
browser = void 0;
|
|
187
|
-
await Promise.allSettled([open?.then((instance) => instance.close()), ...[...bundlers.values()].map((pending) => pending.then((bundler) => bundler.cleanup()))]);
|
|
206
|
+
await reset();
|
|
188
207
|
}
|
|
189
208
|
};
|
|
190
209
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2086,6 +2086,8 @@ interface WarmRendererResult {
|
|
|
2086
2086
|
interface WarmStoryRenderer {
|
|
2087
2087
|
/** Runs one tool. Calls are serialized: the dev server serves one app at a time. */
|
|
2088
2088
|
call(tool: WarmRendererToolName, input: Record<string, unknown>): Promise<WarmRendererResult>;
|
|
2089
|
+
/** Closes the browser and dev servers; the next render starts fresh ones. */
|
|
2090
|
+
restart(): Promise<void>;
|
|
2089
2091
|
dispose(): Promise<void>;
|
|
2090
2092
|
}
|
|
2091
2093
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -2086,6 +2086,8 @@ interface WarmRendererResult {
|
|
|
2086
2086
|
interface WarmStoryRenderer {
|
|
2087
2087
|
/** Runs one tool. Calls are serialized: the dev server serves one app at a time. */
|
|
2088
2088
|
call(tool: WarmRendererToolName, input: Record<string, unknown>): Promise<WarmRendererResult>;
|
|
2089
|
+
/** Closes the browser and dev servers; the next render starts fresh ones. */
|
|
2090
|
+
restart(): Promise<void>;
|
|
2089
2091
|
dispose(): Promise<void>;
|
|
2090
2092
|
}
|
|
2091
2093
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as resolveStyleSystemThemePath, B as STYLE_SYSTEM_TYPES, C as launchBrowserWithFallback, D as resetStyleSystemConfigCache, E as hasStyleSystemProjectConfig, F as TailwindCSSClassesService, I as BaseCSSClassesService, L as TemplatesManagerService, M as StoriesIndexService, N as CSSClassesServiceFactory, O as resolveAppDesignSystemConfig, P as DEFAULT_STYLE_SYSTEM_CONFIG, R as isContained, S as BaseBundlerService, T as getSharedComponentTags, _ as createDefaultBundlerService, b as ViteReactNativeBundlerService, c as createStyleSystemModule, d as GetComponentVisualTool, f as GetCSSClassesTool, g as ThemeService, h as ComponentRendererService, i as createServer, j as MAX_STYLE_SYSTEM_VIEWPORT_DIMENSION, k as StyleSystemConfigLoader, l as ListAppComponentsTool, m as GetUiComponentService, n as extractCustomTokenNames, p as ListThemesTool, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, u as ListSharedComponentsTool, v as getBundlerService, w as getAppDesignSystemConfig, x as ViteReactBundlerService, y as getBundlerServiceFromConfig } from "./stdio-
|
|
1
|
+
import { A as resolveStyleSystemThemePath, B as STYLE_SYSTEM_TYPES, C as launchBrowserWithFallback, D as resetStyleSystemConfigCache, E as hasStyleSystemProjectConfig, F as TailwindCSSClassesService, I as BaseCSSClassesService, L as TemplatesManagerService, M as StoriesIndexService, N as CSSClassesServiceFactory, O as resolveAppDesignSystemConfig, P as DEFAULT_STYLE_SYSTEM_CONFIG, R as isContained, S as BaseBundlerService, T as getSharedComponentTags, _ as createDefaultBundlerService, b as ViteReactNativeBundlerService, c as createStyleSystemModule, d as GetComponentVisualTool, f as GetCSSClassesTool, g as ThemeService, h as ComponentRendererService, i as createServer, j as MAX_STYLE_SYSTEM_VIEWPORT_DIMENSION, k as StyleSystemConfigLoader, l as ListAppComponentsTool, m as GetUiComponentService, n as extractCustomTokenNames, p as ListThemesTool, r as generateRestrictedClassesConfig, s as createContainer, t as StdioTransportHandler, u as ListSharedComponentsTool, v as getBundlerService, w as getAppDesignSystemConfig, x as ViteReactBundlerService, y as getBundlerServiceFromConfig } from "./stdio-BSPlpcZN.mjs";
|
|
2
2
|
import { promises } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -144,6 +144,11 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
144
144
|
if (bundler.isServerRunning()) await bundler.cleanup();
|
|
145
145
|
await bundler.startDevServer(resolved);
|
|
146
146
|
};
|
|
147
|
+
const reset = async () => {
|
|
148
|
+
const open = browser;
|
|
149
|
+
browser = void 0;
|
|
150
|
+
await Promise.allSettled([open?.then((instance) => instance.close()), ...[...bundlers.values()].map((pending) => pending.then((bundler) => bundler.cleanup()))]);
|
|
151
|
+
};
|
|
147
152
|
const run = async (tool, input) => {
|
|
148
153
|
if (disposed) throw new Error("The story renderer is shut down.");
|
|
149
154
|
if (workspaceRoot && typeof input.appPath === "string") {
|
|
@@ -154,9 +159,20 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
154
159
|
appPath
|
|
155
160
|
};
|
|
156
161
|
}
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
162
|
+
const visualAppPath = tool === "get_component_visual" && typeof input.appPath === "string" ? input.appPath : void 0;
|
|
163
|
+
const execute = async () => {
|
|
164
|
+
if (visualAppPath) await ensureDevServer(visualAppPath);
|
|
165
|
+
const result = await container.get(WARM_RENDERER_TOOLS[tool]).execute(input);
|
|
166
|
+
return {
|
|
167
|
+
result,
|
|
168
|
+
text: result.content.flatMap((item) => item.type === "text" && item.text ? [item.text] : []).join("\n\n")
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
let { result, text } = await execute();
|
|
172
|
+
if (visualAppPath && result.isError && text.includes("Failed to render component")) {
|
|
173
|
+
await reset();
|
|
174
|
+
({result, text} = await execute());
|
|
175
|
+
}
|
|
160
176
|
const images = [];
|
|
161
177
|
if (tool === "get_component_visual" && !result.isError) {
|
|
162
178
|
const imagePath = /"imagePath":\s*"([^"]+)"/u.exec(text)?.[1];
|
|
@@ -177,12 +193,15 @@ function createWarmStoryRenderer(options = {}) {
|
|
|
177
193
|
queue = next.catch(() => void 0);
|
|
178
194
|
return next;
|
|
179
195
|
},
|
|
196
|
+
restart() {
|
|
197
|
+
const next = queue.then(reset);
|
|
198
|
+
queue = next.catch(() => void 0);
|
|
199
|
+
return next;
|
|
200
|
+
},
|
|
180
201
|
async dispose() {
|
|
181
202
|
disposed = true;
|
|
182
203
|
await queue;
|
|
183
|
-
|
|
184
|
-
browser = void 0;
|
|
185
|
-
await Promise.allSettled([open?.then((instance) => instance.close()), ...[...bundlers.values()].map((pending) => pending.then((bundler) => bundler.cleanup()))]);
|
|
204
|
+
await reset();
|
|
186
205
|
}
|
|
187
206
|
};
|
|
188
207
|
}
|
|
@@ -1049,7 +1049,9 @@ let StoriesIndexService = class StoriesIndexService {
|
|
|
1049
1049
|
this.componentFileIndex.set(path.resolve(component.filePath), component);
|
|
1050
1050
|
}
|
|
1051
1051
|
parseStoryFile(filePath, content, fileHash) {
|
|
1052
|
-
const
|
|
1052
|
+
const alias = /^export\s+default\s+([A-Za-z_$][\w$]*)\s*;?\s*$/m.exec(content)?.[1];
|
|
1053
|
+
const parsable = alias ? content.replace(new RegExp(`^export\\s+(const|let|var)\\s+(${alias.replaceAll("$", "\\$")})\\b`, "m"), "$1 $2") : content;
|
|
1054
|
+
const csf = loadCsf(parsable, {
|
|
1053
1055
|
fileName: filePath,
|
|
1054
1056
|
makeTitle: (title) => title
|
|
1055
1057
|
});
|
|
@@ -4724,7 +4726,7 @@ function createContainer(options) {
|
|
|
4724
4726
|
}
|
|
4725
4727
|
//#endregion
|
|
4726
4728
|
//#region package.json
|
|
4727
|
-
var version = "0.2.14-alpha.
|
|
4729
|
+
var version = "0.2.14-alpha.19";
|
|
4728
4730
|
//#endregion
|
|
4729
4731
|
//#region src/metadata.ts
|
|
4730
4732
|
const STYLE_SYSTEM_CLI_NAME = "style-system";
|
|
@@ -1076,7 +1076,9 @@ let StoriesIndexService = class StoriesIndexService {
|
|
|
1076
1076
|
this.componentFileIndex.set(node_path.default.resolve(component.filePath), component);
|
|
1077
1077
|
}
|
|
1078
1078
|
parseStoryFile(filePath, content, fileHash) {
|
|
1079
|
-
const
|
|
1079
|
+
const alias = /^export\s+default\s+([A-Za-z_$][\w$]*)\s*;?\s*$/m.exec(content)?.[1];
|
|
1080
|
+
const parsable = alias ? content.replace(new RegExp(`^export\\s+(const|let|var)\\s+(${alias.replaceAll("$", "\\$")})\\b`, "m"), "$1 $2") : content;
|
|
1081
|
+
const csf = (0, storybook_internal_csf_tools.loadCsf)(parsable, {
|
|
1080
1082
|
fileName: filePath,
|
|
1081
1083
|
makeTitle: (title) => title
|
|
1082
1084
|
});
|
|
@@ -4751,7 +4753,7 @@ function createContainer(options) {
|
|
|
4751
4753
|
}
|
|
4752
4754
|
//#endregion
|
|
4753
4755
|
//#region package.json
|
|
4754
|
-
var version = "0.2.14-alpha.
|
|
4756
|
+
var version = "0.2.14-alpha.19";
|
|
4755
4757
|
//#endregion
|
|
4756
4758
|
//#region src/metadata.ts
|
|
4757
4759
|
const STYLE_SYSTEM_CLI_NAME = "style-system";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-style-system-tooling",
|
|
3
|
-
"version": "0.2.14-alpha.
|
|
3
|
+
"version": "0.2.14-alpha.19",
|
|
4
4
|
"description": "MCP server for exploring themes, Tailwind CSS classes, and UI components from Storybook with standalone component rendering capabilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|