@ocap/util 1.27.15 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/esm/bn.d.ts +8 -6
  2. package/esm/bn.js +11 -7
  3. package/esm/constant.d.ts +4 -1
  4. package/esm/constant.js +5 -1
  5. package/esm/create-sorted-list.d.ts +4 -1
  6. package/esm/create-sorted-list.js +8 -3
  7. package/esm/curve.d.ts +85 -55
  8. package/esm/curve.js +132 -127
  9. package/esm/error.d.ts +12 -9
  10. package/esm/error.js +24 -17
  11. package/esm/get-list-field.d.ts +4 -1
  12. package/esm/get-list-field.js +7 -2
  13. package/esm/get-related-addr.d.ts +4 -1
  14. package/esm/get-related-addr.js +5 -1
  15. package/esm/index.d.ts +47 -44
  16. package/esm/index.js +364 -469
  17. package/esm/lodash.d.ts +12 -0
  18. package/esm/md5.d.ts +4 -1
  19. package/esm/md5.js +7 -3
  20. package/esm/ready.d.ts +13 -9
  21. package/esm/ready.js +33 -36
  22. package/esm/retry.d.ts +16 -9
  23. package/esm/retry.js +26 -27
  24. package/esm/tsfixme.d.ts +3 -0
  25. package/esm/url.d.ts +16 -12
  26. package/esm/url.js +67 -92
  27. package/lib/_virtual/rolldown_runtime.js +29 -0
  28. package/lib/bn.d.ts +8 -6
  29. package/lib/bn.js +12 -12
  30. package/lib/constant.d.ts +4 -1
  31. package/lib/constant.js +6 -4
  32. package/lib/create-sorted-list.d.ts +4 -1
  33. package/lib/create-sorted-list.js +11 -10
  34. package/lib/curve.d.ts +84 -55
  35. package/lib/curve.js +139 -137
  36. package/lib/error.d.ts +12 -9
  37. package/lib/error.js +25 -21
  38. package/lib/get-list-field.d.ts +4 -1
  39. package/lib/get-list-field.js +9 -9
  40. package/lib/get-related-addr.d.ts +4 -1
  41. package/lib/get-related-addr.js +5 -4
  42. package/lib/index.d.ts +47 -44
  43. package/lib/index.js +386 -506
  44. package/lib/lodash.d.ts +12 -0
  45. package/lib/md5.d.ts +4 -1
  46. package/lib/md5.js +9 -10
  47. package/lib/ready.d.ts +13 -9
  48. package/lib/ready.js +34 -42
  49. package/lib/retry.d.ts +16 -9
  50. package/lib/retry.js +27 -30
  51. package/lib/tsfixme.d.ts +3 -0
  52. package/lib/url.d.ts +16 -12
  53. package/lib/url.js +69 -118
  54. package/package.json +23 -9
@@ -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
@@ -1 +1,4 @@
1
- export declare const md5: (x: $TSFixMe) => string;
1
+ //#region src/md5.d.ts
2
+ declare const md5: (x: $TSFixMe) => string;
3
+ //#endregion
4
+ export { md5 };
package/lib/md5.js CHANGED
@@ -1,10 +1,9 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.md5 = void 0;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- // eslint-disable-next-line import/prefer-default-export
9
- const md5 = (x) => crypto_1.default.createHash('md5').update(x).digest('hex');
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 'events';
2
- export declare class Ready extends EventEmitter {
3
- emit: $TSFixMe;
4
- ready: $TSFixMe;
5
- readyCallbacks: $TSFixMe;
6
- readyMarks: $TSFixMe;
7
- constructor();
8
- markReady(mark?: $TSFixMe): void;
9
- onReady(cb: $TSFixMe): void;
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
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Ready = void 0;
7
- const events_1 = __importDefault(require("events"));
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
- retryLimit?: number;
3
- backoff?: {
4
- baseDelay: number;
5
- maxDelay: number;
6
- };
7
- shouldRetry?: (error: unknown) => boolean;
8
- onError?: (error: unknown, attempt: number) => Promise<void> | void;
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
- export declare function withRetry<T>(handle: () => Promise<T>, { retryLimit, backoff, shouldRetry, onError, }?: RetryOptions): Promise<T>;
11
- export {};
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
- "use strict";
2
- /* eslint-disable no-await-in-loop */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.withRetry = withRetry;
1
+
2
+ //#region src/retry.ts
5
3
  function wait(ms) {
6
- return new Promise((resolve) => {
7
- setTimeout(resolve, ms);
8
- });
4
+ return new Promise((resolve) => {
5
+ setTimeout(resolve, ms);
6
+ });
9
7
  }
10
- // eslint-disable-next-line consistent-return
11
- async function withRetry(handle, { retryLimit = 30, backoff = { baseDelay: 20, maxDelay: 1000 }, shouldRetry = () => true, onError = () => { }, } = {}) {
12
- let attempt = 0;
13
- let lastError;
14
- while (attempt <= retryLimit) {
15
- attempt++;
16
- try {
17
- const result = await handle();
18
- return result;
19
- }
20
- catch (error) {
21
- if (!shouldRetry(error) || attempt > retryLimit) {
22
- throw error;
23
- }
24
- lastError = error;
25
- if (onError) {
26
- await onError(lastError, attempt);
27
- }
28
- const { baseDelay, maxDelay } = backoff;
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;
@@ -0,0 +1,3 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ type $TSFixMe = any;
3
+ type $TSFixMeFunction = (...args: any[]) => any;
package/lib/url.d.ts CHANGED
@@ -1,13 +1,17 @@
1
- import * as ipaddr from 'ipaddr.js';
2
- export declare function parseIp(host: string): ipaddr.IPv4 | ipaddr.IPv6 | null;
3
- export declare function isUnicastAddress(host: string): boolean;
4
- export declare function resolveHostAddresses(host: string): Promise<string[]>;
5
- export interface VerifyUrlOptions {
6
- allowIp?: boolean;
7
- maxLength?: number;
8
- protocols?: string[];
9
- blockedHosts?: string[];
10
- blockedSuffixes?: string[];
11
- checkDns?: boolean;
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
- export declare function verifyUrl(url: string, options?: VerifyUrlOptions): Promise<boolean>;
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
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
- if (!ipaddr.isValid(host))
36
- return null;
37
- try {
38
- return ipaddr.parse(host);
39
- }
40
- catch {
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
- return host.replace(/\.+$/, '');
18
+ return host.replace(/\.+$/, "");
46
19
  }
47
20
  function isBlockedHostname(host, blockedHosts, blockedSuffixes) {
48
- const normalized = host.toLowerCase();
49
- if (blockedHosts.includes(normalized))
50
- return true;
51
- if (blockedSuffixes.some((suffix) => normalized.endsWith(suffix)))
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
- const parsed = parseIp(host);
57
- if (!parsed)
58
- return false;
59
- const range = parsed.range();
60
- if (range === 'ipv4Mapped' && parsed.kind() === 'ipv6') {
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
- try {
68
- const resolver = new promises_1.Resolver();
69
- resolver.setServers(['8.8.8.8', '1.1.1.1']);
70
- const addresses = [];
71
- // resolve ipv4
72
- try {
73
- const ipv4Addresses = await resolver.resolve4(host);
74
- addresses.push(...ipv4Addresses);
75
- }
76
- catch (error) {
77
- console.warn(`IPv4 resolution failed for ${host}:`, error?.message);
78
- }
79
- // resolve ipv6
80
- if (!addresses.length) {
81
- try {
82
- const ipv6Addresses = await resolver.resolve6(host);
83
- addresses.push(...ipv6Addresses);
84
- }
85
- catch (error) {
86
- console.warn(`IPv6 resolution failed for ${host}:`, error?.message);
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
- if (!url)
98
- throw new Error('URL is required');
99
- const { maxLength = MAX_URL_LENGTH, protocols = ['https:'], blockedHosts = ['localhost'], blockedSuffixes = [], allowIp = false, checkDns = false, } = options;
100
- if (url.length > maxLength) {
101
- throw new Error(`URL exceeds maximum length of ${maxLength} characters: ${url.length}`);
102
- }
103
- const { hostname, protocol } = new url_1.URL(url);
104
- if (!protocols.includes(protocol)) {
105
- throw new Error(`Protocol '${protocol}' is not allowed. Allowed protocols: ${protocols.join(', ')}`);
106
- }
107
- const normalizedHost = stripTrailingDots(hostname);
108
- if (isBlockedHostname(normalizedHost, blockedHosts, blockedSuffixes)) {
109
- throw new Error(`Hostname '${normalizedHost}' is blocked`);
110
- }
111
- const isIP = Boolean(parseIp(normalizedHost));
112
- if (isIP) {
113
- if (!allowIp) {
114
- throw new Error(`IP addresses are not allowed: ${normalizedHost}`);
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.27.15",
3
+ "version": "1.28.0",
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.27.15"
21
+ "@ocap/types": "^1.28.0"
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,24 @@
47
48
  "homepage": "https://www.arcblock.io/docs/blockchain-utils",
48
49
  "license": "Apache-2.0",
49
50
  "main": "./lib/index.js",
50
- "types": "./lib/index.d.ts",
51
+ "sideEffects": false,
52
+ "module": "./esm/index.js",
53
+ "types": "./esm/index.d.ts",
54
+ "exports": {
55
+ ".": {
56
+ "import": {
57
+ "types": "./esm/index.d.ts",
58
+ "default": "./esm/index.js"
59
+ },
60
+ "require": {
61
+ "types": "./lib/index.d.ts",
62
+ "default": "./lib/index.js"
63
+ }
64
+ },
65
+ "./lib/*": {
66
+ "require": "./lib/*.js"
67
+ }
68
+ },
51
69
  "files": [
52
70
  "lib",
53
71
  "esm"
@@ -64,11 +82,7 @@
64
82
  "lint:fix": "npm run lint -- --fix",
65
83
  "test": "jest --forceExit --detectOpenHandles",
66
84
  "coverage": "npm run test -- --coverage",
67
- "clean": "rm -fr lib esm",
68
- "prebuild": "npm run clean",
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"
85
+ "build": "tsdown",
86
+ "build:watch": "tsdown --watch"
73
87
  }
74
88
  }