This commit is contained in:
Nicolas Dextraze 2019-11-02 15:40:02 -07:00
parent 3f7798d46e
commit fe82aebfec
5 changed files with 64 additions and 21 deletions

41
package-lock.json generated
View File

@ -1953,7 +1953,8 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -1974,12 +1975,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -1994,17 +1997,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2121,7 +2127,8 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -2133,6 +2140,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -2147,6 +2155,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -2154,12 +2163,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -2178,6 +2189,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -2258,7 +2270,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -2270,6 +2283,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2355,7 +2369,8 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -2391,6 +2406,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -2410,6 +2426,7 @@
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -2453,12 +2470,14 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
} }
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "node-eventstore-client", "name": "node-eventstore-client",
"version": "0.2.13", "version": "0.2.14",
"description": "A port of the EventStore .Net ClientAPI to Node.js", "description": "A port of the EventStore .Net ClientAPI to Node.js",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
@ -9,13 +9,13 @@
}, },
"engineStrict": true, "engineStrict": true,
"scripts": { "scripts": {
"clean": "rm lib/dist.js", "clean": "rm -f lib/dist.js",
"prebuild": "npm run clean", "prebuild": "npm run clean",
"build": "webpack", "build": "webpack -o ./lib/dist.js",
"pretest": "npm run build", "pretest": "npm run build",
"test": "nodeunit", "test": "nodeunit",
"test-debug": "TESTS_VERBOSE_LOGGING=1 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" "gendocs": "rm -rf docs && jsdoc src -r -d docs"
}, },
"files": [ "files": [

View File

@ -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*/ /*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 */ (function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd) /* CommonJS */if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
define(["protobufjs/minimal"], factory); module.exports = factory(require("protobufjs/minimal"), require("../utils/modules"));
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) })(this, function($protobuf, $moduleUtil) {
module.exports = factory(require("protobufjs/minimal"));
})(this, function($protobuf) {
"use strict"; "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 // Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

17
src/utils/modules.js Normal file
View 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]);
};

View File

@ -5,6 +5,11 @@ var client = require('../../lib/dist');
var FileLogger = require('../../src/common/log/fileLogger'); var FileLogger = require('../../src/common/log/fileLogger');
var NoopLogger = require('../../src/common/log/noopLogger'); 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 = { var settings = {
log: new NoopLogger() log: new NoopLogger()
}; };