@jbrowse/core 1.4.4 → 1.5.3
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 -4
- package/BaseFeatureWidget/BaseFeatureDetail.js +27 -8
- package/BaseFeatureWidget/SequenceFeatureDetails.js +10 -10
- package/BaseFeatureWidget/index.js +1 -1
- package/BaseFeatureWidget/types.d.ts +1 -1
- package/BaseFeatureWidget/util.js +3 -3
- package/CorePlugin.d.ts +0 -1
- package/CorePlugin.js +13 -1
- package/PluginLoader.d.ts +26 -4
- package/PluginLoader.js +337 -51
- package/PluginManager.d.ts +18 -11
- package/PluginManager.js +53 -31
- package/ReExports/list.js +1 -1
- package/ReExports/material-ui-colors.js +38 -38
- package/ReExports/modules.d.ts +19 -20
- package/ReExports/modules.js +10 -3
- package/TextSearch/BaseResults.d.ts +5 -14
- package/TextSearch/BaseResults.js +16 -58
- package/TextSearch/BaseResults.test.js +1 -11
- package/TextSearch/TextSearchManager.d.ts +3 -3
- package/TextSearch/TextSearchManager.js +1 -1
- package/assemblyManager/assembly.d.ts +21 -8
- package/assemblyManager/assembly.js +163 -120
- package/assemblyManager/assemblyConfigSchema.d.ts +3 -0
- package/assemblyManager/{assemblyConfigSchemas.js → assemblyConfigSchema.js} +35 -27
- package/assemblyManager/assemblyManager.d.ts +169 -60
- package/assemblyManager/index.d.ts +1 -1
- package/assemblyManager/index.js +5 -5
- package/configuration/configurationSchema.d.ts +3 -2
- package/configuration/configurationSchema.js +7 -10
- package/configuration/configurationSchema.test.js +4 -2
- package/configuration/configurationSlot.js +5 -4
- package/configuration/index.js +4 -4
- package/configuration/util.js +5 -5
- package/data_adapters/BaseAdapter.d.ts +5 -3
- package/data_adapters/BaseAdapter.js +7 -4
- package/data_adapters/BaseAdapter.test.js +4 -2
- package/data_adapters/CytobandAdapter.d.ts +8 -0
- package/data_adapters/CytobandAdapter.js +128 -0
- package/data_adapters/dataAdapterCache.js +3 -3
- package/package.json +7 -7
- package/pluggableElementTypes/AdapterType.d.ts +9 -1
- package/pluggableElementTypes/AdapterType.js +20 -0
- package/pluggableElementTypes/InternetAccountType.d.ts +12 -0
- package/pluggableElementTypes/InternetAccountType.js +64 -0
- package/pluggableElementTypes/PluggableElementBase.d.ts +1 -2
- package/pluggableElementTypes/PluggableElementBase.js +2 -3
- package/pluggableElementTypes/RpcMethodType.d.ts +3 -0
- package/pluggableElementTypes/RpcMethodType.js +269 -26
- package/pluggableElementTypes/RpcMethodType.test.d.ts +4 -0
- package/pluggableElementTypes/RpcMethodType.test.js +118 -0
- package/pluggableElementTypes/ViewType.d.ts +1 -1
- package/pluggableElementTypes/WidgetType.d.ts +1 -0
- package/pluggableElementTypes/index.d.ts +7 -3
- package/pluggableElementTypes/index.js +127 -1
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +6 -6
- package/pluggableElementTypes/models/BaseDisplayModel.js +1 -3
- package/pluggableElementTypes/models/BaseViewModel.js +13 -15
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +24 -0
- package/pluggableElementTypes/models/InternetAccountModel.js +85 -0
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +4 -0
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +25 -0
- package/pluggableElementTypes/models/index.d.ts +3 -0
- package/pluggableElementTypes/models/index.js +24 -8
- package/pluggableElementTypes/renderers/BoxRendererType.js +1 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +15 -6
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +3 -3
- package/pluggableElementTypes/renderers/FeatureRendererType.js +17 -8
- package/pluggableElementTypes/renderers/RendererType.d.ts +1 -0
- package/pluggableElementTypes/renderers/RendererType.js +4 -1
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +1 -1
- package/pluggableElementTypes/renderers/index.d.ts +9 -0
- package/pluggableElementTypes/renderers/index.js +63 -0
- package/rpc/BaseRpcDriver.js +5 -9
- package/rpc/BaseRpcDriver.test.js +6 -6
- package/rpc/RpcManager.d.ts +1 -1
- package/rpc/RpcManager.js +44 -16
- package/rpc/WebWorkerRpcDriver.js +3 -3
- package/rpc/coreRpcMethods.d.ts +2 -1
- package/rpc/coreRpcMethods.js +109 -75
- package/rpc/remoteAbortSignals.js +2 -2
- package/ui/App.d.ts +17 -4
- package/ui/App.js +55 -41
- package/ui/Drawer.d.ts +6 -14
- package/ui/Drawer.js +11 -12
- package/ui/DrawerWidget.d.ts +5 -3
- package/ui/DrawerWidget.js +100 -61
- package/ui/ErrorMessage.d.ts +5 -0
- package/ui/ErrorMessage.js +54 -0
- package/ui/FileSelector/FileSelector.d.ts +11 -0
- package/ui/FileSelector/FileSelector.js +198 -0
- package/ui/FileSelector/LocalFileChooser.d.ts +7 -0
- package/ui/FileSelector/LocalFileChooser.js +79 -0
- package/ui/FileSelector/UrlChooser.d.ts +9 -0
- package/ui/FileSelector/UrlChooser.js +41 -0
- package/ui/FileSelector/index.d.ts +2 -0
- package/ui/FileSelector/index.js +13 -0
- package/ui/Icons.d.ts +4 -0
- package/ui/Icons.js +34 -0
- package/ui/Logo.js +1 -1
- package/ui/PrerenderedCanvas.d.ts +1 -0
- package/ui/PrerenderedCanvas.js +4 -1
- package/ui/ResizeHandle.d.ts +2 -3
- package/ui/ResizeHandle.js +6 -7
- package/ui/SanitizedHTML.js +1 -1
- package/ui/Snackbar.js +4 -6
- package/ui/SnackbarModel.d.ts +16 -0
- package/ui/SnackbarModel.js +56 -0
- package/ui/Tooltip.d.ts +1 -1
- package/ui/index.js +24 -24
- package/ui/theme.js +5 -5
- package/util/QuickLRU.d.ts +1 -1
- package/util/QuickLRU.js +3 -3
- package/util/aborting.d.ts +1 -1
- package/util/aborting.js +10 -11
- package/util/analytics.d.ts +2 -2
- package/util/analytics.js +20 -7
- package/util/blockTypes.d.ts +11 -6
- package/util/blockTypes.js +7 -1
- package/util/color/cssColorsLevel4.js +1 -1
- package/util/color/index.js +5 -5
- package/util/compositeMap.js +3 -3
- package/util/index.d.ts +6 -16
- package/util/index.js +76 -100
- package/util/io/RemoteFileWithRangeCache.d.ts +17 -0
- package/util/io/RemoteFileWithRangeCache.js +266 -0
- package/util/io/index.d.ts +4 -2
- package/util/io/index.js +134 -25
- 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/PrecomputedLayout.js +2 -1
- package/util/layouts/index.d.ts +7 -0
- package/util/layouts/index.js +68 -0
- package/util/mst-reflection.js +3 -3
- package/util/offscreenCanvasPonyfill.js +1 -1
- package/util/range.js +1 -1
- package/util/simpleFeature.js +1 -1
- package/util/stats.js +2 -2
- package/util/tracks.d.ts +31 -362
- package/util/tracks.js +74 -190
- package/util/types/index.d.ts +54 -10
- package/util/types/index.js +110 -8
- package/util/types/mst.d.ts +46 -2
- package/util/types/mst.js +56 -8
- package/util/types/util.d.ts +1 -1
- package/util/when.js +1 -1
- package/assemblyManager/assemblyConfigSchemas.d.ts +0 -7
- package/ui/FileSelector.d.ts +0 -9
- package/ui/FileSelector.js +0 -150
- package/util/io/LocalFile.d.ts +0 -18
- package/util/io/LocalFile.js +0 -220
- package/util/io/rangeFetcher.d.ts +0 -3
- package/util/io/rangeFetcher.js +0 -236
- package/value.d.ts +0 -1
- package/value.js +0 -10
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
16
|
|
|
12
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
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,15 +24,22 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
21
24
|
|
|
22
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
26
|
|
|
24
|
-
var
|
|
27
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
25
28
|
|
|
26
29
|
var _loadScript = _interopRequireDefault(require("load-script2"));
|
|
27
30
|
|
|
31
|
+
var _sanitizeFilename = _interopRequireDefault(require("sanitize-filename"));
|
|
32
|
+
|
|
28
33
|
var _configuration = require("./configuration");
|
|
29
34
|
|
|
30
35
|
var _ReExports = _interopRequireDefault(require("./ReExports"));
|
|
31
36
|
|
|
32
|
-
|
|
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
|
+
|
|
33
43
|
var PluginSourceConfigurationSchema = (0, _configuration.ConfigurationSchema)('PluginSource', {
|
|
34
44
|
name: {
|
|
35
45
|
type: 'string',
|
|
@@ -42,6 +52,32 @@ var PluginSourceConfigurationSchema = (0, _configuration.ConfigurationSchema)('P
|
|
|
42
52
|
});
|
|
43
53
|
exports.PluginSourceConfigurationSchema = PluginSourceConfigurationSchema;
|
|
44
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
|
+
|
|
45
81
|
var PluginLoader = /*#__PURE__*/function () {
|
|
46
82
|
function PluginLoader() {
|
|
47
83
|
var pluginDefinitions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -53,16 +89,18 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
53
89
|
(0, _createClass2.default)(PluginLoader, [{
|
|
54
90
|
key: "loadScript",
|
|
55
91
|
value: function loadScript(scriptUrl) {
|
|
56
|
-
|
|
92
|
+
var globalObject = getGlobalObject();
|
|
93
|
+
|
|
94
|
+
if (!isInWebWorker(globalObject)) {
|
|
57
95
|
return (0, _loadScript.default)(scriptUrl);
|
|
58
96
|
} // @ts-ignore
|
|
59
97
|
|
|
60
98
|
|
|
61
|
-
if (
|
|
99
|
+
if (globalObject && globalObject.importScripts) {
|
|
62
100
|
return new Promise(function (resolve, reject) {
|
|
63
101
|
try {
|
|
64
102
|
// @ts-ignore
|
|
65
|
-
|
|
103
|
+
globalObject.importScripts(scriptUrl);
|
|
66
104
|
} catch (error) {
|
|
67
105
|
reject(error || new Error("failed to load ".concat(scriptUrl)));
|
|
68
106
|
return;
|
|
@@ -75,55 +113,305 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
75
113
|
throw new Error('cannot figure out how to load external JS scripts in this environment');
|
|
76
114
|
}
|
|
77
115
|
}, {
|
|
78
|
-
key: "
|
|
116
|
+
key: "loadCJSPlugin",
|
|
79
117
|
value: function () {
|
|
80
|
-
var
|
|
81
|
-
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;
|
|
82
120
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
83
121
|
while (1) {
|
|
84
122
|
switch (_context.prev = _context.next) {
|
|
85
123
|
case 0:
|
|
86
|
-
|
|
124
|
+
_context.prev = 0;
|
|
125
|
+
parsedUrl = new URL(pluginDefinition.cjsUrl, getGlobalObject().location.href);
|
|
126
|
+
_context.next = 8;
|
|
127
|
+
break;
|
|
87
128
|
|
|
88
|
-
|
|
89
|
-
|
|
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;
|
|
90
193
|
break;
|
|
91
194
|
}
|
|
92
195
|
|
|
93
|
-
|
|
94
|
-
|
|
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;
|
|
95
228
|
|
|
96
229
|
case 4:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
}
|
|
100
240
|
|
|
101
|
-
|
|
241
|
+
throw new Error("cannot load plugins using protocol \"".concat(parsedUrl.protocol, "\""));
|
|
102
242
|
|
|
103
|
-
|
|
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;
|
|
104
253
|
|
|
105
254
|
if (plugin) {
|
|
106
|
-
|
|
255
|
+
_context2.next = 15;
|
|
107
256
|
break;
|
|
108
257
|
}
|
|
109
258
|
|
|
110
|
-
throw new Error("
|
|
259
|
+
throw new Error("Could not load ESM plugin: ".concat(parsedUrl));
|
|
111
260
|
|
|
112
|
-
case
|
|
113
|
-
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
|
+
}
|
|
114
304
|
|
|
115
|
-
case 11:
|
|
116
305
|
throw new Error("cannot load plugins using protocol \"".concat(parsedUrl.protocol, "\""));
|
|
117
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
|
+
|
|
118
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:
|
|
119
407
|
case "end":
|
|
120
|
-
return
|
|
408
|
+
return _context4.stop();
|
|
121
409
|
}
|
|
122
410
|
}
|
|
123
|
-
},
|
|
411
|
+
}, _callee4, this);
|
|
124
412
|
}));
|
|
125
413
|
|
|
126
|
-
function loadPlugin(
|
|
414
|
+
function loadPlugin(_x4) {
|
|
127
415
|
return _loadPlugin.apply(this, arguments);
|
|
128
416
|
}
|
|
129
417
|
|
|
@@ -133,62 +421,60 @@ var PluginLoader = /*#__PURE__*/function () {
|
|
|
133
421
|
key: "installGlobalReExports",
|
|
134
422
|
value: function installGlobalReExports(target) {
|
|
135
423
|
// @ts-ignore
|
|
136
|
-
target.JBrowseExports = {
|
|
137
|
-
Object.entries(_ReExports.default).forEach(function (_ref) {
|
|
424
|
+
target.JBrowseExports = Object.fromEntries(Object.entries(_ReExports.default).map(function (_ref) {
|
|
138
425
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
139
426
|
moduleName = _ref2[0],
|
|
140
427
|
module = _ref2[1];
|
|
141
428
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
429
|
+
return [moduleName, module];
|
|
430
|
+
}));
|
|
145
431
|
}
|
|
146
432
|
}, {
|
|
147
433
|
key: "load",
|
|
148
434
|
value: function () {
|
|
149
|
-
var _load = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
435
|
+
var _load = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
150
436
|
var _this = this;
|
|
151
437
|
|
|
152
|
-
return _regenerator.default.wrap(function
|
|
438
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
153
439
|
while (1) {
|
|
154
|
-
switch (
|
|
440
|
+
switch (_context6.prev = _context6.next) {
|
|
155
441
|
case 0:
|
|
156
|
-
return
|
|
157
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
158
|
-
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) {
|
|
159
445
|
while (1) {
|
|
160
|
-
switch (
|
|
446
|
+
switch (_context5.prev = _context5.next) {
|
|
161
447
|
case 0:
|
|
162
|
-
|
|
448
|
+
_context5.next = 2;
|
|
163
449
|
return _this.loadPlugin(definition);
|
|
164
450
|
|
|
165
451
|
case 2:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return
|
|
169
|
-
plugin:
|
|
170
|
-
definition:
|
|
452
|
+
_context5.t0 = _context5.sent;
|
|
453
|
+
_context5.t1 = definition;
|
|
454
|
+
return _context5.abrupt("return", {
|
|
455
|
+
plugin: _context5.t0,
|
|
456
|
+
definition: _context5.t1
|
|
171
457
|
});
|
|
172
458
|
|
|
173
459
|
case 5:
|
|
174
460
|
case "end":
|
|
175
|
-
return
|
|
461
|
+
return _context5.stop();
|
|
176
462
|
}
|
|
177
463
|
}
|
|
178
|
-
},
|
|
464
|
+
}, _callee5);
|
|
179
465
|
}));
|
|
180
466
|
|
|
181
|
-
return function (
|
|
467
|
+
return function (_x5) {
|
|
182
468
|
return _ref3.apply(this, arguments);
|
|
183
469
|
};
|
|
184
470
|
}())));
|
|
185
471
|
|
|
186
472
|
case 1:
|
|
187
473
|
case "end":
|
|
188
|
-
return
|
|
474
|
+
return _context6.stop();
|
|
189
475
|
}
|
|
190
476
|
}
|
|
191
|
-
},
|
|
477
|
+
}, _callee6, this);
|
|
192
478
|
}));
|
|
193
479
|
|
|
194
480
|
function load() {
|