Merge commit '7c1ae250acb4120322b01a666993ed63c795ef21' into master
Update flatbuffers to latest master.
This adds an upstream flatbuffer_ts_library rule and changes the
typescript codegen, so ends up touching every typescript file we have
that uses flatbuffers. But it does clean up some of the hacks we had to
make to get that to work.
Had to hack the flatbuffer_ts_library a bit because I forgot to make
imports work nicely for cross-repo things.
And of course, the original motivation for this is that it gives us
proper handling of transitive dependencies for
flatbuffer_cc_library, if we start using the deps attribute!
Had to modify the codegen for the new declaration_file attribute in
flatbuffer schemas to make it just be the filename rather than including
the path. Modifying that to make it use a workspace-relative path was
looking obnoxious. It's definitely feasible, but since we don't actually
need that attribute, just make it be a filename for now.
Change-Id: I523a758cafa512fa2a686c9705d23337a26798ca
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/third_party/flatbuffers/ts/BUILD b/third_party/flatbuffers/ts/BUILD
deleted file mode 100644
index 05d20bf..0000000
--- a/third_party/flatbuffers/ts/BUILD
+++ /dev/null
@@ -1,16 +0,0 @@
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
-
-ts_library(
- name = "flatbuffers_ts",
- srcs = [
- "builder.ts",
- "byte-buffer.ts",
- "constants.ts",
- "encoding.ts",
- "flatbuffers.ts",
- "long.ts",
- "types.ts",
- "utils.ts",
- ],
- visibility = ["//visibility:public"],
-)
diff --git a/third_party/flatbuffers/ts/BUILD.bazel b/third_party/flatbuffers/ts/BUILD.bazel
new file mode 100644
index 0000000..6e8a10b
--- /dev/null
+++ b/third_party/flatbuffers/ts/BUILD.bazel
@@ -0,0 +1,39 @@
+load("@npm//@bazel/typescript:index.bzl", "ts_project")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+
+ts_project(
+ name = "flatbuffers_ts",
+ srcs = [
+ "builder.ts",
+ "byte-buffer.ts",
+ "constants.ts",
+ "encoding.ts",
+ "index.ts",
+ "types.ts",
+ "utils.ts",
+ ],
+ declaration = True,
+ tsconfig = {
+ "compilerOptions": {
+ "module": "es2015",
+ "declaration": True,
+ "moduleResolution": "node",
+ "lib": [
+ "ES2015",
+ "ES2020.BigInt",
+ "DOM",
+ ],
+ "types": ["node"],
+ "strict": True,
+ },
+ },
+ visibility = ["//visibility:public"],
+ deps = ["@npm//@types/node"],
+)
+
+js_library(
+ name = "flatbuffers",
+ package_name = "flatbuffers",
+ visibility = ["//visibility:public"],
+ deps = [":flatbuffers_ts"],
+)
diff --git a/third_party/flatbuffers/ts/builder.ts b/third_party/flatbuffers/ts/builder.ts
index 137031e..344a629 100644
--- a/third_party/flatbuffers/ts/builder.ts
+++ b/third_party/flatbuffers/ts/builder.ts
@@ -1,7 +1,6 @@
-import { ByteBuffer } from "./byte-buffer"
-import { SIZEOF_SHORT, SIZE_PREFIX_LENGTH, SIZEOF_INT, FILE_IDENTIFIER_LENGTH } from "./constants"
-import { Offset, IGeneratedObject } from "./types"
-import { Long } from "./long"
+import { ByteBuffer } from "./byte-buffer.js"
+import { SIZEOF_SHORT, SIZE_PREFIX_LENGTH, SIZEOF_INT, FILE_IDENTIFIER_LENGTH } from "./constants.js"
+import { Offset, IGeneratedObject } from "./types.js"
export class Builder {
private bb: ByteBuffer
@@ -136,7 +135,7 @@
this.bb.writeInt32(this.space -= 4, value);
}
- writeInt64(value: Long): void {
+ writeInt64(value: bigint): void {
this.bb.writeInt64(this.space -= 8, value);
}
@@ -179,7 +178,7 @@
* Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
* @param value The `int64` to add the the buffer.
*/
- addInt64(value: Long): void {
+ addInt64(value: bigint): void {
this.prep(8, 0);
this.writeInt64(value);
}
@@ -223,8 +222,8 @@
}
}
- addFieldInt64(voffset: number, value: Long, defaultValue: Long): void {
- if (this.force_defaults || !value.equals(defaultValue)) {
+ addFieldInt64(voffset: number, value: bigint, defaultValue: bigint): void {
+ if (this.force_defaults || value !== defaultValue) {
this.addInt64(value);
this.slot(voffset);
}
@@ -523,8 +522,11 @@
* @param s The string to encode
* @return The offset in the buffer where the encoded string starts
*/
- createString(s: string | Uint8Array): Offset {
- if (!s) { return 0 }
+ createString(s: string | Uint8Array | null | undefined): Offset {
+ if (s === null || s === undefined) {
+ return 0;
+ }
+
let utf8: string | Uint8Array | number[];
if (s instanceof Uint8Array) {
utf8 = s;
@@ -575,18 +577,11 @@
}
/**
- * A helper function to avoid generated code depending on this file directly.
- */
- createLong(low: number, high: number): Long {
- return Long.create(low, high);
- }
-
- /**
* A helper function to pack an object
*
* @returns offset of obj
*/
- createObjectOffset(obj: string | IGeneratedObject): Offset {
+ createObjectOffset(obj: string | any): Offset {
if(obj === null) {
return 0
}
@@ -603,7 +598,7 @@
*
* @returns list of offsets of each non null object
*/
- createObjectOffsetList(list: string[]): Offset[] {
+ createObjectOffsetList(list: string[] | any[]): Offset[] {
const ret: number[] = [];
for(let i = 0; i < list.length; ++i) {
@@ -620,7 +615,7 @@
return ret;
}
- createStructOffsetList(list: string[], startFunc: (builder: Builder, length: number) => void): Offset {
+ createStructOffsetList(list: string[] | any[], startFunc: (builder: Builder, length: number) => void): Offset {
startFunc(this, list.length);
this.createObjectOffsetList(list);
return this.endVector();
diff --git a/third_party/flatbuffers/ts/byte-buffer.ts b/third_party/flatbuffers/ts/byte-buffer.ts
index b936c7b..bb77f3b 100644
--- a/third_party/flatbuffers/ts/byte-buffer.ts
+++ b/third_party/flatbuffers/ts/byte-buffer.ts
@@ -1,8 +1,7 @@
-import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants";
-import { Long } from "./long";
-import { int32, isLittleEndian, float32, float64 } from "./utils";
-import { Offset, Table, IGeneratedObject } from "./types";
-import { Encoding } from "./encoding";
+import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants.js";
+import { int32, isLittleEndian, float32, float64 } from "./utils.js";
+import { Offset, Table, IGeneratedObject } from "./types.js";
+import { Encoding } from "./encoding.js";
export class ByteBuffer {
private position_ = 0;
@@ -75,12 +74,12 @@
return this.readInt32(offset) >>> 0;
}
- readInt64(offset: number): Long {
- return new Long(this.readInt32(offset), this.readInt32(offset + 4));
+ readInt64(offset: number): bigint {
+ return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
}
- readUint64(offset: number): Long {
- return new Long(this.readUint32(offset), this.readUint32(offset + 4));
+ readUint64(offset: number): bigint {
+ return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));
}
readFloat32(offset: number): number {
@@ -108,8 +107,8 @@
}
writeUint16(offset: number, value: number): void {
- this.bytes_[offset] = value;
- this.bytes_[offset + 1] = value >> 8;
+ this.bytes_[offset] = value;
+ this.bytes_[offset + 1] = value >> 8;
}
writeInt32(offset: number, value: number): void {
@@ -120,20 +119,20 @@
}
writeUint32(offset: number, value: number): void {
- this.bytes_[offset] = value;
- this.bytes_[offset + 1] = value >> 8;
- this.bytes_[offset + 2] = value >> 16;
- this.bytes_[offset + 3] = value >> 24;
+ this.bytes_[offset] = value;
+ this.bytes_[offset + 1] = value >> 8;
+ this.bytes_[offset + 2] = value >> 16;
+ this.bytes_[offset + 3] = value >> 24;
}
- writeInt64(offset: number, value: Long): void {
- this.writeInt32(offset, value.low);
- this.writeInt32(offset + 4, value.high);
+ writeInt64(offset: number, value: bigint): void {
+ this.writeInt32(offset, Number(BigInt.asIntN(32, value)));
+ this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));
}
- writeUint64(offset: number, value: Long): void {
- this.writeUint32(offset, value.low);
- this.writeUint32(offset + 4, value.high);
+ writeUint64(offset: number, value: bigint): void {
+ this.writeUint32(offset, Number(BigInt.asUintN(32, value)));
+ this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));
}
writeFloat32(offset: number, value: number): void {
@@ -301,19 +300,12 @@
}
return true;
}
-
- /**
- * A helper function to avoid generated code depending on this file directly.
- */
- createLong(low: number, high: number): Long {
- return Long.create(low, high);
- }
-
+
/**
* A helper function for generating list for obj api
*/
- createScalarList(listAccessor: (i: number) => unknown, listLength: number) : unknown[] {
- const ret: unknown[] = [];
+ createScalarList(listAccessor: (i: number) => unknown, listLength: number): any[] {
+ const ret: any[] = [];
for(let i = 0; i < listLength; ++i) {
if(listAccessor(i) !== null) {
ret.push(listAccessor(i));
@@ -324,28 +316,21 @@
}
/**
- * This function is here only to get around typescript type system
- */
- createStringList(listAccessor: (i: number) => unknown, listLength: number): unknown[] {
- return this.createScalarList(listAccessor, listLength);
- }
-
- /**
* A helper function for generating list for obj api
* @param listAccessor function that accepts an index and return data at that index
* @param listLength listLength
* @param res result list
*/
- createObjList(listAccessor: (i: number) => IGeneratedObject, listLength: number): IGeneratedObject[] {
- const ret: IGeneratedObject[] = [];
+ createObjList(listAccessor: (i: number) => unknown, listLength: number): any[] {
+ const ret: any[] = [];
for(let i = 0; i < listLength; ++i) {
const val = listAccessor(i);
if(val !== null) {
- ret.push(val.unpack());
+ ret.push((val as IGeneratedObject).unpack());
}
}
return ret;
}
- }
\ No newline at end of file
+ }
diff --git a/third_party/flatbuffers/ts/flatbuffers.ts b/third_party/flatbuffers/ts/flatbuffers.ts
deleted file mode 100644
index 9184527..0000000
--- a/third_party/flatbuffers/ts/flatbuffers.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/* eslint-disable @typescript-eslint/no-namespace */
-import * as constants from './constants'
-import * as types from './types'
-import * as utils from './utils'
-
-import { Long as LongClass } from './long'
-import { Encoding as EncodingEnum } from './encoding'
-import { Builder as BuilderClass } from './builder'
-import { ByteBuffer as ByteBufferClass } from './byte-buffer'
-
-export namespace flatbuffers {
-
- export type Offset = types.Offset;
-
- export type Table = types.Table;
-
- export const SIZEOF_SHORT = constants.SIZEOF_SHORT;
- export const SIZEOF_INT = constants.SIZEOF_INT;
- export const FILE_IDENTIFIER_LENGTH = constants.FILE_IDENTIFIER_LENGTH;
- export const SIZE_PREFIX_LENGTH = constants.SIZE_PREFIX_LENGTH;
-
- export const Encoding = EncodingEnum;
-
- export const int32 = utils.int32;
- export const float32 = utils.float32;
- export const float64 = utils.float64;
- export const isLittleEndian = utils.isLittleEndian;
-
- export const Long = LongClass;
- export const Builder = BuilderClass;
- export const ByteBuffer = ByteBufferClass;
-}
-
-export default flatbuffers;
diff --git a/third_party/flatbuffers/ts/flexbuffers.ts b/third_party/flatbuffers/ts/flexbuffers.ts
index 40482dc..a59d497 100644
--- a/third_party/flatbuffers/ts/flexbuffers.ts
+++ b/third_party/flatbuffers/ts/flexbuffers.ts
@@ -1,13 +1,14 @@
/* eslint-disable @typescript-eslint/no-namespace */
-import { Builder } from './flexbuffers/builder'
-import { toReference as toReferenceFunction } from './flexbuffers/reference';
+import { Builder } from './flexbuffers/builder.js'
+import { toReference } from './flexbuffers/reference.js'
+export { toReference } from './flexbuffers/reference.js'
export function builder(): Builder {
return new Builder();
}
-export function toObject(buffer: Uint8Array): unknown {
- return toReferenceFunction(buffer).toObject();
+export function toObject(buffer: ArrayBuffer): unknown {
+ return toReference(buffer).toObject();
}
export function encode(object: unknown, size = 2048, deduplicateStrings = true, deduplicateKeys = true, deduplicateKeyVectors = true): Uint8Array {
@@ -15,16 +16,3 @@
builder.add(object);
return builder.finish();
}
-
-const builderFunction = builder
-const toObjectFunction = toObject
-const encodeFunction = encode
-
-export namespace flexbuffers {
- export const builder = builderFunction;
- export const toObject = toObjectFunction;
- export const encode = encodeFunction;
- export const toReference = toReferenceFunction;
-}
-
-export default flexbuffers;
diff --git a/third_party/flatbuffers/ts/flexbuffers/bit-width-util.ts b/third_party/flatbuffers/ts/flexbuffers/bit-width-util.ts
index acb3c96..3a295fd 100644
--- a/third_party/flatbuffers/ts/flexbuffers/bit-width-util.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/bit-width-util.ts
@@ -1,4 +1,4 @@
-import { BitWidth } from './bit-width'
+import { BitWidth } from './bit-width.js'
export function toByteWidth(bitWidth: BitWidth): number {
return 1 << bitWidth;
diff --git a/third_party/flatbuffers/ts/flexbuffers/builder.ts b/third_party/flatbuffers/ts/flexbuffers/builder.ts
index 4321547..9c2aa2a 100644
--- a/third_party/flatbuffers/ts/flexbuffers/builder.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/builder.ts
@@ -1,9 +1,9 @@
-import { BitWidth } from './bit-width'
-import { paddingSize, iwidth, uwidth, fwidth, toByteWidth, fromByteWidth } from './bit-width-util'
-import { toUTF8Array } from './flexbuffers-util'
-import { ValueType } from './value-type'
-import { isNumber, isTypedVectorElement, toTypedVector } from './value-type-util'
-import { StackValue } from './stack-value'
+import { BitWidth } from './bit-width.js'
+import { paddingSize, iwidth, uwidth, fwidth, toByteWidth, fromByteWidth } from './bit-width-util.js'
+import { toUTF8Array } from './flexbuffers-util.js'
+import { ValueType } from './value-type.js'
+import { isNumber, isTypedVectorElement, toTypedVector } from './value-type-util.js'
+import { StackValue } from './stack-value.js'
interface StackPointer {
stackPosition: number,
diff --git a/third_party/flatbuffers/ts/flexbuffers/reference-util.ts b/third_party/flatbuffers/ts/flexbuffers/reference-util.ts
index a5eb48d..c55a941 100644
--- a/third_party/flatbuffers/ts/flexbuffers/reference-util.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/reference-util.ts
@@ -1,9 +1,6 @@
-import { BitWidth } from './bit-width'
-import { toByteWidth, fromByteWidth } from './bit-width-util'
-import { toUTF8Array, fromUTF8Array } from './flexbuffers-util'
-import { Reference } from './reference'
-
-import { Long } from '../long'
+import { BitWidth } from './bit-width.js'
+import { toByteWidth, fromByteWidth } from './bit-width-util.js'
+import { toUTF8Array, fromUTF8Array } from './flexbuffers-util.js'
export function validateOffset(dataView: DataView, offset: number, width: number): void {
if (dataView.byteLength <= offset + width || (offset & (toByteWidth(width) - 1)) !== 0) {
@@ -11,7 +8,7 @@
}
}
-export function readInt(dataView: DataView, offset: number, width: number): number | Long | bigint {
+export function readInt(dataView: DataView, offset: number, width: number): number | bigint {
if (width < 2) {
if (width < 1) {
return dataView.getInt8(offset);
@@ -23,14 +20,14 @@
return dataView.getInt32(offset, true)
} else {
if (dataView.setBigInt64 === undefined) {
- return new Long(dataView.getUint32(offset, true), dataView.getUint32(offset + 4, true))
+ return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) << BigInt(32));
}
return dataView.getBigInt64(offset, true)
}
}
}
-export function readUInt(dataView: DataView, offset: number, width: number): number | Long | bigint {
+export function readUInt(dataView: DataView, offset: number, width: number): number | bigint {
if (width < 2) {
if (width < 1) {
return dataView.getUint8(offset);
@@ -42,7 +39,7 @@
return dataView.getUint32(offset, true)
} else {
if (dataView.getBigUint64 === undefined) {
- return new Long(dataView.getUint32(offset, true), dataView.getUint32(offset + 4, true))
+ return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) << BigInt(32));
}
return dataView.getBigUint64(offset, true)
}
@@ -97,13 +94,6 @@
return dataView.getUint8(keyIndirectOffset + input.length) === 0 ? 0 : -1;
}
-export function valueForIndexWithKey(index: number, key: string, dataView: DataView, offset: number, parentWidth: number, byteWidth: number, length: number, path: string): Reference {
- const _indirect = indirect(dataView, offset, parentWidth);
- const elementOffset = _indirect + index * byteWidth;
- const packedType = dataView.getUint8(_indirect + length * byteWidth + index);
- return new Reference(dataView, elementOffset, fromByteWidth(byteWidth), packedType, `${path}/${key}`)
-}
-
export function keyForIndex(index: number, dataView: DataView, offset: number, parentWidth: number, byteWidth: number): string {
const keysVectorOffset = indirect(dataView, offset, parentWidth) - byteWidth * 3;
const bitWidth = fromByteWidth(byteWidth);
@@ -116,4 +106,4 @@
length++;
}
return fromUTF8Array(new Uint8Array(dataView.buffer, keyIndirectOffset, length));
-}
\ No newline at end of file
+}
diff --git a/third_party/flatbuffers/ts/flexbuffers/reference.ts b/third_party/flatbuffers/ts/flexbuffers/reference.ts
index a93c743..0eff6f4 100644
--- a/third_party/flatbuffers/ts/flexbuffers/reference.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/reference.ts
@@ -1,14 +1,13 @@
-import { fromByteWidth } from './bit-width-util'
-import { ValueType } from './value-type'
-import { isNumber, isIndirectNumber, isAVector, fixedTypedVectorElementSize, isFixedTypedVector, isTypedVector, typedVectorElementType, packedType, fixedTypedVectorElementType } from './value-type-util'
-import { indirect, keyForIndex, keyIndex, readFloat, readInt, readUInt, valueForIndexWithKey } from './reference-util'
-import { Long } from '../long';
-import { fromUTF8Array } from './flexbuffers-util';
-import { BitWidth } from './bit-width';
+import { fromByteWidth } from './bit-width-util.js'
+import { ValueType } from './value-type.js'
+import { isNumber, isIndirectNumber, isAVector, fixedTypedVectorElementSize, isFixedTypedVector, isTypedVector, typedVectorElementType, packedType, fixedTypedVectorElementType } from './value-type-util.js'
+import { indirect, keyForIndex, keyIndex, readFloat, readInt, readUInt } from './reference-util.js'
+import { fromUTF8Array } from './flexbuffers-util.js';
+import { BitWidth } from './bit-width.js';
-export function toReference(buffer: Uint8Array): Reference {
+export function toReference(buffer: ArrayBuffer): Reference {
const len = buffer.byteLength;
-
+
if (len < 3) {
throw "Buffer needs to be bigger than 3";
}
@@ -22,6 +21,13 @@
return new Reference(dataView, offset, parentWidth, packedType, "/")
}
+function valueForIndexWithKey(index: number, key: string, dataView: DataView, offset: number, parentWidth: number, byteWidth: number, length: number, path: string): Reference {
+ const _indirect = indirect(dataView, offset, parentWidth);
+ const elementOffset = _indirect + index * byteWidth;
+ const packedType = dataView.getUint8(_indirect + length * byteWidth + index);
+ return new Reference(dataView, elementOffset, fromByteWidth(byteWidth), packedType, `${path}/${key}`)
+}
+
export class Reference {
private readonly byteWidth: number
private readonly valueType: ValueType
@@ -48,7 +54,7 @@
return null;
}
- intValue(): number | Long | bigint | null {
+ intValue(): number | bigint | null {
if (this.valueType === ValueType.INT) {
return readInt(this.dataView, this.offset, this.parentWidth);
}
@@ -74,7 +80,7 @@
return null;
}
- numericValue(): number | Long | bigint | null { return this.floatValue() || this.intValue()}
+ numericValue(): number | bigint | null { return this.floatValue() || this.intValue()}
stringValue(): string | null {
if (this.valueType === ValueType.STRING || this.valueType === ValueType.KEY) {
diff --git a/third_party/flatbuffers/ts/flexbuffers/stack-value.ts b/third_party/flatbuffers/ts/flexbuffers/stack-value.ts
index ef8e2f1..0106417 100644
--- a/third_party/flatbuffers/ts/flexbuffers/stack-value.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/stack-value.ts
@@ -1,8 +1,8 @@
-import { Builder } from './builder'
-import { BitWidth } from './bit-width'
-import { paddingSize, uwidth, fromByteWidth } from './bit-width-util'
-import { ValueType } from './value-type'
-import { isInline, packedType } from './value-type-util'
+import { Builder } from './builder.js'
+import { BitWidth } from './bit-width.js'
+import { paddingSize, uwidth, fromByteWidth } from './bit-width-util.js'
+import { ValueType } from './value-type.js'
+import { isInline, packedType } from './value-type-util.js'
export class StackValue {
constructor(private builder: Builder, public type: ValueType, public width: number, public value: number | boolean | null = null, public offset: number = 0) {
diff --git a/third_party/flatbuffers/ts/flexbuffers/value-type-util.ts b/third_party/flatbuffers/ts/flexbuffers/value-type-util.ts
index da869a9..784977d 100644
--- a/third_party/flatbuffers/ts/flexbuffers/value-type-util.ts
+++ b/third_party/flatbuffers/ts/flexbuffers/value-type-util.ts
@@ -1,4 +1,4 @@
-import { ValueType } from './value-type'
+import { ValueType } from './value-type.js'
export function isInline(value: ValueType): boolean {
return value === ValueType.BOOL
diff --git a/third_party/flatbuffers/ts/index.ts b/third_party/flatbuffers/ts/index.ts
new file mode 100644
index 0000000..19f44e6
--- /dev/null
+++ b/third_party/flatbuffers/ts/index.ts
@@ -0,0 +1,12 @@
+export { SIZEOF_SHORT } from './constants.js'
+export { SIZEOF_INT } from './constants.js'
+export { FILE_IDENTIFIER_LENGTH } from './constants.js'
+export { SIZE_PREFIX_LENGTH } from './constants.js'
+
+export { Table, Offset } from './types.js'
+
+export { int32, float32, float64, isLittleEndian } from './utils.js'
+
+export { Encoding } from './encoding.js'
+export { Builder } from './builder.js'
+export { ByteBuffer } from './byte-buffer.js'
diff --git a/third_party/flatbuffers/ts/long.ts b/third_party/flatbuffers/ts/long.ts
deleted file mode 100644
index 50a3ea8..0000000
--- a/third_party/flatbuffers/ts/long.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-export function createLong(low: number, high: number): Long {
- return Long.create(low, high);
-}
-
-export class Long {
- static readonly ZERO = new Long(0, 0)
- low: number
- high: number
- constructor(low: number, high: number) {
- this.low = low | 0;
- this.high = high | 0;
- }
- static create(low: number, high: number): Long {
- // Special-case zero to avoid GC overhead for default values
- return low == 0 && high == 0 ? Long.ZERO : new Long(low, high);
- }
- toFloat64(): number {
- return (this.low >>> 0) + this.high * 0x100000000;
- }
- equals(other: Long): boolean {
- return this.low == other.low && this.high == other.high;
- }
-}
\ No newline at end of file
diff --git a/third_party/flatbuffers/ts/types.ts b/third_party/flatbuffers/ts/types.ts
index 30e4050..31fefc1 100644
--- a/third_party/flatbuffers/ts/types.ts
+++ b/third_party/flatbuffers/ts/types.ts
@@ -1,5 +1,5 @@
-import { ByteBuffer } from './byte-buffer'
-import { Builder } from './builder'
+import { ByteBuffer } from './byte-buffer.js'
+import { Builder } from './builder.js'
export type Offset = number;