Skip to content

Commit 687d3eb

Browse files
committed
fix: better support for CJS importing
1 parent aa3b3e9 commit 687d3eb

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

lib/Redis.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { EventEmitter } from "events";
22
import * as commands from "redis-commands";
33
import asCallback from "standard-as-callback";
4-
import {
5-
AbstractConnector,
6-
Cluster,
7-
Command,
8-
ScanStream,
9-
SentinelConnector,
10-
} from ".";
4+
import Cluster from "./cluster";
5+
import Command from "./command";
116
import { StandaloneConnector } from "./connectors";
7+
import AbstractConnector from "./connectors/AbstractConnector";
8+
import SentinelConnector from "./connectors/SentinelConnector";
129
import * as eventHandler from "./redis/event_handler";
1310
import {
1411
DEFAULT_REDIS_OPTIONS,
1512
ReconnectOnError,
1613
RedisOptions,
1714
} from "./redis/RedisOptions";
15+
import ScanStream from "./ScanStream";
1816
import { addTransactionSupport, Transaction } from "./transaction";
1917
import {
2018
Callback,

lib/cluster/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EventEmitter } from "events";
22
import * as commands from "redis-commands";
33
import { AbortError, RedisError } from "redis-errors";
44
import asCallback from "standard-as-callback";
5-
import { Pipeline } from "..";
5+
import Pipeline from "../pipeline";
66
import Command from "../command";
77
import ClusterAllFailedError from "../errors/ClusterAllFailedError";
88
import Redis from "../Redis";

lib/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Redis from "./Redis";
1+
exports = module.exports = require("./Redis").default;
22

3+
export { default } from "./Redis";
34
export { default as Cluster } from "./cluster";
45

56
/**
@@ -64,5 +65,3 @@ export function print(err: Error | null, reply?: any) {
6465
console.log("Reply: " + reply);
6566
}
6667
}
67-
68-
export default Redis;

lib/pipeline.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as calculateSlot from "cluster-key-slot";
22
import { exists, hasFlag } from "redis-commands";
33
import asCallback from "standard-as-callback";
44
import { deprecate } from "util";
5-
import Redis, { Cluster } from ".";
5+
import Redis from "./Redis";
6+
import Cluster from "./cluster";
67
import Command from "./command";
78
import { Callback, PipelineWriteableStream } from "./types";
89
import { noop } from "./utils";

0 commit comments

Comments
 (0)