@jbrowse/core 2.6.1 → 2.6.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/PluginLoader.d.ts +0 -1
- package/PluginLoader.js +26 -14
- package/PluginManager.d.ts +2 -2
- package/TextSearch/TextSearchManager.js +3 -2
- package/package.json +4 -4
- package/pluggableElementTypes/RpcMethodType.js +2 -3
- package/rpc/WebWorkerRpcDriver.js +4 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/ColorPicker.js +2 -1
- package/util/index.d.ts +3 -2
- package/util/index.js +7 -4
- package/util/io/RemoteFileWithRangeCache.js +1 -1
- package/util/types/index.d.ts +2 -0
- package/util/types/index.js +15 -1
package/PluginLoader.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ export default class PluginLoader {
|
|
|
48
48
|
fetchESM?: (url: string) => Promise<LoadedPlugin>;
|
|
49
49
|
fetchCJS?: (url: string) => Promise<LoadedPlugin>;
|
|
50
50
|
});
|
|
51
|
-
loadScript(scriptUrl: string): Promise<any>;
|
|
52
51
|
loadCJSPlugin(def: CJSPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
|
|
53
52
|
loadESMPlugin(def: ESMPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
|
|
54
53
|
loadUMDPlugin(def: UMDPluginDefinition | LegacyUMDPluginDefinition, baseUri?: string): Promise<{
|
package/PluginLoader.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isCJSPluginDefinition = exports.isESMPluginDefinition = exports.isUMDPluginDefinition = void 0;
|
|
7
|
-
const
|
|
7
|
+
const load_script_1 = __importDefault(require("load-script"));
|
|
8
8
|
// locals
|
|
9
9
|
const Plugin_1 = __importDefault(require("./Plugin"));
|
|
10
10
|
const ReExports_1 = __importDefault(require("./ReExports"));
|
|
@@ -21,6 +21,30 @@ function isESMPluginDefinition(def) {
|
|
|
21
21
|
def.esmLoc !== undefined);
|
|
22
22
|
}
|
|
23
23
|
exports.isESMPluginDefinition = isESMPluginDefinition;
|
|
24
|
+
function promisifiedLoadScript(src) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
(0, load_script_1.default)(src, (err, script) => {
|
|
27
|
+
if (err) {
|
|
28
|
+
reject(err);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
resolve(script.src);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function loadScript(scriptUrl) {
|
|
37
|
+
if (!isInWebWorker()) {
|
|
38
|
+
return promisifiedLoadScript(scriptUrl);
|
|
39
|
+
}
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
if (globalThis === null || globalThis === void 0 ? void 0 : globalThis.importScripts) {
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
await globalThis.importScripts(scriptUrl);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
throw new Error('cannot figure out how to load external JS scripts in this environment');
|
|
47
|
+
}
|
|
24
48
|
function isCJSPluginDefinition(def) {
|
|
25
49
|
return def.cjsUrl !== undefined;
|
|
26
50
|
}
|
|
@@ -49,18 +73,6 @@ class PluginLoader {
|
|
|
49
73
|
this.fetchCJS = args === null || args === void 0 ? void 0 : args.fetchCJS;
|
|
50
74
|
this.definitions = JSON.parse(JSON.stringify(defs));
|
|
51
75
|
}
|
|
52
|
-
async loadScript(scriptUrl) {
|
|
53
|
-
if (!isInWebWorker()) {
|
|
54
|
-
return (0, load_script2_1.default)(scriptUrl);
|
|
55
|
-
}
|
|
56
|
-
// @ts-expect-error
|
|
57
|
-
if (globalThis === null || globalThis === void 0 ? void 0 : globalThis.importScripts) {
|
|
58
|
-
// @ts-expect-error
|
|
59
|
-
await globalThis.importScripts(scriptUrl);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
throw new Error('cannot figure out how to load external JS scripts in this environment');
|
|
63
|
-
}
|
|
64
76
|
async loadCJSPlugin(def, baseUri) {
|
|
65
77
|
const parsedUrl = new URL(def.cjsUrl, baseUri);
|
|
66
78
|
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
|
|
@@ -99,7 +111,7 @@ class PluginLoader {
|
|
|
99
111
|
const moduleName = def.name;
|
|
100
112
|
const umdName = `JBrowsePlugin${moduleName}`;
|
|
101
113
|
if (typeof jest === 'undefined') {
|
|
102
|
-
await
|
|
114
|
+
await loadScript(parsedUrl.href);
|
|
103
115
|
}
|
|
104
116
|
else {
|
|
105
117
|
// @ts-expect-error
|
package/PluginManager.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type PluggableElementTypeGroup = 'renderer' | 'adapter' | 'display' | 'track' |
|
|
|
31
31
|
declare class TypeRecord<ElementClass extends PluggableElementBase> {
|
|
32
32
|
typeName: string;
|
|
33
33
|
baseClass: {
|
|
34
|
-
new (...args:
|
|
34
|
+
new (...args: unknown[]): ElementClass;
|
|
35
35
|
} | (Function & {
|
|
36
36
|
prototype: ElementClass;
|
|
37
37
|
});
|
|
@@ -39,7 +39,7 @@ declare class TypeRecord<ElementClass extends PluggableElementBase> {
|
|
|
39
39
|
[name: string]: ElementClass;
|
|
40
40
|
};
|
|
41
41
|
constructor(typeName: string, baseClass: {
|
|
42
|
-
new (...args:
|
|
42
|
+
new (...args: unknown[]): ElementClass;
|
|
43
43
|
} | (Function & {
|
|
44
44
|
prototype: ElementClass;
|
|
45
45
|
}));
|
|
@@ -29,9 +29,10 @@ class TextSearchManager {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
relevantAdapters(searchScope) {
|
|
32
|
-
var _a;
|
|
32
|
+
var _a, _b;
|
|
33
33
|
const pm = this.pluginManager;
|
|
34
|
-
const { aggregateTextSearchAdapters
|
|
34
|
+
const { aggregateTextSearchAdapters } = (_a = pm.rootModel) === null || _a === void 0 ? void 0 : _a.jbrowse;
|
|
35
|
+
const { tracks } = (_b = pm.rootModel) === null || _b === void 0 ? void 0 : _b.session;
|
|
35
36
|
const { assemblyName } = searchScope;
|
|
36
37
|
return [
|
|
37
38
|
...this.getAdaptersWithAssembly(assemblyName, aggregateTextSearchAdapters),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/core",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "JBrowse 2 core libraries used by plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"escape-html": "^1.0.3",
|
|
46
46
|
"fast-deep-equal": "^3.1.3",
|
|
47
47
|
"generic-filehandle": "^3.0.0",
|
|
48
|
-
"http-range-fetcher": "^
|
|
48
|
+
"http-range-fetcher": "^2.0.0",
|
|
49
49
|
"is-object": "^1.0.1",
|
|
50
50
|
"jexl": "^2.3.0",
|
|
51
51
|
"json-stable-stringify": "^1.0.1",
|
|
52
52
|
"librpc-web-mod": "^1.1.5",
|
|
53
|
-
"load-
|
|
53
|
+
"load-script": "^2.0.0",
|
|
54
54
|
"material-ui-popup-state": "^5.0.0",
|
|
55
55
|
"rbush": "^3.0.1",
|
|
56
56
|
"react-error-boundary": "^4.0.3",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"access": "public",
|
|
75
75
|
"directory": "dist"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "ed402c87efb0904858d602c363bd1757d5742129"
|
|
78
78
|
}
|
|
@@ -56,9 +56,8 @@ class RpcMethodType extends PluggableElementBase_1.default {
|
|
|
56
56
|
}
|
|
57
57
|
catch (error) {
|
|
58
58
|
if ((0, types_1.isAuthNeededException)(error)) {
|
|
59
|
-
const retryAccount =
|
|
60
|
-
|
|
61
|
-
(_a = this.pluginManager.rootModel) === null || _a === void 0 ? void 0 : _a.createEphemeralInternetAccount(`HTTPBasicInternetAccount-${new URL(error.url).origin}`, {}, error.url);
|
|
59
|
+
const retryAccount = // @ts-expect-error
|
|
60
|
+
(_a = this.pluginManager.rootModel) === null || _a === void 0 ? void 0 : _a.createEphemeralInternetAccount(`HTTPBasicInternetAccount-${new URL(error.url).origin}`, {}, error.url);
|
|
62
61
|
throw new types_1.RetryError('Retrying with created internet account', retryAccount.internetAccountId);
|
|
63
62
|
}
|
|
64
63
|
throw error;
|
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const librpc_web_mod_1 = __importDefault(require("librpc-web-mod"));
|
|
7
7
|
const shortid_1 = __importDefault(require("shortid"));
|
|
8
|
-
const serialize_error_1 = require("serialize-error");
|
|
9
8
|
// locals
|
|
10
9
|
const BaseRpcDriver_1 = __importDefault(require("./BaseRpcDriver"));
|
|
10
|
+
const serialize_error_1 = require("serialize-error");
|
|
11
11
|
class WebWorkerHandle extends librpc_web_mod_1.default.Client {
|
|
12
12
|
destroy() {
|
|
13
13
|
this.workers[0].terminate();
|
|
@@ -36,6 +36,9 @@ class WebWorkerRpcDriver extends BaseRpcDriver_1.default {
|
|
|
36
36
|
// one for each worker, because we want to do our own state-group-aware
|
|
37
37
|
// load balancing rather than using librpc's builtin round-robin
|
|
38
38
|
const instance = this.makeWorkerInstance();
|
|
39
|
+
// @ts-ignore this is used to avoid warning in jbrowse-web startup
|
|
40
|
+
// (because this file is referred to via src, declare.d.ts file is in
|
|
41
|
+
// e.g. products/jbrowse-web)
|
|
39
42
|
const worker = new WebWorkerHandle({ workers: [instance] });
|
|
40
43
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
41
44
|
if (isSafari) {
|