@jbrowse/img 2.16.1 → 2.18.0

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 CHANGED
@@ -5,11 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
7
  const yargs_1 = __importDefault(require("yargs"));
8
- // locals
9
8
  const parseArgv_1 = require("./parseArgv");
10
9
  const renderRegion_1 = require("./renderRegion");
11
- const util_1 = require("./util");
12
10
  const setupEnv_1 = __importDefault(require("./setupEnv"));
11
+ const util_1 = require("./util");
13
12
  (0, setupEnv_1.default)();
14
13
  const err = console.error;
15
14
  console.error = (...p) => {
@@ -23,10 +22,6 @@ console.warn = (...p) => {
23
22
  warn(p);
24
23
  }
25
24
  };
26
- // note: yargs is actually unused except for printing help we do custom command
27
- // line parsing, see parseArgv.ts
28
- //
29
- // eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-unused-expressions
30
25
  yargs_1.default
31
26
  .command('jb2export', 'Creates a jbrowse 2 image snapshot')
32
27
  .option('config', {
@@ -66,7 +61,6 @@ yargs_1.default
66
61
  type: 'number',
67
62
  default: 2048,
68
63
  })
69
- // track types
70
64
  .option('configtracks', {
71
65
  description: 'A list of track labels from a config file',
72
66
  type: 'array',
@@ -103,7 +97,6 @@ yargs_1.default
103
97
  description: 'A bed tabix file, the --bedgz can be used multiple times to specify multiple bedtabix files',
104
98
  type: 'array',
105
99
  })
106
- // other
107
100
  .option('out', {
108
101
  description: 'File to output to. Default: out.svg. If a filename with extension .png is supplied the program will try to automatically execute rsvg-convert to convert it to png',
109
102
  type: 'string',
@@ -144,9 +137,6 @@ const args = (0, parseArgv_1.standardizeArgv)((0, parseArgv_1.parseArgv)(process
144
137
  else {
145
138
  fs_1.default.writeFileSync(out, result);
146
139
  }
147
- // manually exit the process after done rendering because autoruns or
148
- // something similar otherwise keeps the nodejs process alive xref
149
- // https://github.com/GMOD/jb2export/issues/6
150
140
  process.exit(0);
151
141
  }
152
142
  catch (e) {
package/dist/parseArgv.js CHANGED
@@ -2,18 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseArgv = parseArgv;
4
4
  exports.standardizeArgv = standardizeArgv;
5
- // example (see parseArgv.test.js):
6
- // const args =
7
- // '--bam dad.bam color:red --vcf variants.vcf --bam mom.bam --defaultSession --out out.svg --noRasterize'
8
- //
9
- // expect(parseArgv(args.split(' '))).toEqual([
10
- // ['bam', ['dad.bam', 'color:red']],
11
- // ['vcf', ['variants.vcf']],
12
- // ['bam', ['mom.bam']],
13
- // ['defaultSession', []],
14
- // ['out', ['out.svg']],
15
- // ['noRasterize', []],
16
- // ])
17
5
  function parseArgv(argv) {
18
6
  const map = [];
19
7
  while (argv.length) {
@@ -1,4 +1,4 @@
1
- import { Entry } from './parseArgv';
1
+ import type { Entry } from './parseArgv';
2
2
  export interface Opts {
3
3
  noRasterize?: boolean;
4
4
  loc?: string;
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.readData = readData;
7
7
  exports.renderRegion = renderRegion;
8
- const client_1 = require("react-dom/client");
9
- const react_linear_genome_view_1 = require("@jbrowse/react-linear-genome-view");
10
- const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
11
- const path_1 = __importDefault(require("path"));
12
8
  const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
11
+ const react_linear_genome_view_1 = require("@jbrowse/react-linear-genome-view");
12
+ const client_1 = require("react-dom/client");
13
13
  const util_1 = require("./util");
14
14
  function read(file) {
15
15
  let res;
@@ -47,22 +47,15 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
47
47
  if (config) {
48
48
  addRelativePaths(configData, path_1.default.dirname(path_1.default.resolve(config)));
49
49
  }
50
- // the session.json can be a raw session or a json file with a "session"
51
- // attribute, which is what is exported via the "File->Export session" in
52
- // jbrowse-web
53
50
  if (sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) {
54
51
  sessionData = sessionData.session;
55
52
  }
56
- // only export first view
57
53
  if (sessionData === null || sessionData === void 0 ? void 0 : sessionData.views) {
58
54
  sessionData.view = sessionData.views[0];
59
55
  }
60
- // use assembly from file if a file existed
61
56
  if (assemblyData) {
62
57
  configData.assembly = assemblyData;
63
58
  }
64
- // else check if it was an assembly name in a config file
65
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
66
59
  else if ((_a = configData.assemblies) === null || _a === void 0 ? void 0 : _a.length) {
67
60
  configData.assemblies.find(entry => entry.name === asm);
68
61
  if (asm) {
@@ -76,7 +69,6 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
76
69
  configData.assembly = configData.assemblies[0];
77
70
  }
78
71
  }
79
- // else load fasta from command line
80
72
  else if (fasta) {
81
73
  const bgzip = fasta.endsWith('gz');
82
74
  configData.assembly = {
@@ -109,15 +101,12 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
109
101
  };
110
102
  }
111
103
  }
112
- // throw if still no assembly
113
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
114
104
  if (!configData.assembly) {
115
105
  throw new Error('no assembly specified, use --fasta to supply an indexed FASTA file (generated with samtools faidx yourfile.fa). see README for alternatives with --assembly and --config');
116
106
  }
117
107
  if (tracksData) {
118
108
  configData.tracks = tracksData;
119
109
  }
120
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
121
110
  else if (!configData.tracks) {
122
111
  configData.tracks = [];
123
112
  }
@@ -290,11 +279,8 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
290
279
  }
291
280
  });
292
281
  if (!defaultSession) {
293
- // don't use defaultSession from config.json file, can result in assembly
294
- // name confusion
295
282
  configData.defaultSession = undefined;
296
283
  }
297
- // only allow an external manually specified session
298
284
  if (sessionData) {
299
285
  configData.defaultSession = sessionData;
300
286
  }
@@ -308,19 +294,16 @@ function process(trackEntry, view, extra = c => c) {
308
294
  const currentTrack = view.showTrack(extra(track));
309
295
  const display = currentTrack.displays[0];
310
296
  opts.forEach(opt => {
311
- // apply height to any track
312
297
  if (opt.startsWith('height:')) {
313
298
  const [, height] = opt.split(':');
314
299
  if (height) {
315
300
  display.setHeight(+height);
316
301
  }
317
302
  }
318
- // apply sort to pileup
319
303
  else if (opt.startsWith('sort:')) {
320
304
  const [, type, tag] = opt.split(':');
321
305
  display.PileupDisplay.setSortedBy(type, tag);
322
306
  }
323
- // apply color scheme to pileup
324
307
  else if (opt.startsWith('color:')) {
325
308
  const [, type, tag] = opt.split(':');
326
309
  if (display.PileupDisplay) {
@@ -330,19 +313,16 @@ function process(trackEntry, view, extra = c => c) {
330
313
  display.setColor(type);
331
314
  }
332
315
  }
333
- // force track to render even if maxbpperpx limit hit...
334
316
  else if (opt.startsWith('force:')) {
335
317
  const [, force] = opt.split(':');
336
318
  if (force) {
337
319
  display.setFeatureDensityStatsLimit({ bytes: Number.MAX_VALUE });
338
320
  }
339
321
  }
340
- // apply wiggle autoscale
341
322
  else if (opt.startsWith('autoscale:')) {
342
323
  const [, autoscale] = opt.split(':');
343
324
  display.setAutoscale(autoscale);
344
325
  }
345
- // apply min and max score to wiggle
346
326
  else if (opt.startsWith('minmax:')) {
347
327
  const [, min, max] = opt.split(':');
348
328
  if (min) {
@@ -352,22 +332,18 @@ function process(trackEntry, view, extra = c => c) {
352
332
  display.setMaxScore(+max);
353
333
  }
354
334
  }
355
- // apply linear or log scale to wiggle
356
335
  else if (opt.startsWith('scaletype:')) {
357
336
  const [, scaletype] = opt.split(':');
358
337
  display.setScaleType(scaletype);
359
338
  }
360
- // draw crosshatches on wiggle
361
339
  else if (opt.startsWith('crosshatch:')) {
362
340
  const [, val = 'false'] = opt.split(':');
363
341
  display.setCrossHatches((0, util_1.booleanize)(val));
364
342
  }
365
- // turn off fill on bigwig with fill:false
366
343
  else if (opt.startsWith('fill:')) {
367
344
  const [, val = 'true'] = opt.split(':');
368
345
  display.setFill((0, util_1.booleanize)(val));
369
346
  }
370
- // set resolution:superfine to use finer bigwig bin size
371
347
  else if (opt.startsWith('resolution:')) {
372
348
  let [, val = 1] = opt.split(':');
373
349
  if (val === 'fine') {
package/dist/setupEnv.js CHANGED
@@ -24,43 +24,33 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.default = setupEnv;
27
- const node_fetch_1 = __importStar(require("node-fetch"));
28
- const jsdom_1 = require("jsdom");
27
+ const util_1 = require("util");
29
28
  const canvas_1 = require("canvas");
29
+ const jsdom_1 = require("jsdom");
30
+ const node_fetch_1 = __importStar(require("node-fetch"));
30
31
  function setupEnv() {
31
- // @ts-expect-error
32
+ addGlobalCanvasUtils();
33
+ addGlobalTextUtils();
34
+ addGlobalDocument();
35
+ addFetchPolyfill();
36
+ }
37
+ function addGlobalCanvasUtils() {
32
38
  global.nodeImage = canvas_1.Image;
33
- // @ts-expect-error
34
39
  global.nodeCreateCanvas = canvas_1.createCanvas;
40
+ }
41
+ function addGlobalTextUtils() {
42
+ global.TextEncoder = util_1.TextEncoder;
43
+ global.TextDecoder = util_1.TextDecoder;
44
+ }
45
+ function addGlobalDocument() {
35
46
  const window = new jsdom_1.JSDOM('...').window;
36
47
  global.document = window.document;
37
- // @ts-expect-error
38
48
  global.window = window;
39
- // force use of node-fetch polyfill, even if node 18+ fetch is available.
40
- // native node 18+ fetch currently gives errors related to unidici and
41
- // Uint8Array:
42
- //
43
- //
44
- // % node --version
45
- // v18.12.1
46
- //
47
- // % jb2export --fasta https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.fa --bam https://jbrowse.org/code/jb2/main/test_data/volvox/volvox-sorted.bam --loc ctgA:1-1000 --out out4.svg
48
- // [
49
- // '(node:1387934) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time\n' +
50
- // '(Use `node --trace-warnings ...` to show where the warning was created)'
51
- // ]
52
- // [
53
- // RangeError: offset is out of bounds
54
- // at Uint8Array.set (<anonymous>)
55
- // at Response.arrayBuffer (node:internal/deps/undici/undici:6117:23)
56
- // at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
57
- // ]
58
- // @ts-expect-error
49
+ addFetchPolyfill();
50
+ }
51
+ function addFetchPolyfill() {
59
52
  global.fetch = node_fetch_1.default;
60
- // @ts-expect-error
61
53
  global.Headers = node_fetch_1.Headers;
62
- // @ts-expect-error
63
54
  global.Response = node_fetch_1.Response;
64
- // @ts-expect-error
65
55
  global.Request = node_fetch_1.Request;
66
56
  }
package/dist/util.js CHANGED
@@ -5,10 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.booleanize = booleanize;
7
7
  exports.convert = convert;
8
+ const child_process_1 = require("child_process");
8
9
  const fs_1 = __importDefault(require("fs"));
9
10
  const tmp_1 = __importDefault(require("tmp"));
10
- const child_process_1 = require("child_process");
11
- // nice helper function from https://stackoverflow.com/questions/263965/
12
11
  function booleanize(str) {
13
12
  return str === 'false' ? false : !!str;
14
13
  }
package/esm/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import fs from 'fs';
2
2
  import yargs from 'yargs';
3
- // locals
4
- import { standardizeArgv, parseArgv } from './parseArgv';
3
+ import { parseArgv, standardizeArgv } from './parseArgv';
5
4
  import { renderRegion } from './renderRegion';
6
- import { convert } from './util';
7
5
  import setupEnv from './setupEnv';
6
+ import { convert } from './util';
8
7
  setupEnv();
9
8
  const err = console.error;
10
9
  console.error = (...p) => {
@@ -18,10 +17,6 @@ console.warn = (...p) => {
18
17
  warn(p);
19
18
  }
20
19
  };
21
- // note: yargs is actually unused except for printing help we do custom command
22
- // line parsing, see parseArgv.ts
23
- //
24
- // eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-unused-expressions
25
20
  yargs
26
21
  .command('jb2export', 'Creates a jbrowse 2 image snapshot')
27
22
  .option('config', {
@@ -61,7 +56,6 @@ yargs
61
56
  type: 'number',
62
57
  default: 2048,
63
58
  })
64
- // track types
65
59
  .option('configtracks', {
66
60
  description: 'A list of track labels from a config file',
67
61
  type: 'array',
@@ -98,7 +92,6 @@ yargs
98
92
  description: 'A bed tabix file, the --bedgz can be used multiple times to specify multiple bedtabix files',
99
93
  type: 'array',
100
94
  })
101
- // other
102
95
  .option('out', {
103
96
  description: 'File to output to. Default: out.svg. If a filename with extension .png is supplied the program will try to automatically execute rsvg-convert to convert it to png',
104
97
  type: 'string',
@@ -139,9 +132,6 @@ const args = standardizeArgv(parseArgv(process.argv.slice(2)), [
139
132
  else {
140
133
  fs.writeFileSync(out, result);
141
134
  }
142
- // manually exit the process after done rendering because autoruns or
143
- // something similar otherwise keeps the nodejs process alive xref
144
- // https://github.com/GMOD/jb2export/issues/6
145
135
  process.exit(0);
146
136
  }
147
137
  catch (e) {
package/esm/parseArgv.js CHANGED
@@ -1,15 +1,3 @@
1
- // example (see parseArgv.test.js):
2
- // const args =
3
- // '--bam dad.bam color:red --vcf variants.vcf --bam mom.bam --defaultSession --out out.svg --noRasterize'
4
- //
5
- // expect(parseArgv(args.split(' '))).toEqual([
6
- // ['bam', ['dad.bam', 'color:red']],
7
- // ['vcf', ['variants.vcf']],
8
- // ['bam', ['mom.bam']],
9
- // ['defaultSession', []],
10
- // ['out', ['out.svg']],
11
- // ['noRasterize', []],
12
- // ])
13
1
  export function parseArgv(argv) {
14
2
  const map = [];
15
3
  while (argv.length) {
@@ -1,4 +1,4 @@
1
- import { Entry } from './parseArgv';
1
+ import type { Entry } from './parseArgv';
2
2
  export interface Opts {
3
3
  noRasterize?: boolean;
4
4
  loc?: string;
@@ -1,8 +1,8 @@
1
- import { createRoot } from 'react-dom/client';
2
- import { createViewState } from '@jbrowse/react-linear-genome-view';
3
- import { renderToSvg, } from '@jbrowse/plugin-linear-genome-view';
4
- import path from 'path';
5
1
  import fs from 'fs';
2
+ import path from 'path';
3
+ import { renderToSvg } from '@jbrowse/plugin-linear-genome-view';
4
+ import { createViewState } from '@jbrowse/react-linear-genome-view';
5
+ import { createRoot } from 'react-dom/client';
6
6
  import { booleanize } from './util';
7
7
  function read(file) {
8
8
  let res;
@@ -40,22 +40,15 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
40
40
  if (config) {
41
41
  addRelativePaths(configData, path.dirname(path.resolve(config)));
42
42
  }
43
- // the session.json can be a raw session or a json file with a "session"
44
- // attribute, which is what is exported via the "File->Export session" in
45
- // jbrowse-web
46
43
  if (sessionData === null || sessionData === void 0 ? void 0 : sessionData.session) {
47
44
  sessionData = sessionData.session;
48
45
  }
49
- // only export first view
50
46
  if (sessionData === null || sessionData === void 0 ? void 0 : sessionData.views) {
51
47
  sessionData.view = sessionData.views[0];
52
48
  }
53
- // use assembly from file if a file existed
54
49
  if (assemblyData) {
55
50
  configData.assembly = assemblyData;
56
51
  }
57
- // else check if it was an assembly name in a config file
58
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
59
52
  else if ((_a = configData.assemblies) === null || _a === void 0 ? void 0 : _a.length) {
60
53
  configData.assemblies.find(entry => entry.name === asm);
61
54
  if (asm) {
@@ -69,7 +62,6 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
69
62
  configData.assembly = configData.assemblies[0];
70
63
  }
71
64
  }
72
- // else load fasta from command line
73
65
  else if (fasta) {
74
66
  const bgzip = fasta.endsWith('gz');
75
67
  configData.assembly = {
@@ -102,15 +94,12 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
102
94
  };
103
95
  }
104
96
  }
105
- // throw if still no assembly
106
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
107
97
  if (!configData.assembly) {
108
98
  throw new Error('no assembly specified, use --fasta to supply an indexed FASTA file (generated with samtools faidx yourfile.fa). see README for alternatives with --assembly and --config');
109
99
  }
110
100
  if (tracksData) {
111
101
  configData.tracks = tracksData;
112
102
  }
113
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
114
103
  else if (!configData.tracks) {
115
104
  configData.tracks = [];
116
105
  }
@@ -283,11 +272,8 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
283
272
  }
284
273
  });
285
274
  if (!defaultSession) {
286
- // don't use defaultSession from config.json file, can result in assembly
287
- // name confusion
288
275
  configData.defaultSession = undefined;
289
276
  }
290
- // only allow an external manually specified session
291
277
  if (sessionData) {
292
278
  configData.defaultSession = sessionData;
293
279
  }
@@ -301,19 +287,16 @@ function process(trackEntry, view, extra = c => c) {
301
287
  const currentTrack = view.showTrack(extra(track));
302
288
  const display = currentTrack.displays[0];
303
289
  opts.forEach(opt => {
304
- // apply height to any track
305
290
  if (opt.startsWith('height:')) {
306
291
  const [, height] = opt.split(':');
307
292
  if (height) {
308
293
  display.setHeight(+height);
309
294
  }
310
295
  }
311
- // apply sort to pileup
312
296
  else if (opt.startsWith('sort:')) {
313
297
  const [, type, tag] = opt.split(':');
314
298
  display.PileupDisplay.setSortedBy(type, tag);
315
299
  }
316
- // apply color scheme to pileup
317
300
  else if (opt.startsWith('color:')) {
318
301
  const [, type, tag] = opt.split(':');
319
302
  if (display.PileupDisplay) {
@@ -323,19 +306,16 @@ function process(trackEntry, view, extra = c => c) {
323
306
  display.setColor(type);
324
307
  }
325
308
  }
326
- // force track to render even if maxbpperpx limit hit...
327
309
  else if (opt.startsWith('force:')) {
328
310
  const [, force] = opt.split(':');
329
311
  if (force) {
330
312
  display.setFeatureDensityStatsLimit({ bytes: Number.MAX_VALUE });
331
313
  }
332
314
  }
333
- // apply wiggle autoscale
334
315
  else if (opt.startsWith('autoscale:')) {
335
316
  const [, autoscale] = opt.split(':');
336
317
  display.setAutoscale(autoscale);
337
318
  }
338
- // apply min and max score to wiggle
339
319
  else if (opt.startsWith('minmax:')) {
340
320
  const [, min, max] = opt.split(':');
341
321
  if (min) {
@@ -345,22 +325,18 @@ function process(trackEntry, view, extra = c => c) {
345
325
  display.setMaxScore(+max);
346
326
  }
347
327
  }
348
- // apply linear or log scale to wiggle
349
328
  else if (opt.startsWith('scaletype:')) {
350
329
  const [, scaletype] = opt.split(':');
351
330
  display.setScaleType(scaletype);
352
331
  }
353
- // draw crosshatches on wiggle
354
332
  else if (opt.startsWith('crosshatch:')) {
355
333
  const [, val = 'false'] = opt.split(':');
356
334
  display.setCrossHatches(booleanize(val));
357
335
  }
358
- // turn off fill on bigwig with fill:false
359
336
  else if (opt.startsWith('fill:')) {
360
337
  const [, val = 'true'] = opt.split(':');
361
338
  display.setFill(booleanize(val));
362
339
  }
363
- // set resolution:superfine to use finer bigwig bin size
364
340
  else if (opt.startsWith('resolution:')) {
365
341
  let [, val = 1] = opt.split(':');
366
342
  if (val === 'fine') {
package/esm/setupEnv.js CHANGED
@@ -1,40 +1,30 @@
1
- import fetch, { Headers, Response, Request } from 'node-fetch';
2
- import { JSDOM } from 'jsdom';
1
+ import { TextDecoder, TextEncoder } from 'util';
3
2
  import { Image, createCanvas } from 'canvas';
3
+ import { JSDOM } from 'jsdom';
4
+ import fetch, { Headers, Request, Response } from 'node-fetch';
4
5
  export default function setupEnv() {
5
- // @ts-expect-error
6
+ addGlobalCanvasUtils();
7
+ addGlobalTextUtils();
8
+ addGlobalDocument();
9
+ addFetchPolyfill();
10
+ }
11
+ function addGlobalCanvasUtils() {
6
12
  global.nodeImage = Image;
7
- // @ts-expect-error
8
13
  global.nodeCreateCanvas = createCanvas;
14
+ }
15
+ function addGlobalTextUtils() {
16
+ global.TextEncoder = TextEncoder;
17
+ global.TextDecoder = TextDecoder;
18
+ }
19
+ function addGlobalDocument() {
9
20
  const window = new JSDOM('...').window;
10
21
  global.document = window.document;
11
- // @ts-expect-error
12
22
  global.window = window;
13
- // force use of node-fetch polyfill, even if node 18+ fetch is available.
14
- // native node 18+ fetch currently gives errors related to unidici and
15
- // Uint8Array:
16
- //
17
- //
18
- // % node --version
19
- // v18.12.1
20
- //
21
- // % jb2export --fasta https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.fa --bam https://jbrowse.org/code/jb2/main/test_data/volvox/volvox-sorted.bam --loc ctgA:1-1000 --out out4.svg
22
- // [
23
- // '(node:1387934) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time\n' +
24
- // '(Use `node --trace-warnings ...` to show where the warning was created)'
25
- // ]
26
- // [
27
- // RangeError: offset is out of bounds
28
- // at Uint8Array.set (<anonymous>)
29
- // at Response.arrayBuffer (node:internal/deps/undici/undici:6117:23)
30
- // at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
31
- // ]
32
- // @ts-expect-error
23
+ addFetchPolyfill();
24
+ }
25
+ function addFetchPolyfill() {
33
26
  global.fetch = fetch;
34
- // @ts-expect-error
35
27
  global.Headers = Headers;
36
- // @ts-expect-error
37
28
  global.Response = Response;
38
- // @ts-expect-error
39
29
  global.Request = Request;
40
30
  }
package/esm/util.js CHANGED
@@ -1,7 +1,6 @@
1
+ import { spawnSync } from 'child_process';
1
2
  import fs from 'fs';
2
3
  import tmp from 'tmp';
3
- import { spawnSync } from 'child_process';
4
- // nice helper function from https://stackoverflow.com/questions/263965/
5
4
  export function booleanize(str) {
6
5
  return str === 'false' ? false : !!str;
7
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/img",
3
- "version": "2.16.1",
3
+ "version": "2.18.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "esm/index.js",
6
6
  "author": "JBrowse Team",
@@ -27,8 +27,8 @@
27
27
  "@babel/runtime": "^7.17.9",
28
28
  "@emotion/cache": "^11.7.1",
29
29
  "@emotion/react": "^11.9.0",
30
- "@jbrowse/plugin-linear-genome-view": "^2.16.1",
31
- "@jbrowse/react-linear-genome-view": "^2.16.1",
30
+ "@jbrowse/plugin-linear-genome-view": "^2.18.0",
31
+ "@jbrowse/react-linear-genome-view": "^2.18.0",
32
32
  "canvas": "^2.9.1",
33
33
  "jsdom": "^24.0.0",
34
34
  "mobx": "^6.6.0",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
44
+ "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
45
45
  }