@jbrowse/img 3.6.5 → 4.0.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/package.json CHANGED
@@ -1,44 +1,50 @@
1
1
  {
2
2
  "name": "@jbrowse/img",
3
- "version": "3.6.5",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
- "module": "esm/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./esm/index.js",
10
+ "require": "./dist/index.js"
11
+ }
12
+ },
6
13
  "author": "JBrowse Team",
7
14
  "license": "Apache-2.0",
8
15
  "engines": {
9
- "node": ">=14"
16
+ "node": ">=20"
10
17
  },
11
18
  "bin": {
12
19
  "jb2export": "./dist/bin.js"
13
20
  },
14
21
  "files": [
15
- "dist",
16
22
  "esm"
17
23
  ],
18
- "scripts": {
19
- "clean": "rm -rf dist esm *.tsbuildinfo",
20
- "prebuild": "yarn clean",
21
- "build": "npm-run-all build:*",
22
- "build:esm": "tsc --build tsconfig.build.esm.json",
23
- "build:commonjs": "tsc --build tsconfig.build.commonjs.json",
24
- "preversion": "npm run build"
25
- },
24
+ "sideEffects": false,
26
25
  "dependencies": {
27
- "@babel/runtime": "^7.17.9",
28
- "@emotion/cache": "^11.7.1",
29
- "@emotion/react": "^11.9.0",
30
- "@jbrowse/react-linear-genome-view2": "^3.6.5",
31
- "canvas": "^3.0.0",
32
- "jsdom": "^26.0.0",
33
- "mobx": "^6.6.0",
34
- "node-fetch": "^2.6.7",
35
- "react": "^19.0.0",
36
- "react-dom": "^19.0.0",
37
- "tmp": "^0.2.1",
38
- "yargs": "^17.3.0"
26
+ "@emotion/cache": "^11.14.0",
27
+ "@emotion/react": "^11.14.0",
28
+ "canvas": "^3.2.0",
29
+ "@types/jsdom": "^21.1.7",
30
+ "@types/yargs": "^17.0.33",
31
+ "jsdom": "27.0.0",
32
+ "node-fetch": "^2.7.0",
33
+ "react": "^19.2.3",
34
+ "react-dom": "^19.2.3",
35
+ "tmp": "^0.2.5",
36
+ "yargs": "^18.0.0",
37
+ "@jbrowse/plugin-linear-genome-view": "^4.0.0",
38
+ "@jbrowse/react-linear-genome-view2": "^4.0.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "354d0a87b757b4d84f824b47507662f6f3a1693f"
44
- }
43
+ "scripts": {
44
+ "clean": "rm -rf esm *.tsbuildinfo",
45
+ "prebuild": "pnpm clean",
46
+ "build": "pnpm run /^build:/",
47
+ "build:esm": "tsc --build tsconfig.build.esm.json",
48
+ "preversion": "pnpm build"
49
+ }
50
+ }
package/dist/bin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/bin.js DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- const Module = require('module');
4
- const originalRequire = Module.prototype.require;
5
- Module.prototype.require = function (path) {
6
- if (path.endsWith('.css')) {
7
- return {};
8
- }
9
- return Reflect.apply(originalRequire, this, arguments);
10
- };
11
- require('./index.js');
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js DELETED
@@ -1,146 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const yargs_1 = __importDefault(require("yargs"));
8
- const parseArgv_1 = require("./parseArgv");
9
- const renderRegion_1 = require("./renderRegion");
10
- const setupEnv_1 = __importDefault(require("./setupEnv"));
11
- const util_1 = require("./util");
12
- (0, setupEnv_1.default)();
13
- const err = console.error;
14
- console.error = (...p) => {
15
- if (!/useLayoutEffect/.exec(`${p[0]}`)) {
16
- err(p);
17
- }
18
- };
19
- const warn = console.warn;
20
- console.warn = (...p) => {
21
- if (!/estimation reached timeout/.exec(`${p[0]}`)) {
22
- warn(p);
23
- }
24
- };
25
- yargs_1.default
26
- .command('jb2export', 'Creates a jbrowse 2 image snapshot')
27
- .option('config', {
28
- description: 'Path to config file',
29
- type: 'string',
30
- })
31
- .option('session', {
32
- description: 'Path to session file',
33
- type: 'string',
34
- })
35
- .option('assembly', {
36
- description: 'Path to an assembly configuration, or a name of an assembly in the configFile',
37
- type: 'string',
38
- })
39
- .option('tracks', {
40
- description: 'Path to tracks portion of a session',
41
- type: 'string',
42
- })
43
- .option('loc', {
44
- description: 'A locstring to navigate to, or --loc all to view the whole genome',
45
- type: 'string',
46
- })
47
- .option('fasta', {
48
- description: 'Supply a fasta for the assembly',
49
- type: 'string',
50
- })
51
- .option('aliases', {
52
- description: 'Supply aliases for the assembly, e.g. mapping of 1 to chr1. Tab separated file where column 1 matches the names from the FASTA',
53
- type: 'string',
54
- })
55
- .option('width', {
56
- description: 'Set the width of the window that jbrowse renders to, default: 1500px',
57
- type: 'number',
58
- })
59
- .option('pngwidth', {
60
- description: 'Set the width of the png canvas if using png output, default 2048px',
61
- type: 'number',
62
- default: 2048,
63
- })
64
- .option('configtracks', {
65
- description: 'A list of track labels from a config file',
66
- type: 'array',
67
- })
68
- .option('bam', {
69
- description: 'A bam file, flag --bam can be used multiple times to specify multiple bam files',
70
- type: 'array',
71
- })
72
- .option('bigwig', {
73
- description: 'A bigwig file, the --bigwig flag can be used multiple times to specify multiple bigwig files',
74
- type: 'array',
75
- })
76
- .option('cram', {
77
- description: 'A cram file, the --cram flag can be used multiple times to specify multiple cram files',
78
- type: 'array',
79
- })
80
- .option('vcfgz', {
81
- description: 'A tabixed VCF, the --vcfgz flag can be used multiple times to specify multiple vcfgz files',
82
- type: 'array',
83
- })
84
- .option('gffgz', {
85
- description: 'A tabixed GFF, the --gffgz can be used multiple times to specify multiple gffgz files',
86
- type: 'array',
87
- })
88
- .option('hic', {
89
- description: 'A .hic file, the --hic can be used multiple times to specify multiple hic files',
90
- type: 'array',
91
- })
92
- .option('bigbed', {
93
- description: 'A .bigBed file, the --bigbed can be used multiple times to specify multiple bigbed files',
94
- type: 'array',
95
- })
96
- .option('bedgz', {
97
- description: 'A bed tabix file, the --bedgz can be used multiple times to specify multiple bedtabix files',
98
- type: 'array',
99
- })
100
- .option('out', {
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',
102
- type: 'string',
103
- default: 'out.svg',
104
- })
105
- .option('noRasterize', {
106
- description: 'Use full SVG rendering with no rasterized layers, this can substantially increase filesize',
107
- type: 'boolean',
108
- })
109
- .option('defaultSession', {
110
- description: 'Use the defaultSession from config.json',
111
- type: 'boolean',
112
- })
113
- .help()
114
- .alias('help', 'h')
115
- .alias('width', 'w').argv;
116
- const args = (0, parseArgv_1.standardizeArgv)((0, parseArgv_1.parseArgv)(process.argv.slice(2)), [
117
- 'bam',
118
- 'cram',
119
- 'vcfgz',
120
- 'hic',
121
- 'bigwig',
122
- 'bigbed',
123
- 'bedgz',
124
- 'gffgz',
125
- 'configtracks',
126
- ]);
127
- (async () => {
128
- try {
129
- const result = await (0, renderRegion_1.renderRegion)(args);
130
- const { out = 'out.svg', pngwidth = '2048' } = args;
131
- if (out.endsWith('.png')) {
132
- (0, util_1.convert)(result, { out, pngwidth });
133
- }
134
- else if (out.endsWith('.pdf')) {
135
- (0, util_1.convert)(result, { out, pngwidth }, ['-f', 'pdf']);
136
- }
137
- else {
138
- fs_1.default.writeFileSync(out, result);
139
- }
140
- process.exit(0);
141
- }
142
- catch (e) {
143
- console.error(e);
144
- process.exit(1);
145
- }
146
- })();
@@ -1,8 +0,0 @@
1
- export type Entry = [string, string[]];
2
- export declare function parseArgv(argv: string[]): Entry[];
3
- export declare function standardizeArgv(args: Entry[], trackTypes: string[]): {
4
- [key: string]: unknown;
5
- trackList: Entry[];
6
- out?: string;
7
- pngwidth?: string;
8
- };
package/dist/parseArgv.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseArgv = parseArgv;
4
- exports.standardizeArgv = standardizeArgv;
5
- function parseArgv(argv) {
6
- const map = [];
7
- while (argv.length) {
8
- const val = argv[0].slice(2);
9
- argv = argv.slice(1);
10
- const next = argv.findIndex(arg => arg.startsWith('-'));
11
- if (next !== -1) {
12
- map.push([val, argv.slice(0, next)]);
13
- argv = argv.slice(next);
14
- }
15
- else {
16
- map.push([val, argv]);
17
- break;
18
- }
19
- }
20
- return map;
21
- }
22
- function standardizeArgv(args, trackTypes) {
23
- const result = { trackList: [] };
24
- for (const arg of args) {
25
- if (trackTypes.includes(arg[0])) {
26
- result.trackList.push(arg);
27
- }
28
- else {
29
- result[arg[0]] = arg[1][0] || true;
30
- }
31
- }
32
- return result;
33
- }
@@ -1,34 +0,0 @@
1
- import type { Entry } from './parseArgv';
2
- export interface Opts {
3
- noRasterize?: boolean;
4
- loc?: string;
5
- width?: number;
6
- session?: string;
7
- assembly?: string;
8
- config?: string;
9
- fasta?: string;
10
- aliases?: string;
11
- cytobands?: string;
12
- defaultSession?: string;
13
- trackList?: Entry[];
14
- tracks?: string;
15
- }
16
- interface Assembly {
17
- name: string;
18
- sequence: Record<string, unknown>;
19
- refNameAliases?: Record<string, unknown>;
20
- cytobands?: Record<string, unknown>;
21
- }
22
- interface Track {
23
- trackId: string;
24
- [key: string]: unknown;
25
- }
26
- interface Config {
27
- assemblies: Assembly[];
28
- assembly: Assembly;
29
- tracks: Track[];
30
- [key: string]: unknown;
31
- }
32
- export declare function readData({ assembly: asm, config, session, fasta, aliases, cytobands, defaultSession, tracks, trackList, }: Opts): Config;
33
- export declare function renderRegion(opts: Opts): Promise<string>;
34
- export {};