@jbrowse/img 1.6.5 → 1.6.8

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