Skip to content

Commit d9c6363

Browse files
committed
apply pure ESM policy
1 parent 3c3023c commit d9c6363

40 files changed

+253
-79
lines changed

.mocharc.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
'use strict';
2-
3-
require("ts-node/register");
1+
"use strict";
42

53
module.exports = {
64
diff: true,
7-
extension: ['ts'],
8-
package: '../package.json',
5+
extension: ["ts"],
6+
package: "../package.json",
97
timeout: 10000,
8+
require: ["tsimp"],
109
};

package-lock.json

Lines changed: 165 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"rimraf": "latest",
8282
"ts-loader": "latest",
8383
"ts-node": "latest",
84+
"tsimp": "^2.0.12",
8485
"typescript": "latest",
8586
"webpack": "latest",
8687
"webpack-cli": "latest"

src/CachedKeyDecoder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { utf8DecodeJs } from "./utils/utf8";
1+
import { utf8DecodeJs } from "./utils/utf8.ts";
22

33
const DEFAULT_MAX_KEY_LENGTH = 16;
44
const DEFAULT_MAX_LENGTH_PER_KEY = 16;

src/Decoder.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { prettyByte } from "./utils/prettyByte";
2-
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec";
3-
import { getInt64, getUint64, UINT32_MAX } from "./utils/int";
4-
import { utf8Decode } from "./utils/utf8";
5-
import { ensureUint8Array } from "./utils/typedArrays";
6-
import { CachedKeyDecoder, KeyDecoder } from "./CachedKeyDecoder";
7-
import { DecodeError } from "./DecodeError";
8-
import type { ContextOf } from "./context";
1+
import { prettyByte } from "./utils/prettyByte.ts";
2+
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec.ts";
3+
import { getInt64, getUint64, UINT32_MAX } from "./utils/int.ts";
4+
import { utf8Decode } from "./utils/utf8.ts";
5+
import { ensureUint8Array } from "./utils/typedArrays.ts";
6+
import { CachedKeyDecoder, KeyDecoder } from "./CachedKeyDecoder.ts";
7+
import { DecodeError } from "./DecodeError.ts";
8+
import type { ContextOf } from "./context.ts";
99

1010
export type DecoderOptions<ContextType = undefined> = Readonly<
1111
Partial<{

src/Encoder.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { utf8Count, utf8Encode } from "./utils/utf8";
2-
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec";
3-
import { setInt64, setUint64 } from "./utils/int";
4-
import { ensureUint8Array } from "./utils/typedArrays";
5-
import type { ExtData } from "./ExtData";
6-
import type { ContextOf } from "./context";
1+
import { utf8Count, utf8Encode } from "./utils/utf8.ts";
2+
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec.ts";
3+
import { setInt64, setUint64 } from "./utils/int.ts";
4+
import { ensureUint8Array } from "./utils/typedArrays.ts";
5+
import type { ExtData } from "./ExtData.ts";
6+
import type { ContextOf } from "./context.ts";
77

88
export const DEFAULT_MAX_DEPTH = 100;
99
export const DEFAULT_INITIAL_BUFFER_SIZE = 2048;

src/ExtensionCodec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ExtensionCodec to handle MessagePack extensions
22

3-
import { ExtData } from "./ExtData";
4-
import { timestampExtension } from "./timestamp";
3+
import { ExtData } from "./ExtData.ts";
4+
import { timestampExtension } from "./timestamp.ts";
55

66
export type ExtensionDecoderType<ContextType> = (
77
data: Uint8Array,

src/decode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Decoder } from "./Decoder";
2-
import type { DecoderOptions } from "./Decoder";
3-
import type { SplitUndefined } from "./context";
1+
import { Decoder } from "./Decoder.ts";
2+
import type { DecoderOptions } from "./Decoder.ts";
3+
import type { SplitUndefined } from "./context.ts";
44

55
/**
66
* It decodes a single MessagePack object in a buffer.

src/decodeAsync.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Decoder } from "./Decoder";
2-
import { ensureAsyncIterable } from "./utils/stream";
3-
import type { DecoderOptions } from "./Decoder";
4-
import type { ReadableStreamLike } from "./utils/stream";
5-
import type { SplitUndefined } from "./context";
1+
import { Decoder } from "./Decoder.ts";
2+
import { ensureAsyncIterable } from "./utils/stream.ts";
3+
import type { DecoderOptions } from "./Decoder.ts";
4+
import type { ReadableStreamLike } from "./utils/stream.ts";
5+
import type { SplitUndefined } from "./context.ts";
66

77
/**
88
* @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty.

src/encode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Encoder } from "./Encoder";
2-
import type { EncoderOptions } from "./Encoder";
3-
import type { SplitUndefined } from "./context";
1+
import { Encoder } from "./Encoder.ts";
2+
import type { EncoderOptions } from "./Encoder.ts";
3+
import type { SplitUndefined } from "./context.ts";
44

55
/**
66
* It encodes `value` in the MessagePack format and

0 commit comments

Comments
 (0)