b4n1-web 0.3.1 → 0.3.3
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/browser.js +17 -10
- package/dist/browser.js.map +1 -1
- package/dist/errors.js +9 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/security.js +10 -5
- package/dist/security.js.map +1 -1
- package/dist/types.js +7 -3
- package/dist/types.js.map +1 -1
- package/package.json +1 -4
package/dist/browser.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* B4n1Web Browser - JavaScript/TypeScript Implementation
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AgentBrowser = exports.Page = void 0;
|
|
7
|
+
exports.getB4n1webVersion = getB4n1webVersion;
|
|
8
|
+
exports.createBrowserAndGoto = createBrowserAndGoto;
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const types_1 = require("./types");
|
|
6
11
|
/**
|
|
7
12
|
* Find the b4n1web binary in common locations
|
|
8
13
|
*/
|
|
@@ -29,13 +34,13 @@ function getB4n1webBinary() {
|
|
|
29
34
|
/**
|
|
30
35
|
* Get B4n1Web binary version
|
|
31
36
|
*/
|
|
32
|
-
|
|
37
|
+
function getB4n1webVersion() {
|
|
33
38
|
const binaryPath = getB4n1webBinary();
|
|
34
39
|
if (!binaryPath) {
|
|
35
40
|
return 'unknown';
|
|
36
41
|
}
|
|
37
42
|
try {
|
|
38
|
-
const version = execSync(`${binaryPath} --version`, { timeout: 5000 }).toString().trim();
|
|
43
|
+
const version = (0, child_process_1.execSync)(`${binaryPath} --version`, { timeout: 5000 }).toString().trim();
|
|
39
44
|
return version || 'unknown';
|
|
40
45
|
}
|
|
41
46
|
catch {
|
|
@@ -45,7 +50,7 @@ export function getB4n1webVersion() {
|
|
|
45
50
|
/**
|
|
46
51
|
* Page data returned by B4n1Web
|
|
47
52
|
*/
|
|
48
|
-
|
|
53
|
+
class Page {
|
|
49
54
|
constructor(data) {
|
|
50
55
|
this.url = data.url;
|
|
51
56
|
this.markdown = data.markdown;
|
|
@@ -68,6 +73,7 @@ export class Page {
|
|
|
68
73
|
return this.links.filter(link => link.toLowerCase().includes(lowerText));
|
|
69
74
|
}
|
|
70
75
|
}
|
|
76
|
+
exports.Page = Page;
|
|
71
77
|
/**
|
|
72
78
|
* B4n1Web Agent Browser
|
|
73
79
|
*
|
|
@@ -84,14 +90,14 @@ export class Page {
|
|
|
84
90
|
* browser.close();
|
|
85
91
|
* ```
|
|
86
92
|
*/
|
|
87
|
-
|
|
93
|
+
class AgentBrowser {
|
|
88
94
|
constructor(options = {}) {
|
|
89
|
-
this.mode = options.mode ?? BrowserMode.LIGHT;
|
|
95
|
+
this.mode = options.mode ?? types_1.BrowserMode.LIGHT;
|
|
90
96
|
this.timeout = options.timeout ?? 30;
|
|
91
97
|
this.userAgent = options.userAgent ?? 'B4n1Web-Agent/1.0';
|
|
92
98
|
const binary = getB4n1webBinary();
|
|
93
99
|
if (!binary) {
|
|
94
|
-
throw new BinaryNotFoundError('b4n1web binary not found. Run: curl -sL https://web.b4n1.com/install | bash');
|
|
100
|
+
throw new types_1.BinaryNotFoundError('b4n1web binary not found. Run: curl -sL https://web.b4n1.com/install | bash');
|
|
95
101
|
}
|
|
96
102
|
this.binaryPath = binary;
|
|
97
103
|
}
|
|
@@ -101,7 +107,7 @@ export class AgentBrowser {
|
|
|
101
107
|
async goto(url) {
|
|
102
108
|
return new Promise((resolve, reject) => {
|
|
103
109
|
try {
|
|
104
|
-
const output = execSync(`${this.binaryPath} goto ${url} --mode ${this.mode}`, { timeout: this.timeout * 1000 }).toString();
|
|
110
|
+
const output = (0, child_process_1.execSync)(`${this.binaryPath} goto ${url} --mode ${this.mode}`, { timeout: this.timeout * 1000 }).toString();
|
|
105
111
|
const page = this.parseOutput(url, output);
|
|
106
112
|
resolve(page);
|
|
107
113
|
}
|
|
@@ -159,10 +165,11 @@ export class AgentBrowser {
|
|
|
159
165
|
this.close();
|
|
160
166
|
}
|
|
161
167
|
}
|
|
168
|
+
exports.AgentBrowser = AgentBrowser;
|
|
162
169
|
/**
|
|
163
170
|
* Create a browser and navigate in one go
|
|
164
171
|
*/
|
|
165
|
-
|
|
172
|
+
async function createBrowserAndGoto(url, options = {}) {
|
|
166
173
|
const browser = new AgentBrowser(options);
|
|
167
174
|
try {
|
|
168
175
|
return await browser.goto(url);
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAgCH,8CAWC;AA6ID,oDAUC;AAhMD,iDAAyC;AACzC,mCAA+F;AAE/F;;GAEG;AACH,SAAS,gBAAgB;IACvB,MAAM,aAAa,GAAG;QACpB,wBAAwB;QACxB,kBAAkB;QAClB,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,qBAAqB;QACxC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,uBAAuB;KAC3C,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClE,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;QACzC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED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B,EAAE;IAE5B,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* B4n1Web Errors
|
|
3
4
|
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BinaryError = exports.NavigationError = exports.BinaryNotFoundError = void 0;
|
|
4
7
|
/**
|
|
5
8
|
* Error thrown when B4n1Web binary is not found
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
class BinaryNotFoundError extends Error {
|
|
8
11
|
constructor(message = 'B4n1Web binary not found. Please install it first:\n curl -sL https://web.b4n1.com/install | bash') {
|
|
9
12
|
super(message);
|
|
10
13
|
this.name = 'BinaryNotFoundError';
|
|
11
14
|
Error.captureStackTrace(this, BinaryNotFoundError);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
exports.BinaryNotFoundError = BinaryNotFoundError;
|
|
14
18
|
/**
|
|
15
19
|
* Error thrown when navigation fails
|
|
16
20
|
*/
|
|
17
|
-
|
|
21
|
+
class NavigationError extends Error {
|
|
18
22
|
constructor(message, url) {
|
|
19
23
|
super(message);
|
|
20
24
|
this.url = url;
|
|
@@ -22,10 +26,11 @@ export class NavigationError extends Error {
|
|
|
22
26
|
Error.captureStackTrace(this, NavigationError);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
29
|
+
exports.NavigationError = NavigationError;
|
|
25
30
|
/**
|
|
26
31
|
* Error thrown when binary execution fails
|
|
27
32
|
*/
|
|
28
|
-
|
|
33
|
+
class BinaryError extends Error {
|
|
29
34
|
constructor(message, stderr) {
|
|
30
35
|
super(message);
|
|
31
36
|
this.stderr = stderr;
|
|
@@ -33,4 +38,5 @@ export class BinaryError extends Error {
|
|
|
33
38
|
Error.captureStackTrace(this, BinaryError);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
41
|
+
exports.BinaryError = BinaryError;
|
|
36
42
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;CACF;AAND,kDAMC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe,EAAkB,GAAW;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,QAAG,GAAH,GAAG,CAAQ;QAEtD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACjD,CAAC;CACF;AAND,0CAMC;AAED;;GAEG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe,EAAkB,MAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,WAAM,GAAN,MAAM,CAAQ;QAEzD,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;CACF;AAND,kCAMC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* B4n1Web SDK for JavaScript/TypeScript
|
|
3
4
|
* Zero-overhead, high-speed web execution for sovereign AI agents.
|
|
4
5
|
*
|
|
5
6
|
* @module b4n1web
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.navigate = exports.SecurityShield = exports.BinaryNotFoundError = exports.BrowserMode = exports.Page = exports.AgentBrowser = void 0;
|
|
10
|
+
var browser_1 = require("./browser");
|
|
11
|
+
Object.defineProperty(exports, "AgentBrowser", { enumerable: true, get: function () { return browser_1.AgentBrowser; } });
|
|
12
|
+
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return browser_1.Page; } });
|
|
13
|
+
var types_1 = require("./types");
|
|
14
|
+
Object.defineProperty(exports, "BrowserMode", { enumerable: true, get: function () { return types_1.BrowserMode; } });
|
|
15
|
+
var errors_1 = require("./errors");
|
|
16
|
+
Object.defineProperty(exports, "BinaryNotFoundError", { enumerable: true, get: function () { return errors_1.BinaryNotFoundError; } });
|
|
17
|
+
var security_1 = require("./security");
|
|
18
|
+
Object.defineProperty(exports, "SecurityShield", { enumerable: true, get: function () { return security_1.SecurityShield; } });
|
|
19
|
+
Object.defineProperty(exports, "navigate", { enumerable: true, get: function () { return security_1.navigate; } });
|
|
11
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,qCAA+C;AAAtC,uGAAA,YAAY,OAAA;AAAE,+FAAA,IAAI,OAAA;AAC3B,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA;AAC5B,uCAAsD;AAA7C,0GAAA,cAAc,OAAA;AAAE,oGAAA,QAAQ,OAAA"}
|
package/dist/security.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* B4n1Web SecurityShield - URL Security Validation
|
|
3
4
|
*
|
|
4
5
|
* Provides URL security validation with caching.
|
|
5
6
|
* Fall-safe: returns safe=true if any error occurs.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SecurityShield = void 0;
|
|
10
|
+
exports.navigate = navigate;
|
|
11
|
+
const browser_1 = require("./browser");
|
|
12
|
+
const types_1 = require("./types");
|
|
9
13
|
/**
|
|
10
14
|
* SecurityShield - Domain safety validation with caching
|
|
11
15
|
*
|
|
@@ -21,7 +25,7 @@ import { BrowserMode } from './types';
|
|
|
21
25
|
* const { isSafe, needsApiCheck } = shield.isUrlSafe('https://example.com');
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
|
-
|
|
28
|
+
class SecurityShield {
|
|
25
29
|
constructor(options = {}) {
|
|
26
30
|
this.dbPath = options.dbPath ?? `${process.env.HOME}/.b4n1web/security.db`;
|
|
27
31
|
this.cacheDays = options.cacheDays ?? 7;
|
|
@@ -72,6 +76,7 @@ export class SecurityShield {
|
|
|
72
76
|
this.cache.clear();
|
|
73
77
|
}
|
|
74
78
|
}
|
|
79
|
+
exports.SecurityShield = SecurityShield;
|
|
75
80
|
/**
|
|
76
81
|
* Navigate to URL with optional security check
|
|
77
82
|
*
|
|
@@ -85,7 +90,7 @@ export class SecurityShield {
|
|
|
85
90
|
* }
|
|
86
91
|
* ```
|
|
87
92
|
*/
|
|
88
|
-
|
|
93
|
+
async function navigate(url, ignoreSecurity = false, securityShield) {
|
|
89
94
|
if (!securityShield) {
|
|
90
95
|
securityShield = new SecurityShield();
|
|
91
96
|
}
|
|
@@ -100,7 +105,7 @@ export async function navigate(url, ignoreSecurity = false, securityShield) {
|
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
try {
|
|
103
|
-
const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
|
|
108
|
+
const browser = new browser_1.AgentBrowser({ mode: types_1.BrowserMode.LIGHT });
|
|
104
109
|
const page = await browser.goto(url);
|
|
105
110
|
browser.close();
|
|
106
111
|
return {
|
package/dist/security.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA+FH,4BA4CC;AAzID,uCAAoD;AACpD,mCAAsC;AAGtC;;;;;;;;;;;;;;GAcG;AACH,MAAa,cAAc;IAKzB,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC;QAC3E,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,GAAW;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,GAAW;QACnB,MAAM,MAAM,GAAG,IAAI,CAA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AAC;QACpB,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,GAAG;gBACH,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,yCAAyC;aACjD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,sBAAY,CAAC,EAAE,IAAI,EAAE,mBAAW,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9D,MAAM,IAAI,GAAS,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,GAAG;YACH,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* B4n1Web TypeScript Types
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BinaryNotFoundError = exports.BrowserMode = void 0;
|
|
7
|
+
var BrowserMode;
|
|
5
8
|
(function (BrowserMode) {
|
|
6
9
|
BrowserMode["LIGHT"] = "light";
|
|
7
10
|
BrowserMode["JS"] = "js";
|
|
8
11
|
BrowserMode["RENDER"] = "render";
|
|
9
|
-
})(BrowserMode || (BrowserMode = {}));
|
|
10
|
-
|
|
12
|
+
})(BrowserMode || (exports.BrowserMode = BrowserMode = {}));
|
|
13
|
+
class BinaryNotFoundError extends Error {
|
|
11
14
|
constructor(message = 'B4n1Web binary not found. Please install it first:\n curl -sL https://web.b4n1.com/install | bash') {
|
|
12
15
|
super(message);
|
|
13
16
|
this.name = 'BinaryNotFoundError';
|
|
14
17
|
}
|
|
15
18
|
}
|
|
19
|
+
exports.BinaryNotFoundError = BinaryNotFoundError;
|
|
16
20
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,wBAAS,CAAA;IACT,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAiCD,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,oGAAoG;QACxH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "b4n1-web",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "B4n1Web SDK for JavaScript/TypeScript - Agentic Browser Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
|
-
"type": "module",
|
|
9
7
|
"exports": {
|
|
10
8
|
".": {
|
|
11
|
-
"import": "./dist/index.mjs",
|
|
12
9
|
"require": "./dist/index.js",
|
|
13
10
|
"types": "./dist/index.d.ts"
|
|
14
11
|
}
|