tcdona_unilib 1.0.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/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # tclib - 统一依赖聚合层
2
+
3
+ 一个统一的依赖管理库,支持通过子路径导入,保持 tree-shaking 能力。
4
+
5
+ ## 特性
6
+
7
+ - ✅ ESM 模块(`type: module`)
8
+ - ✅ 子路径导入支持(如 `import from 'tclib/zod'`)
9
+ - ✅ Tree-shaking 优化
10
+ - ✅ 完整的类型支持
11
+ - ✅ 统一的版本管理
12
+
13
+ ## 安装
14
+
15
+ ```bash
16
+ npm install tclib
17
+ # or
18
+ yarn add tclib
19
+ # or
20
+ pnpm add tclib
21
+ ```
22
+
23
+ ## 使用
24
+
25
+ ### 子路径导入
26
+
27
+ ```typescript
28
+ // 导入单个库
29
+ import { z } from "tclib/zod"
30
+ import { nanoid } from "tclib/nanoid"
31
+ import dayjs from "tclib/dayjs"
32
+ import { defineConfig } from "tclib/vite"
33
+
34
+ // 导入所有库
35
+ import * as tclib from "tclib"
36
+ ```
37
+
38
+ ## 支持的库
39
+
40
+ | 库名 | 导入方式 | 用途 |
41
+ | ------------ | ------------------ | ---------------- |
42
+ | neverthrow | `tclib/neverthrow` | 错误处理 |
43
+ | zod | `tclib/zod` | 数据验证 |
44
+ | zx | `tclib/zx` | Shell 脚本 |
45
+ | dayjs | `tclib/dayjs` | 日期时间 |
46
+ | big.js | `tclib/big.js` | 精确算术 |
47
+ | nanoid | `tclib/nanoid` | ID 生成 |
48
+ | nanostores | `tclib/nanostores` | 状态管理 |
49
+ | effort | `tclib/effort` | 效率工具 |
50
+ | animejs | `tclib/animejs` | 动画库 |
51
+ | clipboardy | `tclib/clipboardy` | 剪贴板 |
52
+ | marked | `tclib/marked` | Markdown 解析 |
53
+ | pathe | `tclib/pathe` | 路径处理 |
54
+ | prettier | `tclib/prettier` | 代码格式化 |
55
+ | turndown | `tclib/turndown` | HTML 转 Markdown |
56
+ | effector | `tclib/effector` | 事件管理 |
57
+ | comctx | `tclib/comctx` | 上下文管理 |
58
+ | es-toolkit | `tclib/estk` | ES 工具集 |
59
+ | magic-regexp | `tclib/magicreg` | 正则表达式 |
60
+ | exome | `tclib/exome` | 状态管理 |
61
+ | vue | `tclib/vue` | Vue 框架 |
62
+ | vite | `tclib/vite` | 构建工具 |
63
+
64
+ ## 项目结构
65
+
66
+ ```
67
+ tclib/
68
+ ├── package.json # 统一依赖声明
69
+ ├── tsconfig.json # TypeScript 配置
70
+ ├── index.ts # 全量导出入口
71
+ ├── neverthrow.ts # 子路径模块
72
+ ├── zod.ts
73
+ ├── ... (其他 20 个库)
74
+ └── README.md
75
+ ```
76
+
77
+ ## 配置原理
78
+
79
+ - **exports 字段**: 定义子路径映射关系,支持 `tclib/zod` 导入方式
80
+ - **type: module**: 启用 ESM 模块系统
81
+ - **Tree-shaking**: 每个模块仅做简单转发,构建工具可自动优化
82
+
83
+ ## 添加新库
84
+
85
+ 要添加新库,只需:
86
+
87
+ 1. 在 `package.json` 的 `dependencies` 中添加库及版本
88
+ 2. 在 `exports` 中添加路径映射
89
+ 3. 创建对应的 `*.ts` 转发文件:
90
+ ```typescript
91
+ export * from "your-library"
92
+ ```
93
+ 4. 在 `index.ts` 中添加导出行
94
+
95
+ ## 版本管理
96
+
97
+ 所有依赖版本统一在 `package.json` 中管理,确保项目内一致性。
package/animejs.ts ADDED
@@ -0,0 +1 @@
1
+ export { animate, createTimeline, createTimer, createScope, createSpring, createDraggable, stagger, eases, utils, svg, engine } from 'animejs';
package/big.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as Big } from 'big.js';
2
+ export type { Big as BigType, BigSource } from 'big.js';
package/clipboardy.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as clipboard } from 'clipboardy';
package/comctx.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { defineProxy, checkMessage, MESSAGE_TYPE, MESSAGE_SENDER } from 'comctx';
2
+ export type { Adapter, Context, Message, MessageMeta, MessageType, MessageSender, OffMessage, OnMessage, Options, SendMessage } from 'comctx';
package/dayjs.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as dayjs } from 'dayjs';
2
+ export type { Dayjs, ConfigType, OptionType } from 'dayjs';
package/effector.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { createEvent, createStore, createEffect, createDomain, sample, combine, attach, merge, split, forward, guard, restore, scopeBind, allSettled, fork, serialize, hydrate, clearNode, withRegion, launch, is } from 'effector';
2
+ export type { Event, Store, Effect, Domain, Scope, Unit, EventCallable, StoreWritable } from 'effector';
package/es-toolkit.ts ADDED
@@ -0,0 +1,112 @@
1
+ export {
2
+ chunk,
3
+ compact,
4
+ countBy,
5
+ difference,
6
+ differenceBy,
7
+ differenceWith,
8
+ drop,
9
+ dropRight,
10
+ dropRightWhile,
11
+ dropWhile,
12
+ fill,
13
+ flatten,
14
+ flattenDeep,
15
+ groupBy,
16
+ head,
17
+ initial,
18
+ intersection,
19
+ intersectionBy,
20
+ intersectionWith,
21
+ isSubset,
22
+ keyBy,
23
+ last,
24
+ maxBy,
25
+ minBy,
26
+ orderBy,
27
+ partition,
28
+ pullAt,
29
+ sample,
30
+ sampleSize,
31
+ shuffle,
32
+ sortBy,
33
+ tail,
34
+ take,
35
+ takeRight,
36
+ takeRightWhile,
37
+ takeWhile,
38
+ union,
39
+ unionBy,
40
+ unionWith,
41
+ uniq,
42
+ uniqBy,
43
+ uniqWith,
44
+ unzip,
45
+ unzipWith,
46
+ without,
47
+ xor,
48
+ xorBy,
49
+ xorWith,
50
+ zip,
51
+ zipObject,
52
+ zipWith,
53
+
54
+ debounce,
55
+ throttle,
56
+ once,
57
+ noop,
58
+ identity,
59
+ range,
60
+
61
+ clone,
62
+ cloneDeep,
63
+ isEqual,
64
+ isPlainObject,
65
+ merge,
66
+ omit,
67
+ omitBy,
68
+ pick,
69
+ pickBy,
70
+ invert,
71
+ mapKeys,
72
+ mapValues,
73
+
74
+ camelCase,
75
+ capitalize,
76
+ kebabCase,
77
+ lowerCase,
78
+ lowerFirst,
79
+ snakeCase,
80
+ startCase,
81
+ upperCase,
82
+ upperFirst,
83
+ trim,
84
+ trimEnd,
85
+ trimStart,
86
+ pad,
87
+
88
+ mean,
89
+ meanBy,
90
+ sum,
91
+ sumBy,
92
+ round,
93
+ clamp,
94
+ random,
95
+ randomInt,
96
+
97
+ delay,
98
+ timeout,
99
+ retry,
100
+
101
+ isNil,
102
+ isNull,
103
+ isUndefined,
104
+ isString,
105
+ isBoolean,
106
+ isFunction,
107
+ isDate,
108
+ isRegExp,
109
+ isSymbol,
110
+ isLength,
111
+ isTypedArray,
112
+ } from 'es-toolkit';
package/exome.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Exome, addMiddleware, getExomeId, onAction, subscribe, update, runMiddleware } from 'exome';
2
+ export type { Middleware } from 'exome';
@@ -0,0 +1,2 @@
1
+ export { createRegExp, exactly, oneOrMore, anyOf, char, charIn, charNotIn, word, wordChar, wordBoundary, digit, whitespace, letter, tab, linefeed, carriageReturn, not, maybe, global, multiline, caseInsensitive, sticky, unicode, dotAll, withIndices } from 'magic-regexp';
2
+ export type { Input, MagicRegExp } from 'magic-regexp';
package/marked.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { marked, Marked, Lexer, Parser, Tokenizer, Renderer, TextRenderer, Hooks, getDefaults, setOptions, use, parse, parseInline, lexer, parser, walkTokens } from 'marked';
2
+ export type { Token, Tokens, TokensList, MarkedExtension, MarkedOptions, RendererObject, TokenizerObject } from 'marked';
package/nanoid.ts ADDED
@@ -0,0 +1 @@
1
+ export { nanoid, customAlphabet, customRandom, urlAlphabet, random } from 'nanoid';
package/nanostores.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { atom, map, deepMap, computed, onMount, onSet, onNotify, onStart, onStop, listenKeys, keepMount, task, startTask, allTasks, cleanTasks, batched, STORE_UNMOUNT_DELAY } from 'nanostores';
2
+ export type { Atom, MapStore, DeepMapStore, ReadableAtom, WritableAtom, PreinitializedWritableAtom, MapStoreKeys, AnyStore, Store, StoreValue } from 'nanostores';
package/neverthrow.ts ADDED
@@ -0,0 +1,15 @@
1
+ export {
2
+ ok,
3
+ err,
4
+ Ok,
5
+ Err,
6
+ Result,
7
+ ResultAsync,
8
+ okAsync,
9
+ errAsync,
10
+ fromPromise,
11
+ fromSafePromise,
12
+ fromThrowable,
13
+ safeTry,
14
+ } from 'neverthrow';
15
+ export type { Result as ResultType } from 'neverthrow';
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "tcdona_unilib",
3
+ "version": "1.0.0",
4
+ "description": "Unified dependency aggregation layer for shared libraries",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ "./neverthrow": "./neverthrow.ts",
9
+ "./zod": "./zod.ts",
10
+ "./zx": "./zx.ts",
11
+ "./dayjs": "./dayjs.ts",
12
+ "./big.js": "./big.ts",
13
+ "./nanoid": "./nanoid.ts",
14
+ "./nanostores": "./nanostores.ts",
15
+ "./animejs": "./animejs.ts",
16
+ "./clipboardy": "./clipboardy.ts",
17
+ "./marked": "./marked.ts",
18
+ "./pathe": "./pathe.ts",
19
+ "./prettier": "./prettier.ts",
20
+ "./turndown": "./turndown.ts",
21
+ "./effector": "./effector.ts",
22
+ "./comctx": "./comctx.ts",
23
+ "./estk": "./es-toolkit.ts",
24
+ "./magicreg": "./magic-regexp.ts",
25
+ "./exome": "./exome.ts",
26
+ "./vue": "./vue.ts",
27
+ "./vite": "./vite.ts"
28
+ },
29
+ "scripts": {
30
+ "test": "echo \"Error: no test specified\" && exit 1"
31
+ },
32
+ "keywords": [],
33
+ "author": "",
34
+ "license": "ISC",
35
+ "devDependencies": {
36
+ "@types/node": "^20.10.6"
37
+ },
38
+ "dependencies": {
39
+ "@types/big.js": "^6.2.2",
40
+ "@types/turndown": "^5.0.6",
41
+ "animejs": "^4.1.3",
42
+ "big.js": "^7.0.1",
43
+ "clipboardy": "^5.0.2",
44
+ "comctx": "^1.4.3",
45
+ "dayjs": "^1.11.19",
46
+ "effector": "^23.4.4",
47
+ "es-toolkit": "^1.43.0",
48
+ "exome": "^2.8.0",
49
+ "magic-regexp": "^0.10.0",
50
+ "marked": "^17.0.1",
51
+ "nanoid": "^5.1.6",
52
+ "nanostores": "^1.1.0",
53
+ "neverthrow": "^8.2.0",
54
+ "pathe": "^2.0.3",
55
+ "prettier": "^3.7.4",
56
+ "turndown": "^7.2.2",
57
+ "vite": "^7.3.0",
58
+ "vue": "^3.5.26",
59
+ "zod": "^4.2.1",
60
+ "zx": "^8.8.5"
61
+ }
62
+ }
package/pathe.ts ADDED
@@ -0,0 +1 @@
1
+ export { basename, delimiter, dirname, extname, format, isAbsolute, join, normalize, normalizeString, parse, relative, resolve, sep, toNamespacedPath } from 'pathe';
package/prettier.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { format, formatWithCursor, check, resolveConfig, resolveConfigFile, clearConfigCache, getFileInfo, getSupportInfo, doc, version } from 'prettier';
2
+ export type { Options, Plugin, Printer, Parser, SupportLanguage, SupportOption } from 'prettier';
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2020"],
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "sourceMap": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./",
12
+ "strict": true,
13
+ "esModuleInterop": true,
14
+ "skipLibCheck": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "noEmit": false,
19
+ },
20
+ "include": [
21
+ "*.ts"
22
+ ],
23
+ "exclude": [
24
+ "node_modules",
25
+ "dist"
26
+ ]
27
+ }
package/turndown.ts ADDED
@@ -0,0 +1 @@
1
+ export { default as TurndownService } from 'turndown';
package/vite.ts ADDED
@@ -0,0 +1,54 @@
1
+ export {
2
+ defineConfig,
3
+ loadConfigFromFile,
4
+ loadEnv,
5
+ normalizePath,
6
+ mergeConfig,
7
+ searchForWorkspaceRoot,
8
+ send,
9
+ transformWithEsbuild,
10
+ resolveConfig,
11
+ sortUserPlugins,
12
+ preprocessCSS,
13
+ createServer,
14
+ preview,
15
+ build,
16
+ buildErrorMessage,
17
+ createFilter,
18
+ createLogger,
19
+ formatPostcssSourceMap,
20
+ isCSSRequest,
21
+ parseAst,
22
+ parseAstAsync,
23
+ } from 'vite';
24
+
25
+ export type {
26
+ UserConfig,
27
+ ConfigEnv,
28
+ ResolvedConfig,
29
+ Plugin,
30
+ PluginOption,
31
+ HtmlTagDescriptor,
32
+ IndexHtmlTransform,
33
+ IndexHtmlTransformContext,
34
+ IndexHtmlTransformResult,
35
+ ServerOptions,
36
+ BuildOptions,
37
+ PreviewOptions,
38
+ ResolveOptions,
39
+ CSSOptions,
40
+ ESBuildOptions,
41
+ DepOptimizationOptions,
42
+ ViteDevServer,
43
+ PreviewServer,
44
+ ModuleNode,
45
+ ModuleGraph,
46
+ HmrContext,
47
+ Logger,
48
+ LogLevel,
49
+ LogType,
50
+ Manifest,
51
+ ManifestChunk,
52
+ SSROptions,
53
+ FilterPattern,
54
+ } from 'vite';
package/vue.ts ADDED
@@ -0,0 +1,105 @@
1
+ export {
2
+ createApp,
3
+ createSSRApp,
4
+ defineComponent,
5
+ defineAsyncComponent,
6
+ defineCustomElement,
7
+
8
+ ref,
9
+ reactive,
10
+ readonly,
11
+ computed,
12
+ watch,
13
+ watchEffect,
14
+ watchPostEffect,
15
+ watchSyncEffect,
16
+
17
+ shallowRef,
18
+ shallowReactive,
19
+ shallowReadonly,
20
+ triggerRef,
21
+ toRef,
22
+ toRefs,
23
+ toValue,
24
+ toRaw,
25
+ markRaw,
26
+ isRef,
27
+ isReactive,
28
+ isReadonly,
29
+ isProxy,
30
+ unref,
31
+ customRef,
32
+ effectScope,
33
+ getCurrentScope,
34
+ onScopeDispose,
35
+
36
+ provide,
37
+ inject,
38
+ hasInjectionContext,
39
+
40
+ h,
41
+ mergeProps,
42
+ cloneVNode,
43
+ isVNode,
44
+ resolveComponent,
45
+ resolveDirective,
46
+ withDirectives,
47
+ withModifiers,
48
+
49
+ onMounted,
50
+ onUpdated,
51
+ onUnmounted,
52
+ onBeforeMount,
53
+ onBeforeUpdate,
54
+ onBeforeUnmount,
55
+ onActivated,
56
+ onDeactivated,
57
+ onErrorCaptured,
58
+ onRenderTracked,
59
+ onRenderTriggered,
60
+ onServerPrefetch,
61
+
62
+ nextTick,
63
+
64
+ Transition,
65
+ TransitionGroup,
66
+ KeepAlive,
67
+ Teleport,
68
+ Suspense,
69
+
70
+ Fragment,
71
+ Text,
72
+ Comment,
73
+ Static,
74
+
75
+ useCssModule,
76
+ useCssVars,
77
+ useSlots,
78
+ useAttrs,
79
+ useModel,
80
+ useTemplateRef,
81
+ useId,
82
+
83
+ version,
84
+ } from 'vue';
85
+
86
+ export type {
87
+ App,
88
+ Component,
89
+ ComponentPublicInstance,
90
+ ComputedRef,
91
+ DefineComponent,
92
+ Directive,
93
+ InjectionKey,
94
+ Plugin,
95
+ PropType,
96
+ Ref,
97
+ SetupContext,
98
+ ShallowRef,
99
+ Slots,
100
+ VNode,
101
+ WatchCallback,
102
+ WatchOptions,
103
+ WatchSource,
104
+ WritableComputedRef,
105
+ } from 'vue';
package/zod.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { z } from 'zod';
2
+ export type { ZodSchema, ZodType, ZodObject, ZodArray, ZodString, ZodNumber, ZodBoolean, ZodEnum, ZodUnion, ZodIntersection, ZodOptional, ZodNullable, ZodDefault, ZodError, ZodIssue, infer as ZodInfer } from 'zod';
package/zx.ts ADDED
@@ -0,0 +1 @@
1
+ export { $, cd, chalk, echo, fs, glob, os, path, question, sleep, spinner, stdin, within, argv, fetch, which, nothrow, quiet, retry, expBackoff, ProcessOutput, ProcessPromise } from 'zx';