@lowdefy/server-dev 0.0.0-experimental-20260925135632 → 0.0.0-experimental-20260925210809

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.
@@ -49,6 +49,7 @@ import devToolDefinitions, { INSTRUCTIONS } from './devToolDefinitions.js';
49
49
  import scaffoldPage from './scaffoldPage.js';
50
50
  import screenshotPage from './screenshotPage.js';
51
51
  import searchDocs from './searchDocs.js';
52
+ import searchIcons from './searchIcons.js';
52
53
  import waitForBuild from './waitForBuild.js';
53
54
 
54
55
  const logger = createLogger({ server: 'lowdefy-dev-mcp' });
@@ -306,6 +307,10 @@ function createDocsMcpServer({ origin, honoContext } = {}) {
306
307
 
307
308
  registerDevTool('lowdefy_search_docs', ({ query }) => textResult(searchDocs({ query })));
308
309
 
310
+ registerDevTool('lowdefy_search_icons', ({ query, limit }) =>
311
+ textResult(searchIcons({ query, limit }))
312
+ );
313
+
309
314
  registerDevTool('lowdefy_get_plugin_doc', ({ package: packageName }) => {
310
315
  const doc = getPluginDoc({ packageName });
311
316
  if (doc === null) {
@@ -48,6 +48,7 @@ const EXPECTED_TOOLS = [
48
48
  'lowdefy_get_examples',
49
49
  'lowdefy_get_doc',
50
50
  'lowdefy_search_docs',
51
+ 'lowdefy_search_icons',
51
52
  'lowdefy_get_plugin_doc',
52
53
  'lowdefy_build_status',
53
54
  'lowdefy_check',
@@ -24,7 +24,7 @@ import { z } from 'zod';
24
24
 
25
25
  const INSTRUCTIONS = `Lowdefy documentation and feedback server for this project. Lowdefy apps are YAML config composing blocks (UI), operators (logic), actions (event handlers), and connections/requests (data).
26
26
 
27
- Discovery workflow: start with lowdefy_overview. Use lowdefy_list_types with a kind to discover ALL installed blocks/operators/actions/connections/requests — never guess type names. Then lowdefy_get_schema and lowdefy_get_examples for the exact contract of a type, and lowdefy_get_doc / lowdefy_search_docs for concept documentation. lowdefy_list_plugins and lowdefy_get_plugin_doc cover this project's local plugin packages.
27
+ Discovery workflow: start with lowdefy_overview. Use lowdefy_list_types with a kind to discover ALL installed blocks/operators/actions/connections/requests — never guess type names. Then lowdefy_get_schema and lowdefy_get_examples for the exact contract of a type, and lowdefy_get_doc / lowdefy_search_docs for concept documentation. Icons: use lowdefy_search_icons and prefer semantic names (icon: edit), never emoji; in any HTML string use <i data-icon="edit"></i>, data-tooltip="…" and data-popover="…", ClickableHtml with data-event for clicks, <a data-page-id="page" data-url-query="k=v"> for in-app links (never a hard-coded href; data-new-tab, not target), and data-tag="success" / data-status="success" for statuses (never inline-styled pills), <time datetime="…" data-time="relative">, data-format="currency" data-currency="USD" on raw numbers, data-avatar="Name" (never an avatar image service), data-copy, data-truncate="2", data-tone="secondary" (never inline grey colours) and, in ClickableHtml, data-confirm="…" on destructive data-event elements; lowdefy_get_doc concepts/html-attributes lists them all. lowdefy_list_plugins and lowdefy_get_plugin_doc cover this project's local plugin packages.
28
28
 
29
29
  Push events: build results, server restarts and browser/server errors arrive as notifications/message from logger "lowdefy" (data.type is one of build, restart, client_error, server_error; a build event carries status, errors, warnings and stale). Act on them without polling — lowdefy_build_status remains the full picture.
30
30
 
@@ -339,6 +339,15 @@ const devToolDefinitions = {
339
339
  },
340
340
  },
341
341
 
342
+ lowdefy_search_icons: {
343
+ description:
344
+ 'Search icon names before using one — never guess. Returns matching semantic names (edit, delete, warning, … and this app\'s theme.icons.aliases) and react-icons names (Lucide first). Use the result in any icon property (icon: edit) or in HTML as <i data-icon="edit"></i>.',
345
+ inputSchema: {
346
+ query: z.string().describe('What the icon shows, e.g. "trash" or "arrow right".'),
347
+ limit: z.number().int().positive().optional().describe('Max react-icons names. Default 30.'),
348
+ },
349
+ },
350
+
342
351
  lowdefy_get_plugin_doc: {
343
352
  description:
344
353
  "Get markdown documentation shipped inside an installed plugin package (README, guides). Useful for this project's local custom plugins.",
@@ -219,6 +219,7 @@ test('getOverview includes counts and route guidance', () => {
219
219
  expect(overview).toContain('2 block types');
220
220
  expect(overview).toContain('/lowdefy-docs/schema/{kind}/{type}');
221
221
  expect(overview).toContain('lowdefy_list_types');
222
+ expect(overview).not.toContain('config.basePath');
222
223
  });
223
224
 
224
225
  test('normalizeTypeKind maps singular and plural, rejects unknown', () => {
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import getDocsManifest from './getDocsManifest.js';
18
+ import lowdefyConfig from '../build/config.js';
18
19
  import listPlugins from './listPlugins.js';
19
20
  import readBuildArtifact from './readBuildArtifact.js';
20
21
 
@@ -31,6 +32,17 @@ function countKinds({ availableTypes }) {
31
32
  };
32
33
  }
33
34
 
35
+ // The dev server mounts every route under config.basePath, the docs tools
36
+ // included, so an app with a basePath must tell agents the prefix.
37
+ function basePathLines() {
38
+ const basePath = lowdefyConfig.basePath ?? '';
39
+ if (basePath === '') return [];
40
+ return [
41
+ `This app sets \`config.basePath: ${basePath}\`, so every route below is served under it: \`GET ${basePath}/lowdefy-docs\`, \`${basePath}/lowdefy-docs/mcp\`, \`${basePath}/api/...\`.`,
42
+ '',
43
+ ];
44
+ }
45
+
34
46
  function getOverview() {
35
47
  const availableTypes = readBuildArtifact({ name: 'plugins/availableTypes.json' }) ?? {};
36
48
  const counts = countKinds({ availableTypes });
@@ -45,6 +57,7 @@ function getOverview() {
45
57
  '',
46
58
  'This server describes everything installed in THIS project — never guess type names or properties, look them up here first.',
47
59
  '',
60
+ ...basePathLines(),
48
61
  '## What is available',
49
62
  '',
50
63
  `- ${counts.blocks} block types, ${counts.operators} operators, ${counts.actions} actions, ${counts.connections} connections, ${counts.requests} request types (from ${plugins.length} plugin packages, including this project's local plugins).`,
@@ -59,7 +72,8 @@ function getOverview() {
59
72
  '3. **See real usage**: `GET /lowdefy-docs/examples/{type}` — or `lowdefy_get_examples`. YAML examples for block types.',
60
73
  '4. **Read concept docs**: `GET /lowdefy-docs/content/{slug}` (e.g. `/lowdefy-docs/content/operators/_get`) — or `lowdefy_get_doc`. Start with `concepts/lowdefy-schema`, `concepts/blocks`, `concepts/events-and-actions`, `concepts/connections-and-requests`, `concepts/operators`.',
61
74
  '5. **Search**: `GET /lowdefy-docs/search?q=...` — or `lowdefy_search_docs`.',
62
- '6. **Plugin packages**: `GET /lowdefy-docs/plugins` lists every installed plugin; `GET /lowdefy-docs/plugin-doc/{package}` returns markdown a plugin ships itself (READMEs, guides).',
75
+ '6. **Icons**: `GET /lowdefy-docs/icons?q=...` — or `lowdefy_search_icons`. Prefer semantic names (`icon: edit`); in HTML use `<i data-icon="edit"></i>`, `data-tooltip` and `data-popover`.',
76
+ '7. **Plugin packages**: `GET /lowdefy-docs/plugins` lists every installed plugin; `GET /lowdefy-docs/plugin-doc/{package}` returns markdown a plugin ships itself (READMEs, guides).',
63
77
  '',
64
78
  'A `stale` field on a JSON response, a `> STALE:` banner on markdown, or an `X-Lowdefy-Stale` header means the last build FAILED and the served build is behind the source — this answer predates your latest edits. Call `GET /lowdefy-docs/build-status` and fix the errors before trusting anything else.',
65
79
  '',
@@ -101,6 +115,7 @@ function getOverview() {
101
115
  '| `GET /lowdefy-docs/examples/{type}` | Example yaml for a block type |',
102
116
  '| `GET /lowdefy-docs/content/{slug}` | Core doc page as markdown |',
103
117
  '| `GET /lowdefy-docs/search?q={query}` | Search core docs |',
118
+ '| `GET /lowdefy-docs/icons?q={query}` | Search icon names (semantic names first, then react-icons) |',
104
119
  '| `GET /lowdefy-docs/plugin-doc/{package}` | Markdown shipped inside a plugin package |',
105
120
  '| `GET /lowdefy-docs/build-status` | Current build errors/warnings + recent browser errors |',
106
121
  '| `GET /lowdefy-docs/events` | SSE push channel: `restart` on connect, then `build`, `client_error`, `server_error` events as they happen (build events carry `stale`) |',
@@ -0,0 +1,36 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import fs from 'fs';
18
+ import path from 'path';
19
+
20
+ import setupTestFixtures from './setupTestFixtures.mjs';
21
+
22
+ // lib/build/config.js reads build/config.json from process.cwd() at import
23
+ // time, so the fixture carries the basePath before getOverview is imported.
24
+ const fixtureDir = setupTestFixtures();
25
+ fs.writeFileSync(path.join(fixtureDir, 'build/config.json'), JSON.stringify({ basePath: '/app' }));
26
+ process.chdir(fixtureDir);
27
+
28
+ const { default: getOverview } = await import('./getOverview.js');
29
+
30
+ test('getOverview tells agents the docs routes are served under the app basePath', () => {
31
+ const overview = getOverview();
32
+
33
+ expect(overview).toContain(
34
+ 'This app sets `config.basePath: /app`, so every route below is served under it: `GET /app/lowdefy-docs`, `/app/lowdefy-docs/mcp`, `/app/api/...`.'
35
+ );
36
+ });
@@ -0,0 +1,93 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import fs from 'node:fs';
18
+ import { createRequire } from 'node:module';
19
+ import path from 'node:path';
20
+ import { type } from '@lowdefy/helpers';
21
+ import { defaultIconAliases, iconPackages } from '@lowdefy/build/dev';
22
+
23
+ import readBuildArtifact from './readBuildArtifact.js';
24
+
25
+ const require = createRequire(import.meta.url);
26
+
27
+ const DEFAULT_LIMIT = 30;
28
+
29
+ // Lucide is the pack the built-in semantic names use, so its names rank first
30
+ // among react-icons results and an app stays in one visual style.
31
+ const PREFERRED_PACKAGE = 'react-icons/lu';
32
+
33
+ const declarationRegex = /export declare const (\w+)/g;
34
+
35
+ let iconNamesCache = null;
36
+
37
+ // Names come from each pack's type declarations: requiring the packs would load
38
+ // tens of megabytes of icon code into the dev server. Only the packs Lowdefy
39
+ // can bundle (iconPackages) are listed; io and io5 share IoIos names.
40
+ function getIconNames() {
41
+ if (iconNamesCache !== null) {
42
+ return iconNamesCache;
43
+ }
44
+ const packages = [
45
+ PREFERRED_PACKAGE,
46
+ ...Object.keys(iconPackages).filter((iconPackage) => iconPackage !== PREFERRED_PACKAGE),
47
+ ];
48
+ const names = new Set();
49
+ packages.forEach((iconPackage) => {
50
+ const packageDir = path.dirname(require.resolve(iconPackage));
51
+ const declarations = fs.readFileSync(path.join(packageDir, 'index.d.ts'), 'utf8');
52
+ [...declarations.matchAll(declarationRegex)]
53
+ .map((match) => match[1])
54
+ .sort()
55
+ .forEach((name) => names.add(name));
56
+ });
57
+ iconNamesCache = [...names];
58
+ return iconNamesCache;
59
+ }
60
+
61
+ function matchesWords(text, words) {
62
+ const lowerText = text.toLowerCase();
63
+ return words.every((word) => lowerText.includes(word));
64
+ }
65
+
66
+ function searchIcons({ query, limit = DEFAULT_LIMIT }) {
67
+ if (!type.isString(query) || query.trim() === '') {
68
+ throw new Error('searchIcons requires a "query" string.');
69
+ }
70
+ const words = query
71
+ .trim()
72
+ .toLowerCase()
73
+ .split(/[\s-]+/);
74
+ // The dev build writes every alias (built-in and theme.icons.aliases) here.
75
+ // Before the first build only the built-in names are known.
76
+ const aliases = readBuildArtifact({ name: 'iconAliases.json' }) ?? defaultIconAliases;
77
+
78
+ const aliasResults = Object.entries(aliases)
79
+ .filter(([name, icon]) => matchesWords(`${name} ${icon}`, words))
80
+ .map(([name, icon]) => ({ name, icon }));
81
+ const iconResults = getIconNames()
82
+ .filter((name) => matchesWords(name, words))
83
+ .slice(0, limit);
84
+
85
+ return {
86
+ aliases: aliasResults,
87
+ icons: iconResults,
88
+ usage:
89
+ 'Prefer a semantic name from "aliases" (icon: edit, or <i data-icon="edit"></i> in HTML). Use a react-icons name from "icons" only when no semantic name fits, and prefer Lu (Lucide) names so the app keeps one style. Add app-specific semantic names under theme.icons.aliases in lowdefy.yaml.',
90
+ };
91
+ }
92
+
93
+ export default searchIcons;
@@ -0,0 +1,81 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import { jest } from '@jest/globals';
18
+
19
+ // searchIcons reads the dev build's iconAliases.json, which only exists in a
20
+ // built server directory. The react-icons packages are real.
21
+ const mockReadBuildArtifact = jest.fn();
22
+ jest.unstable_mockModule('./readBuildArtifact.js', () => ({
23
+ default: mockReadBuildArtifact,
24
+ }));
25
+
26
+ const { default: searchIcons } = await import('./searchIcons.js');
27
+
28
+ beforeEach(() => {
29
+ mockReadBuildArtifact.mockReset();
30
+ });
31
+
32
+ test('searchIcons lists matching semantic names before react-icons names', () => {
33
+ mockReadBuildArtifact.mockReturnValue({ delete: 'LuTrash2', edit: 'LuPencil' });
34
+ const result = searchIcons({ query: 'trash' });
35
+ expect(result.aliases).toEqual([{ name: 'delete', icon: 'LuTrash2' }]);
36
+ expect(result.icons[0]).toBe('LuTrash');
37
+ expect(result.icons).toContain('LuTrash2');
38
+ });
39
+
40
+ test('searchIcons includes theme aliases from the build', () => {
41
+ mockReadBuildArtifact.mockReturnValue({ invoice: 'LuReceipt' });
42
+ const result = searchIcons({ query: 'invoice' });
43
+ expect(result.aliases).toEqual([{ name: 'invoice', icon: 'LuReceipt' }]);
44
+ });
45
+
46
+ test('searchIcons falls back to the built-in names before the first build', () => {
47
+ mockReadBuildArtifact.mockReturnValue(null);
48
+ const result = searchIcons({ query: 'external link' });
49
+ expect(result.aliases).toEqual([{ name: 'external-link', icon: 'LuExternalLink' }]);
50
+ });
51
+
52
+ test('searchIcons requires every query word to match', () => {
53
+ mockReadBuildArtifact.mockReturnValue({});
54
+ const result = searchIcons({ query: 'arrow right circle', limit: 50 });
55
+ expect(result.icons.length).toBeGreaterThan(0);
56
+ result.icons.forEach((name) => {
57
+ const lower = name.toLowerCase();
58
+ expect(lower).toContain('arrow');
59
+ expect(lower).toContain('right');
60
+ expect(lower).toContain('circle');
61
+ });
62
+ });
63
+
64
+ test('searchIcons caps react-icons results at the limit', () => {
65
+ mockReadBuildArtifact.mockReturnValue({});
66
+ expect(searchIcons({ query: 'user', limit: 5 }).icons).toHaveLength(5);
67
+ });
68
+
69
+ test('searchIcons throws without a query', () => {
70
+ expect(() => searchIcons({ query: ' ' })).toThrow('searchIcons requires a "query" string.');
71
+ });
72
+
73
+ test('every built-in semantic icon name targets an icon react-icons exports', async () => {
74
+ // react-icons upgrades have renamed Lucide exports (LuHome → LuHouse); this
75
+ // catches a built-in name that would stop rendering.
76
+ const { defaultIconAliases } = await import('@lowdefy/build/dev');
77
+ const { createRequire } = await import('node:module');
78
+ const lucide = createRequire(import.meta.url)('react-icons/lu');
79
+ const missing = Object.entries(defaultIconAliases).filter(([, icon]) => !lucide[icon]);
80
+ expect(missing).toEqual([]);
81
+ });
@@ -86,6 +86,27 @@ test('getPageJitEnrichment scopes icons referenced directly in the page config',
86
86
  expect(dynamicIcons).toEqual({ FiStar: { tag: 'svg' } });
87
87
  });
88
88
 
89
+ test('getPageJitEnrichment scopes icons named in data-icon attributes inside HTML', () => {
90
+ const { dynamicIcons } = getPageJitEnrichment({
91
+ pageConfig: { id: 'p', blocks: [{ properties: { html: '<i data-icon="LuTrash2"></i>' } }] },
92
+ buildContext: buildContext({
93
+ dynamicIconData: { LuTrash2: { tag: 'svg' }, LuOther: { tag: 'svg' } },
94
+ }),
95
+ });
96
+ expect(dynamicIcons).toEqual({ LuTrash2: { tag: 'svg' } });
97
+ });
98
+
99
+ test('getPageJitEnrichment scopes semantic icon names used on the page', () => {
100
+ const { dynamicIcons } = getPageJitEnrichment({
101
+ pageConfig: { id: 'p', blocks: [{ properties: { icon: 'edit' } }] },
102
+ buildContext: {
103
+ ...buildContext({ dynamicIconData: { edit: { tag: 'svg' }, delete: { tag: 'svg' } } }),
104
+ iconAliases: { delete: 'LuTrash2', edit: 'LuPencil' },
105
+ },
106
+ });
107
+ expect(dynamicIcons).toEqual({ edit: { tag: 'svg' } });
108
+ });
109
+
89
110
  test('getPageJitEnrichment returns {} when there is no build context', () => {
90
111
  expect(getPageJitEnrichment({ pageConfig: { id: 'p' }, buildContext: null })).toEqual({});
91
112
  });
@@ -19,10 +19,10 @@ import path from 'path';
19
19
  import { serializer, type } from '@lowdefy/helpers';
20
20
  import {
21
21
  buildPageJit,
22
+ collectIconNames,
22
23
  createContext,
23
24
  generateClientJsModule,
24
25
  hydrateDeferredRecords,
25
- iconPackages,
26
26
  makeId,
27
27
  } from '@lowdefy/build/dev';
28
28
 
@@ -163,6 +163,10 @@ function getBuildContext(buildDirectory, configDirectory) {
163
163
  bundledIconImports = readJsonFile(path.join(buildDirectory, 'iconImports.json')) ?? [];
164
164
  }
165
165
  cachedBuildContext.iconImports = bundledIconImports;
166
+ // The full semantic name map (built-in and theme.icons.aliases). Read on every
167
+ // context rebuild, since a lowdefy.yaml edit can change it.
168
+ cachedBuildContext.iconAliases =
169
+ readJsonFile(path.join(buildDirectory, 'iconAliases.json')) ?? {};
166
170
 
167
171
  // Accumulator for dynamically extracted icon SVG data written to plugins/iconsDynamic.js.
168
172
  // Reset on skeleton rebuild (cachedBuildContext = null) — JIT re-discovers as needed.
@@ -265,16 +269,17 @@ function collectJsHashes(node, hashes) {
265
269
  // Reproduce that surface: scan the served config plus the page's own client _js
266
270
  // source strings, and keep only names present in dynamicIconData (which holds
267
271
  // only JIT-discovered icons — static ones are already in the client bundle).
268
- function scopeDynamicIcons({ pageConfig, scopedJsMap, dynamicIconData }) {
272
+ function scopeDynamicIcons({ pageConfig, scopedJsMap, dynamicIconData, iconAliases }) {
269
273
  if (Object.keys(dynamicIconData).length === 0) return undefined;
270
274
  const scanText = [JSON.stringify(pageConfig), ...Object.values(scopedJsMap)].join('\n');
275
+ const { aliasNames, packageIcons } = collectIconNames({ json: scanText, aliases: iconAliases });
271
276
  const found = {};
272
- for (const regex of Object.values(iconPackages)) {
273
- for (const match of scanText.matchAll(regex)) {
274
- const name = match[1];
275
- if (dynamicIconData[name] && !found[name]) {
276
- found[name] = dynamicIconData[name];
277
- }
277
+ for (const name of [
278
+ ...Object.values(packageIcons).flatMap((icons) => [...icons]),
279
+ ...aliasNames,
280
+ ]) {
281
+ if (dynamicIconData[name]) {
282
+ found[name] = dynamicIconData[name];
278
283
  }
279
284
  }
280
285
  return Object.keys(found).length > 0 ? found : undefined;
@@ -309,6 +314,7 @@ export function getPageJitEnrichment({ pageConfig, buildContext = cachedBuildCon
309
314
  pageConfig,
310
315
  scopedJsMap,
311
316
  dynamicIconData: buildContext.dynamicIconData ?? {},
317
+ iconAliases: buildContext.iconAliases ?? {},
312
318
  });
313
319
 
314
320
  return { jsEntries, dynamicIcons };
@@ -0,0 +1,40 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ function escapeRegExp(value) {
18
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
19
+ }
20
+
21
+ // The paths Vite serves itself; every other request routes to the Hono app.
22
+ // @hono/vite-dev-server tests these against the raw request url, before Vite
23
+ // strips its `base`, and Vite serves every module under `base` - so with
24
+ // config.basePath the patterns must carry the prefix. Without it
25
+ // `<basePath>/@vite/client` and `<basePath>/client/main.jsx` fall through to
26
+ // the Hono page route and come back as the HTML shell.
27
+ function createDevServerExclude({ basePath }) {
28
+ const prefix = escapeRegExp(basePath);
29
+ return [
30
+ new RegExp(`^${prefix}/client/.+`),
31
+ new RegExp(`^${prefix}/lib/.+`),
32
+ new RegExp(`^${prefix}/build/.+`),
33
+ new RegExp(`^${prefix}/@.+$`),
34
+ new RegExp(`^${prefix}/node_modules/.*`),
35
+ /\?t=\d+$/,
36
+ /^\/favicon\.ico$/,
37
+ ];
38
+ }
39
+
40
+ export default createDevServerExclude;
@@ -0,0 +1,79 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import createDevServerExclude from './createDevServerExclude.js';
18
+
19
+ function isExcluded(exclude, url) {
20
+ return exclude.some((pattern) => pattern.test(url));
21
+ }
22
+
23
+ test('createDevServerExclude leaves Vite module paths to Vite when there is no basePath', () => {
24
+ const exclude = createDevServerExclude({ basePath: '' });
25
+
26
+ expect(isExcluded(exclude, '/@vite/client')).toBe(true);
27
+ expect(isExcluded(exclude, '/@react-refresh')).toBe(true);
28
+ expect(isExcluded(exclude, '/client/main.jsx')).toBe(true);
29
+ expect(isExcluded(exclude, '/build/plugins/blocks.js')).toBe(true);
30
+ expect(isExcluded(exclude, '/lib/client/ErrorBar.jsx')).toBe(true);
31
+ expect(isExcluded(exclude, '/node_modules/.vite/deps/react.js?v=1')).toBe(true);
32
+ expect(isExcluded(exclude, '/client/App.jsx?t=1712345678')).toBe(true);
33
+ expect(isExcluded(exclude, '/favicon.ico')).toBe(true);
34
+ });
35
+
36
+ test('createDevServerExclude routes page, api and docs paths to Hono when there is no basePath', () => {
37
+ const exclude = createDevServerExclude({ basePath: '' });
38
+
39
+ expect(isExcluded(exclude, '/')).toBe(false);
40
+ expect(isExcluded(exclude, '/home')).toBe(false);
41
+ expect(isExcluded(exclude, '/api/ping')).toBe(false);
42
+ expect(isExcluded(exclude, '/lowdefy-docs/mcp')).toBe(false);
43
+ });
44
+
45
+ test('createDevServerExclude leaves Vite module paths under the basePath to Vite', () => {
46
+ const exclude = createDevServerExclude({ basePath: '/app' });
47
+
48
+ expect(isExcluded(exclude, '/app/@vite/client')).toBe(true);
49
+ expect(isExcluded(exclude, '/app/@react-refresh')).toBe(true);
50
+ expect(isExcluded(exclude, '/app/@fs/Users/dev/app/plugin.js')).toBe(true);
51
+ expect(isExcluded(exclude, '/app/client/main.jsx')).toBe(true);
52
+ expect(isExcluded(exclude, '/app/build/plugins/blocks.js')).toBe(true);
53
+ expect(isExcluded(exclude, '/app/lib/client/ErrorBar.jsx')).toBe(true);
54
+ expect(isExcluded(exclude, '/app/node_modules/.vite/deps/react.js?v=1')).toBe(true);
55
+ });
56
+
57
+ test('createDevServerExclude routes page, api and docs paths under the basePath to Hono', () => {
58
+ const exclude = createDevServerExclude({ basePath: '/app' });
59
+
60
+ expect(isExcluded(exclude, '/app')).toBe(false);
61
+ expect(isExcluded(exclude, '/app/home')).toBe(false);
62
+ expect(isExcluded(exclude, '/app/client-list')).toBe(false);
63
+ expect(isExcluded(exclude, '/app/api/ping')).toBe(false);
64
+ expect(isExcluded(exclude, '/app/lowdefy-docs/mcp')).toBe(false);
65
+ });
66
+
67
+ test('createDevServerExclude does not hand unprefixed module paths to Vite under a basePath', () => {
68
+ const exclude = createDevServerExclude({ basePath: '/app' });
69
+
70
+ expect(isExcluded(exclude, '/@vite/client')).toBe(false);
71
+ expect(isExcluded(exclude, '/client/main.jsx')).toBe(false);
72
+ });
73
+
74
+ test('createDevServerExclude matches a basePath containing regular expression characters literally', () => {
75
+ const exclude = createDevServerExclude({ basePath: '/my.app' });
76
+
77
+ expect(isExcluded(exclude, '/my.app/@vite/client')).toBe(true);
78
+ expect(isExcluded(exclude, '/myxapp/@vite/client')).toBe(false);
79
+ });
@@ -16,6 +16,7 @@
16
16
 
17
17
  import { spawn } from 'child_process';
18
18
 
19
+ import readBasePath from '../utils/readBasePath.mjs';
19
20
 
20
21
  function createStdErrLineHandler({ context }) {
21
22
  const port = context.internalPort;
@@ -33,6 +34,15 @@ function createStdErrLineHandler({ context }) {
33
34
  function startServer(context) {
34
35
  context.shutdownServer();
35
36
 
37
+ // The app, its API and the /lowdefy-docs tools all live under basePath, and
38
+ // a config change that edits basePath restarts the child - so the URL is
39
+ // recorded on every start. Everything that finds this server through
40
+ // .lowdefy/instance.json (lowdefy mcp, the hub, lowdefy test) appends its
41
+ // paths to this URL.
42
+ context.basePath = readBasePath(context);
43
+ context.url = `http://localhost:${context.options.port}${context.basePath}`;
44
+ context.instance.update({ url: context.url });
45
+
36
46
  // The child binds context.internalPort on loopback; the manager's proxy owns
37
47
  // the public context.options.port (see startProxy.mjs) so a restart never
38
48
  // drops the listener that browsers, SSE reload streams and MCP agents hold.
package/manager/run.mjs CHANGED
@@ -132,7 +132,8 @@ try {
132
132
  const { port, internalPort } = await resolvePorts(context);
133
133
  context.options.port = port;
134
134
  context.internalPort = internalPort;
135
- instance.update({ port, internalPort, url: `http://localhost:${port}` });
135
+ instance.update({ port, internalPort });
136
+ context.instance = instance;
136
137
 
137
138
  // The manager holds the public port for the whole session and proxies to the
138
139
  // Vite child on an internal loopback port — restarting the child (js module
@@ -142,12 +143,12 @@ try {
142
143
  await startProxy(context);
143
144
 
144
145
  startServer(context);
145
- if (await waitForServer({ port: context.internalPort })) {
146
+ if (await waitForServer({ port: context.internalPort, basePath: context.basePath })) {
146
147
  instance.update({ state: 'ready' });
147
148
  } else {
148
149
  context.logger.warn('The dev server did not answer within 2 minutes - check the output above.');
149
150
  }
150
- const docsUrl = `http://localhost:${context.options.port}/lowdefy-docs`;
151
+ const docsUrl = `${context.url}/lowdefy-docs`;
151
152
  context.logger.info(
152
153
  { color: 'blue' },
153
154
  formatNoticeBox({
@@ -168,7 +169,7 @@ try {
168
169
  // A hub-owned server was started for an agent, not for a person at a browser.
169
170
  if (process.env.LOWDEFY_SERVER_DEV_OPEN_BROWSER === 'true' && context.options.owner !== 'hub') {
170
171
  // TODO: Wait 1 sec for a ping and don't open if a ping is seen
171
- opener(`http://localhost:${context.options.port}`);
172
+ opener(context.url);
172
173
  }
173
174
  await new Promise(() => {});
174
175
  } catch (error) {
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import fs from 'fs';
18
+ import path from 'path';
19
+
20
+ // The build always writes config.json, and Vite reads basePath from the same
21
+ // file when the child starts, so the manager and the child agree on it.
22
+ function readBasePath({ directories }) {
23
+ const config = JSON.parse(fs.readFileSync(path.join(directories.build, 'config.json'), 'utf8'));
24
+ return config.basePath ?? '';
25
+ }
26
+
27
+ export default readBasePath;
@@ -0,0 +1,43 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import fs from 'fs';
18
+ import os from 'os';
19
+ import path from 'path';
20
+
21
+ import readBasePath from './readBasePath.mjs';
22
+
23
+ let buildDirectory;
24
+
25
+ beforeEach(() => {
26
+ buildDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'lowdefy-read-base-path-'));
27
+ });
28
+
29
+ afterEach(() => {
30
+ fs.rmSync(buildDirectory, { recursive: true, force: true });
31
+ });
32
+
33
+ test('readBasePath returns the basePath from the build config', () => {
34
+ fs.writeFileSync(path.join(buildDirectory, 'config.json'), JSON.stringify({ basePath: '/app' }));
35
+
36
+ expect(readBasePath({ directories: { build: buildDirectory } })).toEqual('/app');
37
+ });
38
+
39
+ test('readBasePath returns an empty string when the app sets no basePath', () => {
40
+ fs.writeFileSync(path.join(buildDirectory, 'config.json'), JSON.stringify({ theme: {} }));
41
+
42
+ expect(readBasePath({ directories: { build: buildDirectory } })).toEqual('');
43
+ });
@@ -16,14 +16,14 @@
16
16
 
17
17
  import { wait } from '@lowdefy/helpers';
18
18
 
19
- // The child answers /api/ping once Vite and the Hono app are both up, so this
19
+ // The child answers <basePath>/api/ping once Vite and the Hono app are both up, so this
20
20
  // is the moment the server is really usable - the instance record flips to
21
21
  // "ready" here, which is what the hub and the MCP shim wait on.
22
- async function waitForServer({ port, timeoutMs = 120000, intervalMs = 250 }) {
22
+ async function waitForServer({ port, basePath, timeoutMs = 120000, intervalMs = 250 }) {
23
23
  const deadline = Date.now() + timeoutMs;
24
24
  while (Date.now() < deadline) {
25
25
  try {
26
- const response = await fetch(`http://127.0.0.1:${port}/api/ping`);
26
+ const response = await fetch(`http://127.0.0.1:${port}${basePath}/api/ping`);
27
27
  if (response.ok) {
28
28
  return true;
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server-dev",
3
- "version": "0.0.0-experimental-20260925135632",
3
+ "version": "0.0.0-experimental-20260925210809",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -45,41 +45,41 @@
45
45
  "@hono/mcp": "0.3.0",
46
46
  "@hono/node-server": "2.0.10",
47
47
  "@hono/vite-dev-server": "0.26.0",
48
- "@lowdefy/actions-core": "0.0.0-experimental-20260925135632",
49
- "@lowdefy/api": "0.0.0-experimental-20260925135632",
50
- "@lowdefy/block-utils": "0.0.0-experimental-20260925135632",
51
- "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260925135632",
52
- "@lowdefy/blocks-antd": "0.0.0-experimental-20260925135632",
53
- "@lowdefy/blocks-antd-x": "0.0.0-experimental-20260925135632",
54
- "@lowdefy/blocks-basic": "0.0.0-experimental-20260925135632",
55
- "@lowdefy/blocks-captcha": "0.0.0-experimental-20260925135632",
56
- "@lowdefy/blocks-echarts": "0.0.0-experimental-20260925135632",
57
- "@lowdefy/blocks-loaders": "0.0.0-experimental-20260925135632",
58
- "@lowdefy/blocks-markdown": "0.0.0-experimental-20260925135632",
59
- "@lowdefy/blocks-tiptap": "0.0.0-experimental-20260925135632",
60
- "@lowdefy/build": "0.0.0-experimental-20260925135632",
61
- "@lowdefy/client": "0.0.0-experimental-20260925135632",
62
- "@lowdefy/connection-axios-http": "0.0.0-experimental-20260925135632",
63
- "@lowdefy/connection-mongodb": "0.0.0-experimental-20260925135632",
64
- "@lowdefy/docs-content": "0.0.0-experimental-20260925135632",
65
- "@lowdefy/e2e-utils": "0.0.0-experimental-20260925135632",
66
- "@lowdefy/engine": "0.0.0-experimental-20260925135632",
67
- "@lowdefy/errors": "0.0.0-experimental-20260925135632",
68
- "@lowdefy/helpers": "0.0.0-experimental-20260925135632",
69
- "@lowdefy/layout": "0.0.0-experimental-20260925135632",
70
- "@lowdefy/logger": "0.0.0-experimental-20260925135632",
71
- "@lowdefy/node-utils": "0.0.0-experimental-20260925135632",
72
- "@lowdefy/operators-change-case": "0.0.0-experimental-20260925135632",
73
- "@lowdefy/operators-cron": "0.0.0-experimental-20260925135632",
74
- "@lowdefy/operators-dayjs": "0.0.0-experimental-20260925135632",
75
- "@lowdefy/operators-diff": "0.0.0-experimental-20260925135632",
76
- "@lowdefy/operators-js": "0.0.0-experimental-20260925135632",
77
- "@lowdefy/operators-mql": "0.0.0-experimental-20260925135632",
78
- "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260925135632",
79
- "@lowdefy/operators-uuid": "0.0.0-experimental-20260925135632",
80
- "@lowdefy/operators-yaml": "0.0.0-experimental-20260925135632",
81
- "@lowdefy/plugin-better-auth": "0.0.0-experimental-20260925135632",
82
- "@lowdefy/websockets-core": "0.0.0-experimental-20260925135632",
48
+ "@lowdefy/actions-core": "0.0.0-experimental-20260925210809",
49
+ "@lowdefy/api": "0.0.0-experimental-20260925210809",
50
+ "@lowdefy/block-utils": "0.0.0-experimental-20260925210809",
51
+ "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260925210809",
52
+ "@lowdefy/blocks-antd": "0.0.0-experimental-20260925210809",
53
+ "@lowdefy/blocks-antd-x": "0.0.0-experimental-20260925210809",
54
+ "@lowdefy/blocks-basic": "0.0.0-experimental-20260925210809",
55
+ "@lowdefy/blocks-captcha": "0.0.0-experimental-20260925210809",
56
+ "@lowdefy/blocks-echarts": "0.0.0-experimental-20260925210809",
57
+ "@lowdefy/blocks-loaders": "0.0.0-experimental-20260925210809",
58
+ "@lowdefy/blocks-markdown": "0.0.0-experimental-20260925210809",
59
+ "@lowdefy/blocks-tiptap": "0.0.0-experimental-20260925210809",
60
+ "@lowdefy/build": "0.0.0-experimental-20260925210809",
61
+ "@lowdefy/client": "0.0.0-experimental-20260925210809",
62
+ "@lowdefy/connection-axios-http": "0.0.0-experimental-20260925210809",
63
+ "@lowdefy/connection-mongodb": "0.0.0-experimental-20260925210809",
64
+ "@lowdefy/docs-content": "0.0.0-experimental-20260925210809",
65
+ "@lowdefy/e2e-utils": "0.0.0-experimental-20260925210809",
66
+ "@lowdefy/engine": "0.0.0-experimental-20260925210809",
67
+ "@lowdefy/errors": "0.0.0-experimental-20260925210809",
68
+ "@lowdefy/helpers": "0.0.0-experimental-20260925210809",
69
+ "@lowdefy/layout": "0.0.0-experimental-20260925210809",
70
+ "@lowdefy/logger": "0.0.0-experimental-20260925210809",
71
+ "@lowdefy/node-utils": "0.0.0-experimental-20260925210809",
72
+ "@lowdefy/operators-change-case": "0.0.0-experimental-20260925210809",
73
+ "@lowdefy/operators-cron": "0.0.0-experimental-20260925210809",
74
+ "@lowdefy/operators-dayjs": "0.0.0-experimental-20260925210809",
75
+ "@lowdefy/operators-diff": "0.0.0-experimental-20260925210809",
76
+ "@lowdefy/operators-js": "0.0.0-experimental-20260925210809",
77
+ "@lowdefy/operators-mql": "0.0.0-experimental-20260925210809",
78
+ "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260925210809",
79
+ "@lowdefy/operators-uuid": "0.0.0-experimental-20260925210809",
80
+ "@lowdefy/operators-yaml": "0.0.0-experimental-20260925210809",
81
+ "@lowdefy/plugin-better-auth": "0.0.0-experimental-20260925210809",
82
+ "@lowdefy/websockets-core": "0.0.0-experimental-20260925210809",
83
83
  "@modelcontextprotocol/sdk": "1.29.0",
84
84
  "@tailwindcss/postcss": "4.3.1",
85
85
  "@vitejs/plugin-react": "6.0.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server-dev",
3
- "version": "0.0.0-experimental-20260925135632",
3
+ "version": "0.0.0-experimental-20260925210809",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -51,41 +51,41 @@
51
51
  "@hono/mcp": "0.3.0",
52
52
  "@hono/node-server": "2.0.10",
53
53
  "@hono/vite-dev-server": "0.26.0",
54
- "@lowdefy/actions-core": "0.0.0-experimental-20260925135632",
55
- "@lowdefy/api": "0.0.0-experimental-20260925135632",
56
- "@lowdefy/block-utils": "0.0.0-experimental-20260925135632",
57
- "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260925135632",
58
- "@lowdefy/blocks-antd": "0.0.0-experimental-20260925135632",
59
- "@lowdefy/blocks-antd-x": "0.0.0-experimental-20260925135632",
60
- "@lowdefy/blocks-basic": "0.0.0-experimental-20260925135632",
61
- "@lowdefy/blocks-captcha": "0.0.0-experimental-20260925135632",
62
- "@lowdefy/blocks-echarts": "0.0.0-experimental-20260925135632",
63
- "@lowdefy/blocks-loaders": "0.0.0-experimental-20260925135632",
64
- "@lowdefy/blocks-markdown": "0.0.0-experimental-20260925135632",
65
- "@lowdefy/blocks-tiptap": "0.0.0-experimental-20260925135632",
66
- "@lowdefy/build": "0.0.0-experimental-20260925135632",
67
- "@lowdefy/client": "0.0.0-experimental-20260925135632",
68
- "@lowdefy/connection-axios-http": "0.0.0-experimental-20260925135632",
69
- "@lowdefy/connection-mongodb": "0.0.0-experimental-20260925135632",
70
- "@lowdefy/docs-content": "0.0.0-experimental-20260925135632",
71
- "@lowdefy/e2e-utils": "0.0.0-experimental-20260925135632",
72
- "@lowdefy/engine": "0.0.0-experimental-20260925135632",
73
- "@lowdefy/errors": "0.0.0-experimental-20260925135632",
74
- "@lowdefy/helpers": "0.0.0-experimental-20260925135632",
75
- "@lowdefy/layout": "0.0.0-experimental-20260925135632",
76
- "@lowdefy/logger": "0.0.0-experimental-20260925135632",
77
- "@lowdefy/node-utils": "0.0.0-experimental-20260925135632",
78
- "@lowdefy/operators-change-case": "0.0.0-experimental-20260925135632",
79
- "@lowdefy/operators-cron": "0.0.0-experimental-20260925135632",
80
- "@lowdefy/operators-dayjs": "0.0.0-experimental-20260925135632",
81
- "@lowdefy/operators-diff": "0.0.0-experimental-20260925135632",
82
- "@lowdefy/operators-js": "0.0.0-experimental-20260925135632",
83
- "@lowdefy/operators-mql": "0.0.0-experimental-20260925135632",
84
- "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260925135632",
85
- "@lowdefy/operators-uuid": "0.0.0-experimental-20260925135632",
86
- "@lowdefy/operators-yaml": "0.0.0-experimental-20260925135632",
87
- "@lowdefy/plugin-better-auth": "0.0.0-experimental-20260925135632",
88
- "@lowdefy/websockets-core": "0.0.0-experimental-20260925135632",
54
+ "@lowdefy/actions-core": "0.0.0-experimental-20260925210809",
55
+ "@lowdefy/api": "0.0.0-experimental-20260925210809",
56
+ "@lowdefy/block-utils": "0.0.0-experimental-20260925210809",
57
+ "@lowdefy/blocks-aggrid": "0.0.0-experimental-20260925210809",
58
+ "@lowdefy/blocks-antd": "0.0.0-experimental-20260925210809",
59
+ "@lowdefy/blocks-antd-x": "0.0.0-experimental-20260925210809",
60
+ "@lowdefy/blocks-basic": "0.0.0-experimental-20260925210809",
61
+ "@lowdefy/blocks-captcha": "0.0.0-experimental-20260925210809",
62
+ "@lowdefy/blocks-echarts": "0.0.0-experimental-20260925210809",
63
+ "@lowdefy/blocks-loaders": "0.0.0-experimental-20260925210809",
64
+ "@lowdefy/blocks-markdown": "0.0.0-experimental-20260925210809",
65
+ "@lowdefy/blocks-tiptap": "0.0.0-experimental-20260925210809",
66
+ "@lowdefy/build": "0.0.0-experimental-20260925210809",
67
+ "@lowdefy/client": "0.0.0-experimental-20260925210809",
68
+ "@lowdefy/connection-axios-http": "0.0.0-experimental-20260925210809",
69
+ "@lowdefy/connection-mongodb": "0.0.0-experimental-20260925210809",
70
+ "@lowdefy/docs-content": "0.0.0-experimental-20260925210809",
71
+ "@lowdefy/e2e-utils": "0.0.0-experimental-20260925210809",
72
+ "@lowdefy/engine": "0.0.0-experimental-20260925210809",
73
+ "@lowdefy/errors": "0.0.0-experimental-20260925210809",
74
+ "@lowdefy/helpers": "0.0.0-experimental-20260925210809",
75
+ "@lowdefy/layout": "0.0.0-experimental-20260925210809",
76
+ "@lowdefy/logger": "0.0.0-experimental-20260925210809",
77
+ "@lowdefy/node-utils": "0.0.0-experimental-20260925210809",
78
+ "@lowdefy/operators-change-case": "0.0.0-experimental-20260925210809",
79
+ "@lowdefy/operators-cron": "0.0.0-experimental-20260925210809",
80
+ "@lowdefy/operators-dayjs": "0.0.0-experimental-20260925210809",
81
+ "@lowdefy/operators-diff": "0.0.0-experimental-20260925210809",
82
+ "@lowdefy/operators-js": "0.0.0-experimental-20260925210809",
83
+ "@lowdefy/operators-mql": "0.0.0-experimental-20260925210809",
84
+ "@lowdefy/operators-nunjucks": "0.0.0-experimental-20260925210809",
85
+ "@lowdefy/operators-uuid": "0.0.0-experimental-20260925210809",
86
+ "@lowdefy/operators-yaml": "0.0.0-experimental-20260925210809",
87
+ "@lowdefy/plugin-better-auth": "0.0.0-experimental-20260925210809",
88
+ "@lowdefy/websockets-core": "0.0.0-experimental-20260925210809",
89
89
  "@modelcontextprotocol/sdk": "1.29.0",
90
90
  "@tailwindcss/postcss": "4.3.1",
91
91
  "@vitejs/plugin-react": "6.0.2",
package/src/app.js CHANGED
@@ -56,6 +56,7 @@ import docsPluginDocHandler from './routes/docs/pluginDoc.js';
56
56
  import docsPluginsHandler from './routes/docs/plugins.js';
57
57
  import docsSchemaHandler from './routes/docs/schema.js';
58
58
  import docsScreenshotHandler from './routes/docs/screenshot.js';
59
+ import docsIconsHandler from './routes/docs/icons.js';
59
60
  import docsSearchHandler from './routes/docs/search.js';
60
61
  import docsTypesHandler from './routes/docs/types.js';
61
62
  import endpointsHandler from './routes/endpoints.js';
@@ -171,6 +172,7 @@ function createApp() {
171
172
  app.get('/lowdefy-docs/schema/:kind/:type', docsSchemaHandler);
172
173
  app.get('/lowdefy-docs/examples/:type', docsExamplesHandler);
173
174
  app.get('/lowdefy-docs/search', docsSearchHandler);
175
+ app.get('/lowdefy-docs/icons', docsIconsHandler);
174
176
  app.get('/lowdefy-docs/plugin-doc/:package{.+}', docsPluginDocHandler);
175
177
  app.get('/lowdefy-docs/content/:slug{.+}', docsContentHandler);
176
178
  app.get('/lowdefy-docs/:kind', docsTypesHandler);
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import searchIcons from '../../../lib/docs/searchIcons.js';
18
+
19
+ function docsIconsHandler(c) {
20
+ const query = c.req.query('q');
21
+ if (!query || query.trim() === '') {
22
+ return c.json(
23
+ { error: 'Missing search query. Use GET /lowdefy-docs/icons?q=your+keywords.' },
24
+ 400
25
+ );
26
+ }
27
+ return c.json(searchIcons({ query }));
28
+ }
29
+
30
+ export default docsIconsHandler;
package/vite.config.js CHANGED
@@ -20,6 +20,8 @@ import react from '@vitejs/plugin-react';
20
20
  import devServer from '@hono/vite-dev-server';
21
21
  import { WebSocketServer } from 'ws';
22
22
 
23
+ import createDevServerExclude from './lib/vite/createDevServerExclude.js';
24
+
23
25
  // basePath from the Lowdefy build — assets and routes are served under it.
24
26
  let basePath = '';
25
27
  try {
@@ -65,16 +67,7 @@ export default defineConfig(({ mode }) => ({
65
67
  lowdefyWebSocket(),
66
68
  devServer({
67
69
  entry: './src/app.js',
68
- // Vite serves these itself; everything else routes to the Hono app.
69
- exclude: [
70
- /^\/client\/.+/,
71
- /^\/lib\/.+/,
72
- /^\/build\/.+/,
73
- /^\/@.+$/,
74
- /^\/node_modules\/.*/,
75
- /\?t=\d+$/,
76
- /^\/favicon\.ico$/,
77
- ],
70
+ exclude: createDevServerExclude({ basePath }),
78
71
  }),
79
72
  ],
80
73
  define: {