@jbrowse/img 1.6.5 → 1.6.6
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/dist/index.js +89 -46
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -16,10 +16,24 @@ var _renderRegion = require("./renderRegion");
|
|
|
16
16
|
|
|
17
17
|
var _tmp = _interopRequireDefault(require("tmp"));
|
|
18
18
|
|
|
19
|
+
require("abortcontroller-polyfill/dist/abortcontroller-polyfill-only");
|
|
20
|
+
|
|
19
21
|
var _child_process = require("child_process");
|
|
20
22
|
|
|
21
23
|
/* eslint-disable no-console */
|
|
22
|
-
|
|
24
|
+
var err = console.error;
|
|
25
|
+
|
|
26
|
+
console.error = function () {
|
|
27
|
+
var _args$;
|
|
28
|
+
|
|
29
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
+
args[_key] = arguments[_key];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (_args$ = args[0]) !== null && _args$ !== void 0 && _args$.match('useLayoutEffect') ? null : err(args);
|
|
34
|
+
}; // eslint-disable-next-line no-unused-expressions
|
|
35
|
+
|
|
36
|
+
|
|
23
37
|
_yargs.default.command('jb2export', 'Creates a jbrowse 2 image snapshot').option('config', {
|
|
24
38
|
description: 'Path to config file',
|
|
25
39
|
type: 'string'
|
|
@@ -94,67 +108,96 @@ function time(_x) {
|
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
function _time() {
|
|
97
|
-
_time = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
111
|
+
_time = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cb) {
|
|
98
112
|
var start, ret;
|
|
99
|
-
return _regenerator.default.wrap(function
|
|
113
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
100
114
|
while (1) {
|
|
101
|
-
switch (
|
|
115
|
+
switch (_context2.prev = _context2.next) {
|
|
102
116
|
case 0:
|
|
103
117
|
start = +Date.now();
|
|
104
|
-
|
|
118
|
+
_context2.next = 3;
|
|
105
119
|
return cb();
|
|
106
120
|
|
|
107
121
|
case 3:
|
|
108
|
-
ret =
|
|
122
|
+
ret = _context2.sent;
|
|
109
123
|
console.log("Finished rendering: ".concat((+Date.now() - start) / 1000, "s"));
|
|
110
|
-
return
|
|
124
|
+
return _context2.abrupt("return", ret);
|
|
111
125
|
|
|
112
126
|
case 6:
|
|
113
127
|
case "end":
|
|
114
|
-
return
|
|
128
|
+
return _context2.stop();
|
|
115
129
|
}
|
|
116
130
|
}
|
|
117
|
-
},
|
|
131
|
+
}, _callee2);
|
|
118
132
|
}));
|
|
119
133
|
return _time.apply(this, arguments);
|
|
120
134
|
}
|
|
121
135
|
|
|
122
136
|
var args = (0, _parseArgv.standardizeArgv)((0, _parseArgv.parseArgv)(process.argv.slice(2)), ['bam', 'cram', 'vcfgz', 'hic', 'bigwig', 'bigbed', 'bedgz', 'gffgz', 'configtracks']);
|
|
123
|
-
time(function () {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
137
|
+
time( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
138
|
+
var result, outfile, tmpobj, ls, _tmpobj, _ls;
|
|
139
|
+
|
|
140
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
141
|
+
while (1) {
|
|
142
|
+
switch (_context.prev = _context.next) {
|
|
143
|
+
case 0:
|
|
144
|
+
_context.prev = 0;
|
|
145
|
+
_context.next = 3;
|
|
146
|
+
return (0, _renderRegion.renderRegion)(args);
|
|
147
|
+
|
|
148
|
+
case 3:
|
|
149
|
+
result = _context.sent;
|
|
150
|
+
outfile = args.out || 'out.svg';
|
|
151
|
+
|
|
152
|
+
if (outfile.endsWith('.png')) {
|
|
153
|
+
tmpobj = _tmp.default.fileSync({
|
|
154
|
+
mode: 420,
|
|
155
|
+
prefix: 'prefix-',
|
|
156
|
+
postfix: '.svg'
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
_fs.default.writeFileSync(tmpobj.name, result);
|
|
160
|
+
|
|
161
|
+
ls = (0, _child_process.spawnSync)('rsvg-convert', ['-w', args.pngwidth || 2048, tmpobj.name, '-o', outfile]);
|
|
162
|
+
console.log("rsvg-convert stderr: ".concat(ls.stderr.toString()));
|
|
163
|
+
console.log("rsvg-convert stdout: ".concat(ls.stdout.toString()));
|
|
164
|
+
|
|
165
|
+
_fs.default.unlinkSync(tmpobj.name);
|
|
166
|
+
} else if (outfile.endsWith('.pdf')) {
|
|
167
|
+
_tmpobj = _tmp.default.fileSync({
|
|
168
|
+
mode: 420,
|
|
169
|
+
prefix: 'prefix-',
|
|
170
|
+
postfix: '.svg'
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
_fs.default.writeFileSync(_tmpobj.name, result);
|
|
174
|
+
|
|
175
|
+
_ls = (0, _child_process.spawnSync)('rsvg-convert', ['-w', args.pngwidth || 2048, _tmpobj.name, '-f', 'pdf', '-o', outfile]);
|
|
176
|
+
console.log("rsvg-convert stderr: ".concat(_ls.stderr.toString()));
|
|
177
|
+
console.log("rsvg-convert stdout: ".concat(_ls.stdout.toString()));
|
|
178
|
+
|
|
179
|
+
_fs.default.unlinkSync(_tmpobj.name);
|
|
180
|
+
} else {
|
|
181
|
+
_fs.default.writeFileSync(outfile, result);
|
|
182
|
+
} // manually exit the process after done rendering because autoruns or
|
|
183
|
+
// something similar otherwise keeps the nodejs process alive xref
|
|
184
|
+
// https://github.com/GMOD/jb2export/issues/6
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
process.exit(0);
|
|
188
|
+
_context.next = 13;
|
|
189
|
+
break;
|
|
190
|
+
|
|
191
|
+
case 9:
|
|
192
|
+
_context.prev = 9;
|
|
193
|
+
_context.t0 = _context["catch"](0);
|
|
194
|
+
console.error(_context.t0);
|
|
195
|
+
process.exit(1);
|
|
196
|
+
|
|
197
|
+
case 13:
|
|
198
|
+
case "end":
|
|
199
|
+
return _context.stop();
|
|
200
|
+
}
|
|
158
201
|
}
|
|
159
|
-
},
|
|
160
|
-
});
|
|
202
|
+
}, _callee, null, [[0, 9]]);
|
|
203
|
+
})));
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/img",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "JBrowse Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"engines":
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=14"
|
|
9
|
+
},
|
|
8
10
|
"bin": {
|
|
9
11
|
"jb2export": "./dist/bin.js"
|
|
10
12
|
},
|
|
@@ -26,8 +28,9 @@
|
|
|
26
28
|
"postversion": "git push --follow-tags"
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
29
|
-
"@jbrowse/plugin-linear-genome-view": "^1.6.
|
|
30
|
-
"@jbrowse/react-linear-genome-view": "^1.6.
|
|
31
|
+
"@jbrowse/plugin-linear-genome-view": "^1.6.6",
|
|
32
|
+
"@jbrowse/react-linear-genome-view": "^1.6.6",
|
|
33
|
+
"abortcontroller-polyfill": "^1.7.3",
|
|
31
34
|
"mobx": "^5.10.1",
|
|
32
35
|
"react": "^17.0.1",
|
|
33
36
|
"react-dom": "^17.0.1",
|
|
@@ -37,5 +40,5 @@
|
|
|
37
40
|
"publishConfig": {
|
|
38
41
|
"access": "public"
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9fcca7793af0df2d6e527ddaace2b368c8ed2879"
|
|
41
44
|
}
|