From f50f5ce7e811f229e55101323a1f68cb883606ad Mon Sep 17 00:00:00 2001 From: Joost Farla Date: Sat, 10 Oct 2015 11:10:51 +0200 Subject: [PATCH] Require statements break Browserify compatibility --- lib/client.js | 8 ++++---- lib/connection-parameters.js | 2 +- lib/index.js | 8 ++++---- lib/native/index.js | 2 +- lib/pool.js | 4 ++-- lib/query.js | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/client.js b/lib/client.js index c888d41..f0a374d 100644 --- a/lib/client.js +++ b/lib/client.js @@ -4,10 +4,10 @@ var util = require('util'); var pgPass = require('pgpass'); var TypeOverrides = require('./type-overrides'); -var ConnectionParameters = require(__dirname + '/connection-parameters'); -var Query = require(__dirname + '/query'); -var defaults = require(__dirname + '/defaults'); -var Connection = require(__dirname + '/connection'); +var ConnectionParameters = require('./connection-parameters'); +var Query = require('./query'); +var defaults = require('./defaults'); +var Connection = require('./connection'); var Client = function(config) { EventEmitter.call(this); diff --git a/lib/connection-parameters.js b/lib/connection-parameters.js index 612f0b6..2ba462b 100644 --- a/lib/connection-parameters.js +++ b/lib/connection-parameters.js @@ -1,7 +1,7 @@ var url = require('url'); var dns = require('dns'); -var defaults = require(__dirname + '/defaults'); +var defaults = require('./defaults'); var val = function(key, config, envVar) { if (envVar === undefined) { diff --git a/lib/index.js b/lib/index.js index e11334d..c8b9f53 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,9 +1,9 @@ var EventEmitter = require('events').EventEmitter; var util = require('util'); -var Client = require(__dirname+'/client'); -var defaults = require(__dirname + '/defaults'); -var pool = require(__dirname + '/pool'); -var Connection = require(__dirname + '/connection'); +var Client = require('./client'); +var defaults = require('./defaults'); +var pool = require('./pool'); +var Connection = require('./connection'); var PG = function(clientConstructor) { EventEmitter.call(this); diff --git a/lib/native/index.js b/lib/native/index.js index 7569c4d..381f0a8 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -5,7 +5,7 @@ var pkg = require('../../package.json'); var assert = require('assert'); var EventEmitter = require('events').EventEmitter; var util = require('util'); -var ConnectionParameters = require(__dirname + '/../connection-parameters'); +var ConnectionParameters = require('../connection-parameters'); var msg = 'Version >= ' + pkg.minNativeVersion + ' of pg-native required.'; assert(semver.gte(Native.version, pkg.minNativeVersion), msg); diff --git a/lib/pool.js b/lib/pool.js index 00cce7c..885a351 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -1,13 +1,13 @@ var EventEmitter = require('events').EventEmitter; -var defaults = require(__dirname + '/defaults'); +var defaults = require('./defaults'); var genericPool = require('generic-pool'); var pools = { //dictionary of all key:pool pairs all: {}, //reference to the client constructor - can override in tests or for require('pg').native - Client: require(__dirname + '/client'), + Client: require('./client'), getOrCreate: function(clientConfig) { clientConfig = clientConfig || {}; var name = JSON.stringify(clientConfig); diff --git a/lib/query.js b/lib/query.js index 3eb8164..cb2794e 100644 --- a/lib/query.js +++ b/lib/query.js @@ -1,8 +1,8 @@ var EventEmitter = require('events').EventEmitter; var util = require('util'); -var Result = require(__dirname + '/result'); -var utils = require(__dirname + '/utils'); +var Result = require('./result'); +var utils = require('./utils'); var Query = function(config, values, callback) { // use of "new" optional