[JS] Add ".js" suffix to all import statements to generate a browser compatible mjs...
authorTimo Sturm <sturm.timo@gmail.com>
Tue, 8 Feb 2022 20:21:20 +0000 (21:21 +0100)
committerGitHub <noreply@github.com>
Tue, 8 Feb 2022 20:21:20 +0000 (12:21 -0800)
ts/builder.ts
ts/byte-buffer.ts
ts/flatbuffers.ts
ts/flexbuffers.ts
ts/flexbuffers/bit-width-util.ts
ts/flexbuffers/builder.ts
ts/flexbuffers/reference-util.ts
ts/flexbuffers/reference.ts
ts/flexbuffers/stack-value.ts
ts/flexbuffers/value-type-util.ts
ts/types.ts

index a8c2d1e..344a629 100644 (file)
@@ -1,6 +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 { 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
index 2e07573..bb77f3b 100644 (file)
@@ -1,7 +1,7 @@
-import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from "./constants";
-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;
index 4246109..19f44e6 100644 (file)
@@ -1,12 +1,12 @@
-export { SIZEOF_SHORT } from './constants'
-export { SIZEOF_INT } from './constants'
-export { FILE_IDENTIFIER_LENGTH } from './constants'
-export { SIZE_PREFIX_LENGTH } from './constants'
+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'
+export { Table, Offset } from './types.js'
 
-export { int32, float32, float64, isLittleEndian } from './utils'
+export { int32, float32, float64, isLittleEndian } from './utils.js'
 
-export { Encoding } from './encoding'
-export { Builder } from './builder'
-export { ByteBuffer } from './byte-buffer'
+export { Encoding } from './encoding.js'
+export { Builder } from './builder.js'
+export { ByteBuffer } from './byte-buffer.js'
index b8c722d..a59d497 100644 (file)
@@ -1,7 +1,7 @@
 /* eslint-disable @typescript-eslint/no-namespace */
-import { Builder } from './flexbuffers/builder'
-import { toReference } from './flexbuffers/reference'
-export { toReference } 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();
index acb3c96..3a295fd 100644 (file)
@@ -1,4 +1,4 @@
-import { BitWidth } from './bit-width'
+import { BitWidth } from './bit-width.js'
 
 export function toByteWidth(bitWidth: BitWidth): number {
   return 1 << bitWidth;
index 4321547..9c2aa2a 100644 (file)
@@ -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,
index 7e83367..410d2af 100644 (file)
@@ -1,7 +1,7 @@
-import { BitWidth } from './bit-width'
-import { toByteWidth, fromByteWidth } from './bit-width-util'
-import { toUTF8Array, fromUTF8Array } from './flexbuffers-util'
-import { Reference } from './reference'
+import { BitWidth } from './bit-width.js'
+import { toByteWidth, fromByteWidth } from './bit-width-util.js'
+import { toUTF8Array, fromUTF8Array } from './flexbuffers-util.js'
+import { Reference } from './reference.js'
 
 export function validateOffset(dataView: DataView, offset: number, width: number): void {
   if (dataView.byteLength <= offset + width || (offset & (toByteWidth(width) - 1)) !== 0) {
index 9a3f5f7..53f3ff0 100644 (file)
@@ -1,9 +1,9 @@
-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 { 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, valueForIndexWithKey } from './reference-util.js'
+import { fromUTF8Array } from './flexbuffers-util.js';
+import { BitWidth } from './bit-width.js';
 
 export function toReference(buffer: ArrayBuffer): Reference {
   const len = buffer.byteLength;
index ef8e2f1..0106417 100644 (file)
@@ -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) {
index da869a9..784977d 100644 (file)
@@ -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
index 30e4050..31fefc1 100644 (file)
@@ -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;