@fangzhongya/utils 0.0.73 → 0.0.75
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/basic/index.cjs +6 -5
- package/dist/basic/index.d.cts +2 -1
- package/dist/basic/index.d.ts +2 -1
- package/dist/basic/index.js +5 -4
- package/dist/basic/string/getExports.cjs +12 -0
- package/dist/basic/string/getExports.d.cts +16 -0
- package/dist/basic/string/getExports.d.ts +16 -0
- package/dist/basic/string/getExports.js +12 -0
- package/dist/basic/string/index.cjs +11 -3
- package/dist/basic/string/index.d.cts +1 -0
- package/dist/basic/string/index.d.ts +1 -0
- package/dist/basic/string/index.js +10 -2
- package/dist/basic/string/toFunctionParam.cjs +2 -2
- package/dist/basic/string/toFunctionParam.d.cts +7 -4
- package/dist/basic/string/toFunctionParam.d.ts +7 -4
- package/dist/basic/string/toFunctionParam.js +1 -1
- package/dist/{chunk-IBSTABZR.cjs → chunk-2IDKKVEA.cjs} +2 -2
- package/dist/chunk-4KYAGDPN.js +150 -0
- package/dist/chunk-ASGZ2VD6.cjs +150 -0
- package/dist/{chunk-ZZKR5C3Y.cjs → chunk-BWXXXTFU.cjs} +87 -22
- package/dist/{chunk-5CHESUXV.js → chunk-CY2RRXP5.js} +9 -1
- package/dist/{chunk-OCYQMNHW.cjs → chunk-G6O3Z6MX.cjs} +11 -3
- package/dist/{chunk-BQZX7DEK.js → chunk-NGZ6KFQR.js} +1 -1
- package/dist/{chunk-SE2X5XKO.js → chunk-U6V3V5KH.js} +87 -22
- package/dist/css/index.cjs +13 -13
- package/dist/css/index.js +18 -18
- package/dist/date/index.cjs +4 -4
- package/dist/date/index.js +4 -4
- package/dist/{index-CGsG3tMc.d.ts → index-BKbw-_J6.d.ts} +1 -1
- package/dist/{index-CRh3wZkY.d.ts → index-BkNPwlhS.d.ts} +5 -1
- package/dist/{index-BMhmeVcw.d.cts → index-C1ttB6pd.d.cts} +1 -1
- package/dist/{index-BmGaGt2M.d.cts → index-JauNNBr7.d.cts} +5 -1
- package/dist/index.cjs +40 -39
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +40 -39
- package/dist/urls/index.cjs +13 -13
- package/dist/urls/index.js +16 -16
- package/dist/window/index.cjs +5 -5
- package/dist/window/index.js +14 -14
- package/package.json +6 -1
- package/dist/{chunk-Y3UJ5NPB.js → chunk-2AZDXCHJ.js} +13 -13
- package/dist/{chunk-UJBXAZW7.cjs → chunk-2KAMKGPZ.cjs} +11 -11
- package/dist/{chunk-UIVSKRGG.js → chunk-3DUFQKFF.js} +15 -15
- package/dist/{chunk-7NEXCOZZ.cjs → chunk-5SOPYS7L.cjs} +3 -3
- package/dist/{chunk-AU3BKC3U.cjs → chunk-7GCUYESU.cjs} +12 -12
- package/dist/{chunk-JPQN3LUH.js → chunk-H22VVRP6.js} +3 -3
- package/dist/{chunk-P2M6G3BJ.cjs → chunk-MDSCUXDF.cjs} +4 -4
- package/dist/{chunk-2LB4NKNM.js → chunk-QM6EWX7J.js} +16 -16
package/dist/basic/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-2IDKKVEA.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
4
|
+
var _chunkG6O3Z6MXcjs = require('../chunk-G6O3Z6MX.cjs');
|
|
5
|
+
require('../chunk-BWXXXTFU.cjs');
|
|
6
6
|
require('../chunk-K2XKKEE7.cjs');
|
|
7
7
|
require('../chunk-TKE7IK2M.cjs');
|
|
8
8
|
require('../chunk-HLKHFBMF.cjs');
|
|
9
9
|
require('../chunk-JJ37YIPJ.cjs');
|
|
10
10
|
require('../chunk-4PUYFFPO.cjs');
|
|
11
|
+
require('../chunk-ASGZ2VD6.cjs');
|
|
11
12
|
require('../chunk-HWHYHL6J.cjs');
|
|
12
13
|
require('../chunk-J7S3KBHL.cjs');
|
|
13
14
|
require('../chunk-L7FSHU27.cjs');
|
|
@@ -40,9 +41,9 @@ require('../chunk-ILJLXJ5O.cjs');
|
|
|
40
41
|
require('../chunk-OJBZ7UUC.cjs');
|
|
41
42
|
require('../chunk-JR6ZN6QD.cjs');
|
|
42
43
|
require('../chunk-PW7RP73J.cjs');
|
|
44
|
+
require('../chunk-XW3XIK3D.cjs');
|
|
43
45
|
require('../chunk-UEVMS6QD.cjs');
|
|
44
46
|
require('../chunk-OQL4GIEJ.cjs');
|
|
45
|
-
require('../chunk-XW3XIK3D.cjs');
|
|
46
47
|
require('../chunk-WWAPPA4E.cjs');
|
|
47
48
|
require('../chunk-A5LHXE5X.cjs');
|
|
48
49
|
require('../chunk-MIC3W2VY.cjs');
|
|
@@ -52,4 +53,4 @@ require('../chunk-75ZPJI57.cjs');
|
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
exports.array = _chunk65O7KWP4cjs.array_exports; exports.object = _chunkYUKBGZQ4cjs.object_exports; exports.string =
|
|
56
|
+
exports.array = _chunk65O7KWP4cjs.array_exports; exports.object = _chunkYUKBGZQ4cjs.object_exports; exports.string = _chunkG6O3Z6MXcjs.string_exports;
|
package/dist/basic/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { i as array } from '../index-D8_Udh46.cjs';
|
|
2
2
|
export { i as object } from '../index-Cz8fWd5l.cjs';
|
|
3
|
-
export { i as string } from '../index-
|
|
3
|
+
export { i as string } from '../index-JauNNBr7.cjs';
|
|
4
4
|
import './array/asyncMergeArray.cjs';
|
|
5
5
|
import './array/compareArray.cjs';
|
|
6
6
|
import './array/deleteArray.cjs';
|
|
@@ -29,6 +29,7 @@ import './string/deComment.cjs';
|
|
|
29
29
|
import './string/firstLower.cjs';
|
|
30
30
|
import './string/firstUpper.cjs';
|
|
31
31
|
import './string/getContent.cjs';
|
|
32
|
+
import './string/getExports.cjs';
|
|
32
33
|
import './string/getImports.cjs';
|
|
33
34
|
import './string/getStartSame.cjs';
|
|
34
35
|
import './string/getStartSames.cjs';
|
package/dist/basic/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { i as array } from '../index-BYfEDFkm.js';
|
|
2
2
|
export { i as object } from '../index-oW2flHUo.js';
|
|
3
|
-
export { i as string } from '../index-
|
|
3
|
+
export { i as string } from '../index-BkNPwlhS.js';
|
|
4
4
|
import './array/asyncMergeArray.js';
|
|
5
5
|
import './array/compareArray.js';
|
|
6
6
|
import './array/deleteArray.js';
|
|
@@ -29,6 +29,7 @@ import './string/deComment.js';
|
|
|
29
29
|
import './string/firstLower.js';
|
|
30
30
|
import './string/firstUpper.js';
|
|
31
31
|
import './string/getContent.js';
|
|
32
|
+
import './string/getExports.js';
|
|
32
33
|
import './string/getImports.js';
|
|
33
34
|
import './string/getStartSame.js';
|
|
34
35
|
import './string/getStartSames.js';
|
package/dist/basic/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-NGZ6KFQR.js";
|
|
2
2
|
import {
|
|
3
3
|
string_exports
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-CY2RRXP5.js";
|
|
5
|
+
import "../chunk-U6V3V5KH.js";
|
|
6
6
|
import "../chunk-TIZFQBWC.js";
|
|
7
7
|
import "../chunk-ZADO6V3Z.js";
|
|
8
8
|
import "../chunk-ADPTUJSF.js";
|
|
9
9
|
import "../chunk-Q6BNW3MO.js";
|
|
10
10
|
import "../chunk-YKSVLAAK.js";
|
|
11
|
+
import "../chunk-4KYAGDPN.js";
|
|
11
12
|
import "../chunk-N5Y3XGHX.js";
|
|
12
13
|
import "../chunk-7DTHADVK.js";
|
|
13
14
|
import "../chunk-VKE5JARB.js";
|
|
@@ -40,9 +41,9 @@ import "../chunk-P7AWHISY.js";
|
|
|
40
41
|
import "../chunk-LPMR5W6M.js";
|
|
41
42
|
import "../chunk-DMZP4RPN.js";
|
|
42
43
|
import "../chunk-A276ZDLP.js";
|
|
44
|
+
import "../chunk-O34QAOO7.js";
|
|
43
45
|
import "../chunk-4OBNLDTJ.js";
|
|
44
46
|
import "../chunk-EWJJKQIO.js";
|
|
45
|
-
import "../chunk-O34QAOO7.js";
|
|
46
47
|
import "../chunk-BEKTNBRJ.js";
|
|
47
48
|
import "../chunk-GYE23WAN.js";
|
|
48
49
|
import "../chunk-MXY4W3K5.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkASGZ2VD6cjs = require('../../chunk-ASGZ2VD6.cjs');
|
|
6
|
+
require('../../chunk-XWCRGY54.cjs');
|
|
7
|
+
require('../../chunk-75ZPJI57.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.getExports = _chunkASGZ2VD6cjs.getExports; exports.getExportsExtended = _chunkASGZ2VD6cjs.getExportsExtended; exports.getExportsStrict = _chunkASGZ2VD6cjs.getExportsStrict;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ExtractedExports {
|
|
2
|
+
named: string[];
|
|
3
|
+
default: string | null;
|
|
4
|
+
}
|
|
5
|
+
declare function getExports(code: string): ExtractedExports;
|
|
6
|
+
interface ExtendedExports extends ExtractedExports {
|
|
7
|
+
starExports: string[];
|
|
8
|
+
reExports: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
source: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
declare function getExportsExtended(code: string): ExtendedExports;
|
|
14
|
+
declare function getExportsStrict(code: string): ExtractedExports;
|
|
15
|
+
|
|
16
|
+
export { getExports, getExportsExtended, getExportsStrict };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ExtractedExports {
|
|
2
|
+
named: string[];
|
|
3
|
+
default: string | null;
|
|
4
|
+
}
|
|
5
|
+
declare function getExports(code: string): ExtractedExports;
|
|
6
|
+
interface ExtendedExports extends ExtractedExports {
|
|
7
|
+
starExports: string[];
|
|
8
|
+
reExports: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
source: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
declare function getExportsExtended(code: string): ExtendedExports;
|
|
14
|
+
declare function getExportsStrict(code: string): ExtractedExports;
|
|
15
|
+
|
|
16
|
+
export { getExports, getExportsExtended, getExportsStrict };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-G6O3Z6MX.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkBWXXXTFUcjs = require('../../chunk-BWXXXTFU.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -28,6 +28,11 @@ var _chunk4PUYFFPOcjs = require('../../chunk-4PUYFFPO.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
|
|
32
|
+
var _chunkASGZ2VD6cjs = require('../../chunk-ASGZ2VD6.cjs');
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
31
36
|
var _chunkHWHYHL6Jcjs = require('../../chunk-HWHYHL6J.cjs');
|
|
32
37
|
|
|
33
38
|
|
|
@@ -88,4 +93,7 @@ require('../../chunk-75ZPJI57.cjs');
|
|
|
88
93
|
|
|
89
94
|
|
|
90
95
|
|
|
91
|
-
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
exports.appearNum = _chunkOJBZ7UUCcjs.appearNum; exports.appearNumSeat = _chunkJR6ZN6QDcjs.appearNumSeat; exports.deComment = _chunkXWCRGY54cjs.deComment; exports.extractParams = _chunkJJ37YIPJcjs.extractParams; exports.firstLower = _chunkUEVMS6QDcjs.firstLower; exports.firstUpper = _chunkOQL4GIEJcjs.firstUpper; exports.getContent = _chunk4PUYFFPOcjs.getContent; exports.getContents = _chunk4PUYFFPOcjs.getContents; exports.getExports = _chunkASGZ2VD6cjs.getExports; exports.getExportsExtended = _chunkASGZ2VD6cjs.getExportsExtended; exports.getExportsStrict = _chunkASGZ2VD6cjs.getExportsStrict; exports.getFunctionFormat = _chunkJJ37YIPJcjs.getFunctionFormat; exports.getImports = _chunkHWHYHL6Jcjs.getImports; exports.getImportss = _chunkHWHYHL6Jcjs.getImportss; exports.getStartSame = _chunkJ7S3KBHLcjs.getStartSame; exports.getStartSames = _chunkPW7RP73Jcjs.getStartSames; exports.getStrNunPosit = _chunk2H3KVSFAcjs.getStrNunPosit; exports.serializeCodeBlock = _chunkTKE7IK2Mcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkTKE7IK2Mcjs.serializeFunctionRef; exports.splitUpper = _chunkL7FSHU27cjs.splitUpper; exports.startsNum = _chunkILJLXJ5Ocjs.startsNum; exports.toFunction = _chunkJJ37YIPJcjs.toFunction; exports.toFunctionParam = _chunkBWXXXTFUcjs.toFunctionParam; exports.toFunctionParamOptions = _chunkBWXXXTFUcjs.toFunctionParamOptions; exports.toJSONParse = _chunkK2XKKEE7cjs.toJSONParse; exports.toJSONSParse = _chunkTKE7IK2Mcjs.toJSONSParse; exports.toJSONSStringify = _chunkTKE7IK2Mcjs.toJSONSStringify; exports.toJSONStringify = _chunkK2XKKEE7cjs.toJSONStringify; exports.toStringParse = _chunkHLKHFBMFcjs.toStringParse;
|
|
@@ -4,6 +4,7 @@ export { deComment } from './deComment.cjs';
|
|
|
4
4
|
export { firstLower } from './firstLower.cjs';
|
|
5
5
|
export { firstUpper } from './firstUpper.cjs';
|
|
6
6
|
export { getContent, getContents } from './getContent.cjs';
|
|
7
|
+
export { getExports, getExportsExtended, getExportsStrict } from './getExports.cjs';
|
|
7
8
|
export { getImports, getImportss } from './getImports.cjs';
|
|
8
9
|
export { getStartSame } from './getStartSame.cjs';
|
|
9
10
|
export { getStartSames } from './getStartSames.cjs';
|
|
@@ -4,6 +4,7 @@ export { deComment } from './deComment.js';
|
|
|
4
4
|
export { firstLower } from './firstLower.js';
|
|
5
5
|
export { firstUpper } from './firstUpper.js';
|
|
6
6
|
export { getContent, getContents } from './getContent.js';
|
|
7
|
+
export { getExports, getExportsExtended, getExportsStrict } from './getExports.js';
|
|
7
8
|
export { getImports, getImportss } from './getImports.js';
|
|
8
9
|
export { getStartSame } from './getStartSame.js';
|
|
9
10
|
export { getStartSames } from './getStartSames.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../../chunk-
|
|
1
|
+
import "../../chunk-CY2RRXP5.js";
|
|
2
2
|
import {
|
|
3
3
|
toFunctionParam,
|
|
4
4
|
toFunctionParamOptions
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-U6V3V5KH.js";
|
|
6
6
|
import {
|
|
7
7
|
toJSONParse,
|
|
8
8
|
toJSONStringify
|
|
@@ -25,6 +25,11 @@ import {
|
|
|
25
25
|
getContent,
|
|
26
26
|
getContents
|
|
27
27
|
} from "../../chunk-YKSVLAAK.js";
|
|
28
|
+
import {
|
|
29
|
+
getExports,
|
|
30
|
+
getExportsExtended,
|
|
31
|
+
getExportsStrict
|
|
32
|
+
} from "../../chunk-4KYAGDPN.js";
|
|
28
33
|
import {
|
|
29
34
|
getImports,
|
|
30
35
|
getImportss
|
|
@@ -70,6 +75,9 @@ export {
|
|
|
70
75
|
firstUpper,
|
|
71
76
|
getContent,
|
|
72
77
|
getContents,
|
|
78
|
+
getExports,
|
|
79
|
+
getExportsExtended,
|
|
80
|
+
getExportsStrict,
|
|
73
81
|
getFunctionFormat,
|
|
74
82
|
getImports,
|
|
75
83
|
getImportss,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkBWXXXTFUcjs = require('../../chunk-BWXXXTFU.cjs');
|
|
5
5
|
require('../../chunk-JJ37YIPJ.cjs');
|
|
6
6
|
require('../../chunk-75ZPJI57.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.toFunctionParam =
|
|
10
|
+
exports.toFunctionParam = _chunkBWXXXTFUcjs.toFunctionParam; exports.toFunctionParamOptions = _chunkBWXXXTFUcjs.toFunctionParamOptions;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
type ObjAny = Record<string, any>;
|
|
2
2
|
/**
|
|
3
|
-
* 优化的toFunctionParam函数 -
|
|
3
|
+
* 优化的toFunctionParam函数 - 修复版本
|
|
4
4
|
*/
|
|
5
|
-
declare function toFunctionParam(str: string | Function, externalParams?: ObjAny): Function | undefined;
|
|
5
|
+
declare function toFunctionParam(str: string | Function, externalParams?: ObjAny | (() => ObjAny)): Function | undefined;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 增强版,支持更多选项(修复版本)
|
|
8
8
|
*/
|
|
9
|
-
declare function toFunctionParamOptions(str: string | Function, externalParams?: ObjAny, options?: {
|
|
9
|
+
declare function toFunctionParamOptions(str: string | Function, externalParams?: ObjAny | (() => ObjAny), options?: {
|
|
10
10
|
useClosure?: boolean;
|
|
11
11
|
strictMode?: boolean;
|
|
12
12
|
context?: ObjAny;
|
|
13
13
|
paramDefaults?: Record<string, any>;
|
|
14
14
|
bindThis?: boolean;
|
|
15
15
|
name?: string;
|
|
16
|
+
autoRebind?: boolean;
|
|
17
|
+
autoFirst?: boolean;
|
|
18
|
+
useProxy?: boolean;
|
|
16
19
|
}): Function | undefined;
|
|
17
20
|
|
|
18
21
|
export { toFunctionParam, toFunctionParamOptions };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
type ObjAny = Record<string, any>;
|
|
2
2
|
/**
|
|
3
|
-
* 优化的toFunctionParam函数 -
|
|
3
|
+
* 优化的toFunctionParam函数 - 修复版本
|
|
4
4
|
*/
|
|
5
|
-
declare function toFunctionParam(str: string | Function, externalParams?: ObjAny): Function | undefined;
|
|
5
|
+
declare function toFunctionParam(str: string | Function, externalParams?: ObjAny | (() => ObjAny)): Function | undefined;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 增强版,支持更多选项(修复版本)
|
|
8
8
|
*/
|
|
9
|
-
declare function toFunctionParamOptions(str: string | Function, externalParams?: ObjAny, options?: {
|
|
9
|
+
declare function toFunctionParamOptions(str: string | Function, externalParams?: ObjAny | (() => ObjAny), options?: {
|
|
10
10
|
useClosure?: boolean;
|
|
11
11
|
strictMode?: boolean;
|
|
12
12
|
context?: ObjAny;
|
|
13
13
|
paramDefaults?: Record<string, any>;
|
|
14
14
|
bindThis?: boolean;
|
|
15
15
|
name?: string;
|
|
16
|
+
autoRebind?: boolean;
|
|
17
|
+
autoFirst?: boolean;
|
|
18
|
+
useProxy?: boolean;
|
|
16
19
|
}): Function | undefined;
|
|
17
20
|
|
|
18
21
|
export { toFunctionParam, toFunctionParamOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkG6O3Z6MXcjs = require('./chunk-G6O3Z6MX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkYUKBGZQ4cjs = require('./chunk-YUKBGZQ4.cjs');
|
|
@@ -16,7 +16,7 @@ var basic_exports = {};
|
|
|
16
16
|
_chunk75ZPJI57cjs.__export.call(void 0, basic_exports, {
|
|
17
17
|
array: () => _chunk65O7KWP4cjs.array_exports,
|
|
18
18
|
object: () => _chunkYUKBGZQ4cjs.object_exports,
|
|
19
|
-
string: () =>
|
|
19
|
+
string: () => _chunkG6O3Z6MXcjs.string_exports
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deComment
|
|
3
|
+
} from "./chunk-FS4JPT23.js";
|
|
4
|
+
|
|
5
|
+
// packages/basic/string/getExports.ts
|
|
6
|
+
var REGEX_PATTERNS = {
|
|
7
|
+
// export const/let/var variableName
|
|
8
|
+
VAR_EXPORT: /export\s+(?:const|let|var)\s+(\w+)/g,
|
|
9
|
+
// export function functionName
|
|
10
|
+
FUNCTION_EXPORT: /export\s+function\s+(\w+)/g,
|
|
11
|
+
// export class ClassName
|
|
12
|
+
CLASS_EXPORT: /export\s+class\s+(\w+)/g,
|
|
13
|
+
// export { a, b as c, d }
|
|
14
|
+
NAMED_EXPORTS: /export\s*\{([^}]+)\}/g,
|
|
15
|
+
// export default identifier
|
|
16
|
+
DEFAULT_EXPORT: /export\s+default\s+(\w+)/,
|
|
17
|
+
// 提取重命名后的名称
|
|
18
|
+
RENAME_SPLIT: /\s+as\s+/
|
|
19
|
+
};
|
|
20
|
+
function getExports(code) {
|
|
21
|
+
code = deComment(code);
|
|
22
|
+
const exports = {
|
|
23
|
+
named: [],
|
|
24
|
+
default: null
|
|
25
|
+
};
|
|
26
|
+
const namedExportsSet = /* @__PURE__ */ new Set();
|
|
27
|
+
const processMatches = (pattern, extractName) => {
|
|
28
|
+
const matches = code.matchAll(pattern);
|
|
29
|
+
for (const match of matches) {
|
|
30
|
+
const name = extractName(match);
|
|
31
|
+
if (name) {
|
|
32
|
+
namedExportsSet.add(name);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
processMatches(REGEX_PATTERNS.VAR_EXPORT, (match) => match[1]);
|
|
37
|
+
processMatches(REGEX_PATTERNS.FUNCTION_EXPORT, (match) => match[1]);
|
|
38
|
+
processMatches(REGEX_PATTERNS.CLASS_EXPORT, (match) => match[1]);
|
|
39
|
+
const namedExportMatches = code.matchAll(REGEX_PATTERNS.NAMED_EXPORTS);
|
|
40
|
+
for (const match of namedExportMatches) {
|
|
41
|
+
const items = match[1];
|
|
42
|
+
if (!items) continue;
|
|
43
|
+
items.split(",").forEach((item) => {
|
|
44
|
+
const trimmed = item.trim();
|
|
45
|
+
if (!trimmed) return;
|
|
46
|
+
const parts = trimmed.split(REGEX_PATTERNS.RENAME_SPLIT);
|
|
47
|
+
const name = parts[parts.length - 1].trim();
|
|
48
|
+
if (name) {
|
|
49
|
+
namedExportsSet.add(name);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const defaultMatch = code.match(REGEX_PATTERNS.DEFAULT_EXPORT);
|
|
54
|
+
if (defaultMatch) {
|
|
55
|
+
exports.default = defaultMatch[1];
|
|
56
|
+
}
|
|
57
|
+
exports.named = Array.from(namedExportsSet).sort();
|
|
58
|
+
return exports;
|
|
59
|
+
}
|
|
60
|
+
function getExportsExtended(code) {
|
|
61
|
+
const exports = {
|
|
62
|
+
named: [],
|
|
63
|
+
default: null,
|
|
64
|
+
starExports: [],
|
|
65
|
+
reExports: []
|
|
66
|
+
};
|
|
67
|
+
const namedExportsSet = /* @__PURE__ */ new Set();
|
|
68
|
+
const EXTENDED_PATTERNS = {
|
|
69
|
+
// export * from 'module'
|
|
70
|
+
STAR_EXPORT: /export\s*\*\s*from\s*(['"])([^'"]+)\1/g,
|
|
71
|
+
// export { name } from 'module'
|
|
72
|
+
RE_EXPORT: /export\s*\{([^}]+)\}\s*from\s*(['"])([^'"]+)\2/g,
|
|
73
|
+
// 匿名默认导出:export default function() {...} 或 export default class {...}
|
|
74
|
+
ANONYMOUS_DEFAULT: /export\s+default\s+(?:function|class|\([^)]*\)\s*=>)/,
|
|
75
|
+
// 默认导出字面量
|
|
76
|
+
DEFAULT_LITERAL: /export\s+default\s+([^{(\s][^\s;{]*)/,
|
|
77
|
+
// 解构导出:export const { a, b } = obj
|
|
78
|
+
DESTRUCTURING_EXPORT: /export\s+(?:const|let|var)\s+\{([^}]+)\}/g
|
|
79
|
+
};
|
|
80
|
+
const basicExports = getExports(code);
|
|
81
|
+
basicExports.named.forEach((name) => namedExportsSet.add(name));
|
|
82
|
+
exports.default = basicExports.default;
|
|
83
|
+
const starMatches = code.matchAll(EXTENDED_PATTERNS.STAR_EXPORT);
|
|
84
|
+
for (const match of starMatches) {
|
|
85
|
+
const modulePath = match[2];
|
|
86
|
+
if (modulePath) {
|
|
87
|
+
exports.starExports.push(modulePath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const reExportMatches = code.matchAll(EXTENDED_PATTERNS.RE_EXPORT);
|
|
91
|
+
for (const match of reExportMatches) {
|
|
92
|
+
const names = match[1];
|
|
93
|
+
const source = match[3];
|
|
94
|
+
if (names && source) {
|
|
95
|
+
names.split(",").forEach((item) => {
|
|
96
|
+
const trimmed = item.trim();
|
|
97
|
+
if (trimmed) {
|
|
98
|
+
const parts = trimmed.split(/\s+as\s+/);
|
|
99
|
+
const name = parts[parts.length - 1].trim();
|
|
100
|
+
if (name) {
|
|
101
|
+
exports.reExports.push({ name, source });
|
|
102
|
+
namedExportsSet.add(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (EXTENDED_PATTERNS.ANONYMOUS_DEFAULT.test(code) && !exports.default) {
|
|
109
|
+
exports.default = "[anonymous]";
|
|
110
|
+
}
|
|
111
|
+
const literalMatch = code.match(EXTENDED_PATTERNS.DEFAULT_LITERAL);
|
|
112
|
+
if (literalMatch && !exports.default) {
|
|
113
|
+
exports.default = literalMatch[1].trim();
|
|
114
|
+
}
|
|
115
|
+
const destructuringMatches = code.matchAll(
|
|
116
|
+
EXTENDED_PATTERNS.DESTRUCTURING_EXPORT
|
|
117
|
+
);
|
|
118
|
+
for (const match of destructuringMatches) {
|
|
119
|
+
const items = match[1];
|
|
120
|
+
if (items) {
|
|
121
|
+
items.split(",").forEach((item) => {
|
|
122
|
+
const trimmed = item.trim();
|
|
123
|
+
if (trimmed) {
|
|
124
|
+
const colonParts = trimmed.split(":");
|
|
125
|
+
const name = colonParts[colonParts.length - 1].trim();
|
|
126
|
+
namedExportsSet.add(name);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.named = Array.from(namedExportsSet).sort();
|
|
132
|
+
return exports;
|
|
133
|
+
}
|
|
134
|
+
function isValidIdentifier(name) {
|
|
135
|
+
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
|
|
136
|
+
}
|
|
137
|
+
function getExportsStrict(code) {
|
|
138
|
+
const result = getExports(code);
|
|
139
|
+
result.named = result.named.filter(isValidIdentifier);
|
|
140
|
+
if (result.default && !isValidIdentifier(result.default)) {
|
|
141
|
+
result.default = null;
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
getExports,
|
|
148
|
+
getExportsExtended,
|
|
149
|
+
getExportsStrict
|
|
150
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkXWCRGY54cjs = require('./chunk-XWCRGY54.cjs');
|
|
4
|
+
|
|
5
|
+
// packages/basic/string/getExports.ts
|
|
6
|
+
var REGEX_PATTERNS = {
|
|
7
|
+
// export const/let/var variableName
|
|
8
|
+
VAR_EXPORT: /export\s+(?:const|let|var)\s+(\w+)/g,
|
|
9
|
+
// export function functionName
|
|
10
|
+
FUNCTION_EXPORT: /export\s+function\s+(\w+)/g,
|
|
11
|
+
// export class ClassName
|
|
12
|
+
CLASS_EXPORT: /export\s+class\s+(\w+)/g,
|
|
13
|
+
// export { a, b as c, d }
|
|
14
|
+
NAMED_EXPORTS: /export\s*\{([^}]+)\}/g,
|
|
15
|
+
// export default identifier
|
|
16
|
+
DEFAULT_EXPORT: /export\s+default\s+(\w+)/,
|
|
17
|
+
// 提取重命名后的名称
|
|
18
|
+
RENAME_SPLIT: /\s+as\s+/
|
|
19
|
+
};
|
|
20
|
+
function getExports(code) {
|
|
21
|
+
code = _chunkXWCRGY54cjs.deComment.call(void 0, code);
|
|
22
|
+
const exports = {
|
|
23
|
+
named: [],
|
|
24
|
+
default: null
|
|
25
|
+
};
|
|
26
|
+
const namedExportsSet = /* @__PURE__ */ new Set();
|
|
27
|
+
const processMatches = (pattern, extractName) => {
|
|
28
|
+
const matches = code.matchAll(pattern);
|
|
29
|
+
for (const match of matches) {
|
|
30
|
+
const name = extractName(match);
|
|
31
|
+
if (name) {
|
|
32
|
+
namedExportsSet.add(name);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
processMatches(REGEX_PATTERNS.VAR_EXPORT, (match) => match[1]);
|
|
37
|
+
processMatches(REGEX_PATTERNS.FUNCTION_EXPORT, (match) => match[1]);
|
|
38
|
+
processMatches(REGEX_PATTERNS.CLASS_EXPORT, (match) => match[1]);
|
|
39
|
+
const namedExportMatches = code.matchAll(REGEX_PATTERNS.NAMED_EXPORTS);
|
|
40
|
+
for (const match of namedExportMatches) {
|
|
41
|
+
const items = match[1];
|
|
42
|
+
if (!items) continue;
|
|
43
|
+
items.split(",").forEach((item) => {
|
|
44
|
+
const trimmed = item.trim();
|
|
45
|
+
if (!trimmed) return;
|
|
46
|
+
const parts = trimmed.split(REGEX_PATTERNS.RENAME_SPLIT);
|
|
47
|
+
const name = parts[parts.length - 1].trim();
|
|
48
|
+
if (name) {
|
|
49
|
+
namedExportsSet.add(name);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const defaultMatch = code.match(REGEX_PATTERNS.DEFAULT_EXPORT);
|
|
54
|
+
if (defaultMatch) {
|
|
55
|
+
exports.default = defaultMatch[1];
|
|
56
|
+
}
|
|
57
|
+
exports.named = Array.from(namedExportsSet).sort();
|
|
58
|
+
return exports;
|
|
59
|
+
}
|
|
60
|
+
function getExportsExtended(code) {
|
|
61
|
+
const exports = {
|
|
62
|
+
named: [],
|
|
63
|
+
default: null,
|
|
64
|
+
starExports: [],
|
|
65
|
+
reExports: []
|
|
66
|
+
};
|
|
67
|
+
const namedExportsSet = /* @__PURE__ */ new Set();
|
|
68
|
+
const EXTENDED_PATTERNS = {
|
|
69
|
+
// export * from 'module'
|
|
70
|
+
STAR_EXPORT: /export\s*\*\s*from\s*(['"])([^'"]+)\1/g,
|
|
71
|
+
// export { name } from 'module'
|
|
72
|
+
RE_EXPORT: /export\s*\{([^}]+)\}\s*from\s*(['"])([^'"]+)\2/g,
|
|
73
|
+
// 匿名默认导出:export default function() {...} 或 export default class {...}
|
|
74
|
+
ANONYMOUS_DEFAULT: /export\s+default\s+(?:function|class|\([^)]*\)\s*=>)/,
|
|
75
|
+
// 默认导出字面量
|
|
76
|
+
DEFAULT_LITERAL: /export\s+default\s+([^{(\s][^\s;{]*)/,
|
|
77
|
+
// 解构导出:export const { a, b } = obj
|
|
78
|
+
DESTRUCTURING_EXPORT: /export\s+(?:const|let|var)\s+\{([^}]+)\}/g
|
|
79
|
+
};
|
|
80
|
+
const basicExports = getExports(code);
|
|
81
|
+
basicExports.named.forEach((name) => namedExportsSet.add(name));
|
|
82
|
+
exports.default = basicExports.default;
|
|
83
|
+
const starMatches = code.matchAll(EXTENDED_PATTERNS.STAR_EXPORT);
|
|
84
|
+
for (const match of starMatches) {
|
|
85
|
+
const modulePath = match[2];
|
|
86
|
+
if (modulePath) {
|
|
87
|
+
exports.starExports.push(modulePath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const reExportMatches = code.matchAll(EXTENDED_PATTERNS.RE_EXPORT);
|
|
91
|
+
for (const match of reExportMatches) {
|
|
92
|
+
const names = match[1];
|
|
93
|
+
const source = match[3];
|
|
94
|
+
if (names && source) {
|
|
95
|
+
names.split(",").forEach((item) => {
|
|
96
|
+
const trimmed = item.trim();
|
|
97
|
+
if (trimmed) {
|
|
98
|
+
const parts = trimmed.split(/\s+as\s+/);
|
|
99
|
+
const name = parts[parts.length - 1].trim();
|
|
100
|
+
if (name) {
|
|
101
|
+
exports.reExports.push({ name, source });
|
|
102
|
+
namedExportsSet.add(name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (EXTENDED_PATTERNS.ANONYMOUS_DEFAULT.test(code) && !exports.default) {
|
|
109
|
+
exports.default = "[anonymous]";
|
|
110
|
+
}
|
|
111
|
+
const literalMatch = code.match(EXTENDED_PATTERNS.DEFAULT_LITERAL);
|
|
112
|
+
if (literalMatch && !exports.default) {
|
|
113
|
+
exports.default = literalMatch[1].trim();
|
|
114
|
+
}
|
|
115
|
+
const destructuringMatches = code.matchAll(
|
|
116
|
+
EXTENDED_PATTERNS.DESTRUCTURING_EXPORT
|
|
117
|
+
);
|
|
118
|
+
for (const match of destructuringMatches) {
|
|
119
|
+
const items = match[1];
|
|
120
|
+
if (items) {
|
|
121
|
+
items.split(",").forEach((item) => {
|
|
122
|
+
const trimmed = item.trim();
|
|
123
|
+
if (trimmed) {
|
|
124
|
+
const colonParts = trimmed.split(":");
|
|
125
|
+
const name = colonParts[colonParts.length - 1].trim();
|
|
126
|
+
namedExportsSet.add(name);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.named = Array.from(namedExportsSet).sort();
|
|
132
|
+
return exports;
|
|
133
|
+
}
|
|
134
|
+
function isValidIdentifier(name) {
|
|
135
|
+
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
|
|
136
|
+
}
|
|
137
|
+
function getExportsStrict(code) {
|
|
138
|
+
const result = getExports(code);
|
|
139
|
+
result.named = result.named.filter(isValidIdentifier);
|
|
140
|
+
if (result.default && !isValidIdentifier(result.default)) {
|
|
141
|
+
result.default = null;
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
exports.getExports = getExports; exports.getExportsExtended = getExportsExtended; exports.getExportsStrict = getExportsStrict;
|