Skip to content

Commit

Permalink
fix(types): ensure common types are visible in published package
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Nov 27, 2023
1 parent 2bf6b87 commit 0ea96f3
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import StructIo, { StructFields, StructOptions } from './type/StructIo.js';
import TlvIo, { TlvValueCallback } from './type/TlvIo.js';
import { validateType } from './util.js';
import { openStream } from './stream/util.js';
import { IoStream, IoType } from './types.js';

const array = (type: IoType, options: ArrayOptions) =>
new ArrayIo(type, options);
Expand Down
1 change: 1 addition & 0 deletions src/lib/stream/ArrayBufferStream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Endianness } from '../util.js';
import { IoStream } from '../types.js';

class ArrayBufferStream implements IoStream {
#buffer: ArrayBuffer;
Expand Down
1 change: 1 addition & 0 deletions src/lib/stream/FsStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from '../shim/fs.cjs';
import { Endianness } from '../util.js';
import { IoStream } from '../types.js';

class FsStream implements IoStream {
#fd: number;
Expand Down
1 change: 1 addition & 0 deletions src/lib/stream/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ArrayBufferStream from './ArrayBufferStream.js';
import FsStream from './FsStream.js';
import { Endianness } from '../util.js';
import { IoSource, IoStream } from '../types.js';

const isStream = (ref: any) => {
if (ref instanceof ArrayBufferStream) {
Expand Down
1 change: 1 addition & 0 deletions src/lib/type/ArrayIo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { validateType } from '../util.js';
import { openStream } from '../stream/util.js';
import { IoContext, IoSource, IoType } from '../types.js';

type ArrayOptions = {
size?: number;
Expand Down
1 change: 1 addition & 0 deletions src/lib/type/StringIo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolveValue } from '../util.js';
import { openStream } from '../stream/util.js';
import { IoContext, IoSource, IoStream, IoType } from '../types.js';

const STRING_TERMINATOR = 0x00;
const DEFAULT_ENCODING = 'utf-8';
Expand Down
1 change: 1 addition & 0 deletions src/lib/type/StructIo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Endianness, validateType } from '../util.js';
import { openStream } from '../stream/util.js';
import { IoContext, IoSource, IoType } from '../types.js';

type StructFields = Record<string, IoType>;

Expand Down
1 change: 1 addition & 0 deletions src/lib/type/TlvIo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Endianness } from '../util.js';
import { openStream } from '../stream/util.js';
import { IoContext, IoSource, IoType } from '../types.js';

type TlvValueCallback = (
type: string | number,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/types.d.ts → src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ type IoType = {
read: (source: IoSource, context: IoContext) => any;
write?: (source: IoSource, value: any, context: IoContext) => any;
};

export { IoContext, IoSource, IoStream, IoType };
2 changes: 2 additions & 0 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IoType } from './types.js';

enum Endianness {
Little = 1,
Big = 2,
Expand Down

0 comments on commit 0ea96f3

Please sign in to comment.