@1money/component-ui 0.1.17 → 0.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1money/component-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "React Components based on primereact for 1money front-end projects",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -514,21 +514,13 @@
514
514
  "dependencies": {
515
515
  "@1money/hooks": "0.1.4",
516
516
  "@babel/runtime": "^7.27.0",
517
- "@dnd-kit/core": "^6.3.1",
518
- "@dnd-kit/sortable": "^10.0.0",
519
- "@dnd-kit/utilities": "^3.2.2",
520
517
  "@floating-ui/react": "^0.27.19",
521
518
  "@modelcontextprotocol/sdk": "^1.29.0",
522
519
  "bignumber.js": "^9.3.0",
523
520
  "classnames": "~2.2.6",
524
521
  "clsx": "^2.1.1",
525
- "lodash.debounce": "^4.0.8",
526
- "lodash.isequal": "^4.5.0",
527
522
  "lottie-web": "^5.12.2",
528
- "react-calendar": "^6.0.0",
529
- "react-hook-form": "^7.54.0",
530
523
  "react-number-format": "^5.4.4",
531
- "react-pro-sidebar": "^1.1.0",
532
524
  "react-tooltip": "^5.28.1",
533
525
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
534
526
  },
@@ -571,8 +563,6 @@
571
563
  "@types/enzyme": "3.10.18",
572
564
  "@types/jest": "29.5.12",
573
565
  "@types/jsdom": "^21.1.7",
574
- "@types/lodash.debounce": "^4.0.9",
575
- "@types/lodash.isequal": "^4.5.8",
576
566
  "@types/node": "~18.19.86",
577
567
  "@types/react": "~19.1.2",
578
568
  "@types/react-dom": "~19.1.2",
@@ -687,7 +677,6 @@
687
677
  "yaml@^2.0.0": "2.9.0"
688
678
  },
689
679
  "patchedDependencies": {
690
- "react-pro-sidebar": "patches/react-pro-sidebar.patch",
691
680
  "primereact": "patches/primereact.patch"
692
681
  }
693
682
  }
@@ -16,6 +16,11 @@ tokens, icons), `examples.generated.json` (content-hashed example bodies), and
16
16
  `drift.json` (export-map audit) — then exposes 8 MCP tools. See §3 of
17
17
  `docs/plans/2026-04-21-component-library-mcp.md` for the design background.
18
18
 
19
+ `get_symbol` and `resolve_import` share lookup tables prepared from the index
20
+ at startup, so requests do not rebuild them. The tables retain the existing
21
+ duplicate-name and namespace-owner precedence. Direct handler calls without
22
+ a prepared context continue to derive their lookups from the supplied index.
23
+
19
24
  ## Usage — consumer `.mcp.json`
20
25
 
21
26
  Add this to the downstream repo's `.mcp.json` (Claude Code, Cursor, and any other
@@ -30,6 +30,7 @@ import listIcons from './tools/list-icons.mjs';
30
30
  import getToken from './tools/get-token.mjs';
31
31
  import resolveImport from './tools/resolve-import.mjs';
32
32
  import getLibraryInfo from './tools/get-library-info.mjs';
33
+ import { buildSymbolLookups } from './tools/symbol-lookups.mjs';
33
34
 
34
35
  const EXPECTED_SCHEMA_VERSION = '1';
35
36
  const SERVER_NAME = '1money-components-ui';
@@ -222,7 +223,7 @@ async function loadContext() {
222
223
  process.exit(1);
223
224
  }
224
225
 
225
- return { index, drift, examplesIndex, pkg };
226
+ return { index, drift, examplesIndex, pkg, symbolLookups: buildSymbolLookups(index) };
226
227
  }
227
228
 
228
229
  function toToolResult(value) {
@@ -8,6 +8,8 @@
8
8
  * algorithm.
9
9
  */
10
10
 
11
+ import { buildSymbolLookups } from './symbol-lookups.mjs';
12
+
11
13
  const VALID_INCLUDES = ['props', 'examples', 'members', 'notes', 'related'];
12
14
  const DEFAULT_INCLUDE = ['props', 'members'];
13
15
  const LOCAL_PREFIX = '$local:';
@@ -39,30 +41,6 @@ function validateInput(input) {
39
41
  return { name: args.name.trim(), include };
40
42
  }
41
43
 
42
- /**
43
- * Build a name -> symbol map and a reverse owner lookup that maps any flat
44
- * member name back to its owner module (so we can populate namespaceAccess).
45
- */
46
- function buildLookups(index) {
47
- const byName = new Map();
48
- const ownerLookup = new Map();
49
- for (const sym of index.symbols) {
50
- byName.set(sym.name, sym);
51
- }
52
- for (const sym of index.symbols) {
53
- if (sym.kind === 'module' && sym.memberMap && typeof sym.memberMap === 'object') {
54
- for (const [key, target] of Object.entries(sym.memberMap)) {
55
- if (typeof target === 'string' && !target.startsWith(LOCAL_PREFIX)) {
56
- if (!ownerLookup.has(target)) {
57
- ownerLookup.set(target, { owner: sym.name, memberKey: key });
58
- }
59
- }
60
- }
61
- }
62
- }
63
- return { byName, ownerLookup };
64
- }
65
-
66
44
  function notExported(inputName, hint) {
67
45
  return { kind: 'not_exported', name: inputName, inputName, hint };
68
46
  }
@@ -206,7 +184,9 @@ function resolveDotted(inputName, byName) {
206
184
  export default function getSymbol(input, ctx) {
207
185
  const { name, include } = validateInput(input);
208
186
  const { index, examplesIndex } = ctx;
209
- const { byName, ownerLookup } = buildLookups(index);
187
+ const { byName, ownerLookup } = ctx.symbolLookups?.index === index
188
+ ? ctx.symbolLookups
189
+ : buildSymbolLookups(index);
210
190
  const recordCtx = { ownerLookup, include, examplesIndex };
211
191
 
212
192
  // Step 1: dotted-path attempt.
@@ -9,6 +9,8 @@
9
9
  * names are string keys, not exported symbols.
10
10
  */
11
11
 
12
+ import { buildSymbolLookups } from './symbol-lookups.mjs';
13
+
12
14
  const LOCAL_PREFIX = '$local:';
13
15
  const ICONS_DOTTED = /^Icons\.[A-Z][A-Za-z0-9]*$/;
14
16
 
@@ -20,24 +22,6 @@ function validateInput(input) {
20
22
  return { symbol: args.symbol.trim() };
21
23
  }
22
24
 
23
- function buildLookups(index) {
24
- const byName = new Map();
25
- const ownerLookup = new Map();
26
- for (const sym of index.symbols) byName.set(sym.name, sym);
27
- for (const sym of index.symbols) {
28
- if (sym.kind === 'module' && sym.memberMap) {
29
- for (const [key, target] of Object.entries(sym.memberMap)) {
30
- if (typeof target === 'string' && !target.startsWith(LOCAL_PREFIX)) {
31
- if (!ownerLookup.has(target)) {
32
- ownerLookup.set(target, { owner: sym.name, memberKey: key });
33
- }
34
- }
35
- }
36
- }
37
- }
38
- return { byName, ownerLookup };
39
- }
40
-
41
25
  function notFound(inputSymbol, hint) {
42
26
  return { found: false, inputSymbol, hint };
43
27
  }
@@ -87,7 +71,9 @@ export default function resolveImport(input, ctx) {
87
71
  );
88
72
  }
89
73
 
90
- const { byName, ownerLookup } = buildLookups(index);
74
+ const { byName, importOwnerLookup: ownerLookup } = ctx.symbolLookups?.index === index
75
+ ? ctx.symbolLookups
76
+ : buildSymbolLookups(index);
91
77
 
92
78
  // Dotted path: owner.member
93
79
  if (symbol.includes('.')) {
@@ -0,0 +1,29 @@
1
+ /** Build the lookup tables once for a server's static index snapshot. */
2
+ export function buildSymbolLookups(index) {
3
+ const byName = new Map();
4
+ const ownerLookup = new Map();
5
+ const importOwnerLookup = new Map();
6
+
7
+ for (const symbol of index.symbols) {
8
+ byName.set(symbol.name, symbol);
9
+ }
10
+ for (const symbol of index.symbols) {
11
+ if (symbol.kind !== 'module' || !symbol.memberMap) continue;
12
+
13
+ for (const [key, target] of Object.entries(symbol.memberMap)) {
14
+ if (typeof target !== 'string' || target.startsWith('$local:')) continue;
15
+
16
+ const owner = { owner: symbol.name, memberKey: key };
17
+ // Preserve the handlers' existing guards for non-object member maps:
18
+ // get_symbol skips them; resolve_import also inspects their entries.
19
+ if (typeof symbol.memberMap === 'object' && !ownerLookup.has(target)) {
20
+ ownerLookup.set(target, owner);
21
+ }
22
+ if (!importOwnerLookup.has(target)) {
23
+ importOwnerLookup.set(target, owner);
24
+ }
25
+ }
26
+ }
27
+
28
+ return { index, byName, ownerLookup, importOwnerLookup };
29
+ }