@jbrowse/img 2.16.1 → 2.17.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/setupEnv.js CHANGED
@@ -27,15 +27,32 @@ exports.default = setupEnv;
27
27
  const node_fetch_1 = __importStar(require("node-fetch"));
28
28
  const jsdom_1 = require("jsdom");
29
29
  const canvas_1 = require("canvas");
30
+ const util_1 = require("util");
30
31
  function setupEnv() {
32
+ addGlobalCanvasUtils();
33
+ addGlobalTextUtils();
34
+ addGlobalDocument();
35
+ addFetchPolyfill();
36
+ }
37
+ function addGlobalCanvasUtils() {
31
38
  // @ts-expect-error
32
39
  global.nodeImage = canvas_1.Image;
33
40
  // @ts-expect-error
34
41
  global.nodeCreateCanvas = canvas_1.createCanvas;
42
+ }
43
+ function addGlobalTextUtils() {
44
+ global.TextEncoder = util_1.TextEncoder;
45
+ // @ts-expect-error
46
+ global.TextDecoder = util_1.TextDecoder;
47
+ }
48
+ function addGlobalDocument() {
35
49
  const window = new jsdom_1.JSDOM('...').window;
36
50
  global.document = window.document;
37
51
  // @ts-expect-error
38
52
  global.window = window;
53
+ addFetchPolyfill();
54
+ }
55
+ function addFetchPolyfill() {
39
56
  // force use of node-fetch polyfill, even if node 18+ fetch is available.
40
57
  // native node 18+ fetch currently gives errors related to unidici and
41
58
  // Uint8Array:
package/esm/setupEnv.js CHANGED
@@ -1,15 +1,32 @@
1
1
  import fetch, { Headers, Response, Request } from 'node-fetch';
2
2
  import { JSDOM } from 'jsdom';
3
3
  import { Image, createCanvas } from 'canvas';
4
+ import { TextEncoder, TextDecoder } from 'util';
4
5
  export default function setupEnv() {
6
+ addGlobalCanvasUtils();
7
+ addGlobalTextUtils();
8
+ addGlobalDocument();
9
+ addFetchPolyfill();
10
+ }
11
+ function addGlobalCanvasUtils() {
5
12
  // @ts-expect-error
6
13
  global.nodeImage = Image;
7
14
  // @ts-expect-error
8
15
  global.nodeCreateCanvas = createCanvas;
16
+ }
17
+ function addGlobalTextUtils() {
18
+ global.TextEncoder = TextEncoder;
19
+ // @ts-expect-error
20
+ global.TextDecoder = TextDecoder;
21
+ }
22
+ function addGlobalDocument() {
9
23
  const window = new JSDOM('...').window;
10
24
  global.document = window.document;
11
25
  // @ts-expect-error
12
26
  global.window = window;
27
+ addFetchPolyfill();
28
+ }
29
+ function addFetchPolyfill() {
13
30
  // force use of node-fetch polyfill, even if node 18+ fetch is available.
14
31
  // native node 18+ fetch currently gives errors related to unidici and
15
32
  // Uint8Array:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/img",
3
- "version": "2.16.1",
3
+ "version": "2.17.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.17.0",
31
+ "@jbrowse/react-linear-genome-view": "^2.17.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": "eed30b5e671f8f7823652d7cecc51aa89226de46"
45
45
  }