Fix #91
This commit is contained in:
parent
3f7798d46e
commit
fe82aebfec
41
package-lock.json
generated
41
package-lock.json
generated
|
@ -1953,7 +1953,8 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -1974,12 +1975,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -1994,17 +1997,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2121,7 +2127,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -2133,6 +2140,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -2147,6 +2155,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -2154,12 +2163,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -2178,6 +2189,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -2258,7 +2270,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -2270,6 +2283,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -2355,7 +2369,8 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -2391,6 +2406,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -2410,6 +2426,7 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -2453,12 +2470,14 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "node-eventstore-client",
|
||||
"version": "0.2.13",
|
||||
"version": "0.2.14",
|
||||
"description": "A port of the EventStore .Net ClientAPI to Node.js",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
|
@ -9,13 +9,13 @@
|
|||
},
|
||||
"engineStrict": true,
|
||||
"scripts": {
|
||||
"clean": "rm lib/dist.js",
|
||||
"clean": "rm -f lib/dist.js",
|
||||
"prebuild": "npm run clean",
|
||||
"build": "webpack",
|
||||
"build": "webpack -o ./lib/dist.js",
|
||||
"pretest": "npm run build",
|
||||
"test": "nodeunit",
|
||||
"test-debug": "TESTS_VERBOSE_LOGGING=1 nodeunit",
|
||||
"prepublish": "npm run build && npm run gendocs",
|
||||
"prepublishOnly": "npm run build && npm run gendocs",
|
||||
"gendocs": "rm -rf docs && jsdoc src -r -d docs"
|
||||
},
|
||||
"files": [
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
|
||||
(function(global, factory) { /* global define, require, module */
|
||||
|
||||
/* AMD */ if (typeof define === 'function' && define.amd)
|
||||
define(["protobufjs/minimal"], factory);
|
||||
/* CommonJS */if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
|
||||
module.exports = factory(require("protobufjs/minimal"), require("../utils/modules"));
|
||||
|
||||
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
|
||||
module.exports = factory(require("protobufjs/minimal"));
|
||||
|
||||
})(this, function($protobuf) {
|
||||
})(this, function($protobuf, $moduleUtil) {
|
||||
"use strict";
|
||||
|
||||
// This fixes bug #91 by giving us an isolate copy of protobufjs library so any tampering with it doesn't affect us
|
||||
var old = $moduleUtil.uncache(require.resolve('protobufjs/minimal'));
|
||||
$protobuf = require('protobufjs/minimal');
|
||||
$moduleUtil.recache(old);
|
||||
|
||||
// Common aliases
|
||||
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
||||
|
||||
|
|
17
src/utils/modules.js
Normal file
17
src/utils/modules.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
exports.uncache = function uncache(id) {
|
||||
var mod = require.cache[id];
|
||||
if (!mod) return;
|
||||
delete require.cache[id];
|
||||
if (mod.children)
|
||||
for(var i = 0; i < mod.children.length; i++)
|
||||
uncache(mod.children[i].id);
|
||||
return mod;
|
||||
};
|
||||
|
||||
exports.recache = function recache(mod) {
|
||||
if (require.cache[mod.id] === mod) return;
|
||||
require.cache[mod.id] = mod;
|
||||
if (mod.children)
|
||||
for(var i = 0; i < mod.children.length; i++)
|
||||
recache(mod.children[i]);
|
||||
};
|
|
@ -5,6 +5,11 @@ var client = require('../../lib/dist');
|
|||
var FileLogger = require('../../src/common/log/fileLogger');
|
||||
var NoopLogger = require('../../src/common/log/noopLogger');
|
||||
|
||||
// Make sure we mess with protobufjs setup for bug #91
|
||||
var protobufJS = require('protobufjs');
|
||||
protobufJS.util.Long = undefined;
|
||||
protobufJS.configure();
|
||||
|
||||
var settings = {
|
||||
log: new NoopLogger()
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user