Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 41d32fb

Browse filesBrowse files
authored
Merge pull request #261 from msgpack/polyfill-dispose
implement a tiny polyfill to Symbol.dispose
2 parents 130ea87 + 9ab0b52 commit 41d32fb
Copy full SHA for 41d32fb

File tree

4 files changed

+14
-0
lines changed
Filter options

4 files changed

+14
-0
lines changed

‎src/Decoder.ts

Copy file name to clipboardExpand all lines: src/Decoder.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "./utils/symbol.dispose";
12
import { prettyByte } from "./utils/prettyByte";
23
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec";
34
import { getInt64, getUint64, UINT32_MAX } from "./utils/int";

‎src/Encoder.ts

Copy file name to clipboardExpand all lines: src/Encoder.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "./utils/symbol.dispose";
12
import { utf8Count, utf8Encode } from "./utils/utf8";
23
import { ExtensionCodec, ExtensionCodecType } from "./ExtensionCodec";
34
import { setInt64, setUint64 } from "./utils/int";

‎src/utils/symbol.dispose.ts

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Polyfill to Symbol.dispose
2+
3+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
4+
if (!Symbol.dispose) {
5+
Object.defineProperty(Symbol, "dispose", {
6+
value: Symbol("dispose"),
7+
writable: false,
8+
enumerable: false,
9+
configurable: false,
10+
});
11+
}

‎tools/esmify.ts

Copy file name to clipboardExpand all lines: tools/esmify.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ for (const file of files) {
1111
// .js => .mjs
1212
const content = fs.readFileSync(file).toString("utf-8");
1313
const newContent = content.replace(/\bfrom "(\.\.?\/[^"]+)";/g, 'from "$1.mjs";')
14+
.replace(/\bimport "(\.\.?\/[^"]+)";/g, 'import "$1.mjs";')
1415
.replace(/\/\/# sourceMappingURL=(.+)\.js\.map$/,
1516
"//# sourceMappingURL=$1.mjs.map");
1617
fs.writeFileSync(fileMjs, newContent);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.