@agimon-ai/po-style-system-tooling 0.2.14-alpha.28 → 0.2.14-alpha.29

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_stdio = require("./stdio-CzypeTki.cjs");
2
+ const require_stdio = require("./stdio-Dxe1iygw.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);
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-8Q9kNGmc.mjs";
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-B12YYINp.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-CzypeTki.cjs");
2
+ const require_stdio = require("./stdio-Dxe1iygw.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);
@@ -191,9 +191,12 @@ const WARM_RENDERER_TOOLS = {
191
191
  list_shared_components: require_stdio.STYLE_SYSTEM_TYPES.ListSharedComponentsTool,
192
192
  list_app_components: require_stdio.STYLE_SYSTEM_TYPES.ListAppComponentsTool
193
193
  };
194
+ /** Long enough to cover an edit-and-render loop; an idle dev server still holds its module graph and watchers. */
195
+ const IDLE_CLOSE_MS = 6e5;
194
196
  /**
195
197
  * Keeps one browser and one Vite dev server warm across renders, so a render after the first
196
198
  * skips the browser launch and the static build. Rendered screenshots come back as base64.
199
+ * After IDLE_CLOSE_MS without a call it stops them; the next call starts them again.
197
200
  */
198
201
  function createWarmStoryRenderer(options = {}) {
199
202
  const workspaceRoot = options.workspaceRoot ? node_path.default.resolve(options.workspaceRoot) : void 0;
@@ -221,6 +224,8 @@ function createWarmStoryRenderer(options = {}) {
221
224
  let queue = Promise.resolve();
222
225
  let disposed = false;
223
226
  let captures = 0;
227
+ let inFlight = 0;
228
+ let idleTimer;
224
229
  const ensureDevServer = async (appPath) => {
225
230
  const resolved = node_path.default.resolve(workspaceRoot ?? ".", appPath);
226
231
  const { config } = await configLoader.resolveProject(resolved);
@@ -291,19 +296,30 @@ function createWarmStoryRenderer(options = {}) {
291
296
  isError: result.isError === true
292
297
  };
293
298
  };
299
+ const enqueue = (task) => {
300
+ const next = queue.then(task);
301
+ queue = next.catch(() => void 0);
302
+ return next;
303
+ };
304
+ const armIdleClose = () => {
305
+ if (--inFlight > 0 || disposed) return;
306
+ idleTimer = setTimeout(() => void enqueue(reset), IDLE_CLOSE_MS);
307
+ idleTimer.unref();
308
+ };
294
309
  return {
295
310
  call(tool, input) {
296
- const next = queue.then(() => run(tool, input));
297
- queue = next.catch(() => void 0);
311
+ clearTimeout(idleTimer);
312
+ inFlight++;
313
+ const next = enqueue(() => run(tool, input));
314
+ next.then(armIdleClose, armIdleClose);
298
315
  return next;
299
316
  },
300
317
  restart() {
301
- const next = queue.then(reset);
302
- queue = next.catch(() => void 0);
303
- return next;
318
+ return enqueue(reset);
304
319
  },
305
320
  async dispose() {
306
321
  disposed = true;
322
+ clearTimeout(idleTimer);
307
323
  await queue;
308
324
  await reset();
309
325
  }
package/dist/index.d.cts CHANGED
@@ -2121,6 +2121,7 @@ interface WarmStoryRenderer {
2121
2121
  /**
2122
2122
  * Keeps one browser and one Vite dev server warm across renders, so a render after the first
2123
2123
  * skips the browser launch and the static build. Rendered screenshots come back as base64.
2124
+ * After IDLE_CLOSE_MS without a call it stops them; the next call starts them again.
2124
2125
  */
2125
2126
  export declare function createWarmStoryRenderer(options?: {
2126
2127
  workspaceRoot?: string;
package/dist/index.d.mts CHANGED
@@ -2121,6 +2121,7 @@ interface WarmStoryRenderer {
2121
2121
  /**
2122
2122
  * Keeps one browser and one Vite dev server warm across renders, so a render after the first
2123
2123
  * skips the browser launch and the static build. Rendered screenshots come back as base64.
2124
+ * After IDLE_CLOSE_MS without a call it stops them; the next call starts them again.
2124
2125
  */
2125
2126
  export declare function createWarmStoryRenderer(options?: {
2126
2127
  workspaceRoot?: string;
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, z as log } from "./stdio-8Q9kNGmc.mjs";
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, z as log } from "./stdio-B12YYINp.mjs";
2
2
  import { promises } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -189,9 +189,12 @@ const WARM_RENDERER_TOOLS = {
189
189
  list_shared_components: STYLE_SYSTEM_TYPES.ListSharedComponentsTool,
190
190
  list_app_components: STYLE_SYSTEM_TYPES.ListAppComponentsTool
191
191
  };
192
+ /** Long enough to cover an edit-and-render loop; an idle dev server still holds its module graph and watchers. */
193
+ const IDLE_CLOSE_MS = 6e5;
192
194
  /**
193
195
  * Keeps one browser and one Vite dev server warm across renders, so a render after the first
194
196
  * skips the browser launch and the static build. Rendered screenshots come back as base64.
197
+ * After IDLE_CLOSE_MS without a call it stops them; the next call starts them again.
195
198
  */
196
199
  function createWarmStoryRenderer(options = {}) {
197
200
  const workspaceRoot = options.workspaceRoot ? path.resolve(options.workspaceRoot) : void 0;
@@ -219,6 +222,8 @@ function createWarmStoryRenderer(options = {}) {
219
222
  let queue = Promise.resolve();
220
223
  let disposed = false;
221
224
  let captures = 0;
225
+ let inFlight = 0;
226
+ let idleTimer;
222
227
  const ensureDevServer = async (appPath) => {
223
228
  const resolved = path.resolve(workspaceRoot ?? ".", appPath);
224
229
  const { config } = await configLoader.resolveProject(resolved);
@@ -289,19 +294,30 @@ function createWarmStoryRenderer(options = {}) {
289
294
  isError: result.isError === true
290
295
  };
291
296
  };
297
+ const enqueue = (task) => {
298
+ const next = queue.then(task);
299
+ queue = next.catch(() => void 0);
300
+ return next;
301
+ };
302
+ const armIdleClose = () => {
303
+ if (--inFlight > 0 || disposed) return;
304
+ idleTimer = setTimeout(() => void enqueue(reset), IDLE_CLOSE_MS);
305
+ idleTimer.unref();
306
+ };
292
307
  return {
293
308
  call(tool, input) {
294
- const next = queue.then(() => run(tool, input));
295
- queue = next.catch(() => void 0);
309
+ clearTimeout(idleTimer);
310
+ inFlight++;
311
+ const next = enqueue(() => run(tool, input));
312
+ next.then(armIdleClose, armIdleClose);
296
313
  return next;
297
314
  },
298
315
  restart() {
299
- const next = queue.then(reset);
300
- queue = next.catch(() => void 0);
301
- return next;
316
+ return enqueue(reset);
302
317
  },
303
318
  async dispose() {
304
319
  disposed = true;
320
+ clearTimeout(idleTimer);
305
321
  await queue;
306
322
  await reset();
307
323
  }
@@ -4714,7 +4714,7 @@ function createContainer(options) {
4714
4714
  }
4715
4715
  //#endregion
4716
4716
  //#region package.json
4717
- var version = "0.2.14-alpha.28";
4717
+ var version = "0.2.14-alpha.29";
4718
4718
  //#endregion
4719
4719
  //#region src/metadata.ts
4720
4720
  const STYLE_SYSTEM_CLI_NAME = "style-system";
@@ -4742,7 +4742,7 @@ function createContainer(options) {
4742
4742
  }
4743
4743
  //#endregion
4744
4744
  //#region package.json
4745
- var version = "0.2.14-alpha.28";
4745
+ var version = "0.2.14-alpha.29";
4746
4746
  //#endregion
4747
4747
  //#region src/metadata.ts
4748
4748
  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.28",
3
+ "version": "0.2.14-alpha.29",
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",