@moewolf/moe-icons-cli 0.0.1
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 +15 -0
- package/README.md +32 -0
- package/bin/moeicons.js +20 -0
- package/dist/api/client.d.ts +42 -0
- package/dist/api/client.js +105 -0
- package/dist/auth/callback.d.ts +37 -0
- package/dist/auth/callback.js +72 -0
- package/dist/auth/device-login.d.ts +29 -0
- package/dist/auth/device-login.js +74 -0
- package/dist/auth/login.d.ts +41 -0
- package/dist/auth/login.js +85 -0
- package/dist/auth/open-browser.d.ts +2 -0
- package/dist/auth/open-browser.js +15 -0
- package/dist/auth/pkce.d.ts +17 -0
- package/dist/auth/pkce.js +20 -0
- package/dist/auth/token-store.d.ts +38 -0
- package/dist/auth/token-store.js +126 -0
- package/dist/catalog/catalog.d.ts +32 -0
- package/dist/catalog/catalog.js +80 -0
- package/dist/catalog/catalog.json +9371 -0
- package/dist/cli.d.ts +23 -0
- package/dist/cli.js +507 -0
- package/dist/commands/parser.d.ts +41 -0
- package/dist/commands/parser.js +146 -0
- package/dist/core/auth.d.ts +32 -0
- package/dist/core/auth.js +131 -0
- package/dist/core/bitmap-assets.d.ts +29 -0
- package/dist/core/bitmap-assets.js +77 -0
- package/dist/core/cli-update.d.ts +43 -0
- package/dist/core/cli-update.js +71 -0
- package/dist/core/context.d.ts +22 -0
- package/dist/core/context.js +1 -0
- package/dist/core/free-download.d.ts +66 -0
- package/dist/core/free-download.js +193 -0
- package/dist/core/generate.d.ts +33 -0
- package/dist/core/generate.js +285 -0
- package/dist/core/icon-names.d.ts +14 -0
- package/dist/core/icon-names.js +54 -0
- package/dist/core/init.d.ts +12 -0
- package/dist/core/init.js +23 -0
- package/dist/core/install.d.ts +67 -0
- package/dist/core/install.js +117 -0
- package/dist/core/library-update.d.ts +24 -0
- package/dist/core/library-update.js +161 -0
- package/dist/core/manage.d.ts +24 -0
- package/dist/core/manage.js +38 -0
- package/dist/core/pro-download.d.ts +29 -0
- package/dist/core/pro-download.js +112 -0
- package/dist/core/pro-install.d.ts +24 -0
- package/dist/core/pro-install.js +72 -0
- package/dist/core/release-descriptor.d.ts +40 -0
- package/dist/core/release-descriptor.js +114 -0
- package/dist/core/resource-variant.d.ts +35 -0
- package/dist/core/resource-variant.js +70 -0
- package/dist/core/signed-artifact.d.ts +29 -0
- package/dist/core/signed-artifact.js +81 -0
- package/dist/core/target-subtree.d.ts +49 -0
- package/dist/core/target-subtree.js +132 -0
- package/dist/core/update-policy.d.ts +31 -0
- package/dist/core/update-policy.js +27 -0
- package/dist/core/version-service.d.ts +26 -0
- package/dist/core/version-service.js +71 -0
- package/dist/core/wizard.d.ts +49 -0
- package/dist/core/wizard.js +71 -0
- package/dist/errors/errors.d.ts +34 -0
- package/dist/errors/errors.js +39 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/generator/cn.d.ts +5 -0
- package/dist/generator/cn.js +14 -0
- package/dist/generator/generate.d.ts +34 -0
- package/dist/generator/generate.js +562 -0
- package/dist/generator/theme-resolve.d.ts +26 -0
- package/dist/generator/theme-resolve.js +100 -0
- package/dist/mcp/server.d.ts +58 -0
- package/dist/mcp/server.js +176 -0
- package/dist/project/config.d.ts +74 -0
- package/dist/project/config.js +353 -0
- package/dist/project/detect.d.ts +26 -0
- package/dist/project/detect.js +104 -0
- package/dist/project/install-metadata.d.ts +29 -0
- package/dist/project/install-metadata.js +108 -0
- package/dist/project/install.d.ts +115 -0
- package/dist/project/install.js +537 -0
- package/dist/project/project-lock.d.ts +11 -0
- package/dist/project/project-lock.js +81 -0
- package/dist/project/tailwind.d.ts +51 -0
- package/dist/project/tailwind.js +188 -0
- package/dist/project/tar-gz.d.ts +12 -0
- package/dist/project/tar-gz.js +100 -0
- package/dist/tui/primitives.d.ts +36 -0
- package/dist/tui/primitives.js +88 -0
- package/dist/ui/banner.d.ts +11 -0
- package/dist/ui/banner.js +105 -0
- package/dist/ui/clack.d.ts +8 -0
- package/dist/ui/clack.js +53 -0
- package/dist/ui/create-ui.d.ts +14 -0
- package/dist/ui/create-ui.js +16 -0
- package/dist/ui/non-interactive.d.ts +5 -0
- package/dist/ui/non-interactive.js +30 -0
- package/dist/ui/stream.d.ts +11 -0
- package/dist/ui/stream.js +50 -0
- package/package.json +70 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { catalog, findCatalogStyleGroup } from "../catalog/catalog.js";
|
|
2
|
+
import { assetRelativePath, resolveResourceVariant, } from "../core/resource-variant.js";
|
|
3
|
+
import { toLibraryExportName, toProxyName } from "../core/icon-names.js";
|
|
4
|
+
export function resolveThemes(config, sourceCatalog = catalog) {
|
|
5
|
+
const errors = [];
|
|
6
|
+
const themes = [];
|
|
7
|
+
for (const [theme, entry] of Object.entries(config.themes)) {
|
|
8
|
+
const group = findCatalogStyleGroup(entry.styleGroup, sourceCatalog);
|
|
9
|
+
if (!group) {
|
|
10
|
+
errors.push(`unknown style group "${entry.styleGroup}" for theme "${theme}"`);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (group.type === "bitmap") {
|
|
14
|
+
try {
|
|
15
|
+
const variant = resolveResourceVariant(entry.styleGroup, {
|
|
16
|
+
...(entry.format !== undefined ? { format: entry.format } : {}),
|
|
17
|
+
...(entry.imageSize !== undefined ? { imageSize: entry.imageSize } : {}),
|
|
18
|
+
});
|
|
19
|
+
if (!group.formats.includes(variant.format)) {
|
|
20
|
+
errors.push(`format ${variant.format} is unavailable for ${group.id}`);
|
|
21
|
+
}
|
|
22
|
+
if (!group.imageSizes.includes(variant.imageSize)) {
|
|
23
|
+
errors.push(`imageSize ${String(variant.imageSize)} is unavailable for ${group.id}`);
|
|
24
|
+
}
|
|
25
|
+
themes.push({ theme, entry, kind: "bitmap", group, variant });
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
themes.push({ theme, entry, kind: "svg", group });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (errors.length > 0)
|
|
36
|
+
return { ok: false, errors };
|
|
37
|
+
return { ok: true, themes };
|
|
38
|
+
}
|
|
39
|
+
export function bitmapWrapperImportName(theme, iconId) {
|
|
40
|
+
return `${toProxyName(theme)}${toProxyName(iconId)}Bitmap`;
|
|
41
|
+
}
|
|
42
|
+
export function svgInternalImportName(theme, styleGroup, iconId) {
|
|
43
|
+
return `${toProxyName(theme)}${toProxyName(styleGroup)}${toProxyName(iconId)}`;
|
|
44
|
+
}
|
|
45
|
+
/** Relative import from icons/Foo.tsx → assets/... */
|
|
46
|
+
export function relativeAssetImportFromIcons(variant, iconId) {
|
|
47
|
+
return `../${assetRelativePath(variant.resourceVariantId, iconId, variant.format)}`;
|
|
48
|
+
}
|
|
49
|
+
export function reactBitmapWrapperSource(iconId, wrapperName, variant, themeClassName) {
|
|
50
|
+
const assetImport = relativeAssetImportFromIcons(variant, iconId);
|
|
51
|
+
const defaultClass = themeClassName ? JSON.stringify(themeClassName) : "undefined";
|
|
52
|
+
return `import type { IconProps } from "../types";
|
|
53
|
+
import { cn } from "../cn";
|
|
54
|
+
import assetUrl from "${assetImport}";
|
|
55
|
+
|
|
56
|
+
export function ${wrapperName}(props: IconProps) {
|
|
57
|
+
const { className, size, "aria-label": ariaLabel, strokeWidth: _strokeWidth, ...rest } = props;
|
|
58
|
+
const sizeClass = typeof size === "number" ? \`w-[\${size}px] h-[\${size}px]\` : undefined;
|
|
59
|
+
return (
|
|
60
|
+
<img
|
|
61
|
+
src={assetUrl}
|
|
62
|
+
alt={ariaLabel ?? ""}
|
|
63
|
+
aria-hidden={ariaLabel ? undefined : true}
|
|
64
|
+
draggable={false}
|
|
65
|
+
className={cn("moe-icon", ${defaultClass}, sizeClass, className)}
|
|
66
|
+
{...rest}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
export function vueBitmapWrapperSource(iconId, wrapperName, variant, themeClassName) {
|
|
73
|
+
const assetImport = relativeAssetImportFromIcons(variant, iconId);
|
|
74
|
+
const defaultClass = themeClassName ? JSON.stringify(themeClassName) : "undefined";
|
|
75
|
+
return `import { defineComponent, h } from "vue";
|
|
76
|
+
import { cn } from "../cn";
|
|
77
|
+
import assetUrl from "${assetImport}";
|
|
78
|
+
|
|
79
|
+
export const ${wrapperName} = defineComponent({
|
|
80
|
+
name: "${wrapperName}",
|
|
81
|
+
setup(_props, { attrs }) {
|
|
82
|
+
return () => {
|
|
83
|
+
const className = typeof attrs.class === "string" ? attrs.class : undefined;
|
|
84
|
+
const size = typeof attrs.size === "number" ? attrs.size : undefined;
|
|
85
|
+
const ariaLabel = typeof attrs["aria-label"] === "string" ? attrs["aria-label"] : undefined;
|
|
86
|
+
const sizeClass = typeof size === "number" ? \`w-[\${size}px] h-[\${size}px]\` : undefined;
|
|
87
|
+
return h("img", {
|
|
88
|
+
...attrs,
|
|
89
|
+
src: assetUrl,
|
|
90
|
+
alt: ariaLabel ?? "",
|
|
91
|
+
"aria-hidden": ariaLabel ? undefined : true,
|
|
92
|
+
draggable: false,
|
|
93
|
+
class: cn("moe-icon", ${defaultClass}, sizeClass, className),
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
export { toLibraryExportName, toProxyName };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal MCP (Model Context Protocol) stdio server. Registers only v1 tools:
|
|
3
|
+
* list_icon_groups, get_account, install_icon_group. Protocol data goes only
|
|
4
|
+
* to stdout; logs go to stderr. Graceful shutdown on SIGINT/SIGTERM.
|
|
5
|
+
*/
|
|
6
|
+
interface McpRequest {
|
|
7
|
+
readonly jsonrpc: "2.0";
|
|
8
|
+
readonly id: number | string;
|
|
9
|
+
readonly method: string;
|
|
10
|
+
readonly params?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
interface McpResponse {
|
|
13
|
+
readonly jsonrpc: "2.0";
|
|
14
|
+
readonly id: number | string;
|
|
15
|
+
readonly result?: unknown;
|
|
16
|
+
readonly error?: {
|
|
17
|
+
code: number;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface McpServices {
|
|
22
|
+
readonly listIconGroups: () => Promise<readonly {
|
|
23
|
+
id: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}[]>;
|
|
26
|
+
readonly getAccount: () => Promise<{
|
|
27
|
+
accountId: string;
|
|
28
|
+
tier: string;
|
|
29
|
+
} | undefined>;
|
|
30
|
+
readonly installIconGroup: (args: {
|
|
31
|
+
groupId: string;
|
|
32
|
+
projectPath: string;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
ok: boolean;
|
|
35
|
+
message: string;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export interface McpDeps {
|
|
39
|
+
readonly services: McpServices;
|
|
40
|
+
readonly stdout: (text: string) => void;
|
|
41
|
+
readonly stderr: (text: string) => void;
|
|
42
|
+
readonly signal?: AbortSignal;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create an MCP server bound to injected streams. Returns a dispatcher that
|
|
46
|
+
* handles one decoded JSON-RPC message.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createMcpServer(deps: McpDeps): {
|
|
49
|
+
handle: (message: McpRequest) => Promise<McpResponse | undefined>;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Read JSON-RPC messages from an async iterable of lines and write responses to
|
|
53
|
+
* stdout. Used by the stdio transport.
|
|
54
|
+
*/
|
|
55
|
+
export declare function runMcpStdio(deps: McpDeps & {
|
|
56
|
+
lines: AsyncIterable<string>;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal MCP (Model Context Protocol) stdio server. Registers only v1 tools:
|
|
3
|
+
* list_icon_groups, get_account, install_icon_group. Protocol data goes only
|
|
4
|
+
* to stdout; logs go to stderr. Graceful shutdown on SIGINT/SIGTERM.
|
|
5
|
+
*/
|
|
6
|
+
import { CLI_VERSION } from "../ui/banner.js";
|
|
7
|
+
function validateArgs(method, params, required) {
|
|
8
|
+
if (!params) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
for (const key of required) {
|
|
12
|
+
if (typeof params[key] !== "string" || params[key].length === 0) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const out = {};
|
|
17
|
+
for (const key of required) {
|
|
18
|
+
out[key] = String(params[key]);
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create an MCP server bound to injected streams. Returns a dispatcher that
|
|
24
|
+
* handles one decoded JSON-RPC message.
|
|
25
|
+
*/
|
|
26
|
+
export function createMcpServer(deps) {
|
|
27
|
+
const handle = async (message) => {
|
|
28
|
+
if (message.jsonrpc !== "2.0") {
|
|
29
|
+
return { jsonrpc: "2.0", id: message.id, error: { code: -32600, message: "invalid request" } };
|
|
30
|
+
}
|
|
31
|
+
switch (message.method) {
|
|
32
|
+
case "initialize":
|
|
33
|
+
return {
|
|
34
|
+
jsonrpc: "2.0",
|
|
35
|
+
id: message.id,
|
|
36
|
+
result: {
|
|
37
|
+
protocolVersion: "2024-11-05",
|
|
38
|
+
capabilities: { tools: {} },
|
|
39
|
+
serverInfo: { name: "moeicons", version: CLI_VERSION },
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
case "tools/list":
|
|
43
|
+
return {
|
|
44
|
+
jsonrpc: "2.0",
|
|
45
|
+
id: message.id,
|
|
46
|
+
result: {
|
|
47
|
+
tools: [
|
|
48
|
+
{
|
|
49
|
+
name: "list_icon_groups",
|
|
50
|
+
description: "List available icon groups",
|
|
51
|
+
inputSchema: { type: "object", properties: {} },
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "get_account",
|
|
55
|
+
description: "Get the current account/tier",
|
|
56
|
+
inputSchema: { type: "object", properties: {} },
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "install_icon_group",
|
|
60
|
+
description: "Install an icon group into a project",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
groupId: { type: "string" },
|
|
65
|
+
projectPath: { type: "string" },
|
|
66
|
+
},
|
|
67
|
+
required: ["groupId", "projectPath"],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
case "tools/call": {
|
|
74
|
+
const toolName = message.params?.name;
|
|
75
|
+
const args = message.params?.arguments ?? {};
|
|
76
|
+
try {
|
|
77
|
+
if (toolName === "list_icon_groups") {
|
|
78
|
+
const groups = await deps.services.listIconGroups();
|
|
79
|
+
return {
|
|
80
|
+
jsonrpc: "2.0",
|
|
81
|
+
id: message.id,
|
|
82
|
+
result: { content: [{ type: "text", text: JSON.stringify(groups) }] },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (toolName === "get_account") {
|
|
86
|
+
const account = await deps.services.getAccount();
|
|
87
|
+
return {
|
|
88
|
+
jsonrpc: "2.0",
|
|
89
|
+
id: message.id,
|
|
90
|
+
result: {
|
|
91
|
+
content: [
|
|
92
|
+
{ type: "text", text: account ? JSON.stringify(account) : "not logged in" },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (toolName === "install_icon_group") {
|
|
98
|
+
const validated = validateArgs(toolName, args, ["groupId", "projectPath"]);
|
|
99
|
+
if (!validated) {
|
|
100
|
+
return {
|
|
101
|
+
jsonrpc: "2.0",
|
|
102
|
+
id: message.id,
|
|
103
|
+
error: { code: -32602, message: "groupId and projectPath are required strings" },
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const projectPath = validated["projectPath"];
|
|
107
|
+
const groupId = validated["groupId"];
|
|
108
|
+
if (!projectPath || !groupId) {
|
|
109
|
+
return {
|
|
110
|
+
jsonrpc: "2.0",
|
|
111
|
+
id: message.id,
|
|
112
|
+
error: { code: -32602, message: "groupId and projectPath are required strings" },
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (projectPath.split(/[\\/]/).includes("..")) {
|
|
116
|
+
return {
|
|
117
|
+
jsonrpc: "2.0",
|
|
118
|
+
id: message.id,
|
|
119
|
+
error: { code: -32602, message: "projectPath must not contain path traversal" },
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const result = await deps.services.installIconGroup({
|
|
123
|
+
groupId,
|
|
124
|
+
projectPath,
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
jsonrpc: "2.0",
|
|
128
|
+
id: message.id,
|
|
129
|
+
result: { content: [{ type: "text", text: JSON.stringify(result) }] },
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
jsonrpc: "2.0",
|
|
134
|
+
id: message.id,
|
|
135
|
+
error: { code: -32601, message: `unknown tool: ${String(toolName)}` },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
deps.stderr(`mcp tool error: ${String(error)}\n`);
|
|
140
|
+
return {
|
|
141
|
+
jsonrpc: "2.0",
|
|
142
|
+
id: message.id,
|
|
143
|
+
error: { code: -32000, message: String(error) },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
default:
|
|
148
|
+
return { jsonrpc: "2.0", id: message.id, error: { code: -32601, message: `method not found: ${message.method}` } };
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return { handle };
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Read JSON-RPC messages from an async iterable of lines and write responses to
|
|
155
|
+
* stdout. Used by the stdio transport.
|
|
156
|
+
*/
|
|
157
|
+
export async function runMcpStdio(deps) {
|
|
158
|
+
const server = createMcpServer(deps);
|
|
159
|
+
for await (const line of deps.lines) {
|
|
160
|
+
const trimmed = line.trim();
|
|
161
|
+
if (!trimmed)
|
|
162
|
+
continue;
|
|
163
|
+
let message;
|
|
164
|
+
try {
|
|
165
|
+
message = JSON.parse(trimmed);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
deps.stdout(JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "parse error" } }) + "\n");
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const response = await server.handle(message);
|
|
172
|
+
if (response) {
|
|
173
|
+
deps.stdout(JSON.stringify(response) + "\n");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type IconCatalog } from "../catalog/catalog.js";
|
|
2
|
+
import type { Target } from "../commands/parser.js";
|
|
3
|
+
export interface MoeiconsThemeConfig {
|
|
4
|
+
readonly styleGroup: string;
|
|
5
|
+
readonly styles?: readonly string[];
|
|
6
|
+
readonly format?: "svg" | "webp" | "png";
|
|
7
|
+
readonly imageSize?: 64 | 128 | 256 | 512;
|
|
8
|
+
readonly defaultSize?: number;
|
|
9
|
+
readonly strokeWidth?: number;
|
|
10
|
+
readonly className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Normalized config: schema version 2 with a REQUIRED `target`. Core code must
|
|
14
|
+
* never see an optional or missing target — v1 files are migrated by
|
|
15
|
+
* `readMoeiconsConfig` and invalid v2 files fail with a validation error
|
|
16
|
+
* instead of silently defaulting to React.
|
|
17
|
+
*/
|
|
18
|
+
export interface MoeiconsConfigFile {
|
|
19
|
+
readonly schemaVersion: 2;
|
|
20
|
+
readonly tier: "free" | "pro";
|
|
21
|
+
readonly target: Target;
|
|
22
|
+
readonly outputDir: string;
|
|
23
|
+
readonly defaultTheme: string;
|
|
24
|
+
readonly themes: Readonly<Record<string, MoeiconsThemeConfig>>;
|
|
25
|
+
readonly icons: readonly string[];
|
|
26
|
+
readonly missingIconPolicy?: "fallback" | "error";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Legacy v1 input shape. Reads normalize it into a `MoeiconsConfigFile` v2 by
|
|
30
|
+
* migrating `framework` to `target`. Core code never receives this type.
|
|
31
|
+
*/
|
|
32
|
+
export interface LegacyConfigInput {
|
|
33
|
+
readonly schemaVersion: 1;
|
|
34
|
+
readonly tier: "free" | "pro";
|
|
35
|
+
readonly framework: "react" | "vue";
|
|
36
|
+
readonly outputDir: string;
|
|
37
|
+
readonly defaultTheme: string;
|
|
38
|
+
readonly themes: Readonly<Record<string, MoeiconsThemeConfig>>;
|
|
39
|
+
readonly icons: readonly string[];
|
|
40
|
+
readonly missingIconPolicy?: "fallback" | "error";
|
|
41
|
+
}
|
|
42
|
+
export type ConfigLoadResult = {
|
|
43
|
+
readonly kind: "missing";
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "invalid";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "unsupported";
|
|
49
|
+
readonly version: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "ok";
|
|
52
|
+
readonly config: MoeiconsConfigFile;
|
|
53
|
+
readonly warnings: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
export declare const SUPPORTED_FILENAMES: readonly ["moeicons.config.jsonc", "moeicons.config.json", "moeicons.config.ts", "moeicons.config.js"];
|
|
56
|
+
export declare function findConfigFile(root: string): string | undefined;
|
|
57
|
+
export declare function readMoeiconsConfig(root: string, sourceCatalog?: IconCatalog): ConfigLoadResult;
|
|
58
|
+
export declare function mergeMoeiconsConfig(current: MoeiconsConfigFile | LegacyConfigInput, patch: Partial<Omit<MoeiconsConfigFile, "schemaVersion">>): MoeiconsConfigFile;
|
|
59
|
+
export declare function createMoeiconsConfig(options: {
|
|
60
|
+
target?: Target;
|
|
61
|
+
/** Legacy v1 alias; still emits a v2 `target`. */
|
|
62
|
+
framework?: "react" | "vue";
|
|
63
|
+
tier?: "free" | "pro";
|
|
64
|
+
outputDir?: string;
|
|
65
|
+
icons?: readonly string[];
|
|
66
|
+
themes?: Readonly<Record<string, MoeiconsThemeConfig>>;
|
|
67
|
+
}): MoeiconsConfigFile;
|
|
68
|
+
/** Render the editable, grouped JSONC skeleton used by `init`. */
|
|
69
|
+
export declare function renderMoeiconsConfigJsonc(options: {
|
|
70
|
+
target?: Target;
|
|
71
|
+
/** Legacy v1 alias; still emits a v2 `target`. */
|
|
72
|
+
framework?: "react" | "vue";
|
|
73
|
+
tier?: "free" | "pro";
|
|
74
|
+
}): string;
|