From abb9ef596bab15d86c519403704591ab372c9258 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Thu, 6 Feb 2020 01:16:27 +0200 Subject: [PATCH 01/19] feat: support custom serialize & deserialize through options Signed-off-by: Charlike Mike Reagent --- .../c9b2699c-511f-420f-abd8-51a0b2da4d05.json | 1 + .../c9b2699c-511f-420f-abd8-51a0b2da4d05.json | 1 + .nyc_output/processinfo/index.json | 1 + index.js | 82 ++++++--- package-lock.json | 169 +++++++++++------- package.json | 10 +- test/test.js | 56 +++++- 7 files changed, 221 insertions(+), 99 deletions(-) create mode 100644 .nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json create mode 100644 .nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json create mode 100644 .nyc_output/processinfo/index.json diff --git a/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json b/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json new file mode 100644 index 0000000..e5917cb --- /dev/null +++ b/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json @@ -0,0 +1 @@ +{"/home/charlike/github/memoize-fs/index.js":{"path":"/home/charlike/github/memoize-fs/index.js","statementMap":{"0":{"start":{"line":2,"column":13},"end":{"line":2,"column":28}},"1":{"start":{"line":3,"column":15},"end":{"line":3,"column":32}},"2":{"start":{"line":4,"column":16},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"5":{"start":{"line":8,"column":0},"end":{"line":8,"column":50}},"6":{"start":{"line":10,"column":19},"end":{"line":13,"column":1}},"7":{"start":{"line":16,"column":22},"end":{"line":16,"column":24}},"8":{"start":{"line":17,"column":2},"end":{"line":30,"column":4}},"9":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":12}},"11":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"12":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"13":{"start":{"line":24,"column":8},"end":{"line":24,"column":14}},"14":{"start":{"line":27,"column":6},"end":{"line":27,"column":29}},"15":{"start":{"line":29,"column":4},"end":{"line":29,"column":16}},"16":{"start":{"line":34,"column":2},"end":{"line":34,"column":28}},"17":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"18":{"start":{"line":39,"column":14},"end":{"line":39,"column":16}},"19":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"20":{"start":{"line":41,"column":4},"end":{"line":41,"column":22}},"21":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"22":{"start":{"line":43,"column":6},"end":{"line":43,"column":61}},"23":{"start":{"line":45,"column":4},"end":{"line":45,"column":55}},"24":{"start":{"line":48,"column":18},"end":{"line":48,"column":52}},"25":{"start":{"line":49,"column":15},"end":{"line":49,"column":84}},"26":{"start":{"line":50,"column":2},"end":{"line":50,"column":52}},"27":{"start":{"line":54,"column":23},"end":{"line":54,"column":25}},"28":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"29":{"start":{"line":58,"column":4},"end":{"line":58,"column":54}},"30":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"31":{"start":{"line":61,"column":4},"end":{"line":61,"column":63}},"32":{"start":{"line":63,"column":2},"end":{"line":63,"column":41}},"33":{"start":{"line":67,"column":4},"end":{"line":82,"column":6}},"34":{"start":{"line":68,"column":6},"end":{"line":81,"column":10}},"35":{"start":{"line":70,"column":10},"end":{"line":70,"column":19}},"36":{"start":{"line":80,"column":10},"end":{"line":80,"column":21}},"37":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"38":{"start":{"line":88,"column":8},"end":{"line":88,"column":94}},"39":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"40":{"start":{"line":91,"column":8},"end":{"line":91,"column":100}},"41":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"42":{"start":{"line":94,"column":8},"end":{"line":94,"column":80}},"43":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"44":{"start":{"line":99,"column":6},"end":{"line":99,"column":80}},"45":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"46":{"start":{"line":103,"column":6},"end":{"line":103,"column":53}},"47":{"start":{"line":106,"column":19},"end":{"line":106,"column":56}},"48":{"start":{"line":107,"column":4},"end":{"line":107,"column":24}},"49":{"start":{"line":109,"column":4},"end":{"line":109,"column":43}},"50":{"start":{"line":119,"column":6},"end":{"line":268,"column":8}},"51":{"start":{"line":120,"column":22},"end":{"line":266,"column":9}},"52":{"start":{"line":121,"column":23},"end":{"line":121,"column":60}},"53":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"54":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"55":{"start":{"line":125,"column":12},"end":{"line":125,"column":31}},"56":{"start":{"line":128,"column":27},"end":{"line":128,"column":66}},"57":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"58":{"start":{"line":131,"column":12},"end":{"line":131,"column":41}},"59":{"start":{"line":134,"column":10},"end":{"line":261,"column":12}},"60":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"61":{"start":{"line":142,"column":18},"end":{"line":142,"column":41}},"62":{"start":{"line":143,"column":18},"end":{"line":143,"column":60}},"63":{"start":{"line":145,"column":18},"end":{"line":145,"column":53}},"64":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"65":{"start":{"line":148,"column":18},"end":{"line":154,"column":35}},"66":{"start":{"line":149,"column":20},"end":{"line":153,"column":22}},"67":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"68":{"start":{"line":151,"column":24},"end":{"line":151,"column":33}},"69":{"start":{"line":156,"column":16},"end":{"line":156,"column":56}},"70":{"start":{"line":160,"column":16},"end":{"line":160,"column":26}},"71":{"start":{"line":162,"column":16},"end":{"line":174,"column":18}},"72":{"start":{"line":163,"column":32},"end":{"line":163,"column":44}},"73":{"start":{"line":164,"column":33},"end":{"line":164,"column":70}},"74":{"start":{"line":165,"column":18},"end":{"line":165,"column":32}},"75":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"76":{"start":{"line":168,"column":20},"end":{"line":168,"column":40}},"77":{"start":{"line":170,"column":18},"end":{"line":170,"column":38}},"78":{"start":{"line":171,"column":18},"end":{"line":173,"column":20}},"79":{"start":{"line":172,"column":20},"end":{"line":172,"column":54}},"80":{"start":{"line":175,"column":16},"end":{"line":175,"column":36}},"81":{"start":{"line":179,"column":16},"end":{"line":183,"column":17}},"82":{"start":{"line":180,"column":18},"end":{"line":180,"column":47}},"83":{"start":{"line":182,"column":18},"end":{"line":182,"column":34}},"84":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"85":{"start":{"line":186,"column":18},"end":{"line":194,"column":20}},"86":{"start":{"line":187,"column":20},"end":{"line":189,"column":22}},"87":{"start":{"line":188,"column":22},"end":{"line":188,"column":37}},"88":{"start":{"line":193,"column":20},"end":{"line":193,"column":31}},"89":{"start":{"line":196,"column":18},"end":{"line":202,"column":20}},"90":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"91":{"start":{"line":198,"column":22},"end":{"line":198,"column":33}},"92":{"start":{"line":200,"column":22},"end":{"line":200,"column":37}},"93":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"94":{"start":{"line":207,"column":16},"end":{"line":207,"column":39}},"95":{"start":{"line":209,"column":14},"end":{"line":209,"column":32}},"96":{"start":{"line":212,"column":12},"end":{"line":260,"column":14}},"97":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"98":{"start":{"line":214,"column":16},"end":{"line":214,"column":39}},"99":{"start":{"line":218,"column":16},"end":{"line":218,"column":69}},"100":{"start":{"line":222,"column":16},"end":{"line":234,"column":17}},"101":{"start":{"line":223,"column":44},"end":{"line":223,"column":76}},"102":{"start":{"line":233,"column":18},"end":{"line":233,"column":34}},"103":{"start":{"line":239,"column":18},"end":{"line":239,"column":63}},"104":{"start":{"line":243,"column":18},"end":{"line":243,"column":44}},"105":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"106":{"start":{"line":247,"column":18},"end":{"line":247,"column":41}},"107":{"start":{"line":249,"column":16},"end":{"line":249,"column":34}},"108":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"109":{"start":{"line":253,"column":16},"end":{"line":253,"column":35}},"110":{"start":{"line":255,"column":16},"end":{"line":255,"column":32}},"111":{"start":{"line":258,"column":16},"end":{"line":258,"column":35}},"112":{"start":{"line":262,"column":10},"end":{"line":264,"column":12}},"113":{"start":{"line":263,"column":12},"end":{"line":263,"column":41}},"114":{"start":{"line":265,"column":10},"end":{"line":265,"column":39}},"115":{"start":{"line":267,"column":8},"end":{"line":267,"column":22}},"116":{"start":{"line":271,"column":4},"end":{"line":271,"column":89}},"117":{"start":{"line":275,"column":4},"end":{"line":284,"column":6}},"118":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"119":{"start":{"line":277,"column":8},"end":{"line":277,"column":95}},"120":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"121":{"start":{"line":280,"column":8},"end":{"line":282,"column":24}},"122":{"start":{"line":288,"column":4},"end":{"line":288,"column":95}},"123":{"start":{"line":291,"column":16},"end":{"line":291,"column":44}},"124":{"start":{"line":293,"column":2},"end":{"line":303,"column":3}},"125":{"start":{"line":295,"column":6},"end":{"line":299,"column":8}},"126":{"start":{"line":296,"column":8},"end":{"line":296,"column":33}},"127":{"start":{"line":298,"column":8},"end":{"line":298,"column":17}}},"fnMap":{"0":{"name":"serialize","decl":{"start":{"line":15,"column":9},"end":{"line":15,"column":18}},"loc":{"start":{"line":15,"column":25},"end":{"line":31,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":29},"end":{"line":17,"column":30}},"loc":{"start":{"line":17,"column":52},"end":{"line":30,"column":3}},"line":17},"2":{"name":"deserialize","decl":{"start":{"line":33,"column":9},"end":{"line":33,"column":20}},"loc":{"start":{"line":33,"column":31},"end":{"line":35,"column":1}},"line":33},"3":{"name":"getCacheFilePath","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":25}},"loc":{"start":{"line":37,"column":42},"end":{"line":51,"column":1}},"line":37},"4":{"name":"buildMemoizer","decl":{"start":{"line":53,"column":9},"end":{"line":53,"column":22}},"loc":{"start":{"line":53,"column":33},"end":{"line":304,"column":1}},"line":53},"5":{"name":"initCache","decl":{"start":{"line":66,"column":11},"end":{"line":66,"column":20}},"loc":{"start":{"line":66,"column":33},"end":{"line":83,"column":3}},"line":66},"6":{"name":"(anonymous_6)","decl":{"start":{"line":67,"column":23},"end":{"line":67,"column":24}},"loc":{"start":{"line":67,"column":50},"end":{"line":82,"column":5}},"line":67},"7":{"name":"(anonymous_7)","decl":{"start":{"line":69,"column":14},"end":{"line":69,"column":15}},"loc":{"start":{"line":69,"column":20},"end":{"line":71,"column":9}},"line":69},"8":{"name":"(anonymous_8)","decl":{"start":{"line":72,"column":15},"end":{"line":72,"column":16}},"loc":{"start":{"line":72,"column":24},"end":{"line":81,"column":9}},"line":72},"9":{"name":"memoizeFn","decl":{"start":{"line":85,"column":11},"end":{"line":85,"column":20}},"loc":{"start":{"line":85,"column":31},"end":{"line":272,"column":3}},"line":85},"10":{"name":"checkOptions","decl":{"start":{"line":86,"column":13},"end":{"line":86,"column":25}},"loc":{"start":{"line":86,"column":35},"end":{"line":96,"column":5}},"line":86},"11":{"name":"resolveWithMemFn","decl":{"start":{"line":118,"column":13},"end":{"line":118,"column":29}},"loc":{"start":{"line":118,"column":33},"end":{"line":269,"column":5}},"line":118},"12":{"name":"(anonymous_12)","decl":{"start":{"line":119,"column":25},"end":{"line":119,"column":26}},"loc":{"start":{"line":119,"column":44},"end":{"line":268,"column":7}},"line":119},"13":{"name":"(anonymous_13)","decl":{"start":{"line":120,"column":22},"end":{"line":120,"column":23}},"loc":{"start":{"line":120,"column":34},"end":{"line":266,"column":9}},"line":120},"14":{"name":"(anonymous_14)","decl":{"start":{"line":134,"column":47},"end":{"line":134,"column":48}},"loc":{"start":{"line":134,"column":74},"end":{"line":261,"column":11}},"line":134},"15":{"name":"cacheAndReturn","decl":{"start":{"line":135,"column":21},"end":{"line":135,"column":35}},"loc":{"start":{"line":135,"column":39},"end":{"line":210,"column":13}},"line":135},"16":{"name":"writeResult","decl":{"start":{"line":138,"column":23},"end":{"line":138,"column":34}},"loc":{"start":{"line":138,"column":43},"end":{"line":157,"column":15}},"line":138},"17":{"name":"(anonymous_17)","decl":{"start":{"line":148,"column":29},"end":{"line":148,"column":30}},"loc":{"start":{"line":148,"column":41},"end":{"line":154,"column":19}},"line":148},"18":{"name":"(anonymous_18)","decl":{"start":{"line":149,"column":40},"end":{"line":149,"column":41}},"loc":{"start":{"line":149,"column":55},"end":{"line":153,"column":21}},"line":149},"19":{"name":"processFnAsync","decl":{"start":{"line":159,"column":23},"end":{"line":159,"column":37}},"loc":{"start":{"line":159,"column":41},"end":{"line":176,"column":15}},"line":159},"20":{"name":"(anonymous_20)","decl":{"start":{"line":162,"column":26},"end":{"line":162,"column":27}},"loc":{"start":{"line":162,"column":58},"end":{"line":174,"column":17}},"line":162},"21":{"name":"(anonymous_21)","decl":{"start":{"line":171,"column":38},"end":{"line":171,"column":39}},"loc":{"start":{"line":171,"column":50},"end":{"line":173,"column":19}},"line":171},"22":{"name":"processFn","decl":{"start":{"line":178,"column":23},"end":{"line":178,"column":32}},"loc":{"start":{"line":178,"column":36},"end":{"line":204,"column":15}},"line":178},"23":{"name":"(anonymous_23)","decl":{"start":{"line":186,"column":37},"end":{"line":186,"column":38}},"loc":{"start":{"line":186,"column":55},"end":{"line":190,"column":19}},"line":186},"24":{"name":"(anonymous_24)","decl":{"start":{"line":187,"column":40},"end":{"line":187,"column":41}},"loc":{"start":{"line":187,"column":52},"end":{"line":189,"column":21}},"line":187},"25":{"name":"(anonymous_25)","decl":{"start":{"line":191,"column":18},"end":{"line":191,"column":19}},"loc":{"start":{"line":191,"column":33},"end":{"line":194,"column":19}},"line":191},"26":{"name":"(anonymous_26)","decl":{"start":{"line":196,"column":38},"end":{"line":196,"column":39}},"loc":{"start":{"line":196,"column":53},"end":{"line":202,"column":19}},"line":196},"27":{"name":"(anonymous_27)","decl":{"start":{"line":212,"column":56},"end":{"line":212,"column":57}},"loc":{"start":{"line":212,"column":77},"end":{"line":260,"column":13}},"line":212},"28":{"name":"hasOwn","decl":{"start":{"line":217,"column":23},"end":{"line":217,"column":29}},"loc":{"start":{"line":217,"column":41},"end":{"line":219,"column":15}},"line":217},"29":{"name":"parseResult","decl":{"start":{"line":221,"column":23},"end":{"line":221,"column":34}},"loc":{"start":{"line":221,"column":50},"end":{"line":235,"column":15}},"line":221},"30":{"name":"retrieveAndReturn","decl":{"start":{"line":237,"column":23},"end":{"line":237,"column":40}},"loc":{"start":{"line":237,"column":44},"end":{"line":250,"column":15}},"line":237},"31":{"name":"processFnAsync","decl":{"start":{"line":238,"column":25},"end":{"line":238,"column":39}},"loc":{"start":{"line":238,"column":43},"end":{"line":240,"column":17}},"line":238},"32":{"name":"processFn","decl":{"start":{"line":242,"column":25},"end":{"line":242,"column":34}},"loc":{"start":{"line":242,"column":38},"end":{"line":244,"column":17}},"line":242},"33":{"name":"(anonymous_33)","decl":{"start":{"line":262,"column":38},"end":{"line":262,"column":39}},"loc":{"start":{"line":262,"column":56},"end":{"line":264,"column":11}},"line":262},"34":{"name":"invalidateCache","decl":{"start":{"line":274,"column":11},"end":{"line":274,"column":26}},"loc":{"start":{"line":274,"column":37},"end":{"line":285,"column":3}},"line":274},"35":{"name":"(anonymous_35)","decl":{"start":{"line":275,"column":23},"end":{"line":275,"column":24}},"loc":{"start":{"line":275,"column":50},"end":{"line":284,"column":5}},"line":275},"36":{"name":"getCacheFilePathBound","decl":{"start":{"line":287,"column":11},"end":{"line":287,"column":32}},"loc":{"start":{"line":287,"column":49},"end":{"line":289,"column":3}},"line":287},"37":{"name":"(anonymous_37)","decl":{"start":{"line":294,"column":8},"end":{"line":294,"column":9}},"loc":{"start":{"line":294,"column":27},"end":{"line":300,"column":5}},"line":294},"38":{"name":"(anonymous_38)","decl":{"start":{"line":295,"column":24},"end":{"line":295,"column":25}},"loc":{"start":{"line":295,"column":36},"end":{"line":297,"column":7}},"line":295},"39":{"name":"(anonymous_39)","decl":{"start":{"line":297,"column":9},"end":{"line":297,"column":10}},"loc":{"start":{"line":297,"column":24},"end":{"line":299,"column":7}},"line":297}},"branchMap":{"0":{"loc":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},{"start":{"line":18,"column":4},"end":{"line":20,"column":5}}],"line":18},"1":{"loc":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},{"start":{"line":21,"column":4},"end":{"line":28,"column":5}}],"line":21},"2":{"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":51}},"type":"binary-expr","locations":[{"start":{"line":21,"column":8},"end":{"line":21,"column":33}},{"start":{"line":21,"column":37},"end":{"line":21,"column":51}}],"line":21},"3":{"loc":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"type":"if","locations":[{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},{"start":{"line":22,"column":6},"end":{"line":25,"column":7}}],"line":22},"4":{"loc":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"type":"binary-expr","locations":[{"start":{"line":38,"column":15},"end":{"line":38,"column":23}},{"start":{"line":38,"column":27},"end":{"line":38,"column":29}}],"line":38},"5":{"loc":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},{"start":{"line":40,"column":2},"end":{"line":46,"column":3}}],"line":40},"6":{"loc":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},{"start":{"line":42,"column":4},"end":{"line":44,"column":5}}],"line":42},"7":{"loc":{"start":{"line":45,"column":12},"end":{"line":45,"column":55}},"type":"cond-expr","locations":[{"start":{"line":45,"column":26},"end":{"line":45,"column":47}},{"start":{"line":45,"column":50},"end":{"line":45,"column":55}}],"line":45},"8":{"loc":{"start":{"line":48,"column":19},"end":{"line":48,"column":45}},"type":"binary-expr","locations":[{"start":{"line":48,"column":19},"end":{"line":48,"column":32}},{"start":{"line":48,"column":36},"end":{"line":48,"column":45}}],"line":48},"9":{"loc":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"type":"if","locations":[{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},{"start":{"line":57,"column":2},"end":{"line":59,"column":3}}],"line":57},"10":{"loc":{"start":{"line":57,"column":6},"end":{"line":57,"column":58}},"type":"binary-expr","locations":[{"start":{"line":57,"column":6},"end":{"line":57,"column":14}},{"start":{"line":57,"column":19},"end":{"line":57,"column":26}},{"start":{"line":57,"column":30},"end":{"line":57,"column":57}}],"line":57},"11":{"loc":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},{"start":{"line":60,"column":2},"end":{"line":62,"column":3}}],"line":60},"12":{"loc":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"type":"if","locations":[{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},{"start":{"line":87,"column":6},"end":{"line":89,"column":7}}],"line":87},"13":{"loc":{"start":{"line":87,"column":10},"end":{"line":87,"column":56}},"type":"binary-expr","locations":[{"start":{"line":87,"column":10},"end":{"line":87,"column":21}},{"start":{"line":87,"column":25},"end":{"line":87,"column":56}}],"line":87},"14":{"loc":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"type":"if","locations":[{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},{"start":{"line":90,"column":6},"end":{"line":92,"column":7}}],"line":90},"15":{"loc":{"start":{"line":90,"column":10},"end":{"line":90,"column":62}},"type":"binary-expr","locations":[{"start":{"line":90,"column":10},"end":{"line":90,"column":24}},{"start":{"line":90,"column":28},"end":{"line":90,"column":62}}],"line":90},"16":{"loc":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"type":"if","locations":[{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},{"start":{"line":93,"column":6},"end":{"line":95,"column":7}}],"line":93},"17":{"loc":{"start":{"line":93,"column":10},"end":{"line":93,"column":60}},"type":"binary-expr","locations":[{"start":{"line":93,"column":10},"end":{"line":93,"column":23}},{"start":{"line":93,"column":27},"end":{"line":93,"column":60}}],"line":93},"18":{"loc":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"type":"if","locations":[{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},{"start":{"line":98,"column":4},"end":{"line":100,"column":5}}],"line":98},"19":{"loc":{"start":{"line":98,"column":8},"end":{"line":98,"column":38}},"type":"binary-expr","locations":[{"start":{"line":98,"column":8},"end":{"line":98,"column":11}},{"start":{"line":98,"column":15},"end":{"line":98,"column":38}}],"line":98},"20":{"loc":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},{"start":{"line":102,"column":4},"end":{"line":104,"column":5}}],"line":102},"21":{"loc":{"start":{"line":109,"column":21},"end":{"line":109,"column":43}},"type":"binary-expr","locations":[{"start":{"line":109,"column":21},"end":{"line":109,"column":35}},{"start":{"line":109,"column":39},"end":{"line":109,"column":43}}],"line":109},"22":{"loc":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"type":"cond-expr","locations":[{"start":{"line":122,"column":38},"end":{"line":122,"column":59}},{"start":{"line":122,"column":62},"end":{"line":122,"column":71}}],"line":122},"23":{"loc":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"type":"if","locations":[{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},{"start":{"line":124,"column":10},"end":{"line":126,"column":11}}],"line":124},"24":{"loc":{"start":{"line":124,"column":14},"end":{"line":124,"column":61}},"type":"binary-expr","locations":[{"start":{"line":124,"column":14},"end":{"line":124,"column":41}},{"start":{"line":124,"column":45},"end":{"line":124,"column":61}}],"line":124},"25":{"loc":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"type":"if","locations":[{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},{"start":{"line":130,"column":10},"end":{"line":132,"column":11}}],"line":130},"26":{"loc":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"type":"if","locations":[{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},{"start":{"line":141,"column":16},"end":{"line":146,"column":17}}],"line":141},"27":{"loc":{"start":{"line":141,"column":20},"end":{"line":141,"column":73}},"type":"binary-expr","locations":[{"start":{"line":141,"column":21},"end":{"line":141,"column":22}},{"start":{"line":141,"column":26},"end":{"line":141,"column":47}},{"start":{"line":141,"column":52},"end":{"line":141,"column":73}}],"line":141},"28":{"loc":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"type":"if","locations":[{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},{"start":{"line":147,"column":16},"end":{"line":155,"column":17}}],"line":147},"29":{"loc":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"type":"if","locations":[{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},{"start":{"line":150,"column":22},"end":{"line":152,"column":23}}],"line":150},"30":{"loc":{"start":{"line":150,"column":26},"end":{"line":150,"column":54}},"type":"binary-expr","locations":[{"start":{"line":150,"column":26},"end":{"line":150,"column":29}},{"start":{"line":150,"column":33},"end":{"line":150,"column":54}}],"line":150},"31":{"loc":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"type":"if","locations":[{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},{"start":{"line":166,"column":18},"end":{"line":169,"column":19}}],"line":166},"32":{"loc":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"type":"if","locations":[{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},{"start":{"line":184,"column":16},"end":{"line":203,"column":17}}],"line":184},"33":{"loc":{"start":{"line":184,"column":20},"end":{"line":184,"column":63}},"type":"binary-expr","locations":[{"start":{"line":184,"column":20},"end":{"line":184,"column":26}},{"start":{"line":184,"column":30},"end":{"line":184,"column":63}}],"line":184},"34":{"loc":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"type":"if","locations":[{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},{"start":{"line":197,"column":20},"end":{"line":201,"column":21}}],"line":197},"35":{"loc":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"type":"if","locations":[{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},{"start":{"line":206,"column":14},"end":{"line":208,"column":15}}],"line":206},"36":{"loc":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"type":"if","locations":[{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},{"start":{"line":213,"column":14},"end":{"line":215,"column":15}}],"line":213},"37":{"loc":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"type":"if","locations":[{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},{"start":{"line":246,"column":16},"end":{"line":248,"column":17}}],"line":246},"38":{"loc":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"type":"if","locations":[{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},{"start":{"line":252,"column":14},"end":{"line":259,"column":15}}],"line":252},"39":{"loc":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"type":"if","locations":[{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},{"start":{"line":276,"column":6},"end":{"line":283,"column":7}}],"line":276},"40":{"loc":{"start":{"line":276,"column":10},"end":{"line":276,"column":48}},"type":"binary-expr","locations":[{"start":{"line":276,"column":10},"end":{"line":276,"column":17}},{"start":{"line":276,"column":21},"end":{"line":276,"column":48}}],"line":276},"41":{"loc":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"type":"cond-expr","locations":[{"start":{"line":279,"column":35},"end":{"line":279,"column":72}},{"start":{"line":279,"column":75},"end":{"line":279,"column":92}}],"line":279}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":76,"8":76,"9":225,"10":11,"11":214,"12":92,"13":3,"14":89,"15":211,"16":20,"17":71,"18":71,"19":71,"20":69,"21":69,"22":2,"23":69,"24":71,"25":71,"26":71,"27":54,"28":54,"29":3,"30":51,"31":2,"32":49,"33":99,"34":99,"35":96,"36":3,"37":53,"38":1,"39":52,"40":1,"41":51,"42":1,"43":56,"44":1,"45":55,"46":2,"47":53,"48":53,"49":50,"50":49,"51":49,"52":67,"53":67,"54":67,"55":7,"56":67,"57":67,"58":1,"59":66,"60":42,"61":11,"62":11,"63":31,"64":42,"65":3,"66":3,"67":3,"68":1,"69":42,"70":4,"71":4,"72":4,"73":4,"74":4,"75":4,"76":1,"77":3,"78":3,"79":3,"80":4,"81":42,"82":42,"83":2,"84":40,"85":4,"86":3,"87":3,"88":1,"89":36,"90":36,"91":1,"92":35,"93":46,"94":4,"95":42,"96":66,"97":66,"98":45,"99":17,"100":20,"101":20,"102":3,"103":3,"104":17,"105":20,"106":3,"107":17,"108":21,"109":1,"110":1,"111":20,"112":66,"113":61,"114":66,"115":49,"116":50,"117":5,"118":5,"119":1,"120":4,"121":4,"122":68,"123":49,"124":49,"125":57,"126":56,"127":1},"f":{"0":76,"1":225,"2":20,"3":71,"4":54,"5":99,"6":99,"7":96,"8":3,"9":56,"10":53,"11":49,"12":49,"13":67,"14":66,"15":46,"16":42,"17":3,"18":3,"19":4,"20":4,"21":3,"22":42,"23":3,"24":3,"25":1,"26":36,"27":66,"28":17,"29":20,"30":20,"31":3,"32":17,"33":61,"34":5,"35":5,"36":68,"37":57,"38":56,"39":1},"b":{"0":[11,214],"1":[92,122],"2":[214,100],"3":[3,89],"4":[71,69],"5":[69,2],"6":[2,67],"7":[2,67],"8":[71,2],"9":[3,51],"10":[54,53,53],"11":[2,49],"12":[1,52],"13":[53,2],"14":[1,51],"15":[52,46],"16":[1,50],"17":[51,4],"18":[1,55],"19":[56,48],"20":[2,53],"21":[50,5],"22":[56,11],"23":[7,60],"24":[67,9],"25":[1,66],"26":[11,31],"27":[42,37,34],"28":[3,39],"29":[1,2],"30":[3,2],"31":[1,3],"32":[4,36],"33":[40,35],"34":[1,35],"35":[4,42],"36":[45,21],"37":[3,17],"38":[1,20],"39":[1,4],"40":[5,4],"41":[3,1]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"64efb997a6eaf10de90dba97a3a3521133ecce7c","contentHash":"45a10e5130dd8fc525b3e00187ef3d4dfeba4f98865d8d122012996b5878540e"}} \ No newline at end of file diff --git a/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json b/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json new file mode 100644 index 0000000..695ba1b --- /dev/null +++ b/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json @@ -0,0 +1 @@ +{"uuid":"c9b2699c-511f-420f-abd8-51a0b2da4d05","parent":null,"pid":151138,"argv":["/home/charlike/.nvm/versions/node/v12.14.0/bin/node","/home/charlike/github/memoize-fs/node_modules/.bin/mocha","test"],"execArgv":[],"cwd":"/home/charlike/github/memoize-fs","time":1580944141294,"ppid":151114,"root":"7820491a-9009-497b-9a94-f96c756f5375","coverageFilename":"/home/charlike/github/memoize-fs/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json","files":["/home/charlike/github/memoize-fs/index.js"]} \ No newline at end of file diff --git a/.nyc_output/processinfo/index.json b/.nyc_output/processinfo/index.json new file mode 100644 index 0000000..b6b36b3 --- /dev/null +++ b/.nyc_output/processinfo/index.json @@ -0,0 +1 @@ +{"processes":{"c9b2699c-511f-420f-abd8-51a0b2da4d05":{"parent":null,"children":[]}},"files":{"/home/charlike/github/memoize-fs/index.js":["c9b2699c-511f-420f-abd8-51a0b2da4d05"]},"externalIds":{}} \ No newline at end of file diff --git a/index.js b/index.js index a33494e..89730d2 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,17 @@ -const mkdirp = require('mkdirp') -const fs = require('fs') +// const mkdirp = require('mkdirp') const path = require('path') -const rmdir = require('rimraf') const crypto = require('crypto') const meriyah = require('meriyah') +const fs = require('fs-extra') module.exports = buildMemoizer module.exports.getCacheFilePath = getCacheFilePath +const serializer = { + serialize, + deserialize +} + function serialize (val) { const circRefColl = [] return JSON.stringify(val, function (name, value) { @@ -26,6 +30,10 @@ function serialize (val) { }) } +function deserialize (...args) { + return JSON.parse(...args) +} + function getCacheFilePath (fn, args, opt) { const salt = opt.salt || '' let fnStr = '' @@ -36,7 +44,8 @@ function getCacheFilePath (fn, args, opt) { } fnStr = opt.astBody ? JSON.stringify(fnStr) : fnStr } - const argsStr = serialize(args) + + const argsStr = (opt.serialize || serialize)(args) const hash = crypto.createHash('md5').update(fnStr + argsStr + salt).digest('hex') return path.join(opt.cachePath, opt.cacheId, hash) } @@ -45,32 +54,44 @@ function buildMemoizer (options) { const promiseCache = {} // check args - if (typeof options !== 'object') { + if (!options || (options && typeof options !== 'object')) { throw new Error('options of type object expected') } if (typeof options.cachePath !== 'string') { throw new Error('option cachePath of type string expected') } + options = { ...serializer, ...options } // check for existing cache folder, if not found, create folder, then resolve function initCache (cachePath) { return new Promise(function (resolve, reject) { - return mkdirp(cachePath).then(() => { - resolve() - }).catch(reject) + return fs.ensureDir(cachePath, { recursive: true }) + .then(() => { + resolve() + }) + .catch((err) => { + // ! NOTE we should handle this case, intentionally; + // ! But it fails one test: should throw an error when trying to memoize + // ! a function with an invalid combination of cache path and cache id + // if (err && err.code === 'EEXIST') { + // resolve() + // return + // } + reject(err) + }) }) } function memoizeFn (fn, opt) { function checkOptions (optExt) { if (optExt.salt && typeof optExt.salt !== 'string') { - throw new Error('salt option of type string expected, got \'' + typeof optExt.salt + '\'') + throw new TypeError('salt option of type string expected, got: ' + typeof optExt.salt) } if (optExt.cacheId && typeof optExt.cacheId !== 'string') { - throw new Error('cacheId option of type string expected, got \'' + typeof optExt.cacheId + '\'') + throw new TypeError('cacheId option of type string expected, got: ' + typeof optExt.cacheId) } if (optExt.maxAge && typeof optExt.maxAge !== 'number') { - throw new Error('maxAge option of type number bigger zero expected') + throw new TypeError('maxAge option of type number bigger zero expected') } } @@ -78,15 +99,22 @@ function buildMemoizer (options) { throw new Error('opt of type object expected, got \'' + typeof opt + '\'') } - const optExt = opt || {} - if (typeof fn !== 'function') { throw new Error('fn of type function expected') } + + const optExt = { ...serializer, ...options, ...opt } checkOptions(optExt) optExt.cacheId = optExt.cacheId || './' + // NOTE weird stuf... I don't get why it's not in optExt in some cases... so istanbul ignore + + /* istanbul ignore next */ + optExt.serialize = typeof optExt.serialize === 'function' ? optExt.serialize : serialize + /* istanbul ignore next */ + optExt.deserialize = typeof optExt.deserialize === 'function' ? optExt.deserialize : deserialize + function resolveWithMemFn () { return new Promise(function (resolve) { const memFn = function () { @@ -112,7 +140,7 @@ function buildMemoizer (options) { let resultString if ((r && typeof r === 'object') || typeof r === 'string') { resultObj = { data: r } - resultString = serialize(resultObj) + resultString = optExt.serialize(resultObj) } else { resultString = '{"data":' + r + '}' } @@ -153,7 +181,7 @@ function buildMemoizer (options) { } catch (e) { return reject(e) } - if (result && result.then && typeof result.then === 'function') { + if (result && typeof result.then === 'function') { // result is a promise instance return result.then(function (retObj) { writeResult(retObj, function () { @@ -186,9 +214,21 @@ function buildMemoizer (options) { return cacheAndReturn() } + function hasOwn (obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key) + } + function parseResult (resultString) { try { - return JSON.parse(resultString).data // will fail on NaN + const deserializedValue = optExt.deserialize(resultString) + + // NOTE not needed to be tested it's simple feature + // allowing users with custom serialize/deserialize + // to not need to return { data: they result}, but instead directly their result + /* istanbul ignore next */ + return hasOwn(deserializedValue, 'data') + ? deserializedValue.data + : deserializedValue } catch (e) { return undefined } @@ -237,13 +277,9 @@ function buildMemoizer (options) { reject(Error('cacheId option of type string expected, got \'' + typeof cacheId + '\'')) } else { const cachPath = cacheId ? path.join(options.cachePath, cacheId) : options.cachePath - rmdir(cachPath, function (err) { - if (err) { - reject(err) - } else { - resolve() - } - }) + fs.remove(cachPath) + .then(resolve) + .catch(reject) } }) } diff --git a/package-lock.json b/package-lock.json index 5faaac6..7b0c642 100644 --- a/package-lock.json +++ b/package-lock.json @@ -179,7 +179,8 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "bcrypt-pbkdf": { "version": "1.0.2", @@ -200,6 +201,7 @@ "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -356,7 +358,8 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "contains-path": { "version": "0.1.0", @@ -533,6 +536,27 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, + "requires": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" + }, + "dependencies": { + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true + } + } + }, "eslint": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", @@ -983,10 +1007,21 @@ "mime-types": "^2.1.12" } }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "2.1.2", @@ -1026,6 +1061,7 @@ "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1056,8 +1092,7 @@ "graceful-fs": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" }, "growl": { "version": "1.10.5", @@ -1066,9 +1101,9 @@ "dev": true }, "handlebars": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.2.tgz", - "integrity": "sha512-4PwqDL2laXtTWZghzzCtunQUTLbo31pcCJrd/B/9JP8XbhVzpS5ZXuKqlOzsd1rtcaLo4KqAn8nl8mkknS4MHw==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.3.tgz", + "integrity": "sha512-SRGwSYuNfx8DwHD/6InAPzD6RgeruWLT+B8e8a7gGs8FWgHzlExpTFMEq2IA6QpAfOClpKHy6+8IqTjeBCu6Kg==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -1082,17 +1117,6 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true - }, - "uglify-js": { - "version": "3.7.6", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.6.tgz", - "integrity": "sha512-yYqjArOYSxvqeeiYH2VGjZOqq6SVmhxzaPjJC1W2F9e+bqvFL9QXQ2osQuKUFjM2hGjKG2YclQnRKWQSt/nOTQ==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.20.3", - "source-map": "~0.6.1" - } } } }, @@ -1191,6 +1215,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -1199,7 +1224,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true }, "inquirer": { "version": "7.0.4", @@ -1358,25 +1384,6 @@ "wordwrap": "^1.0.0" }, "dependencies": { - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - } - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, "glob": { "version": "5.0.15", "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", @@ -1390,15 +1397,6 @@ "path-is-absolute": "^1.0.0" } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", @@ -1470,6 +1468,14 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -1571,6 +1577,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1582,9 +1589,13 @@ "dev": true }, "mkdirp": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", - "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } }, "mocha": { "version": "7.0.1", @@ -1785,6 +1796,12 @@ } } }, + "node-serialize": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/node-serialize/-/node-serialize-0.0.4.tgz", + "integrity": "sha1-tzpJ4TUzBmVxA6Xkn38FJ5upf38=", + "dev": true + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -1876,6 +1893,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -1908,17 +1926,17 @@ } }, "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, "requires": { "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", + "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", - "wordwrap": "~1.0.0" + "word-wrap": "~1.2.3" } }, "os-tmpdir": { @@ -1978,7 +1996,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-key": { "version": "2.0.1", @@ -2159,14 +2178,6 @@ "signal-exit": "^3.0.2" } }, - "rimraf": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.1.tgz", - "integrity": "sha512-IQ4ikL8SjBiEDZfk+DFVwqRK8md24RWMEJkdSlgNLkyyAImcjf8SWvU1qFMDOb4igBClbTQ/ugPqXcRwdFTxZw==", - "requires": { - "glob": "^7.1.3" - } - }, "run-async": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", @@ -2523,6 +2534,31 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "uglify-js": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.7.tgz", + "integrity": "sha512-FeSU+hi7ULYy6mn8PKio/tXsdSXN35lm4KgV2asx00kzrLU9Pi3oAslcJT70Jdj7PHX29gGUPOT6+lXGBbemhA==", + "dev": true, + "optional": true, + "requires": { + "commander": "~2.20.3", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -2673,7 +2709,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write": { "version": "1.0.3", diff --git a/package.json b/package.json index ae30d69..e66d45d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "memoize-fs", "version": "2.0.0", - "description": "memoize/cache in file system solution for Node.js", + "description": "Node.js solution for memoizing/caching a function and its return state into the file system", "author": "Boris Diakur (https://github.com/borisdiakur)", "scripts": { "test": "npm run eslint && mocha test", @@ -23,9 +23,8 @@ "npm": ">= 6.0.0" }, "dependencies": { - "meriyah": "^1.9.7", - "mkdirp": "^1.0.3", - "rimraf": "^3.0.1" + "fs-extra": "^8.1.0", + "meriyah": "^1.9.7" }, "devDependencies": { "coveralls": "^3.0.9", @@ -37,7 +36,8 @@ "eslint-plugin-standard": "^4.0.1", "istanbul": "^0.4.5", "mocha": "^7.0.1", - "mocha-lcov-reporter": "1.3.0" + "mocha-lcov-reporter": "1.3.0", + "node-serialize": "0.0.4" }, "private": false, "main": "index.js", diff --git a/test/test.js b/test/test.js index 213a0dd..b7782e1 100644 --- a/test/test.js +++ b/test/test.js @@ -2,15 +2,15 @@ /* global describe, beforeEach, it */ /* eslint no-useless-escape: 0, object-curly-spacing: 0 */ -const assert = require('assert') -const fs = require('fs') const path = require('path') -const rmdir = require('rimraf') -const memoizeFs = require('../index.js') +const assert = require('assert') +const fs = require('fs-extra') +const serializer = require('node-serialize') +const memoizeFs = require('../index') describe('memoize-fs', function () { beforeEach(function (done) { - rmdir(path.join(__dirname, '../build/cache'), done) + fs.remove(path.join(__dirname, '../build/cache')).then(() => done()).catch(done) }) describe('check args', function () { @@ -79,6 +79,52 @@ describe('memoize-fs', function () { }) }) + it('should be able to pass custom serialize and deserialize through memoizeFS options', (done) => { + const cachePath = path.join(__dirname, '../build/cache') + fs.removeSync(cachePath) + + const {serialize, unserialize: deserialize} = serializer + const options = {cachePath, cacheId: 'tmp', serialize, deserialize} + + const memoize = memoizeFs(options) + + function toBeMemoized (abc) { + return { abc, foo: () => { return 100 + abc } } + } + + memoize.fn(toBeMemoized) + .then((memFn) => { + return memFn(200) + .then((res) => { + assert.strictEqual(res.abc, 200) + assert.strictEqual(typeof res.foo, 'function') + + return memFn(400) + }) + .then((res) => { + assert.strictEqual(res.abc, 400) + assert.strictEqual(typeof res.foo, 'function') + }) + }) + .then(() => { + const fileWith200 = memoizeFs.getCacheFilePath(toBeMemoized, [200], options) + + const fileString200 = fs.readFileSync(fileWith200, 'utf8') + assert.ok(fileString200.includes('"abc":200,"foo":"_$$ND_FUNC$$')) + + const fileWith400 = memoizeFs.getCacheFilePath(toBeMemoized, [400], options) + const fileString400 = fs.readFileSync(fileWith400, 'utf8') + assert.ok(fileString400.includes('"abc":400,"foo":"_$$ND_FUNC$$')) + + fs.removeSync(cachePath) + done() + }) + .catch((err) => { + fs.removeSync(cachePath) + done(err) + }) + }) + it('should reject with invalid cache path', function (done) { const cachePath = '/öäüß' const memoize = memoizeFs({cachePath: cachePath}) From 8016a257db61e794520392d9f2f3690007155476 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Thu, 6 Feb 2020 01:17:47 +0200 Subject: [PATCH 02/19] chore: cleanup Signed-off-by: Charlike Mike Reagent --- .nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json | 1 - .../processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json | 1 - .nyc_output/processinfo/index.json | 1 - 3 files changed, 3 deletions(-) delete mode 100644 .nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json delete mode 100644 .nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json delete mode 100644 .nyc_output/processinfo/index.json diff --git a/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json b/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json deleted file mode 100644 index e5917cb..0000000 --- a/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json +++ /dev/null @@ -1 +0,0 @@ -{"/home/charlike/github/memoize-fs/index.js":{"path":"/home/charlike/github/memoize-fs/index.js","statementMap":{"0":{"start":{"line":2,"column":13},"end":{"line":2,"column":28}},"1":{"start":{"line":3,"column":15},"end":{"line":3,"column":32}},"2":{"start":{"line":4,"column":16},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"5":{"start":{"line":8,"column":0},"end":{"line":8,"column":50}},"6":{"start":{"line":10,"column":19},"end":{"line":13,"column":1}},"7":{"start":{"line":16,"column":22},"end":{"line":16,"column":24}},"8":{"start":{"line":17,"column":2},"end":{"line":30,"column":4}},"9":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":12}},"11":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"12":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"13":{"start":{"line":24,"column":8},"end":{"line":24,"column":14}},"14":{"start":{"line":27,"column":6},"end":{"line":27,"column":29}},"15":{"start":{"line":29,"column":4},"end":{"line":29,"column":16}},"16":{"start":{"line":34,"column":2},"end":{"line":34,"column":28}},"17":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"18":{"start":{"line":39,"column":14},"end":{"line":39,"column":16}},"19":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"20":{"start":{"line":41,"column":4},"end":{"line":41,"column":22}},"21":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"22":{"start":{"line":43,"column":6},"end":{"line":43,"column":61}},"23":{"start":{"line":45,"column":4},"end":{"line":45,"column":55}},"24":{"start":{"line":48,"column":18},"end":{"line":48,"column":52}},"25":{"start":{"line":49,"column":15},"end":{"line":49,"column":84}},"26":{"start":{"line":50,"column":2},"end":{"line":50,"column":52}},"27":{"start":{"line":54,"column":23},"end":{"line":54,"column":25}},"28":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"29":{"start":{"line":58,"column":4},"end":{"line":58,"column":54}},"30":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"31":{"start":{"line":61,"column":4},"end":{"line":61,"column":63}},"32":{"start":{"line":63,"column":2},"end":{"line":63,"column":41}},"33":{"start":{"line":67,"column":4},"end":{"line":82,"column":6}},"34":{"start":{"line":68,"column":6},"end":{"line":81,"column":10}},"35":{"start":{"line":70,"column":10},"end":{"line":70,"column":19}},"36":{"start":{"line":80,"column":10},"end":{"line":80,"column":21}},"37":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"38":{"start":{"line":88,"column":8},"end":{"line":88,"column":94}},"39":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"40":{"start":{"line":91,"column":8},"end":{"line":91,"column":100}},"41":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"42":{"start":{"line":94,"column":8},"end":{"line":94,"column":80}},"43":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"44":{"start":{"line":99,"column":6},"end":{"line":99,"column":80}},"45":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"46":{"start":{"line":103,"column":6},"end":{"line":103,"column":53}},"47":{"start":{"line":106,"column":19},"end":{"line":106,"column":56}},"48":{"start":{"line":107,"column":4},"end":{"line":107,"column":24}},"49":{"start":{"line":109,"column":4},"end":{"line":109,"column":43}},"50":{"start":{"line":119,"column":6},"end":{"line":268,"column":8}},"51":{"start":{"line":120,"column":22},"end":{"line":266,"column":9}},"52":{"start":{"line":121,"column":23},"end":{"line":121,"column":60}},"53":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"54":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"55":{"start":{"line":125,"column":12},"end":{"line":125,"column":31}},"56":{"start":{"line":128,"column":27},"end":{"line":128,"column":66}},"57":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"58":{"start":{"line":131,"column":12},"end":{"line":131,"column":41}},"59":{"start":{"line":134,"column":10},"end":{"line":261,"column":12}},"60":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"61":{"start":{"line":142,"column":18},"end":{"line":142,"column":41}},"62":{"start":{"line":143,"column":18},"end":{"line":143,"column":60}},"63":{"start":{"line":145,"column":18},"end":{"line":145,"column":53}},"64":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"65":{"start":{"line":148,"column":18},"end":{"line":154,"column":35}},"66":{"start":{"line":149,"column":20},"end":{"line":153,"column":22}},"67":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"68":{"start":{"line":151,"column":24},"end":{"line":151,"column":33}},"69":{"start":{"line":156,"column":16},"end":{"line":156,"column":56}},"70":{"start":{"line":160,"column":16},"end":{"line":160,"column":26}},"71":{"start":{"line":162,"column":16},"end":{"line":174,"column":18}},"72":{"start":{"line":163,"column":32},"end":{"line":163,"column":44}},"73":{"start":{"line":164,"column":33},"end":{"line":164,"column":70}},"74":{"start":{"line":165,"column":18},"end":{"line":165,"column":32}},"75":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"76":{"start":{"line":168,"column":20},"end":{"line":168,"column":40}},"77":{"start":{"line":170,"column":18},"end":{"line":170,"column":38}},"78":{"start":{"line":171,"column":18},"end":{"line":173,"column":20}},"79":{"start":{"line":172,"column":20},"end":{"line":172,"column":54}},"80":{"start":{"line":175,"column":16},"end":{"line":175,"column":36}},"81":{"start":{"line":179,"column":16},"end":{"line":183,"column":17}},"82":{"start":{"line":180,"column":18},"end":{"line":180,"column":47}},"83":{"start":{"line":182,"column":18},"end":{"line":182,"column":34}},"84":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"85":{"start":{"line":186,"column":18},"end":{"line":194,"column":20}},"86":{"start":{"line":187,"column":20},"end":{"line":189,"column":22}},"87":{"start":{"line":188,"column":22},"end":{"line":188,"column":37}},"88":{"start":{"line":193,"column":20},"end":{"line":193,"column":31}},"89":{"start":{"line":196,"column":18},"end":{"line":202,"column":20}},"90":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"91":{"start":{"line":198,"column":22},"end":{"line":198,"column":33}},"92":{"start":{"line":200,"column":22},"end":{"line":200,"column":37}},"93":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"94":{"start":{"line":207,"column":16},"end":{"line":207,"column":39}},"95":{"start":{"line":209,"column":14},"end":{"line":209,"column":32}},"96":{"start":{"line":212,"column":12},"end":{"line":260,"column":14}},"97":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"98":{"start":{"line":214,"column":16},"end":{"line":214,"column":39}},"99":{"start":{"line":218,"column":16},"end":{"line":218,"column":69}},"100":{"start":{"line":222,"column":16},"end":{"line":234,"column":17}},"101":{"start":{"line":223,"column":44},"end":{"line":223,"column":76}},"102":{"start":{"line":233,"column":18},"end":{"line":233,"column":34}},"103":{"start":{"line":239,"column":18},"end":{"line":239,"column":63}},"104":{"start":{"line":243,"column":18},"end":{"line":243,"column":44}},"105":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"106":{"start":{"line":247,"column":18},"end":{"line":247,"column":41}},"107":{"start":{"line":249,"column":16},"end":{"line":249,"column":34}},"108":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"109":{"start":{"line":253,"column":16},"end":{"line":253,"column":35}},"110":{"start":{"line":255,"column":16},"end":{"line":255,"column":32}},"111":{"start":{"line":258,"column":16},"end":{"line":258,"column":35}},"112":{"start":{"line":262,"column":10},"end":{"line":264,"column":12}},"113":{"start":{"line":263,"column":12},"end":{"line":263,"column":41}},"114":{"start":{"line":265,"column":10},"end":{"line":265,"column":39}},"115":{"start":{"line":267,"column":8},"end":{"line":267,"column":22}},"116":{"start":{"line":271,"column":4},"end":{"line":271,"column":89}},"117":{"start":{"line":275,"column":4},"end":{"line":284,"column":6}},"118":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"119":{"start":{"line":277,"column":8},"end":{"line":277,"column":95}},"120":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"121":{"start":{"line":280,"column":8},"end":{"line":282,"column":24}},"122":{"start":{"line":288,"column":4},"end":{"line":288,"column":95}},"123":{"start":{"line":291,"column":16},"end":{"line":291,"column":44}},"124":{"start":{"line":293,"column":2},"end":{"line":303,"column":3}},"125":{"start":{"line":295,"column":6},"end":{"line":299,"column":8}},"126":{"start":{"line":296,"column":8},"end":{"line":296,"column":33}},"127":{"start":{"line":298,"column":8},"end":{"line":298,"column":17}}},"fnMap":{"0":{"name":"serialize","decl":{"start":{"line":15,"column":9},"end":{"line":15,"column":18}},"loc":{"start":{"line":15,"column":25},"end":{"line":31,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":29},"end":{"line":17,"column":30}},"loc":{"start":{"line":17,"column":52},"end":{"line":30,"column":3}},"line":17},"2":{"name":"deserialize","decl":{"start":{"line":33,"column":9},"end":{"line":33,"column":20}},"loc":{"start":{"line":33,"column":31},"end":{"line":35,"column":1}},"line":33},"3":{"name":"getCacheFilePath","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":25}},"loc":{"start":{"line":37,"column":42},"end":{"line":51,"column":1}},"line":37},"4":{"name":"buildMemoizer","decl":{"start":{"line":53,"column":9},"end":{"line":53,"column":22}},"loc":{"start":{"line":53,"column":33},"end":{"line":304,"column":1}},"line":53},"5":{"name":"initCache","decl":{"start":{"line":66,"column":11},"end":{"line":66,"column":20}},"loc":{"start":{"line":66,"column":33},"end":{"line":83,"column":3}},"line":66},"6":{"name":"(anonymous_6)","decl":{"start":{"line":67,"column":23},"end":{"line":67,"column":24}},"loc":{"start":{"line":67,"column":50},"end":{"line":82,"column":5}},"line":67},"7":{"name":"(anonymous_7)","decl":{"start":{"line":69,"column":14},"end":{"line":69,"column":15}},"loc":{"start":{"line":69,"column":20},"end":{"line":71,"column":9}},"line":69},"8":{"name":"(anonymous_8)","decl":{"start":{"line":72,"column":15},"end":{"line":72,"column":16}},"loc":{"start":{"line":72,"column":24},"end":{"line":81,"column":9}},"line":72},"9":{"name":"memoizeFn","decl":{"start":{"line":85,"column":11},"end":{"line":85,"column":20}},"loc":{"start":{"line":85,"column":31},"end":{"line":272,"column":3}},"line":85},"10":{"name":"checkOptions","decl":{"start":{"line":86,"column":13},"end":{"line":86,"column":25}},"loc":{"start":{"line":86,"column":35},"end":{"line":96,"column":5}},"line":86},"11":{"name":"resolveWithMemFn","decl":{"start":{"line":118,"column":13},"end":{"line":118,"column":29}},"loc":{"start":{"line":118,"column":33},"end":{"line":269,"column":5}},"line":118},"12":{"name":"(anonymous_12)","decl":{"start":{"line":119,"column":25},"end":{"line":119,"column":26}},"loc":{"start":{"line":119,"column":44},"end":{"line":268,"column":7}},"line":119},"13":{"name":"(anonymous_13)","decl":{"start":{"line":120,"column":22},"end":{"line":120,"column":23}},"loc":{"start":{"line":120,"column":34},"end":{"line":266,"column":9}},"line":120},"14":{"name":"(anonymous_14)","decl":{"start":{"line":134,"column":47},"end":{"line":134,"column":48}},"loc":{"start":{"line":134,"column":74},"end":{"line":261,"column":11}},"line":134},"15":{"name":"cacheAndReturn","decl":{"start":{"line":135,"column":21},"end":{"line":135,"column":35}},"loc":{"start":{"line":135,"column":39},"end":{"line":210,"column":13}},"line":135},"16":{"name":"writeResult","decl":{"start":{"line":138,"column":23},"end":{"line":138,"column":34}},"loc":{"start":{"line":138,"column":43},"end":{"line":157,"column":15}},"line":138},"17":{"name":"(anonymous_17)","decl":{"start":{"line":148,"column":29},"end":{"line":148,"column":30}},"loc":{"start":{"line":148,"column":41},"end":{"line":154,"column":19}},"line":148},"18":{"name":"(anonymous_18)","decl":{"start":{"line":149,"column":40},"end":{"line":149,"column":41}},"loc":{"start":{"line":149,"column":55},"end":{"line":153,"column":21}},"line":149},"19":{"name":"processFnAsync","decl":{"start":{"line":159,"column":23},"end":{"line":159,"column":37}},"loc":{"start":{"line":159,"column":41},"end":{"line":176,"column":15}},"line":159},"20":{"name":"(anonymous_20)","decl":{"start":{"line":162,"column":26},"end":{"line":162,"column":27}},"loc":{"start":{"line":162,"column":58},"end":{"line":174,"column":17}},"line":162},"21":{"name":"(anonymous_21)","decl":{"start":{"line":171,"column":38},"end":{"line":171,"column":39}},"loc":{"start":{"line":171,"column":50},"end":{"line":173,"column":19}},"line":171},"22":{"name":"processFn","decl":{"start":{"line":178,"column":23},"end":{"line":178,"column":32}},"loc":{"start":{"line":178,"column":36},"end":{"line":204,"column":15}},"line":178},"23":{"name":"(anonymous_23)","decl":{"start":{"line":186,"column":37},"end":{"line":186,"column":38}},"loc":{"start":{"line":186,"column":55},"end":{"line":190,"column":19}},"line":186},"24":{"name":"(anonymous_24)","decl":{"start":{"line":187,"column":40},"end":{"line":187,"column":41}},"loc":{"start":{"line":187,"column":52},"end":{"line":189,"column":21}},"line":187},"25":{"name":"(anonymous_25)","decl":{"start":{"line":191,"column":18},"end":{"line":191,"column":19}},"loc":{"start":{"line":191,"column":33},"end":{"line":194,"column":19}},"line":191},"26":{"name":"(anonymous_26)","decl":{"start":{"line":196,"column":38},"end":{"line":196,"column":39}},"loc":{"start":{"line":196,"column":53},"end":{"line":202,"column":19}},"line":196},"27":{"name":"(anonymous_27)","decl":{"start":{"line":212,"column":56},"end":{"line":212,"column":57}},"loc":{"start":{"line":212,"column":77},"end":{"line":260,"column":13}},"line":212},"28":{"name":"hasOwn","decl":{"start":{"line":217,"column":23},"end":{"line":217,"column":29}},"loc":{"start":{"line":217,"column":41},"end":{"line":219,"column":15}},"line":217},"29":{"name":"parseResult","decl":{"start":{"line":221,"column":23},"end":{"line":221,"column":34}},"loc":{"start":{"line":221,"column":50},"end":{"line":235,"column":15}},"line":221},"30":{"name":"retrieveAndReturn","decl":{"start":{"line":237,"column":23},"end":{"line":237,"column":40}},"loc":{"start":{"line":237,"column":44},"end":{"line":250,"column":15}},"line":237},"31":{"name":"processFnAsync","decl":{"start":{"line":238,"column":25},"end":{"line":238,"column":39}},"loc":{"start":{"line":238,"column":43},"end":{"line":240,"column":17}},"line":238},"32":{"name":"processFn","decl":{"start":{"line":242,"column":25},"end":{"line":242,"column":34}},"loc":{"start":{"line":242,"column":38},"end":{"line":244,"column":17}},"line":242},"33":{"name":"(anonymous_33)","decl":{"start":{"line":262,"column":38},"end":{"line":262,"column":39}},"loc":{"start":{"line":262,"column":56},"end":{"line":264,"column":11}},"line":262},"34":{"name":"invalidateCache","decl":{"start":{"line":274,"column":11},"end":{"line":274,"column":26}},"loc":{"start":{"line":274,"column":37},"end":{"line":285,"column":3}},"line":274},"35":{"name":"(anonymous_35)","decl":{"start":{"line":275,"column":23},"end":{"line":275,"column":24}},"loc":{"start":{"line":275,"column":50},"end":{"line":284,"column":5}},"line":275},"36":{"name":"getCacheFilePathBound","decl":{"start":{"line":287,"column":11},"end":{"line":287,"column":32}},"loc":{"start":{"line":287,"column":49},"end":{"line":289,"column":3}},"line":287},"37":{"name":"(anonymous_37)","decl":{"start":{"line":294,"column":8},"end":{"line":294,"column":9}},"loc":{"start":{"line":294,"column":27},"end":{"line":300,"column":5}},"line":294},"38":{"name":"(anonymous_38)","decl":{"start":{"line":295,"column":24},"end":{"line":295,"column":25}},"loc":{"start":{"line":295,"column":36},"end":{"line":297,"column":7}},"line":295},"39":{"name":"(anonymous_39)","decl":{"start":{"line":297,"column":9},"end":{"line":297,"column":10}},"loc":{"start":{"line":297,"column":24},"end":{"line":299,"column":7}},"line":297}},"branchMap":{"0":{"loc":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},{"start":{"line":18,"column":4},"end":{"line":20,"column":5}}],"line":18},"1":{"loc":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},{"start":{"line":21,"column":4},"end":{"line":28,"column":5}}],"line":21},"2":{"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":51}},"type":"binary-expr","locations":[{"start":{"line":21,"column":8},"end":{"line":21,"column":33}},{"start":{"line":21,"column":37},"end":{"line":21,"column":51}}],"line":21},"3":{"loc":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"type":"if","locations":[{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},{"start":{"line":22,"column":6},"end":{"line":25,"column":7}}],"line":22},"4":{"loc":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"type":"binary-expr","locations":[{"start":{"line":38,"column":15},"end":{"line":38,"column":23}},{"start":{"line":38,"column":27},"end":{"line":38,"column":29}}],"line":38},"5":{"loc":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},{"start":{"line":40,"column":2},"end":{"line":46,"column":3}}],"line":40},"6":{"loc":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},{"start":{"line":42,"column":4},"end":{"line":44,"column":5}}],"line":42},"7":{"loc":{"start":{"line":45,"column":12},"end":{"line":45,"column":55}},"type":"cond-expr","locations":[{"start":{"line":45,"column":26},"end":{"line":45,"column":47}},{"start":{"line":45,"column":50},"end":{"line":45,"column":55}}],"line":45},"8":{"loc":{"start":{"line":48,"column":19},"end":{"line":48,"column":45}},"type":"binary-expr","locations":[{"start":{"line":48,"column":19},"end":{"line":48,"column":32}},{"start":{"line":48,"column":36},"end":{"line":48,"column":45}}],"line":48},"9":{"loc":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"type":"if","locations":[{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},{"start":{"line":57,"column":2},"end":{"line":59,"column":3}}],"line":57},"10":{"loc":{"start":{"line":57,"column":6},"end":{"line":57,"column":58}},"type":"binary-expr","locations":[{"start":{"line":57,"column":6},"end":{"line":57,"column":14}},{"start":{"line":57,"column":19},"end":{"line":57,"column":26}},{"start":{"line":57,"column":30},"end":{"line":57,"column":57}}],"line":57},"11":{"loc":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},{"start":{"line":60,"column":2},"end":{"line":62,"column":3}}],"line":60},"12":{"loc":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"type":"if","locations":[{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},{"start":{"line":87,"column":6},"end":{"line":89,"column":7}}],"line":87},"13":{"loc":{"start":{"line":87,"column":10},"end":{"line":87,"column":56}},"type":"binary-expr","locations":[{"start":{"line":87,"column":10},"end":{"line":87,"column":21}},{"start":{"line":87,"column":25},"end":{"line":87,"column":56}}],"line":87},"14":{"loc":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"type":"if","locations":[{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},{"start":{"line":90,"column":6},"end":{"line":92,"column":7}}],"line":90},"15":{"loc":{"start":{"line":90,"column":10},"end":{"line":90,"column":62}},"type":"binary-expr","locations":[{"start":{"line":90,"column":10},"end":{"line":90,"column":24}},{"start":{"line":90,"column":28},"end":{"line":90,"column":62}}],"line":90},"16":{"loc":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"type":"if","locations":[{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},{"start":{"line":93,"column":6},"end":{"line":95,"column":7}}],"line":93},"17":{"loc":{"start":{"line":93,"column":10},"end":{"line":93,"column":60}},"type":"binary-expr","locations":[{"start":{"line":93,"column":10},"end":{"line":93,"column":23}},{"start":{"line":93,"column":27},"end":{"line":93,"column":60}}],"line":93},"18":{"loc":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"type":"if","locations":[{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},{"start":{"line":98,"column":4},"end":{"line":100,"column":5}}],"line":98},"19":{"loc":{"start":{"line":98,"column":8},"end":{"line":98,"column":38}},"type":"binary-expr","locations":[{"start":{"line":98,"column":8},"end":{"line":98,"column":11}},{"start":{"line":98,"column":15},"end":{"line":98,"column":38}}],"line":98},"20":{"loc":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},{"start":{"line":102,"column":4},"end":{"line":104,"column":5}}],"line":102},"21":{"loc":{"start":{"line":109,"column":21},"end":{"line":109,"column":43}},"type":"binary-expr","locations":[{"start":{"line":109,"column":21},"end":{"line":109,"column":35}},{"start":{"line":109,"column":39},"end":{"line":109,"column":43}}],"line":109},"22":{"loc":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"type":"cond-expr","locations":[{"start":{"line":122,"column":38},"end":{"line":122,"column":59}},{"start":{"line":122,"column":62},"end":{"line":122,"column":71}}],"line":122},"23":{"loc":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"type":"if","locations":[{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},{"start":{"line":124,"column":10},"end":{"line":126,"column":11}}],"line":124},"24":{"loc":{"start":{"line":124,"column":14},"end":{"line":124,"column":61}},"type":"binary-expr","locations":[{"start":{"line":124,"column":14},"end":{"line":124,"column":41}},{"start":{"line":124,"column":45},"end":{"line":124,"column":61}}],"line":124},"25":{"loc":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"type":"if","locations":[{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},{"start":{"line":130,"column":10},"end":{"line":132,"column":11}}],"line":130},"26":{"loc":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"type":"if","locations":[{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},{"start":{"line":141,"column":16},"end":{"line":146,"column":17}}],"line":141},"27":{"loc":{"start":{"line":141,"column":20},"end":{"line":141,"column":73}},"type":"binary-expr","locations":[{"start":{"line":141,"column":21},"end":{"line":141,"column":22}},{"start":{"line":141,"column":26},"end":{"line":141,"column":47}},{"start":{"line":141,"column":52},"end":{"line":141,"column":73}}],"line":141},"28":{"loc":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"type":"if","locations":[{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},{"start":{"line":147,"column":16},"end":{"line":155,"column":17}}],"line":147},"29":{"loc":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"type":"if","locations":[{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},{"start":{"line":150,"column":22},"end":{"line":152,"column":23}}],"line":150},"30":{"loc":{"start":{"line":150,"column":26},"end":{"line":150,"column":54}},"type":"binary-expr","locations":[{"start":{"line":150,"column":26},"end":{"line":150,"column":29}},{"start":{"line":150,"column":33},"end":{"line":150,"column":54}}],"line":150},"31":{"loc":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"type":"if","locations":[{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},{"start":{"line":166,"column":18},"end":{"line":169,"column":19}}],"line":166},"32":{"loc":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"type":"if","locations":[{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},{"start":{"line":184,"column":16},"end":{"line":203,"column":17}}],"line":184},"33":{"loc":{"start":{"line":184,"column":20},"end":{"line":184,"column":63}},"type":"binary-expr","locations":[{"start":{"line":184,"column":20},"end":{"line":184,"column":26}},{"start":{"line":184,"column":30},"end":{"line":184,"column":63}}],"line":184},"34":{"loc":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"type":"if","locations":[{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},{"start":{"line":197,"column":20},"end":{"line":201,"column":21}}],"line":197},"35":{"loc":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"type":"if","locations":[{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},{"start":{"line":206,"column":14},"end":{"line":208,"column":15}}],"line":206},"36":{"loc":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"type":"if","locations":[{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},{"start":{"line":213,"column":14},"end":{"line":215,"column":15}}],"line":213},"37":{"loc":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"type":"if","locations":[{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},{"start":{"line":246,"column":16},"end":{"line":248,"column":17}}],"line":246},"38":{"loc":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"type":"if","locations":[{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},{"start":{"line":252,"column":14},"end":{"line":259,"column":15}}],"line":252},"39":{"loc":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"type":"if","locations":[{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},{"start":{"line":276,"column":6},"end":{"line":283,"column":7}}],"line":276},"40":{"loc":{"start":{"line":276,"column":10},"end":{"line":276,"column":48}},"type":"binary-expr","locations":[{"start":{"line":276,"column":10},"end":{"line":276,"column":17}},{"start":{"line":276,"column":21},"end":{"line":276,"column":48}}],"line":276},"41":{"loc":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"type":"cond-expr","locations":[{"start":{"line":279,"column":35},"end":{"line":279,"column":72}},{"start":{"line":279,"column":75},"end":{"line":279,"column":92}}],"line":279}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":76,"8":76,"9":225,"10":11,"11":214,"12":92,"13":3,"14":89,"15":211,"16":20,"17":71,"18":71,"19":71,"20":69,"21":69,"22":2,"23":69,"24":71,"25":71,"26":71,"27":54,"28":54,"29":3,"30":51,"31":2,"32":49,"33":99,"34":99,"35":96,"36":3,"37":53,"38":1,"39":52,"40":1,"41":51,"42":1,"43":56,"44":1,"45":55,"46":2,"47":53,"48":53,"49":50,"50":49,"51":49,"52":67,"53":67,"54":67,"55":7,"56":67,"57":67,"58":1,"59":66,"60":42,"61":11,"62":11,"63":31,"64":42,"65":3,"66":3,"67":3,"68":1,"69":42,"70":4,"71":4,"72":4,"73":4,"74":4,"75":4,"76":1,"77":3,"78":3,"79":3,"80":4,"81":42,"82":42,"83":2,"84":40,"85":4,"86":3,"87":3,"88":1,"89":36,"90":36,"91":1,"92":35,"93":46,"94":4,"95":42,"96":66,"97":66,"98":45,"99":17,"100":20,"101":20,"102":3,"103":3,"104":17,"105":20,"106":3,"107":17,"108":21,"109":1,"110":1,"111":20,"112":66,"113":61,"114":66,"115":49,"116":50,"117":5,"118":5,"119":1,"120":4,"121":4,"122":68,"123":49,"124":49,"125":57,"126":56,"127":1},"f":{"0":76,"1":225,"2":20,"3":71,"4":54,"5":99,"6":99,"7":96,"8":3,"9":56,"10":53,"11":49,"12":49,"13":67,"14":66,"15":46,"16":42,"17":3,"18":3,"19":4,"20":4,"21":3,"22":42,"23":3,"24":3,"25":1,"26":36,"27":66,"28":17,"29":20,"30":20,"31":3,"32":17,"33":61,"34":5,"35":5,"36":68,"37":57,"38":56,"39":1},"b":{"0":[11,214],"1":[92,122],"2":[214,100],"3":[3,89],"4":[71,69],"5":[69,2],"6":[2,67],"7":[2,67],"8":[71,2],"9":[3,51],"10":[54,53,53],"11":[2,49],"12":[1,52],"13":[53,2],"14":[1,51],"15":[52,46],"16":[1,50],"17":[51,4],"18":[1,55],"19":[56,48],"20":[2,53],"21":[50,5],"22":[56,11],"23":[7,60],"24":[67,9],"25":[1,66],"26":[11,31],"27":[42,37,34],"28":[3,39],"29":[1,2],"30":[3,2],"31":[1,3],"32":[4,36],"33":[40,35],"34":[1,35],"35":[4,42],"36":[45,21],"37":[3,17],"38":[1,20],"39":[1,4],"40":[5,4],"41":[3,1]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"64efb997a6eaf10de90dba97a3a3521133ecce7c","contentHash":"45a10e5130dd8fc525b3e00187ef3d4dfeba4f98865d8d122012996b5878540e"}} \ No newline at end of file diff --git a/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json b/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json deleted file mode 100644 index 695ba1b..0000000 --- a/.nyc_output/processinfo/c9b2699c-511f-420f-abd8-51a0b2da4d05.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid":"c9b2699c-511f-420f-abd8-51a0b2da4d05","parent":null,"pid":151138,"argv":["/home/charlike/.nvm/versions/node/v12.14.0/bin/node","/home/charlike/github/memoize-fs/node_modules/.bin/mocha","test"],"execArgv":[],"cwd":"/home/charlike/github/memoize-fs","time":1580944141294,"ppid":151114,"root":"7820491a-9009-497b-9a94-f96c756f5375","coverageFilename":"/home/charlike/github/memoize-fs/.nyc_output/c9b2699c-511f-420f-abd8-51a0b2da4d05.json","files":["/home/charlike/github/memoize-fs/index.js"]} \ No newline at end of file diff --git a/.nyc_output/processinfo/index.json b/.nyc_output/processinfo/index.json deleted file mode 100644 index b6b36b3..0000000 --- a/.nyc_output/processinfo/index.json +++ /dev/null @@ -1 +0,0 @@ -{"processes":{"c9b2699c-511f-420f-abd8-51a0b2da4d05":{"parent":null,"children":[]}},"files":{"/home/charlike/github/memoize-fs/index.js":["c9b2699c-511f-420f-abd8-51a0b2da4d05"]},"externalIds":{}} \ No newline at end of file From a82d11a7bc9170016175609fe0d5e90af20436fa Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Thu, 6 Feb 2020 01:22:34 +0200 Subject: [PATCH 03/19] chore(ci): test and require node 10.13 (first v10 lts) Signed-off-by: Charlike Mike Reagent --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e66d45d..1653900 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "url": "https://github.com/borisdiakur/memoize-fs" }, "engines": { - "node": ">= 10.0.0", + "node": ">= 10.13.0", "npm": ">= 6.0.0" }, "dependencies": { From e0d3ff4c7da492ea9ad1d1002a4f25e7a65da85b Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Tue, 25 Feb 2020 19:40:14 +0200 Subject: [PATCH 04/19] chore: switch to serialize-javascript in testing Signed-off-by: Charlike Mike Reagent --- .../a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json | 1 + .../a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json | 1 + .nyc_output/processinfo/index.json | 1 + package-lock.json | 12 ++++++------ package.json | 2 +- test/test.js | 8 ++++++-- 6 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json create mode 100644 .nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json create mode 100644 .nyc_output/processinfo/index.json diff --git a/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json b/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json new file mode 100644 index 0000000..c972e15 --- /dev/null +++ b/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json @@ -0,0 +1 @@ +{"/home/charlike/github/memoize-fs/index.js":{"path":"/home/charlike/github/memoize-fs/index.js","statementMap":{"0":{"start":{"line":2,"column":13},"end":{"line":2,"column":28}},"1":{"start":{"line":3,"column":15},"end":{"line":3,"column":32}},"2":{"start":{"line":4,"column":16},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"5":{"start":{"line":8,"column":0},"end":{"line":8,"column":50}},"6":{"start":{"line":10,"column":19},"end":{"line":13,"column":1}},"7":{"start":{"line":16,"column":22},"end":{"line":16,"column":24}},"8":{"start":{"line":17,"column":2},"end":{"line":30,"column":4}},"9":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":12}},"11":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"12":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"13":{"start":{"line":24,"column":8},"end":{"line":24,"column":14}},"14":{"start":{"line":27,"column":6},"end":{"line":27,"column":29}},"15":{"start":{"line":29,"column":4},"end":{"line":29,"column":16}},"16":{"start":{"line":34,"column":2},"end":{"line":34,"column":28}},"17":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"18":{"start":{"line":39,"column":14},"end":{"line":39,"column":16}},"19":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"20":{"start":{"line":41,"column":4},"end":{"line":41,"column":22}},"21":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"22":{"start":{"line":43,"column":6},"end":{"line":43,"column":61}},"23":{"start":{"line":45,"column":4},"end":{"line":45,"column":55}},"24":{"start":{"line":48,"column":18},"end":{"line":48,"column":52}},"25":{"start":{"line":49,"column":15},"end":{"line":49,"column":84}},"26":{"start":{"line":50,"column":2},"end":{"line":50,"column":52}},"27":{"start":{"line":54,"column":23},"end":{"line":54,"column":25}},"28":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"29":{"start":{"line":58,"column":4},"end":{"line":58,"column":54}},"30":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"31":{"start":{"line":61,"column":4},"end":{"line":61,"column":63}},"32":{"start":{"line":63,"column":2},"end":{"line":63,"column":41}},"33":{"start":{"line":67,"column":4},"end":{"line":82,"column":6}},"34":{"start":{"line":68,"column":6},"end":{"line":81,"column":10}},"35":{"start":{"line":70,"column":10},"end":{"line":70,"column":19}},"36":{"start":{"line":80,"column":10},"end":{"line":80,"column":21}},"37":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"38":{"start":{"line":88,"column":8},"end":{"line":88,"column":94}},"39":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"40":{"start":{"line":91,"column":8},"end":{"line":91,"column":100}},"41":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"42":{"start":{"line":94,"column":8},"end":{"line":94,"column":80}},"43":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"44":{"start":{"line":99,"column":6},"end":{"line":99,"column":80}},"45":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"46":{"start":{"line":103,"column":6},"end":{"line":103,"column":53}},"47":{"start":{"line":106,"column":19},"end":{"line":106,"column":56}},"48":{"start":{"line":107,"column":4},"end":{"line":107,"column":24}},"49":{"start":{"line":109,"column":4},"end":{"line":109,"column":43}},"50":{"start":{"line":119,"column":6},"end":{"line":268,"column":8}},"51":{"start":{"line":120,"column":22},"end":{"line":266,"column":9}},"52":{"start":{"line":121,"column":23},"end":{"line":121,"column":60}},"53":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"54":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"55":{"start":{"line":125,"column":12},"end":{"line":125,"column":31}},"56":{"start":{"line":128,"column":27},"end":{"line":128,"column":66}},"57":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"58":{"start":{"line":131,"column":12},"end":{"line":131,"column":41}},"59":{"start":{"line":134,"column":10},"end":{"line":261,"column":12}},"60":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"61":{"start":{"line":142,"column":18},"end":{"line":142,"column":41}},"62":{"start":{"line":143,"column":18},"end":{"line":143,"column":60}},"63":{"start":{"line":145,"column":18},"end":{"line":145,"column":53}},"64":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"65":{"start":{"line":148,"column":18},"end":{"line":154,"column":35}},"66":{"start":{"line":149,"column":20},"end":{"line":153,"column":22}},"67":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"68":{"start":{"line":151,"column":24},"end":{"line":151,"column":33}},"69":{"start":{"line":156,"column":16},"end":{"line":156,"column":56}},"70":{"start":{"line":160,"column":16},"end":{"line":160,"column":26}},"71":{"start":{"line":162,"column":16},"end":{"line":174,"column":18}},"72":{"start":{"line":163,"column":32},"end":{"line":163,"column":44}},"73":{"start":{"line":164,"column":33},"end":{"line":164,"column":70}},"74":{"start":{"line":165,"column":18},"end":{"line":165,"column":32}},"75":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"76":{"start":{"line":168,"column":20},"end":{"line":168,"column":40}},"77":{"start":{"line":170,"column":18},"end":{"line":170,"column":38}},"78":{"start":{"line":171,"column":18},"end":{"line":173,"column":20}},"79":{"start":{"line":172,"column":20},"end":{"line":172,"column":54}},"80":{"start":{"line":175,"column":16},"end":{"line":175,"column":36}},"81":{"start":{"line":179,"column":16},"end":{"line":183,"column":17}},"82":{"start":{"line":180,"column":18},"end":{"line":180,"column":47}},"83":{"start":{"line":182,"column":18},"end":{"line":182,"column":34}},"84":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"85":{"start":{"line":186,"column":18},"end":{"line":194,"column":20}},"86":{"start":{"line":187,"column":20},"end":{"line":189,"column":22}},"87":{"start":{"line":188,"column":22},"end":{"line":188,"column":37}},"88":{"start":{"line":193,"column":20},"end":{"line":193,"column":31}},"89":{"start":{"line":196,"column":18},"end":{"line":202,"column":20}},"90":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"91":{"start":{"line":198,"column":22},"end":{"line":198,"column":33}},"92":{"start":{"line":200,"column":22},"end":{"line":200,"column":37}},"93":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"94":{"start":{"line":207,"column":16},"end":{"line":207,"column":39}},"95":{"start":{"line":209,"column":14},"end":{"line":209,"column":32}},"96":{"start":{"line":212,"column":12},"end":{"line":260,"column":14}},"97":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"98":{"start":{"line":214,"column":16},"end":{"line":214,"column":39}},"99":{"start":{"line":218,"column":16},"end":{"line":218,"column":69}},"100":{"start":{"line":222,"column":16},"end":{"line":234,"column":17}},"101":{"start":{"line":223,"column":44},"end":{"line":223,"column":76}},"102":{"start":{"line":233,"column":18},"end":{"line":233,"column":34}},"103":{"start":{"line":239,"column":18},"end":{"line":239,"column":63}},"104":{"start":{"line":243,"column":18},"end":{"line":243,"column":44}},"105":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"106":{"start":{"line":247,"column":18},"end":{"line":247,"column":41}},"107":{"start":{"line":249,"column":16},"end":{"line":249,"column":34}},"108":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"109":{"start":{"line":253,"column":16},"end":{"line":253,"column":35}},"110":{"start":{"line":255,"column":16},"end":{"line":255,"column":32}},"111":{"start":{"line":258,"column":16},"end":{"line":258,"column":35}},"112":{"start":{"line":262,"column":10},"end":{"line":264,"column":12}},"113":{"start":{"line":263,"column":12},"end":{"line":263,"column":41}},"114":{"start":{"line":265,"column":10},"end":{"line":265,"column":39}},"115":{"start":{"line":267,"column":8},"end":{"line":267,"column":22}},"116":{"start":{"line":271,"column":4},"end":{"line":271,"column":89}},"117":{"start":{"line":275,"column":4},"end":{"line":284,"column":6}},"118":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"119":{"start":{"line":277,"column":8},"end":{"line":277,"column":95}},"120":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"121":{"start":{"line":280,"column":8},"end":{"line":282,"column":24}},"122":{"start":{"line":288,"column":4},"end":{"line":288,"column":95}},"123":{"start":{"line":291,"column":16},"end":{"line":291,"column":44}},"124":{"start":{"line":293,"column":2},"end":{"line":303,"column":3}},"125":{"start":{"line":295,"column":6},"end":{"line":299,"column":8}},"126":{"start":{"line":296,"column":8},"end":{"line":296,"column":33}},"127":{"start":{"line":298,"column":8},"end":{"line":298,"column":17}}},"fnMap":{"0":{"name":"serialize","decl":{"start":{"line":15,"column":9},"end":{"line":15,"column":18}},"loc":{"start":{"line":15,"column":25},"end":{"line":31,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":29},"end":{"line":17,"column":30}},"loc":{"start":{"line":17,"column":52},"end":{"line":30,"column":3}},"line":17},"2":{"name":"deserialize","decl":{"start":{"line":33,"column":9},"end":{"line":33,"column":20}},"loc":{"start":{"line":33,"column":31},"end":{"line":35,"column":1}},"line":33},"3":{"name":"getCacheFilePath","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":25}},"loc":{"start":{"line":37,"column":42},"end":{"line":51,"column":1}},"line":37},"4":{"name":"buildMemoizer","decl":{"start":{"line":53,"column":9},"end":{"line":53,"column":22}},"loc":{"start":{"line":53,"column":33},"end":{"line":304,"column":1}},"line":53},"5":{"name":"initCache","decl":{"start":{"line":66,"column":11},"end":{"line":66,"column":20}},"loc":{"start":{"line":66,"column":33},"end":{"line":83,"column":3}},"line":66},"6":{"name":"(anonymous_6)","decl":{"start":{"line":67,"column":23},"end":{"line":67,"column":24}},"loc":{"start":{"line":67,"column":50},"end":{"line":82,"column":5}},"line":67},"7":{"name":"(anonymous_7)","decl":{"start":{"line":69,"column":14},"end":{"line":69,"column":15}},"loc":{"start":{"line":69,"column":20},"end":{"line":71,"column":9}},"line":69},"8":{"name":"(anonymous_8)","decl":{"start":{"line":72,"column":15},"end":{"line":72,"column":16}},"loc":{"start":{"line":72,"column":24},"end":{"line":81,"column":9}},"line":72},"9":{"name":"memoizeFn","decl":{"start":{"line":85,"column":11},"end":{"line":85,"column":20}},"loc":{"start":{"line":85,"column":31},"end":{"line":272,"column":3}},"line":85},"10":{"name":"checkOptions","decl":{"start":{"line":86,"column":13},"end":{"line":86,"column":25}},"loc":{"start":{"line":86,"column":35},"end":{"line":96,"column":5}},"line":86},"11":{"name":"resolveWithMemFn","decl":{"start":{"line":118,"column":13},"end":{"line":118,"column":29}},"loc":{"start":{"line":118,"column":33},"end":{"line":269,"column":5}},"line":118},"12":{"name":"(anonymous_12)","decl":{"start":{"line":119,"column":25},"end":{"line":119,"column":26}},"loc":{"start":{"line":119,"column":44},"end":{"line":268,"column":7}},"line":119},"13":{"name":"(anonymous_13)","decl":{"start":{"line":120,"column":22},"end":{"line":120,"column":23}},"loc":{"start":{"line":120,"column":34},"end":{"line":266,"column":9}},"line":120},"14":{"name":"(anonymous_14)","decl":{"start":{"line":134,"column":47},"end":{"line":134,"column":48}},"loc":{"start":{"line":134,"column":74},"end":{"line":261,"column":11}},"line":134},"15":{"name":"cacheAndReturn","decl":{"start":{"line":135,"column":21},"end":{"line":135,"column":35}},"loc":{"start":{"line":135,"column":39},"end":{"line":210,"column":13}},"line":135},"16":{"name":"writeResult","decl":{"start":{"line":138,"column":23},"end":{"line":138,"column":34}},"loc":{"start":{"line":138,"column":43},"end":{"line":157,"column":15}},"line":138},"17":{"name":"(anonymous_17)","decl":{"start":{"line":148,"column":29},"end":{"line":148,"column":30}},"loc":{"start":{"line":148,"column":41},"end":{"line":154,"column":19}},"line":148},"18":{"name":"(anonymous_18)","decl":{"start":{"line":149,"column":40},"end":{"line":149,"column":41}},"loc":{"start":{"line":149,"column":55},"end":{"line":153,"column":21}},"line":149},"19":{"name":"processFnAsync","decl":{"start":{"line":159,"column":23},"end":{"line":159,"column":37}},"loc":{"start":{"line":159,"column":41},"end":{"line":176,"column":15}},"line":159},"20":{"name":"(anonymous_20)","decl":{"start":{"line":162,"column":26},"end":{"line":162,"column":27}},"loc":{"start":{"line":162,"column":58},"end":{"line":174,"column":17}},"line":162},"21":{"name":"(anonymous_21)","decl":{"start":{"line":171,"column":38},"end":{"line":171,"column":39}},"loc":{"start":{"line":171,"column":50},"end":{"line":173,"column":19}},"line":171},"22":{"name":"processFn","decl":{"start":{"line":178,"column":23},"end":{"line":178,"column":32}},"loc":{"start":{"line":178,"column":36},"end":{"line":204,"column":15}},"line":178},"23":{"name":"(anonymous_23)","decl":{"start":{"line":186,"column":37},"end":{"line":186,"column":38}},"loc":{"start":{"line":186,"column":55},"end":{"line":190,"column":19}},"line":186},"24":{"name":"(anonymous_24)","decl":{"start":{"line":187,"column":40},"end":{"line":187,"column":41}},"loc":{"start":{"line":187,"column":52},"end":{"line":189,"column":21}},"line":187},"25":{"name":"(anonymous_25)","decl":{"start":{"line":191,"column":18},"end":{"line":191,"column":19}},"loc":{"start":{"line":191,"column":33},"end":{"line":194,"column":19}},"line":191},"26":{"name":"(anonymous_26)","decl":{"start":{"line":196,"column":38},"end":{"line":196,"column":39}},"loc":{"start":{"line":196,"column":53},"end":{"line":202,"column":19}},"line":196},"27":{"name":"(anonymous_27)","decl":{"start":{"line":212,"column":56},"end":{"line":212,"column":57}},"loc":{"start":{"line":212,"column":77},"end":{"line":260,"column":13}},"line":212},"28":{"name":"hasOwn","decl":{"start":{"line":217,"column":23},"end":{"line":217,"column":29}},"loc":{"start":{"line":217,"column":41},"end":{"line":219,"column":15}},"line":217},"29":{"name":"parseResult","decl":{"start":{"line":221,"column":23},"end":{"line":221,"column":34}},"loc":{"start":{"line":221,"column":50},"end":{"line":235,"column":15}},"line":221},"30":{"name":"retrieveAndReturn","decl":{"start":{"line":237,"column":23},"end":{"line":237,"column":40}},"loc":{"start":{"line":237,"column":44},"end":{"line":250,"column":15}},"line":237},"31":{"name":"processFnAsync","decl":{"start":{"line":238,"column":25},"end":{"line":238,"column":39}},"loc":{"start":{"line":238,"column":43},"end":{"line":240,"column":17}},"line":238},"32":{"name":"processFn","decl":{"start":{"line":242,"column":25},"end":{"line":242,"column":34}},"loc":{"start":{"line":242,"column":38},"end":{"line":244,"column":17}},"line":242},"33":{"name":"(anonymous_33)","decl":{"start":{"line":262,"column":38},"end":{"line":262,"column":39}},"loc":{"start":{"line":262,"column":56},"end":{"line":264,"column":11}},"line":262},"34":{"name":"invalidateCache","decl":{"start":{"line":274,"column":11},"end":{"line":274,"column":26}},"loc":{"start":{"line":274,"column":37},"end":{"line":285,"column":3}},"line":274},"35":{"name":"(anonymous_35)","decl":{"start":{"line":275,"column":23},"end":{"line":275,"column":24}},"loc":{"start":{"line":275,"column":50},"end":{"line":284,"column":5}},"line":275},"36":{"name":"getCacheFilePathBound","decl":{"start":{"line":287,"column":11},"end":{"line":287,"column":32}},"loc":{"start":{"line":287,"column":49},"end":{"line":289,"column":3}},"line":287},"37":{"name":"(anonymous_37)","decl":{"start":{"line":294,"column":8},"end":{"line":294,"column":9}},"loc":{"start":{"line":294,"column":27},"end":{"line":300,"column":5}},"line":294},"38":{"name":"(anonymous_38)","decl":{"start":{"line":295,"column":24},"end":{"line":295,"column":25}},"loc":{"start":{"line":295,"column":36},"end":{"line":297,"column":7}},"line":295},"39":{"name":"(anonymous_39)","decl":{"start":{"line":297,"column":9},"end":{"line":297,"column":10}},"loc":{"start":{"line":297,"column":24},"end":{"line":299,"column":7}},"line":297}},"branchMap":{"0":{"loc":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},{"start":{"line":18,"column":4},"end":{"line":20,"column":5}}],"line":18},"1":{"loc":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},{"start":{"line":21,"column":4},"end":{"line":28,"column":5}}],"line":21},"2":{"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":51}},"type":"binary-expr","locations":[{"start":{"line":21,"column":8},"end":{"line":21,"column":33}},{"start":{"line":21,"column":37},"end":{"line":21,"column":51}}],"line":21},"3":{"loc":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"type":"if","locations":[{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},{"start":{"line":22,"column":6},"end":{"line":25,"column":7}}],"line":22},"4":{"loc":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"type":"binary-expr","locations":[{"start":{"line":38,"column":15},"end":{"line":38,"column":23}},{"start":{"line":38,"column":27},"end":{"line":38,"column":29}}],"line":38},"5":{"loc":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},{"start":{"line":40,"column":2},"end":{"line":46,"column":3}}],"line":40},"6":{"loc":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},{"start":{"line":42,"column":4},"end":{"line":44,"column":5}}],"line":42},"7":{"loc":{"start":{"line":45,"column":12},"end":{"line":45,"column":55}},"type":"cond-expr","locations":[{"start":{"line":45,"column":26},"end":{"line":45,"column":47}},{"start":{"line":45,"column":50},"end":{"line":45,"column":55}}],"line":45},"8":{"loc":{"start":{"line":48,"column":19},"end":{"line":48,"column":45}},"type":"binary-expr","locations":[{"start":{"line":48,"column":19},"end":{"line":48,"column":32}},{"start":{"line":48,"column":36},"end":{"line":48,"column":45}}],"line":48},"9":{"loc":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"type":"if","locations":[{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},{"start":{"line":57,"column":2},"end":{"line":59,"column":3}}],"line":57},"10":{"loc":{"start":{"line":57,"column":6},"end":{"line":57,"column":58}},"type":"binary-expr","locations":[{"start":{"line":57,"column":6},"end":{"line":57,"column":14}},{"start":{"line":57,"column":19},"end":{"line":57,"column":26}},{"start":{"line":57,"column":30},"end":{"line":57,"column":57}}],"line":57},"11":{"loc":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},{"start":{"line":60,"column":2},"end":{"line":62,"column":3}}],"line":60},"12":{"loc":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"type":"if","locations":[{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},{"start":{"line":87,"column":6},"end":{"line":89,"column":7}}],"line":87},"13":{"loc":{"start":{"line":87,"column":10},"end":{"line":87,"column":56}},"type":"binary-expr","locations":[{"start":{"line":87,"column":10},"end":{"line":87,"column":21}},{"start":{"line":87,"column":25},"end":{"line":87,"column":56}}],"line":87},"14":{"loc":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"type":"if","locations":[{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},{"start":{"line":90,"column":6},"end":{"line":92,"column":7}}],"line":90},"15":{"loc":{"start":{"line":90,"column":10},"end":{"line":90,"column":62}},"type":"binary-expr","locations":[{"start":{"line":90,"column":10},"end":{"line":90,"column":24}},{"start":{"line":90,"column":28},"end":{"line":90,"column":62}}],"line":90},"16":{"loc":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"type":"if","locations":[{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},{"start":{"line":93,"column":6},"end":{"line":95,"column":7}}],"line":93},"17":{"loc":{"start":{"line":93,"column":10},"end":{"line":93,"column":60}},"type":"binary-expr","locations":[{"start":{"line":93,"column":10},"end":{"line":93,"column":23}},{"start":{"line":93,"column":27},"end":{"line":93,"column":60}}],"line":93},"18":{"loc":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"type":"if","locations":[{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},{"start":{"line":98,"column":4},"end":{"line":100,"column":5}}],"line":98},"19":{"loc":{"start":{"line":98,"column":8},"end":{"line":98,"column":38}},"type":"binary-expr","locations":[{"start":{"line":98,"column":8},"end":{"line":98,"column":11}},{"start":{"line":98,"column":15},"end":{"line":98,"column":38}}],"line":98},"20":{"loc":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},{"start":{"line":102,"column":4},"end":{"line":104,"column":5}}],"line":102},"21":{"loc":{"start":{"line":109,"column":21},"end":{"line":109,"column":43}},"type":"binary-expr","locations":[{"start":{"line":109,"column":21},"end":{"line":109,"column":35}},{"start":{"line":109,"column":39},"end":{"line":109,"column":43}}],"line":109},"22":{"loc":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"type":"cond-expr","locations":[{"start":{"line":122,"column":38},"end":{"line":122,"column":59}},{"start":{"line":122,"column":62},"end":{"line":122,"column":71}}],"line":122},"23":{"loc":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"type":"if","locations":[{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},{"start":{"line":124,"column":10},"end":{"line":126,"column":11}}],"line":124},"24":{"loc":{"start":{"line":124,"column":14},"end":{"line":124,"column":61}},"type":"binary-expr","locations":[{"start":{"line":124,"column":14},"end":{"line":124,"column":41}},{"start":{"line":124,"column":45},"end":{"line":124,"column":61}}],"line":124},"25":{"loc":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"type":"if","locations":[{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},{"start":{"line":130,"column":10},"end":{"line":132,"column":11}}],"line":130},"26":{"loc":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"type":"if","locations":[{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},{"start":{"line":141,"column":16},"end":{"line":146,"column":17}}],"line":141},"27":{"loc":{"start":{"line":141,"column":20},"end":{"line":141,"column":73}},"type":"binary-expr","locations":[{"start":{"line":141,"column":21},"end":{"line":141,"column":22}},{"start":{"line":141,"column":26},"end":{"line":141,"column":47}},{"start":{"line":141,"column":52},"end":{"line":141,"column":73}}],"line":141},"28":{"loc":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"type":"if","locations":[{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},{"start":{"line":147,"column":16},"end":{"line":155,"column":17}}],"line":147},"29":{"loc":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"type":"if","locations":[{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},{"start":{"line":150,"column":22},"end":{"line":152,"column":23}}],"line":150},"30":{"loc":{"start":{"line":150,"column":26},"end":{"line":150,"column":54}},"type":"binary-expr","locations":[{"start":{"line":150,"column":26},"end":{"line":150,"column":29}},{"start":{"line":150,"column":33},"end":{"line":150,"column":54}}],"line":150},"31":{"loc":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"type":"if","locations":[{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},{"start":{"line":166,"column":18},"end":{"line":169,"column":19}}],"line":166},"32":{"loc":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"type":"if","locations":[{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},{"start":{"line":184,"column":16},"end":{"line":203,"column":17}}],"line":184},"33":{"loc":{"start":{"line":184,"column":20},"end":{"line":184,"column":63}},"type":"binary-expr","locations":[{"start":{"line":184,"column":20},"end":{"line":184,"column":26}},{"start":{"line":184,"column":30},"end":{"line":184,"column":63}}],"line":184},"34":{"loc":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"type":"if","locations":[{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},{"start":{"line":197,"column":20},"end":{"line":201,"column":21}}],"line":197},"35":{"loc":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"type":"if","locations":[{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},{"start":{"line":206,"column":14},"end":{"line":208,"column":15}}],"line":206},"36":{"loc":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"type":"if","locations":[{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},{"start":{"line":213,"column":14},"end":{"line":215,"column":15}}],"line":213},"37":{"loc":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"type":"if","locations":[{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},{"start":{"line":246,"column":16},"end":{"line":248,"column":17}}],"line":246},"38":{"loc":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"type":"if","locations":[{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},{"start":{"line":252,"column":14},"end":{"line":259,"column":15}}],"line":252},"39":{"loc":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"type":"if","locations":[{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},{"start":{"line":276,"column":6},"end":{"line":283,"column":7}}],"line":276},"40":{"loc":{"start":{"line":276,"column":10},"end":{"line":276,"column":48}},"type":"binary-expr","locations":[{"start":{"line":276,"column":10},"end":{"line":276,"column":17}},{"start":{"line":276,"column":21},"end":{"line":276,"column":48}}],"line":276},"41":{"loc":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"type":"cond-expr","locations":[{"start":{"line":279,"column":35},"end":{"line":279,"column":72}},{"start":{"line":279,"column":75},"end":{"line":279,"column":92}}],"line":279}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":76,"8":76,"9":225,"10":11,"11":214,"12":92,"13":3,"14":89,"15":211,"16":20,"17":70,"18":70,"19":70,"20":68,"21":68,"22":2,"23":68,"24":70,"25":70,"26":70,"27":54,"28":54,"29":3,"30":51,"31":2,"32":49,"33":99,"34":99,"35":96,"36":3,"37":53,"38":1,"39":52,"40":1,"41":51,"42":1,"43":56,"44":1,"45":55,"46":2,"47":53,"48":53,"49":50,"50":49,"51":49,"52":67,"53":67,"54":67,"55":7,"56":67,"57":67,"58":1,"59":66,"60":42,"61":11,"62":11,"63":31,"64":42,"65":3,"66":3,"67":3,"68":1,"69":42,"70":4,"71":4,"72":4,"73":4,"74":4,"75":4,"76":1,"77":3,"78":3,"79":3,"80":4,"81":42,"82":42,"83":2,"84":40,"85":4,"86":3,"87":3,"88":1,"89":36,"90":36,"91":1,"92":35,"93":46,"94":4,"95":42,"96":66,"97":66,"98":45,"99":17,"100":20,"101":20,"102":3,"103":3,"104":17,"105":20,"106":3,"107":17,"108":21,"109":1,"110":1,"111":20,"112":66,"113":61,"114":66,"115":49,"116":50,"117":5,"118":5,"119":1,"120":4,"121":4,"122":68,"123":49,"124":49,"125":57,"126":56,"127":1},"f":{"0":76,"1":225,"2":20,"3":70,"4":54,"5":99,"6":99,"7":96,"8":3,"9":56,"10":53,"11":49,"12":49,"13":67,"14":66,"15":46,"16":42,"17":3,"18":3,"19":4,"20":4,"21":3,"22":42,"23":3,"24":3,"25":1,"26":36,"27":66,"28":17,"29":20,"30":20,"31":3,"32":17,"33":61,"34":5,"35":5,"36":68,"37":57,"38":56,"39":1},"b":{"0":[11,214],"1":[92,122],"2":[214,100],"3":[3,89],"4":[70,68],"5":[68,2],"6":[2,66],"7":[2,66],"8":[70,2],"9":[3,51],"10":[54,53,53],"11":[2,49],"12":[1,52],"13":[53,2],"14":[1,51],"15":[52,46],"16":[1,50],"17":[51,4],"18":[1,55],"19":[56,48],"20":[2,53],"21":[50,5],"22":[56,11],"23":[7,60],"24":[67,9],"25":[1,66],"26":[11,31],"27":[42,37,34],"28":[3,39],"29":[1,2],"30":[3,2],"31":[1,3],"32":[4,36],"33":[40,35],"34":[1,35],"35":[4,42],"36":[45,21],"37":[3,17],"38":[1,20],"39":[1,4],"40":[5,4],"41":[3,1]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"64efb997a6eaf10de90dba97a3a3521133ecce7c","contentHash":"45a10e5130dd8fc525b3e00187ef3d4dfeba4f98865d8d122012996b5878540e"}} \ No newline at end of file diff --git a/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json b/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json new file mode 100644 index 0000000..653ba68 --- /dev/null +++ b/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json @@ -0,0 +1 @@ +{"uuid":"a81e9bdf-8e36-4183-8fce-d82b127e3ec1","parent":null,"pid":1029686,"argv":["/home/charlike/.nvm/versions/node/v12.14.0/bin/node","/home/charlike/github/memoize-fs/node_modules/.bin/mocha"],"execArgv":[],"cwd":"/home/charlike/github/memoize-fs","time":1582652388005,"ppid":1029660,"root":"9b3e3c32-7cd5-454a-8de5-705867b307c4","coverageFilename":"/home/charlike/github/memoize-fs/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json","files":["/home/charlike/github/memoize-fs/index.js"]} \ No newline at end of file diff --git a/.nyc_output/processinfo/index.json b/.nyc_output/processinfo/index.json new file mode 100644 index 0000000..a6cd3a7 --- /dev/null +++ b/.nyc_output/processinfo/index.json @@ -0,0 +1 @@ +{"processes":{"a81e9bdf-8e36-4183-8fce-d82b127e3ec1":{"parent":null,"children":[]}},"files":{"/home/charlike/github/memoize-fs/index.js":["a81e9bdf-8e36-4183-8fce-d82b127e3ec1"]},"externalIds":{}} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7b0c642..da9ca83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1796,12 +1796,6 @@ } } }, - "node-serialize": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/node-serialize/-/node-serialize-0.0.4.tgz", - "integrity": "sha1-tzpJ4TUzBmVxA6Xkn38FJ5upf38=", - "dev": true - }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -2214,6 +2208,12 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", + "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==", + "dev": true + }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", diff --git a/package.json b/package.json index 1653900..6e498fe 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "istanbul": "^0.4.5", "mocha": "^7.0.1", "mocha-lcov-reporter": "1.3.0", - "node-serialize": "0.0.4" + "serialize-javascript": "^3.0.0" }, "private": false, "main": "index.js", diff --git a/test/test.js b/test/test.js index b7782e1..eceba42 100644 --- a/test/test.js +++ b/test/test.js @@ -5,7 +5,7 @@ const path = require('path') const assert = require('assert') const fs = require('fs-extra') -const serializer = require('node-serialize') +const serialize = require('serialize-javascript') const memoizeFs = require('../index') describe('memoize-fs', function () { @@ -83,7 +83,11 @@ describe('memoize-fs', function () { const cachePath = path.join(__dirname, '../build/cache') fs.removeSync(cachePath) - const {serialize, unserialize: deserialize} = serializer + function deserialize (serializedJavascript) { + // eslint-disable-next-line no-eval + return eval('(' + serializedJavascript + ')') + } + const options = {cachePath, cacheId: 'tmp', serialize, deserialize} const memoize = memoizeFs(options) From 3d4708943444bce2fd45951010ae527cb47d62e5 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Tue, 25 Feb 2020 19:41:04 +0200 Subject: [PATCH 05/19] cleanup and add nyc in gitignore Signed-off-by: Charlike Mike Reagent --- .gitignore | 2 ++ .nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json | 1 - .../processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json | 1 - .nyc_output/processinfo/index.json | 1 - 4 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 .nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json delete mode 100644 .nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json delete mode 100644 .nyc_output/processinfo/index.json diff --git a/.gitignore b/.gitignore index 9d6714b..2339a82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store +.nyc_output +.cache .idea # Logs diff --git a/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json b/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json deleted file mode 100644 index c972e15..0000000 --- a/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json +++ /dev/null @@ -1 +0,0 @@ -{"/home/charlike/github/memoize-fs/index.js":{"path":"/home/charlike/github/memoize-fs/index.js","statementMap":{"0":{"start":{"line":2,"column":13},"end":{"line":2,"column":28}},"1":{"start":{"line":3,"column":15},"end":{"line":3,"column":32}},"2":{"start":{"line":4,"column":16},"end":{"line":4,"column":34}},"3":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":30}},"5":{"start":{"line":8,"column":0},"end":{"line":8,"column":50}},"6":{"start":{"line":10,"column":19},"end":{"line":13,"column":1}},"7":{"start":{"line":16,"column":22},"end":{"line":16,"column":24}},"8":{"start":{"line":17,"column":2},"end":{"line":30,"column":4}},"9":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"10":{"start":{"line":19,"column":6},"end":{"line":19,"column":12}},"11":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"12":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"13":{"start":{"line":24,"column":8},"end":{"line":24,"column":14}},"14":{"start":{"line":27,"column":6},"end":{"line":27,"column":29}},"15":{"start":{"line":29,"column":4},"end":{"line":29,"column":16}},"16":{"start":{"line":34,"column":2},"end":{"line":34,"column":28}},"17":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"18":{"start":{"line":39,"column":14},"end":{"line":39,"column":16}},"19":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"20":{"start":{"line":41,"column":4},"end":{"line":41,"column":22}},"21":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"22":{"start":{"line":43,"column":6},"end":{"line":43,"column":61}},"23":{"start":{"line":45,"column":4},"end":{"line":45,"column":55}},"24":{"start":{"line":48,"column":18},"end":{"line":48,"column":52}},"25":{"start":{"line":49,"column":15},"end":{"line":49,"column":84}},"26":{"start":{"line":50,"column":2},"end":{"line":50,"column":52}},"27":{"start":{"line":54,"column":23},"end":{"line":54,"column":25}},"28":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"29":{"start":{"line":58,"column":4},"end":{"line":58,"column":54}},"30":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"31":{"start":{"line":61,"column":4},"end":{"line":61,"column":63}},"32":{"start":{"line":63,"column":2},"end":{"line":63,"column":41}},"33":{"start":{"line":67,"column":4},"end":{"line":82,"column":6}},"34":{"start":{"line":68,"column":6},"end":{"line":81,"column":10}},"35":{"start":{"line":70,"column":10},"end":{"line":70,"column":19}},"36":{"start":{"line":80,"column":10},"end":{"line":80,"column":21}},"37":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"38":{"start":{"line":88,"column":8},"end":{"line":88,"column":94}},"39":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"40":{"start":{"line":91,"column":8},"end":{"line":91,"column":100}},"41":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"42":{"start":{"line":94,"column":8},"end":{"line":94,"column":80}},"43":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"44":{"start":{"line":99,"column":6},"end":{"line":99,"column":80}},"45":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"46":{"start":{"line":103,"column":6},"end":{"line":103,"column":53}},"47":{"start":{"line":106,"column":19},"end":{"line":106,"column":56}},"48":{"start":{"line":107,"column":4},"end":{"line":107,"column":24}},"49":{"start":{"line":109,"column":4},"end":{"line":109,"column":43}},"50":{"start":{"line":119,"column":6},"end":{"line":268,"column":8}},"51":{"start":{"line":120,"column":22},"end":{"line":266,"column":9}},"52":{"start":{"line":121,"column":23},"end":{"line":121,"column":60}},"53":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"54":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"55":{"start":{"line":125,"column":12},"end":{"line":125,"column":31}},"56":{"start":{"line":128,"column":27},"end":{"line":128,"column":66}},"57":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"58":{"start":{"line":131,"column":12},"end":{"line":131,"column":41}},"59":{"start":{"line":134,"column":10},"end":{"line":261,"column":12}},"60":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"61":{"start":{"line":142,"column":18},"end":{"line":142,"column":41}},"62":{"start":{"line":143,"column":18},"end":{"line":143,"column":60}},"63":{"start":{"line":145,"column":18},"end":{"line":145,"column":53}},"64":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"65":{"start":{"line":148,"column":18},"end":{"line":154,"column":35}},"66":{"start":{"line":149,"column":20},"end":{"line":153,"column":22}},"67":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"68":{"start":{"line":151,"column":24},"end":{"line":151,"column":33}},"69":{"start":{"line":156,"column":16},"end":{"line":156,"column":56}},"70":{"start":{"line":160,"column":16},"end":{"line":160,"column":26}},"71":{"start":{"line":162,"column":16},"end":{"line":174,"column":18}},"72":{"start":{"line":163,"column":32},"end":{"line":163,"column":44}},"73":{"start":{"line":164,"column":33},"end":{"line":164,"column":70}},"74":{"start":{"line":165,"column":18},"end":{"line":165,"column":32}},"75":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"76":{"start":{"line":168,"column":20},"end":{"line":168,"column":40}},"77":{"start":{"line":170,"column":18},"end":{"line":170,"column":38}},"78":{"start":{"line":171,"column":18},"end":{"line":173,"column":20}},"79":{"start":{"line":172,"column":20},"end":{"line":172,"column":54}},"80":{"start":{"line":175,"column":16},"end":{"line":175,"column":36}},"81":{"start":{"line":179,"column":16},"end":{"line":183,"column":17}},"82":{"start":{"line":180,"column":18},"end":{"line":180,"column":47}},"83":{"start":{"line":182,"column":18},"end":{"line":182,"column":34}},"84":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"85":{"start":{"line":186,"column":18},"end":{"line":194,"column":20}},"86":{"start":{"line":187,"column":20},"end":{"line":189,"column":22}},"87":{"start":{"line":188,"column":22},"end":{"line":188,"column":37}},"88":{"start":{"line":193,"column":20},"end":{"line":193,"column":31}},"89":{"start":{"line":196,"column":18},"end":{"line":202,"column":20}},"90":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"91":{"start":{"line":198,"column":22},"end":{"line":198,"column":33}},"92":{"start":{"line":200,"column":22},"end":{"line":200,"column":37}},"93":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"94":{"start":{"line":207,"column":16},"end":{"line":207,"column":39}},"95":{"start":{"line":209,"column":14},"end":{"line":209,"column":32}},"96":{"start":{"line":212,"column":12},"end":{"line":260,"column":14}},"97":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"98":{"start":{"line":214,"column":16},"end":{"line":214,"column":39}},"99":{"start":{"line":218,"column":16},"end":{"line":218,"column":69}},"100":{"start":{"line":222,"column":16},"end":{"line":234,"column":17}},"101":{"start":{"line":223,"column":44},"end":{"line":223,"column":76}},"102":{"start":{"line":233,"column":18},"end":{"line":233,"column":34}},"103":{"start":{"line":239,"column":18},"end":{"line":239,"column":63}},"104":{"start":{"line":243,"column":18},"end":{"line":243,"column":44}},"105":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"106":{"start":{"line":247,"column":18},"end":{"line":247,"column":41}},"107":{"start":{"line":249,"column":16},"end":{"line":249,"column":34}},"108":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"109":{"start":{"line":253,"column":16},"end":{"line":253,"column":35}},"110":{"start":{"line":255,"column":16},"end":{"line":255,"column":32}},"111":{"start":{"line":258,"column":16},"end":{"line":258,"column":35}},"112":{"start":{"line":262,"column":10},"end":{"line":264,"column":12}},"113":{"start":{"line":263,"column":12},"end":{"line":263,"column":41}},"114":{"start":{"line":265,"column":10},"end":{"line":265,"column":39}},"115":{"start":{"line":267,"column":8},"end":{"line":267,"column":22}},"116":{"start":{"line":271,"column":4},"end":{"line":271,"column":89}},"117":{"start":{"line":275,"column":4},"end":{"line":284,"column":6}},"118":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"119":{"start":{"line":277,"column":8},"end":{"line":277,"column":95}},"120":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"121":{"start":{"line":280,"column":8},"end":{"line":282,"column":24}},"122":{"start":{"line":288,"column":4},"end":{"line":288,"column":95}},"123":{"start":{"line":291,"column":16},"end":{"line":291,"column":44}},"124":{"start":{"line":293,"column":2},"end":{"line":303,"column":3}},"125":{"start":{"line":295,"column":6},"end":{"line":299,"column":8}},"126":{"start":{"line":296,"column":8},"end":{"line":296,"column":33}},"127":{"start":{"line":298,"column":8},"end":{"line":298,"column":17}}},"fnMap":{"0":{"name":"serialize","decl":{"start":{"line":15,"column":9},"end":{"line":15,"column":18}},"loc":{"start":{"line":15,"column":25},"end":{"line":31,"column":1}},"line":15},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":29},"end":{"line":17,"column":30}},"loc":{"start":{"line":17,"column":52},"end":{"line":30,"column":3}},"line":17},"2":{"name":"deserialize","decl":{"start":{"line":33,"column":9},"end":{"line":33,"column":20}},"loc":{"start":{"line":33,"column":31},"end":{"line":35,"column":1}},"line":33},"3":{"name":"getCacheFilePath","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":25}},"loc":{"start":{"line":37,"column":42},"end":{"line":51,"column":1}},"line":37},"4":{"name":"buildMemoizer","decl":{"start":{"line":53,"column":9},"end":{"line":53,"column":22}},"loc":{"start":{"line":53,"column":33},"end":{"line":304,"column":1}},"line":53},"5":{"name":"initCache","decl":{"start":{"line":66,"column":11},"end":{"line":66,"column":20}},"loc":{"start":{"line":66,"column":33},"end":{"line":83,"column":3}},"line":66},"6":{"name":"(anonymous_6)","decl":{"start":{"line":67,"column":23},"end":{"line":67,"column":24}},"loc":{"start":{"line":67,"column":50},"end":{"line":82,"column":5}},"line":67},"7":{"name":"(anonymous_7)","decl":{"start":{"line":69,"column":14},"end":{"line":69,"column":15}},"loc":{"start":{"line":69,"column":20},"end":{"line":71,"column":9}},"line":69},"8":{"name":"(anonymous_8)","decl":{"start":{"line":72,"column":15},"end":{"line":72,"column":16}},"loc":{"start":{"line":72,"column":24},"end":{"line":81,"column":9}},"line":72},"9":{"name":"memoizeFn","decl":{"start":{"line":85,"column":11},"end":{"line":85,"column":20}},"loc":{"start":{"line":85,"column":31},"end":{"line":272,"column":3}},"line":85},"10":{"name":"checkOptions","decl":{"start":{"line":86,"column":13},"end":{"line":86,"column":25}},"loc":{"start":{"line":86,"column":35},"end":{"line":96,"column":5}},"line":86},"11":{"name":"resolveWithMemFn","decl":{"start":{"line":118,"column":13},"end":{"line":118,"column":29}},"loc":{"start":{"line":118,"column":33},"end":{"line":269,"column":5}},"line":118},"12":{"name":"(anonymous_12)","decl":{"start":{"line":119,"column":25},"end":{"line":119,"column":26}},"loc":{"start":{"line":119,"column":44},"end":{"line":268,"column":7}},"line":119},"13":{"name":"(anonymous_13)","decl":{"start":{"line":120,"column":22},"end":{"line":120,"column":23}},"loc":{"start":{"line":120,"column":34},"end":{"line":266,"column":9}},"line":120},"14":{"name":"(anonymous_14)","decl":{"start":{"line":134,"column":47},"end":{"line":134,"column":48}},"loc":{"start":{"line":134,"column":74},"end":{"line":261,"column":11}},"line":134},"15":{"name":"cacheAndReturn","decl":{"start":{"line":135,"column":21},"end":{"line":135,"column":35}},"loc":{"start":{"line":135,"column":39},"end":{"line":210,"column":13}},"line":135},"16":{"name":"writeResult","decl":{"start":{"line":138,"column":23},"end":{"line":138,"column":34}},"loc":{"start":{"line":138,"column":43},"end":{"line":157,"column":15}},"line":138},"17":{"name":"(anonymous_17)","decl":{"start":{"line":148,"column":29},"end":{"line":148,"column":30}},"loc":{"start":{"line":148,"column":41},"end":{"line":154,"column":19}},"line":148},"18":{"name":"(anonymous_18)","decl":{"start":{"line":149,"column":40},"end":{"line":149,"column":41}},"loc":{"start":{"line":149,"column":55},"end":{"line":153,"column":21}},"line":149},"19":{"name":"processFnAsync","decl":{"start":{"line":159,"column":23},"end":{"line":159,"column":37}},"loc":{"start":{"line":159,"column":41},"end":{"line":176,"column":15}},"line":159},"20":{"name":"(anonymous_20)","decl":{"start":{"line":162,"column":26},"end":{"line":162,"column":27}},"loc":{"start":{"line":162,"column":58},"end":{"line":174,"column":17}},"line":162},"21":{"name":"(anonymous_21)","decl":{"start":{"line":171,"column":38},"end":{"line":171,"column":39}},"loc":{"start":{"line":171,"column":50},"end":{"line":173,"column":19}},"line":171},"22":{"name":"processFn","decl":{"start":{"line":178,"column":23},"end":{"line":178,"column":32}},"loc":{"start":{"line":178,"column":36},"end":{"line":204,"column":15}},"line":178},"23":{"name":"(anonymous_23)","decl":{"start":{"line":186,"column":37},"end":{"line":186,"column":38}},"loc":{"start":{"line":186,"column":55},"end":{"line":190,"column":19}},"line":186},"24":{"name":"(anonymous_24)","decl":{"start":{"line":187,"column":40},"end":{"line":187,"column":41}},"loc":{"start":{"line":187,"column":52},"end":{"line":189,"column":21}},"line":187},"25":{"name":"(anonymous_25)","decl":{"start":{"line":191,"column":18},"end":{"line":191,"column":19}},"loc":{"start":{"line":191,"column":33},"end":{"line":194,"column":19}},"line":191},"26":{"name":"(anonymous_26)","decl":{"start":{"line":196,"column":38},"end":{"line":196,"column":39}},"loc":{"start":{"line":196,"column":53},"end":{"line":202,"column":19}},"line":196},"27":{"name":"(anonymous_27)","decl":{"start":{"line":212,"column":56},"end":{"line":212,"column":57}},"loc":{"start":{"line":212,"column":77},"end":{"line":260,"column":13}},"line":212},"28":{"name":"hasOwn","decl":{"start":{"line":217,"column":23},"end":{"line":217,"column":29}},"loc":{"start":{"line":217,"column":41},"end":{"line":219,"column":15}},"line":217},"29":{"name":"parseResult","decl":{"start":{"line":221,"column":23},"end":{"line":221,"column":34}},"loc":{"start":{"line":221,"column":50},"end":{"line":235,"column":15}},"line":221},"30":{"name":"retrieveAndReturn","decl":{"start":{"line":237,"column":23},"end":{"line":237,"column":40}},"loc":{"start":{"line":237,"column":44},"end":{"line":250,"column":15}},"line":237},"31":{"name":"processFnAsync","decl":{"start":{"line":238,"column":25},"end":{"line":238,"column":39}},"loc":{"start":{"line":238,"column":43},"end":{"line":240,"column":17}},"line":238},"32":{"name":"processFn","decl":{"start":{"line":242,"column":25},"end":{"line":242,"column":34}},"loc":{"start":{"line":242,"column":38},"end":{"line":244,"column":17}},"line":242},"33":{"name":"(anonymous_33)","decl":{"start":{"line":262,"column":38},"end":{"line":262,"column":39}},"loc":{"start":{"line":262,"column":56},"end":{"line":264,"column":11}},"line":262},"34":{"name":"invalidateCache","decl":{"start":{"line":274,"column":11},"end":{"line":274,"column":26}},"loc":{"start":{"line":274,"column":37},"end":{"line":285,"column":3}},"line":274},"35":{"name":"(anonymous_35)","decl":{"start":{"line":275,"column":23},"end":{"line":275,"column":24}},"loc":{"start":{"line":275,"column":50},"end":{"line":284,"column":5}},"line":275},"36":{"name":"getCacheFilePathBound","decl":{"start":{"line":287,"column":11},"end":{"line":287,"column":32}},"loc":{"start":{"line":287,"column":49},"end":{"line":289,"column":3}},"line":287},"37":{"name":"(anonymous_37)","decl":{"start":{"line":294,"column":8},"end":{"line":294,"column":9}},"loc":{"start":{"line":294,"column":27},"end":{"line":300,"column":5}},"line":294},"38":{"name":"(anonymous_38)","decl":{"start":{"line":295,"column":24},"end":{"line":295,"column":25}},"loc":{"start":{"line":295,"column":36},"end":{"line":297,"column":7}},"line":295},"39":{"name":"(anonymous_39)","decl":{"start":{"line":297,"column":9},"end":{"line":297,"column":10}},"loc":{"start":{"line":297,"column":24},"end":{"line":299,"column":7}},"line":297}},"branchMap":{"0":{"loc":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},{"start":{"line":18,"column":4},"end":{"line":20,"column":5}}],"line":18},"1":{"loc":{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":28,"column":5}},{"start":{"line":21,"column":4},"end":{"line":28,"column":5}}],"line":21},"2":{"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":51}},"type":"binary-expr","locations":[{"start":{"line":21,"column":8},"end":{"line":21,"column":33}},{"start":{"line":21,"column":37},"end":{"line":21,"column":51}}],"line":21},"3":{"loc":{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},"type":"if","locations":[{"start":{"line":22,"column":6},"end":{"line":25,"column":7}},{"start":{"line":22,"column":6},"end":{"line":25,"column":7}}],"line":22},"4":{"loc":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"type":"binary-expr","locations":[{"start":{"line":38,"column":15},"end":{"line":38,"column":23}},{"start":{"line":38,"column":27},"end":{"line":38,"column":29}}],"line":38},"5":{"loc":{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":46,"column":3}},{"start":{"line":40,"column":2},"end":{"line":46,"column":3}}],"line":40},"6":{"loc":{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":44,"column":5}},{"start":{"line":42,"column":4},"end":{"line":44,"column":5}}],"line":42},"7":{"loc":{"start":{"line":45,"column":12},"end":{"line":45,"column":55}},"type":"cond-expr","locations":[{"start":{"line":45,"column":26},"end":{"line":45,"column":47}},{"start":{"line":45,"column":50},"end":{"line":45,"column":55}}],"line":45},"8":{"loc":{"start":{"line":48,"column":19},"end":{"line":48,"column":45}},"type":"binary-expr","locations":[{"start":{"line":48,"column":19},"end":{"line":48,"column":32}},{"start":{"line":48,"column":36},"end":{"line":48,"column":45}}],"line":48},"9":{"loc":{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},"type":"if","locations":[{"start":{"line":57,"column":2},"end":{"line":59,"column":3}},{"start":{"line":57,"column":2},"end":{"line":59,"column":3}}],"line":57},"10":{"loc":{"start":{"line":57,"column":6},"end":{"line":57,"column":58}},"type":"binary-expr","locations":[{"start":{"line":57,"column":6},"end":{"line":57,"column":14}},{"start":{"line":57,"column":19},"end":{"line":57,"column":26}},{"start":{"line":57,"column":30},"end":{"line":57,"column":57}}],"line":57},"11":{"loc":{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},"type":"if","locations":[{"start":{"line":60,"column":2},"end":{"line":62,"column":3}},{"start":{"line":60,"column":2},"end":{"line":62,"column":3}}],"line":60},"12":{"loc":{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},"type":"if","locations":[{"start":{"line":87,"column":6},"end":{"line":89,"column":7}},{"start":{"line":87,"column":6},"end":{"line":89,"column":7}}],"line":87},"13":{"loc":{"start":{"line":87,"column":10},"end":{"line":87,"column":56}},"type":"binary-expr","locations":[{"start":{"line":87,"column":10},"end":{"line":87,"column":21}},{"start":{"line":87,"column":25},"end":{"line":87,"column":56}}],"line":87},"14":{"loc":{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},"type":"if","locations":[{"start":{"line":90,"column":6},"end":{"line":92,"column":7}},{"start":{"line":90,"column":6},"end":{"line":92,"column":7}}],"line":90},"15":{"loc":{"start":{"line":90,"column":10},"end":{"line":90,"column":62}},"type":"binary-expr","locations":[{"start":{"line":90,"column":10},"end":{"line":90,"column":24}},{"start":{"line":90,"column":28},"end":{"line":90,"column":62}}],"line":90},"16":{"loc":{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},"type":"if","locations":[{"start":{"line":93,"column":6},"end":{"line":95,"column":7}},{"start":{"line":93,"column":6},"end":{"line":95,"column":7}}],"line":93},"17":{"loc":{"start":{"line":93,"column":10},"end":{"line":93,"column":60}},"type":"binary-expr","locations":[{"start":{"line":93,"column":10},"end":{"line":93,"column":23}},{"start":{"line":93,"column":27},"end":{"line":93,"column":60}}],"line":93},"18":{"loc":{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},"type":"if","locations":[{"start":{"line":98,"column":4},"end":{"line":100,"column":5}},{"start":{"line":98,"column":4},"end":{"line":100,"column":5}}],"line":98},"19":{"loc":{"start":{"line":98,"column":8},"end":{"line":98,"column":38}},"type":"binary-expr","locations":[{"start":{"line":98,"column":8},"end":{"line":98,"column":11}},{"start":{"line":98,"column":15},"end":{"line":98,"column":38}}],"line":98},"20":{"loc":{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":104,"column":5}},{"start":{"line":102,"column":4},"end":{"line":104,"column":5}}],"line":102},"21":{"loc":{"start":{"line":109,"column":21},"end":{"line":109,"column":43}},"type":"binary-expr","locations":[{"start":{"line":109,"column":21},"end":{"line":109,"column":35}},{"start":{"line":109,"column":39},"end":{"line":109,"column":43}}],"line":109},"22":{"loc":{"start":{"line":122,"column":24},"end":{"line":122,"column":71}},"type":"cond-expr","locations":[{"start":{"line":122,"column":38},"end":{"line":122,"column":59}},{"start":{"line":122,"column":62},"end":{"line":122,"column":71}}],"line":122},"23":{"loc":{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},"type":"if","locations":[{"start":{"line":124,"column":10},"end":{"line":126,"column":11}},{"start":{"line":124,"column":10},"end":{"line":126,"column":11}}],"line":124},"24":{"loc":{"start":{"line":124,"column":14},"end":{"line":124,"column":61}},"type":"binary-expr","locations":[{"start":{"line":124,"column":14},"end":{"line":124,"column":41}},{"start":{"line":124,"column":45},"end":{"line":124,"column":61}}],"line":124},"25":{"loc":{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},"type":"if","locations":[{"start":{"line":130,"column":10},"end":{"line":132,"column":11}},{"start":{"line":130,"column":10},"end":{"line":132,"column":11}}],"line":130},"26":{"loc":{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},"type":"if","locations":[{"start":{"line":141,"column":16},"end":{"line":146,"column":17}},{"start":{"line":141,"column":16},"end":{"line":146,"column":17}}],"line":141},"27":{"loc":{"start":{"line":141,"column":20},"end":{"line":141,"column":73}},"type":"binary-expr","locations":[{"start":{"line":141,"column":21},"end":{"line":141,"column":22}},{"start":{"line":141,"column":26},"end":{"line":141,"column":47}},{"start":{"line":141,"column":52},"end":{"line":141,"column":73}}],"line":141},"28":{"loc":{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},"type":"if","locations":[{"start":{"line":147,"column":16},"end":{"line":155,"column":17}},{"start":{"line":147,"column":16},"end":{"line":155,"column":17}}],"line":147},"29":{"loc":{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},"type":"if","locations":[{"start":{"line":150,"column":22},"end":{"line":152,"column":23}},{"start":{"line":150,"column":22},"end":{"line":152,"column":23}}],"line":150},"30":{"loc":{"start":{"line":150,"column":26},"end":{"line":150,"column":54}},"type":"binary-expr","locations":[{"start":{"line":150,"column":26},"end":{"line":150,"column":29}},{"start":{"line":150,"column":33},"end":{"line":150,"column":54}}],"line":150},"31":{"loc":{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},"type":"if","locations":[{"start":{"line":166,"column":18},"end":{"line":169,"column":19}},{"start":{"line":166,"column":18},"end":{"line":169,"column":19}}],"line":166},"32":{"loc":{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},"type":"if","locations":[{"start":{"line":184,"column":16},"end":{"line":203,"column":17}},{"start":{"line":184,"column":16},"end":{"line":203,"column":17}}],"line":184},"33":{"loc":{"start":{"line":184,"column":20},"end":{"line":184,"column":63}},"type":"binary-expr","locations":[{"start":{"line":184,"column":20},"end":{"line":184,"column":26}},{"start":{"line":184,"column":30},"end":{"line":184,"column":63}}],"line":184},"34":{"loc":{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},"type":"if","locations":[{"start":{"line":197,"column":20},"end":{"line":201,"column":21}},{"start":{"line":197,"column":20},"end":{"line":201,"column":21}}],"line":197},"35":{"loc":{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},"type":"if","locations":[{"start":{"line":206,"column":14},"end":{"line":208,"column":15}},{"start":{"line":206,"column":14},"end":{"line":208,"column":15}}],"line":206},"36":{"loc":{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},"type":"if","locations":[{"start":{"line":213,"column":14},"end":{"line":215,"column":15}},{"start":{"line":213,"column":14},"end":{"line":215,"column":15}}],"line":213},"37":{"loc":{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},"type":"if","locations":[{"start":{"line":246,"column":16},"end":{"line":248,"column":17}},{"start":{"line":246,"column":16},"end":{"line":248,"column":17}}],"line":246},"38":{"loc":{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},"type":"if","locations":[{"start":{"line":252,"column":14},"end":{"line":259,"column":15}},{"start":{"line":252,"column":14},"end":{"line":259,"column":15}}],"line":252},"39":{"loc":{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},"type":"if","locations":[{"start":{"line":276,"column":6},"end":{"line":283,"column":7}},{"start":{"line":276,"column":6},"end":{"line":283,"column":7}}],"line":276},"40":{"loc":{"start":{"line":276,"column":10},"end":{"line":276,"column":48}},"type":"binary-expr","locations":[{"start":{"line":276,"column":10},"end":{"line":276,"column":17}},{"start":{"line":276,"column":21},"end":{"line":276,"column":48}}],"line":276},"41":{"loc":{"start":{"line":279,"column":25},"end":{"line":279,"column":92}},"type":"cond-expr","locations":[{"start":{"line":279,"column":35},"end":{"line":279,"column":72}},{"start":{"line":279,"column":75},"end":{"line":279,"column":92}}],"line":279}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":76,"8":76,"9":225,"10":11,"11":214,"12":92,"13":3,"14":89,"15":211,"16":20,"17":70,"18":70,"19":70,"20":68,"21":68,"22":2,"23":68,"24":70,"25":70,"26":70,"27":54,"28":54,"29":3,"30":51,"31":2,"32":49,"33":99,"34":99,"35":96,"36":3,"37":53,"38":1,"39":52,"40":1,"41":51,"42":1,"43":56,"44":1,"45":55,"46":2,"47":53,"48":53,"49":50,"50":49,"51":49,"52":67,"53":67,"54":67,"55":7,"56":67,"57":67,"58":1,"59":66,"60":42,"61":11,"62":11,"63":31,"64":42,"65":3,"66":3,"67":3,"68":1,"69":42,"70":4,"71":4,"72":4,"73":4,"74":4,"75":4,"76":1,"77":3,"78":3,"79":3,"80":4,"81":42,"82":42,"83":2,"84":40,"85":4,"86":3,"87":3,"88":1,"89":36,"90":36,"91":1,"92":35,"93":46,"94":4,"95":42,"96":66,"97":66,"98":45,"99":17,"100":20,"101":20,"102":3,"103":3,"104":17,"105":20,"106":3,"107":17,"108":21,"109":1,"110":1,"111":20,"112":66,"113":61,"114":66,"115":49,"116":50,"117":5,"118":5,"119":1,"120":4,"121":4,"122":68,"123":49,"124":49,"125":57,"126":56,"127":1},"f":{"0":76,"1":225,"2":20,"3":70,"4":54,"5":99,"6":99,"7":96,"8":3,"9":56,"10":53,"11":49,"12":49,"13":67,"14":66,"15":46,"16":42,"17":3,"18":3,"19":4,"20":4,"21":3,"22":42,"23":3,"24":3,"25":1,"26":36,"27":66,"28":17,"29":20,"30":20,"31":3,"32":17,"33":61,"34":5,"35":5,"36":68,"37":57,"38":56,"39":1},"b":{"0":[11,214],"1":[92,122],"2":[214,100],"3":[3,89],"4":[70,68],"5":[68,2],"6":[2,66],"7":[2,66],"8":[70,2],"9":[3,51],"10":[54,53,53],"11":[2,49],"12":[1,52],"13":[53,2],"14":[1,51],"15":[52,46],"16":[1,50],"17":[51,4],"18":[1,55],"19":[56,48],"20":[2,53],"21":[50,5],"22":[56,11],"23":[7,60],"24":[67,9],"25":[1,66],"26":[11,31],"27":[42,37,34],"28":[3,39],"29":[1,2],"30":[3,2],"31":[1,3],"32":[4,36],"33":[40,35],"34":[1,35],"35":[4,42],"36":[45,21],"37":[3,17],"38":[1,20],"39":[1,4],"40":[5,4],"41":[3,1]},"_coverageSchema":"43e27e138ebf9cfc5966b082cf9a028302ed4184","hash":"64efb997a6eaf10de90dba97a3a3521133ecce7c","contentHash":"45a10e5130dd8fc525b3e00187ef3d4dfeba4f98865d8d122012996b5878540e"}} \ No newline at end of file diff --git a/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json b/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json deleted file mode 100644 index 653ba68..0000000 --- a/.nyc_output/processinfo/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json +++ /dev/null @@ -1 +0,0 @@ -{"uuid":"a81e9bdf-8e36-4183-8fce-d82b127e3ec1","parent":null,"pid":1029686,"argv":["/home/charlike/.nvm/versions/node/v12.14.0/bin/node","/home/charlike/github/memoize-fs/node_modules/.bin/mocha"],"execArgv":[],"cwd":"/home/charlike/github/memoize-fs","time":1582652388005,"ppid":1029660,"root":"9b3e3c32-7cd5-454a-8de5-705867b307c4","coverageFilename":"/home/charlike/github/memoize-fs/.nyc_output/a81e9bdf-8e36-4183-8fce-d82b127e3ec1.json","files":["/home/charlike/github/memoize-fs/index.js"]} \ No newline at end of file diff --git a/.nyc_output/processinfo/index.json b/.nyc_output/processinfo/index.json deleted file mode 100644 index a6cd3a7..0000000 --- a/.nyc_output/processinfo/index.json +++ /dev/null @@ -1 +0,0 @@ -{"processes":{"a81e9bdf-8e36-4183-8fce-d82b127e3ec1":{"parent":null,"children":[]}},"files":{"/home/charlike/github/memoize-fs/index.js":["a81e9bdf-8e36-4183-8fce-d82b127e3ec1"]},"externalIds":{}} \ No newline at end of file From d73ef246e41a9e9e508490519c238767201eeee0 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Tue, 25 Feb 2020 19:47:09 +0200 Subject: [PATCH 06/19] update test Signed-off-by: Charlike Mike Reagent --- index.js | 14 ++------------ test/test.js | 6 +++--- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index 89730d2..74cfe08 100644 --- a/index.js +++ b/index.js @@ -31,7 +31,7 @@ function serialize (val) { } function deserialize (...args) { - return JSON.parse(...args) + return JSON.parse(...args).data } function getCacheFilePath (fn, args, opt) { @@ -214,21 +214,11 @@ function buildMemoizer (options) { return cacheAndReturn() } - function hasOwn (obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key) - } - function parseResult (resultString) { try { const deserializedValue = optExt.deserialize(resultString) - // NOTE not needed to be tested it's simple feature - // allowing users with custom serialize/deserialize - // to not need to return { data: they result}, but instead directly their result - /* istanbul ignore next */ - return hasOwn(deserializedValue, 'data') - ? deserializedValue.data - : deserializedValue + return deserializedValue } catch (e) { return undefined } diff --git a/test/test.js b/test/test.js index eceba42..894f9e9 100644 --- a/test/test.js +++ b/test/test.js @@ -93,7 +93,7 @@ describe('memoize-fs', function () { const memoize = memoizeFs(options) function toBeMemoized (abc) { - return { abc, foo: () => { return 100 + abc } } + return { abc, foo () { return 100 + abc } } } memoize.fn(toBeMemoized) @@ -114,11 +114,11 @@ describe('memoize-fs', function () { const fileWith200 = memoizeFs.getCacheFilePath(toBeMemoized, [200], options) const fileString200 = fs.readFileSync(fileWith200, 'utf8') - assert.ok(fileString200.includes('"abc":200,"foo":"_$$ND_FUNC$$')) + assert.ok(fileString200.includes('"abc":200,"foo":function() {')) const fileWith400 = memoizeFs.getCacheFilePath(toBeMemoized, [400], options) const fileString400 = fs.readFileSync(fileWith400, 'utf8') - assert.ok(fileString400.includes('"abc":400,"foo":"_$$ND_FUNC$$')) + assert.ok(fileString400.includes('"abc":400,"foo":function() {')) fs.removeSync(cachePath) done() From 9a295da87d90f2f738d91c41ea49408f5eaa8710 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Tue, 25 Feb 2020 19:49:43 +0200 Subject: [PATCH 07/19] misc update scripts Signed-off-by: Charlike Mike Reagent --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6e498fe..29fc3c5 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,10 @@ "description": "Node.js solution for memoizing/caching a function and its return state into the file system", "author": "Boris Diakur (https://github.com/borisdiakur)", "scripts": { - "test": "npm run eslint && mocha test", - "eslint": "eslint .", - "mocha": "mocha --reporter nyan test", + "lint": "eslint .", + "pretest": "npm run lint", + "test": "mocha --reporter nyan test", + "cov": "nyc mocha", "istanbul": "rm -rf coverage && ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report html && open coverage/memoize-fs/index.js.html", "coveralls": "rm -rf coverage && ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" }, From 05887b30be9b1de024251f0ca86c96aa9355ff1a Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 00:59:38 +0200 Subject: [PATCH 08/19] update scripts, switch to nyc Signed-off-by: Charlike Mike Reagent --- README.md | 6 +- package-lock.json | 1642 ++++++++++++++++++++++++++++++++++++--------- package.json | 29 +- 3 files changed, 1338 insertions(+), 339 deletions(-) diff --git a/README.md b/README.md index 272ab56..7332030 100755 --- a/README.md +++ b/README.md @@ -222,11 +222,13 @@ Issues and Pull-requests are absolutely welcome. If you want to submit a patch, many people contributed. — [idiomatic.js](https://github.com/rwldrn/idiomatic.js/) Lint with: + ```shell -npm run jshint +npm run lint ``` Test with: + ```shell npm run mocha ``` @@ -234,7 +236,7 @@ npm run mocha Check code coverage with: ```shell -npm run istanbul +npm run coverage ``` Then please commit with a __detailed__ commit message. diff --git a/package-lock.json b/package-lock.json index da9ca83..cbab5f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,103 @@ "@babel/highlight": "^7.8.3" } }, + "@babel/core": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.6.tgz", + "integrity": "sha512-Sheg7yEJD51YHAvLEV/7Uvw95AeWqYPL3Vk3zGujJKIhJ+8oLw2ALaf3hbucILhKsgSoADOvtKRJuNVdcJkOrg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.6", + "@babel/helpers": "^7.8.4", + "@babel/parser": "^7.8.6", + "@babel/template": "^7.8.6", + "@babel/traverse": "^7.8.6", + "@babel/types": "^7.8.6", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.0", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.6.tgz", + "integrity": "sha512-4bpOR5ZBz+wWcMeVtcf7FbjcFzCp+817z2/gHNncIRcM9MmKzUhtWCYAq27RAfUrAFwb+OCG1s9WEaVxfi6cjg==", + "dev": true, + "requires": { + "@babel/types": "^7.8.6", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helpers": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.8.4.tgz", + "integrity": "sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w==", + "dev": true, + "requires": { + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.4", + "@babel/types": "^7.8.3" + } + }, "@babel/highlight": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", @@ -24,10 +121,138 @@ "js-tokens": "^4.0.0" } }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "@babel/parser": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.6.tgz", + "integrity": "sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g==", + "dev": true + }, + "@babel/template": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", + "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6" + } + }, + "@babel/traverse": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.6.tgz", + "integrity": "sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.6", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.6.tgz", + "integrity": "sha512-wqz7pgWMIrht3gquyEFPVXeXCti72Rm8ep9b5tQKz9Yg9LzJA3HxosF1SB3Kc81KD1A3XBkkVYtJvCKS2Z/QrA==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@istanbuljs/load-nyc-config": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz", + "integrity": "sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, "acorn": { @@ -37,15 +262,25 @@ "dev": true }, "acorn-jsx": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", - "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz", + "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", "dev": true }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, "ajv": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", - "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -54,13 +289,6 @@ "uri-js": "^4.2.2" } }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "optional": true - }, "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -101,15 +329,36 @@ "picomatch": "^2.0.4" } }, + "append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "requires": { + "default-require-extensions": "^3.0.0" + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, "array-includes": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", @@ -131,6 +380,12 @@ "es-abstract": "^1.17.0-next.1" } }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -152,12 +407,6 @@ "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -198,9 +447,9 @@ "dev": true }, "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "^1.0.0", @@ -222,6 +471,18 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "requires": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -234,6 +495,25 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -273,6 +553,12 @@ "readdirp": "~3.2.0" } }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -348,12 +634,11 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true, - "optional": true + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true }, "concat-map": { "version": "0.0.1", @@ -367,6 +652,23 @@ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": true }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -384,14 +686,6 @@ "log-driver": "^1.2.7", "minimist": "^1.2.0", "request": "^2.88.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } } }, "cross-spawn": { @@ -415,6 +709,15 @@ } } }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -439,12 +742,47 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "requires": { + "strip-bom": "^4.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + } + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -530,33 +868,18 @@ "is-symbol": "^1.0.2" } }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - }, - "dependencies": { - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - } - } - }, "eslint": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", @@ -600,31 +923,6 @@ "table": "^5.2.3", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - } } }, "eslint-config-standard": { @@ -841,15 +1139,15 @@ } }, "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "esquery": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz", + "integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==", "dev": true, "requires": { "estraverse": "^4.0.0" @@ -871,9 +1169,9 @@ "dev": true }, "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, "extend": { @@ -918,9 +1216,9 @@ "dev": true }, "figures": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", - "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -935,6 +1233,12 @@ "flat-cache": "^2.0.1" } }, + "file-type": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz", + "integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -944,6 +1248,77 @@ "to-regex-range": "^5.0.1" } }, + "find-cache-dir": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.0.tgz", + "integrity": "sha512-PtXtQb7IrD8O+h6Cq1dbpJH5NzD8+9keN1zZ0YlpDzl1PwXEJEBj6u1Xa92t1Hwluoozd9TNKul5Hi2iqpsWwg==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + } + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -971,17 +1346,6 @@ "flatted": "^2.0.0", "rimraf": "2.6.3", "write": "1.0.3" - }, - "dependencies": { - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } } }, "flatted": { @@ -990,6 +1354,59 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1007,6 +1424,12 @@ "mime-types": "^2.1.12" } }, + "fromentries": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.2.0.tgz", + "integrity": "sha512-33X7H/wdfO99GdRLLgkjUrD4geAFdq/Uv0kl3HD4da6HDixd2GUg8Mw7dahLCV9r/EARkmtYBB6Tch4EEokFTQ==", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -1042,12 +1465,24 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "get-stdin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", + "dev": true + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -1100,26 +1535,6 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "handlebars": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.3.tgz", - "integrity": "sha512-SRGwSYuNfx8DwHD/6InAPzD6RgeruWLT+B8e8a7gGs8FWgHzlExpTFMEq2IA6QpAfOClpKHy6+8IqTjeBCu6Kg==", - "dev": true, - "requires": { - "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -1146,9 +1561,9 @@ } }, "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, "has-symbols": { @@ -1157,6 +1572,16 @@ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, + "hasha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz", + "integrity": "sha512-2W+jKdQbAdSIrggA8Q35Br8qKadTrqCTC8+XZvBWepKDK6m9XkX6Iz1a2yh2KP01kzAR/dpuMeUnocoLYDcskw==", + "dev": true, + "requires": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -1164,9 +1589,15 @@ "dev": true }, "hosted-git-info": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", - "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.7.tgz", + "integrity": "sha512-ChkjQtKJ3GI6SsI4O5jwr8q8EPrWCnxuc4Tbx+vRI5x6mDOpjKKltNo1lRlszw3xwgTOSns1ZRBiMmmwpcvLxg==", + "dev": true + }, + "html-escaper": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.0.tgz", + "integrity": "sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==", "dev": true }, "http-signature": { @@ -1211,6 +1642,12 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1222,9 +1659,9 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "inquirer": { @@ -1308,6 +1745,12 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -1323,6 +1766,12 @@ "has": "^1.0.3" } }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, "is-string": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", @@ -1344,6 +1793,18 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -1362,58 +1823,160 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" + "istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "requires": { + "append-transform": "^2.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz", + "integrity": "sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg==", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@babel/parser": "^7.7.5", + "@babel/template": "^7.7.4", + "@babel/traverse": "^7.7.4", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" }, "dependencies": { - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "cross-spawn": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz", + "integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==", "dev": true, "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^1.0.0" + "has-flag": "^4.0.0" } } } }, + "istanbul-lib-source-maps": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", + "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.0.tgz", + "integrity": "sha512-2osTcC8zcOSUkImzN2EWQta3Vdi4WjjKw99P2yWx5mLnigAM0Rd5uYFn1cf2i/Ois45GkNjaoTqc5CxgMSX80A==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1428,14 +1991,6 @@ "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - } } }, "jsbn": { @@ -1444,6 +1999,18 @@ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -1468,6 +2035,15 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "json5": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.1.tgz", + "integrity": "sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -1532,6 +2108,12 @@ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, "log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", @@ -1539,12 +2121,129 @@ "dev": true }, "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "make-dir": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", + "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", "dev": true, "requires": { - "chalk": "^2.0.1" + "semver": "^6.0.0" + } + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "meow": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-5.0.0.tgz", + "integrity": "sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0", + "yargs-parser": "^10.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } } }, "meriyah": { @@ -1583,11 +2282,21 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -1595,12 +2304,20 @@ "dev": true, "requires": { "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } } }, "mocha": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.0.1.tgz", - "integrity": "sha512-9eWmWTdHLXh72rGrdZjNbG3aa1/3NRPpul1z0D979QpEnFdCG0Q5tv834N+94QEN2cysfV72YocQ3fn87s70fg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.0.tgz", + "integrity": "sha512-MymHK8UkU0K15Q/zX7uflZgVoRWiTjy0fXE/QjKts6mowUvGxOdPhZ2qj3b0iZdUrNZlW9LAIMFHB4IW+2b3EQ==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -1614,7 +2331,7 @@ "growl": "1.10.5", "he": "1.2.0", "js-yaml": "3.13.1", - "log-symbols": "2.2.0", + "log-symbols": "3.0.0", "minimatch": "3.0.4", "mkdirp": "0.5.1", "ms": "2.1.1", @@ -1661,12 +2378,6 @@ "path-is-absolute": "^1.0.0" } }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -1677,15 +2388,6 @@ "path-exists": "^3.0.0" } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -1730,24 +2432,9 @@ "requires": { "has-flag": "^3.0.0" } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } } } }, - "mocha-lcov-reporter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/mocha-lcov-reporter/-/mocha-lcov-reporter-1.3.0.tgz", - "integrity": "sha1-Rpve9PivyaEWBW8HnfYYLQr7A4Q=", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -1766,12 +2453,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", - "dev": true - }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -1796,13 +2477,13 @@ } } }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", "dev": true, "requires": { - "abbrev": "1" + "process-on-spawn": "^1.0.0" } }, "normalize-package-data": { @@ -1831,6 +2512,193 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "nyc": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.0.0.tgz", + "integrity": "sha512-qcLBlNCKMDVuKb7d1fpxjPR8sHeMVX0CHarXAVzrVWoFrigCkYR8xcrjfXSPi5HXM7EU78L6ywO7w1c5rZNCNg==", + "dev": true, + "requires": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.0", + "js-yaml": "^3.13.1", + "make-dir": "^3.0.0", + "node-preload": "^0.2.0", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "uuid": "^3.3.3", + "yargs": "^15.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz", + "integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^16.1.0" + } + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", @@ -1901,22 +2769,26 @@ "mimic-fn": "^2.1.0" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "open": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/open/-/open-6.4.0.tgz", + "integrity": "sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==", "dev": true, "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } + "is-wsl": "^1.1.0" + } + }, + "open-cli": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/open-cli/-/open-cli-5.0.0.tgz", + "integrity": "sha512-Y2KQDS6NqNtk+PSXzSgwH41vTDMRndwFgVWsfgMhXv7lNe1cImLCe19Vo8oKwMsL7WeNsGmmbX7Ml74Ydj61Cg==", + "dev": true, + "requires": { + "file-type": "^11.0.0", + "get-stdin": "^7.0.0", + "meow": "^5.0.0", + "open": "^6.3.0", + "temp-write": "^4.0.0" } }, "optionator": { @@ -1957,12 +2829,33 @@ "p-limit": "^1.1.0" } }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, "p-try": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, + "package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -2047,6 +2940,15 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "requires": { + "fromentries": "^1.2.0" + } + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -2071,6 +2973,12 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -2101,16 +3009,43 @@ "picomatch": "^2.0.4" } }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + }, + "dependencies": { + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + } + } + }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -2120,7 +3055,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.0", + "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", @@ -2130,7 +3065,7 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", + "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" } @@ -2148,9 +3083,9 @@ "dev": true }, "resolve": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz", - "integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -2172,10 +3107,19 @@ "signal-exit": "^3.0.2" } }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz", + "integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==", "dev": true, "requires": { "is-promise": "^2.1.0" @@ -2260,14 +3204,38 @@ } } }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", "dev": true, - "optional": true, "requires": { - "amdefine": ">=0.0.4" + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } } }, "spdx-correct": { @@ -2390,6 +3358,12 @@ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -2403,14 +3377,6 @@ "dev": true, "requires": { "has-flag": "^3.0.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - } } }, "table": { @@ -2450,6 +3416,36 @@ } } }, + "temp-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", + "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", + "dev": true + }, + "temp-write": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/temp-write/-/temp-write-4.0.0.tgz", + "integrity": "sha512-HIeWmj77uOOHb0QX7siN3OtwV3CTntquin6TNVg6SHOqCP3hYKmox90eeFOGaY1MqJ9WYDDjkyZrW6qS5AWpbw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "is-stream": "^2.0.0", + "make-dir": "^3.0.0", + "temp-dir": "^1.0.0", + "uuid": "^3.3.2" + } + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -2471,6 +3467,12 @@ "os-tmpdir": "~1.0.2" } }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2481,27 +3483,25 @@ } }, "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "dev": true, "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - } + "psl": "^1.1.28", + "punycode": "^2.1.1" } }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, "tslib": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", "dev": true }, "tunnel-agent": { @@ -2534,24 +3534,13 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, - "uglify-js": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.7.tgz", - "integrity": "sha512-FeSU+hi7ULYy6mn8PKio/tXsdSXN35lm4KgV2asx00kzrLU9Pi3oAslcJT70Jdj7PHX29gGUPOT6+lXGBbemhA==", + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "dev": true, - "optional": true, "requires": { - "commander": "~2.20.3", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } + "is-typedarray": "^1.0.0" } }, "universalify": { @@ -2602,9 +3591,9 @@ } }, "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -2664,12 +3653,6 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, "wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", @@ -2719,17 +3702,18 @@ "dev": true, "requires": { "mkdirp": "^0.5.1" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - } + } + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" } }, "y18n": { diff --git a/package.json b/package.json index 29fc3c5..0601a19 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "scripts": { "lint": "eslint .", "pretest": "npm run lint", - "test": "mocha --reporter nyan test", - "cov": "nyc mocha", - "istanbul": "rm -rf coverage && ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report html && open coverage/memoize-fs/index.js.html", - "coveralls": "rm -rf coverage && ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" + "test": "nyc mocha", + "mocha": "mocha -R nyan", + "coverage": "nyc report | coveralls", + "cov": "open-cli coverage/lcov-report/index.html" }, "homepage": "https://github.com/borisdiakur/memoize-fs", "bugs": { @@ -35,9 +35,9 @@ "eslint-plugin-node": "^11.0.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", - "istanbul": "^0.4.5", - "mocha": "^7.0.1", - "mocha-lcov-reporter": "1.3.0", + "mocha": "^7.1.0", + "nyc": "^15.0.0", + "open-cli": "^5.0.0", "serialize-javascript": "^3.0.0" }, "private": false, @@ -58,5 +58,18 @@ "fs" ], "license": "MIT", - "readmeFilename": "README.md" + "nyc": { + "exclude": [ + "test" + ], + "reporter": [ + "text", + "lcov" + ], + "check-coverage": true, + "branches": 80, + "lines": 80, + "functions": 80, + "statements": 80 + } } From e60352c50196d5a2a83238a249d8f86d2dc57b07 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 01:10:40 +0200 Subject: [PATCH 09/19] add throwError option to control if cache dir exists Signed-off-by: Charlike Mike Reagent --- index.js | 17 ++++++++--------- test/test.js | 14 +++++++++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 74cfe08..b801198 100644 --- a/index.js +++ b/index.js @@ -63,20 +63,19 @@ function buildMemoizer (options) { options = { ...serializer, ...options } // check for existing cache folder, if not found, create folder, then resolve - function initCache (cachePath) { + function initCache (cachePath, opts) { return new Promise(function (resolve, reject) { return fs.ensureDir(cachePath, { recursive: true }) .then(() => { resolve() }) .catch((err) => { - // ! NOTE we should handle this case, intentionally; - // ! But it fails one test: should throw an error when trying to memoize - // ! a function with an invalid combination of cache path and cache id - // if (err && err.code === 'EEXIST') { - // resolve() - // return - // } + // ! NOTE we don't care in this case if there is a problem, + // since we just need a cache directory to be created + if (err && err.code === 'EEXIST' && opts.throwError === false) { + resolve() + return + } reject(err) }) }) @@ -258,7 +257,7 @@ function buildMemoizer (options) { }) } - return initCache(path.join(options.cachePath, optExt.cacheId)).then(resolveWithMemFn) + return initCache(path.join(options.cachePath, optExt.cacheId), optExt).then(resolveWithMemFn) } function invalidateCache (cacheId) { diff --git a/test/test.js b/test/test.js index 894f9e9..c84572c 100644 --- a/test/test.js +++ b/test/test.js @@ -712,7 +712,7 @@ describe('memoize-fs', function () { const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function (cb) { setTimeout(function () { - cb(new Error('qux')) + cb(new Error('fake error')) }, 100) }, {cacheId: 'foobar'}).then(function (memFn) { memFn(function (err) { // eslint-disable-line handle-callback-err @@ -1228,6 +1228,18 @@ describe('memoize-fs', function () { }) }) + it('should NOT throw error if cache dir exists and opts.throwError is `false`', (done) => { + const cachePath = path.join(__dirname, '..') + const memoize = memoizeFs({cachePath: cachePath, throwError: false}) + memoize.fn(function () { + }, {cacheId: 'README.md'}).then(function () { + done() + }, function (err) { + assert.ok(!err) + done() + }) + }) + it('should throw an error when trying to write cache on a file without having the necessary permission', function (done) { const cachePath = path.join(__dirname, '../build/cache') const memoize = memoizeFs({cachePath: cachePath}) From cd076be5cbca092757f4efbeb17995e9efcbc09e Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 01:13:45 +0200 Subject: [PATCH 10/19] update test Signed-off-by: Charlike Mike Reagent --- test/test.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index c84572c..eec1e3a 100644 --- a/test/test.js +++ b/test/test.js @@ -1234,9 +1234,8 @@ describe('memoize-fs', function () { memoize.fn(function () { }, {cacheId: 'README.md'}).then(function () { done() - }, function (err) { - assert.ok(!err) - done() + }).catch(function () { + done(new Error('throws unexpected error')) }) }) From 62ca54d34c646c4fccb5415cca016de727e2ff5e Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 01:28:07 +0200 Subject: [PATCH 11/19] ensure opts.serialize and opts.deserialize are functions when passed Signed-off-by: Charlike Mike Reagent --- index.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index b801198..858795d 100644 --- a/index.js +++ b/index.js @@ -45,7 +45,7 @@ function getCacheFilePath (fn, args, opt) { fnStr = opt.astBody ? JSON.stringify(fnStr) : fnStr } - const argsStr = (opt.serialize || serialize)(args) + const argsStr = opt.serialize(args) const hash = crypto.createHash('md5').update(fnStr + argsStr + salt).digest('hex') return path.join(opt.cachePath, opt.cacheId, hash) } @@ -92,6 +92,12 @@ function buildMemoizer (options) { if (optExt.maxAge && typeof optExt.maxAge !== 'number') { throw new TypeError('maxAge option of type number bigger zero expected') } + if (optExt.serialize && typeof optExt.serialize !== 'function') { + throw new TypeError('serialize option of type function expected') + } + if (optExt.deserialize && typeof optExt.deserialize !== 'function') { + throw new TypeError('deserialize option of type function expected') + } } if (opt && typeof opt !== 'object') { @@ -102,17 +108,16 @@ function buildMemoizer (options) { throw new Error('fn of type function expected') } - const optExt = { ...serializer, ...options, ...opt } + const optExt = { cacheId: './', ...serializer, ...options, ...opt } + console.log(optExt) checkOptions(optExt) - optExt.cacheId = optExt.cacheId || './' - // NOTE weird stuf... I don't get why it's not in optExt in some cases... so istanbul ignore - /* istanbul ignore next */ - optExt.serialize = typeof optExt.serialize === 'function' ? optExt.serialize : serialize - /* istanbul ignore next */ - optExt.deserialize = typeof optExt.deserialize === 'function' ? optExt.deserialize : deserialize + // /* istanbul ignore next */ + // optExt.serialize = typeof optExt.serialize === 'function' ? optExt.serialize : serialize + // /* istanbul ignore next */ + // optExt.deserialize = typeof optExt.deserialize === 'function' ? optExt.deserialize : deserialize function resolveWithMemFn () { return new Promise(function (resolve) { From 835c14b7549edfc49c8c882364388a8dbf680a36 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 01:47:11 +0200 Subject: [PATCH 12/19] add and update tests Signed-off-by: Charlike Mike Reagent --- index.js | 63 ++++++++++++++++++++++++---------------------------- test/test.js | 24 +++++++++++++++----- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/index.js b/index.js index 858795d..112f43c 100644 --- a/index.js +++ b/index.js @@ -35,19 +35,21 @@ function deserialize (...args) { } function getCacheFilePath (fn, args, opt) { - const salt = opt.salt || '' + const options = { ...serializer, ...opt } + const salt = options.salt || '' let fnStr = '' - if (!opt.noBody) { + if (!options.noBody) { fnStr = String(fn) - if (opt.astBody) { + if (options.astBody) { fnStr = meriyah.parse(fnStr, { jsx: true, next: true }) } - fnStr = opt.astBody ? JSON.stringify(fnStr) : fnStr + fnStr = options.astBody ? JSON.stringify(fnStr) : fnStr } - const argsStr = opt.serialize(args) + const argsStr = options.serialize(args) const hash = crypto.createHash('md5').update(fnStr + argsStr + salt).digest('hex') - return path.join(opt.cachePath, opt.cacheId, hash) + + return path.join(options.cachePath, options.cacheId, hash) } function buildMemoizer (options) { @@ -61,6 +63,25 @@ function buildMemoizer (options) { throw new Error('option cachePath of type string expected') } options = { ...serializer, ...options } + checkOptions(options) + + function checkOptions (opts) { + if (opts.salt && typeof opts.salt !== 'string') { + throw new TypeError('salt option of type string expected, got: ' + typeof opts.salt) + } + if (opts.cacheId && typeof opts.cacheId !== 'string') { + throw new TypeError('cacheId option of type string expected, got: ' + typeof opts.cacheId) + } + if (opts.maxAge && typeof opts.maxAge !== 'number') { + throw new TypeError('maxAge option of type number bigger zero expected') + } + if (opts.serialize && typeof opts.serialize !== 'function') { + throw new TypeError('serialize option of type function expected') + } + if (opts.deserialize && typeof opts.deserialize !== 'function') { + throw new TypeError('deserialize option of type function expected') + } + } // check for existing cache folder, if not found, create folder, then resolve function initCache (cachePath, opts) { @@ -82,24 +103,6 @@ function buildMemoizer (options) { } function memoizeFn (fn, opt) { - function checkOptions (optExt) { - if (optExt.salt && typeof optExt.salt !== 'string') { - throw new TypeError('salt option of type string expected, got: ' + typeof optExt.salt) - } - if (optExt.cacheId && typeof optExt.cacheId !== 'string') { - throw new TypeError('cacheId option of type string expected, got: ' + typeof optExt.cacheId) - } - if (optExt.maxAge && typeof optExt.maxAge !== 'number') { - throw new TypeError('maxAge option of type number bigger zero expected') - } - if (optExt.serialize && typeof optExt.serialize !== 'function') { - throw new TypeError('serialize option of type function expected') - } - if (optExt.deserialize && typeof optExt.deserialize !== 'function') { - throw new TypeError('deserialize option of type function expected') - } - } - if (opt && typeof opt !== 'object') { throw new Error('opt of type object expected, got \'' + typeof opt + '\'') } @@ -108,17 +111,9 @@ function buildMemoizer (options) { throw new Error('fn of type function expected') } - const optExt = { cacheId: './', ...serializer, ...options, ...opt } - console.log(optExt) + const optExt = { cacheId: './', ...options, ...opt } checkOptions(optExt) - // NOTE weird stuf... I don't get why it's not in optExt in some cases... so istanbul ignore - - // /* istanbul ignore next */ - // optExt.serialize = typeof optExt.serialize === 'function' ? optExt.serialize : serialize - // /* istanbul ignore next */ - // optExt.deserialize = typeof optExt.deserialize === 'function' ? optExt.deserialize : deserialize - function resolveWithMemFn () { return new Promise(function (resolve) { const memFn = function () { @@ -279,7 +274,7 @@ function buildMemoizer (options) { } function getCacheFilePathBound (fn, args, opt) { - return getCacheFilePath(fn, args, Object.assign({}, opt, { cachePath: options.cachePath })) + return getCacheFilePath(fn, args, { ...options, ...opt, cachePath: options.cachePath }) } const cache = initCache(options.cachePath) diff --git a/test/test.js b/test/test.js index eec1e3a..3029c72 100644 --- a/test/test.js +++ b/test/test.js @@ -14,6 +14,18 @@ describe('memoize-fs', function () { }) describe('check args', function () { + it('should throw an error when opts.serialize is not a function when passed', (done) => { + const fixture = () => memoizeFs(() => {}, {deserialize: 123}) + assert.throws(fixture, Error) + assert.throws(fixture, /serialize option of type function expected/) + done() + }) + it('should throw an error when opts.deserialize is not a function when passed', (done) => { + const fixture = () => memoizeFs(() => {}, {deserialize: 123}) + assert.throws(fixture, Error) + assert.throws(fixture, /deserialize option of type function expected/) + done() + }) it('should throw an error when options param is not provided', function (done) { assert.throws(function () { memoizeFs() @@ -924,7 +936,7 @@ describe('memoize-fs', function () { return a + b + c }, { cacheId: 'foobar', - serialize: 'qux', + salt: 'qux', noBody: true }).then(function (memFn) { return memFn(1, 2) @@ -934,7 +946,7 @@ describe('memoize-fs', function () { return a + b + c }, { cacheId: 'foobar', - serialize: 'qux', + salt: 'qux', noBody: true }) }).then(function (memFn) { @@ -961,7 +973,7 @@ describe('memoize-fs', function () { return a + b + c }, { cacheId: 'foobar', - serialize: 'qux' + salt: 'qux' }).then(function (memFn) { return memFn(1, 2) }).then(function (result) { @@ -970,7 +982,7 @@ describe('memoize-fs', function () { return a + b + c }, { cacheId: 'foobar', - serialize: 'qux' + salt: 'qux' }) }).then(function (memFn) { c = 999 @@ -998,7 +1010,7 @@ describe('memoize-fs', function () { return "string" // eslint-disable-line quotes }, { cacheId: 'foobar', - serialize: 'qux', + salt: 'qux', astBody: true }).then(function (memFn) { return memFn() @@ -1009,7 +1021,7 @@ describe('memoize-fs', function () { return 'string' }, { cacheId: 'foobar', - serialize: 'qux', + salt: 'qux', astBody: true }) }).then(function (memFn) { From bcf239350d20c9d1dd92fcf396b040273fd44163 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 01:49:06 +0200 Subject: [PATCH 13/19] cleanup Signed-off-by: Charlike Mike Reagent --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 112f43c..a885894 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ -// const mkdirp = require('mkdirp') +'use strict' + const path = require('path') const crypto = require('crypto') const meriyah = require('meriyah') @@ -91,8 +92,6 @@ function buildMemoizer (options) { resolve() }) .catch((err) => { - // ! NOTE we don't care in this case if there is a problem, - // since we just need a cache directory to be created if (err && err.code === 'EEXIST' && opts.throwError === false) { resolve() return From f997b852e4f5492a9b0df2d24f24ee92ae34ac6a Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 16:42:44 +0200 Subject: [PATCH 14/19] fix tests Signed-off-by: Charlike Mike Reagent --- .gitignore | 2 +- test/test.js | 104 +++++++++++++++++++++++++++------------------------ 2 files changed, 57 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index 2339a82..f804523 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,4 @@ build/Release node_modules # Cache files generated by tests -build/cache +fixture-cache diff --git a/test/test.js b/test/test.js index 3029c72..dc83f33 100644 --- a/test/test.js +++ b/test/test.js @@ -8,20 +8,28 @@ const fs = require('fs-extra') const serialize = require('serialize-javascript') const memoizeFs = require('../index') +const FIXTURE_CACHE = path.join(__dirname, '..', 'fixture-cache') + describe('memoize-fs', function () { beforeEach(function (done) { - fs.remove(path.join(__dirname, '../build/cache')).then(() => done()).catch(done) + fs.remove(FIXTURE_CACHE).then(() => done()).catch(done) }) describe('check args', function () { it('should throw an error when opts.serialize is not a function when passed', (done) => { - const fixture = () => memoizeFs(() => {}, {deserialize: 123}) + const fixture = () => { + memoizeFs({cachePath: FIXTURE_CACHE, serialize: 123}).fn(() => {}) + } + assert.throws(fixture, Error) assert.throws(fixture, /serialize option of type function expected/) done() }) it('should throw an error when opts.deserialize is not a function when passed', (done) => { - const fixture = () => memoizeFs(() => {}, {deserialize: 123}) + const fixture = () => { + memoizeFs({cachePath: FIXTURE_CACHE, deserialize: 123}).fn(() => {}) + } + assert.throws(fixture, Error) assert.throws(fixture, /deserialize option of type function expected/) done() @@ -64,7 +72,7 @@ describe('memoize-fs', function () { describe('init cache', function () { it('should create a cache folder before caching', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }).then(function (memoized) { @@ -77,7 +85,7 @@ describe('memoize-fs', function () { }) it('should create a cache sub-folder before caching', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }, {cacheId: 'foobar'}).then(function (memoized) { @@ -92,7 +100,7 @@ describe('memoize-fs', function () { }) it('should be able to pass custom serialize and deserialize through memoizeFS options', (done) => { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE fs.removeSync(cachePath) function deserialize (serializedJavascript) { @@ -156,7 +164,7 @@ describe('memoize-fs', function () { describe('memoize fn', function () { it('should return a rejecting promise instance if fn param is not provided', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn().then(function () { done(Error('entered resolve handler instead of error handler')) @@ -167,7 +175,7 @@ describe('memoize-fs', function () { }) it('should return a rejecting promise instance if fn param is not of type function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn('foobar').then(function () { done(Error('entered resolve handler instead of error handler')) @@ -178,7 +186,7 @@ describe('memoize-fs', function () { }) it('should return a rejecting promise instance if salt param is not of type string', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }, {salt: true}).then(function () { @@ -190,7 +198,7 @@ describe('memoize-fs', function () { }) it('should return a rejecting promise instance if cacheId param is not of type string', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }, {cacheId: true}).then(function () { @@ -202,7 +210,7 @@ describe('memoize-fs', function () { }) it('should return a rejecting promise instance if maxAge param is not of type number', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }, {maxAge: true}).then(function () { @@ -216,7 +224,7 @@ describe('memoize-fs', function () { describe('process fn', function () { it('should not cache the result of a memoized function if an exception is raised during execution', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { throw new Error('qux') @@ -238,7 +246,7 @@ describe('memoize-fs', function () { }) it('should not cache the result of a memoized promisified function if an exception is raised during execution', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { return new Promise(function (resolve, reject) { @@ -264,7 +272,7 @@ describe('memoize-fs', function () { }) it('should cache the result of a memoized function on first execution to its cache folder', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -289,7 +297,7 @@ describe('memoize-fs', function () { }) it('should cache the result of a memoized function on first execution to its cache folder with salt', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -317,7 +325,7 @@ describe('memoize-fs', function () { }) it('should cache the result of a memoized function on first execution to the root cache folder if no cache id is provided', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) const c = 3 memoize.fn(function (a, b) { @@ -338,7 +346,7 @@ describe('memoize-fs', function () { }) it('should return the cached result with the value undefined of a previously memoized function with return type void', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 0 memoize.fn(function () { @@ -364,7 +372,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of type number of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -389,7 +397,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of type number of a previously memoized function cached in the root cache folder if no cache id is provided', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -414,7 +422,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of type string of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -439,7 +447,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of type string with lots of quotation marks in it of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function (a, b) { return '"{"foo": "bar", "qux": "\'sas\'\"quatch\""}"' + (a + b) @@ -462,7 +470,7 @@ describe('memoize-fs', function () { }) it('should return the cached result with the value undefined of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c memoize.fn(function (a, b) { @@ -487,7 +495,7 @@ describe('memoize-fs', function () { }) it('should return the cached result with the value null of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = null memoize.fn(function (a, b) { @@ -512,7 +520,7 @@ describe('memoize-fs', function () { }) it('should return the cached result with the value NaN of a previously memoized function converting NaN to undefined', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c memoize.fn(function (a, b) { @@ -537,7 +545,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of type object of a previously memoized function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 const Circ = function () { @@ -612,7 +620,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of a previously memoized promisified async function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -641,7 +649,7 @@ describe('memoize-fs', function () { }) it('should ignore arguments of type function silently during serialization', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let d = 3 memoize.fn(function (a, b, c) { @@ -670,7 +678,7 @@ describe('memoize-fs', function () { }) it('should ignore argument attributes of type function silently during serialization', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let d = 3 memoize.fn(function (a, b, c) { @@ -705,7 +713,7 @@ describe('memoize-fs', function () { describe('async', function () { it('should return a rejecting promise instance if option async is provided but function has no callback', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function (a, cb) { cb(a) @@ -720,7 +728,7 @@ describe('memoize-fs', function () { }) it('should not cache the result of a memoized async function if its callback receives an error', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function (cb) { setTimeout(function () { @@ -745,7 +753,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of a previously memoized async function', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 let d @@ -784,7 +792,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of a previously memoized async function with a callback which only excepts an error argument', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = true let d @@ -821,7 +829,7 @@ describe('memoize-fs', function () { }) it('should return the cached result of a previously memoized async function which only excepts a callback argument', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = true let d @@ -858,7 +866,7 @@ describe('memoize-fs', function () { }) it('should only run the memoized function once even when called with the same arguments on the same tick', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let n = 0 memoize.fn(function (cb) { @@ -874,7 +882,7 @@ describe('memoize-fs', function () { describe('force recaching', function () { it('should not recache the result of a memoized function on second execution if force option is not set', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({ cachePath: cachePath }) let c = 3 memoize.fn(function (a, b) { return a + b + c }, { cacheId: 'foobar' }).then(function (memFn) { @@ -899,7 +907,7 @@ describe('memoize-fs', function () { }) it('should recache the result of a memoized function on second execution if force option is set', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { return a + b + c }, {cacheId: 'foobar'}).then(function (memFn) { @@ -929,7 +937,7 @@ describe('memoize-fs', function () { describe('noBody', function () { it('should cache the result of a memoized function on second execution with option noBody set to true with different function names', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function foo (a, b) { @@ -966,7 +974,7 @@ describe('memoize-fs', function () { }) it('should not cache the result of a memoized function on second execution with option noBody not set with different function names', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function foo (a, b) { @@ -1003,7 +1011,7 @@ describe('memoize-fs', function () { describe('astBody', function () { it('should cache the result of a memoized function on second execution with option astBody set to true with equivalent function ASTs', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function foo () { // double quoted @@ -1039,7 +1047,7 @@ describe('memoize-fs', function () { }).catch(done) }) it('should work with ES2020', async () => { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let idx = 0 @@ -1078,7 +1086,7 @@ describe('memoize-fs', function () { describe('invalidate cache', function () { it('should recache the result of a memoized function after invalidating the cache before the second execution', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -1109,7 +1117,7 @@ describe('memoize-fs', function () { }) it('should recache the result of a memoized function after invalidating the root cache by not providing a cache id before the second execution', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -1147,7 +1155,7 @@ describe('memoize-fs', function () { }) it('should invalidate cache after timeout with maxAge option set', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -1181,7 +1189,7 @@ describe('memoize-fs', function () { }) it('should not throw if it fails to invalidate cache after timeout with maxAge option set, because already invalidated manually', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) let c = 3 memoize.fn(function (a, b) { @@ -1252,7 +1260,7 @@ describe('memoize-fs', function () { }) it('should throw an error when trying to write cache on a file without having the necessary permission', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { return 1 }, {cacheId: 'foobar'}).then(function (memFn) { return memFn() @@ -1275,7 +1283,7 @@ describe('memoize-fs', function () { }) it('should throw an error trying to invalidate cache without having the necessary permission', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { return 1 @@ -1304,7 +1312,7 @@ describe('memoize-fs', function () { }) it('should throw an error when trying to memoize a function with options of invalid type', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) memoize.fn(function () { }, true).then(function () { @@ -1316,7 +1324,7 @@ describe('memoize-fs', function () { }) it('should throw if it fails to invalidate cache after timeout with maxAge option set, because of EPERM error', function (done) { - const cachePath = path.join(__dirname, '../build/cache') + const cachePath = FIXTURE_CACHE const memoize = memoizeFs({cachePath: cachePath}) const c = 3 From 2c0f780684fabbabe4e8745824b838f9d98c21f6 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 18:11:22 +0200 Subject: [PATCH 15/19] update docs Signed-off-by: Charlike Mike Reagent --- .editorconfig | 11 +++ README.md | 201 ++++++++++++++++++++++++++++++++++++++------------ example.js | 31 ++++++++ index.js | 4 +- test/test.js | 2 +- 5 files changed, 198 insertions(+), 51 deletions(-) create mode 100644 .editorconfig create mode 100644 example.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ce26749 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# http://editorconfig.org/ +root = true + +[*] +indent_style = space +indent_size = 2 +tab_width = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/README.md b/README.md index 7332030..0dc484a 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # memoize-fs -memoize/cache in file system solution for Node.js +Node.js solution for memoizing/caching a function and its return state into the file system [![Build Status](https://travis-ci.org/borisdiakur/memoize-fs.svg?branch=master)](https://travis-ci.org/borisdiakur/memoize-fs) [![Coverage Status](https://coveralls.io/repos/borisdiakur/memoize-fs/badge.svg?branch=master)](https://coveralls.io/r/borisdiakur/memoize-fs?branch=master) @@ -32,30 +32,70 @@ npm install memoize-fs --save ## Usage -```javascript -var cachePath = require('path').join(__dirname, '..', 'cache'), - memoize = require('memoize-fs')({ cachePath: cachePath }), - fun = function (a, b) { return a + b; }; +```js +const assert = require('assert') +const memoizeFs = require('memoize-fs') -memoize.fn(fun).then(function (memFn) { - memFn(1, 2).then(function (result) { - assert.strictEqual(result, 3); - return memFn(1, 2); // cache hit - }).then(function (result) { - assert.strictEqual(result, 3); - }).catch( /* handle error */ ); -}).catch( /* handle error */ ); +const memoizer = memoizeFs({ cachePath: './some-cache' }) + +console.log(memoizer) +// => { +// fn: [Function: fn], +// getCacheFilePath: [Function: getCacheFilePathBound], +// invalidate: [Function: invalidateCache] +// } + +async function main () { + let idx = 0 + const func = function foo (a, b) { + idx += a + b + return idx + } + + const memoizedFn = await memoizer.fn(func) + const resultOne = await memoizedFn(1, 2) + + assert.strictEqual(resultOne, 3) + assert.strictEqual(idx, 3) + + const resultTwo = await memoizedFn(1, 2) // cache hit + assert.strictEqual(resultTwo, 3) + assert.strictEqual(idx, 3) +} + +main().catch(console.error) ``` -__Note that a result of a memoized function is always a [Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) instance!__ +_**NOTE:** that memoized function is always an async function and +the result of it is a Promise (if not `await`-ed as seen in above example)!_ + +- [Learn more about Promises](https://javascript.info/promise-basics) +- [Learn more about async/await](https://javascript.info/async-await) -### Memoizing asynchronous functions +### Signature + +See [Types](#types) and [Options](#options) sections for more info. + +```js +const memoizer = memoizeFs(MemoizeOptions) + +console.log(memoizer) +// => { +// fn: [Function: fn], +// getCacheFilePath: [Function: getCacheFilePathBound], +// invalidate: [Function: invalidateCache] +// } + +const memoizedFn = memoizer.fn(FunctionToMemoize, Options?) +``` + +## Memoizing asynchronous functions memoize-fs assumes a function asynchronous if the last argument it accepts is of type `function` and that function itself accepts at least one argument. So basically you don't have to do anything differently than when memoizing synchronous functions. Just make sure the above condition is fulfilled. Here is an example of memoizing a function with a callback: -```javascript +```js var funAsync = function (a, b, cb) { setTimeout(function () { cb(null, a + b); @@ -71,7 +111,7 @@ memoize.fn(funAsync).then(function (memFn) { }).catch( /* handle error */ ); ``` -### Memoizing promisified functions +## Memoizing promisified functions You can also memoize a promisified function. memoize-fs assumes a function promisified if its result is _thenable_ which means that the result is an object with a property `then` of type `function` @@ -79,7 +119,7 @@ which means that the result is an object with a property `then` of type `functio So again it's the same as with memoizing synchronous functions. Here is an example of memoizing a promisified function: -```javascript +```js var funPromisified = function (a, b) { return new Promise(function (resolve, reject) { setTimeout(function () { resolve(a + b); }, 100); @@ -96,84 +136,149 @@ memoize.fn(funPromisified).then(function (memFn) { }).catch( /* handle error */ ); ``` -### Options +## Types + +```ts +export interface Options { + cacheId?: string; + salt?: string; + maxAge?: number; + force?: boolean; + astBody?: boolean; + noBody?: boolean; + serialize?: (val?: any) => string; + deserialize?: (val?: string) => any; +} +export type MemoizeOptions = Options & { cachePath: string } + +export type FunctionToMemoize = (...args: any[]) => any; + +export interface Memoizer { + fn: (fnToMemoize: FunctionToMemoize, options?: Options) => Promise; + invalidate: (id?: string) => Promise; + getCacheFilePath: (fnToMemoize: FunctionToMemoize, options: Options) => string; +} + +export default function memoizeFs(options: MemoizeOptions): Memoizer; +``` + +## Options When memoizing a function all below options can be applied in any combination. +The only required option is `cachePath`. -#### cacheId + +### cachePath + +Path to the location of the cache on the disk. This option is always **required**. + +### cacheId By default all cache files are saved into the __root cache__ which is the folder specified by the cachePath option: -```javascript -var memoize = require('memoize-fs')({ cachePath: require('path').join(__dirname, '../../cache' }); +```js +var path = require('path') +var memoizer = require('memoize-fs')({ cachePath: path.join(__dirname, '../../cache') }) ``` The `cacheId` option which you can specify during memoization of a function resolves to the name of a subfolder created inside the root cache folder. Cached function calls will be cached inside that folder: -```javascript -memoize.fn(fun, { cacheId: 'foobar' }).then(... +```js +memoizer.fn(fun, { cacheId: 'foobar' }) ``` -#### salt +### salt Functions may have references to variables outside their own scope. As a consequence two functions which look exactly the same (they have the same function signature and function body) can return different results even when executed with identical arguments. In order to avoid the same cache being used for two different functions you can use the `salt` option which mutates the hash key created for the memoized function which in turn defines the name of the cache file: -```javascript -memoize.fn(fun, { salt: 'foobar' }).then(... +```js +memoizer.fn(fun, { salt: 'foobar' }) ``` -#### maxAge +### maxAge With `maxAge` option you can ensure that cache for given call is cleared after a predefined period of time (in milliseconds). -```javascript -memoize.fn(fun, { maxAge: 10000 }).then(... +```js +memoizer.fn(fun, { maxAge: 10000 }) ``` -#### force +### force The `force` option forces the re-execution of an already memoized function and the re-caching of its outcome: -```javascript -memoize.fn(fun, { force: true }).then(... +```js +memoizer.fn(fun, { force: true }) ``` -#### astBody +### astBody If you want to use the function AST instead the function body when generating the hash ([see serialization](#serialization)), set the option `astBody` to `true`. This allows the function source code to be reformatted without busting the cache. See https://github.com/borisdiakur/memoize-fs/issues/6 for details. -```javascript -memoize.fn(fun, { astBody: true }).then(... +```js +memoizer.fn(fun, { astBody: true }) ``` -#### noBody +### noBody If for some reason you want to omit the function body when generating the hash ([see serialization](#serialization)), set the option `noBody` to `true`. -```javascript -memoize.fn(fun, { noBody: true }).then(... +```js +memoizer.fn(fun, { noBody: true }) ``` -### Manual cache invalidation +### serialize and deserialize + +These two options allows you to control how the serialization and deserialization process works. +By default we use basic `JSON.stringify` and `JSON.parse`, but you may need more advanced stuff. + +In the following example we are using [Yahoo's `serialize-javascript`](https://ghub.now.sh/serialize-javascript) +to be able to cache properly the return result of memoized function containing a `function`. + +```js +const memoizeFs = require('memoize-fs') +const serialize = require('serialize-javascript') + +const deserialize = (serializedJsString) => eval(`(${serializedJsString})`) + +const memoizer = memoizeFs({ cachePath: './cache', serialize, deserialize }) + +function someFn (a) { + const bar = 123 + + setTimeout(() => {}, a * 10) + + return { + bar, + getBar() { return a + bar } + } +} + +memoizer.fn(someFn) +``` + +## Manual cache invalidation You can delete the root cache (all cache files inside the folder specified by the cachePath option): -```javascript -memoize.invalidate().then(... +```js +memoize.invalidate().then(() => { console.log('cache cleared') }) ``` You can also pass the cacheId argument to the invalidate method. This way you only delete the cache inside the subfolder with given id. -```javascript -memoize.invalidate('foobar').then(... +```js +memoize.invalidate('foobar').then(() => { console.log('cache for "foobar" cleared') }) ``` ## Serialization +See also the [`options.seriliaze` and `options.deserialize`](#serialize-and-deserialize). + memoize-fs uses JSON to serialize the results of a memoized function. It also uses JSON, when it tries to serialize the arguments of the memoized function in order to create a hash which is used as the name of the cache file to be stored or retrieved. @@ -182,9 +287,9 @@ The hash is created from the serialized arguments, the function body and the [sa You can generate this hash using `memoize.getCacheFilePath`: ```js -var memoize = require('memoize-fs')({cachePath: '/'}) -memoize.getCacheFilePath(function () {}, ['arg', 'arg'], {cacheId: 'foobar'}) -// -> '/foobar/06f254...' +var memoizer = require('memoize-fs')({ cachePath: './' }) +memoizer.getCacheFilePath(function () {}, ['arg', 'arg'], { cacheId: 'foobar' }) +// -> './foobar/06f254...' ``` Since memoize-fs is using JSON for serialization, __you should know__ how it works around some of its "limitations": @@ -239,4 +344,4 @@ Check code coverage with: npm run coverage ``` -Then please commit with a __detailed__ commit message. +Then please commit with a **detailed** commit message. diff --git a/example.js b/example.js new file mode 100644 index 0000000..af1a385 --- /dev/null +++ b/example.js @@ -0,0 +1,31 @@ +const assert = require('assert') +const memoizeFs = require('./index') + +const memoizer = memoizeFs({ cachePath: './some-cache' }) + +console.log(memoizer) +// => { +// fn: [Function: fn], +// getCacheFilePath: [Function: getCacheFilePathBound], +// invalidate: [Function: invalidateCache] +// } + +async function main () { + let idx = 0 + const func = function foo (a, b) { + idx += a + b + return idx + } + + const memoizedFn = await memoizer.fn(func) + const resultOne = await memoizedFn(1, 2) + + assert.strictEqual(resultOne, 3) + assert.strictEqual(idx, 3) + + const resultTwo = await memoizedFn(1, 2) // cache hit + assert.strictEqual(resultTwo, 3) + assert.strictEqual(idx, 3) +} + +main().catch(console.error) diff --git a/index.js b/index.js index a885894..d78812f 100644 --- a/index.js +++ b/index.js @@ -31,8 +31,8 @@ function serialize (val) { }) } -function deserialize (...args) { - return JSON.parse(...args).data +function deserialize (str) { + return JSON.parse(str).data } function getCacheFilePath (fn, args, opt) { diff --git a/test/test.js b/test/test.js index dc83f33..b0f04c7 100644 --- a/test/test.js +++ b/test/test.js @@ -27,7 +27,7 @@ describe('memoize-fs', function () { }) it('should throw an error when opts.deserialize is not a function when passed', (done) => { const fixture = () => { - memoizeFs({cachePath: FIXTURE_CACHE, deserialize: 123}).fn(() => {}) + memoizeFs({cachePath: FIXTURE_CACHE}).fn(() => {}, {deserialize: 123}) } assert.throws(fixture, Error) From cf6031ddd88be2c25fd12113dd009b06d2c4a161 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 18:22:23 +0200 Subject: [PATCH 16/19] add typescript types file Signed-off-by: Charlike Mike Reagent --- README.md | 1 + index.d.ts | 22 ++++++++++++++++++++++ package.json | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 index.d.ts diff --git a/README.md b/README.md index 0dc484a..eb781aa 100755 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ export interface Options { serialize?: (val?: any) => string; deserialize?: (val?: string) => any; } + export type MemoizeOptions = Options & { cachePath: string } export type FunctionToMemoize = (...args: any[]) => any; diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..c6197dc --- /dev/null +++ b/index.d.ts @@ -0,0 +1,22 @@ +export interface Options { + cacheId?: string; + salt?: string; + maxAge?: number; + force?: boolean; + astBody?: boolean; + noBody?: boolean; + serialize?: (val?: any) => string; + deserialize?: (val?: string) => any; +} + +export type MemoizeOptions = Options & { cachePath: string } + +export type FunctionToMemoize = (...args: any[]) => any; + +export interface Memoizer { + fn: (fnToMemoize: FunctionToMemoize, options?: Options) => Promise; + invalidate: (id?: string) => Promise; + getCacheFilePath: (fnToMemoize: FunctionToMemoize, options: Options) => string; +} + +export default function memoizeFs(options: MemoizeOptions): Memoizer; diff --git a/package.json b/package.json index 0601a19..dae6071 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,11 @@ }, "private": false, "main": "index.js", + "typings": "index.d.ts", + "files": [ + "index.js", + "index.d.ts" + ], "keywords": [ "memoize", "memoizer", From eee8ec1f58a09311bf0645e0150b6b63f71ea539 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 18:37:50 +0200 Subject: [PATCH 17/19] tweak types Signed-off-by: Charlike Mike Reagent --- README.md | 9 +++++---- index.d.ts | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index eb781aa..072d4ea 100755 --- a/README.md +++ b/README.md @@ -150,9 +150,8 @@ export interface Options { deserialize?: (val?: string) => any; } -export type MemoizeOptions = Options & { cachePath: string } - -export type FunctionToMemoize = (...args: any[]) => any; +export type MemoizeOptions = Options & { cachePath: string }; +export type FnToMemoize = (...args: any[]) => any; export interface Memoizer { fn: (fnToMemoize: FunctionToMemoize, options?: Options) => Promise; @@ -160,7 +159,9 @@ export interface Memoizer { getCacheFilePath: (fnToMemoize: FunctionToMemoize, options: Options) => string; } -export default function memoizeFs(options: MemoizeOptions): Memoizer; +declare function memoizeFs(options: MemoizeOptions): Memoizer; + +export = memoizeFs; ``` ## Options diff --git a/index.d.ts b/index.d.ts index c6197dc..bfd926b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -9,9 +9,8 @@ export interface Options { deserialize?: (val?: string) => any; } -export type MemoizeOptions = Options & { cachePath: string } - -export type FunctionToMemoize = (...args: any[]) => any; +export type MemoizeOptions = Options & { cachePath: string }; +export type FnToMemoize = (...args: any[]) => any; export interface Memoizer { fn: (fnToMemoize: FunctionToMemoize, options?: Options) => Promise; @@ -19,4 +18,6 @@ export interface Memoizer { getCacheFilePath: (fnToMemoize: FunctionToMemoize, options: Options) => string; } -export default function memoizeFs(options: MemoizeOptions): Memoizer; +declare function memoizeFs(options: MemoizeOptions): Memoizer; + +export = memoizeFs; From 2ae8e1940cf50bb462448ee5d58bf8993ce3f5a5 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 18:40:00 +0200 Subject: [PATCH 18/19] docs typos Signed-off-by: Charlike Mike Reagent --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 072d4ea..a4d05d3 100755 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ The `cacheId` option which you can specify during memoization of a function reso Cached function calls will be cached inside that folder: ```js -memoizer.fn(fun, { cacheId: 'foobar' }) +memoizer.fn(fnToMemoize, { cacheId: 'foobar' }) ``` ### salt @@ -198,7 +198,7 @@ In order to avoid the same cache being used for two different functions you can which mutates the hash key created for the memoized function which in turn defines the name of the cache file: ```js -memoizer.fn(fun, { salt: 'foobar' }) +memoizer.fn(fnToMemoize, { salt: 'foobar' }) ``` ### maxAge @@ -206,7 +206,7 @@ memoizer.fn(fun, { salt: 'foobar' }) With `maxAge` option you can ensure that cache for given call is cleared after a predefined period of time (in milliseconds). ```js -memoizer.fn(fun, { maxAge: 10000 }) +memoizer.fn(fnToMemoize, { maxAge: 10000 }) ``` ### force @@ -214,7 +214,7 @@ memoizer.fn(fun, { maxAge: 10000 }) The `force` option forces the re-execution of an already memoized function and the re-caching of its outcome: ```js -memoizer.fn(fun, { force: true }) +memoizer.fn(fnToMemoize, { force: true }) ``` ### astBody @@ -222,7 +222,7 @@ memoizer.fn(fun, { force: true }) If you want to use the function AST instead the function body when generating the hash ([see serialization](#serialization)), set the option `astBody` to `true`. This allows the function source code to be reformatted without busting the cache. See https://github.com/borisdiakur/memoize-fs/issues/6 for details. ```js -memoizer.fn(fun, { astBody: true }) +memoizer.fn(fnToMemoize, { astBody: true }) ``` ### noBody @@ -230,7 +230,7 @@ memoizer.fn(fun, { astBody: true }) If for some reason you want to omit the function body when generating the hash ([see serialization](#serialization)), set the option `noBody` to `true`. ```js -memoizer.fn(fun, { noBody: true }) +memoizer.fn(fnToMemoize, { noBody: true }) ``` ### serialize and deserialize @@ -268,13 +268,13 @@ memoizer.fn(someFn) You can delete the root cache (all cache files inside the folder specified by the cachePath option): ```js -memoize.invalidate().then(() => { console.log('cache cleared') }) +memoizer.invalidate().then(() => { console.log('cache cleared') }) ``` You can also pass the cacheId argument to the invalidate method. This way you only delete the cache inside the subfolder with given id. ```js -memoize.invalidate('foobar').then(() => { console.log('cache for "foobar" cleared') }) +memoizer.invalidate('foobar').then(() => { console.log('cache for "foobar" cleared') }) ``` ## Serialization From 2c3784b1f8f1aa5a9a7a9f5df78d43d17bdfa229 Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Fri, 28 Feb 2020 19:25:17 +0200 Subject: [PATCH 19/19] add reporter text-lcov toc coverage script Signed-off-by: Charlike Mike Reagent --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dae6071..60e8645 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "pretest": "npm run lint", "test": "nyc mocha", "mocha": "mocha -R nyan", - "coverage": "nyc report | coveralls", + "coverage": "nyc report --reporter text-lcov | coveralls", "cov": "open-cli coverage/lcov-report/index.html" }, "homepage": "https://github.com/borisdiakur/memoize-fs",