Skip to content

Commit

Permalink
5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Oct 10, 2023
1 parent add5727 commit c393b51
Show file tree
Hide file tree
Showing 27 changed files with 1,476 additions and 1,419 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

## X.X.X (comming soon)

## 5.4.0 (10 October 2023)

- FIX import of `p-queue` throws `is not a constructor`

## 5.3.0 (18 August 2023)
Expand Down
6 changes: 2 additions & 4 deletions dist/es5node/broadcast-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ var _options = require("./options.js");
* Contains all open channels,
* used in tests to ensure everything is closed.
*/
var OPEN_BROADCAST_CHANNELS = new Set();
exports.OPEN_BROADCAST_CHANNELS = OPEN_BROADCAST_CHANNELS;
var OPEN_BROADCAST_CHANNELS = exports.OPEN_BROADCAST_CHANNELS = new Set();
var lastId = 0;
var BroadcastChannel = function BroadcastChannel(name, options) {
var BroadcastChannel = exports.BroadcastChannel = function BroadcastChannel(name, options) {
// identifier of the channel to debug stuff
this.id = lastId++;
OPEN_BROADCAST_CHANNELS.add(this);
Expand Down Expand Up @@ -73,7 +72,6 @@ var BroadcastChannel = function BroadcastChannel(name, options) {
* window.BroadcastChannel with this
* See methods/native.js
*/
exports.BroadcastChannel = BroadcastChannel;
BroadcastChannel._pubkey = true;

/**
Expand Down
3 changes: 1 addition & 2 deletions dist/es5node/leader-election-web-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var _leaderElectionUtil = require("./leader-election-util.js");
* A faster version of the leader elector that uses the WebLock API
* @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API
*/
var LeaderElectionWebLock = function LeaderElectionWebLock(broadcastChannel, options) {
var LeaderElectionWebLock = exports.LeaderElectionWebLock = function LeaderElectionWebLock(broadcastChannel, options) {
var _this = this;
this.broadcastChannel = broadcastChannel;
broadcastChannel._befC.push(function () {
Expand All @@ -30,7 +30,6 @@ var LeaderElectionWebLock = function LeaderElectionWebLock(broadcastChannel, opt
// lock name
this.lN = 'pubkey-bc||' + broadcastChannel.method.type + '||' + broadcastChannel.name;
};
exports.LeaderElectionWebLock = LeaderElectionWebLock;
LeaderElectionWebLock.prototype = {
hasLeader: function hasLeader() {
var _this2 = this;
Expand Down
14 changes: 5 additions & 9 deletions dist/es5node/methods/indexed-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,18 @@ var _options = require("../options.js");
* @link https://rxdb.info/slow-indexeddb.html
*/

var microSeconds = _util.microSeconds;
exports.microSeconds = microSeconds;
var microSeconds = exports.microSeconds = _util.microSeconds;
var DB_PREFIX = 'pubkey.broadcast-channel-0-';
var OBJECT_STORE_ID = 'messages';

/**
* Use relaxed durability for faster performance on all transactions.
* @link https://nolanlawson.com/2021/08/22/speeding-up-indexeddb-reads-and-writes/
*/
var TRANSACTION_SETTINGS = {
var TRANSACTION_SETTINGS = exports.TRANSACTION_SETTINGS = {
durability: 'relaxed'
};
exports.TRANSACTION_SETTINGS = TRANSACTION_SETTINGS;
var type = 'idb';
exports.type = type;
var type = exports.type = 'idb';
function getIdb() {
if (typeof indexedDB !== 'undefined') return indexedDB;
if (typeof window !== 'undefined') {
Expand Down Expand Up @@ -359,7 +356,7 @@ function canBeUsed() {
function averageResponseTime(options) {
return options.idb.fallbackInterval * 2;
}
var IndexedDBMethod = {
var IndexedDBMethod = exports.IndexedDBMethod = {
create: create,
close: close,
onMessage: onMessage,
Expand All @@ -368,5 +365,4 @@ var IndexedDBMethod = {
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};
exports.IndexedDBMethod = IndexedDBMethod;
};
11 changes: 4 additions & 7 deletions dist/es5node/methods/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ var _util = require("../util.js");
* @link https://caniuse.com/#feat=indexeddb
*/

var microSeconds = _util.microSeconds;
exports.microSeconds = microSeconds;
var microSeconds = exports.microSeconds = _util.microSeconds;
var KEY_PREFIX = 'pubkey.broadcastChannel-';
var type = 'localstorage';
var type = exports.type = 'localstorage';

/**
* copied from crosstab
* @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32
*/
exports.type = type;
function getLocalStorage() {
var localStorage;
if (typeof window === 'undefined') return null;
Expand Down Expand Up @@ -159,7 +157,7 @@ function averageResponseTime() {
}
return defaultTime;
}
var LocalstorageMethod = {
var LocalstorageMethod = exports.LocalstorageMethod = {
create: create,
close: close,
onMessage: onMessage,
Expand All @@ -168,5 +166,4 @@ var LocalstorageMethod = {
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};
exports.LocalstorageMethod = LocalstorageMethod;
};
11 changes: 4 additions & 7 deletions dist/es5node/methods/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ exports.onMessage = onMessage;
exports.postMessage = postMessage;
exports.type = void 0;
var _util = require("../util.js");
var microSeconds = _util.microSeconds;
exports.microSeconds = microSeconds;
var type = 'native';
exports.type = type;
var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'native';
function create(channelName) {
var state = {
messagesCallback: null,
Expand Down Expand Up @@ -59,7 +57,7 @@ function canBeUsed() {
function averageResponseTime() {
return 150;
}
var NativeMethod = {
var NativeMethod = exports.NativeMethod = {
create: create,
close: close,
onMessage: onMessage,
Expand All @@ -68,5 +66,4 @@ var NativeMethod = {
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};
exports.NativeMethod = NativeMethod;
};
9 changes: 4 additions & 5 deletions dist/es5node/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var _obliviousSet = require("oblivious-set");
* The ipc is handled via sockets and file-writes to the tmp-folder
*/

var PQueueConstructor = _pQueue["default"]["default"] ? _pQueue["default"]["default"] : _pQueue["default"];
/**
* windows sucks, so we have handle windows-type of socket-paths
* @link https://gist.github.com/domenic/2790533#gistcomment-331356
Expand Down Expand Up @@ -105,8 +106,7 @@ var removeDir = /*#__PURE__*/function () {
}();
var OTHER_INSTANCES = {};
var TMP_FOLDER_NAME = 'pubkey.bc';
var TMP_FOLDER_BASE = _path["default"].join(_os["default"].tmpdir(), TMP_FOLDER_NAME);
exports.TMP_FOLDER_BASE = TMP_FOLDER_BASE;
var TMP_FOLDER_BASE = exports.TMP_FOLDER_BASE = _path["default"].join(_os["default"].tmpdir(), TMP_FOLDER_NAME);
var getPathsCache = new Map();
function getPaths(channelName) {
if (!getPathsCache.has(channelName)) {
Expand Down Expand Up @@ -587,13 +587,12 @@ function _cleanOldMessages() {
}));
return _cleanOldMessages.apply(this, arguments);
}
var type = 'node';
var type = exports.type = 'node';

/**
* creates a new channelState
* @return {Promise<any>}
*/
exports.type = type;
function create(_x20) {
return _create.apply(this, arguments);
}
Expand Down Expand Up @@ -631,7 +630,7 @@ function _create() {
* which could throw an error.
* Must always be smaller than options.node.maxParallelWrites
*/
writeFileQueue: new _pQueue["default"]({
writeFileQueue: new PQueueConstructor({
concurrency: options.node.maxParallelWrites
}),
messagesCallbackTime: null,
Expand Down
11 changes: 4 additions & 7 deletions dist/es5node/methods/simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ exports.onMessage = onMessage;
exports.postMessage = postMessage;
exports.type = void 0;
var _util = require("../util.js");
var microSeconds = _util.microSeconds;
exports.microSeconds = microSeconds;
var type = 'simulate';
exports.type = type;
var microSeconds = exports.microSeconds = _util.microSeconds;
var type = exports.type = 'simulate';
var SIMULATE_CHANNELS = new Set();
function create(channelName) {
var state = {
Expand Down Expand Up @@ -55,7 +53,7 @@ function canBeUsed() {
function averageResponseTime() {
return 5;
}
var SimulateMethod = {
var SimulateMethod = exports.SimulateMethod = {
create: create,
close: close,
onMessage: onMessage,
Expand All @@ -64,5 +62,4 @@ var SimulateMethod = {
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};
exports.SimulateMethod = SimulateMethod;
};
9 changes: 3 additions & 6 deletions dist/es5node/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ exports.supportsWebLockAPI = supportsWebLockAPI;
function isPromise(obj) {
return obj && typeof obj.then === 'function';
}
var PROMISE_RESOLVED_FALSE = Promise.resolve(false);
exports.PROMISE_RESOLVED_FALSE = PROMISE_RESOLVED_FALSE;
var PROMISE_RESOLVED_TRUE = Promise.resolve(true);
exports.PROMISE_RESOLVED_TRUE = PROMISE_RESOLVED_TRUE;
var PROMISE_RESOLVED_VOID = Promise.resolve();
exports.PROMISE_RESOLVED_VOID = PROMISE_RESOLVED_VOID;
var PROMISE_RESOLVED_FALSE = exports.PROMISE_RESOLVED_FALSE = Promise.resolve(false);
var PROMISE_RESOLVED_TRUE = exports.PROMISE_RESOLVED_TRUE = Promise.resolve(true);
var PROMISE_RESOLVED_VOID = exports.PROMISE_RESOLVED_VOID = Promise.resolve();
function sleep(time, resolveWith) {
if (!time) time = 0;
return new Promise(function (res) {
Expand Down
3 changes: 2 additions & 1 deletion dist/esbrowser/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import events from 'events';
import net from 'net';
import path from 'path';
import PQueue from 'p-queue';
var PQueueConstructor = PQueue["default"] ? PQueue["default"] : PQueue;
import { add as unloadAdd } from 'unload';
import { fillOptionsWithDefaults } from '../options.js';
import { randomInt, randomToken, PROMISE_RESOLVED_VOID } from '../util.js';
Expand Down Expand Up @@ -596,7 +597,7 @@ function _create() {
* which could throw an error.
* Must always be smaller than options.node.maxParallelWrites
*/
writeFileQueue: new PQueue({
writeFileQueue: new PQueueConstructor({
concurrency: options.node.maxParallelWrites
}),
messagesCallbackTime: null,
Expand Down
3 changes: 2 additions & 1 deletion dist/esnode/methods/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import events from 'events';
import net from 'net';
import path from 'path';
import PQueue from 'p-queue';
var PQueueConstructor = PQueue["default"] ? PQueue["default"] : PQueue;
import { add as unloadAdd } from 'unload';
import { fillOptionsWithDefaults } from '../options.js';
import { randomInt, randomToken, PROMISE_RESOLVED_VOID } from '../util.js';
Expand Down Expand Up @@ -596,7 +597,7 @@ function _create() {
* which could throw an error.
* Must always be smaller than options.node.maxParallelWrites
*/
writeFileQueue: new PQueue({
writeFileQueue: new PQueueConstructor({
concurrency: options.node.maxParallelWrites
}),
messagesCallbackTime: null,
Expand Down
6 changes: 2 additions & 4 deletions dist/lib/broadcast-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ var _options = require("./options.js");
* Contains all open channels,
* used in tests to ensure everything is closed.
*/
var OPEN_BROADCAST_CHANNELS = new Set();
exports.OPEN_BROADCAST_CHANNELS = OPEN_BROADCAST_CHANNELS;
var OPEN_BROADCAST_CHANNELS = exports.OPEN_BROADCAST_CHANNELS = new Set();
var lastId = 0;
var BroadcastChannel = function BroadcastChannel(name, options) {
var BroadcastChannel = exports.BroadcastChannel = function BroadcastChannel(name, options) {
// identifier of the channel to debug stuff
this.id = lastId++;
OPEN_BROADCAST_CHANNELS.add(this);
Expand Down Expand Up @@ -73,7 +72,6 @@ var BroadcastChannel = function BroadcastChannel(name, options) {
* window.BroadcastChannel with this
* See methods/native.js
*/
exports.BroadcastChannel = BroadcastChannel;
BroadcastChannel._pubkey = true;

/**
Expand Down
Loading

0 comments on commit c393b51

Please sign in to comment.