@solana/codecs-strings 2.0.0-experimental.a48ebd2 → 2.0.0-experimental.a71a2db
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/README.md +194 -4
- package/dist/index.browser.cjs +143 -127
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +144 -128
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +115 -112
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +125 -125
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +126 -126
- package/dist/index.node.js.map +1 -1
- package/dist/types/assertions.d.ts.map +1 -1
- package/dist/types/base10.d.ts +3 -3
- package/dist/types/base10.d.ts.map +1 -1
- package/dist/types/base16.d.ts +4 -4
- package/dist/types/base16.d.ts.map +1 -1
- package/dist/types/base58.d.ts +3 -3
- package/dist/types/base58.d.ts.map +1 -1
- package/dist/types/base64.d.ts +4 -4
- package/dist/types/base64.d.ts.map +1 -1
- package/dist/types/baseX-reslice.d.ts +4 -4
- package/dist/types/baseX-reslice.d.ts.map +1 -1
- package/dist/types/baseX.d.ts +4 -4
- package/dist/types/baseX.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/dist/types/string.d.ts +26 -5
- package/dist/types/string.d.ts.map +1 -1
- package/dist/types/utf8.d.ts +3 -3
- package/dist/types/utf8.d.ts.map +1 -1
- package/package.json +14 -35
- package/dist/index.development.js +0 -472
- package/dist/index.development.js.map +0 -1
- package/dist/index.production.min.js +0 -37
package/dist/types/baseX.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
/**
|
|
3
3
|
* Encodes a string using a custom alphabet by dividing
|
|
4
4
|
* by the base and handling leading zeroes.
|
|
5
5
|
* @see {@link getBaseXCodec} for a more detailed description.
|
|
6
6
|
*/
|
|
7
|
-
export declare const getBaseXEncoder: (alphabet: string) =>
|
|
7
|
+
export declare const getBaseXEncoder: (alphabet: string) => VariableSizeEncoder<string>;
|
|
8
8
|
/**
|
|
9
9
|
* Decodes a string using a custom alphabet by dividing
|
|
10
10
|
* by the base and handling leading zeroes.
|
|
11
11
|
* @see {@link getBaseXCodec} for a more detailed description.
|
|
12
12
|
*/
|
|
13
|
-
export declare const getBaseXDecoder: (alphabet: string) =>
|
|
13
|
+
export declare const getBaseXDecoder: (alphabet: string) => VariableSizeDecoder<string>;
|
|
14
14
|
/**
|
|
15
15
|
* A string codec that requires a custom alphabet and uses
|
|
16
16
|
* the length of that alphabet as the base. It then divides
|
|
@@ -20,5 +20,5 @@ export declare const getBaseXDecoder: (alphabet: string) => Decoder<string>;
|
|
|
20
20
|
*
|
|
21
21
|
* This can be used to create codecs such as base10 or base58.
|
|
22
22
|
*/
|
|
23
|
-
export declare const getBaseXCodec: (alphabet: string) =>
|
|
23
|
+
export declare const getBaseXCodec: (alphabet: string) => VariableSizeCodec<string>;
|
|
24
24
|
//# sourceMappingURL=baseX.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseX.d.ts","sourceRoot":"","sources":["../../src/baseX.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"baseX.d.ts","sourceRoot":"","sources":["../../src/baseX.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAI7B;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,oBAAoB,MAAM,CAoC5E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,oBAAoB,MAAM,CAqB5E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,aAAc,MAAM,KAAG,kBAAkB,MAAM,CACH,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './assertions';
|
|
2
|
-
export * from './base10';
|
|
3
|
-
export * from './base16';
|
|
4
|
-
export * from './base58';
|
|
5
|
-
export * from './base64';
|
|
6
|
-
export * from './baseX';
|
|
7
|
-
export * from './baseX-reslice';
|
|
8
|
-
export * from './null-characters';
|
|
9
|
-
export * from './string';
|
|
10
|
-
export * from './utf8';
|
|
1
|
+
export * from './assertions.js';
|
|
2
|
+
export * from './base10.js';
|
|
3
|
+
export * from './base16.js';
|
|
4
|
+
export * from './base58.js';
|
|
5
|
+
export * from './base64.js';
|
|
6
|
+
export * from './baseX.js';
|
|
7
|
+
export * from './baseX-reslice.js';
|
|
8
|
+
export * from './null-characters.js';
|
|
9
|
+
export * from './string.js';
|
|
10
|
+
export * from './utf8.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/types/string.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/** Defines the config for string codecs. */
|
|
4
|
-
export type StringCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder, TEncoding extends Codec<string> | Encoder<string> | Decoder<string>> =
|
|
4
|
+
export type StringCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder, TEncoding extends Codec<string> | Encoder<string> | Decoder<string>> = {
|
|
5
5
|
/**
|
|
6
6
|
* The size of the string. It can be one of the following:
|
|
7
7
|
* - a {@link NumberCodec} that prefixes the string with its size.
|
|
@@ -17,9 +17,30 @@ export type StringCodecConfig<TPrefix extends NumberCodec | NumberEncoder | Numb
|
|
|
17
17
|
encoding?: TEncoding;
|
|
18
18
|
};
|
|
19
19
|
/** Encodes strings from a given encoding and size strategy. */
|
|
20
|
-
export declare
|
|
20
|
+
export declare function getStringEncoder<TSize extends number>(config: StringCodecConfig<NumberEncoder, Encoder<string>> & {
|
|
21
|
+
size: TSize;
|
|
22
|
+
}): FixedSizeEncoder<string, TSize>;
|
|
23
|
+
export declare function getStringEncoder<TSize extends number>(config: StringCodecConfig<NumberEncoder, Encoder<string>> & {
|
|
24
|
+
size: 'variable';
|
|
25
|
+
encoding: FixedSizeEncoder<string, TSize>;
|
|
26
|
+
}): FixedSizeEncoder<string, TSize>;
|
|
27
|
+
export declare function getStringEncoder(config?: StringCodecConfig<NumberEncoder, Encoder<string>>): VariableSizeEncoder<string>;
|
|
21
28
|
/** Decodes strings from a given encoding and size strategy. */
|
|
22
|
-
export declare
|
|
29
|
+
export declare function getStringDecoder<TSize extends number>(config: StringCodecConfig<NumberDecoder, Decoder<string>> & {
|
|
30
|
+
size: TSize;
|
|
31
|
+
}): FixedSizeDecoder<string, TSize>;
|
|
32
|
+
export declare function getStringDecoder<TSize extends number>(config: StringCodecConfig<NumberDecoder, Decoder<string>> & {
|
|
33
|
+
size: 'variable';
|
|
34
|
+
encoding: FixedSizeDecoder<string, TSize>;
|
|
35
|
+
}): FixedSizeDecoder<string, TSize>;
|
|
36
|
+
export declare function getStringDecoder(config?: StringCodecConfig<NumberDecoder, Decoder<string>>): VariableSizeDecoder<string>;
|
|
23
37
|
/** Encodes and decodes strings from a given encoding and size strategy. */
|
|
24
|
-
export declare
|
|
38
|
+
export declare function getStringCodec<TSize extends number>(config: StringCodecConfig<NumberCodec, Codec<string>> & {
|
|
39
|
+
size: TSize;
|
|
40
|
+
}): FixedSizeCodec<string, string, TSize>;
|
|
41
|
+
export declare function getStringCodec<TSize extends number>(config: StringCodecConfig<NumberCodec, Codec<string>> & {
|
|
42
|
+
size: 'variable';
|
|
43
|
+
encoding: FixedSizeCodec<string, string, TSize>;
|
|
44
|
+
}): FixedSizeCodec<string, string, TSize>;
|
|
45
|
+
export declare function getStringCodec(config?: StringCodecConfig<NumberCodec, Codec<string>>): VariableSizeCodec<string>;
|
|
25
46
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,EAIL,OAAO,EACP,OAAO,EAEP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAgC,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIjH,4CAA4C;AAC5C,MAAM,MAAM,iBAAiB,CACzB,OAAO,SAAS,WAAW,GAAG,aAAa,GAAG,aAAa,EAC3D,SAAS,SAAS,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,IACnE;IACA;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,MAAM,EACjD,MAAM,EAAE,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAC5E,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,MAAM,EACjD,MAAM,EAAE,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG;IAC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,EAC/C,MAAM,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG;IACpD,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;CACnD,GACF,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/types/utf8.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Codec,
|
|
1
|
+
import { Codec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
/** Encodes UTF-8 strings using the native `TextEncoder` API. */
|
|
3
|
-
export declare const getUtf8Encoder: () =>
|
|
3
|
+
export declare const getUtf8Encoder: () => VariableSizeEncoder<string>;
|
|
4
4
|
/** Decodes UTF-8 strings using the native `TextDecoder` API. */
|
|
5
|
-
export declare const getUtf8Decoder: () =>
|
|
5
|
+
export declare const getUtf8Decoder: () => VariableSizeDecoder<string>;
|
|
6
6
|
/** Encodes and decodes UTF-8 strings using the native `TextEncoder` and `TextDecoder` API. */
|
|
7
7
|
export declare const getUtf8Codec: () => Codec<string>;
|
|
8
8
|
//# sourceMappingURL=utf8.d.ts.map
|
package/dist/types/utf8.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src/utf8.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src/utf8.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAIL,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAK7B,gEAAgE;AAChE,eAAO,MAAM,cAAc,QAAO,oBAAoB,MAAM,CAU3D,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,cAAc,QAAO,oBAAoB,MAAM,CAQ3D,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,YAAY,QAAO,MAAM,MAAM,CAAqD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/codecs-strings",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.a71a2db",
|
|
4
4
|
"description": "Codecs for strings of different sizes and encodings",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,32 +49,9 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/codecs-core": "2.0.0-experimental.
|
|
53
|
-
"@solana/
|
|
54
|
-
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@solana/eslint-config-solana": "^1.0.2",
|
|
57
|
-
"@swc/jest": "^0.2.29",
|
|
58
|
-
"@types/jest": "^29.5.6",
|
|
59
|
-
"@types/node": "^20.9.0",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
61
|
-
"@typescript-eslint/parser": "^6.3.0",
|
|
62
|
-
"agadoo": "^3.0.0",
|
|
63
|
-
"eslint": "^8.45.0",
|
|
64
|
-
"eslint-plugin-jest": "^27.4.2",
|
|
65
|
-
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
66
|
-
"jest": "^29.7.0",
|
|
67
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
68
|
-
"jest-runner-eslint": "^2.1.2",
|
|
69
|
-
"jest-runner-prettier": "^1.0.0",
|
|
70
|
-
"prettier": "^2.8",
|
|
71
|
-
"tsup": "^8.0.1",
|
|
72
|
-
"typescript": "^5.2.2",
|
|
73
|
-
"version-from-git": "^1.1.1",
|
|
74
|
-
"test-config": "0.0.0",
|
|
75
|
-
"build-scripts": "0.0.0",
|
|
76
|
-
"text-encoding-impl": "0.0.0",
|
|
77
|
-
"tsconfig": "0.0.0"
|
|
52
|
+
"@solana/codecs-core": "2.0.0-experimental.a71a2db",
|
|
53
|
+
"@solana/errors": "2.0.0-experimental.a71a2db",
|
|
54
|
+
"@solana/codecs-numbers": "2.0.0-experimental.a71a2db"
|
|
78
55
|
},
|
|
79
56
|
"peerDependencies": {
|
|
80
57
|
"fastestsmallesttextencoderdecoder": "^1.0.22"
|
|
@@ -88,18 +65,20 @@
|
|
|
88
65
|
]
|
|
89
66
|
},
|
|
90
67
|
"scripts": {
|
|
91
|
-
"
|
|
92
|
-
"compile:
|
|
93
|
-
"
|
|
94
|
-
"
|
|
68
|
+
"benchmark": "./src/__benchmarks__/run.ts",
|
|
69
|
+
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
|
|
70
|
+
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/@solana/build-scripts/add-js-extension-to-types.mjs",
|
|
71
|
+
"dev": "jest -c node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
72
|
+
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag experimental --access public --no-git-checks",
|
|
73
|
+
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
|
|
95
74
|
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
|
|
96
|
-
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
97
|
-
"test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
|
|
75
|
+
"test:lint": "jest -c node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
76
|
+
"test:prettier": "jest -c node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
|
|
98
77
|
"test:treeshakability:browser": "agadoo dist/index.browser.js",
|
|
99
78
|
"test:treeshakability:native": "agadoo dist/index.native.js",
|
|
100
79
|
"test:treeshakability:node": "agadoo dist/index.node.js",
|
|
101
80
|
"test:typecheck": "tsc --noEmit",
|
|
102
|
-
"test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
|
|
103
|
-
"test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"
|
|
81
|
+
"test:unit:browser": "jest -c node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
|
|
82
|
+
"test:unit:node": "jest -c node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
|
|
104
83
|
}
|
|
105
84
|
}
|