@gsknnft/bigint-buffer 1.3.1 → 1.4.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/.travis.yml +10 -10
- package/README.md +123 -126
- package/WHY_BIGINT.md +127 -0
- package/benchmark.md +38 -0
- package/dist/index.cjs +1 -90
- package/dist/index.js +348 -0
- package/dist/index.umd.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/conversion/index.d.ts +1 -0
- package/dist/types/conversion/vite.config.d.ts +2 -0
- package/dist/types/conversion/vitest.config.d.ts +2 -0
- package/dist/types/dist/dist/conversion/conversion/index.d.ts +1 -0
- package/dist/types/dist/dist/index.d.ts +80 -0
- package/dist/types/index.bench.d.ts +1 -0
- package/dist/types/index.d.ts +80 -0
- package/dist/types/index.spec.d.ts +1 -0
- package/eslint.config.ts +12 -0
- package/package.json +115 -100
- package/pnpm-workspace.yaml +14 -0
- package/rollup.cjs.config.js +8 -3
- package/rollup.conversion.cjs.config.js +13 -0
- package/rollup.conversion.esm.config.js +24 -0
- package/rollup.esm.config.js +16 -5
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +44 -0
- package/vitest.config.ts +20 -0
- package/dist/browser.js +0 -75
- package/dist/index.d.ts +0 -28
- package/dist/index.spec.d.ts +0 -1
- package/dist/node.js +0 -90
- package/src/bigint-buffer.c +0 -203
- package/src/index.bench.ts +0 -207
- package/src/index.spec.ts +0 -287
- package/src/index.ts +0 -95
- package/tsconfig.json +0 -20
- /package/dist/{index.bench.d.ts → types/bigint-buffer.test.d.ts} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as conversionUtils from "./conversion/src/ts/index";
|
|
2
|
+
export { conversionUtils };
|
|
3
|
+
export declare let isNative: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a little-endian buffer into a BigInt.
|
|
6
|
+
* @param buf The little-endian buffer to convert
|
|
7
|
+
* @returns A BigInt with the little-endian representation of buf.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toBigIntLE(buf: Buffer): bigint;
|
|
10
|
+
export declare function validateBigIntBuffer(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a big-endian buffer into a BigInt
|
|
13
|
+
* @param buf The big-endian buffer to convert.
|
|
14
|
+
* @returns A BigInt with the big-endian representation of buf.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toBigIntBE(buf: Buffer): bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Convert a BigInt to a little-endian buffer.
|
|
19
|
+
* @param num The BigInt to convert.
|
|
20
|
+
* @param width The number of bytes that the resulting buffer should be.
|
|
21
|
+
* @returns A little-endian buffer representation of num.
|
|
22
|
+
*/
|
|
23
|
+
export declare function toBufferLE(num: bigint, width: number): Buffer;
|
|
24
|
+
/**
|
|
25
|
+
* Convert a BigInt to a big-endian buffer.
|
|
26
|
+
* @param num The BigInt to convert.
|
|
27
|
+
* @param width The number of bytes that the resulting buffer should be.
|
|
28
|
+
* @returns A big-endian buffer representation of num.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toBufferBE(num: bigint, width: number): Buffer;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a bigint to a Buffer with automatic sizing.
|
|
33
|
+
* Uses big-endian encoding and calculates the minimum buffer size needed.
|
|
34
|
+
* @param num The bigint to convert
|
|
35
|
+
* @returns A big-endian Buffer representation
|
|
36
|
+
*/
|
|
37
|
+
export declare function bigintToBuf(num: bigint): Buffer;
|
|
38
|
+
/**
|
|
39
|
+
* Convert a Buffer to a bigint.
|
|
40
|
+
* Assumes big-endian encoding.
|
|
41
|
+
* @param buf The buffer to convert
|
|
42
|
+
* @returns A bigint representation of the buffer
|
|
43
|
+
*/
|
|
44
|
+
export declare function bufToBigint(buf: Buffer): bigint;
|
|
45
|
+
/**
|
|
46
|
+
* Convert a bigint to a hexadecimal string.
|
|
47
|
+
* @param num The bigint to convert
|
|
48
|
+
* @returns A hexadecimal string (without '0x' prefix)
|
|
49
|
+
*/
|
|
50
|
+
export declare function bigintToHex(num: bigint): string;
|
|
51
|
+
/**
|
|
52
|
+
* Convert a hexadecimal string to a bigint.
|
|
53
|
+
* @param hex The hexadecimal string (with or without '0x' prefix)
|
|
54
|
+
* @returns A bigint representation
|
|
55
|
+
*/
|
|
56
|
+
export declare function hexToBigint(hex: string): bigint;
|
|
57
|
+
/**
|
|
58
|
+
* Convert a bigint to a decimal text string.
|
|
59
|
+
* @param num The bigint to convert
|
|
60
|
+
* @returns A decimal string representation
|
|
61
|
+
*/
|
|
62
|
+
export declare function bigintToText(num: bigint): string;
|
|
63
|
+
/**
|
|
64
|
+
* Convert a decimal text string to a bigint.
|
|
65
|
+
* @param text The decimal string to convert
|
|
66
|
+
* @returns A bigint representation
|
|
67
|
+
*/
|
|
68
|
+
export declare function textToBigint(text: string): bigint;
|
|
69
|
+
/**
|
|
70
|
+
* Convert a bigint to a base64 string.
|
|
71
|
+
* @param num The bigint to convert
|
|
72
|
+
* @returns A base64 string representation
|
|
73
|
+
*/
|
|
74
|
+
export declare function bigintToBase64(num: bigint): string;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a base64 string to a bigint.
|
|
77
|
+
* @param base64 The base64 string to convert
|
|
78
|
+
* @returns A bigint representation
|
|
79
|
+
*/
|
|
80
|
+
export declare function base64ToBigint(base64: string): bigint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as conversionUtils from "./conversion/src/ts/index";
|
|
2
|
+
export { conversionUtils };
|
|
3
|
+
export declare let isNative: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a little-endian buffer into a BigInt.
|
|
6
|
+
* @param buf The little-endian buffer to convert
|
|
7
|
+
* @returns A BigInt with the little-endian representation of buf.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toBigIntLE(buf: Buffer): bigint;
|
|
10
|
+
export declare function validateBigIntBuffer(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a big-endian buffer into a BigInt
|
|
13
|
+
* @param buf The big-endian buffer to convert.
|
|
14
|
+
* @returns A BigInt with the big-endian representation of buf.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toBigIntBE(buf: Buffer): bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Convert a BigInt to a little-endian buffer.
|
|
19
|
+
* @param num The BigInt to convert.
|
|
20
|
+
* @param width The number of bytes that the resulting buffer should be.
|
|
21
|
+
* @returns A little-endian buffer representation of num.
|
|
22
|
+
*/
|
|
23
|
+
export declare function toBufferLE(num: bigint, width: number): Buffer;
|
|
24
|
+
/**
|
|
25
|
+
* Convert a BigInt to a big-endian buffer.
|
|
26
|
+
* @param num The BigInt to convert.
|
|
27
|
+
* @param width The number of bytes that the resulting buffer should be.
|
|
28
|
+
* @returns A big-endian buffer representation of num.
|
|
29
|
+
*/
|
|
30
|
+
export declare function toBufferBE(num: bigint, width: number): Buffer;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a bigint to a Buffer with automatic sizing.
|
|
33
|
+
* Uses big-endian encoding and calculates the minimum buffer size needed.
|
|
34
|
+
* @param num The bigint to convert
|
|
35
|
+
* @returns A big-endian Buffer representation
|
|
36
|
+
*/
|
|
37
|
+
export declare function bigintToBuf(num: bigint): Buffer;
|
|
38
|
+
/**
|
|
39
|
+
* Convert a Buffer to a bigint.
|
|
40
|
+
* Assumes big-endian encoding.
|
|
41
|
+
* @param buf The buffer to convert
|
|
42
|
+
* @returns A bigint representation of the buffer
|
|
43
|
+
*/
|
|
44
|
+
export declare function bufToBigint(buf: Buffer): bigint;
|
|
45
|
+
/**
|
|
46
|
+
* Convert a bigint to a hexadecimal string.
|
|
47
|
+
* @param num The bigint to convert
|
|
48
|
+
* @returns A hexadecimal string (without '0x' prefix)
|
|
49
|
+
*/
|
|
50
|
+
export declare function bigintToHex(num: bigint): string;
|
|
51
|
+
/**
|
|
52
|
+
* Convert a hexadecimal string to a bigint.
|
|
53
|
+
* @param hex The hexadecimal string (with or without '0x' prefix)
|
|
54
|
+
* @returns A bigint representation
|
|
55
|
+
*/
|
|
56
|
+
export declare function hexToBigint(hex: string): bigint;
|
|
57
|
+
/**
|
|
58
|
+
* Convert a bigint to a decimal text string.
|
|
59
|
+
* @param num The bigint to convert
|
|
60
|
+
* @returns A decimal string representation
|
|
61
|
+
*/
|
|
62
|
+
export declare function bigintToText(num: bigint): string;
|
|
63
|
+
/**
|
|
64
|
+
* Convert a decimal text string to a bigint.
|
|
65
|
+
* @param text The decimal string to convert
|
|
66
|
+
* @returns A bigint representation
|
|
67
|
+
*/
|
|
68
|
+
export declare function textToBigint(text: string): bigint;
|
|
69
|
+
/**
|
|
70
|
+
* Convert a bigint to a base64 string.
|
|
71
|
+
* @param num The bigint to convert
|
|
72
|
+
* @returns A base64 string representation
|
|
73
|
+
*/
|
|
74
|
+
export declare function bigintToBase64(num: bigint): string;
|
|
75
|
+
/**
|
|
76
|
+
* Convert a base64 string to a bigint.
|
|
77
|
+
* @param base64 The base64 string to convert
|
|
78
|
+
* @returns A bigint representation
|
|
79
|
+
*/
|
|
80
|
+
export declare function base64ToBigint(base64: string): bigint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/eslint.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
import { defineConfig } from "eslint/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
{
|
|
7
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
|
|
8
|
+
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
|
9
|
+
ignores: ["*/build/**", "*/dist/**", "*/coverage/**", "*/test/**", "/src/index.spec.ts", "*/*.test.ts"],
|
|
10
|
+
},
|
|
11
|
+
tseslint.configs.recommended,
|
|
12
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,100 +1,115 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gsknnft/bigint-buffer",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "bigint to buffer conversion with native support",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
7
|
-
"browser":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"@types/
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"karma": "^
|
|
65
|
-
"karma-
|
|
66
|
-
"karma-
|
|
67
|
-
"karma-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"webpack": "
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@gsknnft/bigint-buffer",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "bigint to buffer conversion with native support and built-in conversion helpers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"browser": "dist/browser.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./conversion": {
|
|
15
|
+
"types": "./dist/conversion/index.d.ts",
|
|
16
|
+
"import": "./dist/conversion/index.js",
|
|
17
|
+
"require": "./dist/conversion/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"workspaces": [],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/gsknnft/bigint-buffer.git"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/gsknnft/bigint-buffer/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/gsknnft/bigintbuffer",
|
|
29
|
+
"keywords": [
|
|
30
|
+
"bigint",
|
|
31
|
+
"bignum",
|
|
32
|
+
"tc39-bigint",
|
|
33
|
+
"napi"
|
|
34
|
+
],
|
|
35
|
+
"license": "Apache-2.0",
|
|
36
|
+
"optionalDependencies": {
|
|
37
|
+
"bindings": "^1.5.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"jiti": "^2.6.1",
|
|
41
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
42
|
+
"@rollup/plugin-esm-shim": "0.1.8",
|
|
43
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
44
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
45
|
+
"@rollup/plugin-replace": "6.0.3",
|
|
46
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
47
|
+
"@types/benchmark": "^2.1.5",
|
|
48
|
+
"@types/bn.js": "^5.2.0",
|
|
49
|
+
"@types/chai": "^5.2.3",
|
|
50
|
+
"@types/mocha": "^10.0.10",
|
|
51
|
+
"@types/node": "^24.10.1",
|
|
52
|
+
"@vitest/coverage-v8": "4.0.14",
|
|
53
|
+
"assertion-error": "^2.0.1",
|
|
54
|
+
"benchmark": "^2.1.4",
|
|
55
|
+
"bindings": "1.5.0",
|
|
56
|
+
"bn.js": "^5.2.2",
|
|
57
|
+
"cpy-cli": "^6.0.0",
|
|
58
|
+
"cross-env": "^10.1.0",
|
|
59
|
+
"eslint": "^9.39.1",
|
|
60
|
+
"globals": "^16.5.0",
|
|
61
|
+
"gts": "^6.0.2",
|
|
62
|
+
"karma": "^6.4.4",
|
|
63
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
64
|
+
"karma-env-preprocessor": "^0.1.1",
|
|
65
|
+
"karma-mocha": "^2.0.1",
|
|
66
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
67
|
+
"karma-webpack": "^5.0.1",
|
|
68
|
+
"microtime": "^3.0.0",
|
|
69
|
+
"mkdirp": "^3.0.1",
|
|
70
|
+
"rollup": "^4.53.3",
|
|
71
|
+
"ts-loader": "^9.5.4",
|
|
72
|
+
"ts-node": "^10.9.2",
|
|
73
|
+
"typedoc": "^0.28.14",
|
|
74
|
+
"typescript": "5.9.3",
|
|
75
|
+
"typescript-eslint": "^8.48.0",
|
|
76
|
+
"undici-types": "^7.16.0",
|
|
77
|
+
"vite": "7.2.4",
|
|
78
|
+
"vitest": "^4.0.14",
|
|
79
|
+
"webpack": "5.103.0",
|
|
80
|
+
"webpack-cli": "6.0.1"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=24.0.0"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public"
|
|
87
|
+
},
|
|
88
|
+
"contributors": [
|
|
89
|
+
"Gordon Skinner <gsknnft@gmail.com> (https://github.com/gsknnft)",
|
|
90
|
+
"Michael Wei <mwei@vmware.com> (https://github.com/no2chem)"
|
|
91
|
+
],
|
|
92
|
+
"scripts": {
|
|
93
|
+
"test": "vitest run",
|
|
94
|
+
"test:watch": "vitest watch",
|
|
95
|
+
"coverage": "vitest cover ./test/index.js",
|
|
96
|
+
"lint": "gts check",
|
|
97
|
+
"install": "node-gyp rebuild",
|
|
98
|
+
"clean:js": "npm clean && rm -rf build/* dist/*",
|
|
99
|
+
"test:browser": "vite test --browser",
|
|
100
|
+
"test:node": "mocha build/src/**/*.spec.js --timeout 40000",
|
|
101
|
+
"declare": "tsc -p . --declaration --emitDeclarationOnly --outDir dist/types",
|
|
102
|
+
"benchmark": "node -r ts-node/register src/index.bench.ts",
|
|
103
|
+
"typedoc": "typedoc --out docs $(pwd)/src $(pwd)/helper --target es6 --mode file --tsconfig ./tsconfig.json --excludePrivate --excludeProtected --excludeNotExported --exclude '**/*+(spec|bench).ts'",
|
|
104
|
+
"rebuild:native": "node-gyp rebuild",
|
|
105
|
+
"build": "vite build && npm run declare && tsc -p . && cpy \"index.d.ts\" ../dist --cwd dist/types && cpy \"conversion/index.d.ts\" ../dist/conversion --cwd dist/types",
|
|
106
|
+
"compile": "vite build && npm run declare && tsc -p . && cpy \"index.d.ts\" ../dist/types --cwd dist/types && cpy \"conversion/index.d.ts\" ../dist/conversion --cwd dist/types",
|
|
107
|
+
"check": "eslint src/**/*.ts src/conversion/**/*.ts src/index.spec.ts src/conversion/test/**/*.ts",
|
|
108
|
+
"test:vitest": "vitest",
|
|
109
|
+
"test:all": "pnpm run test && pnpm run benchmark",
|
|
110
|
+
"clean": "gts clean",
|
|
111
|
+
"fix": "gts fix",
|
|
112
|
+
"pretest": "npm run compile",
|
|
113
|
+
"posttest": "npm run check"
|
|
114
|
+
}
|
|
115
|
+
}
|
package/rollup.cjs.config.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
|
-
input: 'build/
|
|
4
|
+
input: 'build/index.js',
|
|
3
5
|
output: {
|
|
4
6
|
file: 'dist/index.cjs',
|
|
5
7
|
format: 'cjs',
|
|
8
|
+
exports: 'named'
|
|
6
9
|
},
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
context: 'globalThis',
|
|
11
|
+
external: ['bindings', '@juanelas/base64'],
|
|
12
|
+
plugins: [commonjs()]
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
input: 'build/conversion/index.js',
|
|
5
|
+
output: {
|
|
6
|
+
file: 'dist/conversion/index.cjs',
|
|
7
|
+
format: 'cjs',
|
|
8
|
+
exports: 'named'
|
|
9
|
+
},
|
|
10
|
+
context: 'globalThis',
|
|
11
|
+
external: ['bindings', '@juanelas/base64'],
|
|
12
|
+
plugins: [commonjs()]
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import replace from '@rollup/plugin-replace';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
input: 'build/conversion/index.js',
|
|
6
|
+
output: {
|
|
7
|
+
file: 'dist/conversion/index.js',
|
|
8
|
+
format: 'esm'
|
|
9
|
+
},
|
|
10
|
+
context: 'globalThis',
|
|
11
|
+
external: ['bindings', '@juanelas/base64'],
|
|
12
|
+
plugins: [
|
|
13
|
+
commonjs({
|
|
14
|
+
include: /node_modules/,
|
|
15
|
+
namedExports: {
|
|
16
|
+
'@juanelas/base64': ['encode', 'decode']
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
19
|
+
replace({
|
|
20
|
+
preventAssignment: true,
|
|
21
|
+
'process.browser': 'false'
|
|
22
|
+
})
|
|
23
|
+
]
|
|
24
|
+
};
|
package/rollup.esm.config.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import replace from 'rollup
|
|
1
|
+
import replace from '@rollup/plugin-replace';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
|
-
input: 'build/
|
|
5
|
+
input: 'build/index.js',
|
|
5
6
|
output: {
|
|
6
|
-
|
|
7
|
+
file: 'dist/index.js',
|
|
8
|
+
format: 'esm'
|
|
7
9
|
},
|
|
10
|
+
context: 'globalThis',
|
|
11
|
+
external: ['bindings', '@juanelas/base64'],
|
|
8
12
|
plugins: [
|
|
13
|
+
commonjs({
|
|
14
|
+
include: /node_modules/,
|
|
15
|
+
namedExports: {
|
|
16
|
+
'@juanelas/base64': ['encode', 'decode']
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
9
19
|
replace({
|
|
10
|
-
|
|
20
|
+
preventAssignment: true,
|
|
21
|
+
'process.browser': 'false'
|
|
11
22
|
})
|
|
12
23
|
]
|
|
13
|
-
};
|
|
24
|
+
};
|