@salmonui/mcp 0.0.0-stage → 0.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NuLL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # @salmonui/mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that lets
4
+ coding agents (Claude Code, Cursor, Codex, VS Code and any other MCP client)
5
+ use Salmon UI correctly: find the right package and entry, read component
6
+ APIs, copy working demo code and check the imports they write.
7
+
8
+ Everything is answered from an index bundled in the package, built from the
9
+ docs, the API reference and the demos of the same Salmon UI version. It
10
+ works offline, sends nothing anywhere and has no runtime dependencies.
11
+ Requires Node.js 22 or later.
12
+
13
+ ## Setup
14
+
15
+ Pin the version your app uses (`@salmonui/mcp@0.2.0`) so the answers match
16
+ your `@salmonui/*` packages; `@salmonui/mcp` alone runs the latest release.
17
+
18
+ ### Claude Code
19
+
20
+ ```sh
21
+ claude mcp add salmonui -- npx -y @salmonui/mcp
22
+ ```
23
+
24
+ Add `--scope project` to share it with your team through `.mcp.json`.
25
+
26
+ ### Cursor
27
+
28
+ `.cursor/mcp.json` in the project (or `~/.cursor/mcp.json` for every project):
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "salmonui": { "command": "npx", "args": ["-y", "@salmonui/mcp"] }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### Codex
39
+
40
+ ```sh
41
+ codex mcp add salmonui -- npx -y @salmonui/mcp
42
+ ```
43
+
44
+ or in `~/.codex/config.toml`:
45
+
46
+ ```toml
47
+ [mcp_servers.salmonui]
48
+ command = "npx"
49
+ args = ["-y", "@salmonui/mcp"]
50
+ ```
51
+
52
+ ### VS Code (GitHub Copilot agent mode)
53
+
54
+ `.vscode/mcp.json` in the workspace:
55
+
56
+ ```json
57
+ {
58
+ "servers": {
59
+ "salmonui": { "type": "stdio", "command": "npx", "args": ["-y", "@salmonui/mcp"] }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### Other clients
65
+
66
+ Run `npx -y @salmonui/mcp` as a stdio server. On Windows, clients that do
67
+ not resolve `npx` themselves need `"command": "cmd", "args": ["/c", "npx", "-y", "@salmonui/mcp"]`.
68
+
69
+ ## Tools
70
+
71
+ | Tool | Arguments | Returns |
72
+ | --- | --- | --- |
73
+ | `list_components` | `filter?` | Every package and component family: import specifier, stylesheet, components, hooks, one-line description. |
74
+ | `search_docs` | `query`, `limit?` (1-10, default 3) | The best docs pages with their URL and best matching sections in Markdown. |
75
+ | `get_component` | `name` | A component, hook, function, type or whole family (`DataGrid`, `useToast`, `date-picker`, `@salmonui/buttons/menu`): import line, stylesheets, props with types, defaults and docs, events, docs links. |
76
+ | `get_example` | `id?` or `query?` | The full source of a docs demo with its description, plus other matches. |
77
+ | `check_imports` | `code`, `stylesheets?` | Problems in the `@salmonui/*` imports of a module: unknown entries or names, private `/internal/*` modules, removed packages with their replacement, missing `@salmonui/core/styles.css` or family stylesheets. |
78
+
79
+ All tools are read-only. The server also sends instructions that tell the
80
+ agent to import `@salmonui/core/styles.css` once and to run `check_imports`
81
+ on the code it writes.
82
+
83
+ ## Protocol
84
+
85
+ MCP over stdio (newline-delimited JSON-RPC 2.0). The server supports the
86
+ stateless `2026-07-28` revision (`server/discover`, per-request `_meta`) and
87
+ the handshake revisions `2025-11-25`, `2025-06-18`, `2025-03-26` and
88
+ `2024-11-05` (`initialize`, `notifications/initialized`, `ping`), so current
89
+ and older clients both connect. It exits when its stdin closes.
90
+
91
+ `salmonui-mcp --version` prints the Salmon UI version of the bundled index;
92
+ `SALMONUI_MCP_INDEX=<file>` serves another index file.
93
+
94
+ ## Programmatic use
95
+
96
+ ```ts
97
+ import { loadIndex, McpServer } from '@salmonui/mcp';
98
+
99
+ const server = new McpServer({ index: loadIndex() });
100
+ const line = server.handleLine('{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}');
101
+ ```
102
+
103
+ Documentation: https://salmonui.dev
104
+
105
+ License: MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ // salmonui-mcp: the Salmon UI MCP server over stdio.
3
+ //
4
+ // claude mcp add salmonui -- npx -y @salmonui/mcp
5
+ //
6
+ // Options: --version, --help. `SALMONUI_MCP_INDEX` points at another index file.
7
+ import { defaultIndexPath, loadIndex } from './data.js';
8
+ import { McpServer } from './server.js';
9
+ import { serveStdio } from './stdio.js';
10
+ const args = process.argv.slice(2);
11
+ if (args.includes('--help') || args.includes('-h')) {
12
+ process.stdout.write('salmonui-mcp: Model Context Protocol server for Salmon UI (stdio).\n\n' +
13
+ 'Register it with your agent, e.g.\n claude mcp add salmonui -- npx -y @salmonui/mcp\n\n' +
14
+ 'Tools: list_components, search_docs, get_component, get_example, check_imports.\n' +
15
+ 'Options: --version, --help. Env: SALMONUI_MCP_INDEX=<index.json>.\n');
16
+ }
17
+ else {
18
+ let index;
19
+ try {
20
+ index = loadIndex(defaultIndexPath());
21
+ }
22
+ catch (error) {
23
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
24
+ process.exit(1);
25
+ }
26
+ if (args.includes('--version') || args.includes('-v')) {
27
+ process.stdout.write(`${index.version}\n`);
28
+ }
29
+ else {
30
+ const server = new McpServer({ index });
31
+ process.stderr.write(`salmonui-mcp ${index.version}: ${index.symbols.length} symbols, ${index.docs.length} docs pages, ${index.demos.length} demos; listening on stdio\n`);
32
+ serveStdio(server, { input: process.stdin, output: process.stdout }).then(() => process.exit(0), (error) => {
33
+ process.stderr.write(`salmonui-mcp: ${error instanceof Error ? error.message : String(error)}\n`);
34
+ process.exit(1);
35
+ });
36
+ }
37
+ }
38
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,qDAAqD;AACrD,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,iFAAiF;AACjF,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KA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AI,CACvE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EACrB,CAAC,KAAc,EAAE,EAAE;YACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAClG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/data.d.ts ADDED
@@ -0,0 +1,121 @@
1
+ export declare const INDEX_FORMAT = 1;
2
+ export type SymbolKind = 'component' | 'function' | 'class' | 'interface' | 'type' | 'const' | 'enum' | 'namespace';
3
+ export interface IndexFamily {
4
+ /** Family slug (`button`, `date-picker`). */
5
+ readonly name: string;
6
+ /** Public import specifier (`@salmonui/buttons/button`). */
7
+ readonly specifier: string;
8
+ /** Further public entries of the family (`@salmonui/charts/chart/features`). */
9
+ readonly subpaths: readonly string[];
10
+ /** The family stylesheet specifier, or null when the family has no own CSS. */
11
+ readonly stylesheet: string | null;
12
+ /** One sentence. */
13
+ readonly summary: string;
14
+ /** Component names exported by the family entry. */
15
+ readonly components: readonly string[];
16
+ /** Hook names (`use*`) exported by the family entry. */
17
+ readonly hooks: readonly string[];
18
+ /** Docs page paths that import the family. */
19
+ readonly docs: readonly string[];
20
+ /**
21
+ * Stylesheets of other families to import with this one because its
22
+ * stylesheet does not carry them; `when` is null when always needed.
23
+ * Every other family it renders is carried by its own stylesheet.
24
+ */
25
+ readonly alsoImport?: readonly {
26
+ readonly stylesheet: string;
27
+ readonly when: string | null;
28
+ }[];
29
+ }
30
+ export interface IndexPackage {
31
+ readonly name: string;
32
+ readonly description: string;
33
+ readonly react: 'required' | 'optional' | 'none';
34
+ readonly deps: readonly string[];
35
+ readonly optionalPeers: readonly string[];
36
+ /** Package-wide stylesheet aggregate (`@salmonui/buttons/styles.css`), when there is one. */
37
+ readonly stylesheet: string | null;
38
+ readonly families: readonly IndexFamily[];
39
+ /** Public JS entries that are not a family (`@salmonui/core/theme`, `@salmonui/data-grid/engine/sort`). */
40
+ readonly entries: readonly string[];
41
+ }
42
+ export interface IndexEntry {
43
+ readonly specifier: string;
44
+ readonly package: string;
45
+ readonly kind: 'js' | 'css';
46
+ /** Family slug the entry belongs to. */
47
+ readonly family?: string;
48
+ /** Exported names (JS entries). */
49
+ readonly names?: readonly string[];
50
+ }
51
+ export interface IndexMember {
52
+ readonly name: string;
53
+ readonly type: string;
54
+ readonly optional: boolean;
55
+ readonly summary: string;
56
+ readonly default?: string;
57
+ readonly deprecated?: string;
58
+ readonly inherited?: boolean;
59
+ }
60
+ export interface IndexParam {
61
+ readonly name: string;
62
+ readonly text: string;
63
+ }
64
+ export interface IndexSymbol {
65
+ readonly name: string;
66
+ readonly kind: SymbolKind;
67
+ /** Entries exporting the symbol; the first is its home. */
68
+ readonly specifiers: readonly string[];
69
+ readonly summary: string;
70
+ readonly docs?: string;
71
+ readonly signature: string;
72
+ readonly deprecated?: string;
73
+ readonly params?: readonly IndexParam[];
74
+ readonly returns?: string;
75
+ readonly members?: readonly IndexMember[];
76
+ }
77
+ export interface IndexSection {
78
+ readonly heading: string;
79
+ /** Heading anchor on the page (empty for the intro). */
80
+ readonly anchor: string;
81
+ readonly text: string;
82
+ }
83
+ export interface IndexDoc {
84
+ readonly title: string;
85
+ readonly description: string;
86
+ /** Site path (`/docs/buttons/button`). */
87
+ readonly path: string;
88
+ readonly section: string;
89
+ readonly sections: readonly IndexSection[];
90
+ }
91
+ export interface IndexDemo {
92
+ readonly id: string;
93
+ readonly title: string;
94
+ readonly description: string;
95
+ readonly category: string;
96
+ /** Site path (`/demos/buttons/button-basics`). */
97
+ readonly path: string;
98
+ readonly notes: string;
99
+ /** `@salmonui/*` specifiers the demo imports. */
100
+ readonly imports: readonly string[];
101
+ readonly source: string;
102
+ }
103
+ export interface McpIndex {
104
+ readonly format: typeof INDEX_FORMAT;
105
+ /** Version of the Salmon UI packages the index was built from. */
106
+ readonly version: string;
107
+ /** Git SHA of the build, or `unknown`. */
108
+ readonly generatedFrom: string;
109
+ /** Public docs site, no trailing slash. */
110
+ readonly siteUrl: string;
111
+ readonly packages: readonly IndexPackage[];
112
+ readonly entries: readonly IndexEntry[];
113
+ readonly symbols: readonly IndexSymbol[];
114
+ readonly docs: readonly IndexDoc[];
115
+ readonly demos: readonly IndexDemo[];
116
+ }
117
+ /** The bundled index file, or the file named by `SALMONUI_MCP_INDEX`. */
118
+ export declare function defaultIndexPath(env?: Readonly<Record<string, string | undefined>>): string;
119
+ /** Reads and checks an index file. Throws with an actionable message when it is missing or of another format. */
120
+ export declare function loadIndex(path?: string): McpIndex;
121
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;AAEpH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAA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AA2B,GAAG,QAAQ,CAYrE"}
package/dist/data.js ADDED
@@ -0,0 +1,28 @@
1
+ // The offline index the server answers from: `dist/index.json`, written at
2
+ // pack time by `scripts/build-index.mjs` from the package manifest, the
3
+ // generated API reference, the docs pages and the demo sources of the same
4
+ // repository version.
5
+ import { readFileSync } from 'node:fs';
6
+ import { fileURLToPath } from 'node:url';
7
+ export const INDEX_FORMAT = 1;
8
+ /** The bundled index file, or the file named by `SALMONUI_MCP_INDEX`. */
9
+ export function defaultIndexPath(env = process.env) {
10
+ const override = env['SALMONUI_MCP_INDEX'];
11
+ return override && override.trim() !== '' ? override : fileURLToPath(new URL('./index.json', import.meta.url));
12
+ }
13
+ /** Reads and checks an index file. Throws with an actionable message when it is missing or of another format. */
14
+ export function loadIndex(path = defaultIndexPath()) {
15
+ let text;
16
+ try {
17
+ text = readFileSync(path, 'utf8');
18
+ }
19
+ catch {
20
+ throw new Error(`@salmonui/mcp: index not found at ${path}. In the Salmon UI repository run \`npm run build && npm run mcp:index\`.`);
21
+ }
22
+ const index = JSON.parse(text);
23
+ if (index === null || typeof index !== 'object' || index.format !== INDEX_FORMAT) {
24
+ throw new Error(`@salmonui/mcp: ${path} is not a format ${INDEX_FORMAT} index.`);
25
+ }
26
+ return index;
27
+ }
28
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,sBAAsB;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AA6H9B,yEAAyE;AACzE,MAAM,UAAU,gBAAgB,CAAC,GAAG,GAAiD,OAAO,CAAC,GAAG;IAC9F,MAAM,QAAQ,GAAG,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC3C,OAAO,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjH,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,SAAS,CAAC,IAAI,GAAW,gBAAgB,EAAE;IACzD,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,2EAA2E,CAAC,CAAC;IACxI,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAa,CAAC;IAC3C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,oBAAoB,YAAY,SAAS,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { IndexEntry, IndexFamily, IndexPackage, McpIndex } from './data.js';
2
+ export interface ImportedName {
3
+ /** Exported name (`default` for a default import). */
4
+ readonly imported: string;
5
+ readonly local: string;
6
+ readonly typeOnly: boolean;
7
+ }
8
+ export interface ParsedImport {
9
+ readonly specifier: string;
10
+ readonly line: number;
11
+ readonly form: 'import' | 'side-effect' | 'export-from' | 'dynamic';
12
+ /** The whole statement is `import type` / `export type`. */
13
+ readonly typeOnly: boolean;
14
+ readonly names: readonly ImportedName[];
15
+ /** `import * as ns` / `export * from`. */
16
+ readonly namespace: boolean;
17
+ }
18
+ /** Replaces comments with spaces (newlines kept) so line numbers and string contents survive. */
19
+ export declare function blankComments(code: string): string;
20
+ /** Every static, side-effect, re-export and dynamic import of a module source, in source order. */
21
+ export declare function parseImports(source: string): ParsedImport[];
22
+ export interface ImportProblem {
23
+ readonly severity: 'error' | 'warning';
24
+ readonly line: number | null;
25
+ readonly specifier: string | null;
26
+ readonly message: string;
27
+ /** Suggested replacement code or specifier. */
28
+ readonly fix?: string;
29
+ }
30
+ export interface ImportReport {
31
+ readonly imports: readonly ParsedImport[];
32
+ /** `@salmonui/*` imports checked. */
33
+ readonly checked: number;
34
+ readonly problems: readonly ImportProblem[];
35
+ }
36
+ /** Lookups over the index used by the checker and the tools. */
37
+ export declare class ExportsMap {
38
+ readonly entries: Map<string, IndexEntry>;
39
+ readonly packages: Map<string, IndexPackage>;
40
+ readonly families: Map<string, {
41
+ pkg: IndexPackage;
42
+ family: IndexFamily;
43
+ }>;
44
+ /** Family of every family entry and subpath. */
45
+ readonly familyOf: Map<string, {
46
+ pkg: IndexPackage;
47
+ family: IndexFamily;
48
+ }>;
49
+ readonly whereExported: Map<string, string[]>;
50
+ constructor(index: McpIndex);
51
+ /** The package name of a specifier (`@salmonui/buttons/button` -> `@salmonui/buttons`). */
52
+ static packageName(specifier: string): string;
53
+ /** Entries exporting `name`, home entries (shortest specifier) first. */
54
+ exportersOf(name: string): string[];
55
+ /** Closest existing specifiers by edit distance (at most `max`). */
56
+ closest(specifier: string, max?: number): string[];
57
+ }
58
+ /** Levenshtein distance. */
59
+ export declare function editDistance(a: string, b: string): number;
60
+ /** Packages that existed before the per-category split, with what replaced them. */
61
+ export declare const REMOVED_PACKAGES: Readonly<Record<string, string>>;
62
+ /**
63
+ * The replacement of a specifier of a removed package, or null when there is
64
+ * no single one (`@salmonui/react` root: each name has its own entry).
65
+ */
66
+ export declare function migrateSpecifier(specifier: string, map: ExportsMap): string | null;
67
+ /**
68
+ * Checks every `@salmonui/*` import of a module: the specifier is a public
69
+ * entry, each named import is exported by it, no private `/internal/*` or
70
+ * removed package is used, and the stylesheets of the used families (and
71
+ * `@salmonui/core/styles.css`) are imported.
72
+ */
73
+ export declare function checkImports(source: string, map: ExportsMap, options?: {
74
+ stylesheets?: boolean;
75
+ }): ImportReport;
76
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../src/imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEjF,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IACpE,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgClD;AA8BD,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,CAqB3D;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ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