@leofcoin/peernet 1.1.72 → 1.1.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,187 @@
1
+ import { g as getDefaultExportFromCjs } from './peernet-w0f2V8kl.js';
2
+
3
+ var global;
4
+ var hasRequiredGlobal;
5
+
6
+ function requireGlobal () {
7
+ if (hasRequiredGlobal) return global;
8
+ hasRequiredGlobal = 1;
9
+ var naiveFallback = function () {
10
+ if (typeof self === "object" && self) return self;
11
+ if (typeof window === "object" && window) return window;
12
+ throw new Error("Unable to resolve global `this`");
13
+ };
14
+
15
+ global = (function () {
16
+ if (this) return this;
17
+
18
+ // Unexpected strict mode (may happen if e.g. bundled into ESM module)
19
+
20
+ // Fallback to standard globalThis if available
21
+ if (typeof globalThis === "object" && globalThis) return globalThis;
22
+
23
+ // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
24
+ // In all ES5+ engines global object inherits from Object.prototype
25
+ // (if you approached one that doesn't please report)
26
+ try {
27
+ Object.defineProperty(Object.prototype, "__global__", {
28
+ get: function () { return this; },
29
+ configurable: true
30
+ });
31
+ } catch (error) {
32
+ // Unfortunate case of updates to Object.prototype being restricted
33
+ // via preventExtensions, seal or freeze
34
+ return naiveFallback();
35
+ }
36
+ try {
37
+ // Safari case (window.__global__ works, but __global__ does not)
38
+ if (!__global__) return naiveFallback();
39
+ return __global__;
40
+ } finally {
41
+ delete Object.prototype.__global__;
42
+ }
43
+ })();
44
+ return global;
45
+ }
46
+
47
+ var name = "websocket";
48
+ var description = "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.";
49
+ var keywords = [
50
+ "websocket",
51
+ "websockets",
52
+ "socket",
53
+ "networking",
54
+ "comet",
55
+ "push",
56
+ "RFC-6455",
57
+ "realtime",
58
+ "server",
59
+ "client"
60
+ ];
61
+ var author = "Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)";
62
+ var contributors = [
63
+ "Iñaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"
64
+ ];
65
+ var version$1 = "1.0.34";
66
+ var repository = {
67
+ type: "git",
68
+ url: "https://github.com/theturtle32/WebSocket-Node.git"
69
+ };
70
+ var homepage = "https://github.com/theturtle32/WebSocket-Node";
71
+ var engines = {
72
+ node: ">=4.0.0"
73
+ };
74
+ var dependencies = {
75
+ bufferutil: "^4.0.1",
76
+ debug: "^2.2.0",
77
+ "es5-ext": "^0.10.50",
78
+ "typedarray-to-buffer": "^3.1.5",
79
+ "utf-8-validate": "^5.0.2",
80
+ yaeti: "^0.0.6"
81
+ };
82
+ var devDependencies = {
83
+ "buffer-equal": "^1.0.0",
84
+ gulp: "^4.0.2",
85
+ "gulp-jshint": "^2.0.4",
86
+ "jshint-stylish": "^2.2.1",
87
+ jshint: "^2.0.0",
88
+ tape: "^4.9.1"
89
+ };
90
+ var config = {
91
+ verbose: false
92
+ };
93
+ var scripts = {
94
+ test: "tape test/unit/*.js",
95
+ gulp: "gulp"
96
+ };
97
+ var main = "index";
98
+ var directories = {
99
+ lib: "./lib"
100
+ };
101
+ var browser$3 = "lib/browser.js";
102
+ var license = "Apache-2.0";
103
+ var require$$0 = {
104
+ name: name,
105
+ description: description,
106
+ keywords: keywords,
107
+ author: author,
108
+ contributors: contributors,
109
+ version: version$1,
110
+ repository: repository,
111
+ homepage: homepage,
112
+ engines: engines,
113
+ dependencies: dependencies,
114
+ devDependencies: devDependencies,
115
+ config: config,
116
+ scripts: scripts,
117
+ main: main,
118
+ directories: directories,
119
+ browser: browser$3,
120
+ license: license
121
+ };
122
+
123
+ var version = require$$0.version;
124
+
125
+ var _globalThis;
126
+ if (typeof globalThis === 'object') {
127
+ _globalThis = globalThis;
128
+ } else {
129
+ try {
130
+ _globalThis = requireGlobal();
131
+ } catch (error) {
132
+ } finally {
133
+ if (!_globalThis && typeof window !== 'undefined') { _globalThis = window; }
134
+ if (!_globalThis) { throw new Error('Could not determine global this'); }
135
+ }
136
+ }
137
+
138
+ var NativeWebSocket = _globalThis.WebSocket || _globalThis.MozWebSocket;
139
+ var websocket_version = version;
140
+
141
+
142
+ /**
143
+ * Expose a W3C WebSocket class with just one or two arguments.
144
+ */
145
+ function W3CWebSocket(uri, protocols) {
146
+ var native_instance;
147
+
148
+ if (protocols) {
149
+ native_instance = new NativeWebSocket(uri, protocols);
150
+ }
151
+ else {
152
+ native_instance = new NativeWebSocket(uri);
153
+ }
154
+
155
+ /**
156
+ * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket
157
+ * class). Since it is an Object it will be returned as it is when creating an
158
+ * instance of W3CWebSocket via 'new W3CWebSocket()'.
159
+ *
160
+ * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2
161
+ */
162
+ return native_instance;
163
+ }
164
+ if (NativeWebSocket) {
165
+ ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'].forEach(function(prop) {
166
+ Object.defineProperty(W3CWebSocket, prop, {
167
+ get: function() { return NativeWebSocket[prop]; }
168
+ });
169
+ });
170
+ }
171
+
172
+ /**
173
+ * Module exports.
174
+ */
175
+ var browser = {
176
+ 'w3cwebsocket' : NativeWebSocket ? W3CWebSocket : null,
177
+ 'version' : websocket_version
178
+ };
179
+
180
+ var browser$1 = /*@__PURE__*/getDefaultExportFromCjs(browser);
181
+
182
+ var browser$2 = /*#__PURE__*/Object.freeze({
183
+ __proto__: null,
184
+ default: browser$1
185
+ });
186
+
187
+ export { browser$2 as b };
@@ -1,4 +1,4 @@
1
- import { K as KeyPath, a as KeyValue } from './value-4e80eeeb.js';
1
+ import { K as KeyPath, a as KeyValue } from './value-wzPYMxsX.js';
2
2
 
3
3
  const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
4
4
 
@@ -24,9 +24,7 @@ function getCursorAdvanceMethods() {
24
24
  IDBCursor.prototype.continuePrimaryKey,
25
25
  ]));
26
26
  }
27
- const cursorRequestMap = new WeakMap();
28
27
  const transactionDoneMap = new WeakMap();
29
- const transactionStoreNamesMap = new WeakMap();
30
28
  const transformCache = new WeakMap();
31
29
  const reverseTransformCache = new WeakMap();
32
30
  function promisifyRequest(request) {
@@ -46,16 +44,6 @@ function promisifyRequest(request) {
46
44
  request.addEventListener('success', success);
47
45
  request.addEventListener('error', error);
48
46
  });
49
- promise
50
- .then((value) => {
51
- // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval
52
- // (see wrapFunction).
53
- if (value instanceof IDBCursor) {
54
- cursorRequestMap.set(value, request);
55
- }
56
- // Catching to avoid "Uncaught Promise exceptions"
57
- })
58
- .catch(() => { });
59
47
  // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This
60
48
  // is because we create many promises from a single IDBRequest.
61
49
  reverseTransformCache.set(promise, request);
@@ -92,10 +80,6 @@ let idbProxyTraps = {
92
80
  // Special handling for transaction.done.
93
81
  if (prop === 'done')
94
82
  return transactionDoneMap.get(target);
95
- // Polyfill for objectStoreNames because of Edge.
96
- if (prop === 'objectStoreNames') {
97
- return target.objectStoreNames || transactionStoreNamesMap.get(target);
98
- }
99
83
  // Make tx.store return the only store in the transaction, or undefined if there are many.
100
84
  if (prop === 'store') {
101
85
  return receiver.objectStoreNames[1]
@@ -124,15 +108,6 @@ function replaceTraps(callback) {
124
108
  function wrapFunction(func) {
125
109
  // Due to expected object equality (which is enforced by the caching in `wrap`), we
126
110
  // only create one new func per func.
127
- // Edge doesn't support objectStoreNames (booo), so we polyfill it here.
128
- if (func === IDBDatabase.prototype.transaction &&
129
- !('objectStoreNames' in IDBTransaction.prototype)) {
130
- return function (storeNames, ...args) {
131
- const tx = func.call(unwrap(this), storeNames, ...args);
132
- transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);
133
- return wrap(tx);
134
- };
135
- }
136
111
  // Cursor methods are special, as the behaviour is a little more different to standard IDB. In
137
112
  // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the
138
113
  // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense
@@ -143,7 +118,7 @@ function wrapFunction(func) {
143
118
  // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use
144
119
  // the original object.
145
120
  func.apply(unwrap(this), args);
146
- return wrap(cursorRequestMap.get(this));
121
+ return wrap(this.request);
147
122
  };
148
123
  }
149
124
  return function (...args) {