@windrun-huaiin/lib 3.1.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.
@@ -0,0 +1,162 @@
1
+ // src/limited-lucide-icons.ts
2
+ import {
3
+ AlbumIcon,
4
+ AlignHorizontalJustifyEnd,
5
+ ArrowLeft,
6
+ ArrowRight,
7
+ ArrowUp,
8
+ Binary,
9
+ Blocks,
10
+ BookX,
11
+ BringToFront,
12
+ Building2,
13
+ Bug,
14
+ Car,
15
+ Circle,
16
+ CircleAlert,
17
+ CircleSmall,
18
+ Check,
19
+ ChevronDown,
20
+ ChevronLeft,
21
+ ChevronRight,
22
+ ChevronUp,
23
+ Cpu,
24
+ ComponentIcon,
25
+ DatabaseZap,
26
+ Dot,
27
+ Download,
28
+ Eye,
29
+ ExternalLink,
30
+ Facebook,
31
+ FileLock2,
32
+ Fingerprint,
33
+ Gift,
34
+ GitPullRequestArrow,
35
+ Globe,
36
+ GlobeLock,
37
+ GripVertical,
38
+ HandHeart,
39
+ Handshake,
40
+ Highlighter,
41
+ HousePlus,
42
+ Info,
43
+ ImageDown,
44
+ ImageOff,
45
+ ImageUp,
46
+ Keyboard,
47
+ LandPlot,
48
+ Layout,
49
+ LayoutTemplate,
50
+ LibraryIcon,
51
+ Link,
52
+ Loader2,
53
+ LogIn,
54
+ LogOut,
55
+ MoreHorizontal,
56
+ MousePointerClick,
57
+ PanelLeft,
58
+ PanelsTopLeft,
59
+ Pencil,
60
+ Pi,
61
+ Palette,
62
+ ReceiptText,
63
+ Regex,
64
+ Replace,
65
+ Rss,
66
+ Scale,
67
+ Search,
68
+ Share,
69
+ ShieldUser,
70
+ SquareDashedBottomCode,
71
+ SquareTerminal,
72
+ Server,
73
+ SplinePointer,
74
+ Sparkles,
75
+ Star,
76
+ Tablets,
77
+ Terminal,
78
+ Twitter,
79
+ X,
80
+ Zap
81
+ } from "lucide-react";
82
+ export {
83
+ AlbumIcon,
84
+ AlignHorizontalJustifyEnd,
85
+ ArrowLeft,
86
+ ArrowRight,
87
+ ArrowUp,
88
+ Binary,
89
+ Blocks,
90
+ BookX,
91
+ BringToFront,
92
+ Bug,
93
+ Building2,
94
+ Car,
95
+ Check,
96
+ ChevronDown,
97
+ ChevronLeft,
98
+ ChevronRight,
99
+ ChevronUp,
100
+ Circle,
101
+ CircleAlert,
102
+ CircleSmall,
103
+ ComponentIcon,
104
+ Cpu,
105
+ DatabaseZap,
106
+ Dot,
107
+ Download,
108
+ ExternalLink,
109
+ Eye,
110
+ Facebook,
111
+ FileLock2,
112
+ Fingerprint,
113
+ Gift,
114
+ GitPullRequestArrow,
115
+ Globe,
116
+ GlobeLock,
117
+ GripVertical,
118
+ HandHeart,
119
+ Handshake,
120
+ Highlighter,
121
+ HousePlus,
122
+ ImageDown,
123
+ ImageOff,
124
+ ImageUp,
125
+ Info,
126
+ Keyboard,
127
+ LandPlot,
128
+ Layout,
129
+ LayoutTemplate,
130
+ LibraryIcon,
131
+ Link,
132
+ Loader2,
133
+ LogIn,
134
+ LogOut,
135
+ MoreHorizontal,
136
+ MousePointerClick,
137
+ Palette,
138
+ PanelLeft,
139
+ PanelsTopLeft,
140
+ Pencil,
141
+ Pi,
142
+ ReceiptText,
143
+ Regex,
144
+ Replace,
145
+ Rss,
146
+ Scale,
147
+ Search,
148
+ Server,
149
+ Share,
150
+ ShieldUser,
151
+ Sparkles,
152
+ SplinePointer,
153
+ SquareDashedBottomCode,
154
+ SquareTerminal,
155
+ Star,
156
+ Tablets,
157
+ Terminal,
158
+ Twitter,
159
+ X,
160
+ Zap
161
+ };
162
+ //# sourceMappingURL=limited-lucide-icons.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/limited-lucide-icons.ts"],"sourcesContent":["/*\n * This file re-exports selected icons from 'lucide-react'.\n * This is the single place to manage which lucide-react icons are available globally.\n * Editing the list of exports here will automatically update their availability\n * in globalLucideIcons.\n */\nexport {\n AlbumIcon,\n AlignHorizontalJustifyEnd,\n ArrowLeft,\n ArrowRight,\n ArrowUp,\n Binary,\n Blocks,\n BookX,\n BringToFront,\n Building2,\n Bug,\n Car,\n Circle,\n CircleAlert,\n CircleSmall,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronRight,\n ChevronUp,\n Cpu,\n ComponentIcon,\n DatabaseZap,\n Dot,\n Download,\n Eye,\n ExternalLink,\n Facebook,\n FileLock2,\n Fingerprint,\n Gift,\n GitPullRequestArrow,\n Globe,\n GlobeLock,\n GripVertical,\n HandHeart,\n Handshake,\n Highlighter,\n HousePlus,\n Info,\n ImageDown,\n ImageOff,\n ImageUp,\n Keyboard,\n LandPlot,\n Layout,\n LayoutTemplate,\n LibraryIcon,\n Link,\n Loader2,\n LogIn,\n LogOut,\n MoreHorizontal,\n MousePointerClick,\n PanelLeft,\n PanelsTopLeft,\n Pencil,\n Pi,\n Palette,\n ReceiptText,\n Regex,\n Replace,\n Rss,\n Scale,\n Search,\n Share,\n ShieldUser,\n SquareDashedBottomCode,\n SquareTerminal,\n Server,\n SplinePointer,\n Sparkles,\n Star,\n Tablets,\n Terminal,\n Twitter,\n X,\n Zap\n} from 'lucide-react'; "],"mappings":";AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function getLLMText(mdxContent: string, title?: string, description?: string): Promise<string>;
2
+
3
+ export { getLLMText };
@@ -0,0 +1,3 @@
1
+ declare function getLLMText(mdxContent: string, title?: string, description?: string): Promise<string>;
2
+
3
+ export { getLLMText };
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
49
+
50
+ // src/llm-utils.ts
51
+ var llm_utils_exports = {};
52
+ __export(llm_utils_exports, {
53
+ getLLMText: () => getLLMText
54
+ });
55
+ module.exports = __toCommonJS(llm_utils_exports);
56
+ var import_remark = require("remark");
57
+ var import_remark_gfm = __toESM(require("remark-gfm"));
58
+ var import_remark_mdx = __toESM(require("remark-mdx"));
59
+ var import_remark_frontmatter = __toESM(require("remark-frontmatter"));
60
+ var import_unist_util_visit = require("unist-util-visit");
61
+ function remarkRemoveFrontmatter() {
62
+ return (tree) => {
63
+ (0, import_unist_util_visit.visit)(tree, "yaml", (_node, index, parent) => {
64
+ if (parent && typeof index === "number") {
65
+ parent.children.splice(index, 1);
66
+ }
67
+ });
68
+ };
69
+ }
70
+ var processor = (0, import_remark.remark)().use(import_remark_frontmatter.default, ["yaml"]).use(remarkRemoveFrontmatter).use(import_remark_mdx.default).use(import_remark_gfm.default);
71
+ function getLLMText(mdxContent, title, description) {
72
+ return __async(this, null, function* () {
73
+ if (typeof mdxContent !== "string") {
74
+ console.error("getLLMText: mdxContent received was not a string. Type:", typeof mdxContent);
75
+ return `# Error
76
+
77
+ Invalid content received by text processor.`;
78
+ }
79
+ try {
80
+ const processed = yield processor.process(mdxContent);
81
+ const contentWithoutFrontmatter = processed.value;
82
+ const markdownParts = [
83
+ title ? `# ${title}` : null,
84
+ description,
85
+ contentWithoutFrontmatter.trim()
86
+ ];
87
+ return markdownParts.filter((part) => part != null).join("\n\n");
88
+ } catch (processingError) {
89
+ console.error("Error during remark processing in getLLMText:", processingError);
90
+ return `# Error
91
+
92
+ Error processing MDX content.`;
93
+ }
94
+ });
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ getLLMText
99
+ });
100
+ //# sourceMappingURL=llm-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/llm-utils.ts"],"sourcesContent":["import { remark } from 'remark';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdx from 'remark-mdx';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport { visit } from 'unist-util-visit';\n\nfunction remarkRemoveFrontmatter() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (tree: any) => {\n visit(tree, 'yaml', (_node, index, parent) => {\n if (parent && typeof index === 'number') {\n parent.children.splice(index, 1);\n }\n });\n };\n}\n\n// remark(), parse the MDX file into MDAST\n// remarkPlugins(), parse the MDAST into HAST\n// rehypePlugins(), render the HAST into React components, i.e. HTML code\nconst processor = remark()\n // parse the md file header\n .use(remarkFrontmatter, ['yaml'])\n // remove the md file header\n .use(remarkRemoveFrontmatter)\n .use(remarkMdx)\n .use(remarkGfm);\n\nexport async function getLLMText(mdxContent: string, title?: string, description?: string) {\n if (typeof mdxContent !== 'string') {\n console.error('getLLMText: mdxContent received was not a string. Type:', typeof mdxContent);\n return `# Error\\n\\nInvalid content received by text processor.`;\n }\n\n try {\n const processed = await processor.process(mdxContent);\n const contentWithoutFrontmatter = processed.value as string;\n\n const markdownParts = [\n title ? `# ${title}` : null,\n description,\n contentWithoutFrontmatter.trim()\n ];\n\n return markdownParts.filter(part => part != null).join('\\n\\n');\n } catch (processingError) {\n console.error('Error during remark processing in getLLMText:', processingError);\n return `# Error\\n\\nError processing MDX content.`;\n }\n} "],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,wBAAsB;AACtB,wBAAsB;AACtB,gCAA8B;AAC9B,8BAAsB;AAEtB,SAAS,0BAA0B;AAEjC,SAAO,CAAC,SAAc;AACpB,uCAAM,MAAM,QAAQ,CAAC,OAAO,OAAO,WAAW;AAC5C,UAAI,UAAU,OAAO,UAAU,UAAU;AACvC,eAAO,SAAS,OAAO,OAAO,CAAC;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAKA,IAAM,gBAAY,sBAAO,EAEtB,IAAI,0BAAAA,SAAmB,CAAC,MAAM,CAAC,EAE/B,IAAI,uBAAuB,EAC3B,IAAI,kBAAAC,OAAS,EACb,IAAI,kBAAAC,OAAS;AAEhB,SAAsB,WAAW,YAAoB,OAAgB,aAAsB;AAAA;AACzF,QAAI,OAAO,eAAe,UAAU;AAClC,cAAQ,MAAM,2DAA2D,OAAO,UAAU;AAC1F,aAAO;AAAA;AAAA;AAAA,IACT;AAEA,QAAI;AACF,YAAM,YAAY,MAAM,UAAU,QAAQ,UAAU;AACpD,YAAM,4BAA4B,UAAU;AAE5C,YAAM,gBAAgB;AAAA,QACpB,QAAQ,KAAK,KAAK,KAAK;AAAA,QACvB;AAAA,QACA,0BAA0B,KAAK;AAAA,MACjC;AAEA,aAAO,cAAc,OAAO,UAAQ,QAAQ,IAAI,EAAE,KAAK,MAAM;AAAA,IAC/D,SAAS,iBAAiB;AACxB,cAAQ,MAAM,iDAAiD,eAAe;AAC9E,aAAO;AAAA;AAAA;AAAA,IACT;AAAA,EACF;AAAA;","names":["remarkFrontmatter","remarkMdx","remarkGfm"]}
@@ -0,0 +1,66 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
21
+
22
+ // src/llm-utils.ts
23
+ import { remark } from "remark";
24
+ import remarkGfm from "remark-gfm";
25
+ import remarkMdx from "remark-mdx";
26
+ import remarkFrontmatter from "remark-frontmatter";
27
+ import { visit } from "unist-util-visit";
28
+ function remarkRemoveFrontmatter() {
29
+ return (tree) => {
30
+ visit(tree, "yaml", (_node, index, parent) => {
31
+ if (parent && typeof index === "number") {
32
+ parent.children.splice(index, 1);
33
+ }
34
+ });
35
+ };
36
+ }
37
+ var processor = remark().use(remarkFrontmatter, ["yaml"]).use(remarkRemoveFrontmatter).use(remarkMdx).use(remarkGfm);
38
+ function getLLMText(mdxContent, title, description) {
39
+ return __async(this, null, function* () {
40
+ if (typeof mdxContent !== "string") {
41
+ console.error("getLLMText: mdxContent received was not a string. Type:", typeof mdxContent);
42
+ return `# Error
43
+
44
+ Invalid content received by text processor.`;
45
+ }
46
+ try {
47
+ const processed = yield processor.process(mdxContent);
48
+ const contentWithoutFrontmatter = processed.value;
49
+ const markdownParts = [
50
+ title ? `# ${title}` : null,
51
+ description,
52
+ contentWithoutFrontmatter.trim()
53
+ ];
54
+ return markdownParts.filter((part) => part != null).join("\n\n");
55
+ } catch (processingError) {
56
+ console.error("Error during remark processing in getLLMText:", processingError);
57
+ return `# Error
58
+
59
+ Error processing MDX content.`;
60
+ }
61
+ });
62
+ }
63
+ export {
64
+ getLLMText
65
+ };
66
+ //# sourceMappingURL=llm-utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/llm-utils.ts"],"sourcesContent":["import { remark } from 'remark';\nimport remarkGfm from 'remark-gfm';\nimport remarkMdx from 'remark-mdx';\nimport remarkFrontmatter from 'remark-frontmatter';\nimport { visit } from 'unist-util-visit';\n\nfunction remarkRemoveFrontmatter() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (tree: any) => {\n visit(tree, 'yaml', (_node, index, parent) => {\n if (parent && typeof index === 'number') {\n parent.children.splice(index, 1);\n }\n });\n };\n}\n\n// remark(), parse the MDX file into MDAST\n// remarkPlugins(), parse the MDAST into HAST\n// rehypePlugins(), render the HAST into React components, i.e. HTML code\nconst processor = remark()\n // parse the md file header\n .use(remarkFrontmatter, ['yaml'])\n // remove the md file header\n .use(remarkRemoveFrontmatter)\n .use(remarkMdx)\n .use(remarkGfm);\n\nexport async function getLLMText(mdxContent: string, title?: string, description?: string) {\n if (typeof mdxContent !== 'string') {\n console.error('getLLMText: mdxContent received was not a string. Type:', typeof mdxContent);\n return `# Error\\n\\nInvalid content received by text processor.`;\n }\n\n try {\n const processed = await processor.process(mdxContent);\n const contentWithoutFrontmatter = processed.value as string;\n\n const markdownParts = [\n title ? `# ${title}` : null,\n description,\n contentWithoutFrontmatter.trim()\n ];\n\n return markdownParts.filter(part => part != null).join('\\n\\n');\n } catch (processingError) {\n console.error('Error during remark processing in getLLMText:', processingError);\n return `# Error\\n\\nError processing MDX content.`;\n }\n} "],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,OAAO,uBAAuB;AAC9B,SAAS,aAAa;AAEtB,SAAS,0BAA0B;AAEjC,SAAO,CAAC,SAAc;AACpB,UAAM,MAAM,QAAQ,CAAC,OAAO,OAAO,WAAW;AAC5C,UAAI,UAAU,OAAO,UAAU,UAAU;AACvC,eAAO,SAAS,OAAO,OAAO,CAAC;AAAA,MACjC;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAKA,IAAM,YAAY,OAAO,EAEtB,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAE/B,IAAI,uBAAuB,EAC3B,IAAI,SAAS,EACb,IAAI,SAAS;AAEhB,SAAsB,WAAW,YAAoB,OAAgB,aAAsB;AAAA;AACzF,QAAI,OAAO,eAAe,UAAU;AAClC,cAAQ,MAAM,2DAA2D,OAAO,UAAU;AAC1F,aAAO;AAAA;AAAA;AAAA,IACT;AAEA,QAAI;AACF,YAAM,YAAY,MAAM,UAAU,QAAQ,UAAU;AACpD,YAAM,4BAA4B,UAAU;AAE5C,YAAM,gBAAgB;AAAA,QACpB,QAAQ,KAAK,KAAK,KAAK;AAAA,QACvB;AAAA,QACA,0BAA0B,KAAK;AAAA,MACjC;AAEA,aAAO,cAAc,OAAO,UAAQ,QAAQ,IAAI,EAAE,KAAK,MAAM;AAAA,IAC/D,SAAS,iBAAiB;AACxB,cAAQ,MAAM,iDAAiD,eAAe;AAC9E,aAAO;AAAA;AAAA;AAAA,IACT;AAAA,EACF;AAAA;","names":[]}
@@ -0,0 +1,6 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ declare function cn(...inputs: ClassValue[]): string;
4
+ declare function formatTimestamp(timestamp: string, formatter: string): string;
5
+
6
+ export { cn, formatTimestamp };
@@ -0,0 +1,6 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ declare function cn(...inputs: ClassValue[]): string;
4
+ declare function formatTimestamp(timestamp: string, formatter: string): string;
5
+
6
+ export { cn, formatTimestamp };
package/dist/utils.js ADDED
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils.ts
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ cn: () => cn,
24
+ formatTimestamp: () => formatTimestamp
25
+ });
26
+ module.exports = __toCommonJS(utils_exports);
27
+ var import_clsx = require("clsx");
28
+ var import_tailwind_merge = require("tailwind-merge");
29
+ var import_date_fns = require("date-fns");
30
+ function cn(...inputs) {
31
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
32
+ }
33
+ function formatTimestamp(timestamp, formatter) {
34
+ const fail = "";
35
+ if (!timestamp) {
36
+ return fail;
37
+ }
38
+ const timestampMs = parseInt(timestamp, 10);
39
+ if (isNaN(timestampMs)) {
40
+ return fail;
41
+ }
42
+ const date = new Date(timestampMs);
43
+ if (!(0, import_date_fns.isValid)(date)) {
44
+ return fail;
45
+ }
46
+ try {
47
+ return (0, import_date_fns.format)(date, formatter);
48
+ } catch (error) {
49
+ console.error("Error formatting date:", error);
50
+ return fail;
51
+ }
52
+ }
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ cn,
56
+ formatTimestamp
57
+ });
58
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\nimport { format, isValid } from 'date-fns';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function formatTimestamp(timestamp: string, formatter: string) {\n const fail = \"\";\n if (!timestamp) {\n return fail;\n }\n\n // Assume gitTimestamp is a millisecond timestamp string\n const timestampMs = parseInt(timestamp, 10);\n if (isNaN(timestampMs)) {\n return fail;\n }\n\n const date = new Date(timestampMs); // or if it is determined to be seconds, use fromUnixTime(timestampSeconds)\n\n // Check if the date is valid\n if (!isValid(date)) {\n return fail;\n }\n\n // Format the date\n try {\n // 'yyyy-MM-dd HH:mm:ss' is the date-fns formatting pattern\n return format(date, formatter);\n } catch (error) {\n // format may also throw an error due to an invalid date (although isValid should have already caught it)\n console.error(\"Error formatting date:\", error);\n return fail;\n }\n} "],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsC;AACtC,4BAAwB;AACxB,sBAAgC;AAEzB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;AAEO,SAAS,gBAAgB,WAAmB,WAAmB;AACpE,QAAM,OAAO;AACb,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAGA,QAAM,cAAc,SAAS,WAAW,EAAE;AAC1C,MAAI,MAAM,WAAW,GAAG;AACrB,WAAO;AAAA,EACV;AAEA,QAAM,OAAO,IAAI,KAAK,WAAW;AAGjC,MAAI,KAAC,yBAAQ,IAAI,GAAG;AAClB,WAAO;AAAA,EACT;AAGA,MAAI;AAED,eAAO,wBAAO,MAAM,SAAS;AAAA,EAChC,SAAS,OAAO;AAEb,YAAQ,MAAM,0BAA0B,KAAK;AAC7C,WAAO;AAAA,EACV;AACF;","names":[]}
package/dist/utils.mjs ADDED
@@ -0,0 +1,32 @@
1
+ // src/utils.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ import { format, isValid } from "date-fns";
5
+ function cn(...inputs) {
6
+ return twMerge(clsx(inputs));
7
+ }
8
+ function formatTimestamp(timestamp, formatter) {
9
+ const fail = "";
10
+ if (!timestamp) {
11
+ return fail;
12
+ }
13
+ const timestampMs = parseInt(timestamp, 10);
14
+ if (isNaN(timestampMs)) {
15
+ return fail;
16
+ }
17
+ const date = new Date(timestampMs);
18
+ if (!isValid(date)) {
19
+ return fail;
20
+ }
21
+ try {
22
+ return format(date, formatter);
23
+ } catch (error) {
24
+ console.error("Error formatting date:", error);
25
+ return fail;
26
+ }
27
+ }
28
+ export {
29
+ cn,
30
+ formatTimestamp
31
+ };
32
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\nimport { format, isValid } from 'date-fns';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function formatTimestamp(timestamp: string, formatter: string) {\n const fail = \"\";\n if (!timestamp) {\n return fail;\n }\n\n // Assume gitTimestamp is a millisecond timestamp string\n const timestampMs = parseInt(timestamp, 10);\n if (isNaN(timestampMs)) {\n return fail;\n }\n\n const date = new Date(timestampMs); // or if it is determined to be seconds, use fromUnixTime(timestampSeconds)\n\n // Check if the date is valid\n if (!isValid(date)) {\n return fail;\n }\n\n // Format the date\n try {\n // 'yyyy-MM-dd HH:mm:ss' is the date-fns formatting pattern\n return format(date, formatter);\n } catch (error) {\n // format may also throw an error due to an invalid date (although isValid should have already caught it)\n console.error(\"Error formatting date:\", error);\n return fail;\n }\n} "],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,QAAQ,eAAe;AAEzB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,SAAS,gBAAgB,WAAmB,WAAmB;AACpE,QAAM,OAAO;AACb,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAGA,QAAM,cAAc,SAAS,WAAW,EAAE;AAC1C,MAAI,MAAM,WAAW,GAAG;AACrB,WAAO;AAAA,EACV;AAEA,QAAM,OAAO,IAAI,KAAK,WAAW;AAGjC,MAAI,CAAC,QAAQ,IAAI,GAAG;AAClB,WAAO;AAAA,EACT;AAGA,MAAI;AAED,WAAO,OAAO,MAAM,SAAS;AAAA,EAChC,SAAS,OAAO;AAEb,YAAQ,MAAM,0BAA0B,KAAK;AAC7C,WAAO;AAAA,EACV;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@windrun-huaiin/lib",
3
+ "version": "3.1.0",
4
+ "description": "Common utilities and configuration",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./utils": {
15
+ "types": "./dist/utils.d.ts",
16
+ "import": "./dist/utils.mjs",
17
+ "require": "./dist/utils.js"
18
+ },
19
+ "./limited-lucide-icons": {
20
+ "types": "./dist/limited-lucide-icons.d.ts",
21
+ "import": "./dist/limited-lucide-icons.mjs",
22
+ "require": "./dist/limited-lucide-icons.js"
23
+ },
24
+ "./llm-utils": {
25
+ "types": "./dist/llm-utils.d.ts",
26
+ "import": "./dist/llm-utils.mjs",
27
+ "require": "./dist/llm-utils.js"
28
+ },
29
+ "./common-app-config": {
30
+ "types": "./dist/common-app-config.d.ts",
31
+ "import": "./dist/common-app-config.mjs",
32
+ "require": "./dist/common-app-config.js"
33
+ },
34
+ "./src/*": "./src/*"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "src",
39
+ "package.json",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "build:prod": "tsup",
46
+ "dev": "tsup --watch",
47
+ "clean": "rm -rf dist",
48
+ "typecheck": "tsc --noEmit",
49
+ "lint": "eslint src",
50
+ "prepublishOnly": "pnpm build"
51
+ },
52
+ "dependencies": {
53
+ "react": "19.1.0",
54
+ "react-dom": "19.1.0",
55
+ "clsx": "^2.1.1",
56
+ "tailwind-merge": "^3.3.0",
57
+ "date-fns": "2.30.0",
58
+ "remark": "^15.0.1",
59
+ "remark-gfm": "^4.0.1",
60
+ "remark-mdx": "^3.1.0",
61
+ "remark-frontmatter": "^5.0.0",
62
+ "unist-util-visit": "^5.0.0",
63
+ "lucide-react": "^0.511.0"
64
+ },
65
+ "devDependencies": {
66
+ "typescript": "^5.8.3",
67
+ "tsup": "^8.3.5",
68
+ "@types/node": "^22.15.18"
69
+ },
70
+ "peerDependencies": {
71
+ "react": "^19.1.0"
72
+ },
73
+ "keywords": [
74
+ "utilities",
75
+ "config",
76
+ "typescript",
77
+ "react",
78
+ "nextjs"
79
+ ],
80
+ "author": "windrun-huaiin",
81
+ "license": "MIT",
82
+ "publishConfig": {
83
+ "access": "public"
84
+ }
85
+ }