@jbrowse/core 1.5.1 → 1.5.5
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.
- package/BaseFeatureWidget/BaseFeatureDetail.d.ts +4 -2
- package/BaseFeatureWidget/BaseFeatureDetail.js +43 -16
- package/BaseFeatureWidget/SequenceFeatureDetails.js +5 -4
- package/BaseFeatureWidget/index.js +1 -1
- package/BaseFeatureWidget/util.js +5 -5
- package/PluginLoader.d.ts +25 -2
- package/PluginLoader.js +334 -47
- package/PluginManager.d.ts +6 -5
- package/PluginManager.js +1 -5
- package/ReExports/list.js +1 -1
- package/ReExports/material-ui-colors.js +38 -38
- package/ReExports/modules.d.ts +2 -0
- package/ReExports/modules.js +3 -0
- package/TextSearch/BaseResults.js +1 -1
- package/TextSearch/TextSearchManager.d.ts +1 -1
- package/TextSearch/TextSearchManager.js +0 -2
- package/assemblyManager/assembly.js +5 -3
- package/assemblyManager/index.js +4 -4
- package/configuration/configurationSchema.js +6 -4
- package/configuration/configurationSlot.js +3 -1
- package/configuration/index.js +4 -4
- package/configuration/util.js +2 -2
- package/data_adapters/BaseAdapter.d.ts +5 -5
- package/data_adapters/BaseAdapter.js +9 -18
- package/data_adapters/CytobandAdapter.js +4 -2
- package/data_adapters/dataAdapterCache.js +2 -2
- package/package.json +9 -8
- package/pluggableElementTypes/AdapterType.js +3 -1
- package/pluggableElementTypes/ConnectionType.js +3 -1
- package/pluggableElementTypes/DisplayType.js +3 -1
- package/pluggableElementTypes/InternetAccountType.js +3 -1
- package/pluggableElementTypes/PluggableElementBase.js +4 -3
- package/pluggableElementTypes/RpcMethodType.js +2 -4
- package/pluggableElementTypes/TextSearchAdapterType.js +3 -1
- package/pluggableElementTypes/WidgetType.js +3 -1
- package/pluggableElementTypes/index.d.ts +2 -1
- package/pluggableElementTypes/index.js +37 -14
- package/pluggableElementTypes/models/BaseDisplayModel.js +2 -2
- package/pluggableElementTypes/models/BaseTrackModel.js +4 -3
- package/pluggableElementTypes/models/BaseViewModel.js +6 -2
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +2 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +2 -2
- package/pluggableElementTypes/models/index.js +14 -14
- package/pluggableElementTypes/renderers/BoxRendererType.js +3 -3
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +3 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/FeatureRendererType.js +4 -4
- package/pluggableElementTypes/renderers/RendererType.js +3 -1
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +2 -2
- package/pluggableElementTypes/renderers/index.d.ts +2 -1
- package/rpc/BaseRpcDriver.d.ts +1 -1
- package/rpc/BaseRpcDriver.js +3 -5
- package/rpc/BaseRpcDriver.test.js +1 -1
- package/rpc/RpcManager.d.ts +3 -3
- package/rpc/RpcManager.js +44 -22
- package/rpc/WebWorkerRpcDriver.d.ts +2 -2
- package/rpc/WebWorkerRpcDriver.js +5 -7
- package/rpc/coreRpcMethods.js +3 -3
- package/rpc/remoteAbortSignals.js +2 -2
- package/ui/App.js +2 -0
- package/ui/DrawerWidget.js +1 -0
- package/ui/EditableTypography.js +2 -2
- package/ui/FileSelector/FileSelector.js +2 -2
- package/ui/Icons.js +4 -4
- package/ui/Logo.js +1 -1
- package/ui/Menu.js +2 -2
- package/ui/NewSessionCards.js +2 -2
- package/ui/PrerenderedCanvas.d.ts +1 -0
- package/ui/PrerenderedCanvas.js +6 -3
- package/ui/SanitizedHTML.js +1 -1
- package/ui/SnackbarModel.d.ts +16 -0
- package/ui/SnackbarModel.js +56 -0
- package/ui/ViewContainer.js +4 -3
- package/ui/index.js +24 -24
- package/ui/theme.js +7 -5
- package/util/Base1DViewModel.js +2 -2
- package/util/aborting.js +7 -4
- package/util/blockTypes.js +8 -11
- package/util/calculateDynamicBlocks.test.js +2 -2
- package/util/color/cssColorsLevel4.js +1 -1
- package/util/color/index.js +5 -5
- package/util/compositeMap.js +3 -11
- package/util/index.d.ts +2 -1
- package/util/index.js +63 -36
- package/util/index.test.js +2 -2
- package/util/io/RemoteFileWithRangeCache.js +3 -3
- package/util/io/index.js +1 -1
- package/util/jexl.js +4 -1
- package/util/layouts/BaseLayout.d.ts +3 -0
- package/util/layouts/GranularRectLayout.d.ts +19 -10
- package/util/layouts/GranularRectLayout.js +459 -100
- package/util/layouts/GranularRectLayout.test.js +57 -10
- package/util/layouts/MultiLayout.d.ts +1 -1
- package/util/layouts/MultiLayout.js +0 -2
- package/util/layouts/PrecomputedLayout.js +2 -1
- package/util/layouts/PrecomputedMultiLayout.js +5 -3
- package/util/layouts/SceneGraph.d.ts +3 -3
- package/util/layouts/SceneGraph.js +0 -14
- package/util/layouts/index.d.ts +7 -0
- package/util/layouts/index.js +68 -0
- package/util/mst-reflection.d.ts +3 -3
- package/util/mst-reflection.js +3 -3
- package/util/offscreenCanvasPonyfill.js +1 -1
- package/util/range.js +1 -1
- package/util/simpleFeature.js +3 -3
- package/util/stats.js +4 -4
- package/util/tracks.js +10 -10
- package/util/types/index.d.ts +9 -1
- package/util/types/index.js +14 -19
- package/util/types/mst.js +3 -3
package/PluginLoader.js
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.default = exports.PluginSourceConfigurationSchema = void 0;
|
|
11
|
+
exports.isCJSPluginDefinition = isCJSPluginDefinition;
|
|
12
|
+
exports.isESMPluginDefinition = isESMPluginDefinition;
|
|
13
|
+
exports.isUMDPluginDefinition = isUMDPluginDefinition;
|
|
9
14
|
|
|
10
15
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
16
|
|
|
12
17
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
18
|
|
|
14
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
19
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
20
|
|
|
18
21
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -21,13 +24,22 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
21
24
|
|
|
22
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
26
|
|
|
27
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
28
|
+
|
|
24
29
|
var _loadScript = _interopRequireDefault(require("load-script2"));
|
|
25
30
|
|
|
31
|
+
var _sanitizeFilename = _interopRequireDefault(require("sanitize-filename"));
|
|
32
|
+
|
|
26
33
|
var _configuration = require("./configuration");
|
|
27
34
|
|
|
28
35
|
var _ReExports = _interopRequireDefault(require("./ReExports"));
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
var _util = require("./util");
|
|
38
|
+
|
|
39
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
|
+
|
|
41
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
42
|
+
|
|
31
43
|
var PluginSourceConfigurationSchema = (0, _configuration.ConfigurationSchema)('PluginSource', {
|
|
32
44
|
name: {
|
|
33
45
|
type: 'string',
|
|
@@ -40,6 +52,32 @@ var PluginSourceConfigurationSchema = (0, _configuration.ConfigurationSchema)('P
|
|
|
40
52
|
});
|
|
41
53
|
exports.PluginSourceConfigurationSchema = PluginSourceConfigurationSchema;
|
|
42
54
|
|
|
55
|
+
function isUMDPluginDefinition(pluginDefinition) {
|
|
56
|
+
return (pluginDefinition.umdUrl !== undefined || pluginDefinition.url !== undefined) && pluginDefinition.name !== undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isESMPluginDefinition(pluginDefinition) {
|
|
60
|
+
return pluginDefinition.esmUrl !== undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isCJSPluginDefinition(pluginDefinition) {
|
|
64
|
+
return pluginDefinition.cjsUrl !== undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function getGlobalObject() {
|
|
68
|
+
// Based on window-or-global
|
|
69
|
+
// https://github.com/purposeindustries/window-or-global/blob/322abc71de0010c9e5d9d0729df40959e1ef8775/lib/index.js
|
|
70
|
+
return (
|
|
71
|
+
/* eslint-disable-next-line no-restricted-globals */
|
|
72
|
+
(typeof self === "undefined" ? "undefined" : (0, _typeof2.default)(self)) === 'object' && self.self === self && self || (typeof global === "undefined" ? "undefined" : (0, _typeof2.default)(global)) === 'object' && global.global === global && global || // @ts-ignore
|
|
73
|
+
this
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function isInWebWorker(globalObject) {
|
|
78
|
+
return Boolean('WorkerGlobalScope' in globalObject);
|
|
79
|
+
}
|
|
80
|
+
|
|
43
81
|
var PluginLoader = /*#__PURE__*/function () {
|
|
44
82
|
function PluginLoader() {
|
|
45
83
|
var pluginDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -51,19 +89,18 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
51
89
|
(0, _createClass2.default)(PluginLoader, [{
|
|
52
90
|
key: "loadScript",
|
|
53
91
|
value: function loadScript(scriptUrl) {
|
|
54
|
-
var
|
|
92
|
+
var globalObject = getGlobalObject();
|
|
55
93
|
|
|
56
|
-
|
|
57
|
-
if (document && document.getElementsByTagName) {
|
|
94
|
+
if (!isInWebWorker(globalObject)) {
|
|
58
95
|
return (0, _loadScript.default)(scriptUrl);
|
|
59
96
|
} // @ts-ignore
|
|
60
97
|
|
|
61
98
|
|
|
62
|
-
if (
|
|
99
|
+
if (globalObject && globalObject.importScripts) {
|
|
63
100
|
return new Promise(function (resolve, reject) {
|
|
64
101
|
try {
|
|
65
102
|
// @ts-ignore
|
|
66
|
-
|
|
103
|
+
globalObject.importScripts(scriptUrl);
|
|
67
104
|
} catch (error) {
|
|
68
105
|
reject(error || new Error("failed to load ".concat(scriptUrl)));
|
|
69
106
|
return;
|
|
@@ -76,55 +113,305 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
76
113
|
throw new Error('cannot figure out how to load external JS scripts in this environment');
|
|
77
114
|
}
|
|
78
115
|
}, {
|
|
79
|
-
key: "
|
|
116
|
+
key: "loadCJSPlugin",
|
|
80
117
|
value: function () {
|
|
81
|
-
var
|
|
82
|
-
var parsedUrl,
|
|
118
|
+
var _loadCJSPlugin = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pluginDefinition) {
|
|
119
|
+
var parsedUrl, fs, path, os, http, fsPromises, systemTmp, tmpDir, plugin, pluginLocation, pluginLocationRelative, pluginDownload;
|
|
83
120
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
84
121
|
while (1) {
|
|
85
122
|
switch (_context.prev = _context.next) {
|
|
86
123
|
case 0:
|
|
87
|
-
|
|
124
|
+
_context.prev = 0;
|
|
125
|
+
parsedUrl = new URL(pluginDefinition.cjsUrl, getGlobalObject().location.href);
|
|
126
|
+
_context.next = 8;
|
|
127
|
+
break;
|
|
88
128
|
|
|
89
|
-
|
|
90
|
-
|
|
129
|
+
case 4:
|
|
130
|
+
_context.prev = 4;
|
|
131
|
+
_context.t0 = _context["catch"](0);
|
|
132
|
+
console.error(_context.t0);
|
|
133
|
+
throw new Error("Error parsing URL: ".concat(pluginDefinition.cjsUrl));
|
|
134
|
+
|
|
135
|
+
case 8:
|
|
136
|
+
if (!(parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:')) {
|
|
137
|
+
_context.next = 10;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
throw new Error("cannot load plugins using protocol \"".concat(parsedUrl.protocol, "\""));
|
|
142
|
+
|
|
143
|
+
case 10:
|
|
144
|
+
fs = require('fs');
|
|
145
|
+
path = require('path');
|
|
146
|
+
os = require('os');
|
|
147
|
+
http = require('http');
|
|
148
|
+
fsPromises = fs.promises; // On macOS `os.tmpdir()` returns the path to a symlink, see:
|
|
149
|
+
// https://github.com/nodejs/node/issues/11422
|
|
150
|
+
|
|
151
|
+
_context.next = 17;
|
|
152
|
+
return fsPromises.realpath(os.tmpdir());
|
|
153
|
+
|
|
154
|
+
case 17:
|
|
155
|
+
systemTmp = _context.sent;
|
|
156
|
+
_context.next = 20;
|
|
157
|
+
return fsPromises.mkdtemp(path.join(systemTmp, 'jbrowse-plugin-'));
|
|
158
|
+
|
|
159
|
+
case 20:
|
|
160
|
+
tmpDir = _context.sent;
|
|
161
|
+
plugin = undefined;
|
|
162
|
+
_context.prev = 22;
|
|
163
|
+
pluginLocation = path.join(tmpDir, (0, _sanitizeFilename.default)(parsedUrl.href));
|
|
164
|
+
pluginLocationRelative = path.relative('.', pluginLocation);
|
|
165
|
+
pluginDownload = new Promise(function (resolve, reject) {
|
|
166
|
+
var file = fs.createWriteStream(pluginLocation);
|
|
167
|
+
http.get(parsedUrl.href, function (response) {
|
|
168
|
+
response.pipe(file);
|
|
169
|
+
file.on('finish', function () {
|
|
170
|
+
resolve();
|
|
171
|
+
});
|
|
172
|
+
}).on('error', function (err) {
|
|
173
|
+
fs.unlinkSync(pluginLocation);
|
|
174
|
+
reject(err);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
_context.next = 28;
|
|
178
|
+
return pluginDownload;
|
|
179
|
+
|
|
180
|
+
case 28:
|
|
181
|
+
plugin = __non_webpack_require__(pluginLocationRelative);
|
|
182
|
+
|
|
183
|
+
case 29:
|
|
184
|
+
_context.prev = 29;
|
|
185
|
+
fsPromises.rmdir(tmpDir, {
|
|
186
|
+
recursive: true
|
|
187
|
+
});
|
|
188
|
+
return _context.finish(29);
|
|
189
|
+
|
|
190
|
+
case 32:
|
|
191
|
+
if (plugin) {
|
|
192
|
+
_context.next = 34;
|
|
91
193
|
break;
|
|
92
194
|
}
|
|
93
195
|
|
|
94
|
-
|
|
95
|
-
|
|
196
|
+
throw new Error("Could not load CJS plugin: ".concat(parsedUrl));
|
|
197
|
+
|
|
198
|
+
case 34:
|
|
199
|
+
return _context.abrupt("return", plugin);
|
|
200
|
+
|
|
201
|
+
case 35:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context.stop();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}, _callee, null, [[0, 4], [22,, 29, 32]]);
|
|
207
|
+
}));
|
|
208
|
+
|
|
209
|
+
function loadCJSPlugin(_x) {
|
|
210
|
+
return _loadCJSPlugin.apply(this, arguments);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return loadCJSPlugin;
|
|
214
|
+
}()
|
|
215
|
+
}, {
|
|
216
|
+
key: "loadESMPlugin",
|
|
217
|
+
value: function () {
|
|
218
|
+
var _loadESMPlugin = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(pluginDefinition) {
|
|
219
|
+
var parsedUrl, plugin;
|
|
220
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
221
|
+
while (1) {
|
|
222
|
+
switch (_context2.prev = _context2.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
_context2.prev = 0;
|
|
225
|
+
parsedUrl = new URL(pluginDefinition.esmUrl, getGlobalObject().location.href);
|
|
226
|
+
_context2.next = 8;
|
|
227
|
+
break;
|
|
96
228
|
|
|
97
229
|
case 4:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
230
|
+
_context2.prev = 4;
|
|
231
|
+
_context2.t0 = _context2["catch"](0);
|
|
232
|
+
console.error(_context2.t0);
|
|
233
|
+
throw new Error("Error parsing URL: ".concat(pluginDefinition.esmUrl));
|
|
234
|
+
|
|
235
|
+
case 8:
|
|
236
|
+
if (!(parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:')) {
|
|
237
|
+
_context2.next = 10;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
101
240
|
|
|
102
|
-
|
|
241
|
+
throw new Error("cannot load plugins using protocol \"".concat(parsedUrl.protocol, "\""));
|
|
103
242
|
|
|
104
|
-
|
|
243
|
+
case 10:
|
|
244
|
+
_context2.next = 12;
|
|
245
|
+
return Promise.resolve("".concat(
|
|
246
|
+
/* webpackIgnore: true */
|
|
247
|
+
parsedUrl.href)).then(function (s) {
|
|
248
|
+
return _interopRequireWildcard(require(s));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
case 12:
|
|
252
|
+
plugin = _context2.sent;
|
|
105
253
|
|
|
106
254
|
if (plugin) {
|
|
107
|
-
|
|
255
|
+
_context2.next = 15;
|
|
108
256
|
break;
|
|
109
257
|
}
|
|
110
258
|
|
|
111
|
-
throw new Error("
|
|
259
|
+
throw new Error("Could not load ESM plugin: ".concat(parsedUrl));
|
|
112
260
|
|
|
113
|
-
case
|
|
114
|
-
return
|
|
261
|
+
case 15:
|
|
262
|
+
return _context2.abrupt("return", plugin);
|
|
263
|
+
|
|
264
|
+
case 16:
|
|
265
|
+
case "end":
|
|
266
|
+
return _context2.stop();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}, _callee2, null, [[0, 4]]);
|
|
270
|
+
}));
|
|
271
|
+
|
|
272
|
+
function loadESMPlugin(_x2) {
|
|
273
|
+
return _loadESMPlugin.apply(this, arguments);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return loadESMPlugin;
|
|
277
|
+
}()
|
|
278
|
+
}, {
|
|
279
|
+
key: "loadUMDPlugin",
|
|
280
|
+
value: function () {
|
|
281
|
+
var _loadUMDPlugin = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(pluginDefinition) {
|
|
282
|
+
var umdUrl, parsedUrl, moduleName, umdName, globalObject, plugin;
|
|
283
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
284
|
+
while (1) {
|
|
285
|
+
switch (_context3.prev = _context3.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
umdUrl = 'url' in pluginDefinition ? pluginDefinition.url : pluginDefinition.umdUrl;
|
|
288
|
+
_context3.prev = 1;
|
|
289
|
+
parsedUrl = new URL(umdUrl, getGlobalObject().location.href);
|
|
290
|
+
_context3.next = 9;
|
|
291
|
+
break;
|
|
292
|
+
|
|
293
|
+
case 5:
|
|
294
|
+
_context3.prev = 5;
|
|
295
|
+
_context3.t0 = _context3["catch"](1);
|
|
296
|
+
console.error(_context3.t0);
|
|
297
|
+
throw new Error("Error parsing URL: ".concat(umdUrl));
|
|
298
|
+
|
|
299
|
+
case 9:
|
|
300
|
+
if (!(parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:')) {
|
|
301
|
+
_context3.next = 11;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
115
304
|
|
|
116
|
-
case 11:
|
|
117
305
|
throw new Error("cannot load plugins using protocol \"".concat(parsedUrl.protocol, "\""));
|
|
118
306
|
|
|
307
|
+
case 11:
|
|
308
|
+
_context3.next = 13;
|
|
309
|
+
return this.loadScript(parsedUrl.href);
|
|
310
|
+
|
|
311
|
+
case 13:
|
|
312
|
+
moduleName = pluginDefinition.name;
|
|
313
|
+
umdName = "JBrowsePlugin".concat(moduleName);
|
|
314
|
+
globalObject = getGlobalObject(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
315
|
+
|
|
316
|
+
plugin = globalObject[umdName];
|
|
317
|
+
|
|
318
|
+
if (plugin) {
|
|
319
|
+
_context3.next = 19;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
throw new Error("Failed to load UMD bundle for ".concat(moduleName, ", ").concat(globalObject.constructor.name, ".").concat(umdName, " is undefined"));
|
|
324
|
+
|
|
325
|
+
case 19:
|
|
326
|
+
return _context3.abrupt("return", plugin);
|
|
327
|
+
|
|
328
|
+
case 20:
|
|
329
|
+
case "end":
|
|
330
|
+
return _context3.stop();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}, _callee3, this, [[1, 5]]);
|
|
334
|
+
}));
|
|
335
|
+
|
|
336
|
+
function loadUMDPlugin(_x3) {
|
|
337
|
+
return _loadUMDPlugin.apply(this, arguments);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return loadUMDPlugin;
|
|
341
|
+
}()
|
|
342
|
+
}, {
|
|
343
|
+
key: "loadPlugin",
|
|
344
|
+
value: function () {
|
|
345
|
+
var _loadPlugin = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(definition) {
|
|
346
|
+
var plugin;
|
|
347
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
348
|
+
while (1) {
|
|
349
|
+
switch (_context4.prev = _context4.next) {
|
|
350
|
+
case 0:
|
|
351
|
+
if (!(_util.isElectron && isCJSPluginDefinition(definition))) {
|
|
352
|
+
_context4.next = 6;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
_context4.next = 3;
|
|
357
|
+
return this.loadCJSPlugin(definition);
|
|
358
|
+
|
|
359
|
+
case 3:
|
|
360
|
+
plugin = _context4.sent;
|
|
361
|
+
_context4.next = 23;
|
|
362
|
+
break;
|
|
363
|
+
|
|
364
|
+
case 6:
|
|
365
|
+
if (!isESMPluginDefinition(definition)) {
|
|
366
|
+
_context4.next = 12;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
_context4.next = 9;
|
|
371
|
+
return this.loadESMPlugin(definition);
|
|
372
|
+
|
|
373
|
+
case 9:
|
|
374
|
+
plugin = _context4.sent;
|
|
375
|
+
_context4.next = 23;
|
|
376
|
+
break;
|
|
377
|
+
|
|
119
378
|
case 12:
|
|
379
|
+
if (!isUMDPluginDefinition(definition)) {
|
|
380
|
+
_context4.next = 18;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
_context4.next = 15;
|
|
385
|
+
return this.loadUMDPlugin(definition);
|
|
386
|
+
|
|
387
|
+
case 15:
|
|
388
|
+
plugin = _context4.sent;
|
|
389
|
+
_context4.next = 23;
|
|
390
|
+
break;
|
|
391
|
+
|
|
392
|
+
case 18:
|
|
393
|
+
if (!(!_util.isElectron && isCJSPluginDefinition(definition))) {
|
|
394
|
+
_context4.next = 22;
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
throw new Error("Only CommonJS plugin found, but not in a NodeJS environment: ".concat(JSON.stringify(definition)));
|
|
399
|
+
|
|
400
|
+
case 22:
|
|
401
|
+
throw new Error("Could not determine plugin type: ".concat(JSON.stringify(definition)));
|
|
402
|
+
|
|
403
|
+
case 23:
|
|
404
|
+
return _context4.abrupt("return", plugin.default);
|
|
405
|
+
|
|
406
|
+
case 24:
|
|
120
407
|
case "end":
|
|
121
|
-
return
|
|
408
|
+
return _context4.stop();
|
|
122
409
|
}
|
|
123
410
|
}
|
|
124
|
-
},
|
|
411
|
+
}, _callee4, this);
|
|
125
412
|
}));
|
|
126
413
|
|
|
127
|
-
function loadPlugin(
|
|
414
|
+
function loadPlugin(_x4) {
|
|
128
415
|
return _loadPlugin.apply(this, arguments);
|
|
129
416
|
}
|
|
130
417
|
|
|
@@ -145,49 +432,49 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
145
432
|
}, {
|
|
146
433
|
key: "load",
|
|
147
434
|
value: function () {
|
|
148
|
-
var _load = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
435
|
+
var _load = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
149
436
|
var _this = this;
|
|
150
437
|
|
|
151
|
-
return _regenerator.default.wrap(function
|
|
438
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
152
439
|
while (1) {
|
|
153
|
-
switch (
|
|
440
|
+
switch (_context6.prev = _context6.next) {
|
|
154
441
|
case 0:
|
|
155
|
-
return
|
|
156
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
157
|
-
return _regenerator.default.wrap(function
|
|
442
|
+
return _context6.abrupt("return", Promise.all(this.definitions.map( /*#__PURE__*/function () {
|
|
443
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(definition) {
|
|
444
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
158
445
|
while (1) {
|
|
159
|
-
switch (
|
|
446
|
+
switch (_context5.prev = _context5.next) {
|
|
160
447
|
case 0:
|
|
161
|
-
|
|
448
|
+
_context5.next = 2;
|
|
162
449
|
return _this.loadPlugin(definition);
|
|
163
450
|
|
|
164
451
|
case 2:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
plugin:
|
|
169
|
-
definition:
|
|
452
|
+
_context5.t0 = _context5.sent;
|
|
453
|
+
_context5.t1 = definition;
|
|
454
|
+
return _context5.abrupt("return", {
|
|
455
|
+
plugin: _context5.t0,
|
|
456
|
+
definition: _context5.t1
|
|
170
457
|
});
|
|
171
458
|
|
|
172
459
|
case 5:
|
|
173
460
|
case "end":
|
|
174
|
-
return
|
|
461
|
+
return _context5.stop();
|
|
175
462
|
}
|
|
176
463
|
}
|
|
177
|
-
},
|
|
464
|
+
}, _callee5);
|
|
178
465
|
}));
|
|
179
466
|
|
|
180
|
-
return function (
|
|
467
|
+
return function (_x5) {
|
|
181
468
|
return _ref3.apply(this, arguments);
|
|
182
469
|
};
|
|
183
470
|
}())));
|
|
184
471
|
|
|
185
472
|
case 1:
|
|
186
473
|
case "end":
|
|
187
|
-
return
|
|
474
|
+
return _context6.stop();
|
|
188
475
|
}
|
|
189
476
|
}
|
|
190
|
-
},
|
|
477
|
+
}, _callee6, this);
|
|
191
478
|
}));
|
|
192
479
|
|
|
193
480
|
function load() {
|
package/PluginManager.d.ts
CHANGED
|
@@ -28,16 +28,16 @@ declare class PhasedScheduler<PhaseName extends string> {
|
|
|
28
28
|
declare type PluggableElementTypeGroup = 'renderer' | 'adapter' | 'display' | 'track' | 'connection' | 'view' | 'widget' | 'rpc method' | 'internet account' | 'text search adapter';
|
|
29
29
|
/** internal class that holds the info for a certain element type */
|
|
30
30
|
declare class TypeRecord<ElementClass extends PluggableElementBase> {
|
|
31
|
-
|
|
32
|
-
[name: string]: ElementClass;
|
|
33
|
-
};
|
|
31
|
+
typeName: string;
|
|
34
32
|
baseClass: {
|
|
35
33
|
new (...args: any[]): ElementClass;
|
|
36
34
|
} | (Function & {
|
|
37
35
|
prototype: ElementClass;
|
|
38
36
|
});
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
registeredTypes: {
|
|
38
|
+
[name: string]: ElementClass;
|
|
39
|
+
};
|
|
40
|
+
constructor(typeName: string, baseClass: {
|
|
41
41
|
new (...args: any[]): ElementClass;
|
|
42
42
|
} | (Function & {
|
|
43
43
|
prototype: ElementClass;
|
|
@@ -202,6 +202,7 @@ export default class PluginManager {
|
|
|
202
202
|
'@jbrowse/core/ui': typeof import("./ui");
|
|
203
203
|
'@jbrowse/core/util': typeof import("./util");
|
|
204
204
|
'@jbrowse/core/util/color': typeof import("./util/color");
|
|
205
|
+
'@jbrowse/core/util/layouts': typeof import("./util/layouts");
|
|
205
206
|
'@jbrowse/core/util/tracks': typeof import("./util/tracks");
|
|
206
207
|
'@jbrowse/core/util/Base1DViewModel': import("mobx-state-tree").IModelType<{
|
|
207
208
|
displayedRegions: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
package/PluginManager.js
CHANGED
|
@@ -107,13 +107,9 @@ var PhasedScheduler = /*#__PURE__*/function () {
|
|
|
107
107
|
|
|
108
108
|
/** internal class that holds the info for a certain element type */
|
|
109
109
|
var TypeRecord = /*#__PURE__*/function () {
|
|
110
|
-
function TypeRecord(typeName,
|
|
110
|
+
function TypeRecord(typeName, baseClass) {
|
|
111
111
|
(0, _classCallCheck2.default)(this, TypeRecord);
|
|
112
112
|
(0, _defineProperty2.default)(this, "registeredTypes", {});
|
|
113
|
-
(0, _defineProperty2.default)(this, "baseClass", void 0);
|
|
114
|
-
(0, _defineProperty2.default)(this, "typeName", void 0);
|
|
115
|
-
this.typeName = typeName;
|
|
116
|
-
this.baseClass = elementType;
|
|
117
113
|
}
|
|
118
114
|
|
|
119
115
|
(0, _createClass2.default)(TypeRecord, [{
|
package/ReExports/list.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['mobx', 'mobx-state-tree', 'react', 'react-dom', 'mobx-react', 'prop-types', '@material-ui/core', '@material-ui/core/SvgIcon', '@material-ui/core/utils', '@material-ui/lab', '@mui/x-data-grid', '@jbrowse/core/Plugin', '@jbrowse/core/pluggableElementTypes', '@jbrowse/core/pluggableElementTypes/ViewType', '@jbrowse/core/pluggableElementTypes/AdapterType', '@jbrowse/core/pluggableElementTypes/DisplayType', '@jbrowse/core/pluggableElementTypes/TrackType', '@jbrowse/core/pluggableElementTypes/WidgetType', '@jbrowse/core/pluggableElementTypes/models', '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType', '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType', '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType', '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType', '@jbrowse/core/pluggableElementTypes/renderers/RendererType', '@jbrowse/core/configuration', '@jbrowse/core/util/types/mst', '@jbrowse/core/ui', '@jbrowse/core/util', '@jbrowse/core/util/color', '@jbrowse/core/util/tracks', '@jbrowse/core/util/Base1DViewModel', '@jbrowse/core/util/io', '@jbrowse/core/util/mst-reflection', '@jbrowse/core/util/rxjs', '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail', '@jbrowse/core/data_adapters/BaseAdapter'];
|
|
7
|
+
var _default = ['mobx', 'mobx-state-tree', 'react', 'react-dom', 'mobx-react', 'prop-types', '@material-ui/core', '@material-ui/core/SvgIcon', '@material-ui/core/utils', '@material-ui/lab', '@mui/x-data-grid', '@jbrowse/core/Plugin', '@jbrowse/core/pluggableElementTypes', '@jbrowse/core/pluggableElementTypes/ViewType', '@jbrowse/core/pluggableElementTypes/AdapterType', '@jbrowse/core/pluggableElementTypes/DisplayType', '@jbrowse/core/pluggableElementTypes/TrackType', '@jbrowse/core/pluggableElementTypes/WidgetType', '@jbrowse/core/pluggableElementTypes/models', '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType', '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType', '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType', '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType', '@jbrowse/core/pluggableElementTypes/renderers/RendererType', '@jbrowse/core/configuration', '@jbrowse/core/util/types/mst', '@jbrowse/core/ui', '@jbrowse/core/util', '@jbrowse/core/util/color', '@jbrowse/core/util/layouts', '@jbrowse/core/util/tracks', '@jbrowse/core/util/Base1DViewModel', '@jbrowse/core/util/io', '@jbrowse/core/util/mst-reflection', '@jbrowse/core/util/rxjs', '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail', '@jbrowse/core/data_adapters/BaseAdapter'];
|
|
8
8
|
exports.default = _default;
|