Skip to content

Commit

Permalink
Avoid named imports of cjs deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-marcacci committed Nov 2, 2019
1 parent c98a792 commit 29ca9e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is useful for file uploads and other situations where you want to avoid del
```js
import fs from "fs";
import http from "http";
import WriteStream from "fs-capacitor";
import { WriteStream } from "fs-capacitor";

http.createServer((req, res) => {
const capacitor = new WriteStream();
Expand Down
6 changes: 5 additions & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import crypto from "crypto";
import fs from "fs";
import os from "os";
import path from "path";
import { Readable, Writable } from "readable-stream";
import rs from "readable-stream";

// Because we target .mjs files and this dependency is commonjs, we can't use
// named exports. Instead, we'll just destructure the object.
const { Readable, Writable } = rs;

let haveCheckedSignalListeners = false;
function checkSignalListeners() {
Expand Down
2 changes: 1 addition & 1 deletion src/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "leaked-handles";
import fs from "fs";
import stream from "stream";
import t from "tap";
import WriteStream, { ReadAfterDestroyedError } from ".";
import { ReadAfterDestroyedError, WriteStream } from ".";

const streamToString = stream =>
new Promise((resolve, reject) => {
Expand Down

0 comments on commit 29ca9e3

Please sign in to comment.