Skip to content

Commit

Permalink
feat(pee): Make package.json hybrid cjs/mjs module and change filenam…
Browse files Browse the repository at this point in the history
…es to standard nomenclature
  • Loading branch information
jukefr committed Mar 26, 2022
1 parent 9c5402a commit d928e95
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
"name": "pee.js",
"version": "1.0.0",
"description": "A javascript Library for leaking memory",
"main": "pee.node.js",
"type": "module",
"main": "pee.cjs",
"module": "pee.js",
"browser": "pee.js",
"exports": {
".": {
"require": "./pee.cjs",
"default": "./pee.js"
}
},
"scripts": {
"test": "node ./test/test.node.js"
},
Expand Down
6 changes: 4 additions & 2 deletions pee.node.js → pee.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ function leak(mb) {
// Pee some memory into the toilet
toilet.push(new ImageData(1, 1));
}

// Giving it a little wiggle does not appear to be necessary in Node, so we can just stop it here :(
}

exports.leak = leak;
module.exports = {
leak
}
4 changes: 3 additions & 1 deletion pee.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ImageData from '@canvas/image-data'

// Toilet for the pee
let toilet = [];

Expand All @@ -7,7 +9,7 @@ export function leak(mb) {
// Pee some memory into the toilet
toilet.push(new ImageData(1, 1));
}

// Give it a little wiggle
giveItALittleWiggle();
}
Expand Down

0 comments on commit d928e95

Please sign in to comment.