@ruan-cat/utils 1.7.0 → 2.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.
Files changed (31) hide show
  1. package/{readme.md → README.md} +6 -0
  2. package/dist/index.d.ts +11 -22
  3. package/dist/index.js +1 -31
  4. package/dist/index.js.map +1 -1
  5. package/dist/{node.cjs → node-cjs/index.cjs} +14 -13
  6. package/dist/node-cjs/index.cjs.map +1 -0
  7. package/dist/{node.d.cts → node-cjs/index.d.cts} +2 -3
  8. package/dist/node-esm/index.d.ts +88 -0
  9. package/dist/node-esm/index.js +388 -0
  10. package/dist/node-esm/index.js.map +1 -0
  11. package/dist/node-esm/template/components.template.js +0 -0
  12. package/dist/node-esm/template/components.template.ts +21 -0
  13. package/package.json +23 -9
  14. package/src/index.ts +1 -2
  15. package/src/node-cjs/index.ts +1 -0
  16. package/src/{node.ts → node-cjs/tools.ts} +4 -2
  17. package/src/node-esm/index.ts +5 -0
  18. package/src/node-esm/scripts/clean.ts +45 -0
  19. package/src/node-esm/vite-plugin-autogeneration-import-file/README.md +11 -0
  20. package/src/node-esm/vite-plugin-autogeneration-import-file/index.ts +120 -0
  21. package/src/node-esm/vite-plugin-autogeneration-import-file/template/components.template.ts +21 -0
  22. package/src/node-esm/vite-plugin-autogeneration-import-file/vite-plugin-autogeneration-import-file.test.ts +7 -0
  23. package/src/unplugin-vue-router/index.ts +10 -0
  24. package/src/vueuse/README.md +9 -0
  25. package/src/vueuse/useAxios/README.md +53 -0
  26. package/dist/node.cjs.map +0 -1
  27. package/dist/node.d.ts +0 -43
  28. package/dist/node.js +0 -62
  29. package/dist/node.js.map +0 -1
  30. /package/src/{ruan-cat-pkg-info.ts → node-esm/ruan-cat-pkg-info.ts} +0 -0
  31. /package/src/vueuse/{useAxios.ts → useAxios/index.ts} +0 -0
@@ -1,3 +1,9 @@
1
+ ---
2
+ order: 10
3
+ dir:
4
+ order: 10
5
+ ---
6
+
1
7
  # 工具包
2
8
 
3
9
  这是阮喵喵开发的工具包,提供了一些工具函数。
package/dist/index.d.ts CHANGED
@@ -125,6 +125,16 @@ type GetRouteName = NonNullable<Options["getRouteName"]>;
125
125
  * 故自定义。
126
126
  *
127
127
  * unplugin-vue-router 插件的 getRouteName 配置项
128
+ *
129
+ * FIXME: https://github.com/vitejs/vite/issues/5370
130
+ *
131
+ * 该函数设计出来是为了解决这个问题
132
+ *
133
+ * 在vite符号链接未解决时,应该直接使用js文件,如下:
134
+ * import { getRouteName } from "@ruan-cat/utils/dist/index.js";
135
+ *
136
+ * 若已经彻底解决,请直接试图用来自符号链接的ts文件,如下:
137
+ * import { getRouteName } from "@ruan-cat/utils";
128
138
  */
129
139
  declare const getRouteName: GetRouteName;
130
140
 
@@ -270,27 +280,6 @@ D = any> {
270
280
  */
271
281
  declare function useAxiosWrapper<T, K extends KeyAxiosRequestConfig, D = any>(params: UseAxiosWrapperParams): StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D> & Promise<StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D>>;
272
282
 
273
- /** 包的信息 */
274
- interface PackageInfo {
275
- /** 包名 */
276
- name: string;
277
- /** 包的描述 */
278
- description: string;
279
- /** 带有包名的官方镜像源地址 */
280
- url: `https://npm.im/${string}`;
281
- }
282
- /**
283
- * 获得阮喵喵全部的包信息
284
- * @description
285
- * 这是一个node环境下的函数,用于获取阮喵喵的所有包的信息。
286
- *
287
- * 使用的是node的child_process模块,调用pnpm命令获取包信息。
288
- *
289
- * - 默认仅考虑pnpm包
290
- * - 在node环境下运行
291
- */
292
- declare function getRuanCatPkgInfo(): Promise<PackageInfo[]>;
293
-
294
283
  /**
295
284
  * pnpm-workspace.yaml 文件的类型声明
296
285
  * @description
@@ -328,4 +317,4 @@ type Prettify<T> = {
328
317
  */
329
318
  type ToNumberLike<T extends number> = T | `${T}`;
330
319
 
331
- export { type AttributePromptTool, type BaseTask, type Condition, type Conditions, type CreateAxiosRequestConfig, type FunctionKeys, type HandleStrategy, type KeyAxiosRequestConfig, type KeyHelper, type PackageInfo, type ParallelTasks, type PnpmWorkspace, type Prettify, type PromiseTasksConfig, type QueueTasks, type RemoveUrl, RmmvClass, type SimpleAsyncTask, type SingleTasks, type StrictUseAxiosReturn, type Task, type TaskType, type TasksConfig, type ToNumberLike, type UseAxiosWrapperParams, defaultHandleStrategy, type defaultHandleStrategy_FuncationName, definePromiseTasks, executePromiseTasks, generateSimpleAsyncTask, getRouteName, getRuanCatPkgInfo, initFlag, isConditionsEvery, isConditionsSome, rmmvClassExpandTools, runPromiseByConcurrency, runPromiseByQueue, taskTypes, useAxiosWrapper };
320
+ export { type AttributePromptTool, type BaseTask, type Condition, type Conditions, type CreateAxiosRequestConfig, type FunctionKeys, type HandleStrategy, type KeyAxiosRequestConfig, type KeyHelper, type ParallelTasks, type PnpmWorkspace, type Prettify, type PromiseTasksConfig, type QueueTasks, type RemoveUrl, RmmvClass, type SimpleAsyncTask, type SingleTasks, type StrictUseAxiosReturn, type Task, type TaskType, type TasksConfig, type ToNumberLike, type UseAxiosWrapperParams, defaultHandleStrategy, type defaultHandleStrategy_FuncationName, definePromiseTasks, executePromiseTasks, generateSimpleAsyncTask, getRouteName, initFlag, isConditionsEvery, isConditionsSome, rmmvClassExpandTools, runPromiseByConcurrency, runPromiseByQueue, taskTypes, useAxiosWrapper };
package/dist/index.js CHANGED
@@ -921,7 +921,7 @@ async function runPromiseByConcurrency(promises) {
921
921
  await Promise.all(promises.map((promise) => promise()));
922
922
  }
923
923
 
924
- // src/vueuse/useAxios.ts
924
+ // src/vueuse/useAxios/index.ts
925
925
  import { useAxios } from "@vueuse/integrations/useAxios";
926
926
  function useAxiosWrapper(params) {
927
927
  const {
@@ -932,42 +932,12 @@ function useAxiosWrapper(params) {
932
932
  } = params;
933
933
  return useAxios(url, config, instance, options);
934
934
  }
935
-
936
- // src/ruan-cat-pkg-info.ts
937
- import { spawnSync } from "node:child_process";
938
- async function getRuanCatPkgInfo() {
939
- return new Promise((resolve, reject) => {
940
- const result = spawnSync("pnpm", ["s", "@ruan-cat/*", "--registry", "https://registry.npmmirror.com/", "--json"], {
941
- encoding: "utf-8"
942
- });
943
- if (result.error) {
944
- console.error(`Error executing command: ${result.error.message}`);
945
- reject(result.error);
946
- return;
947
- }
948
- if (result.stderr) {
949
- console.error(`Error in output: ${result.stderr}`);
950
- reject(new Error(result.stderr));
951
- return;
952
- }
953
- const packages = JSON.parse(result.stdout);
954
- const res = packages.map(
955
- (pkg) => ({
956
- name: pkg.name,
957
- description: pkg.description,
958
- url: `https://npm.im/${pkg.name}`
959
- })
960
- );
961
- resolve(res);
962
- });
963
- }
964
935
  export {
965
936
  defaultHandleStrategy,
966
937
  definePromiseTasks,
967
938
  executePromiseTasks,
968
939
  generateSimpleAsyncTask,
969
940
  getRouteName,
970
- getRuanCatPkgInfo,
971
941
  initFlag,
972
942
  isConditionsEvery,
973
943
  isConditionsSome,