@solana/codecs-strings 2.0.0-experimental.98dd0a9 → 2.0.0-experimental.997a7cc
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/index.browser.cjs +29 -8
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +29 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +16 -6
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +16 -6
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +16 -6
- package/dist/index.node.js.map +1 -1
- package/dist/types/assertions.d.ts.map +1 -1
- package/dist/types/base64.d.ts.map +1 -1
- package/dist/types/string.d.ts +9 -9
- package/dist/types/string.d.ts.map +1 -1
- package/package.json +12 -35
package/dist/types/string.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
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 |
|
|
4
|
+
export type StringCodecConfig<TPrefix extends NumberCodec | NumberDecoder | NumberEncoder, TEncoding extends Codec<string> | Decoder<string> | Encoder<string>> = {
|
|
5
|
+
/**
|
|
6
|
+
* The codec to use for encoding and decoding the content.
|
|
7
|
+
* @defaultValue UTF-8 encoding.
|
|
8
|
+
*/
|
|
9
|
+
encoding?: TEncoding;
|
|
5
10
|
/**
|
|
6
11
|
* The size of the string. It can be one of the following:
|
|
7
12
|
* - a {@link NumberCodec} that prefixes the string with its size.
|
|
@@ -10,19 +15,14 @@ export type StringCodecConfig<TPrefix extends NumberCodec | NumberEncoder | Numb
|
|
|
10
15
|
* @defaultValue u32 prefix.
|
|
11
16
|
*/
|
|
12
17
|
size?: TPrefix | number | 'variable';
|
|
13
|
-
/**
|
|
14
|
-
* The codec to use for encoding and decoding the content.
|
|
15
|
-
* @defaultValue UTF-8 encoding.
|
|
16
|
-
*/
|
|
17
|
-
encoding?: TEncoding;
|
|
18
18
|
};
|
|
19
19
|
/** Encodes strings from a given encoding and size strategy. */
|
|
20
20
|
export declare function getStringEncoder<TSize extends number>(config: StringCodecConfig<NumberEncoder, Encoder<string>> & {
|
|
21
21
|
size: TSize;
|
|
22
22
|
}): FixedSizeEncoder<string, TSize>;
|
|
23
23
|
export declare function getStringEncoder<TSize extends number>(config: StringCodecConfig<NumberEncoder, Encoder<string>> & {
|
|
24
|
-
size: 'variable';
|
|
25
24
|
encoding: FixedSizeEncoder<string, TSize>;
|
|
25
|
+
size: 'variable';
|
|
26
26
|
}): FixedSizeEncoder<string, TSize>;
|
|
27
27
|
export declare function getStringEncoder(config?: StringCodecConfig<NumberEncoder, Encoder<string>>): VariableSizeEncoder<string>;
|
|
28
28
|
/** Decodes strings from a given encoding and size strategy. */
|
|
@@ -30,8 +30,8 @@ export declare function getStringDecoder<TSize extends number>(config: StringCod
|
|
|
30
30
|
size: TSize;
|
|
31
31
|
}): FixedSizeDecoder<string, TSize>;
|
|
32
32
|
export declare function getStringDecoder<TSize extends number>(config: StringCodecConfig<NumberDecoder, Decoder<string>> & {
|
|
33
|
-
size: 'variable';
|
|
34
33
|
encoding: FixedSizeDecoder<string, TSize>;
|
|
34
|
+
size: 'variable';
|
|
35
35
|
}): FixedSizeDecoder<string, TSize>;
|
|
36
36
|
export declare function getStringDecoder(config?: StringCodecConfig<NumberDecoder, Decoder<string>>): VariableSizeDecoder<string>;
|
|
37
37
|
/** Encodes and decodes strings from a given encoding and size strategy. */
|
|
@@ -39,8 +39,8 @@ export declare function getStringCodec<TSize extends number>(config: StringCodec
|
|
|
39
39
|
size: TSize;
|
|
40
40
|
}): FixedSizeCodec<string, string, TSize>;
|
|
41
41
|
export declare function getStringCodec<TSize extends number>(config: StringCodecConfig<NumberCodec, Codec<string>> & {
|
|
42
|
-
size: 'variable';
|
|
43
42
|
encoding: FixedSizeCodec<string, string, TSize>;
|
|
43
|
+
size: 'variable';
|
|
44
44
|
}): FixedSizeCodec<string, string, TSize>;
|
|
45
45
|
export declare function getStringCodec(config?: StringCodecConfig<NumberCodec, Codec<string>>): VariableSizeCodec<string>;
|
|
46
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,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;
|
|
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,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AM,EAAE,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG;IACxD,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1C,IAAI,EAAE,UAAU,CAAC;CACpB,GACF,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,wBAAgB,gBAAgB,CAC5B,MAAM,CAAC,EAAE,iBAAiB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAC3D,mBAAmB,CAAC,MAAM,CAAC,CAAC;AA4B/B,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,KAAK,SAAS,MAAM,EAC/C,MAAM,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACxE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,wBAAgB,cAAc,CAAC,KAAK,SAAS,MAAM,EAC/C,MAAM,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG;IACpD,QAAQ,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAChD,IAAI,EAAE,UAAU,CAAC;CACpB,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/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.997a7cc",
|
|
4
4
|
"description": "Codecs for strings of different sizes and encodings",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,33 +49,9 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/codecs-core": "2.0.0-experimental.
|
|
53
|
-
"@solana/codecs-numbers": "2.0.0-experimental.
|
|
54
|
-
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@solana/eslint-config-solana": "^1.0.2",
|
|
57
|
-
"@swc/jest": "^0.2.29",
|
|
58
|
-
"@types/jest": "^29.5.11",
|
|
59
|
-
"@types/node": "18.11.19",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
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": "^3.1",
|
|
71
|
-
"tinybench": "^2.6.0",
|
|
72
|
-
"tsup": "^8.0.1",
|
|
73
|
-
"typescript": "^5.2.2",
|
|
74
|
-
"version-from-git": "^1.1.1",
|
|
75
|
-
"build-scripts": "0.0.0",
|
|
76
|
-
"test-config": "0.0.0",
|
|
77
|
-
"text-encoding-impl": "0.0.0",
|
|
78
|
-
"tsconfig": "0.0.0"
|
|
52
|
+
"@solana/codecs-core": "2.0.0-experimental.997a7cc",
|
|
53
|
+
"@solana/codecs-numbers": "2.0.0-experimental.997a7cc",
|
|
54
|
+
"@solana/errors": "2.0.0-experimental.997a7cc"
|
|
79
55
|
},
|
|
80
56
|
"peerDependencies": {
|
|
81
57
|
"fastestsmallesttextencoderdecoder": "^1.0.22"
|
|
@@ -91,17 +67,18 @@
|
|
|
91
67
|
"scripts": {
|
|
92
68
|
"benchmark": "./src/__benchmarks__/run.ts",
|
|
93
69
|
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
|
|
94
|
-
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
|
|
95
|
-
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
96
|
-
"publish-
|
|
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",
|
|
97
74
|
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
|
|
98
|
-
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
99
|
-
"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",
|
|
100
77
|
"test:treeshakability:browser": "agadoo dist/index.browser.js",
|
|
101
78
|
"test:treeshakability:native": "agadoo dist/index.native.js",
|
|
102
79
|
"test:treeshakability:node": "agadoo dist/index.node.js",
|
|
103
80
|
"test:typecheck": "tsc --noEmit",
|
|
104
|
-
"test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
|
|
105
|
-
"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"
|
|
106
83
|
}
|
|
107
84
|
}
|