@jbrowse/core 2.10.1 → 2.10.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/index.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/util.d.ts +0 -1
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +1 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +6 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/index.js +12 -8
- package/BaseFeatureWidget/configSchema.d.ts +2 -0
- package/BaseFeatureWidget/configSchema.js +6 -0
- package/BaseFeatureWidget/index.d.ts +2 -128
- package/BaseFeatureWidget/index.js +4 -168
- package/BaseFeatureWidget/stateModelFactory.d.ts +126 -0
- package/BaseFeatureWidget/stateModelFactory.js +168 -0
- package/Plugin.d.ts +1 -1
- package/Plugin.js +0 -3
- package/ReExports/modules.js +5 -5
- package/package.json +3 -2
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +3 -2
- package/rpc/BaseRpcDriver.d.ts +3 -3
- package/rpc/WebWorkerRpcDriver.d.ts +2 -3
- package/rpc/WebWorkerRpcDriver.js +1 -1
- package/rpc/methods/CoreRender.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/ErrorMessage.js +33 -10
- package/ui/ErrorMessageStackTraceDialog.d.ts +5 -0
- package/ui/ErrorMessageStackTraceDialog.js +158 -0
- package/ui/RedErrorMessageBox.d.ts +4 -0
- package/ui/RedErrorMessageBox.js +17 -0
- package/ui/Snackbar.js +1 -1
- package/util/tracks.js +1 -1
- package/util/types/index.d.ts +0 -4
- package/util/types/index.js +0 -1
package/ui/ErrorMessage.js
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const material_1 = require("@mui/material");
|
|
31
|
+
const RedErrorMessageBox_1 = __importDefault(require("./RedErrorMessageBox"));
|
|
32
|
+
const ErrorMessageStackTraceDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./ErrorMessageStackTraceDialog'))));
|
|
7
33
|
function parseError(str) {
|
|
8
34
|
let snapshotError = '';
|
|
9
35
|
const findStr = 'is not assignable';
|
|
@@ -30,19 +56,16 @@ function parseError(str) {
|
|
|
30
56
|
const ErrorMessage = ({ error }) => {
|
|
31
57
|
const str = `${error}`;
|
|
32
58
|
const snapshotError = parseError(str);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
margin: 4,
|
|
36
|
-
overflow: 'auto',
|
|
37
|
-
maxHeight: 200,
|
|
38
|
-
background: '#f88',
|
|
39
|
-
border: '1px solid black',
|
|
40
|
-
} },
|
|
59
|
+
const [showStack, setShowStack] = (0, react_1.useState)(false);
|
|
60
|
+
return (react_1.default.createElement(RedErrorMessageBox_1.default, null,
|
|
41
61
|
str.slice(0, 10000),
|
|
62
|
+
typeof error === 'object' && error && 'stack' in error ? (react_1.default.createElement(material_1.Button, { style: { float: 'right' }, variant: "contained", onClick: () => setShowStack(!showStack) }, showStack ? 'Hide stack trace' : 'Show stack trace')) : null,
|
|
42
63
|
snapshotError ? (react_1.default.createElement("pre", { style: {
|
|
43
64
|
background: 'lightgrey',
|
|
44
65
|
border: '1px solid black',
|
|
45
66
|
margin: 20,
|
|
46
|
-
} }, JSON.stringify(JSON.parse(snapshotError), null, 2))) : null
|
|
67
|
+
} }, JSON.stringify(JSON.parse(snapshotError), null, 2))) : null,
|
|
68
|
+
showStack ? (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
69
|
+
react_1.default.createElement(ErrorMessageStackTraceDialog, { error: error, onClose: () => setShowStack(false) }))) : null));
|
|
47
70
|
};
|
|
48
71
|
exports.default = ErrorMessage;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const material_1 = require("@mui/material");
|
|
31
|
+
const source_map_js_1 = require("source-map-js");
|
|
32
|
+
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
33
|
+
// locals
|
|
34
|
+
const Dialog_1 = __importDefault(require("./Dialog"));
|
|
35
|
+
const LoadingEllipses_1 = __importDefault(require("./LoadingEllipses"));
|
|
36
|
+
// produce a source-map resolved stack trace
|
|
37
|
+
// reference code https://stackoverflow.com/a/77158517/2129219
|
|
38
|
+
const sourceMaps = {};
|
|
39
|
+
async function getSourceMapFromUri(uri) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (sourceMaps[uri] != undefined) {
|
|
42
|
+
return sourceMaps[uri];
|
|
43
|
+
}
|
|
44
|
+
const uriQuery = new URL(uri).search;
|
|
45
|
+
const currentScriptContent = await (await fetch(uri)).text();
|
|
46
|
+
let mapUri = ((_a = new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(currentScriptContent)) === null || _a === void 0 ? void 0 : _a[1]) ||
|
|
47
|
+
'';
|
|
48
|
+
mapUri = new URL(mapUri, uri).href + uriQuery;
|
|
49
|
+
const map = await (await fetch(mapUri)).json();
|
|
50
|
+
sourceMaps[uri] = map;
|
|
51
|
+
return map;
|
|
52
|
+
}
|
|
53
|
+
async function mapStackTrace(stack) {
|
|
54
|
+
const stackLines = stack.split('\n');
|
|
55
|
+
const mappedStack = [];
|
|
56
|
+
for (const line of stackLines) {
|
|
57
|
+
const match = new RegExp(/(.*)(http:\/\/.*):(\d+):(\d+)/).exec(line);
|
|
58
|
+
if (match === null) {
|
|
59
|
+
mappedStack.push(line);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const uri = match[2];
|
|
63
|
+
const consumer = new source_map_js_1.SourceMapConsumer(await getSourceMapFromUri(uri));
|
|
64
|
+
const originalPosition = consumer.originalPositionFor({
|
|
65
|
+
line: parseInt(match[3]),
|
|
66
|
+
column: parseInt(match[4]),
|
|
67
|
+
});
|
|
68
|
+
if (originalPosition.source === null ||
|
|
69
|
+
originalPosition.line === null ||
|
|
70
|
+
originalPosition.column === null) {
|
|
71
|
+
mappedStack.push(line);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
mappedStack.push(`${originalPosition.source}:${originalPosition.line}:${originalPosition.column + 1}`);
|
|
75
|
+
}
|
|
76
|
+
return mappedStack.join('\n');
|
|
77
|
+
}
|
|
78
|
+
const MAX_ERR_LEN = 10000;
|
|
79
|
+
// Chrome has the error message in the stacktrace, firefox doesn't
|
|
80
|
+
function stripMessage(trace, error) {
|
|
81
|
+
if (trace.startsWith('Error:')) {
|
|
82
|
+
// remove the error message, which can be very long due to mobx-state-tree
|
|
83
|
+
// stuff, to get just the stack trace
|
|
84
|
+
const err = `${error}`;
|
|
85
|
+
return trace.slice(err.length);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return trace;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function Contents({ text }) {
|
|
92
|
+
const err = encodeURIComponent('I got this error from JBrowse, here is the stack trace:\n\n```\n' +
|
|
93
|
+
text +
|
|
94
|
+
'\n```\n');
|
|
95
|
+
const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}`;
|
|
96
|
+
const emailLink = `mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${err}`;
|
|
97
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
98
|
+
react_1.default.createElement(material_1.Typography, null,
|
|
99
|
+
"Post a new issue at",
|
|
100
|
+
' ',
|
|
101
|
+
react_1.default.createElement(material_1.Link, { href: githubLink, target: "_blank" }, "GitHub"),
|
|
102
|
+
' ',
|
|
103
|
+
"or send an email to",
|
|
104
|
+
' ',
|
|
105
|
+
react_1.default.createElement(material_1.Link, { href: emailLink, target: "_blank" }, "jbrowse2dev@gmail.com"),
|
|
106
|
+
' '),
|
|
107
|
+
react_1.default.createElement("pre", { style: {
|
|
108
|
+
background: 'lightgrey',
|
|
109
|
+
border: '1px solid black',
|
|
110
|
+
overflow: 'auto',
|
|
111
|
+
margin: 20,
|
|
112
|
+
maxHeight: 300,
|
|
113
|
+
} }, text)));
|
|
114
|
+
}
|
|
115
|
+
function ErrorMessageStackTraceDialog({ error, onClose, }) {
|
|
116
|
+
const [mappedStackTrace, setMappedStackTrace] = (0, react_1.useState)();
|
|
117
|
+
const [secondaryError, setSecondaryError] = (0, react_1.useState)();
|
|
118
|
+
const [clicked, setClicked] = (0, react_1.useState)(false);
|
|
119
|
+
const stackTracePreProcessed = `${error.stack}`;
|
|
120
|
+
const errorText = `${error}`;
|
|
121
|
+
const stackTrace = stripMessage(stackTracePreProcessed, errorText);
|
|
122
|
+
(0, react_1.useEffect)(() => {
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
124
|
+
;
|
|
125
|
+
(async () => {
|
|
126
|
+
try {
|
|
127
|
+
const res = await mapStackTrace(stackTrace);
|
|
128
|
+
setMappedStackTrace(res);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
console.error(e);
|
|
132
|
+
setMappedStackTrace(stackTrace);
|
|
133
|
+
setSecondaryError(e);
|
|
134
|
+
}
|
|
135
|
+
})();
|
|
136
|
+
}, [stackTrace]);
|
|
137
|
+
const errorBoxText = [
|
|
138
|
+
secondaryError
|
|
139
|
+
? 'Error loading source map, showing raw stack trace below:'
|
|
140
|
+
: '',
|
|
141
|
+
errorText.length > MAX_ERR_LEN
|
|
142
|
+
? errorText.slice(0, MAX_ERR_LEN) + '...'
|
|
143
|
+
: errorText,
|
|
144
|
+
mappedStackTrace || 'No stack trace available',
|
|
145
|
+
// @ts-expect-error add version info at bottom if we are in jbrowse-web
|
|
146
|
+
window.JBrowseSession ? `JBrowse ${window.JBrowseSession.version}` : '',
|
|
147
|
+
].join('\n');
|
|
148
|
+
return (react_1.default.createElement(Dialog_1.default, { open: true, onClose: onClose, title: "Stack trace", maxWidth: "xl" },
|
|
149
|
+
react_1.default.createElement(material_1.DialogContent, null, mappedStackTrace === undefined ? (react_1.default.createElement(LoadingEllipses_1.default, { variant: "h6" })) : (react_1.default.createElement(Contents, { text: errorBoxText }))),
|
|
150
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
151
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
152
|
+
(0, copy_to_clipboard_1.default)(errorBoxText);
|
|
153
|
+
setClicked(true);
|
|
154
|
+
setTimeout(() => setClicked(false), 1000);
|
|
155
|
+
} }, clicked ? 'Copied!' : 'Copy stack trace to clipboard'),
|
|
156
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: onClose }, "Close"))));
|
|
157
|
+
}
|
|
158
|
+
exports.default = ErrorMessageStackTraceDialog;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
function RedErrorMessageBox({ children, }) {
|
|
8
|
+
return (react_1.default.createElement("div", { style: {
|
|
9
|
+
padding: 4,
|
|
10
|
+
margin: 4,
|
|
11
|
+
overflow: 'auto',
|
|
12
|
+
maxHeight: 200,
|
|
13
|
+
background: '#f88',
|
|
14
|
+
border: '1px solid black',
|
|
15
|
+
} }, children));
|
|
16
|
+
}
|
|
17
|
+
exports.default = RedErrorMessageBox;
|
package/ui/Snackbar.js
CHANGED
|
@@ -16,7 +16,7 @@ const Snackbar = (0, mobx_react_1.observer)(function ({ session }) {
|
|
|
16
16
|
session.popSnackbarMessage();
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
return
|
|
19
|
+
return latestMessage ? (react_1.default.createElement(material_1.Snackbar, { open: true, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' } },
|
|
20
20
|
react_1.default.createElement(material_1.Alert, { onClose: handleClose, action: latestMessage.action ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
21
21
|
react_1.default.createElement(material_1.Button, { color: "inherit", onClick: e => {
|
|
22
22
|
var _a;
|
package/util/tracks.js
CHANGED
|
@@ -119,7 +119,7 @@ function getFileName(track) {
|
|
|
119
119
|
const blob = 'blobId' in track ? track : undefined;
|
|
120
120
|
return ((blob === null || blob === void 0 ? void 0 : blob.name) ||
|
|
121
121
|
(uri === null || uri === void 0 ? void 0 : uri.slice(uri.lastIndexOf('/') + 1)) ||
|
|
122
|
-
(localPath === null || localPath === void 0 ? void 0 : localPath.slice(localPath.lastIndexOf('/') + 1)) ||
|
|
122
|
+
(localPath === null || localPath === void 0 ? void 0 : localPath.slice((localPath === null || localPath === void 0 ? void 0 : localPath.replace(/\\/g, '/').lastIndexOf('/')) + 1)) ||
|
|
123
123
|
'');
|
|
124
124
|
}
|
|
125
125
|
exports.getFileName = getFileName;
|
package/util/types/index.d.ts
CHANGED
|
@@ -203,10 +203,6 @@ export interface AbstractRootModel {
|
|
|
203
203
|
}
|
|
204
204
|
/** root model with more included for the heavier JBrowse web and desktop app */
|
|
205
205
|
export interface AppRootModel extends AbstractRootModel {
|
|
206
|
-
isAssemblyEditing: boolean;
|
|
207
|
-
isDefaultSessionEditing: boolean;
|
|
208
|
-
setAssemblyEditing: (arg: boolean) => boolean;
|
|
209
|
-
setDefaultSessionEditing: (arg: boolean) => boolean;
|
|
210
206
|
internetAccounts: BaseInternetAccountModel[];
|
|
211
207
|
findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
|
|
212
208
|
}
|
package/util/types/index.js
CHANGED
|
@@ -101,7 +101,6 @@ exports.isTrackViewModel = isTrackViewModel;
|
|
|
101
101
|
function isAppRootModel(thing) {
|
|
102
102
|
return (typeof thing === 'object' &&
|
|
103
103
|
thing !== null &&
|
|
104
|
-
'isAssemblyEditing' in thing &&
|
|
105
104
|
'findAppropriateInternetAccount' in thing);
|
|
106
105
|
}
|
|
107
106
|
exports.isAppRootModel = isAppRootModel;
|