Skip to content

Commit 75b0cc7

Browse files
committed
No default exports
So that all classes can be imported in other projects, espeically useful for TypeScript projects which want's to declare return classes from methods.
1 parent dc8a80d commit 75b0cc7

13 files changed

Lines changed: 36 additions & 39 deletions

rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default [
2222
output: {
2323
file: 'dist/amqp-client.cjs',
2424
format: 'cjs',
25-
exports: 'default',
2625
sourcemap: 'dist/amqp-client.cjs.map'
2726
}
2827
}, {
@@ -31,7 +30,6 @@ export default [
3130
plugins: [typescript(options)],
3231
output: {
3332
file: 'dist/amqp-client.mjs',
34-
exports: 'default',
3533
sourcemap: 'dist/amqp-client.mjs.map'
3634
}
3735
}

src/amqp-base-client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import AMQPChannel from './amqp-channel.js'
2-
import AMQPError from './amqp-error.js'
3-
import AMQPMessage from './amqp-message.js'
4-
import AMQPView from './amqp-view.js'
1+
import { AMQPChannel } from './amqp-channel.js'
2+
import { AMQPError } from './amqp-error.js'
3+
import { AMQPMessage } from './amqp-message.js'
4+
import { AMQPView } from './amqp-view.js'
55

66
const VERSION = '1.3.2'
77

88
/**
99
* Base class for AMQPClients.
1010
* Implements everything except how to connect, send data and close the socket
1111
*/
12-
export default abstract class AMQPBaseClient {
12+
export abstract class AMQPBaseClient {
1313
vhost: string
1414
username: string
1515
password: string

src/amqp-channel.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import AMQPError from './amqp-error.js'
2-
import AMQPView from './amqp-view.js'
3-
import AMQPQueue from './amqp-queue.js'
4-
import AMQPConsumer from './amqp-consumer.js'
5-
import AMQPMessage from './amqp-message.js'
6-
import AMQPBaseClient from './amqp-base-client.js'
1+
import { AMQPError } from './amqp-error.js'
2+
import { AMQPView } from './amqp-view.js'
3+
import { AMQPQueue } from './amqp-queue.js'
4+
import { AMQPConsumer } from './amqp-consumer.js'
5+
import { AMQPMessage } from './amqp-message.js'
6+
import { AMQPBaseClient } from './amqp-base-client.js'
77
import { AMQPProperties } from './amqp-properties.js'
88

99
/**
1010
* Represents an AMQP Channel. Almost all actions in AMQP are performed on a Channel.
1111
*/
12-
export default class AMQPChannel {
12+
export class AMQPChannel {
1313
readonly connection: AMQPBaseClient
1414
readonly id: number
1515
readonly consumers = new Map<string, AMQPConsumer>()

src/amqp-client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import AMQPClient from './amqp-socket-client.js'
2-
export = AMQPClient
1+
export { AMQPClient } from './amqp-socket-client.js'

src/amqp-consumer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import AMQPError from './amqp-error.js'
2-
import AMQPChannel from './amqp-channel.js'
3-
import AMQPMessage from './amqp-message.js'
1+
import { AMQPError } from './amqp-error.js'
2+
import { AMQPChannel } from './amqp-channel.js'
3+
import { AMQPMessage } from './amqp-message.js'
44

55
/**
66
* A consumer, subscribed to a queue
77
*/
8-
export default class AMQPConsumer {
8+
export class AMQPConsumer {
99
readonly channel: AMQPChannel
1010
readonly tag: string
1111
readonly onMessage: (msg: AMQPMessage) => void

src/amqp-error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import AMQPBaseClient from './amqp-base-client.js'
1+
import { AMQPBaseClient } from './amqp-base-client.js'
22

33
/**
44
* An error, can be both AMQP level errors or socket errors
55
* @property {string} message
66
* @property {AMQPBaseClient} connection - The connection the error was raised on
77
*/
8-
export default class AMQPError extends Error {
8+
export class AMQPError extends Error {
99
connection: AMQPBaseClient
1010
/**
1111
* @param message - Error description

src/amqp-message.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import AMQPChannel from './amqp-channel.js'
1+
import { AMQPChannel } from './amqp-channel.js'
22
import { AMQPProperties } from './amqp-properties.js'
33

44
/**
@@ -16,7 +16,7 @@ import { AMQPProperties } from './amqp-properties.js'
1616
* @property {number} replyCode - Code if message was returned
1717
* @property {string} replyText - Error message on why message was returned
1818
*/
19-
export default class AMQPMessage {
19+
export class AMQPMessage {
2020
channel: AMQPChannel
2121
exchange = ""
2222
routingKey = ""

src/amqp-queue.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import AMQPMessage from './amqp-message.js'
2-
import AMQPChannel from './amqp-channel.js'
1+
import { AMQPMessage } from './amqp-message.js'
2+
import { AMQPChannel } from './amqp-channel.js'
33
import { AMQPProperties } from './amqp-properties.js'
4-
import AMQPConsumer from './amqp-consumer.js'
4+
import { AMQPConsumer } from './amqp-consumer.js'
55

66
/**
77
* Convience class for queues
88
*/
9-
export default class AMQPQueue {
9+
export class AMQPQueue {
1010
readonly channel: AMQPChannel
1111
readonly name: string
1212
/**

src/amqp-socket-client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import AMQPBaseClient from './amqp-base-client.js'
2-
import AMQPError from './amqp-error.js'
3-
import AMQPView from './amqp-view.js'
1+
import { AMQPBaseClient } from './amqp-base-client.js'
2+
import { AMQPError } from './amqp-error.js'
3+
import { AMQPView } from './amqp-view.js'
44
import { Buffer } from 'buffer'
55
import * as net from 'net'
66
import * as tls from 'tls'
77

88
/**
99
* AMQP 0-9-1 client over TCP socket.
1010
*/
11-
export default class AMQPClient extends AMQPBaseClient {
11+
export class AMQPClient extends AMQPBaseClient {
1212
socket?: net.Socket
1313
readonly tls : boolean
1414
readonly host : string

src/amqp-view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AMQPProperties, Field } from './amqp-properties.js'
66
* Get methods returns the value read and how many bytes it used.
77
* @ignore
88
*/
9-
export default class AMQPView extends DataView {
9+
export class AMQPView extends DataView {
1010
private static decoder = new TextDecoder()
1111
private static encoder = new TextEncoder()
1212

0 commit comments

Comments
 (0)