@ivujs/i-utils 1.1.7 → 1.1.9
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/dist/cjs/index.cjs +45 -5
- package/dist/es/index.d.ts +43 -2
- package/dist/es/index.mjs +40 -4
- package/dist/index.d.ts +45 -3
- package/dist/lib/index.full.cjs.js +46 -6
- package/dist/lib/index.full.cjs.min.js +2 -2
- package/dist/lib/index.full.cjs.min.js.map +1 -1
- package/dist/lib/index.full.esm.js +41 -5
- package/dist/lib/index.full.esm.min.js +2 -2
- package/dist/lib/index.full.esm.min.js.map +1 -1
- package/dist/lib/index.full.umd.js +46 -6
- package/dist/lib/index.full.umd.min.js +2 -2
- package/dist/lib/index.full.umd.min.js.map +1 -1
- package/dist/resolver/index.cjs +61 -0
- package/dist/resolver/index.d.ts +28 -0
- package/dist/resolver/index.json +20 -0
- package/dist/resolver/index.mjs +59 -0
- package/package.json +9 -11
- package/dist/resolvers.d.ts +0 -2
- package/dist/resolves.cjs +0 -15
- package/dist/resolves.mjs +0 -13
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,14 +3,54 @@
|
|
|
3
3
|
var index = require('./id/index.cjs');
|
|
4
4
|
|
|
5
5
|
// 测试加载成功方法
|
|
6
|
-
function
|
|
6
|
+
function loadedTestUtils() {
|
|
7
7
|
console.log("Nice, iUtils loaded successfully!");
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// 导出股票
|
|
10
|
+
class Stock {
|
|
11
|
+
name;
|
|
12
|
+
code;
|
|
13
|
+
constructor(name, code) {
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.name = name;
|
|
17
|
+
this.code = code;
|
|
18
|
+
}
|
|
19
|
+
getInfo() {
|
|
20
|
+
return `hello,${this.name}${this.code}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// 导出配置
|
|
24
|
+
const MY_CONFIG = { status: "success" };
|
|
25
|
+
// 导出信息
|
|
26
|
+
const getUserInfo = function () {
|
|
27
|
+
return "获得用户信息";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 导出股票信息
|
|
31
|
+
* @param name
|
|
32
|
+
*/
|
|
33
|
+
const getStockInfo = (name) => {
|
|
34
|
+
return `xxxxx${name}`;
|
|
35
|
+
};
|
|
36
|
+
// 导出行情
|
|
37
|
+
class MarketQuote {
|
|
38
|
+
name;
|
|
39
|
+
code;
|
|
40
|
+
constructor(name, code) {
|
|
41
|
+
this.name = name;
|
|
42
|
+
this.code = code;
|
|
43
|
+
}
|
|
44
|
+
getInfo() {
|
|
45
|
+
return `hello,${this.name}${this.code}`;
|
|
46
|
+
}
|
|
11
47
|
}
|
|
12
48
|
|
|
13
49
|
exports.getGUID = index.getGUID;
|
|
14
50
|
exports.getUUID = index.getUUID;
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
51
|
+
exports.MY_CONFIG = MY_CONFIG;
|
|
52
|
+
exports.MarketQuote = MarketQuote;
|
|
53
|
+
exports.Stock = Stock;
|
|
54
|
+
exports.getStockInfo = getStockInfo;
|
|
55
|
+
exports.getUserInfo = getUserInfo;
|
|
56
|
+
exports.loadedTestUtils = loadedTestUtils;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
export
|
|
1
|
+
export declare function loadedTestUtils(): void;
|
|
2
|
+
export type BaseStock = {
|
|
3
|
+
name: string;
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
export type HighStock = BaseStock & {
|
|
7
|
+
chgPrice: number;
|
|
8
|
+
chgPct: number;
|
|
9
|
+
};
|
|
10
|
+
export declare enum StockStatus {
|
|
11
|
+
Idle,
|
|
12
|
+
Loading,
|
|
13
|
+
Done
|
|
14
|
+
}
|
|
15
|
+
export declare const doMain: () => void;
|
|
16
|
+
export declare class MyClass {
|
|
17
|
+
}
|
|
18
|
+
export interface StockQuote {
|
|
19
|
+
name: string;
|
|
20
|
+
code: string;
|
|
21
|
+
chgPct: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class Stock {
|
|
24
|
+
name: string;
|
|
25
|
+
code: string;
|
|
26
|
+
constructor(name: string, code: string);
|
|
27
|
+
getInfo(): string;
|
|
28
|
+
}
|
|
29
|
+
export declare const MY_CONFIG: {
|
|
30
|
+
readonly status: "success";
|
|
31
|
+
};
|
|
32
|
+
export declare const getUserInfo: () => string;
|
|
33
|
+
/**
|
|
34
|
+
* 导出股票信息
|
|
35
|
+
* @param name
|
|
36
|
+
*/
|
|
37
|
+
export declare const getStockInfo: (name: string) => string;
|
|
38
|
+
export declare class MarketQuote {
|
|
39
|
+
name: string;
|
|
40
|
+
code: string;
|
|
41
|
+
constructor(name: string, code: string);
|
|
42
|
+
getInfo(): string;
|
|
43
|
+
}
|
|
3
44
|
export * from "./id/index.ts";
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
export { getGUID, getUUID } from './id/index.mjs';
|
|
2
2
|
|
|
3
3
|
// 测试加载成功方法
|
|
4
|
-
function
|
|
4
|
+
function loadedTestUtils() {
|
|
5
5
|
console.log("Nice, iUtils loaded successfully!");
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// 导出股票
|
|
8
|
+
class Stock {
|
|
9
|
+
name;
|
|
10
|
+
code;
|
|
11
|
+
constructor(name, code) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.code = code;
|
|
16
|
+
}
|
|
17
|
+
getInfo() {
|
|
18
|
+
return `hello,${this.name}${this.code}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
// 导出配置
|
|
22
|
+
const MY_CONFIG = { status: "success" };
|
|
23
|
+
// 导出信息
|
|
24
|
+
const getUserInfo = function () {
|
|
25
|
+
return "获得用户信息";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 导出股票信息
|
|
29
|
+
* @param name
|
|
30
|
+
*/
|
|
31
|
+
const getStockInfo = (name) => {
|
|
32
|
+
return `xxxxx${name}`;
|
|
33
|
+
};
|
|
34
|
+
// 导出行情
|
|
35
|
+
class MarketQuote {
|
|
36
|
+
name;
|
|
37
|
+
code;
|
|
38
|
+
constructor(name, code) {
|
|
39
|
+
this.name = name;
|
|
40
|
+
this.code = code;
|
|
41
|
+
}
|
|
42
|
+
getInfo() {
|
|
43
|
+
return `hello,${this.name}${this.code}`;
|
|
44
|
+
}
|
|
9
45
|
}
|
|
10
46
|
|
|
11
|
-
export {
|
|
47
|
+
export { MY_CONFIG, MarketQuote, Stock, getStockInfo, getUserInfo, loadedTestUtils };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,49 @@ declare function getUUID(len?: number, radix?: number): string;
|
|
|
15
15
|
*/
|
|
16
16
|
declare function getGUID(): string;
|
|
17
17
|
|
|
18
|
-
declare function
|
|
19
|
-
|
|
18
|
+
declare function loadedTestUtils(): void;
|
|
19
|
+
type BaseStock = {
|
|
20
|
+
name: string;
|
|
21
|
+
code: string;
|
|
22
|
+
};
|
|
23
|
+
type HighStock = BaseStock & {
|
|
24
|
+
chgPrice: number;
|
|
25
|
+
chgPct: number;
|
|
26
|
+
};
|
|
27
|
+
declare enum StockStatus {
|
|
28
|
+
Idle,
|
|
29
|
+
Loading,
|
|
30
|
+
Done
|
|
31
|
+
}
|
|
32
|
+
declare const doMain: () => void;
|
|
33
|
+
declare class MyClass {
|
|
34
|
+
}
|
|
35
|
+
interface StockQuote {
|
|
36
|
+
name: string;
|
|
37
|
+
code: string;
|
|
38
|
+
chgPct: number;
|
|
39
|
+
}
|
|
40
|
+
declare class Stock {
|
|
41
|
+
name: string;
|
|
42
|
+
code: string;
|
|
43
|
+
constructor(name: string, code: string);
|
|
44
|
+
getInfo(): string;
|
|
45
|
+
}
|
|
46
|
+
declare const MY_CONFIG: {
|
|
47
|
+
readonly status: "success";
|
|
48
|
+
};
|
|
49
|
+
declare const getUserInfo: () => string;
|
|
50
|
+
/**
|
|
51
|
+
* 导出股票信息
|
|
52
|
+
* @param name
|
|
53
|
+
*/
|
|
54
|
+
declare const getStockInfo: (name: string) => string;
|
|
55
|
+
declare class MarketQuote {
|
|
56
|
+
name: string;
|
|
57
|
+
code: string;
|
|
58
|
+
constructor(name: string, code: string);
|
|
59
|
+
getInfo(): string;
|
|
60
|
+
}
|
|
20
61
|
|
|
21
|
-
export { getGUID, getUUID,
|
|
62
|
+
export { MY_CONFIG, MarketQuote, MyClass, Stock, StockStatus, doMain, getGUID, getStockInfo, getUUID, getUserInfo, loadedTestUtils };
|
|
63
|
+
export type { BaseStock, HighStock, StockQuote };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -48,14 +48,54 @@ function getGUID() {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 测试加载成功方法
|
|
51
|
-
function
|
|
51
|
+
function loadedTestUtils() {
|
|
52
52
|
console.log("Nice, iUtils loaded successfully!");
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// 导出股票
|
|
55
|
+
class Stock {
|
|
56
|
+
name;
|
|
57
|
+
code;
|
|
58
|
+
constructor(name, code) {
|
|
59
|
+
this.name = name;
|
|
60
|
+
this.code = code;
|
|
61
|
+
this.name = name;
|
|
62
|
+
this.code = code;
|
|
63
|
+
}
|
|
64
|
+
getInfo() {
|
|
65
|
+
return `hello,${this.name}${this.code}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// 导出配置
|
|
69
|
+
const MY_CONFIG = { status: "success" };
|
|
70
|
+
// 导出信息
|
|
71
|
+
const getUserInfo = function () {
|
|
72
|
+
return "获得用户信息";
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* 导出股票信息
|
|
76
|
+
* @param name
|
|
77
|
+
*/
|
|
78
|
+
const getStockInfo = (name) => {
|
|
79
|
+
return `xxxxx${name}`;
|
|
80
|
+
};
|
|
81
|
+
// 导出行情
|
|
82
|
+
class MarketQuote {
|
|
83
|
+
name;
|
|
84
|
+
code;
|
|
85
|
+
constructor(name, code) {
|
|
86
|
+
this.name = name;
|
|
87
|
+
this.code = code;
|
|
88
|
+
}
|
|
89
|
+
getInfo() {
|
|
90
|
+
return `hello,${this.name}${this.code}`;
|
|
91
|
+
}
|
|
56
92
|
}
|
|
57
93
|
|
|
94
|
+
exports.MY_CONFIG = MY_CONFIG;
|
|
95
|
+
exports.MarketQuote = MarketQuote;
|
|
96
|
+
exports.Stock = Stock;
|
|
58
97
|
exports.getGUID = getGUID;
|
|
98
|
+
exports.getStockInfo = getStockInfo;
|
|
59
99
|
exports.getUUID = getUUID;
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
100
|
+
exports.getUserInfo = getUserInfo;
|
|
101
|
+
exports.loadedTestUtils = loadedTestUtils;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";exports.getGUID=function(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},exports.getUUID=function(t=32,
|
|
6
|
+
"use strict";exports.MY_CONFIG={status:"success"},exports.MarketQuote=class{name;code;constructor(t,e){this.name=t,this.code=e}getInfo(){return`hello,${this.name}${this.code}`}},exports.Stock=class{name;code;constructor(t,e){this.name=t,this.code=e,this.name=t,this.code=e}getInfo(){return`hello,${this.name}${this.code}`}},exports.getGUID=function(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},exports.getStockInfo=t=>`xxxxx${t}`,exports.getUUID=function(t=32,e=16){const o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let s,n=[];if(e=e||o.length,t)for(s=0;s<t;s++)n[s]=o[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",s=0;s<36;s++)n[s]||(t=0|16*Math.random(),n[s]=o[19===s?3&t|8:t])}return n.join("")},exports.getUserInfo=function(){return"获得用户信息"},exports.loadedTestUtils=function(){console.log("Nice, iUtils loaded successfully!")};
|
|
7
7
|
//# sourceMappingURL=index.full.cjs.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.full.cjs.min.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.full.cjs.min.js","sources":["../../src/file:/D:/webWorks/i-utils/src/index.ts","../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts"],"sourcesContent":["// 测试加载成功方法\r\nexport function loadedTestUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n// 股票基础类型\r\nexport type BaseStock = { name: string; code: string };\r\n// 股票高级类型\r\nexport type HighStock = BaseStock & { chgPrice: number; chgPct: number };\r\n\r\nexport declare enum StockStatus {\r\n Idle,\r\n Loading,\r\n Done,\r\n}\r\nexport declare const doMain: () => void;\r\nexport declare class MyClass {}\r\n\r\n// 股票行情\r\nexport interface StockQuote {\r\n name: string;\r\n code: string;\r\n chgPct: number;\r\n}\r\n// 导出股票\r\nexport class Stock {\r\n constructor(\r\n public name: string,\r\n public code: string,\r\n ) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo() {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 导出配置\r\nexport const MY_CONFIG = { status: \"success\" } as const;\r\n// 导出信息\r\nexport const getUserInfo = function () {\r\n return \"获得用户信息\";\r\n};\r\n/**\r\n * 导出股票信息\r\n * @param name\r\n */\r\nexport const getStockInfo = (name: string) => {\r\n return `xxxxx${name}`;\r\n};\r\n// 导出行情\r\nexport class MarketQuote {\r\n name: string;\r\n code: string;\r\n constructor(name: string, code: string) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo(): string {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n","/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n"],"names":["status","name","code","constructor","this","getInfo","s4","Math","random","toString","substring","len","radix","CHARS","split","i","uuid","length","r","join","console","log"],"mappings":";;;;;+BAqCyB,CAAEA,OAAQ,qCAcjCC,KACAC,KACA,WAAAC,CAAYF,EAAcC,GACxBE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC,uBAjCSD,KACAC,KAFT,WAAAC,CACSF,EACAC,GADAE,KAAAH,KAAAA,EACAG,KAAAF,KAAAA,EAEPE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC,8BCEA,MAAMI,EAAK,WACT,OAA+B,OAArB,EAAIC,KAAKC,UAAuB,GAAGC,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOJ,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,uBDM6BL,GACpB,QAAQA,6BCvCOU,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKN,KAAKC,SAAWI,OAC1D,CACL,IAAIM,EAGJ,IAFAF,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRG,EAAI,EAAqB,GAAhBX,KAAKC,SACdQ,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJG,EAAW,EAAMA,GAGnD,CACA,OAAOF,EAAKG,KAAK,GACnB,sBDY2B,WACzB,MAAO,QACT,qCAvCEC,QAAQC,IAAI,oCACd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -46,11 +46,47 @@ function getGUID() {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// 测试加载成功方法
|
|
49
|
-
function
|
|
49
|
+
function loadedTestUtils() {
|
|
50
50
|
console.log("Nice, iUtils loaded successfully!");
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
// 导出股票
|
|
53
|
+
class Stock {
|
|
54
|
+
name;
|
|
55
|
+
code;
|
|
56
|
+
constructor(name, code) {
|
|
57
|
+
this.name = name;
|
|
58
|
+
this.code = code;
|
|
59
|
+
this.name = name;
|
|
60
|
+
this.code = code;
|
|
61
|
+
}
|
|
62
|
+
getInfo() {
|
|
63
|
+
return `hello,${this.name}${this.code}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 导出配置
|
|
67
|
+
const MY_CONFIG = { status: "success" };
|
|
68
|
+
// 导出信息
|
|
69
|
+
const getUserInfo = function () {
|
|
70
|
+
return "获得用户信息";
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 导出股票信息
|
|
74
|
+
* @param name
|
|
75
|
+
*/
|
|
76
|
+
const getStockInfo = (name) => {
|
|
77
|
+
return `xxxxx${name}`;
|
|
78
|
+
};
|
|
79
|
+
// 导出行情
|
|
80
|
+
class MarketQuote {
|
|
81
|
+
name;
|
|
82
|
+
code;
|
|
83
|
+
constructor(name, code) {
|
|
84
|
+
this.name = name;
|
|
85
|
+
this.code = code;
|
|
86
|
+
}
|
|
87
|
+
getInfo() {
|
|
88
|
+
return `hello,${this.name}${this.code}`;
|
|
89
|
+
}
|
|
54
90
|
}
|
|
55
91
|
|
|
56
|
-
export { getGUID, getUUID,
|
|
92
|
+
export { MY_CONFIG, MarketQuote, Stock, getGUID, getStockInfo, getUUID, getUserInfo, loadedTestUtils };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
function
|
|
6
|
+
function t(t=32,n=16){const e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let o,s=[];if(n=n||e.length,t)for(o=0;o<t;o++)s[o]=e[0|Math.random()*n];else{let t;for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",o=0;o<36;o++)s[o]||(t=0|16*Math.random(),s[o]=e[19===o?3&t|8:t])}return s.join("")}function n(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function e(){console.log("Nice, iUtils loaded successfully!")}class o{name;code;constructor(t,n){this.name=t,this.code=n,this.name=t,this.code=n}getInfo(){return`hello,${this.name}${this.code}`}}const s={status:"success"},c=function(){return"获得用户信息"},r=t=>`xxxxx${t}`;class i{name;code;constructor(t,n){this.name=t,this.code=n}getInfo(){return`hello,${this.name}${this.code}`}}export{s as MY_CONFIG,i as MarketQuote,o as Stock,n as getGUID,r as getStockInfo,t as getUUID,c as getUserInfo,e as loadedTestUtils};
|
|
7
7
|
//# sourceMappingURL=index.full.esm.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.full.esm.min.js","sources":["../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts","../../src/file:/D:/webWorks/i-utils/src/index.ts"],"sourcesContent":["/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n","// 测试加载成功方法\r\nexport function
|
|
1
|
+
{"version":3,"file":"index.full.esm.min.js","sources":["../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts","../../src/file:/D:/webWorks/i-utils/src/index.ts"],"sourcesContent":["/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n","// 测试加载成功方法\r\nexport function loadedTestUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n// 股票基础类型\r\nexport type BaseStock = { name: string; code: string };\r\n// 股票高级类型\r\nexport type HighStock = BaseStock & { chgPrice: number; chgPct: number };\r\n\r\nexport declare enum StockStatus {\r\n Idle,\r\n Loading,\r\n Done,\r\n}\r\nexport declare const doMain: () => void;\r\nexport declare class MyClass {}\r\n\r\n// 股票行情\r\nexport interface StockQuote {\r\n name: string;\r\n code: string;\r\n chgPct: number;\r\n}\r\n// 导出股票\r\nexport class Stock {\r\n constructor(\r\n public name: string,\r\n public code: string,\r\n ) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo() {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 导出配置\r\nexport const MY_CONFIG = { status: \"success\" } as const;\r\n// 导出信息\r\nexport const getUserInfo = function () {\r\n return \"获得用户信息\";\r\n};\r\n/**\r\n * 导出股票信息\r\n * @param name\r\n */\r\nexport const getStockInfo = (name: string) => {\r\n return `xxxxx${name}`;\r\n};\r\n// 导出行情\r\nexport class MarketQuote {\r\n name: string;\r\n code: string;\r\n constructor(name: string, code: string) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo(): string {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n"],"names":["getUUID","len","radix","CHARS","split","i","uuid","length","Math","random","r","join","getGUID","s4","toString","substring","loadedTestUtils","console","log","Stock","name","code","constructor","this","getInfo","MY_CONFIG","status","getUserInfo","getStockInfo","MarketQuote"],"mappings":";;;;;SAQgBA,EAAQC,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKK,KAAKC,SAAWP,OAC1D,CACL,IAAIQ,EAGJ,IAFAJ,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRK,EAAI,EAAqB,GAAhBF,KAAKC,SACdH,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJK,EAAW,EAAMA,GAGnD,CACA,OAAOJ,EAAKK,KAAK,GACnB,UAQgBC,IACd,MAAMC,EAAK,WACT,OAA+B,OAArB,EAAIL,KAAKC,UAAuB,GAAGK,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOF,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,UCvCgBG,IACdC,QAAQC,IAAI,oCACd,OAqBaC,EAEFC,KACAC,KAFT,WAAAC,CACSF,EACAC,GADAE,KAAAH,KAAAA,EACAG,KAAAF,KAAAA,EAEPE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC,QAGWI,EAAY,CAAEC,OAAQ,WAEtBC,EAAc,WACzB,MAAO,QACT,EAKaC,EAAgBR,GACpB,QAAQA,UAGJS,EACXT,KACAC,KACA,WAAAC,CAAYF,EAAcC,GACxBE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -52,16 +52,56 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// 测试加载成功方法
|
|
55
|
-
function
|
|
55
|
+
function loadedTestUtils() {
|
|
56
56
|
console.log("Nice, iUtils loaded successfully!");
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// 导出股票
|
|
59
|
+
class Stock {
|
|
60
|
+
name;
|
|
61
|
+
code;
|
|
62
|
+
constructor(name, code) {
|
|
63
|
+
this.name = name;
|
|
64
|
+
this.code = code;
|
|
65
|
+
this.name = name;
|
|
66
|
+
this.code = code;
|
|
67
|
+
}
|
|
68
|
+
getInfo() {
|
|
69
|
+
return `hello,${this.name}${this.code}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// 导出配置
|
|
73
|
+
const MY_CONFIG = { status: "success" };
|
|
74
|
+
// 导出信息
|
|
75
|
+
const getUserInfo = function () {
|
|
76
|
+
return "获得用户信息";
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 导出股票信息
|
|
80
|
+
* @param name
|
|
81
|
+
*/
|
|
82
|
+
const getStockInfo = (name) => {
|
|
83
|
+
return `xxxxx${name}`;
|
|
84
|
+
};
|
|
85
|
+
// 导出行情
|
|
86
|
+
class MarketQuote {
|
|
87
|
+
name;
|
|
88
|
+
code;
|
|
89
|
+
constructor(name, code) {
|
|
90
|
+
this.name = name;
|
|
91
|
+
this.code = code;
|
|
92
|
+
}
|
|
93
|
+
getInfo() {
|
|
94
|
+
return `hello,${this.name}${this.code}`;
|
|
95
|
+
}
|
|
60
96
|
}
|
|
61
97
|
|
|
98
|
+
exports.MY_CONFIG = MY_CONFIG;
|
|
99
|
+
exports.MarketQuote = MarketQuote;
|
|
100
|
+
exports.Stock = Stock;
|
|
62
101
|
exports.getGUID = getGUID;
|
|
102
|
+
exports.getStockInfo = getStockInfo;
|
|
63
103
|
exports.getUUID = getUUID;
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
104
|
+
exports.getUserInfo = getUserInfo;
|
|
105
|
+
exports.loadedTestUtils = loadedTestUtils;
|
|
66
106
|
|
|
67
107
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @ivujs/i-utils v1.1.
|
|
2
|
+
* @ivujs/i-utils v1.1.9
|
|
3
3
|
* Copyright 2021-2026, <gao911222@163.com>
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(e
|
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).iUtils={})}(this,(function(t){"use strict";t.MY_CONFIG={status:"success"},t.MarketQuote=class{name;code;constructor(t,e){this.name=t,this.code=e}getInfo(){return`hello,${this.name}${this.code}`}},t.Stock=class{name;code;constructor(t,e){this.name=t,this.code=e,this.name=t,this.code=e}getInfo(){return`hello,${this.name}${this.code}`}},t.getGUID=function(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},t.getStockInfo=t=>`xxxxx${t}`,t.getUUID=function(t=32,e=16){const o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");let n,s=[];if(e=e||o.length,t)for(n=0;n<t;n++)s[n]=o[0|Math.random()*e];else{let t;for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",n=0;n<36;n++)s[n]||(t=0|16*Math.random(),s[n]=o[19===n?3&t|8:t])}return s.join("")},t.getUserInfo=function(){return"获得用户信息"},t.loadedTestUtils=function(){console.log("Nice, iUtils loaded successfully!")}}));
|
|
7
7
|
//# sourceMappingURL=index.full.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.full.umd.min.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.full.umd.min.js","sources":["../../src/file:/D:/webWorks/i-utils/src/index.ts","../../src/id/file:/D:/webWorks/i-utils/src/id/index.ts"],"sourcesContent":["// 测试加载成功方法\r\nexport function loadedTestUtils(): void {\r\n console.log(\"Nice, iUtils loaded successfully!\");\r\n}\r\n// 股票基础类型\r\nexport type BaseStock = { name: string; code: string };\r\n// 股票高级类型\r\nexport type HighStock = BaseStock & { chgPrice: number; chgPct: number };\r\n\r\nexport declare enum StockStatus {\r\n Idle,\r\n Loading,\r\n Done,\r\n}\r\nexport declare const doMain: () => void;\r\nexport declare class MyClass {}\r\n\r\n// 股票行情\r\nexport interface StockQuote {\r\n name: string;\r\n code: string;\r\n chgPct: number;\r\n}\r\n// 导出股票\r\nexport class Stock {\r\n constructor(\r\n public name: string,\r\n public code: string,\r\n ) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo() {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 导出配置\r\nexport const MY_CONFIG = { status: \"success\" } as const;\r\n// 导出信息\r\nexport const getUserInfo = function () {\r\n return \"获得用户信息\";\r\n};\r\n/**\r\n * 导出股票信息\r\n * @param name\r\n */\r\nexport const getStockInfo = (name: string) => {\r\n return `xxxxx${name}`;\r\n};\r\n// 导出行情\r\nexport class MarketQuote {\r\n name: string;\r\n code: string;\r\n constructor(name: string, code: string) {\r\n this.name = name;\r\n this.code = code;\r\n }\r\n getInfo(): string {\r\n return `hello,${this.name}${this.code}`;\r\n }\r\n}\r\n// 生成id\r\nexport * from \"./id/index.ts\";\r\n","/**\r\n * 生成UUID\r\n * @param {Number} len 生成的长度,默认32位\r\n * @param {Number} radix 进制数,默认16进制\r\n * @example\r\n * getUUID() // 输出:0a559343dbbf0e7e6c1de90163e7aa0a\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getUUID(len: number = 32, radix: number = 16): string {\r\n const CHARS = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\r\n let uuid = [],\r\n i;\r\n radix = radix || CHARS.length;\r\n if (len) {\r\n for (i = 0; i < len; i++) uuid[i] = CHARS[0 | (Math.random() * radix)];\r\n } else {\r\n let r;\r\n uuid[8] = uuid[13] = uuid[18] = uuid[23] = \"-\";\r\n uuid[14] = \"4\";\r\n for (i = 0; i < 36; i++) {\r\n if (!uuid[i]) {\r\n r = 0 | (Math.random() * 16);\r\n uuid[i] = CHARS[i === 19 ? (r & 0x3) | 0x8 : r];\r\n }\r\n }\r\n }\r\n return uuid.join(\"\");\r\n}\r\n\r\n/**\r\n * 生成GUID\r\n * @example\r\n * getGUID() // 输出:275ec770-0853-6767-4875-7b270220ce9c\r\n * @returns {String} 返回字符串\r\n */\r\nexport function getGUID(): string {\r\n const s4 = function () {\r\n return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n };\r\n return s4() + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + \"-\" + s4() + s4() + s4();\r\n}\r\n"],"names":["status","name","code","constructor","this","getInfo","s4","Math","random","toString","substring","len","radix","CHARS","split","i","uuid","length","r","join","console","log"],"mappings":";;;;;0PAqCyB,CAAEA,OAAQ,+BAcjCC,KACAC,KACA,WAAAC,CAAYF,EAAcC,GACxBE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC,iBAjCSD,KACAC,KAFT,WAAAC,CACSF,EACAC,GADAE,KAAAH,KAAAA,EACAG,KAAAF,KAAAA,EAEPE,KAAKH,KAAOA,EACZG,KAAKF,KAAOA,CACd,CACA,OAAAG,GACE,MAAO,SAASD,KAAKH,OAAOG,KAAKF,MACnC,wBCEA,MAAMI,EAAK,WACT,OAA+B,OAArB,EAAIC,KAAKC,UAAuB,GAAGC,SAAS,IAAIC,UAAU,EACtE,EACA,OAAOJ,IAAOA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAO,IAAMA,IAAOA,IAAOA,GAClF,iBDM6BL,GACpB,QAAQA,uBCvCOU,EAAc,GAAIC,EAAgB,IACxD,MAAMC,EAAQ,iEAAiEC,MAAM,IACrF,IACEC,EADEC,EAAO,GAGX,GADAJ,EAAQA,GAASC,EAAMI,OACnBN,EACF,IAAKI,EAAI,EAAGA,EAAIJ,EAAKI,IAAKC,EAAKD,GAAKF,EAAM,EAAKN,KAAKC,SAAWI,OAC1D,CACL,IAAIM,EAGJ,IAFAF,EAAK,GAAKA,EAAK,IAAMA,EAAK,IAAMA,EAAK,IAAM,IAC3CA,EAAK,IAAM,IACND,EAAI,EAAGA,EAAI,GAAIA,IACbC,EAAKD,KACRG,EAAI,EAAqB,GAAhBX,KAAKC,SACdQ,EAAKD,GAAKF,EAAY,KAANE,EAAgB,EAAJG,EAAW,EAAMA,GAGnD,CACA,OAAOF,EAAKG,KAAK,GACnB,gBDY2B,WACzB,MAAO,QACT,+BAvCEC,QAAQC,IAAI,oCACd"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var resolverJson = require('./index.json');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 提供自动导入插件的解析器
|
|
7
|
+
* @param options 配置项,支持3种传参方式
|
|
8
|
+
* @returns unplugin-auto-import 解析器
|
|
9
|
+
* @example
|
|
10
|
+
* // 场景1:默认加载所有方法
|
|
11
|
+
* IUtilsResolver()
|
|
12
|
+
*
|
|
13
|
+
* // 场景2:追加指定方法名
|
|
14
|
+
* IUtilsResolver(["getDate"])
|
|
15
|
+
*
|
|
16
|
+
* // 场景3:精细化控制(排除/只包含/追加)
|
|
17
|
+
* IUtilsResolver({
|
|
18
|
+
* include: ["getUUID", "getGUID"],
|
|
19
|
+
* exclude: ["loadTest"],
|
|
20
|
+
* append: ["formatDate"]
|
|
21
|
+
* })
|
|
22
|
+
*/
|
|
23
|
+
function IUtilsResolver(options) {
|
|
24
|
+
// 读取默认配置
|
|
25
|
+
const defaultApis = resolverJson.apis || [];
|
|
26
|
+
// api配置
|
|
27
|
+
let finalApis = [...defaultApis];
|
|
28
|
+
// 参数为数组
|
|
29
|
+
if (Array.isArray(options)) {
|
|
30
|
+
finalApis = [...new Set([...defaultApis, ...options])];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (options && typeof options === "object") {
|
|
34
|
+
// 获得传入解析器的配置参数
|
|
35
|
+
const { include = [], exclude = [], append = [] } = options;
|
|
36
|
+
// 第一步:处理只包含
|
|
37
|
+
if (include.length > 0) {
|
|
38
|
+
finalApis = defaultApis.filter((name) => include.includes(name));
|
|
39
|
+
}
|
|
40
|
+
// 第二步:处理排除
|
|
41
|
+
if (exclude.length > 0) {
|
|
42
|
+
finalApis = finalApis.filter((name) => !exclude.includes(name));
|
|
43
|
+
}
|
|
44
|
+
// 第三步:处理追加
|
|
45
|
+
if (append.length > 0) {
|
|
46
|
+
finalApis = [...new Set([...finalApis, ...append])];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// 返回解析器
|
|
51
|
+
return (name) => {
|
|
52
|
+
if (finalApis.includes(name)) {
|
|
53
|
+
return {
|
|
54
|
+
name,
|
|
55
|
+
from: resolverJson.from,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.IUtilsResolver = IUtilsResolver;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Resolver } from "unplugin-auto-import/types";
|
|
2
|
+
/**
|
|
3
|
+
* 解析器类型
|
|
4
|
+
*/
|
|
5
|
+
export type IUtilsResolverOptions = undefined | string[] | {
|
|
6
|
+
exclude?: string[];
|
|
7
|
+
include?: string[];
|
|
8
|
+
append?: string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 提供自动导入插件的解析器
|
|
12
|
+
* @param options 配置项,支持3种传参方式
|
|
13
|
+
* @returns unplugin-auto-import 解析器
|
|
14
|
+
* @example
|
|
15
|
+
* // 场景1:默认加载所有方法
|
|
16
|
+
* IUtilsResolver()
|
|
17
|
+
*
|
|
18
|
+
* // 场景2:追加指定方法名
|
|
19
|
+
* IUtilsResolver(["getDate"])
|
|
20
|
+
*
|
|
21
|
+
* // 场景3:精细化控制(排除/只包含/追加)
|
|
22
|
+
* IUtilsResolver({
|
|
23
|
+
* include: ["getUUID", "getGUID"],
|
|
24
|
+
* exclude: ["loadTest"],
|
|
25
|
+
* append: ["formatDate"]
|
|
26
|
+
* })
|
|
27
|
+
*/
|
|
28
|
+
export declare function IUtilsResolver(options: IUtilsResolverOptions): Resolver;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"from": "@ivujs/i-utils",
|
|
3
|
+
"apis": [
|
|
4
|
+
"getUUID",
|
|
5
|
+
"getGUID",
|
|
6
|
+
"loadedTestUtils",
|
|
7
|
+
"MyClass",
|
|
8
|
+
"Stock",
|
|
9
|
+
"MarketQuote",
|
|
10
|
+
"doMain",
|
|
11
|
+
"MY_CONFIG",
|
|
12
|
+
"getUserInfo",
|
|
13
|
+
"getStockInfo"
|
|
14
|
+
],
|
|
15
|
+
"types": [
|
|
16
|
+
"BaseStock",
|
|
17
|
+
"HighStock",
|
|
18
|
+
"StockQuote"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import resolverJson from './index.json';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 提供自动导入插件的解析器
|
|
5
|
+
* @param options 配置项,支持3种传参方式
|
|
6
|
+
* @returns unplugin-auto-import 解析器
|
|
7
|
+
* @example
|
|
8
|
+
* // 场景1:默认加载所有方法
|
|
9
|
+
* IUtilsResolver()
|
|
10
|
+
*
|
|
11
|
+
* // 场景2:追加指定方法名
|
|
12
|
+
* IUtilsResolver(["getDate"])
|
|
13
|
+
*
|
|
14
|
+
* // 场景3:精细化控制(排除/只包含/追加)
|
|
15
|
+
* IUtilsResolver({
|
|
16
|
+
* include: ["getUUID", "getGUID"],
|
|
17
|
+
* exclude: ["loadTest"],
|
|
18
|
+
* append: ["formatDate"]
|
|
19
|
+
* })
|
|
20
|
+
*/
|
|
21
|
+
function IUtilsResolver(options) {
|
|
22
|
+
// 读取默认配置
|
|
23
|
+
const defaultApis = resolverJson.apis || [];
|
|
24
|
+
// api配置
|
|
25
|
+
let finalApis = [...defaultApis];
|
|
26
|
+
// 参数为数组
|
|
27
|
+
if (Array.isArray(options)) {
|
|
28
|
+
finalApis = [...new Set([...defaultApis, ...options])];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (options && typeof options === "object") {
|
|
32
|
+
// 获得传入解析器的配置参数
|
|
33
|
+
const { include = [], exclude = [], append = [] } = options;
|
|
34
|
+
// 第一步:处理只包含
|
|
35
|
+
if (include.length > 0) {
|
|
36
|
+
finalApis = defaultApis.filter((name) => include.includes(name));
|
|
37
|
+
}
|
|
38
|
+
// 第二步:处理排除
|
|
39
|
+
if (exclude.length > 0) {
|
|
40
|
+
finalApis = finalApis.filter((name) => !exclude.includes(name));
|
|
41
|
+
}
|
|
42
|
+
// 第三步:处理追加
|
|
43
|
+
if (append.length > 0) {
|
|
44
|
+
finalApis = [...new Set([...finalApis, ...append])];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// 返回解析器
|
|
49
|
+
return (name) => {
|
|
50
|
+
if (finalApis.includes(name)) {
|
|
51
|
+
return {
|
|
52
|
+
name,
|
|
53
|
+
from: resolverJson.from,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { IUtilsResolver };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivujs/i-utils",
|
|
3
3
|
"moduleName": "iUtils",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "前端模块化 JavaScript 工具库",
|
|
7
7
|
"author": "<gao911222@163.com>",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"import": "./dist/es/index.mjs",
|
|
24
24
|
"require": "./dist/cjs/index.cjs"
|
|
25
25
|
},
|
|
26
|
-
"./
|
|
27
|
-
"types": "./dist/
|
|
28
|
-
"import": "./dist/
|
|
29
|
-
"require": "./dist/
|
|
26
|
+
"./resolver": {
|
|
27
|
+
"types": "./dist/resolver/index.d.ts",
|
|
28
|
+
"import": "./dist/resolver/index.mjs",
|
|
29
|
+
"require": "./dist/resolver/index.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./es": {
|
|
32
32
|
"types": "./dist/es/index.d.ts",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"dev": "vite",
|
|
47
47
|
"build": "tsx ./build/build.ts"
|
|
48
48
|
},
|
|
49
|
-
"dependencies": {},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@eslint/js": "^9.39.2",
|
|
52
51
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
@@ -58,19 +57,18 @@
|
|
|
58
57
|
"eslint": "^9.39.2",
|
|
59
58
|
"eslint-config-prettier": "^10.1.8",
|
|
60
59
|
"eslint-plugin-prettier": "^5.5.5",
|
|
60
|
+
"typescript-eslint": "^8.53.0",
|
|
61
61
|
"execa": "^9.6.1",
|
|
62
62
|
"globals": "^17.0.0",
|
|
63
63
|
"prettier": "^3.8.0",
|
|
64
64
|
"rimraf": "^6.1.2",
|
|
65
65
|
"rollup": "^4.55.1",
|
|
66
66
|
"rollup-plugin-dts": "^6.3.0",
|
|
67
|
-
"
|
|
67
|
+
"ts-morph": "^27.0.2",
|
|
68
68
|
"tsx": "^4.21.0",
|
|
69
69
|
"typescript": "^5.9.3",
|
|
70
|
-
"
|
|
71
|
-
"vite": "^7.3.1"
|
|
72
|
-
"vite-plugin-dts": "^4.5.4",
|
|
73
|
-
"unplugin-auto-import": "^21.0.0"
|
|
70
|
+
"unplugin-auto-import": "^21.0.0",
|
|
71
|
+
"vite": "^7.3.1"
|
|
74
72
|
},
|
|
75
73
|
"keywords": [
|
|
76
74
|
"i-utils",
|
package/dist/resolvers.d.ts
DELETED
package/dist/resolves.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function IUtilsResolver(options = {}) {
|
|
4
|
-
const api = ["getUUID", "getGUID", "loadTest"];
|
|
5
|
-
return (name) => {
|
|
6
|
-
if (api.includes(name)) {
|
|
7
|
-
return {
|
|
8
|
-
name,
|
|
9
|
-
from: "@ivujs/i-utils",
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports.IUtilsResolver = IUtilsResolver;
|
package/dist/resolves.mjs
DELETED