@dcl/ecs 7.0.6-3767144242.commit-6bb12d2 → 7.0.6-3807227301.commit-1045452
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.
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const FlatString = {
|
|
5
5
|
serialize(value, builder) {
|
|
6
|
-
builder.
|
|
6
|
+
builder.writeUtf8String(value);
|
|
7
7
|
},
|
|
8
8
|
deserialize(reader) {
|
|
9
|
-
return
|
|
9
|
+
return reader.readUtf8String();
|
|
10
10
|
},
|
|
11
11
|
create() {
|
|
12
12
|
return '';
|
|
@@ -79,6 +79,7 @@ export declare type ByteBuffer = {
|
|
|
79
79
|
readUint32(): number;
|
|
80
80
|
readUint64(): bigint;
|
|
81
81
|
readBuffer(): Uint8Array;
|
|
82
|
+
readUtf8String(): string;
|
|
82
83
|
/**
|
|
83
84
|
* Writing purpose
|
|
84
85
|
*/
|
|
@@ -106,6 +107,7 @@ export declare type ByteBuffer = {
|
|
|
106
107
|
* @returns The subarray from 0 to offset.
|
|
107
108
|
*/
|
|
108
109
|
toCopiedBinary(): Uint8Array;
|
|
110
|
+
writeUtf8String(value: string, writeLength?: boolean): void;
|
|
109
111
|
writeBuffer(value: Uint8Array, writeLength?: boolean): void;
|
|
110
112
|
writeFloat32(value: number): void;
|
|
111
113
|
writeFloat64(value: number): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as utf8 from '@protobufjs/utf8';
|
|
1
2
|
/**
|
|
2
3
|
* Take the max between currentSize and intendedSize and then plus 1024. Then,
|
|
3
4
|
* find the next nearer multiple of 1024.
|
|
@@ -120,6 +121,10 @@ export function createByteBuffer(options = {}) {
|
|
|
120
121
|
const length = view.getUint32(roAdd(4));
|
|
121
122
|
return buffer.subarray(roAdd(length), roAdd(0));
|
|
122
123
|
},
|
|
124
|
+
readUtf8String() {
|
|
125
|
+
const length = view.getUint32(roAdd(4));
|
|
126
|
+
return utf8.read(buffer, roAdd(length), roAdd(0));
|
|
127
|
+
},
|
|
123
128
|
incrementWriteOffset(amount) {
|
|
124
129
|
return woAdd(amount);
|
|
125
130
|
},
|
|
@@ -139,6 +144,14 @@ export function createByteBuffer(options = {}) {
|
|
|
139
144
|
const o = woAdd(value.byteLength);
|
|
140
145
|
buffer.set(value, o);
|
|
141
146
|
},
|
|
147
|
+
writeUtf8String(value, writeLength = true) {
|
|
148
|
+
const byteLength = utf8.length(value);
|
|
149
|
+
if (writeLength) {
|
|
150
|
+
this.writeUint32(byteLength);
|
|
151
|
+
}
|
|
152
|
+
const o = woAdd(byteLength);
|
|
153
|
+
utf8.write(value, buffer, o);
|
|
154
|
+
},
|
|
142
155
|
writeFloat32(value) {
|
|
143
156
|
const o = woAdd(4);
|
|
144
157
|
view.setFloat32(o, value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
|
-
"version": "7.0.6-
|
|
3
|
+
"version": "7.0.6-3807227301.commit-1045452",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ts-proto": "^1.112.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dcl/crdt": "7.0.6-
|
|
30
|
+
"@dcl/crdt": "7.0.6-3807227301.commit-1045452",
|
|
31
31
|
"@dcl/js-runtime": "file:../js-runtime",
|
|
32
32
|
"@dcl/protocol": "^1.0.0-3766287015.commit-7d88411"
|
|
33
33
|
},
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"etc"
|
|
37
37
|
],
|
|
38
|
-
"commit": "
|
|
38
|
+
"commit": "104545291581dd38595dbfc46135d0f573d306ff"
|
|
39
39
|
}
|