@asheeui/utils 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 Ashee Softworks
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/dist/index.cjs ADDED
@@ -0,0 +1,73 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let clsx = require("clsx");
3
+ let tailwind_merge = require("tailwind-merge");
4
+ //#region src/cn.ts
5
+ /**
6
+ * Merge Tailwind CSS class names, resolving conflicts deterministically.
7
+ *
8
+ * Combines `clsx` (conditional class composition) with `tailwind-merge`
9
+ * (later conflicting utilities win), which keeps generated class
10
+ * strings short and predictable.
11
+ *
12
+ * @param inputs - Class values: strings, objects, arrays, or falsy
13
+ * values that are ignored.
14
+ * @returns A single space-separated class string.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * cn("px-2 p-4", isActive && "bg-primary", "rounded-md");
19
+ * // isActive=false -> "p-4 rounded-md"; px-2 conflicts with p-4 and is dropped
20
+ * ```
21
+ */
22
+ function cn(...inputs) {
23
+ return (0, tailwind_merge.twMerge)((0, clsx.clsx)(inputs));
24
+ }
25
+ //#endregion
26
+ //#region src/merge-object.ts
27
+ /**
28
+ * Test whether `item` is a plain object (not `null`, not an array).
29
+ *
30
+ * @param item - Value to inspect.
31
+ * @returns `true` when `item` is a non-array object.
32
+ */
33
+ function isPlainObject(item) {
34
+ return typeof item === "object" && item !== null && !Array.isArray(item);
35
+ }
36
+ /**
37
+ * Deeply merge a partial user config over a set of defaults.
38
+ *
39
+ * Nested plain objects are merged recursively; arrays and scalar
40
+ * values from `userConfig` replace the default outright. Keys whose
41
+ * user value is `undefined` are skipped, leaving the default intact.
42
+ * The `defaults` object is not mutated.
43
+ *
44
+ * @param defaults - Baseline object providing fallback values.
45
+ * @param userConfig - Optional partial override object.
46
+ * @returns A new object with the user overrides applied.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const config = mergeObject(
51
+ * { theme: { color: "primary", radius: "md" } },
52
+ * { theme: { radius: "lg" } },
53
+ * );
54
+ * // -> { theme: { color: "primary", radius: "lg" } }
55
+ * ```
56
+ */
57
+ function mergeObject(defaults, userConfig) {
58
+ if (!userConfig) return defaults;
59
+ const output = { ...defaults };
60
+ const defaultsRecord = defaults;
61
+ const userRecord = userConfig;
62
+ for (const key of Object.keys(userConfig)) {
63
+ const userValue = userRecord[key];
64
+ const defaultValue = defaultsRecord[key];
65
+ if (userValue === void 0) continue;
66
+ if (isPlainObject(defaultValue) && isPlainObject(userValue)) output[key] = mergeObject(defaultValue, userValue);
67
+ else output[key] = userValue;
68
+ }
69
+ return output;
70
+ }
71
+ //#endregion
72
+ exports.cn = cn;
73
+ exports.mergeObject = mergeObject;
@@ -0,0 +1,56 @@
1
+ import { ClassValue } from "clsx";
2
+ //#region src/cn.d.ts
3
+ /**
4
+ * Merge Tailwind CSS class names, resolving conflicts deterministically.
5
+ *
6
+ * Combines `clsx` (conditional class composition) with `tailwind-merge`
7
+ * (later conflicting utilities win), which keeps generated class
8
+ * strings short and predictable.
9
+ *
10
+ * @param inputs - Class values: strings, objects, arrays, or falsy
11
+ * values that are ignored.
12
+ * @returns A single space-separated class string.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * cn("px-2 p-4", isActive && "bg-primary", "rounded-md");
17
+ * // isActive=false -> "p-4 rounded-md"; px-2 conflicts with p-4 and is dropped
18
+ * ```
19
+ */
20
+ declare function cn(...inputs: ClassValue[]): string;
21
+ //#endregion
22
+ //#region src/types.d.ts
23
+ /**
24
+ * Recursively make every property of `T` optional.
25
+ *
26
+ * Arrays and primitives are left untouched; only object properties are
27
+ * mapped. Useful for typed partial configuration overrides.
28
+ */
29
+ type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
30
+ //#endregion
31
+ //#region src/merge-object.d.ts
32
+ /**
33
+ * Deeply merge a partial user config over a set of defaults.
34
+ *
35
+ * Nested plain objects are merged recursively; arrays and scalar
36
+ * values from `userConfig` replace the default outright. Keys whose
37
+ * user value is `undefined` are skipped, leaving the default intact.
38
+ * The `defaults` object is not mutated.
39
+ *
40
+ * @param defaults - Baseline object providing fallback values.
41
+ * @param userConfig - Optional partial override object.
42
+ * @returns A new object with the user overrides applied.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const config = mergeObject(
47
+ * { theme: { color: "primary", radius: "md" } },
48
+ * { theme: { radius: "lg" } },
49
+ * );
50
+ * // -> { theme: { color: "primary", radius: "lg" } }
51
+ * ```
52
+ */
53
+ declare function mergeObject<T extends Record<string, unknown>>(defaults: T, userConfig?: DeepPartial<T>): T;
54
+ //#endregion
55
+ export { type DeepPartial, cn, mergeObject };
56
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/merge-object.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAoBgB,MAAM,QAAQ;;;;;;;;;KCdlB,YAAY,KAAK,sBAEtB,WAAW,KAAK,YAAY,EAAE,SAEjC;;;;;;;;;;;;;;;;;;;;;;;;iBCuBY,YAAY,UAAU,yBACpC,UAAU,GACV,aAAa,YAAY,KACxB"}
@@ -0,0 +1,56 @@
1
+ import { ClassValue } from "clsx";
2
+ //#region src/cn.d.ts
3
+ /**
4
+ * Merge Tailwind CSS class names, resolving conflicts deterministically.
5
+ *
6
+ * Combines `clsx` (conditional class composition) with `tailwind-merge`
7
+ * (later conflicting utilities win), which keeps generated class
8
+ * strings short and predictable.
9
+ *
10
+ * @param inputs - Class values: strings, objects, arrays, or falsy
11
+ * values that are ignored.
12
+ * @returns A single space-separated class string.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * cn("px-2 p-4", isActive && "bg-primary", "rounded-md");
17
+ * // isActive=false -> "p-4 rounded-md"; px-2 conflicts with p-4 and is dropped
18
+ * ```
19
+ */
20
+ declare function cn(...inputs: ClassValue[]): string;
21
+ //#endregion
22
+ //#region src/types.d.ts
23
+ /**
24
+ * Recursively make every property of `T` optional.
25
+ *
26
+ * Arrays and primitives are left untouched; only object properties are
27
+ * mapped. Useful for typed partial configuration overrides.
28
+ */
29
+ type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T;
30
+ //#endregion
31
+ //#region src/merge-object.d.ts
32
+ /**
33
+ * Deeply merge a partial user config over a set of defaults.
34
+ *
35
+ * Nested plain objects are merged recursively; arrays and scalar
36
+ * values from `userConfig` replace the default outright. Keys whose
37
+ * user value is `undefined` are skipped, leaving the default intact.
38
+ * The `defaults` object is not mutated.
39
+ *
40
+ * @param defaults - Baseline object providing fallback values.
41
+ * @param userConfig - Optional partial override object.
42
+ * @returns A new object with the user overrides applied.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const config = mergeObject(
47
+ * { theme: { color: "primary", radius: "md" } },
48
+ * { theme: { radius: "lg" } },
49
+ * );
50
+ * // -> { theme: { color: "primary", radius: "lg" } }
51
+ * ```
52
+ */
53
+ declare function mergeObject<T extends Record<string, unknown>>(defaults: T, userConfig?: DeepPartial<T>): T;
54
+ //#endregion
55
+ export { type DeepPartial, cn, mergeObject };
56
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/merge-object.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAoBgB,MAAM,QAAQ;;;;;;;;;KCdlB,YAAY,KAAK,sBAEtB,WAAW,KAAK,YAAY,EAAE,SAEjC;;;;;;;;;;;;;;;;;;;;;;;;iBCuBY,YAAY,UAAU,yBACpC,UAAU,GACV,aAAa,YAAY,KACxB"}
package/dist/index.mjs ADDED
@@ -0,0 +1,73 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ //#region src/cn.ts
4
+ /**
5
+ * Merge Tailwind CSS class names, resolving conflicts deterministically.
6
+ *
7
+ * Combines `clsx` (conditional class composition) with `tailwind-merge`
8
+ * (later conflicting utilities win), which keeps generated class
9
+ * strings short and predictable.
10
+ *
11
+ * @param inputs - Class values: strings, objects, arrays, or falsy
12
+ * values that are ignored.
13
+ * @returns A single space-separated class string.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * cn("px-2 p-4", isActive && "bg-primary", "rounded-md");
18
+ * // isActive=false -> "p-4 rounded-md"; px-2 conflicts with p-4 and is dropped
19
+ * ```
20
+ */
21
+ function cn(...inputs) {
22
+ return twMerge(clsx(inputs));
23
+ }
24
+ //#endregion
25
+ //#region src/merge-object.ts
26
+ /**
27
+ * Test whether `item` is a plain object (not `null`, not an array).
28
+ *
29
+ * @param item - Value to inspect.
30
+ * @returns `true` when `item` is a non-array object.
31
+ */
32
+ function isPlainObject(item) {
33
+ return typeof item === "object" && item !== null && !Array.isArray(item);
34
+ }
35
+ /**
36
+ * Deeply merge a partial user config over a set of defaults.
37
+ *
38
+ * Nested plain objects are merged recursively; arrays and scalar
39
+ * values from `userConfig` replace the default outright. Keys whose
40
+ * user value is `undefined` are skipped, leaving the default intact.
41
+ * The `defaults` object is not mutated.
42
+ *
43
+ * @param defaults - Baseline object providing fallback values.
44
+ * @param userConfig - Optional partial override object.
45
+ * @returns A new object with the user overrides applied.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const config = mergeObject(
50
+ * { theme: { color: "primary", radius: "md" } },
51
+ * { theme: { radius: "lg" } },
52
+ * );
53
+ * // -> { theme: { color: "primary", radius: "lg" } }
54
+ * ```
55
+ */
56
+ function mergeObject(defaults, userConfig) {
57
+ if (!userConfig) return defaults;
58
+ const output = { ...defaults };
59
+ const defaultsRecord = defaults;
60
+ const userRecord = userConfig;
61
+ for (const key of Object.keys(userConfig)) {
62
+ const userValue = userRecord[key];
63
+ const defaultValue = defaultsRecord[key];
64
+ if (userValue === void 0) continue;
65
+ if (isPlainObject(defaultValue) && isPlainObject(userValue)) output[key] = mergeObject(defaultValue, userValue);
66
+ else output[key] = userValue;
67
+ }
68
+ return output;
69
+ }
70
+ //#endregion
71
+ export { cn, mergeObject };
72
+
73
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/cn.ts","../src/merge-object.ts"],"sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge Tailwind CSS class names, resolving conflicts deterministically.\n *\n * Combines `clsx` (conditional class composition) with `tailwind-merge`\n * (later conflicting utilities win), which keeps generated class\n * strings short and predictable.\n *\n * @param inputs - Class values: strings, objects, arrays, or falsy\n * values that are ignored.\n * @returns A single space-separated class string.\n *\n * @example\n * ```ts\n * cn(\"px-2 p-4\", isActive && \"bg-primary\", \"rounded-md\");\n * // isActive=false -> \"p-4 rounded-md\"; px-2 conflicts with p-4 and is dropped\n * ```\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import type { DeepPartial } from \"./types\";\n\n/**\n * Test whether `item` is a plain object (not `null`, not an array).\n *\n * @param item - Value to inspect.\n * @returns `true` when `item` is a non-array object.\n */\nfunction isPlainObject(item: unknown): item is Record<string, unknown> {\n return typeof item === \"object\" && item !== null && !Array.isArray(item);\n}\n\n/**\n * Deeply merge a partial user config over a set of defaults.\n *\n * Nested plain objects are merged recursively; arrays and scalar\n * values from `userConfig` replace the default outright. Keys whose\n * user value is `undefined` are skipped, leaving the default intact.\n * The `defaults` object is not mutated.\n *\n * @param defaults - Baseline object providing fallback values.\n * @param userConfig - Optional partial override object.\n * @returns A new object with the user overrides applied.\n *\n * @example\n * ```ts\n * const config = mergeObject(\n * { theme: { color: \"primary\", radius: \"md\" } },\n * { theme: { radius: \"lg\" } },\n * );\n * // -> { theme: { color: \"primary\", radius: \"lg\" } }\n * ```\n */\nexport function mergeObject<T extends Record<string, unknown>>(\n defaults: T,\n userConfig?: DeepPartial<T>,\n): T {\n if (!userConfig) {\n return defaults;\n }\n\n const output: Record<string, unknown> = { ...defaults };\n const defaultsRecord = defaults as Record<string, unknown>;\n const userRecord = userConfig as Record<string, unknown>;\n\n for (const key of Object.keys(userConfig)) {\n const userValue = userRecord[key];\n const defaultValue = defaultsRecord[key];\n\n if (userValue === undefined) continue;\n\n if (isPlainObject(defaultValue) && isPlainObject(userValue)) {\n output[key] = mergeObject(defaultValue, userValue);\n } else {\n output[key] = userValue;\n }\n }\n\n return output as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,GAAG,GAAG,QAA8B;CAClD,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;;;ACdA,SAAS,cAAc,MAAgD;CACrE,OAAO,OAAO,SAAS,YAAY,SAAS,QAAQ,CAAC,MAAM,QAAQ,IAAI;AACzE;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,YACd,UACA,YACG;CACH,IAAI,CAAC,YACH,OAAO;CAGT,MAAM,SAAkC,EAAE,GAAG,SAAS;CACtD,MAAM,iBAAiB;CACvB,MAAM,aAAa;CAEnB,KAAK,MAAM,OAAO,OAAO,KAAK,UAAU,GAAG;EACzC,MAAM,YAAY,WAAW;EAC7B,MAAM,eAAe,eAAe;EAEpC,IAAI,cAAc,KAAA,GAAW;EAE7B,IAAI,cAAc,YAAY,KAAK,cAAc,SAAS,GACxD,OAAO,OAAO,YAAY,cAAc,SAAS;OAEjD,OAAO,OAAO;CAElB;CAEA,OAAO;AACT"}
@@ -0,0 +1,45 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let node_fs = require("node:fs");
3
+ let node_path = require("node:path");
4
+ //#region src/node/index.ts
5
+ /**
6
+ * Conventional AsheeUI config filenames, checked in order.
7
+ *
8
+ * Supports both `asheeui.config.*` and `asheeui-config.*` spellings
9
+ * across the TypeScript and JavaScript module extensions.
10
+ */
11
+ const CANDIDATES = [
12
+ "asheeui.config.ts",
13
+ "asheeui.config.mts",
14
+ "asheeui.config.js",
15
+ "asheeui.config.mjs",
16
+ "asheeui-config.ts",
17
+ "asheeui-config.mts",
18
+ "asheeui-config.js",
19
+ "asheeui-config.mjs"
20
+ ];
21
+ /**
22
+ * Discover an existing AsheeUI config file inside `root`.
23
+ *
24
+ * Returns the first of {@link CANDIDATES} that exists on disk, walking
25
+ * the list in priority order.
26
+ *
27
+ * @param root - Directory to search. Defaults to `process.cwd()`.
28
+ * @returns Absolute path of the first matching config file, or
29
+ * `undefined` when no config exists.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const configPath = discoverConfig(process.cwd());
34
+ * if (configPath) {
35
+ * // load and apply the user's config
36
+ * }
37
+ * ```
38
+ */
39
+ function discoverConfig(root) {
40
+ const base = root ?? process.cwd();
41
+ return CANDIDATES.map((file) => (0, node_path.resolve)(base, file)).find(node_fs.existsSync);
42
+ }
43
+ //#endregion
44
+ exports.CANDIDATES = CANDIDATES;
45
+ exports.discoverConfig = discoverConfig;
@@ -0,0 +1,30 @@
1
+ //#region src/node/index.d.ts
2
+ /**
3
+ * Conventional AsheeUI config filenames, checked in order.
4
+ *
5
+ * Supports both `asheeui.config.*` and `asheeui-config.*` spellings
6
+ * across the TypeScript and JavaScript module extensions.
7
+ */
8
+ declare const CANDIDATES: readonly ["asheeui.config.ts", "asheeui.config.mts", "asheeui.config.js", "asheeui.config.mjs", "asheeui-config.ts", "asheeui-config.mts", "asheeui-config.js", "asheeui-config.mjs"];
9
+ /**
10
+ * Discover an existing AsheeUI config file inside `root`.
11
+ *
12
+ * Returns the first of {@link CANDIDATES} that exists on disk, walking
13
+ * the list in priority order.
14
+ *
15
+ * @param root - Directory to search. Defaults to `process.cwd()`.
16
+ * @returns Absolute path of the first matching config file, or
17
+ * `undefined` when no config exists.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const configPath = discoverConfig(process.cwd());
22
+ * if (configPath) {
23
+ * // load and apply the user's config
24
+ * }
25
+ * ```
26
+ */
27
+ declare function discoverConfig(root?: string): string | undefined;
28
+ //#endregion
29
+ export { CANDIDATES, discoverConfig };
30
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/node/index.ts"],"mappings":";;;;;;;cASa;;;;;;;;;;;;;;;;;;;iBA6BG,eAAe"}
@@ -0,0 +1,30 @@
1
+ //#region src/node/index.d.ts
2
+ /**
3
+ * Conventional AsheeUI config filenames, checked in order.
4
+ *
5
+ * Supports both `asheeui.config.*` and `asheeui-config.*` spellings
6
+ * across the TypeScript and JavaScript module extensions.
7
+ */
8
+ declare const CANDIDATES: readonly ["asheeui.config.ts", "asheeui.config.mts", "asheeui.config.js", "asheeui.config.mjs", "asheeui-config.ts", "asheeui-config.mts", "asheeui-config.js", "asheeui-config.mjs"];
9
+ /**
10
+ * Discover an existing AsheeUI config file inside `root`.
11
+ *
12
+ * Returns the first of {@link CANDIDATES} that exists on disk, walking
13
+ * the list in priority order.
14
+ *
15
+ * @param root - Directory to search. Defaults to `process.cwd()`.
16
+ * @returns Absolute path of the first matching config file, or
17
+ * `undefined` when no config exists.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const configPath = discoverConfig(process.cwd());
22
+ * if (configPath) {
23
+ * // load and apply the user's config
24
+ * }
25
+ * ```
26
+ */
27
+ declare function discoverConfig(root?: string): string | undefined;
28
+ //#endregion
29
+ export { CANDIDATES, discoverConfig };
30
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/node/index.ts"],"mappings":";;;;;;;cASa;;;;;;;;;;;;;;;;;;;iBA6BG,eAAe"}
@@ -0,0 +1,45 @@
1
+ import { existsSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ //#region src/node/index.ts
4
+ /**
5
+ * Conventional AsheeUI config filenames, checked in order.
6
+ *
7
+ * Supports both `asheeui.config.*` and `asheeui-config.*` spellings
8
+ * across the TypeScript and JavaScript module extensions.
9
+ */
10
+ const CANDIDATES = [
11
+ "asheeui.config.ts",
12
+ "asheeui.config.mts",
13
+ "asheeui.config.js",
14
+ "asheeui.config.mjs",
15
+ "asheeui-config.ts",
16
+ "asheeui-config.mts",
17
+ "asheeui-config.js",
18
+ "asheeui-config.mjs"
19
+ ];
20
+ /**
21
+ * Discover an existing AsheeUI config file inside `root`.
22
+ *
23
+ * Returns the first of {@link CANDIDATES} that exists on disk, walking
24
+ * the list in priority order.
25
+ *
26
+ * @param root - Directory to search. Defaults to `process.cwd()`.
27
+ * @returns Absolute path of the first matching config file, or
28
+ * `undefined` when no config exists.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const configPath = discoverConfig(process.cwd());
33
+ * if (configPath) {
34
+ * // load and apply the user's config
35
+ * }
36
+ * ```
37
+ */
38
+ function discoverConfig(root) {
39
+ const base = root ?? process.cwd();
40
+ return CANDIDATES.map((file) => resolve(base, file)).find(existsSync);
41
+ }
42
+ //#endregion
43
+ export { CANDIDATES, discoverConfig };
44
+
45
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/node/index.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\n/**\n * Conventional AsheeUI config filenames, checked in order.\n *\n * Supports both `asheeui.config.*` and `asheeui-config.*` spellings\n * across the TypeScript and JavaScript module extensions.\n */\nexport const CANDIDATES = [\n \"asheeui.config.ts\",\n \"asheeui.config.mts\",\n \"asheeui.config.js\",\n \"asheeui.config.mjs\",\n \"asheeui-config.ts\",\n \"asheeui-config.mts\",\n \"asheeui-config.js\",\n \"asheeui-config.mjs\",\n] as const;\n\n/**\n * Discover an existing AsheeUI config file inside `root`.\n *\n * Returns the first of {@link CANDIDATES} that exists on disk, walking\n * the list in priority order.\n *\n * @param root - Directory to search. Defaults to `process.cwd()`.\n * @returns Absolute path of the first matching config file, or\n * `undefined` when no config exists.\n *\n * @example\n * ```ts\n * const configPath = discoverConfig(process.cwd());\n * if (configPath) {\n * // load and apply the user's config\n * }\n * ```\n */\nexport function discoverConfig(root?: string): string | undefined {\n const base = root ?? process.cwd();\n return CANDIDATES.map((file) => resolve(base, file)).find(existsSync);\n}\n"],"mappings":";;;;;;;;;AASA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,eAAe,MAAmC;CAChE,MAAM,OAAO,QAAQ,QAAQ,IAAI;CACjC,OAAO,WAAW,KAAK,SAAS,QAAQ,MAAM,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU;AACtE"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@asheeui/utils",
3
+ "version": "0.3.0",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./node": {
20
+ "import": {
21
+ "types": "./dist/node/index.d.mts",
22
+ "default": "./dist/node/index.mjs"
23
+ },
24
+ "require": {
25
+ "types": "./dist/node/index.d.cts",
26
+ "default": "./dist/node/index.cjs"
27
+ }
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "dependencies": {
34
+ "clsx": "^2.1.1",
35
+ "tailwind-merge": "^3.6.0"
36
+ },
37
+ "devDependencies": {
38
+ "tsdown": "^0.22.14"
39
+ },
40
+ "license": "MIT",
41
+ "scripts": {
42
+ "build": "tsdown",
43
+ "dev": "tsdown --watch"
44
+ }
45
+ }