@lowdefy/server-dev 0.0.0-experimental-20260926170209 → 0.0.0-experimental-20260926183344
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/client/App.jsx +33 -23
- package/client/Page.jsx +5 -9
- package/client/clientBuildImports.test.mjs +2 -0
- package/lib/client/utils/usePageConfig.test.mjs +2 -2
- package/lib/docs/createDocsMcpServer.js +2 -2
- package/lib/docs/devToolDefinitions.js +8 -3
- package/lib/docs/getOverview.js +2 -2
- package/lib/docs/listPlugins.js +15 -0
- package/lib/docs/searchIcons.js +39 -42
- package/lib/docs/searchIcons.test.mjs +80 -34
- package/lib/server/getPageJitEnrichment.test.mjs +18 -21
- package/lib/server/jitPageBuilder.js +14 -27
- package/manager/utils/createCustomPluginTypesMap.mjs +1 -0
- package/package.json +36 -37
- package/package.original.json +36 -37
- package/src/routes/docs/icons.js +2 -2
- package/src/routes/jitPage.test.mjs +2 -2
package/client/App.jsx
CHANGED
|
@@ -18,19 +18,25 @@ import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react
|
|
|
18
18
|
import useSWR from 'swr';
|
|
19
19
|
|
|
20
20
|
import { ErrorBoundary } from '@lowdefy/block-utils';
|
|
21
|
-
import { useDarkMode, useLocale } from '@lowdefy/client';
|
|
21
|
+
import { IconProvider, useDarkMode, useLocale } from '@lowdefy/client';
|
|
22
22
|
import { StyleProvider } from '@ant-design/cssinjs';
|
|
23
23
|
import { App as AntdApp, theme as antdTheme } from 'antd';
|
|
24
24
|
import { XProvider } from '@ant-design/x';
|
|
25
|
+
import { serializer } from '@lowdefy/helpers';
|
|
25
26
|
|
|
26
27
|
import antdLocaleLoaders from '../build/i18n/antdLocales.js';
|
|
27
28
|
import antdXLocaleLoaders from '../build/i18n/antdXLocales.js';
|
|
28
29
|
import dayjsLocaleMap from '../build/i18n/dayjsLocales.js';
|
|
30
|
+
import rawTheme from '../build/theme.json';
|
|
29
31
|
import Auth from '../lib/client/auth/Auth.jsx';
|
|
30
32
|
import ErrorBar from '../lib/client/ErrorBar.jsx';
|
|
31
33
|
import request from '../lib/client/utils/request.js';
|
|
32
34
|
import Routing from './Routing.jsx';
|
|
33
35
|
|
|
36
|
+
// rootConfig arrives after the first render; the build-written theme gives
|
|
37
|
+
// the icon provider its settings until then.
|
|
38
|
+
const buildTheme = serializer.deserialize(rawTheme);
|
|
39
|
+
|
|
34
40
|
function ThemeTokenResolver({ lowdefyRef, children }) {
|
|
35
41
|
const { token } = antdTheme.useToken();
|
|
36
42
|
if (!lowdefyRef.current.theme) {
|
|
@@ -131,29 +137,33 @@ function App({ config, router }) {
|
|
|
131
137
|
algorithm,
|
|
132
138
|
}}
|
|
133
139
|
>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
{/* Message, Notification and ConfirmModal render in the App.useApp()
|
|
141
|
+
holders here, above the Client's icon provider. */}
|
|
142
|
+
<IconProvider icons={rootConfig?.theme.icons ?? buildTheme.icons}>
|
|
143
|
+
<AntdApp>
|
|
144
|
+
<ThemeTokenResolver lowdefyRef={lowdefyRef}>
|
|
145
|
+
<ErrorBoundary fullPage onError={handleError}>
|
|
146
|
+
<Suspense
|
|
147
|
+
fallback={
|
|
148
|
+
<div
|
|
149
|
+
style={{
|
|
150
|
+
minHeight: '100vh',
|
|
151
|
+
background: 'var(--ant-color-bg-layout)',
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<Auth user={config?.user}>
|
|
157
|
+
{(auth) => {
|
|
158
|
+
return <Routing auth={auth} lowdefy={lowdefyRef.current} router={router} />;
|
|
143
159
|
}}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</Auth>
|
|
152
|
-
</Suspense>
|
|
153
|
-
</ErrorBoundary>
|
|
154
|
-
<ErrorBar errors={runtimeErrors} />
|
|
155
|
-
</ThemeTokenResolver>
|
|
156
|
-
</AntdApp>
|
|
160
|
+
</Auth>
|
|
161
|
+
</Suspense>
|
|
162
|
+
</ErrorBoundary>
|
|
163
|
+
<ErrorBar errors={runtimeErrors} />
|
|
164
|
+
</ThemeTokenResolver>
|
|
165
|
+
</AntdApp>
|
|
166
|
+
</IconProvider>
|
|
157
167
|
</XProvider>
|
|
158
168
|
</StyleProvider>
|
|
159
169
|
);
|
package/client/Page.jsx
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { useEffect, useRef } from 'react';
|
|
18
|
-
import { GenIcon } from 'react-icons/lib';
|
|
19
18
|
import Client from '@lowdefy/client';
|
|
20
19
|
|
|
21
20
|
import BuildErrorPage from '../lib/client/BuildErrorPage.jsx';
|
|
@@ -79,15 +78,12 @@ const Page = ({
|
|
|
79
78
|
// Merge dynamic JS entries fetched after JIT build with the static jsMap
|
|
80
79
|
const mergedJsMap = pageConfig._jsEntries ? { ...jsMap, ...pageConfig._jsEntries } : jsMap;
|
|
81
80
|
|
|
82
|
-
// Merge JIT-
|
|
83
|
-
// createIcon
|
|
84
|
-
// so mutating the original object makes
|
|
81
|
+
// Merge JIT-delivered icon data into the static icons map. Icons are data
|
|
82
|
+
// (IconData), and createIcon looks up Icons[name] on every render from the
|
|
83
|
+
// captured reference, so mutating the original object makes them available
|
|
84
|
+
// immediately.
|
|
85
85
|
if (pageConfig._dynamicIcons) {
|
|
86
|
-
|
|
87
|
-
if (!types.icons[name]) {
|
|
88
|
-
types.icons[name] = GenIcon(data);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
86
|
+
Object.assign(types.icons, pageConfig._dynamicIcons);
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
return (
|
|
@@ -36,6 +36,8 @@ const allowed = new Set([
|
|
|
36
36
|
'plugins/icons.js',
|
|
37
37
|
'plugins/operators/client.js',
|
|
38
38
|
'plugins/operators/clientJsMap.js',
|
|
39
|
+
// The whole theme already reaches the browser in the root config.
|
|
40
|
+
'theme.json',
|
|
39
41
|
]);
|
|
40
42
|
|
|
41
43
|
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
@@ -39,7 +39,7 @@ test('fetchPageConfig compiles inlined _jsEntries module text into a { hash: fn
|
|
|
39
39
|
mockJsonResponse({
|
|
40
40
|
id: 'p',
|
|
41
41
|
_jsEntries: "export default { 'h1': ({ args }) => { return args.x + 1; } };",
|
|
42
|
-
_dynamicIcons: {
|
|
42
|
+
_dynamicIcons: { Zap: { node: [['path', { d: 'M0 0' }]] } },
|
|
43
43
|
})
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -48,7 +48,7 @@ test('fetchPageConfig compiles inlined _jsEntries module text into a { hash: fn
|
|
|
48
48
|
expect(typeof data._jsEntries.h1).toBe('function');
|
|
49
49
|
expect(data._jsEntries.h1({ args: { x: 1 } })).toBe(2);
|
|
50
50
|
// _dynamicIcons passes through untouched.
|
|
51
|
-
expect(data._dynamicIcons).toEqual({
|
|
51
|
+
expect(data._dynamicIcons).toEqual({ Zap: { node: [['path', { d: 'M0 0' }]] } });
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
test('fetchPageConfig issues only the page-config request — no /api/js or /api/icons fetch', async () => {
|
|
@@ -316,8 +316,8 @@ function createDocsMcpServer({ origin, honoContext } = {}) {
|
|
|
316
316
|
|
|
317
317
|
registerDevTool('lowdefy_search_docs', ({ query }) => textResult(searchDocs({ query })));
|
|
318
318
|
|
|
319
|
-
registerDevTool('lowdefy_search_icons', ({ query, limit }) =>
|
|
320
|
-
textResult(searchIcons({ query, limit }))
|
|
319
|
+
registerDevTool('lowdefy_search_icons', async ({ query, limit }) =>
|
|
320
|
+
textResult(await searchIcons({ query, limit }))
|
|
321
321
|
);
|
|
322
322
|
|
|
323
323
|
registerDevTool('lowdefy_get_plugin_doc', ({ package: packageName }) => {
|
|
@@ -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. Icons: use
|
|
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 a semantic name (icon: edit); otherwise use a Lucide name in PascalCase (icon: Receipt) found with lowdefy_search_icons; never invent an icon name, 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
|
|
|
@@ -375,10 +375,15 @@ const devToolDefinitions = {
|
|
|
375
375
|
|
|
376
376
|
lowdefy_search_icons: {
|
|
377
377
|
description:
|
|
378
|
-
'Search icon names before using one — never
|
|
378
|
+
'Search icon names before using one — never invent a name. Returns matching semantic names (edit, delete, warning, … and this app\'s theme.icons.aliases) with their targets, then Lucide names in PascalCase, then qualified names (set:Name) from installed icon set plugins. Use a semantic name when one fits, otherwise a Lucide name, in any icon property (icon: edit, icon: Receipt) or in HTML as <i data-icon="edit"></i>.',
|
|
379
379
|
inputSchema: {
|
|
380
380
|
query: z.string().describe('What the icon shows, e.g. "trash" or "arrow right".'),
|
|
381
|
-
limit: z
|
|
381
|
+
limit: z
|
|
382
|
+
.number()
|
|
383
|
+
.int()
|
|
384
|
+
.positive()
|
|
385
|
+
.optional()
|
|
386
|
+
.describe('Max icon names (after semantic names). Default 30.'),
|
|
382
387
|
},
|
|
383
388
|
},
|
|
384
389
|
|
package/lib/docs/getOverview.js
CHANGED
|
@@ -72,7 +72,7 @@ function getOverview() {
|
|
|
72
72
|
'3. **See real usage**: `GET /lowdefy-docs/examples/{type}` — or `lowdefy_get_examples`. YAML examples for block types.',
|
|
73
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`.',
|
|
74
74
|
'5. **Search**: `GET /lowdefy-docs/search?q=...` — or `lowdefy_search_docs`.',
|
|
75
|
-
'6. **Icons**: `GET /lowdefy-docs/icons?q=...` — or `lowdefy_search_icons`.
|
|
75
|
+
'6. **Icons**: `GET /lowdefy-docs/icons?q=...` — or `lowdefy_search_icons`. Use a semantic name (`icon: edit`); otherwise use a Lucide name in PascalCase (`icon: Receipt`) found by search. Never invent a name. In HTML use `<i data-icon="edit"></i>`, `data-tooltip` and `data-popover`.',
|
|
76
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).',
|
|
77
77
|
'',
|
|
78
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.',
|
|
@@ -115,7 +115,7 @@ function getOverview() {
|
|
|
115
115
|
'| `GET /lowdefy-docs/examples/{type}` | Example yaml for a block type |',
|
|
116
116
|
'| `GET /lowdefy-docs/content/{slug}` | Core doc page as markdown |',
|
|
117
117
|
'| `GET /lowdefy-docs/search?q={query}` | Search core docs |',
|
|
118
|
-
'| `GET /lowdefy-docs/icons?q={query}` | Search icon names (semantic names first, then
|
|
118
|
+
'| `GET /lowdefy-docs/icons?q={query}` | Search icon names (semantic names first, then Lucide names, then installed icon sets) |',
|
|
119
119
|
'| `GET /lowdefy-docs/plugin-doc/{package}` | Markdown shipped inside a plugin package |',
|
|
120
120
|
'| `GET /lowdefy-docs/build-status` | Current build errors/warnings, failing pages + recent browser errors |',
|
|
121
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`) |',
|
package/lib/docs/listPlugins.js
CHANGED
|
@@ -29,6 +29,15 @@ function addTypes({ plugins, store, kind }) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// Icon sets are keyed by set id, with one layer per plugin that declares it.
|
|
33
|
+
function addIconSets({ plugins, iconSets }) {
|
|
34
|
+
for (const [setId, layers] of Object.entries(iconSets ?? {})) {
|
|
35
|
+
for (const layer of layers) {
|
|
36
|
+
addTypes({ plugins, store: { [setId]: layer }, kind: 'iconSets' });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
function listPlugins() {
|
|
33
42
|
const availableTypes = readBuildArtifact({ name: 'plugins/availableTypes.json' }) ?? {};
|
|
34
43
|
const customTypesMap = readBuildArtifact({ name: 'customTypesMap.json' }) ?? {};
|
|
@@ -44,6 +53,7 @@ function listPlugins() {
|
|
|
44
53
|
addTypes({ plugins, store: availableTypes.operators?.server, kind: 'operators' });
|
|
45
54
|
addTypes({ plugins, store: availableTypes.requests, kind: 'requests' });
|
|
46
55
|
addTypes({ plugins, store: availableTypes.websockets, kind: 'websockets' });
|
|
56
|
+
addIconSets({ plugins, iconSets: customTypesMap.iconSets });
|
|
47
57
|
|
|
48
58
|
const customPackages = new Set();
|
|
49
59
|
const customStores = [
|
|
@@ -61,6 +71,11 @@ function listPlugins() {
|
|
|
61
71
|
customPackages.add(definition.package);
|
|
62
72
|
}
|
|
63
73
|
}
|
|
74
|
+
for (const layers of Object.values(customTypesMap.iconSets ?? {})) {
|
|
75
|
+
for (const layer of layers) {
|
|
76
|
+
customPackages.add(layer.package);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
|
|
65
80
|
return Object.values(plugins)
|
|
66
81
|
.map((plugin) => ({
|
package/lib/docs/searchIcons.js
CHANGED
|
@@ -14,48 +14,42 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import fs from 'node:fs';
|
|
18
|
-
import { createRequire } from 'node:module';
|
|
19
|
-
import path from 'node:path';
|
|
20
17
|
import { type } from '@lowdefy/helpers';
|
|
21
|
-
import { defaultIconAliases,
|
|
18
|
+
import { defaultIconAliases, getLucideIconNames, loadIconSets } from '@lowdefy/build/dev';
|
|
22
19
|
|
|
23
20
|
import readBuildArtifact from './readBuildArtifact.js';
|
|
24
21
|
|
|
25
|
-
const require = createRequire(import.meta.url);
|
|
26
|
-
|
|
27
22
|
const DEFAULT_LIMIT = 30;
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function getIconNames() {
|
|
41
|
-
if (iconNamesCache !== null) {
|
|
42
|
-
return iconNamesCache;
|
|
24
|
+
let setNamesCache = { key: null, names: [] };
|
|
25
|
+
|
|
26
|
+
// Installed icon sets are read through the loader the build uses, so search
|
|
27
|
+
// and the build agree. Icons a plugin adds to "lucide" are listed unqualified,
|
|
28
|
+
// like Lucide's own; every other set's names are listed qualified, which
|
|
29
|
+
// always resolve. Cached until the plugin list in the build changes.
|
|
30
|
+
async function getSetNames() {
|
|
31
|
+
const iconSets = readBuildArtifact({ name: 'customTypesMap.json' })?.iconSets ?? {};
|
|
32
|
+
const key = JSON.stringify(iconSets);
|
|
33
|
+
if (setNamesCache.key === key) {
|
|
34
|
+
return setNamesCache.names;
|
|
43
35
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const names =
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
|
|
36
|
+
const sets = await loadIconSets({
|
|
37
|
+
context: { directories: { server: process.cwd() }, typesMap: { iconSets } },
|
|
38
|
+
});
|
|
39
|
+
const lucideNames = new Set(Object.values(getLucideIconNames()).flat());
|
|
40
|
+
const names = [];
|
|
41
|
+
Object.entries(sets).forEach(([setId, layers]) => {
|
|
42
|
+
const setNames = new Set(layers.flatMap((layer) => [...layer.names]));
|
|
43
|
+
[...setNames].sort().forEach((name) => {
|
|
44
|
+
if (setId !== 'lucide') {
|
|
45
|
+
names.push(`${setId}:${name}`);
|
|
46
|
+
} else if (!lucideNames.has(name)) {
|
|
47
|
+
names.push(name);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
56
50
|
});
|
|
57
|
-
|
|
58
|
-
return
|
|
51
|
+
setNamesCache = { key, names };
|
|
52
|
+
return names;
|
|
59
53
|
}
|
|
60
54
|
|
|
61
55
|
function matchesWords(text, words) {
|
|
@@ -63,7 +57,7 @@ function matchesWords(text, words) {
|
|
|
63
57
|
return words.every((word) => lowerText.includes(word));
|
|
64
58
|
}
|
|
65
59
|
|
|
66
|
-
function searchIcons({ query, limit = DEFAULT_LIMIT }) {
|
|
60
|
+
async function searchIcons({ query, limit = DEFAULT_LIMIT }) {
|
|
67
61
|
if (!type.isString(query) || query.trim() === '') {
|
|
68
62
|
throw new Error('searchIcons requires a "query" string.');
|
|
69
63
|
}
|
|
@@ -71,22 +65,25 @@ function searchIcons({ query, limit = DEFAULT_LIMIT }) {
|
|
|
71
65
|
.trim()
|
|
72
66
|
.toLowerCase()
|
|
73
67
|
.split(/[\s-]+/);
|
|
74
|
-
// The dev build writes
|
|
75
|
-
// Before the first build only the built-in
|
|
76
|
-
|
|
68
|
+
// The dev build writes the full semantic map (built-in, the default icon
|
|
69
|
+
// set's and theme.icons.aliases). Before the first build only the built-in
|
|
70
|
+
// names are known.
|
|
71
|
+
const semantic = readBuildArtifact({ name: 'iconAliases.json' }) ?? defaultIconAliases;
|
|
77
72
|
|
|
78
|
-
const
|
|
73
|
+
const semanticResults = Object.entries(semantic)
|
|
79
74
|
.filter(([name, icon]) => matchesWords(`${name} ${icon}`, words))
|
|
80
75
|
.map(([name, icon]) => ({ name, icon }));
|
|
81
|
-
|
|
76
|
+
// Canonical Lucide names rank before alias names (Home is an alias of House).
|
|
77
|
+
const { canonical, aliases } = getLucideIconNames();
|
|
78
|
+
const iconResults = [...canonical, ...aliases, ...(await getSetNames())]
|
|
82
79
|
.filter((name) => matchesWords(name, words))
|
|
83
80
|
.slice(0, limit);
|
|
84
81
|
|
|
85
82
|
return {
|
|
86
|
-
|
|
83
|
+
semantic: semanticResults,
|
|
87
84
|
icons: iconResults,
|
|
88
85
|
usage:
|
|
89
|
-
'
|
|
86
|
+
'Use a semantic name from "semantic" (icon: edit, or <i data-icon="edit"></i> in HTML). Otherwise use a Lucide name from "icons" in PascalCase (icon: Receipt). Never invent a name. Qualified names (set:Name) come from installed icon set plugins. Add app-specific semantic names under theme.icons.aliases in lowdefy.yaml.',
|
|
90
87
|
};
|
|
91
88
|
}
|
|
92
89
|
|
|
@@ -16,42 +16,96 @@
|
|
|
16
16
|
|
|
17
17
|
import { jest } from '@jest/globals';
|
|
18
18
|
|
|
19
|
-
// searchIcons reads the dev build's iconAliases.json
|
|
20
|
-
// built server directory
|
|
19
|
+
// searchIcons reads the dev build's iconAliases.json and customTypesMap.json,
|
|
20
|
+
// which only exist in a built server directory, and loads installed icon set
|
|
21
|
+
// plugins through the build's loader. Lucide's names are real.
|
|
21
22
|
const mockReadBuildArtifact = jest.fn();
|
|
22
23
|
jest.unstable_mockModule('./readBuildArtifact.js', () => ({
|
|
23
24
|
default: mockReadBuildArtifact,
|
|
24
25
|
}));
|
|
25
26
|
|
|
27
|
+
const buildDev = await import('@lowdefy/build/dev');
|
|
28
|
+
const mockLoadIconSets = jest.fn();
|
|
29
|
+
jest.unstable_mockModule('@lowdefy/build/dev', () => ({
|
|
30
|
+
...buildDev,
|
|
31
|
+
loadIconSets: mockLoadIconSets,
|
|
32
|
+
}));
|
|
33
|
+
|
|
26
34
|
const { default: searchIcons } = await import('./searchIcons.js');
|
|
27
35
|
|
|
36
|
+
function layer(names) {
|
|
37
|
+
return { names: new Set(names) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function mockArtifacts({ aliases = null, iconSets = {} } = {}) {
|
|
41
|
+
mockReadBuildArtifact.mockImplementation(({ name }) => {
|
|
42
|
+
if (name === 'iconAliases.json') return aliases;
|
|
43
|
+
if (name === 'customTypesMap.json') return { iconSets };
|
|
44
|
+
return null;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
28
48
|
beforeEach(() => {
|
|
29
49
|
mockReadBuildArtifact.mockReset();
|
|
50
|
+
mockLoadIconSets.mockReset();
|
|
51
|
+
mockLoadIconSets.mockResolvedValue({ lucide: [layer([])] });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('searchIcons lists matching semantic names, then canonical Lucide names, then aliases', async () => {
|
|
55
|
+
mockArtifacts({ aliases: { delete: 'Trash', edit: 'Pencil' } });
|
|
56
|
+
const result = await searchIcons({ query: 'trash' });
|
|
57
|
+
expect(result.semantic).toEqual([{ name: 'delete', icon: 'Trash' }]);
|
|
58
|
+
expect(result.icons[0]).toBe('Trash');
|
|
59
|
+
expect(result.icons).toContain('Trash2');
|
|
60
|
+
// Trash2 is a canonical name in Lucide 1.x; aliases come after every canonical name.
|
|
61
|
+
const { canonical } = buildDev.getLucideIconNames();
|
|
62
|
+
const firstAlias = result.icons.findIndex((name) => !canonical.includes(name));
|
|
63
|
+
if (firstAlias !== -1) {
|
|
64
|
+
expect(result.icons.slice(firstAlias).every((name) => !canonical.includes(name))).toBe(true);
|
|
65
|
+
}
|
|
30
66
|
});
|
|
31
67
|
|
|
32
|
-
test('searchIcons
|
|
33
|
-
|
|
34
|
-
const result = searchIcons({ query: '
|
|
35
|
-
expect(result.
|
|
36
|
-
|
|
37
|
-
|
|
68
|
+
test('searchIcons ranks canonical names before Lucide alias names', async () => {
|
|
69
|
+
mockArtifacts();
|
|
70
|
+
const result = await searchIcons({ query: 'house', limit: 100 });
|
|
71
|
+
expect(result.icons).toContain('House');
|
|
72
|
+
const home = await searchIcons({ query: 'home', limit: 100 });
|
|
73
|
+
// Home is an alias of House.
|
|
74
|
+
expect(home.icons).toContain('Home');
|
|
75
|
+
expect(home.icons.indexOf('Home')).toBeGreaterThan(home.icons.indexOf('HousePlus'));
|
|
38
76
|
});
|
|
39
77
|
|
|
40
|
-
test('searchIcons includes theme aliases from the build', () => {
|
|
41
|
-
|
|
42
|
-
const result = searchIcons({ query: 'invoice' });
|
|
43
|
-
expect(result.
|
|
78
|
+
test('searchIcons includes theme aliases from the build', async () => {
|
|
79
|
+
mockArtifacts({ aliases: { invoice: 'Receipt' } });
|
|
80
|
+
const result = await searchIcons({ query: 'invoice' });
|
|
81
|
+
expect(result.semantic).toEqual([{ name: 'invoice', icon: 'Receipt' }]);
|
|
44
82
|
});
|
|
45
83
|
|
|
46
|
-
test('searchIcons falls back to the built-in names before the first build', () => {
|
|
47
|
-
|
|
48
|
-
const result = searchIcons({ query: 'external link' });
|
|
49
|
-
expect(result.
|
|
84
|
+
test('searchIcons falls back to the built-in names before the first build', async () => {
|
|
85
|
+
mockArtifacts();
|
|
86
|
+
const result = await searchIcons({ query: 'external link' });
|
|
87
|
+
expect(result.semantic).toEqual([{ name: 'external-link', icon: 'ExternalLink' }]);
|
|
50
88
|
});
|
|
51
89
|
|
|
52
|
-
test('searchIcons
|
|
53
|
-
|
|
54
|
-
|
|
90
|
+
test('searchIcons lists installed set names qualified, after Lucide names', async () => {
|
|
91
|
+
const iconSets = { tabler: [{ package: '@acme/icons-tabler', version: '1.0.0' }] };
|
|
92
|
+
mockArtifacts({ iconSets });
|
|
93
|
+
mockLoadIconSets.mockResolvedValue({
|
|
94
|
+
lucide: [layer(['Pencil']), layer(['PencilInvoice'])],
|
|
95
|
+
tabler: [layer(['PencilBolt', 'Other'])],
|
|
96
|
+
});
|
|
97
|
+
const result = await searchIcons({ query: 'pencil', limit: 100 });
|
|
98
|
+
expect(result.icons[0]).toBe('Pencil');
|
|
99
|
+
// An icon a plugin adds to lucide is listed unqualified; other sets qualified.
|
|
100
|
+
expect(result.icons.slice(-2)).toEqual(['PencilInvoice', 'tabler:PencilBolt']);
|
|
101
|
+
expect(mockLoadIconSets).toHaveBeenCalledWith({
|
|
102
|
+
context: { directories: { server: process.cwd() }, typesMap: { iconSets } },
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('searchIcons requires every query word to match', async () => {
|
|
107
|
+
mockArtifacts();
|
|
108
|
+
const result = await searchIcons({ query: 'arrow right circle', limit: 50 });
|
|
55
109
|
expect(result.icons.length).toBeGreaterThan(0);
|
|
56
110
|
result.icons.forEach((name) => {
|
|
57
111
|
const lower = name.toLowerCase();
|
|
@@ -61,21 +115,13 @@ test('searchIcons requires every query word to match', () => {
|
|
|
61
115
|
});
|
|
62
116
|
});
|
|
63
117
|
|
|
64
|
-
test('searchIcons caps
|
|
65
|
-
|
|
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.');
|
|
118
|
+
test('searchIcons caps icon names at the limit', async () => {
|
|
119
|
+
mockArtifacts();
|
|
120
|
+
expect((await searchIcons({ query: 'user', limit: 5 })).icons).toHaveLength(5);
|
|
71
121
|
});
|
|
72
122
|
|
|
73
|
-
test('
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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([]);
|
|
123
|
+
test('searchIcons throws without a query', async () => {
|
|
124
|
+
await expect(searchIcons({ query: ' ' })).rejects.toThrow(
|
|
125
|
+
'searchIcons requires a "query" string.'
|
|
126
|
+
);
|
|
81
127
|
});
|
|
@@ -53,12 +53,16 @@ test('getPageJitEnrichment scopes string-form, object-form, and args-nested _js
|
|
|
53
53
|
expect(jsEntries).not.toContain("'hashAbsent'");
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
const zap = { node: [['path', { d: 'M4 14 14 3' }]] };
|
|
57
|
+
const star = { node: [['path', { d: 'M12 2 15 9' }]] };
|
|
58
|
+
const other = { node: [['path', { d: 'M0 0' }]] };
|
|
59
|
+
|
|
56
60
|
test('getPageJitEnrichment discovers an icon name that appears only inside a _js source', () => {
|
|
57
61
|
const client = {
|
|
58
|
-
// The icon name lives only in the function body,
|
|
62
|
+
// The icon name lives only in the function body, single-quoted — the
|
|
59
63
|
// served pageConfig has this replaced by the hash, so scanning the config
|
|
60
|
-
// alone would miss it. Only
|
|
61
|
-
hashIcon:
|
|
64
|
+
// alone would miss it. Only Zap is a dynamic icon.
|
|
65
|
+
hashIcon: "return on ? 'Zap' : 'ZapOff';",
|
|
62
66
|
};
|
|
63
67
|
const pageConfig = {
|
|
64
68
|
id: 'p',
|
|
@@ -67,44 +71,37 @@ test('getPageJitEnrichment discovers an icon name that appears only inside a _js
|
|
|
67
71
|
|
|
68
72
|
const { dynamicIcons } = getPageJitEnrichment({
|
|
69
73
|
pageConfig,
|
|
70
|
-
buildContext: buildContext({ client, dynamicIconData: {
|
|
74
|
+
buildContext: buildContext({ client, dynamicIconData: { Zap: zap } }),
|
|
71
75
|
});
|
|
72
76
|
|
|
73
|
-
expect(dynamicIcons).toEqual({
|
|
77
|
+
expect(dynamicIcons).toEqual({ Zap: zap });
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
test('getPageJitEnrichment scopes icons referenced directly in the page config', () => {
|
|
77
|
-
const pageConfig = { id: 'p', blocks: [{ properties: { icon: '
|
|
81
|
+
const pageConfig = { id: 'p', blocks: [{ properties: { icon: 'Star' } }] };
|
|
78
82
|
|
|
79
83
|
const { dynamicIcons } = getPageJitEnrichment({
|
|
80
84
|
pageConfig,
|
|
81
|
-
buildContext: buildContext({
|
|
82
|
-
dynamicIconData: { FiStar: { tag: 'svg' }, FiOther: { tag: 'svg' } },
|
|
83
|
-
}),
|
|
85
|
+
buildContext: buildContext({ dynamicIconData: { Star: star, Other: other } }),
|
|
84
86
|
});
|
|
85
87
|
|
|
86
|
-
expect(dynamicIcons).toEqual({
|
|
88
|
+
expect(dynamicIcons).toEqual({ Star: star });
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
test('getPageJitEnrichment scopes icons named in data-icon attributes inside HTML', () => {
|
|
90
92
|
const { dynamicIcons } = getPageJitEnrichment({
|
|
91
|
-
pageConfig: { id: 'p', blocks: [{ properties: { html: '<i data-icon="
|
|
92
|
-
buildContext: buildContext({
|
|
93
|
-
dynamicIconData: { LuTrash2: { tag: 'svg' }, LuOther: { tag: 'svg' } },
|
|
94
|
-
}),
|
|
93
|
+
pageConfig: { id: 'p', blocks: [{ properties: { html: '<i data-icon="lucide:Star"></i>' } }] },
|
|
94
|
+
buildContext: buildContext({ dynamicIconData: { 'lucide:Star': star, Other: other } }),
|
|
95
95
|
});
|
|
96
|
-
expect(dynamicIcons).toEqual({
|
|
96
|
+
expect(dynamicIcons).toEqual({ 'lucide:Star': star });
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
test('getPageJitEnrichment scopes semantic icon names used on the page', () => {
|
|
100
100
|
const { dynamicIcons } = getPageJitEnrichment({
|
|
101
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
|
-
},
|
|
102
|
+
buildContext: buildContext({ dynamicIconData: { edit: star, delete: other } }),
|
|
106
103
|
});
|
|
107
|
-
expect(dynamicIcons).toEqual({ edit:
|
|
104
|
+
expect(dynamicIcons).toEqual({ edit: star });
|
|
108
105
|
});
|
|
109
106
|
|
|
110
107
|
test('getPageJitEnrichment returns {} when there is no build context', () => {
|
|
@@ -118,7 +115,7 @@ test('getPageJitEnrichment omits both fields when the page has no dynamic _js or
|
|
|
118
115
|
pageConfig,
|
|
119
116
|
buildContext: buildContext({
|
|
120
117
|
client: { hashUnused: 'return 1;' },
|
|
121
|
-
dynamicIconData: {
|
|
118
|
+
dynamicIconData: { Zap: zap },
|
|
122
119
|
}),
|
|
123
120
|
});
|
|
124
121
|
|
|
@@ -43,11 +43,11 @@ let cachedRegistry = null;
|
|
|
43
43
|
let cachedBuildContext = null;
|
|
44
44
|
let lastInvalidationMtime = null;
|
|
45
45
|
|
|
46
|
-
// Frozen snapshot of icon
|
|
47
|
-
// Module-level so it persists across context resets
|
|
48
|
-
// with newly
|
|
49
|
-
//
|
|
50
|
-
let
|
|
46
|
+
// Frozen snapshot of the icon names in the dev client bundle, from the initial
|
|
47
|
+
// build. Module-level so it persists across context resets: skeleton rebuilds
|
|
48
|
+
// rewrite iconImports.json with newly used names, but those are not in the
|
|
49
|
+
// bundle until the server restarts. JIT delivers the rest as data.
|
|
50
|
+
let bundledIcons = null;
|
|
51
51
|
|
|
52
52
|
function readJsonFile(filePath) {
|
|
53
53
|
try {
|
|
@@ -157,21 +157,13 @@ function getBuildContext(buildDirectory, configDirectory) {
|
|
|
157
157
|
// components.api and every CallAPI action is flagged as a non-existent endpoint.
|
|
158
158
|
cachedBuildContext.components = { api: readBuildApiArtifacts(buildDirectory) };
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// discovers on subsequent rebuilds (those icons aren't bundled yet).
|
|
163
|
-
// bundledIconImports is module-level and only resets on server restart.
|
|
164
|
-
if (!bundledIconImports) {
|
|
165
|
-
bundledIconImports = readJsonFile(path.join(buildDirectory, 'iconImports.json')) ?? [];
|
|
160
|
+
if (!bundledIcons) {
|
|
161
|
+
bundledIcons = new Set(readJsonFile(path.join(buildDirectory, 'iconImports.json')) ?? []);
|
|
166
162
|
}
|
|
167
|
-
cachedBuildContext.
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
readJsonFile(path.join(buildDirectory, 'iconAliases.json')) ?? {};
|
|
172
|
-
|
|
173
|
-
// Accumulator for dynamically extracted icon SVG data written to plugins/iconsDynamic.js.
|
|
174
|
-
// Reset on skeleton rebuild (cachedBuildContext = null) — JIT re-discovers as needed.
|
|
163
|
+
cachedBuildContext.bundledIcons = bundledIcons;
|
|
164
|
+
// IconData delivered to pages as _dynamicIcons. Reset on skeleton rebuild
|
|
165
|
+
// (cachedBuildContext = null), since theme.icons or icon set plugins may have
|
|
166
|
+
// changed; JIT re-resolves as pages are requested.
|
|
175
167
|
cachedBuildContext.dynamicIconData = {};
|
|
176
168
|
|
|
177
169
|
// Advance makeId past all skeleton IDs to prevent collisions with JIT builds
|
|
@@ -272,16 +264,12 @@ function collectJsHashes(node, hashes) {
|
|
|
272
264
|
// Reproduce that surface: scan the served config plus the page's own client _js
|
|
273
265
|
// source strings, and keep only names present in dynamicIconData (which holds
|
|
274
266
|
// only JIT-discovered icons — static ones are already in the client bundle).
|
|
275
|
-
function scopeDynamicIcons({ pageConfig, scopedJsMap, dynamicIconData
|
|
267
|
+
function scopeDynamicIcons({ pageConfig, scopedJsMap, dynamicIconData }) {
|
|
276
268
|
if (Object.keys(dynamicIconData).length === 0) return undefined;
|
|
277
269
|
const scanText = [JSON.stringify(pageConfig), ...Object.values(scopedJsMap)].join('\n');
|
|
278
|
-
const { aliasNames, packageIcons } = collectIconNames({ json: scanText, aliases: iconAliases });
|
|
279
270
|
const found = {};
|
|
280
|
-
for (const name of
|
|
281
|
-
|
|
282
|
-
...aliasNames,
|
|
283
|
-
]) {
|
|
284
|
-
if (dynamicIconData[name]) {
|
|
271
|
+
for (const name of collectIconNames({ text: scanText })) {
|
|
272
|
+
if (Object.hasOwn(dynamicIconData, name)) {
|
|
285
273
|
found[name] = dynamicIconData[name];
|
|
286
274
|
}
|
|
287
275
|
}
|
|
@@ -317,7 +305,6 @@ export function getPageJitEnrichment({ pageConfig, buildContext = cachedBuildCon
|
|
|
317
305
|
pageConfig,
|
|
318
306
|
scopedJsMap,
|
|
319
307
|
dynamicIconData: buildContext.dynamicIconData ?? {},
|
|
320
|
-
iconAliases: buildContext.iconAliases ?? {},
|
|
321
308
|
});
|
|
322
309
|
|
|
323
310
|
return { jsEntries, dynamicIcons };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260926183344",
|
|
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-
|
|
49
|
-
"@lowdefy/api": "0.0.0-experimental-
|
|
50
|
-
"@lowdefy/block-utils": "0.0.0-experimental-
|
|
51
|
-
"@lowdefy/blocks-aggrid": "0.0.0-experimental-
|
|
52
|
-
"@lowdefy/blocks-antd": "0.0.0-experimental-
|
|
53
|
-
"@lowdefy/blocks-antd-x": "0.0.0-experimental-
|
|
54
|
-
"@lowdefy/blocks-basic": "0.0.0-experimental-
|
|
55
|
-
"@lowdefy/blocks-captcha": "0.0.0-experimental-
|
|
56
|
-
"@lowdefy/blocks-echarts": "0.0.0-experimental-
|
|
57
|
-
"@lowdefy/blocks-loaders": "0.0.0-experimental-
|
|
58
|
-
"@lowdefy/blocks-markdown": "0.0.0-experimental-
|
|
59
|
-
"@lowdefy/blocks-tiptap": "0.0.0-experimental-
|
|
60
|
-
"@lowdefy/build": "0.0.0-experimental-
|
|
61
|
-
"@lowdefy/client": "0.0.0-experimental-
|
|
62
|
-
"@lowdefy/connection-axios-http": "0.0.0-experimental-
|
|
63
|
-
"@lowdefy/connection-mongodb": "0.0.0-experimental-
|
|
64
|
-
"@lowdefy/docs-content": "0.0.0-experimental-
|
|
65
|
-
"@lowdefy/e2e-utils": "0.0.0-experimental-
|
|
66
|
-
"@lowdefy/engine": "0.0.0-experimental-
|
|
67
|
-
"@lowdefy/errors": "0.0.0-experimental-
|
|
68
|
-
"@lowdefy/helpers": "0.0.0-experimental-
|
|
69
|
-
"@lowdefy/layout": "0.0.0-experimental-
|
|
70
|
-
"@lowdefy/logger": "0.0.0-experimental-
|
|
71
|
-
"@lowdefy/node-utils": "0.0.0-experimental-
|
|
72
|
-
"@lowdefy/operators-change-case": "0.0.0-experimental-
|
|
73
|
-
"@lowdefy/operators-cron": "0.0.0-experimental-
|
|
74
|
-
"@lowdefy/operators-dayjs": "0.0.0-experimental-
|
|
75
|
-
"@lowdefy/operators-diff": "0.0.0-experimental-
|
|
76
|
-
"@lowdefy/operators-js": "0.0.0-experimental-
|
|
77
|
-
"@lowdefy/operators-mql": "0.0.0-experimental-
|
|
78
|
-
"@lowdefy/operators-nunjucks": "0.0.0-experimental-
|
|
79
|
-
"@lowdefy/operators-uuid": "0.0.0-experimental-
|
|
80
|
-
"@lowdefy/operators-yaml": "0.0.0-experimental-
|
|
81
|
-
"@lowdefy/plugin-better-auth": "0.0.0-experimental-
|
|
82
|
-
"@lowdefy/websockets-core": "0.0.0-experimental-
|
|
48
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260926183344",
|
|
49
|
+
"@lowdefy/api": "0.0.0-experimental-20260926183344",
|
|
50
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260926183344",
|
|
51
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20260926183344",
|
|
52
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260926183344",
|
|
53
|
+
"@lowdefy/blocks-antd-x": "0.0.0-experimental-20260926183344",
|
|
54
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260926183344",
|
|
55
|
+
"@lowdefy/blocks-captcha": "0.0.0-experimental-20260926183344",
|
|
56
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20260926183344",
|
|
57
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260926183344",
|
|
58
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260926183344",
|
|
59
|
+
"@lowdefy/blocks-tiptap": "0.0.0-experimental-20260926183344",
|
|
60
|
+
"@lowdefy/build": "0.0.0-experimental-20260926183344",
|
|
61
|
+
"@lowdefy/client": "0.0.0-experimental-20260926183344",
|
|
62
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260926183344",
|
|
63
|
+
"@lowdefy/connection-mongodb": "0.0.0-experimental-20260926183344",
|
|
64
|
+
"@lowdefy/docs-content": "0.0.0-experimental-20260926183344",
|
|
65
|
+
"@lowdefy/e2e-utils": "0.0.0-experimental-20260926183344",
|
|
66
|
+
"@lowdefy/engine": "0.0.0-experimental-20260926183344",
|
|
67
|
+
"@lowdefy/errors": "0.0.0-experimental-20260926183344",
|
|
68
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260926183344",
|
|
69
|
+
"@lowdefy/layout": "0.0.0-experimental-20260926183344",
|
|
70
|
+
"@lowdefy/logger": "0.0.0-experimental-20260926183344",
|
|
71
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260926183344",
|
|
72
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20260926183344",
|
|
73
|
+
"@lowdefy/operators-cron": "0.0.0-experimental-20260926183344",
|
|
74
|
+
"@lowdefy/operators-dayjs": "0.0.0-experimental-20260926183344",
|
|
75
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20260926183344",
|
|
76
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260926183344",
|
|
77
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20260926183344",
|
|
78
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260926183344",
|
|
79
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260926183344",
|
|
80
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20260926183344",
|
|
81
|
+
"@lowdefy/plugin-better-auth": "0.0.0-experimental-20260926183344",
|
|
82
|
+
"@lowdefy/websockets-core": "0.0.0-experimental-20260926183344",
|
|
83
83
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
84
84
|
"@tailwindcss/postcss": "4.3.1",
|
|
85
85
|
"@vitejs/plugin-react": "6.0.2",
|
|
@@ -97,7 +97,6 @@
|
|
|
97
97
|
"process": "0.11.10",
|
|
98
98
|
"react": "18.2.0",
|
|
99
99
|
"react-dom": "18.2.0",
|
|
100
|
-
"react-icons": "5.6.0",
|
|
101
100
|
"swr": "2.2.4",
|
|
102
101
|
"tailwindcss": "4.3.1",
|
|
103
102
|
"tinykeys": "3.0.0",
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260926183344",
|
|
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-
|
|
55
|
-
"@lowdefy/api": "0.0.0-experimental-
|
|
56
|
-
"@lowdefy/block-utils": "0.0.0-experimental-
|
|
57
|
-
"@lowdefy/blocks-aggrid": "0.0.0-experimental-
|
|
58
|
-
"@lowdefy/blocks-antd": "0.0.0-experimental-
|
|
59
|
-
"@lowdefy/blocks-antd-x": "0.0.0-experimental-
|
|
60
|
-
"@lowdefy/blocks-basic": "0.0.0-experimental-
|
|
61
|
-
"@lowdefy/blocks-captcha": "0.0.0-experimental-
|
|
62
|
-
"@lowdefy/blocks-echarts": "0.0.0-experimental-
|
|
63
|
-
"@lowdefy/blocks-loaders": "0.0.0-experimental-
|
|
64
|
-
"@lowdefy/blocks-markdown": "0.0.0-experimental-
|
|
65
|
-
"@lowdefy/blocks-tiptap": "0.0.0-experimental-
|
|
66
|
-
"@lowdefy/build": "0.0.0-experimental-
|
|
67
|
-
"@lowdefy/client": "0.0.0-experimental-
|
|
68
|
-
"@lowdefy/connection-axios-http": "0.0.0-experimental-
|
|
69
|
-
"@lowdefy/connection-mongodb": "0.0.0-experimental-
|
|
70
|
-
"@lowdefy/docs-content": "0.0.0-experimental-
|
|
71
|
-
"@lowdefy/e2e-utils": "0.0.0-experimental-
|
|
72
|
-
"@lowdefy/engine": "0.0.0-experimental-
|
|
73
|
-
"@lowdefy/errors": "0.0.0-experimental-
|
|
74
|
-
"@lowdefy/helpers": "0.0.0-experimental-
|
|
75
|
-
"@lowdefy/layout": "0.0.0-experimental-
|
|
76
|
-
"@lowdefy/logger": "0.0.0-experimental-
|
|
77
|
-
"@lowdefy/node-utils": "0.0.0-experimental-
|
|
78
|
-
"@lowdefy/operators-change-case": "0.0.0-experimental-
|
|
79
|
-
"@lowdefy/operators-cron": "0.0.0-experimental-
|
|
80
|
-
"@lowdefy/operators-dayjs": "0.0.0-experimental-
|
|
81
|
-
"@lowdefy/operators-diff": "0.0.0-experimental-
|
|
82
|
-
"@lowdefy/operators-js": "0.0.0-experimental-
|
|
83
|
-
"@lowdefy/operators-mql": "0.0.0-experimental-
|
|
84
|
-
"@lowdefy/operators-nunjucks": "0.0.0-experimental-
|
|
85
|
-
"@lowdefy/operators-uuid": "0.0.0-experimental-
|
|
86
|
-
"@lowdefy/operators-yaml": "0.0.0-experimental-
|
|
87
|
-
"@lowdefy/plugin-better-auth": "0.0.0-experimental-
|
|
88
|
-
"@lowdefy/websockets-core": "0.0.0-experimental-
|
|
54
|
+
"@lowdefy/actions-core": "0.0.0-experimental-20260926183344",
|
|
55
|
+
"@lowdefy/api": "0.0.0-experimental-20260926183344",
|
|
56
|
+
"@lowdefy/block-utils": "0.0.0-experimental-20260926183344",
|
|
57
|
+
"@lowdefy/blocks-aggrid": "0.0.0-experimental-20260926183344",
|
|
58
|
+
"@lowdefy/blocks-antd": "0.0.0-experimental-20260926183344",
|
|
59
|
+
"@lowdefy/blocks-antd-x": "0.0.0-experimental-20260926183344",
|
|
60
|
+
"@lowdefy/blocks-basic": "0.0.0-experimental-20260926183344",
|
|
61
|
+
"@lowdefy/blocks-captcha": "0.0.0-experimental-20260926183344",
|
|
62
|
+
"@lowdefy/blocks-echarts": "0.0.0-experimental-20260926183344",
|
|
63
|
+
"@lowdefy/blocks-loaders": "0.0.0-experimental-20260926183344",
|
|
64
|
+
"@lowdefy/blocks-markdown": "0.0.0-experimental-20260926183344",
|
|
65
|
+
"@lowdefy/blocks-tiptap": "0.0.0-experimental-20260926183344",
|
|
66
|
+
"@lowdefy/build": "0.0.0-experimental-20260926183344",
|
|
67
|
+
"@lowdefy/client": "0.0.0-experimental-20260926183344",
|
|
68
|
+
"@lowdefy/connection-axios-http": "0.0.0-experimental-20260926183344",
|
|
69
|
+
"@lowdefy/connection-mongodb": "0.0.0-experimental-20260926183344",
|
|
70
|
+
"@lowdefy/docs-content": "0.0.0-experimental-20260926183344",
|
|
71
|
+
"@lowdefy/e2e-utils": "0.0.0-experimental-20260926183344",
|
|
72
|
+
"@lowdefy/engine": "0.0.0-experimental-20260926183344",
|
|
73
|
+
"@lowdefy/errors": "0.0.0-experimental-20260926183344",
|
|
74
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260926183344",
|
|
75
|
+
"@lowdefy/layout": "0.0.0-experimental-20260926183344",
|
|
76
|
+
"@lowdefy/logger": "0.0.0-experimental-20260926183344",
|
|
77
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260926183344",
|
|
78
|
+
"@lowdefy/operators-change-case": "0.0.0-experimental-20260926183344",
|
|
79
|
+
"@lowdefy/operators-cron": "0.0.0-experimental-20260926183344",
|
|
80
|
+
"@lowdefy/operators-dayjs": "0.0.0-experimental-20260926183344",
|
|
81
|
+
"@lowdefy/operators-diff": "0.0.0-experimental-20260926183344",
|
|
82
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260926183344",
|
|
83
|
+
"@lowdefy/operators-mql": "0.0.0-experimental-20260926183344",
|
|
84
|
+
"@lowdefy/operators-nunjucks": "0.0.0-experimental-20260926183344",
|
|
85
|
+
"@lowdefy/operators-uuid": "0.0.0-experimental-20260926183344",
|
|
86
|
+
"@lowdefy/operators-yaml": "0.0.0-experimental-20260926183344",
|
|
87
|
+
"@lowdefy/plugin-better-auth": "0.0.0-experimental-20260926183344",
|
|
88
|
+
"@lowdefy/websockets-core": "0.0.0-experimental-20260926183344",
|
|
89
89
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
90
90
|
"@tailwindcss/postcss": "4.3.1",
|
|
91
91
|
"@vitejs/plugin-react": "6.0.2",
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
"process": "0.11.10",
|
|
104
104
|
"react": "18.2.0",
|
|
105
105
|
"react-dom": "18.2.0",
|
|
106
|
-
"react-icons": "5.6.0",
|
|
107
106
|
"swr": "2.2.4",
|
|
108
107
|
"tailwindcss": "4.3.1",
|
|
109
108
|
"tinykeys": "3.0.0",
|
package/src/routes/docs/icons.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import searchIcons from '../../../lib/docs/searchIcons.js';
|
|
18
18
|
|
|
19
|
-
function docsIconsHandler(c) {
|
|
19
|
+
async function docsIconsHandler(c) {
|
|
20
20
|
const query = c.req.query('q');
|
|
21
21
|
if (!query || query.trim() === '') {
|
|
22
22
|
return c.json(
|
|
@@ -24,7 +24,7 @@ function docsIconsHandler(c) {
|
|
|
24
24
|
400
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
return c.json(searchIcons({ query }));
|
|
27
|
+
return c.json(await searchIcons({ query }));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export default docsIconsHandler;
|
|
@@ -94,7 +94,7 @@ test('jitPageHandler folds _jsEntries and _dynamicIcons onto the ok response', a
|
|
|
94
94
|
mockGetPageConfig.mockResolvedValue({ status: 'ok', pageConfig: { id: 'dashboard' } });
|
|
95
95
|
mockGetPageJitEnrichment.mockReturnValueOnce({
|
|
96
96
|
jsEntries: 'export default {};',
|
|
97
|
-
dynamicIcons: {
|
|
97
|
+
dynamicIcons: { Zap: { node: [['path', { d: 'M0 0' }]] } },
|
|
98
98
|
});
|
|
99
99
|
const res = await createApp().request('/api/page/dashboard');
|
|
100
100
|
expect(res.status).toEqual(200);
|
|
@@ -102,6 +102,6 @@ test('jitPageHandler folds _jsEntries and _dynamicIcons onto the ok response', a
|
|
|
102
102
|
expect(body).toEqual({
|
|
103
103
|
id: 'dashboard',
|
|
104
104
|
_jsEntries: 'export default {};',
|
|
105
|
-
_dynamicIcons: {
|
|
105
|
+
_dynamicIcons: { Zap: { node: [['path', { d: 'M0 0' }]] } },
|
|
106
106
|
});
|
|
107
107
|
});
|