@ocap/util 1.27.16 → 1.28.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.
- package/esm/bn.d.ts +8 -6
- package/esm/bn.js +11 -7
- package/esm/constant.d.ts +4 -1
- package/esm/constant.js +5 -1
- package/esm/create-sorted-list.d.ts +4 -1
- package/esm/create-sorted-list.js +8 -3
- package/esm/curve.d.ts +85 -55
- package/esm/curve.js +132 -127
- package/esm/error.d.ts +12 -9
- package/esm/error.js +24 -17
- package/esm/get-list-field.d.ts +4 -1
- package/esm/get-list-field.js +7 -2
- package/esm/get-related-addr.d.ts +4 -1
- package/esm/get-related-addr.js +5 -1
- package/esm/index.d.ts +47 -44
- package/esm/index.js +364 -469
- package/esm/lodash.d.ts +12 -0
- package/esm/md5.d.ts +4 -1
- package/esm/md5.js +7 -3
- package/esm/ready.d.ts +13 -9
- package/esm/ready.js +33 -36
- package/esm/retry.d.ts +16 -9
- package/esm/retry.js +26 -27
- package/esm/tsfixme.d.ts +3 -0
- package/esm/url.d.ts +16 -12
- package/esm/url.js +67 -92
- package/lib/_virtual/rolldown_runtime.js +29 -0
- package/lib/bn.d.ts +8 -6
- package/lib/bn.js +12 -12
- package/lib/constant.d.ts +4 -1
- package/lib/constant.js +6 -4
- package/lib/create-sorted-list.d.ts +4 -1
- package/lib/create-sorted-list.js +11 -10
- package/lib/curve.d.ts +84 -55
- package/lib/curve.js +139 -137
- package/lib/error.d.ts +12 -9
- package/lib/error.js +25 -21
- package/lib/get-list-field.d.ts +4 -1
- package/lib/get-list-field.js +9 -9
- package/lib/get-related-addr.d.ts +4 -1
- package/lib/get-related-addr.js +5 -4
- package/lib/index.d.ts +47 -44
- package/lib/index.js +386 -506
- package/lib/lodash.d.ts +12 -0
- package/lib/md5.d.ts +4 -1
- package/lib/md5.js +9 -10
- package/lib/ready.d.ts +13 -9
- package/lib/ready.js +34 -42
- package/lib/retry.d.ts +16 -9
- package/lib/retry.js +27 -30
- package/lib/tsfixme.d.ts +3 -0
- package/lib/url.d.ts +16 -12
- package/lib/url.js +69 -118
- package/package.json +20 -9
package/lib/lodash.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module 'lodash/camelCase';
|
|
2
|
+
declare module 'lodash/flatten';
|
|
3
|
+
declare module 'lodash/get';
|
|
4
|
+
declare module 'lodash/isBoolean';
|
|
5
|
+
declare module 'lodash/isNull';
|
|
6
|
+
declare module 'lodash/isNumber';
|
|
7
|
+
declare module 'lodash/isObject';
|
|
8
|
+
declare module 'lodash/isString';
|
|
9
|
+
declare module 'lodash/padEnd';
|
|
10
|
+
declare module 'lodash/padStart';
|
|
11
|
+
declare module 'lodash/uniq';
|
|
12
|
+
declare module 'lodash/upperFirst';
|
package/lib/md5.d.ts
CHANGED
package/lib/md5.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.md5 = md5;
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
|
|
2
|
+
let crypto = require("crypto");
|
|
3
|
+
crypto = require_rolldown_runtime.__toESM(crypto);
|
|
4
|
+
|
|
5
|
+
//#region src/md5.ts
|
|
6
|
+
const md5 = (x) => crypto.default.createHash("md5").update(x).digest("hex");
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.md5 = md5;
|
package/lib/ready.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import EventEmitter from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import EventEmitter from "events";
|
|
2
|
+
|
|
3
|
+
//#region src/ready.d.ts
|
|
4
|
+
declare class Ready extends EventEmitter {
|
|
5
|
+
emit: $TSFixMe;
|
|
6
|
+
ready: $TSFixMe;
|
|
7
|
+
readyCallbacks: $TSFixMe;
|
|
8
|
+
readyMarks: $TSFixMe;
|
|
9
|
+
constructor();
|
|
10
|
+
markReady(mark?: $TSFixMe): void;
|
|
11
|
+
onReady(cb: $TSFixMe): void;
|
|
10
12
|
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Ready };
|
package/lib/ready.js
CHANGED
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
|
|
2
|
+
let events = require("events");
|
|
3
|
+
events = require_rolldown_runtime.__toESM(events);
|
|
4
|
+
|
|
5
|
+
//#region src/ready.ts
|
|
6
|
+
var Ready = class extends events.default {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.ready = false;
|
|
10
|
+
this.readyCallbacks = [];
|
|
11
|
+
this.readyMarks = {};
|
|
12
|
+
}
|
|
13
|
+
markReady(mark) {
|
|
14
|
+
if (this.ready) return;
|
|
15
|
+
if (mark === void 0) {
|
|
16
|
+
this.ready = true;
|
|
17
|
+
this.readyCallbacks.forEach((x) => x());
|
|
18
|
+
this.emit("ready");
|
|
19
|
+
} else {
|
|
20
|
+
this.readyMarks[mark] = true;
|
|
21
|
+
this.ready = Object.values(this.readyMarks).every((x) => !!x);
|
|
22
|
+
if (this.ready) {
|
|
23
|
+
this.readyCallbacks.forEach((cb) => cb());
|
|
24
|
+
this.emit("ready");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
onReady(cb) {
|
|
29
|
+
if (this.ready) cb();
|
|
30
|
+
else this.readyCallbacks.push(cb);
|
|
31
|
+
}
|
|
4
32
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Ready extends events_1.default {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.ready = false;
|
|
12
|
-
this.readyCallbacks = [];
|
|
13
|
-
this.readyMarks = {};
|
|
14
|
-
}
|
|
15
|
-
markReady(mark) {
|
|
16
|
-
if (this.ready) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (mark === undefined) {
|
|
20
|
-
this.ready = true;
|
|
21
|
-
this.readyCallbacks.forEach((x) => x());
|
|
22
|
-
this.emit('ready');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// console.log('Ready.markReady', this.name, mark);
|
|
26
|
-
this.readyMarks[mark] = true;
|
|
27
|
-
this.ready = Object.values(this.readyMarks).every((x) => !!x);
|
|
28
|
-
if (this.ready) {
|
|
29
|
-
this.readyCallbacks.forEach((cb) => cb());
|
|
30
|
-
this.emit('ready');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
onReady(cb) {
|
|
35
|
-
if (this.ready) {
|
|
36
|
-
cb();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.readyCallbacks.push(cb);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.Ready = Ready;
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.Ready = Ready;
|
package/lib/retry.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
//#region src/retry.d.ts
|
|
1
2
|
interface RetryOptions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
retryLimit?: number;
|
|
4
|
+
backoff?: {
|
|
5
|
+
baseDelay: number;
|
|
6
|
+
maxDelay: number;
|
|
7
|
+
};
|
|
8
|
+
shouldRetry?: (error: unknown) => boolean;
|
|
9
|
+
onError?: (error: unknown, attempt: number) => Promise<void> | void;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
declare function withRetry<T>(handle: () => Promise<T>, {
|
|
12
|
+
retryLimit,
|
|
13
|
+
backoff,
|
|
14
|
+
shouldRetry,
|
|
15
|
+
onError
|
|
16
|
+
}?: RetryOptions): Promise<T>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { withRetry };
|
package/lib/retry.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.withRetry = withRetry;
|
|
1
|
+
|
|
2
|
+
//#region src/retry.ts
|
|
5
3
|
function wait(ms) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
setTimeout(resolve, ms);
|
|
6
|
+
});
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const delay = Math.min(maxDelay, baseDelay * 2 ** attempt);
|
|
30
|
-
await wait(Math.random() * delay);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
8
|
+
async function withRetry(handle, { retryLimit = 30, backoff = {
|
|
9
|
+
baseDelay: 20,
|
|
10
|
+
maxDelay: 1e3
|
|
11
|
+
}, shouldRetry = () => true, onError = () => {} } = {}) {
|
|
12
|
+
let attempt = 0;
|
|
13
|
+
let lastError;
|
|
14
|
+
while (attempt <= retryLimit) {
|
|
15
|
+
attempt++;
|
|
16
|
+
try {
|
|
17
|
+
return await handle();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (!shouldRetry(error) || attempt > retryLimit) throw error;
|
|
20
|
+
lastError = error;
|
|
21
|
+
if (onError) await onError(lastError, attempt);
|
|
22
|
+
const { baseDelay, maxDelay } = backoff;
|
|
23
|
+
const delay = Math.min(maxDelay, baseDelay * 2 ** attempt);
|
|
24
|
+
await wait(Math.random() * delay);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
33
27
|
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.withRetry = withRetry;
|
package/lib/tsfixme.d.ts
ADDED
package/lib/url.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import * as ipaddr from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import * as ipaddr from "ipaddr.js";
|
|
2
|
+
|
|
3
|
+
//#region src/url.d.ts
|
|
4
|
+
declare function parseIp(host: string): ipaddr.IPv4 | ipaddr.IPv6 | null;
|
|
5
|
+
declare function isUnicastAddress(host: string): boolean;
|
|
6
|
+
declare function resolveHostAddresses(host: string): Promise<string[]>;
|
|
7
|
+
interface VerifyUrlOptions {
|
|
8
|
+
allowIp?: boolean;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
protocols?: string[];
|
|
11
|
+
blockedHosts?: string[];
|
|
12
|
+
blockedSuffixes?: string[];
|
|
13
|
+
checkDns?: boolean;
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
declare function verifyUrl(url: string, options?: VerifyUrlOptions): Promise<boolean>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { VerifyUrlOptions, isUnicastAddress, parseIp, resolveHostAddresses, verifyUrl };
|
package/lib/url.js
CHANGED
|
@@ -1,130 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.parseIp = parseIp;
|
|
27
|
-
exports.isUnicastAddress = isUnicastAddress;
|
|
28
|
-
exports.resolveHostAddresses = resolveHostAddresses;
|
|
29
|
-
exports.verifyUrl = verifyUrl;
|
|
30
|
-
const url_1 = require("url");
|
|
31
|
-
const ipaddr = __importStar(require("ipaddr.js"));
|
|
32
|
-
const promises_1 = require("dns/promises");
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
|
|
2
|
+
let url = require("url");
|
|
3
|
+
let ipaddr_js = require("ipaddr.js");
|
|
4
|
+
ipaddr_js = require_rolldown_runtime.__toESM(ipaddr_js);
|
|
5
|
+
let dns_promises = require("dns/promises");
|
|
6
|
+
|
|
7
|
+
//#region src/url.ts
|
|
33
8
|
const MAX_URL_LENGTH = 256;
|
|
34
9
|
function parseIp(host) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
10
|
+
if (!ipaddr_js.isValid(host)) return null;
|
|
11
|
+
try {
|
|
12
|
+
return ipaddr_js.parse(host);
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
43
16
|
}
|
|
44
17
|
function stripTrailingDots(host) {
|
|
45
|
-
|
|
18
|
+
return host.replace(/\.+$/, "");
|
|
46
19
|
}
|
|
47
20
|
function isBlockedHostname(host, blockedHosts, blockedSuffixes) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return true;
|
|
53
|
-
return false;
|
|
21
|
+
const normalized = host.toLowerCase();
|
|
22
|
+
if (blockedHosts.includes(normalized)) return true;
|
|
23
|
+
if (blockedSuffixes.some((suffix) => normalized.endsWith(suffix))) return true;
|
|
24
|
+
return false;
|
|
54
25
|
}
|
|
55
26
|
function isUnicastAddress(host) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const mapped = parsed.toIPv4Address();
|
|
62
|
-
return mapped.range() === 'unicast';
|
|
63
|
-
}
|
|
64
|
-
return range === 'unicast';
|
|
27
|
+
const parsed = parseIp(host);
|
|
28
|
+
if (!parsed) return false;
|
|
29
|
+
const range = parsed.range();
|
|
30
|
+
if (range === "ipv4Mapped" && parsed.kind() === "ipv6") return parsed.toIPv4Address().range() === "unicast";
|
|
31
|
+
return range === "unicast";
|
|
65
32
|
}
|
|
66
33
|
async function resolveHostAddresses(host) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
return addresses.filter(Boolean);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
console.warn(`DNS resolution failed for host: ${host}, error: ${error?.message}`);
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
34
|
+
try {
|
|
35
|
+
const resolver = new dns_promises.Resolver();
|
|
36
|
+
resolver.setServers(["8.8.8.8", "1.1.1.1"]);
|
|
37
|
+
const addresses = [];
|
|
38
|
+
try {
|
|
39
|
+
const ipv4Addresses = await resolver.resolve4(host);
|
|
40
|
+
addresses.push(...ipv4Addresses);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.warn(`IPv4 resolution failed for ${host}:`, error?.message);
|
|
43
|
+
}
|
|
44
|
+
if (!addresses.length) try {
|
|
45
|
+
const ipv6Addresses = await resolver.resolve6(host);
|
|
46
|
+
addresses.push(...ipv6Addresses);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.warn(`IPv6 resolution failed for ${host}:`, error?.message);
|
|
49
|
+
}
|
|
50
|
+
return addresses.filter(Boolean);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.warn(`DNS resolution failed for host: ${host}, error: ${error?.message}`);
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
95
55
|
}
|
|
96
|
-
async function verifyUrl(url, options = {}) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
if (!isUnicastAddress(normalizedHost)) {
|
|
117
|
-
throw new Error(`IP address is not unicast: ${normalizedHost}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (checkDns && !isIP) {
|
|
121
|
-
const resolved = await resolveHostAddresses(normalizedHost);
|
|
122
|
-
if (resolved.length === 0) {
|
|
123
|
-
throw new Error(`DNS resolution failed: no addresses found for ${normalizedHost}`);
|
|
124
|
-
}
|
|
125
|
-
if (!resolved.every((address) => isUnicastAddress(address))) {
|
|
126
|
-
throw new Error(`DNS resolved to non-unicast addresses for ${normalizedHost}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return true;
|
|
56
|
+
async function verifyUrl(url$1, options = {}) {
|
|
57
|
+
if (!url$1) throw new Error("URL is required");
|
|
58
|
+
const { maxLength = MAX_URL_LENGTH, protocols = ["https:"], blockedHosts = ["localhost"], blockedSuffixes = [], allowIp = false, checkDns = false } = options;
|
|
59
|
+
if (url$1.length > maxLength) throw new Error(`URL exceeds maximum length of ${maxLength} characters: ${url$1.length}`);
|
|
60
|
+
const { hostname, protocol } = new url.URL(url$1);
|
|
61
|
+
if (!protocols.includes(protocol)) throw new Error(`Protocol '${protocol}' is not allowed. Allowed protocols: ${protocols.join(", ")}`);
|
|
62
|
+
const normalizedHost = stripTrailingDots(hostname);
|
|
63
|
+
if (isBlockedHostname(normalizedHost, blockedHosts, blockedSuffixes)) throw new Error(`Hostname '${normalizedHost}' is blocked`);
|
|
64
|
+
const isIP = Boolean(parseIp(normalizedHost));
|
|
65
|
+
if (isIP) {
|
|
66
|
+
if (!allowIp) throw new Error(`IP addresses are not allowed: ${normalizedHost}`);
|
|
67
|
+
if (!isUnicastAddress(normalizedHost)) throw new Error(`IP address is not unicast: ${normalizedHost}`);
|
|
68
|
+
}
|
|
69
|
+
if (checkDns && !isIP) {
|
|
70
|
+
const resolved = await resolveHostAddresses(normalizedHost);
|
|
71
|
+
if (resolved.length === 0) throw new Error(`DNS resolution failed: no addresses found for ${normalizedHost}`);
|
|
72
|
+
if (!resolved.every((address) => isUnicastAddress(address))) throw new Error(`DNS resolved to non-unicast addresses for ${normalizedHost}`);
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
130
75
|
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.isUnicastAddress = isUnicastAddress;
|
|
79
|
+
exports.parseIp = parseIp;
|
|
80
|
+
exports.resolveHostAddresses = resolveHostAddresses;
|
|
81
|
+
exports.verifyUrl = verifyUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/util",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"description": "utils shared across multiple forge js libs, works in both node.js and browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arcblock",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"ipaddr.js": "^2.1.0",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
20
|
"utf8": "^3.0.0",
|
|
21
|
-
"@ocap/types": "^1.
|
|
21
|
+
"@ocap/types": "^1.28.1"
|
|
22
22
|
},
|
|
23
23
|
"resolutions": {
|
|
24
24
|
"elliptic": "6.5.3"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"eslint": "^8.57.0",
|
|
34
34
|
"jest": "^29.7.0",
|
|
35
35
|
"ts-jest": "^29.2.5",
|
|
36
|
+
"tsdown": "^0.18.4",
|
|
36
37
|
"type-fest": "^3.1.0",
|
|
37
38
|
"typescript": "^5.6.2"
|
|
38
39
|
},
|
|
@@ -47,7 +48,21 @@
|
|
|
47
48
|
"homepage": "https://www.arcblock.io/docs/blockchain-utils",
|
|
48
49
|
"license": "Apache-2.0",
|
|
49
50
|
"main": "./lib/index.js",
|
|
50
|
-
"
|
|
51
|
+
"sideEffects": false,
|
|
52
|
+
"module": "./esm/index.js",
|
|
53
|
+
"types": "./esm/index.d.ts",
|
|
54
|
+
"exports": {
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./esm/index.d.ts",
|
|
57
|
+
"import": "./esm/index.js",
|
|
58
|
+
"default": "./lib/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./lib/*": {
|
|
61
|
+
"types": "./lib/*",
|
|
62
|
+
"import": "./esm/*",
|
|
63
|
+
"default": "./lib/*.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
51
66
|
"files": [
|
|
52
67
|
"lib",
|
|
53
68
|
"esm"
|
|
@@ -64,11 +79,7 @@
|
|
|
64
79
|
"lint:fix": "npm run lint -- --fix",
|
|
65
80
|
"test": "jest --forceExit --detectOpenHandles",
|
|
66
81
|
"coverage": "npm run test -- --coverage",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
70
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
71
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
72
|
-
"build:watch": "npm run build -- -w"
|
|
82
|
+
"build": "tsdown",
|
|
83
|
+
"build:watch": "tsdown --watch"
|
|
73
84
|
}
|
|
74
85
|
}
|