Skip to content

Commit

Permalink
INCOMPLETE: the new rollup/plugin-terser still needs source maps and …
Browse files Browse the repository at this point in the history
…webcrypto detection isn't working due to nodejs/node#45987
  • Loading branch information
brettz9 committed Jan 1, 2023
1 parent 86ae602 commit 3bbc736
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 106 deletions.
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {rollup} from 'rollup';
import {babel} from '@rollup/plugin-babel';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import {terser} from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';

// fs.promises is not available until Node 11 (and need for URL until 10.0.0)

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.2.1",
"c8": "^7.12.0",
"canvas": "^2.11.0",
"chai": "^4.3.7",
Expand All @@ -109,10 +110,8 @@
"eslint-plugin-unicorn": "^45.0.2",
"jsdom": "^20.0.3",
"mocha": "^10.2.0",
"node-webcrypto-ossl": "^2.1.3",
"open-cli": "^7.1.0",
"rollup": "^3.9.0",
"rollup-plugin-terser": "^7.0.2",
"socket.io": "^4.5.4",
"socket.io-client": "^4.5.4"
},
Expand Down
119 changes: 21 additions & 98 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion polyfills/createObjectURL.umd.js.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions test/test-node.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import path from 'node:path';
import http from 'node:http';
import {webcrypto} from 'node:crypto';

// eslint-disable-next-line no-shadow -- This is not a regular test file
import chai from 'chai';
import jsdom from 'jsdom';
import canvas from 'canvas';
import {Server} from 'socket.io';
import socketIOClient from 'socket.io-client';
import {Crypto} from 'node-webcrypto-ossl';

const __dirname = path.resolve(path.dirname(decodeURI(
new URL(import.meta.url).pathname
Expand Down Expand Up @@ -51,9 +51,7 @@ global.File = window.File;
global.DOMException = window.DOMException;
global.performance = window.performance;

const crypto = new Crypto();

global.crypto = crypto;
global.crypto = webcrypto;

// Should be available in jsdom: https://github.com/Automattic/node-canvas/issues/876
global.createImageBitmap = function (cvs) {
Expand Down

0 comments on commit 3bbc736

Please sign in to comment.