@dcl/playground-assets 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.
package/dist/alpha.d.ts CHANGED
@@ -148,6 +148,7 @@ export declare type ByteBuffer = {
148
148
  readUint32(): number;
149
149
  readUint64(): bigint;
150
150
  readBuffer(): Uint8Array;
151
+ readUtf8String(): string;
151
152
  /**
152
153
  * Writing purpose
153
154
  */
@@ -175,6 +176,7 @@ export declare type ByteBuffer = {
175
176
  * @returns The subarray from 0 to offset.
176
177
  */
177
178
  toCopiedBinary(): Uint8Array;
179
+ writeUtf8String(value: string, writeLength?: boolean): void;
178
180
  writeBuffer(value: Uint8Array, writeLength?: boolean): void;
179
181
  writeFloat32(value: number): void;
180
182
  writeFloat64(value: number): void;
package/dist/beta.d.ts CHANGED
@@ -148,6 +148,7 @@ export declare type ByteBuffer = {
148
148
  readUint32(): number;
149
149
  readUint64(): bigint;
150
150
  readBuffer(): Uint8Array;
151
+ readUtf8String(): string;
151
152
  /**
152
153
  * Writing purpose
153
154
  */
@@ -175,6 +176,7 @@ export declare type ByteBuffer = {
175
176
  * @returns The subarray from 0 to offset.
176
177
  */
177
178
  toCopiedBinary(): Uint8Array;
179
+ writeUtf8String(value: string, writeLength?: boolean): void;
178
180
  writeBuffer(value: Uint8Array, writeLength?: boolean): void;
179
181
  writeFloat32(value: number): void;
180
182
  writeFloat64(value: number): void;
@@ -148,6 +148,7 @@ export declare type ByteBuffer = {
148
148
  readUint32(): number;
149
149
  readUint64(): bigint;
150
150
  readBuffer(): Uint8Array;
151
+ readUtf8String(): string;
151
152
  /**
152
153
  * Writing purpose
153
154
  */
@@ -175,6 +176,7 @@ export declare type ByteBuffer = {
175
176
  * @returns The subarray from 0 to offset.
176
177
  */
177
178
  toCopiedBinary(): Uint8Array;
179
+ writeUtf8String(value: string, writeLength?: boolean): void;
178
180
  writeBuffer(value: Uint8Array, writeLength?: boolean): void;
179
181
  writeFloat32(value: number): void;
180
182
  writeFloat64(value: number): void;
package/dist/index.js CHANGED
@@ -12484,10 +12484,10 @@
12484
12484
  */
12485
12485
  const FlatString = {
12486
12486
  serialize(value, builder) {
12487
- builder.writeBuffer(new TextEncoder().encode(value));
12487
+ builder.writeUtf8String(value);
12488
12488
  },
12489
12489
  deserialize(reader) {
12490
- return new TextDecoder().decode(reader.readBuffer());
12490
+ return reader.readUtf8String();
12491
12491
  },
12492
12492
  create() {
12493
12493
  return '';
@@ -12882,6 +12882,8 @@
12882
12882
 
12883
12883
  var distExports = requireDist();
12884
12884
 
12885
+ var utf8Exports = requireUtf8();
12886
+
12885
12887
  /**
12886
12888
  * Take the max between currentSize and intendedSize and then plus 1024. Then,
12887
12889
  * find the next nearer multiple of 1024.
@@ -13004,6 +13006,10 @@
13004
13006
  const length = view.getUint32(roAdd(4));
13005
13007
  return buffer.subarray(roAdd(length), roAdd(0));
13006
13008
  },
13009
+ readUtf8String() {
13010
+ const length = view.getUint32(roAdd(4));
13011
+ return utf8Exports.read(buffer, roAdd(length), roAdd(0));
13012
+ },
13007
13013
  incrementWriteOffset(amount) {
13008
13014
  return woAdd(amount);
13009
13015
  },
@@ -13023,6 +13029,14 @@
13023
13029
  const o = woAdd(value.byteLength);
13024
13030
  buffer.set(value, o);
13025
13031
  },
13032
+ writeUtf8String(value, writeLength = true) {
13033
+ const byteLength = utf8Exports.length(value);
13034
+ if (writeLength) {
13035
+ this.writeUint32(byteLength);
13036
+ }
13037
+ const o = woAdd(byteLength);
13038
+ utf8Exports.write(value, buffer, o);
13039
+ },
13026
13040
  writeFloat32(value) {
13027
13041
  const o = woAdd(4);
13028
13042
  view.setFloat32(o, value);