@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.
Files changed (2) hide show
  1. package/dist/index.js +89 -46
  2. 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
- // eslint-disable-next-line no-unused-expressions
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 _callee(cb) {
111
+ _time = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cb) {
98
112
  var start, ret;
99
- return _regenerator.default.wrap(function _callee$(_context) {
113
+ return _regenerator.default.wrap(function _callee2$(_context2) {
100
114
  while (1) {
101
- switch (_context.prev = _context.next) {
115
+ switch (_context2.prev = _context2.next) {
102
116
  case 0:
103
117
  start = +Date.now();
104
- _context.next = 3;
118
+ _context2.next = 3;
105
119
  return cb();
106
120
 
107
121
  case 3:
108
- ret = _context.sent;
122
+ ret = _context2.sent;
109
123
  console.log("Finished rendering: ".concat((+Date.now() - start) / 1000, "s"));
110
- return _context.abrupt("return", ret);
124
+ return _context2.abrupt("return", ret);
111
125
 
112
126
  case 6:
113
127
  case "end":
114
- return _context.stop();
128
+ return _context2.stop();
115
129
  }
116
130
  }
117
- }, _callee);
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
- return (0, _renderRegion.renderRegion)(args).then(function (result) {
125
- var outfile = args.out || 'out.svg';
126
-
127
- if (outfile.endsWith('.png')) {
128
- var tmpobj = _tmp.default.fileSync({
129
- mode: 420,
130
- prefix: 'prefix-',
131
- postfix: '.svg'
132
- });
133
-
134
- _fs.default.writeFileSync(tmpobj.name, result);
135
-
136
- var ls = (0, _child_process.spawnSync)('rsvg-convert', ['-w', args.pngwidth || 2048, tmpobj.name, '-o', outfile]);
137
- console.log("rsvg-convert stderr: ".concat(ls.stderr.toString()));
138
- console.log("rsvg-convert stdout: ".concat(ls.stdout.toString()));
139
-
140
- _fs.default.unlinkSync(tmpobj.name);
141
- } else if (outfile.endsWith('.pdf')) {
142
- var _tmpobj = _tmp.default.fileSync({
143
- mode: 420,
144
- prefix: 'prefix-',
145
- postfix: '.svg'
146
- });
147
-
148
- _fs.default.writeFileSync(_tmpobj.name, result);
149
-
150
- var _ls = (0, _child_process.spawnSync)('rsvg-convert', ['-w', args.pngwidth || 2048, _tmpobj.name, '-f', 'pdf', '-o', outfile]);
151
-
152
- console.log("rsvg-convert stderr: ".concat(_ls.stderr.toString()));
153
- console.log("rsvg-convert stdout: ".concat(_ls.stdout.toString()));
154
-
155
- _fs.default.unlinkSync(_tmpobj.name);
156
- } else {
157
- _fs.default.writeFileSync(outfile, result);
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
- }, console.error);
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.5",
3
+ "version": "1.6.6",
4
4
  "main": "index.js",
5
5
  "author": "JBrowse Team",
6
6
  "license": "Apache-2.0",
7
- "engines": ">=16",
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.5",
30
- "@jbrowse/react-linear-genome-view": "^1.6.5",
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": "ab41f017840ffef09f5d60b008281cedaa5abe26"
43
+ "gitHead": "9fcca7793af0df2d6e527ddaace2b368c8ed2879"
41
44
  }