Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch vega d3 fix fixme #2575

Merged
merged 5 commits into from Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/swingset-runner/bin/runner
Expand Up @@ -10,14 +10,6 @@
// LMDB bindings need to be imported before lockdown.
import 'node-lmdb';

// FIXME: Without importing vega ahead of lockdown,
// node -r esm bin/runner --init --memdb run demo/encouragementBot
// exits with error code 1, just printing `{}`.
//
// Since this started with ses@0.12.3 we suspect vega is somehow
// hitting the override mistake with `constructor`.
import 'vega';

// Now do lockdown.
import '../src/install-optional-metering-and-ses';
import { main } from '../src/main.js';
Expand Down
18 changes: 18 additions & 0 deletions patches/d3-color+2.0.0.patch
@@ -0,0 +1,18 @@
diff --git a/node_modules/d3-color/dist/d3-color.js b/node_modules/d3-color/dist/d3-color.js
index ba46026..5742b8c 100644
--- a/node_modules/d3-color/dist/d3-color.js
+++ b/node_modules/d3-color/dist/d3-color.js
@@ -7,7 +7,12 @@ typeof define === 'function' && define.amd ? define(['exports'], factory) :

function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
- prototype.constructor = constructor;
+ Object.defineProperty(prototype, 'constructor', {
+ value: constructor,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
}

function extend(parent, definition) {
28 changes: 28 additions & 0 deletions patches/express+4.17.1.patch
@@ -0,0 +1,28 @@
diff --git a/node_modules/express/lib/router/index.js b/node_modules/express/lib/router/index.js
index 69e6d38..085e61e 100644
--- a/node_modules/express/lib/router/index.js
+++ b/node_modules/express/lib/router/index.js
@@ -504,12 +504,17 @@ proto.route = function route(path) {
};

// create Router#VERB functions
-methods.concat('all').forEach(function(method){
- proto[method] = function(path){
- var route = this.route(path)
- route[method].apply(route, slice.call(arguments, 1));
- return this;
- };
+methods.concat('all').forEach(function (method) {
+ Object.defineProperty(proto, method, {
+ value: function (path) {
+ var route = this.route(path)
+ route[method].apply(route, slice.call(arguments, 1));
+ return this;
+ },
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
});

// append methods to a list of methods
40 changes: 40 additions & 0 deletions patches/external-editor+3.1.0.patch
@@ -0,0 +1,40 @@
diff --git a/node_modules/external-editor/main/errors/CreateFileError.js b/node_modules/external-editor/main/errors/CreateFileError.js
index 7faa34c..7b49f68 100644
--- a/node_modules/external-editor/main/errors/CreateFileError.js
+++ b/node_modules/external-editor/main/errors/CreateFileError.js
@@ -14,7 +14,14 @@ var __extends = (this && this.__extends) || (function () {
};
return function (d, b) {
extendStatics(d, b);
- function __() { this.constructor = d; }
+ function __() {
+ Object.defineProperty(this, 'constructor', {
+ value: d,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
diff --git a/node_modules/external-editor/main/errors/LaunchEditorError.js b/node_modules/external-editor/main/errors/LaunchEditorError.js
index 85a164e..217f192 100644
--- a/node_modules/external-editor/main/errors/LaunchEditorError.js
+++ b/node_modules/external-editor/main/errors/LaunchEditorError.js
@@ -14,7 +14,14 @@ var __extends = (this && this.__extends) || (function () {
};
return function (d, b) {
extendStatics(d, b);
- function __() { this.constructor = d; }
+ function __() {
+ Object.defineProperty(this, 'constructor', {
+ value: d,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
erights marked this conversation as resolved.
Show resolved Hide resolved
};
})();
43 changes: 43 additions & 0 deletions patches/node-fetch+2.6.1.patch
@@ -0,0 +1,43 @@
diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js
index 4b241bf..c5f1165 100644
--- a/node_modules/node-fetch/lib/index.js
+++ b/node_modules/node-fetch/lib/index.js
@@ -153,9 +153,23 @@ function FetchError(message, type, systemError) {
Error.captureStackTrace(this, this.constructor);
}

-FetchError.prototype = Object.create(Error.prototype);
-FetchError.prototype.constructor = FetchError;
-FetchError.prototype.name = 'FetchError';
erights marked this conversation as resolved.
Show resolved Hide resolved
+function makeErrorish(errorConstructor, name) {
+ errorConstructor.prototype = Object.create(Error.prototype, {
+ constructor: {
+ value: errorConstructor,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ name: {
+ value: name,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ });
+}
+makeErrorish(FetchError, 'FetchError');

let convert;
try {
@@ -1378,10 +1392,7 @@ function AbortError(message) {
// hide custom error implementation details from end-users
Error.captureStackTrace(this, this.constructor);
}
-
-AbortError.prototype = Object.create(Error.prototype);
-AbortError.prototype.constructor = AbortError;
-AbortError.prototype.name = 'AbortError';
+makeErrorish(AbortError, 'AbortError');

// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
const PassThrough$1 = Stream.PassThrough;
56 changes: 56 additions & 0 deletions patches/vega-util+1.16.0.patch
@@ -0,0 +1,56 @@
diff --git a/node_modules/vega-util/build/vega-util.js b/node_modules/vega-util/build/vega-util.js
index 0b40c91..bd0a2e4 100644
--- a/node_modules/vega-util/build/vega-util.js
+++ b/node_modules/vega-util/build/vega-util.js
@@ -611,7 +611,12 @@

function inherits (child, parent, members) {
const proto = child.prototype = Object.create(parent.prototype);
- proto.constructor = child;
+ Object.defineProperty(proto, 'constructor', {
+ value: child,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
return extend(proto, members);
}

@@ -859,7 +864,6 @@
exports.fastmap = fastmap;
exports.field = field;
exports.flush = flush;
- exports.hasOwnProperty = has;
exports.id = id;
exports.identity = identity;
exports.inherits = inherits;
@@ -895,7 +899,6 @@
exports.toDate = toDate;
exports.toNumber = toNumber;
exports.toSet = toSet;
- exports.toString = toString;
exports.truncate = truncate;
exports.truthy = truthy;
exports.utcquarter = utcquarter;
@@ -907,6 +910,21 @@
exports.zoomPow = zoomPow;
exports.zoomSymlog = zoomSymlog;

+ Object.defineProperties(exports, {
+ hasOwnProperty: {
+ value: has,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ toString: {
+ value: toString,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ }
+ });
+
Object.defineProperty(exports, '__esModule', { value: true });

})));