@jbrowse/core 2.3.3 → 2.3.4
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 +7 -8
- package/PluginLoader.js +18 -20
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/Dialog.js +8 -1
- package/ui/DropDownMenu.js +1 -4
- package/ui/EditableTypography.js +1 -1
- package/ui/Menu.js +9 -1
- package/ui/ResizeBar.d.ts +11 -0
- package/ui/ResizeBar.js +95 -0
- package/ui/ResizeHandle.d.ts +1 -1
- package/ui/ResizeHandle.js +1 -1
- package/ui/SanitizedHTML.js +1 -1
- package/ui/theme.d.ts +10 -0
- package/ui/theme.js +10 -0
- package/util/index.d.ts +13 -7
- package/util/index.js +19 -8
package/PluginLoader.d.ts
CHANGED
|
@@ -40,24 +40,23 @@ export interface PluginRecord {
|
|
|
40
40
|
export interface LoadedPlugin {
|
|
41
41
|
default: PluginConstructor;
|
|
42
42
|
}
|
|
43
|
-
export declare function getWindowPath(windowHref: string): string;
|
|
44
43
|
export default class PluginLoader {
|
|
45
44
|
definitions: PluginDefinition[];
|
|
46
|
-
fetchESM?: (url: string) => Promise<
|
|
45
|
+
fetchESM?: (url: string) => Promise<LoadedPlugin>;
|
|
47
46
|
fetchCJS?: (url: string) => Promise<LoadedPlugin>;
|
|
48
47
|
constructor(defs?: PluginDefinition[], args?: {
|
|
49
|
-
fetchESM?: (url: string) => Promise<
|
|
48
|
+
fetchESM?: (url: string) => Promise<LoadedPlugin>;
|
|
50
49
|
fetchCJS?: (url: string) => Promise<LoadedPlugin>;
|
|
51
50
|
});
|
|
52
51
|
loadScript(scriptUrl: string): Promise<void>;
|
|
53
|
-
loadCJSPlugin(def: CJSPluginDefinition,
|
|
54
|
-
loadESMPlugin(def: ESMPluginDefinition,
|
|
55
|
-
loadUMDPlugin(def: UMDPluginDefinition | LegacyUMDPluginDefinition,
|
|
52
|
+
loadCJSPlugin(def: CJSPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
|
|
53
|
+
loadESMPlugin(def: ESMPluginDefinition, baseUri?: string): Promise<LoadedPlugin>;
|
|
54
|
+
loadUMDPlugin(def: UMDPluginDefinition | LegacyUMDPluginDefinition, baseUri?: string): Promise<{
|
|
56
55
|
default: PluginConstructor;
|
|
57
56
|
}>;
|
|
58
|
-
loadPlugin(def: PluginDefinition,
|
|
57
|
+
loadPlugin(def: PluginDefinition, baseUri?: string): Promise<PluginConstructor>;
|
|
59
58
|
installGlobalReExports(target: WindowOrWorkerGlobalScope): void;
|
|
60
|
-
load(
|
|
59
|
+
load(baseUri?: string): Promise<{
|
|
61
60
|
plugin: PluginConstructor;
|
|
62
61
|
definition: PluginDefinition;
|
|
63
62
|
}[]>;
|
package/PluginLoader.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isCJSPluginDefinition = exports.isESMPluginDefinition = exports.isUMDPluginDefinition = void 0;
|
|
7
7
|
const load_script2_1 = __importDefault(require("load-script2"));
|
|
8
8
|
const ReExports_1 = __importDefault(require("./ReExports"));
|
|
9
9
|
const util_1 = require("./util");
|
|
@@ -23,10 +23,6 @@ function isCJSPluginDefinition(def) {
|
|
|
23
23
|
return def.cjsUrl !== undefined;
|
|
24
24
|
}
|
|
25
25
|
exports.isCJSPluginDefinition = isCJSPluginDefinition;
|
|
26
|
-
function getWindowPath(windowHref) {
|
|
27
|
-
return window.location.href + windowHref;
|
|
28
|
-
}
|
|
29
|
-
exports.getWindowPath = getWindowPath;
|
|
30
26
|
function getGlobalObject() {
|
|
31
27
|
// Based on window-or-global
|
|
32
28
|
// https://github.com/purposeindustries/window-or-global/blob/322abc71de0010c9e5d9d0729df40959e1ef8775/lib/index.js
|
|
@@ -60,8 +56,8 @@ class PluginLoader {
|
|
|
60
56
|
}
|
|
61
57
|
throw new Error('cannot figure out how to load external JS scripts in this environment');
|
|
62
58
|
}
|
|
63
|
-
async loadCJSPlugin(def,
|
|
64
|
-
const parsedUrl = new URL(def.cjsUrl,
|
|
59
|
+
async loadCJSPlugin(def, baseUri) {
|
|
60
|
+
const parsedUrl = new URL(def.cjsUrl, baseUri);
|
|
65
61
|
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
|
|
66
62
|
throw new Error(`Cannot load plugins using protocol "${parsedUrl.protocol}"`);
|
|
67
63
|
}
|
|
@@ -70,25 +66,27 @@ class PluginLoader {
|
|
|
70
66
|
}
|
|
71
67
|
return this.fetchCJS(parsedUrl.href);
|
|
72
68
|
}
|
|
73
|
-
async loadESMPlugin(def,
|
|
74
|
-
var _a;
|
|
69
|
+
async loadESMPlugin(def, baseUri) {
|
|
75
70
|
const parsedUrl = 'esmUrl' in def
|
|
76
|
-
? new URL(def.esmUrl,
|
|
71
|
+
? new URL(def.esmUrl, baseUri)
|
|
77
72
|
: new URL(def.esmLoc.uri, def.esmLoc.baseUri);
|
|
78
73
|
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
|
|
79
74
|
throw new Error(`cannot load plugins using protocol "${parsedUrl.protocol}"`);
|
|
80
75
|
}
|
|
81
|
-
|
|
76
|
+
if (!this.fetchESM) {
|
|
77
|
+
throw new Error(`No ESM fetcher installed`);
|
|
78
|
+
}
|
|
79
|
+
const plugin = await this.fetchESM(parsedUrl.href);
|
|
82
80
|
if (!plugin) {
|
|
83
81
|
throw new Error(`Could not load ESM plugin: ${parsedUrl}`);
|
|
84
82
|
}
|
|
85
83
|
return plugin;
|
|
86
84
|
}
|
|
87
|
-
async loadUMDPlugin(def,
|
|
85
|
+
async loadUMDPlugin(def, baseUri) {
|
|
88
86
|
const parsedUrl = 'url' in def
|
|
89
|
-
? new URL(def.url,
|
|
87
|
+
? new URL(def.url, baseUri)
|
|
90
88
|
: 'umdUrl' in def
|
|
91
|
-
? new URL(def.umdUrl,
|
|
89
|
+
? new URL(def.umdUrl, baseUri)
|
|
92
90
|
: new URL(def.umdLoc.uri, def.umdLoc.baseUri);
|
|
93
91
|
if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
|
|
94
92
|
throw new Error(`cannot load plugins using protocol "${parsedUrl.protocol}"`);
|
|
@@ -104,16 +102,16 @@ class PluginLoader {
|
|
|
104
102
|
}
|
|
105
103
|
return plugin;
|
|
106
104
|
}
|
|
107
|
-
async loadPlugin(def,
|
|
105
|
+
async loadPlugin(def, baseUri) {
|
|
108
106
|
let plugin;
|
|
109
107
|
if (util_1.isElectron && isCJSPluginDefinition(def)) {
|
|
110
|
-
plugin = await this.loadCJSPlugin(def,
|
|
108
|
+
plugin = await this.loadCJSPlugin(def, baseUri);
|
|
111
109
|
}
|
|
112
110
|
else if (isESMPluginDefinition(def)) {
|
|
113
|
-
plugin = await this.loadESMPlugin(def,
|
|
111
|
+
plugin = await this.loadESMPlugin(def, baseUri);
|
|
114
112
|
}
|
|
115
113
|
else if (isUMDPluginDefinition(def)) {
|
|
116
|
-
plugin = await this.loadUMDPlugin(def,
|
|
114
|
+
plugin = await this.loadUMDPlugin(def, baseUri);
|
|
117
115
|
}
|
|
118
116
|
else if (!util_1.isElectron && isCJSPluginDefinition(def)) {
|
|
119
117
|
throw new Error(`CommonJS plugin found, but not in a NodeJS environment: ${JSON.stringify(def)}`);
|
|
@@ -129,9 +127,9 @@ class PluginLoader {
|
|
|
129
127
|
return [moduleName, module];
|
|
130
128
|
}));
|
|
131
129
|
}
|
|
132
|
-
async load(
|
|
130
|
+
async load(baseUri) {
|
|
133
131
|
return Promise.all(this.definitions.map(async (definition) => ({
|
|
134
|
-
plugin: await this.loadPlugin(definition,
|
|
132
|
+
plugin: await this.loadPlugin(definition, baseUri),
|
|
135
133
|
definition,
|
|
136
134
|
})));
|
|
137
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "JBrowse 2 core libraries used by plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"access": "public",
|
|
75
75
|
"directory": "dist"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "98ae48be91ee2371e1b2768a907b4997995e9915"
|
|
78
78
|
}
|