Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-universal-import

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-universal-import - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

2

coverage/coverage-final.json

@@ -1,2 +0,2 @@

{"/home/travis/build/faceyspacey/babel-plugin-universal-import/index.js": {"path":"/home/travis/build/faceyspacey/babel-plugin-universal-import/index.js","statementMap":{"0":{"start":{"line":3,"column":0},"end":{"line":236,"column":1}},"1":{"start":{"line":4,"column":18},"end":{"line":4,"column":35}},"2":{"start":{"line":5,"column":28},"end":{"line":5,"column":55}},"3":{"start":{"line":6,"column":22},"end":{"line":6,"column":43}},"4":{"start":{"line":7,"column":17},"end":{"line":7,"column":33}},"5":{"start":{"line":9,"column":28},"end":{"line":9,"column":52}},"6":{"start":{"line":10,"column":23},"end":{"line":10,"column":69}},"7":{"start":{"line":11,"column":26},"end":{"line":11,"column":71}},"8":{"start":{"line":12,"column":23},"end":{"line":14,"column":3}},"9":{"start":{"line":17,"column":4},"end":{"line":17,"column":43}},"10":{"start":{"line":21,"column":4},"end":{"line":21,"column":49}},"11":{"start":{"line":25,"column":4},"end":{"line":25,"column":35}},"12":{"start":{"line":29,"column":4},"end":{"line":36,"column":5}},"13":{"start":{"line":30,"column":24},"end":{"line":34,"column":7}},"14":{"start":{"line":35,"column":6},"end":{"line":35,"column":47}},"15":{"start":{"line":38,"column":4},"end":{"line":38,"column":40}},"16":{"start":{"line":42,"column":4},"end":{"line":49,"column":5}},"17":{"start":{"line":43,"column":24},"end":{"line":47,"column":7}},"18":{"start":{"line":48,"column":6},"end":{"line":48,"column":41}},"19":{"start":{"line":51,"column":4},"end":{"line":51,"column":34}},"20":{"start":{"line":55,"column":4},"end":{"line":58,"column":5}},"21":{"start":{"line":56,"column":19},"end":{"line":56,"column":66}},"22":{"start":{"line":57,"column":6},"end":{"line":57,"column":31}},"23":{"start":{"line":60,"column":4},"end":{"line":60,"column":29}},"24":{"start":{"line":64,"column":4},"end":{"line":76,"column":5}},"25":{"start":{"line":65,"column":19},"end":{"line":65,"column":48}},"26":{"start":{"line":66,"column":22},"end":{"line":66,"column":66}},"27":{"start":{"line":67,"column":6},"end":{"line":69,"column":8}},"28":{"start":{"line":71,"column":6},"end":{"line":71,"column":78}},"29":{"start":{"line":71,"column":41},"end":{"line":71,"column":76}},"30":{"start":{"line":73,"column":6},"end":{"line":75,"column":8}},"31":{"start":{"line":78,"column":23},"end":{"line":78,"column":64}},"32":{"start":{"line":79,"column":4},"end":{"line":79,"column":38}},"33":{"start":{"line":83,"column":20},"end":{"line":83,"column":60}},"34":{"start":{"line":85,"column":4},"end":{"line":87,"column":6}},"35":{"start":{"line":91,"column":36},"end":{"line":91,"column":49}},"36":{"start":{"line":92,"column":4},"end":{"line":92,"column":65}},"37":{"start":{"line":92,"column":17},"end":{"line":92,"column":65}},"38":{"start":{"line":94,"column":20},"end":{"line":94,"column":42}},"39":{"start":{"line":95,"column":27},"end":{"line":95,"column":49}},"40":{"start":{"line":96,"column":22},"end":{"line":96,"column":67}},"41":{"start":{"line":97,"column":4},"end":{"line":97,"column":42}},"42":{"start":{"line":101,"column":36},"end":{"line":101,"column":49}},"43":{"start":{"line":102,"column":4},"end":{"line":102,"column":43}},"44":{"start":{"line":102,"column":17},"end":{"line":102,"column":43}},"45":{"start":{"line":104,"column":4},"end":{"line":108,"column":10}},"46":{"start":{"line":105,"column":16},"end":{"line":105,"column":34}},"47":{"start":{"line":106,"column":17},"end":{"line":106,"column":54}},"48":{"start":{"line":107,"column":6},"end":{"line":107,"column":46}},"49":{"start":{"line":112,"column":15},"end":{"line":112,"column":44}},"50":{"start":{"line":113,"column":4},"end":{"line":113,"column":68}},"51":{"start":{"line":117,"column":4},"end":{"line":120,"column":5}},"52":{"start":{"line":124,"column":17},"end":{"line":138,"column":10}},"53":{"start":{"line":125,"column":24},"end":{"line":125,"column":42}},"54":{"start":{"line":126,"column":25},"end":{"line":126,"column":41}},"55":{"start":{"line":128,"column":6},"end":{"line":135,"column":7}},"56":{"start":{"line":129,"column":31},"end":{"line":132,"column":9}},"57":{"start":{"line":134,"column":8},"end":{"line":134,"column":36}},"58":{"start":{"line":137,"column":6},"end":{"line":137,"column":20}},"59":{"start":{"line":140,"column":4},"end":{"line":140,"column":35}},"60":{"start":{"line":144,"column":20},"end":{"line":144,"column":39}},"61":{"start":{"line":145,"column":22},"end":{"line":145,"column":61}},"62":{"start":{"line":147,"column":4},"end":{"line":147,"column":39}},"63":{"start":{"line":148,"column":4},"end":{"line":148,"column":71}},"64":{"start":{"line":150,"column":20},"end":{"line":150,"column":54}},"65":{"start":{"line":151,"column":17},"end":{"line":156,"column":17}},"66":{"start":{"line":158,"column":4},"end":{"line":158,"column":55}},"67":{"start":{"line":162,"column":17},"end":{"line":165,"column":17}},"68":{"start":{"line":167,"column":4},"end":{"line":167,"column":55}},"69":{"start":{"line":171,"column":20},"end":{"line":173,"column":17}},"70":{"start":{"line":175,"column":4},"end":{"line":175,"column":61}},"71":{"start":{"line":179,"column":22},"end":{"line":181,"column":17}},"72":{"start":{"line":183,"column":4},"end":{"line":183,"column":65}},"73":{"start":{"line":186,"column":2},"end":{"line":235,"column":3}},"74":{"start":{"line":190,"column":8},"end":{"line":190,"column":30}},"75":{"start":{"line":190,"column":24},"end":{"line":190,"column":30}},"76":{"start":{"line":191,"column":8},"end":{"line":191,"column":25}},"77":{"start":{"line":193,"column":30},"end":{"line":193,"column":54}},"78":{"start":{"line":194,"column":32},"end":{"line":194,"column":53}},"79":{"start":{"line":195,"column":27},"end":{"line":197,"column":9}},"80":{"start":{"line":200,"column":8},"end":{"line":210,"column":9}},"81":{"start":{"line":204,"column":23},"end":{"line":207,"column":12}},"82":{"start":{"line":209,"column":10},"end":{"line":209,"column":47}},"83":{"start":{"line":212,"column":21},"end":{"line":227,"column":11}},"84":{"start":{"line":229,"column":24},"end":{"line":229,"column":48}},"85":{"start":{"line":231,"column":21},"end":{"line":231,"column":65}},"86":{"start":{"line":232,"column":8},"end":{"line":232,"column":38}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":17},"end":{"line":3,"column":18}},"loc":{"start":{"line":3,"column":51},"end":{"line":236,"column":1}},"line":3},"1":{"name":"getImportArgPath","decl":{"start":{"line":16,"column":11},"end":{"line":16,"column":27}},"loc":{"start":{"line":16,"column":31},"end":{"line":18,"column":3}},"line":16},"2":{"name":"trimChunkNameBaseDir","decl":{"start":{"line":20,"column":11},"end":{"line":20,"column":31}},"loc":{"start":{"line":20,"column":41},"end":{"line":22,"column":3}},"line":20},"3":{"name":"prepareChunkNamePath","decl":{"start":{"line":24,"column":11},"end":{"line":24,"column":31}},"loc":{"start":{"line":24,"column":38},"end":{"line":26,"column":3}},"line":24},"4":{"name":"getUniversalImport","decl":{"start":{"line":28,"column":11},"end":{"line":28,"column":29}},"loc":{"start":{"line":28,"column":33},"end":{"line":39,"column":3}},"line":28},"5":{"name":"getImportCss","decl":{"start":{"line":41,"column":11},"end":{"line":41,"column":23}},"loc":{"start":{"line":41,"column":27},"end":{"line":52,"column":3}},"line":41},"6":{"name":"getPath","decl":{"start":{"line":54,"column":11},"end":{"line":54,"column":18}},"loc":{"start":{"line":54,"column":22},"end":{"line":61,"column":3}},"line":54},"7":{"name":"createTrimmedChunkName","decl":{"start":{"line":63,"column":11},"end":{"line":63,"column":33}},"loc":{"start":{"line":63,"column":49},"end":{"line":80,"column":3}},"line":63},"8":{"name":"(anonymous_8)","decl":{"start":{"line":71,"column":26},"end":{"line":71,"column":27}},"loc":{"start":{"line":71,"column":41},"end":{"line":71,"column":76}},"line":71},"9":{"name":"prepareQuasi","decl":{"start":{"line":82,"column":11},"end":{"line":82,"column":23}},"loc":{"start":{"line":82,"column":31},"end":{"line":88,"column":3}},"line":82},"10":{"name":"getMagicCommentChunkName","decl":{"start":{"line":90,"column":11},"end":{"line":90,"column":35}},"loc":{"start":{"line":90,"column":51},"end":{"line":98,"column":3}},"line":90},"11":{"name":"getComponentId","decl":{"start":{"line":100,"column":11},"end":{"line":100,"column":25}},"loc":{"start":{"line":100,"column":41},"end":{"line":109,"column":3}},"line":100},"12":{"name":"(anonymous_12)","decl":{"start":{"line":104,"column":25},"end":{"line":104,"column":26}},"loc":{"start":{"line":104,"column":44},"end":{"line":108,"column":5}},"line":104},"13":{"name":"idOption","decl":{"start":{"line":111,"column":11},"end":{"line":111,"column":19}},"loc":{"start":{"line":111,"column":35},"end":{"line":114,"column":3}},"line":111},"14":{"name":"fileOption","decl":{"start":{"line":116,"column":11},"end":{"line":116,"column":21}},"loc":{"start":{"line":116,"column":25},"end":{"line":121,"column":3}},"line":116},"15":{"name":"getCssOptionExpression","decl":{"start":{"line":123,"column":11},"end":{"line":123,"column":33}},"loc":{"start":{"line":123,"column":46},"end":{"line":141,"column":3}},"line":123},"16":{"name":"(anonymous_16)","decl":{"start":{"line":124,"column":48},"end":{"line":124,"column":49}},"loc":{"start":{"line":124,"column":69},"end":{"line":138,"column":5}},"line":124},"17":{"name":"loadOption","decl":{"start":{"line":143,"column":11},"end":{"line":143,"column":21}},"loc":{"start":{"line":143,"column":52},"end":{"line":159,"column":3}},"line":143},"18":{"name":"pathOption","decl":{"start":{"line":161,"column":11},"end":{"line":161,"column":21}},"loc":{"start":{"line":161,"column":40},"end":{"line":168,"column":3}},"line":161},"19":{"name":"resolveOption","decl":{"start":{"line":170,"column":11},"end":{"line":170,"column":24}},"loc":{"start":{"line":170,"column":40},"end":{"line":176,"column":3}},"line":170},"20":{"name":"chunkNameOption","decl":{"start":{"line":178,"column":11},"end":{"line":178,"column":26}},"loc":{"start":{"line":178,"column":42},"end":{"line":184,"column":3}},"line":178}},"branchMap":{"0":{"loc":{"start":{"line":29,"column":4},"end":{"line":36,"column":5}},"type":"if","locations":[{"start":{"line":29,"column":4},"end":{"line":36,"column":5}},{"start":{"line":29,"column":4},"end":{"line":36,"column":5}}],"line":29},"1":{"loc":{"start":{"line":42,"column":4},"end":{"line":49,"column":5}},"type":"if","locations":[{"start":{"line":42,"column":4},"end":{"line":49,"column":5}},{"start":{"line":42,"column":4},"end":{"line":49,"column":5}}],"line":42},"2":{"loc":{"start":{"line":55,"column":4},"end":{"line":58,"column":5}},"type":"if","locations":[{"start":{"line":55,"column":4},"end":{"line":58,"column":5}},{"start":{"line":55,"column":4},"end":{"line":58,"column":5}}],"line":55},"3":{"loc":{"start":{"line":64,"column":4},"end":{"line":76,"column":5}},"type":"if","locations":[{"start":{"line":64,"column":4},"end":{"line":76,"column":5}},{"start":{"line":64,"column":4},"end":{"line":76,"column":5}}],"line":64},"4":{"loc":{"start":{"line":71,"column":41},"end":{"line":71,"column":76}},"type":"cond-expr","locations":[{"start":{"line":71,"column":49},"end":{"line":71,"column":68}},{"start":{"line":71,"column":71},"end":{"line":71,"column":76}}],"line":71},"5":{"loc":{"start":{"line":92,"column":4},"end":{"line":92,"column":65}},"type":"if","locations":[{"start":{"line":92,"column":4},"end":{"line":92,"column":65}},{"start":{"line":92,"column":4},"end":{"line":92,"column":65}}],"line":92},"6":{"loc":{"start":{"line":96,"column":33},"end":{"line":96,"column":66}},"type":"cond-expr","locations":[{"start":{"line":96,"column":50},"end":{"line":96,"column":61}},{"start":{"line":96,"column":64},"end":{"line":96,"column":66}}],"line":96},"7":{"loc":{"start":{"line":102,"column":4},"end":{"line":102,"column":43}},"type":"if","locations":[{"start":{"line":102,"column":4},"end":{"line":102,"column":43}},{"start":{"line":102,"column":4},"end":{"line":102,"column":43}}],"line":102},"8":{"loc":{"start":{"line":106,"column":17},"end":{"line":106,"column":54}},"type":"binary-expr","locations":[{"start":{"line":106,"column":17},"end":{"line":106,"column":31}},{"start":{"line":106,"column":35},"end":{"line":106,"column":54}}],"line":106},"9":{"loc":{"start":{"line":107,"column":21},"end":{"line":107,"column":45}},"type":"cond-expr","locations":[{"start":{"line":107,"column":26},"end":{"line":107,"column":41}},{"start":{"line":107,"column":44},"end":{"line":107,"column":45}}],"line":107},"10":{"loc":{"start":{"line":128,"column":6},"end":{"line":135,"column":7}},"type":"if","locations":[{"start":{"line":128,"column":6},"end":{"line":135,"column":7}},{"start":{"line":128,"column":6},"end":{"line":135,"column":7}}],"line":128},"11":{"loc":{"start":{"line":190,"column":8},"end":{"line":190,"column":30}},"type":"if","locations":[{"start":{"line":190,"column":8},"end":{"line":190,"column":30}},{"start":{"line":190,"column":8},"end":{"line":190,"column":30}}],"line":190},"12":{"loc":{"start":{"line":200,"column":8},"end":{"line":210,"column":9}},"type":"if","locations":[{"start":{"line":200,"column":8},"end":{"line":210,"column":9}},{"start":{"line":200,"column":8},"end":{"line":210,"column":9}}],"line":200},"13":{"loc":{"start":{"line":201,"column":10},"end":{"line":202,"column":59}},"type":"binary-expr","locations":[{"start":{"line":201,"column":10},"end":{"line":201,"column":53}},{"start":{"line":202,"column":10},"end":{"line":202,"column":59}}],"line":201},"14":{"loc":{"start":{"line":212,"column":21},"end":{"line":227,"column":11}},"type":"cond-expr","locations":[{"start":{"line":213,"column":12},"end":{"line":219,"column":11}},{"start":{"line":220,"column":12},"end":{"line":227,"column":11}}],"line":212}},"s":{"0":1,"1":2,"2":2,"3":2,"4":2,"5":2,"6":2,"7":2,"8":2,"9":25,"10":36,"11":11,"12":13,"13":13,"14":13,"15":13,"16":12,"17":12,"18":12,"19":12,"20":12,"21":12,"22":12,"23":12,"24":24,"25":15,"26":15,"27":15,"28":15,"29":26,"30":15,"31":9,"32":9,"33":11,"34":11,"35":12,"36":12,"37":4,"38":8,"39":8,"40":8,"41":8,"42":12,"43":12,"44":5,"45":7,"46":12,"47":12,"48":12,"49":12,"50":12,"51":12,"52":12,"53":12,"54":12,"55":12,"56":1,"57":1,"58":12,"59":12,"60":12,"61":12,"62":12,"63":12,"64":12,"65":12,"66":12,"67":12,"68":12,"69":12,"70":12,"71":12,"72":12,"73":2,"74":25,"75":12,"76":13,"77":13,"78":13,"79":13,"80":13,"81":1,"82":1,"83":12,"84":12,"85":12,"86":12},"f":{"0":2,"1":25,"2":36,"3":11,"4":13,"5":12,"6":12,"7":24,"8":26,"9":11,"10":12,"11":12,"12":12,"13":12,"14":12,"15":12,"16":12,"17":12,"18":12,"19":12,"20":12},"b":{"0":[13,0],"1":[12,0],"2":[12,0],"3":[15,9],"4":[11,15],"5":[4,8],"6":[6,2],"7":[5,7],"8":[12,5],"9":[5,7],"10":[1,11],"11":[12,13],"12":[1,12],"13":[13,13],"14":[1,11]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"cb2d3ec274075f265989aa4d78ec29a20e5a5224"}
{"/home/travis/build/faceyspacey/babel-plugin-universal-import/index.js": {"path":"/home/travis/build/faceyspacey/babel-plugin-universal-import/index.js","statementMap":{"0":{"start":{"line":3,"column":23},"end":{"line":3,"column":62}},"1":{"start":{"line":5,"column":16},"end":{"line":5,"column":33}},"2":{"start":{"line":7,"column":33},"end":{"line":11,"column":1}},"3":{"start":{"line":13,"column":27},"end":{"line":17,"column":1}},"4":{"start":{"line":19,"column":28},"end":{"line":23,"column":1}},"5":{"start":{"line":26,"column":2},"end":{"line":26,"column":41}},"6":{"start":{"line":30,"column":2},"end":{"line":30,"column":47}},"7":{"start":{"line":34,"column":2},"end":{"line":34,"column":33}},"8":{"start":{"line":38,"column":2},"end":{"line":40,"column":3}},"9":{"start":{"line":39,"column":4},"end":{"line":39,"column":56}},"10":{"start":{"line":42,"column":2},"end":{"line":42,"column":23}},"11":{"start":{"line":46,"column":2},"end":{"line":58,"column":3}},"12":{"start":{"line":47,"column":17},"end":{"line":47,"column":46}},"13":{"start":{"line":48,"column":20},"end":{"line":48,"column":64}},"14":{"start":{"line":49,"column":4},"end":{"line":51,"column":6}},"15":{"start":{"line":53,"column":4},"end":{"line":53,"column":76}},"16":{"start":{"line":53,"column":39},"end":{"line":53,"column":74}},"17":{"start":{"line":55,"column":4},"end":{"line":57,"column":6}},"18":{"start":{"line":60,"column":21},"end":{"line":60,"column":62}},"19":{"start":{"line":61,"column":2},"end":{"line":61,"column":36}},"20":{"start":{"line":65,"column":18},"end":{"line":65,"column":58}},"21":{"start":{"line":67,"column":2},"end":{"line":69,"column":4}},"22":{"start":{"line":73,"column":34},"end":{"line":73,"column":47}},"23":{"start":{"line":74,"column":2},"end":{"line":74,"column":63}},"24":{"start":{"line":74,"column":15},"end":{"line":74,"column":63}},"25":{"start":{"line":76,"column":18},"end":{"line":76,"column":40}},"26":{"start":{"line":77,"column":25},"end":{"line":77,"column":47}},"27":{"start":{"line":78,"column":20},"end":{"line":78,"column":65}},"28":{"start":{"line":79,"column":2},"end":{"line":79,"column":40}},"29":{"start":{"line":83,"column":34},"end":{"line":83,"column":47}},"30":{"start":{"line":84,"column":2},"end":{"line":84,"column":41}},"31":{"start":{"line":84,"column":15},"end":{"line":84,"column":41}},"32":{"start":{"line":86,"column":2},"end":{"line":91,"column":8}},"33":{"start":{"line":87,"column":14},"end":{"line":87,"column":32}},"34":{"start":{"line":88,"column":15},"end":{"line":88,"column":52}},"35":{"start":{"line":89,"column":4},"end":{"line":89,"column":35}},"36":{"start":{"line":90,"column":4},"end":{"line":90,"column":14}},"37":{"start":{"line":95,"column":13},"end":{"line":95,"column":45}},"38":{"start":{"line":96,"column":2},"end":{"line":96,"column":66}},"39":{"start":{"line":100,"column":2},"end":{"line":103,"column":3}},"40":{"start":{"line":107,"column":15},"end":{"line":121,"column":8}},"41":{"start":{"line":108,"column":22},"end":{"line":108,"column":40}},"42":{"start":{"line":109,"column":23},"end":{"line":109,"column":39}},"43":{"start":{"line":111,"column":4},"end":{"line":118,"column":5}},"44":{"start":{"line":112,"column":29},"end":{"line":115,"column":7}},"45":{"start":{"line":117,"column":6},"end":{"line":117,"column":34}},"46":{"start":{"line":120,"column":4},"end":{"line":120,"column":18}},"47":{"start":{"line":123,"column":2},"end":{"line":123,"column":33}},"48":{"start":{"line":127,"column":18},"end":{"line":127,"column":37}},"49":{"start":{"line":128,"column":20},"end":{"line":128,"column":59}},"50":{"start":{"line":130,"column":2},"end":{"line":130,"column":37}},"51":{"start":{"line":131,"column":2},"end":{"line":131,"column":69}},"52":{"start":{"line":133,"column":18},"end":{"line":133,"column":55}},"53":{"start":{"line":134,"column":15},"end":{"line":139,"column":15}},"54":{"start":{"line":141,"column":2},"end":{"line":141,"column":53}},"55":{"start":{"line":145,"column":15},"end":{"line":148,"column":15}},"56":{"start":{"line":150,"column":2},"end":{"line":150,"column":53}},"57":{"start":{"line":154,"column":18},"end":{"line":156,"column":15}},"58":{"start":{"line":158,"column":2},"end":{"line":158,"column":59}},"59":{"start":{"line":162,"column":20},"end":{"line":164,"column":15}},"60":{"start":{"line":166,"column":2},"end":{"line":166,"column":63}},"61":{"start":{"line":169,"column":0},"end":{"line":228,"column":1}},"62":{"start":{"line":170,"column":28},"end":{"line":170,"column":52}},"63":{"start":{"line":171,"column":23},"end":{"line":171,"column":69}},"64":{"start":{"line":172,"column":26},"end":{"line":172,"column":71}},"65":{"start":{"line":173,"column":23},"end":{"line":175,"column":3}},"66":{"start":{"line":177,"column":2},"end":{"line":227,"column":3}},"67":{"start":{"line":181,"column":8},"end":{"line":181,"column":30}},"68":{"start":{"line":181,"column":24},"end":{"line":181,"column":30}},"69":{"start":{"line":182,"column":8},"end":{"line":182,"column":25}},"70":{"start":{"line":184,"column":30},"end":{"line":184,"column":54}},"71":{"start":{"line":185,"column":32},"end":{"line":185,"column":70}},"72":{"start":{"line":186,"column":27},"end":{"line":188,"column":9}},"73":{"start":{"line":191,"column":8},"end":{"line":202,"column":9}},"74":{"start":{"line":195,"column":23},"end":{"line":198,"column":12}},"75":{"start":{"line":200,"column":10},"end":{"line":200,"column":40}},"76":{"start":{"line":201,"column":10},"end":{"line":201,"column":16}},"77":{"start":{"line":204,"column":21},"end":{"line":219,"column":11}},"78":{"start":{"line":221,"column":24},"end":{"line":221,"column":48}},"79":{"start":{"line":223,"column":21},"end":{"line":223,"column":65}},"80":{"start":{"line":224,"column":8},"end":{"line":224,"column":38}}},"fnMap":{"0":{"name":"getImportArgPath","decl":{"start":{"line":25,"column":9},"end":{"line":25,"column":25}},"loc":{"start":{"line":25,"column":29},"end":{"line":27,"column":1}},"line":25},"1":{"name":"trimChunkNameBaseDir","decl":{"start":{"line":29,"column":9},"end":{"line":29,"column":29}},"loc":{"start":{"line":29,"column":39},"end":{"line":31,"column":1}},"line":29},"2":{"name":"prepareChunkNamePath","decl":{"start":{"line":33,"column":9},"end":{"line":33,"column":29}},"loc":{"start":{"line":33,"column":36},"end":{"line":35,"column":1}},"line":33},"3":{"name":"getImport","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":18}},"loc":{"start":{"line":37,"column":48},"end":{"line":43,"column":1}},"line":37},"4":{"name":"createTrimmedChunkName","decl":{"start":{"line":45,"column":9},"end":{"line":45,"column":31}},"loc":{"start":{"line":45,"column":50},"end":{"line":62,"column":1}},"line":45},"5":{"name":"(anonymous_5)","decl":{"start":{"line":53,"column":24},"end":{"line":53,"column":25}},"loc":{"start":{"line":53,"column":39},"end":{"line":53,"column":74}},"line":53},"6":{"name":"prepareQuasi","decl":{"start":{"line":64,"column":9},"end":{"line":64,"column":21}},"loc":{"start":{"line":64,"column":29},"end":{"line":70,"column":1}},"line":64},"7":{"name":"getMagicCommentChunkName","decl":{"start":{"line":72,"column":9},"end":{"line":72,"column":33}},"loc":{"start":{"line":72,"column":49},"end":{"line":80,"column":1}},"line":72},"8":{"name":"getComponentId","decl":{"start":{"line":82,"column":9},"end":{"line":82,"column":23}},"loc":{"start":{"line":82,"column":42},"end":{"line":92,"column":1}},"line":82},"9":{"name":"(anonymous_9)","decl":{"start":{"line":86,"column":23},"end":{"line":86,"column":24}},"loc":{"start":{"line":86,"column":42},"end":{"line":91,"column":3}},"line":86},"10":{"name":"idOption","decl":{"start":{"line":94,"column":9},"end":{"line":94,"column":17}},"loc":{"start":{"line":94,"column":36},"end":{"line":97,"column":1}},"line":94},"11":{"name":"fileOption","decl":{"start":{"line":99,"column":9},"end":{"line":99,"column":19}},"loc":{"start":{"line":99,"column":26},"end":{"line":104,"column":1}},"line":99},"12":{"name":"getCssOptionExpression","decl":{"start":{"line":106,"column":9},"end":{"line":106,"column":31}},"loc":{"start":{"line":106,"column":47},"end":{"line":124,"column":1}},"line":106},"13":{"name":"(anonymous_13)","decl":{"start":{"line":107,"column":46},"end":{"line":107,"column":47}},"loc":{"start":{"line":107,"column":67},"end":{"line":121,"column":3}},"line":107},"14":{"name":"loadOption","decl":{"start":{"line":126,"column":9},"end":{"line":126,"column":19}},"loc":{"start":{"line":126,"column":67},"end":{"line":142,"column":1}},"line":126},"15":{"name":"pathOption","decl":{"start":{"line":144,"column":9},"end":{"line":144,"column":19}},"loc":{"start":{"line":144,"column":55},"end":{"line":151,"column":1}},"line":144},"16":{"name":"resolveOption","decl":{"start":{"line":153,"column":9},"end":{"line":153,"column":22}},"loc":{"start":{"line":153,"column":58},"end":{"line":159,"column":1}},"line":153},"17":{"name":"chunkNameOption","decl":{"start":{"line":161,"column":9},"end":{"line":161,"column":24}},"loc":{"start":{"line":161,"column":62},"end":{"line":167,"column":1}},"line":161},"18":{"name":"universalImportPlugin","decl":{"start":{"line":169,"column":26},"end":{"line":169,"column":47}},"loc":{"start":{"line":169,"column":72},"end":{"line":228,"column":1}},"line":169}},"branchMap":{"0":{"loc":{"start":{"line":38,"column":2},"end":{"line":40,"column":3}},"type":"if","locations":[{"start":{"line":38,"column":2},"end":{"line":40,"column":3}},{"start":{"line":38,"column":2},"end":{"line":40,"column":3}}],"line":38},"1":{"loc":{"start":{"line":46,"column":2},"end":{"line":58,"column":3}},"type":"if","locations":[{"start":{"line":46,"column":2},"end":{"line":58,"column":3}},{"start":{"line":46,"column":2},"end":{"line":58,"column":3}}],"line":46},"2":{"loc":{"start":{"line":53,"column":39},"end":{"line":53,"column":74}},"type":"cond-expr","locations":[{"start":{"line":53,"column":47},"end":{"line":53,"column":66}},{"start":{"line":53,"column":69},"end":{"line":53,"column":74}}],"line":53},"3":{"loc":{"start":{"line":74,"column":2},"end":{"line":74,"column":63}},"type":"if","locations":[{"start":{"line":74,"column":2},"end":{"line":74,"column":63}},{"start":{"line":74,"column":2},"end":{"line":74,"column":63}}],"line":74},"4":{"loc":{"start":{"line":78,"column":31},"end":{"line":78,"column":64}},"type":"cond-expr","locations":[{"start":{"line":78,"column":48},"end":{"line":78,"column":59}},{"start":{"line":78,"column":62},"end":{"line":78,"column":64}}],"line":78},"5":{"loc":{"start":{"line":84,"column":2},"end":{"line":84,"column":41}},"type":"if","locations":[{"start":{"line":84,"column":2},"end":{"line":84,"column":41}},{"start":{"line":84,"column":2},"end":{"line":84,"column":41}}],"line":84},"6":{"loc":{"start":{"line":88,"column":15},"end":{"line":88,"column":52}},"type":"binary-expr","locations":[{"start":{"line":88,"column":15},"end":{"line":88,"column":29}},{"start":{"line":88,"column":33},"end":{"line":88,"column":52}}],"line":88},"7":{"loc":{"start":{"line":89,"column":11},"end":{"line":89,"column":35}},"type":"cond-expr","locations":[{"start":{"line":89,"column":16},"end":{"line":89,"column":31}},{"start":{"line":89,"column":34},"end":{"line":89,"column":35}}],"line":89},"8":{"loc":{"start":{"line":111,"column":4},"end":{"line":118,"column":5}},"type":"if","locations":[{"start":{"line":111,"column":4},"end":{"line":118,"column":5}},{"start":{"line":111,"column":4},"end":{"line":118,"column":5}}],"line":111},"9":{"loc":{"start":{"line":181,"column":8},"end":{"line":181,"column":30}},"type":"if","locations":[{"start":{"line":181,"column":8},"end":{"line":181,"column":30}},{"start":{"line":181,"column":8},"end":{"line":181,"column":30}}],"line":181},"10":{"loc":{"start":{"line":191,"column":8},"end":{"line":202,"column":9}},"type":"if","locations":[{"start":{"line":191,"column":8},"end":{"line":202,"column":9}},{"start":{"line":191,"column":8},"end":{"line":202,"column":9}}],"line":191},"11":{"loc":{"start":{"line":192,"column":10},"end":{"line":193,"column":59}},"type":"binary-expr","locations":[{"start":{"line":192,"column":10},"end":{"line":192,"column":53}},{"start":{"line":193,"column":10},"end":{"line":193,"column":59}}],"line":192},"12":{"loc":{"start":{"line":204,"column":21},"end":{"line":219,"column":11}},"type":"cond-expr","locations":[{"start":{"line":205,"column":12},"end":{"line":211,"column":11}},{"start":{"line":212,"column":12},"end":{"line":219,"column":11}}],"line":204}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":25,"6":36,"7":11,"8":37,"9":37,"10":37,"11":24,"12":15,"13":15,"14":15,"15":15,"16":26,"17":15,"18":9,"19":9,"20":11,"21":11,"22":12,"23":12,"24":4,"25":8,"26":8,"27":8,"28":8,"29":12,"30":12,"31":5,"32":7,"33":12,"34":12,"35":12,"36":12,"37":12,"38":12,"39":12,"40":12,"41":12,"42":12,"43":12,"44":1,"45":1,"46":12,"47":12,"48":12,"49":12,"50":12,"51":12,"52":12,"53":12,"54":12,"55":12,"56":12,"57":12,"58":12,"59":12,"60":12,"61":1,"62":14,"63":14,"64":14,"65":14,"66":14,"67":25,"68":12,"69":13,"70":13,"71":13,"72":13,"73":13,"74":1,"75":1,"76":1,"77":12,"78":12,"79":12,"80":12},"f":{"0":25,"1":36,"2":11,"3":37,"4":24,"5":26,"6":11,"7":12,"8":12,"9":12,"10":12,"11":12,"12":12,"13":12,"14":12,"15":12,"16":12,"17":12,"18":14},"b":{"0":[37,0],"1":[15,9],"2":[11,15],"3":[4,8],"4":[6,2],"5":[5,7],"6":[12,5],"7":[5,7],"8":[1,11],"9":[12,13],"10":[1,12],"11":[13,13],"12":[1,11]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"86173a3924c4e2158da437651720faefd2646991"}
}
'use-strict'
module.exports = function ({ types: t, template }) {
const visited = Symbol('visited')
const universalImportId = Symbol('universalImportId')
const importCssId = Symbol('importCssId')
const pathId = Symbol('pathId')
const { addDefault } = require('@babel/helper-module-imports')
const chunkNameTemplate = template('() => MODULE')
const pathTemplate = template('() => PATH.join(__dirname, MODULE)')
const resolveTemplate = template('() => require.resolveWeak(MODULE)')
const loadTemplate = template(
'() => Promise.all([IMPORT, IMPORT_CSS(MODULE, CSS_OPTIONS)]).then(proms => proms[0])'
)
const visited = Symbol('visited')
function getImportArgPath(p) {
return p.parentPath.get('arguments')[0]
}
const IMPORT_UNIVERSAL_DEFAULT = {
id: Symbol('universalImportId'),
source: 'babel-plugin-universal-import/universalImport',
nameHint: 'universalImport'
}
function trimChunkNameBaseDir(baseDir) {
return baseDir.replace(/^[./]+|(\.js$)/g, '')
}
const IMPORT_CSS_DEFAULT = {
id: Symbol('importCssId'),
source: 'babel-plugin-universal-import/importCss',
nameHint: 'importCss'
}
function prepareChunkNamePath(path) {
return path.replace(/\//g, '-')
}
const IMPORT_PATH_DEFAULT = {
id: Symbol('pathId'),
source: 'path',
nameHint: 'path'
}
function getUniversalImport(p) {
if (!p.hub.file[universalImportId]) {
const universal = p.hub.file.addImport(
'babel-plugin-universal-import/universalImport.js',
'default',
'universalImport'
)
p.hub.file[universalImportId] = universal
}
function getImportArgPath(p) {
return p.parentPath.get('arguments')[0]
}
return p.hub.file[universalImportId]
}
function trimChunkNameBaseDir(baseDir) {
return baseDir.replace(/^[./]+|(\.js$)/g, '')
}
function getImportCss(p) {
if (!p.hub.file[importCssId]) {
const importCss = p.hub.file.addImport(
'babel-plugin-universal-import/importCss.js',
'default',
'importCss'
)
p.hub.file[importCssId] = importCss
}
function prepareChunkNamePath(path) {
return path.replace(/\//g, '-')
}
return p.hub.file[importCssId]
function getImport(p, { id, source, nameHint }) {
if (!p.hub.file[id]) {
p.hub.file[id] = addDefault(p, source, { nameHint })
}
function getPath(p) {
if (!p.hub.file[pathId]) {
const path = p.hub.file.addImport('path', 'default', 'path')
p.hub.file[pathId] = path
}
return p.hub.file[id]
}
return p.hub.file[pathId]
}
function createTrimmedChunkName(t, importArgNode) {
if (importArgNode.quasis) {
let quasis = importArgNode.quasis.slice(0)
const baseDir = trimChunkNameBaseDir(quasis[0].value.cooked)
quasis[0] = Object.assign({}, quasis[0], {
value: { raw: baseDir, cooked: baseDir }
})
function createTrimmedChunkName(importArgNode) {
if (importArgNode.quasis) {
let quasis = importArgNode.quasis.slice(0)
const baseDir = trimChunkNameBaseDir(quasis[0].value.cooked)
quasis[0] = Object.assign({}, quasis[0], {
value: { raw: baseDir, cooked: baseDir }
})
quasis = quasis.map((quasi, i) => (i > 0 ? prepareQuasi(quasi) : quasi))
quasis = quasis.map((quasi, i) => (i > 0 ? prepareQuasi(quasi) : quasi))
return Object.assign({}, importArgNode, {
quasis
})
}
return Object.assign({}, importArgNode, {
quasis
})
}
const moduleName = trimChunkNameBaseDir(importArgNode.value)
return t.stringLiteral(moduleName)
}
const moduleName = trimChunkNameBaseDir(importArgNode.value)
return t.stringLiteral(moduleName)
}
function prepareQuasi(quasi) {
const newPath = prepareChunkNamePath(quasi.value.cooked)
function prepareQuasi(quasi) {
const newPath = prepareChunkNamePath(quasi.value.cooked)
return Object.assign({}, quasi, {
value: { raw: newPath, cooked: newPath }
})
}
return Object.assign({}, quasi, {
value: { raw: newPath, cooked: newPath }
})
}
function getMagicCommentChunkName(importArgNode) {
const { quasis, expressions } = importArgNode
if (!quasis) return trimChunkNameBaseDir(importArgNode.value)
function getMagicCommentChunkName(importArgNode) {
const { quasis, expressions } = importArgNode
if (!quasis) return trimChunkNameBaseDir(importArgNode.value)
const baseDir = quasis[0].value.cooked
const hasExpressions = expressions.length > 0
const chunkName = baseDir + (hasExpressions ? '[request]' : '')
return trimChunkNameBaseDir(chunkName)
}
const baseDir = quasis[0].value.cooked
const hasExpressions = expressions.length > 0
const chunkName = baseDir + (hasExpressions ? '[request]' : '')
return trimChunkNameBaseDir(chunkName)
}
function getComponentId(t, importArgNode) {
const { quasis, expressions } = importArgNode
if (!quasis) return importArgNode.value
function getComponentId(importArgNode) {
const { quasis, expressions } = importArgNode
if (!quasis) return importArgNode.value
return quasis.reduce((str, quasi, i) => {
const q = quasi.value.cooked
const id = expressions[i] && expressions[i].name
str += id ? `${q}\${${id}}` : q
return str
}, '')
}
return quasis.reduce((str, quasi, i) => {
const q = quasi.value.cooked
const id = expressions[i] && expressions[i].name
return (str += id ? `${q}\${${id}}` : q)
}, '')
}
function idOption(t, importArgNode) {
const id = getComponentId(t, importArgNode)
return t.objectProperty(t.identifier('id'), t.stringLiteral(id))
}
function idOption(importArgNode) {
const id = getComponentId(importArgNode)
return t.objectProperty(t.identifier('id'), t.stringLiteral(id))
}
function fileOption(t, p) {
return t.objectProperty(
t.identifier('file'),
t.stringLiteral(p.hub.file.opts.filename)
)
}
function fileOption(p) {
return t.objectProperty(
t.identifier('file'),
t.stringLiteral(p.hub.file.opts.filename)
)
}
function getCssOptionExpression(t, cssOptions) {
const opts = Object.keys(cssOptions).reduce((options, option) => {
const cssOption = cssOptions[option]
const optionType = typeof cssOption
function getCssOptionExpression(cssOptions) {
const opts = Object.keys(cssOptions).reduce((options, option) => {
const cssOption = cssOptions[option]
const optionType = typeof cssOption
if (optionType !== 'undefined') {
const optionProperty = t.objectProperty(
t.identifier(option),
t[`${optionType}Literal`](cssOption)
)
if (optionType !== 'undefined') {
const optionProperty = t.objectProperty(
t.identifier(option),
t[`${optionType}Literal`](cssOption)
)
options.push(optionProperty)
}
options.push(optionProperty)
}
return options
}, [])
return options
}, [])
return t.objectExpression(opts)
}
return t.objectExpression(opts)
}
function loadOption(t, loadTemplate, p, importArgNode, cssOptions) {
const argPath = getImportArgPath(p)
const chunkName = getMagicCommentChunkName(importArgNode)
function loadOption(p, importArgNode, cssOptions) {
const argPath = getImportArgPath(p)
const chunkName = getMagicCommentChunkName(importArgNode)
delete argPath.node.leadingComments
argPath.addComment('leading', ` webpackChunkName: '${chunkName}' `)
delete argPath.node.leadingComments
argPath.addComment('leading', ` webpackChunkName: '${chunkName}' `)
const cssOpts = getCssOptionExpression(t, cssOptions)
const load = loadTemplate({
IMPORT: argPath.parent,
IMPORT_CSS: getImport(p, IMPORT_CSS_DEFAULT),
MODULE: createTrimmedChunkName(t, importArgNode),
CSS_OPTIONS: cssOpts
}).expression
const cssOpts = getCssOptionExpression(cssOptions)
const load = loadTemplate({
IMPORT: argPath.parent,
IMPORT_CSS: getImportCss(p),
MODULE: createTrimmedChunkName(importArgNode),
CSS_OPTIONS: cssOpts
}).expression
return t.objectProperty(t.identifier('load'), load)
}
return t.objectProperty(t.identifier('load'), load)
}
function pathOption(t, pathTemplate, p, importArgNode) {
const path = pathTemplate({
PATH: getImport(p, IMPORT_PATH_DEFAULT),
MODULE: importArgNode
}).expression
function pathOption(p, importArgNode) {
const path = pathTemplate({
PATH: getPath(p),
MODULE: importArgNode
}).expression
return t.objectProperty(t.identifier('path'), path)
}
return t.objectProperty(t.identifier('path'), path)
}
function resolveOption(t, resolveTemplate, importArgNode) {
const resolve = resolveTemplate({
MODULE: importArgNode
}).expression
function resolveOption(importArgNode) {
const resolve = resolveTemplate({
MODULE: importArgNode
}).expression
return t.objectProperty(t.identifier('resolve'), resolve)
}
return t.objectProperty(t.identifier('resolve'), resolve)
}
function chunkNameOption(t, chunkNameTemplate, importArgNode) {
const chunkName = chunkNameTemplate({
MODULE: createTrimmedChunkName(t, importArgNode)
}).expression
function chunkNameOption(importArgNode) {
const chunkName = chunkNameTemplate({
MODULE: createTrimmedChunkName(importArgNode)
}).expression
return t.objectProperty(t.identifier('chunkName'), chunkName)
}
return t.objectProperty(t.identifier('chunkName'), chunkName)
}
module.exports = function universalImportPlugin({ types: t, template }) {
const chunkNameTemplate = template('() => MODULE')
const pathTemplate = template('() => PATH.join(__dirname, MODULE)')
const resolveTemplate = template('() => require.resolveWeak(MODULE)')
const loadTemplate = template(
'() => Promise.all([IMPORT, IMPORT_CSS(MODULE, CSS_OPTIONS)]).then(proms => proms[0])'
)

@@ -194,3 +185,3 @@ return {

const importArgNode = getImportArgPath(p).node
const universalImport = getUniversalImport(p)
const universalImport = getImport(p, IMPORT_UNIVERSAL_DEFAULT)
const cssOptions = {

@@ -206,7 +197,8 @@ disableWarnings: this.opts.disableWarnings

const func = t.callExpression(universalImport, [
loadOption(p, importArgNode, cssOptions).value,
loadOption(t, loadTemplate, p, importArgNode, cssOptions).value,
t.booleanLiteral(false)
])
return p.parentPath.replaceWith(func)
p.parentPath.replaceWith(func)
return
}

@@ -216,15 +208,15 @@

? [
idOption(importArgNode),
fileOption(p),
pathOption(p, importArgNode),
resolveOption(importArgNode),
chunkNameOption(importArgNode)
idOption(t, importArgNode),
fileOption(t, p),
pathOption(t, pathTemplate, p, importArgNode),
resolveOption(t, resolveTemplate, importArgNode),
chunkNameOption(t, chunkNameTemplate, importArgNode)
]
: [
idOption(importArgNode),
fileOption(p),
loadOption(p, importArgNode, cssOptions), // only when not on a babel-server
pathOption(p, importArgNode),
resolveOption(importArgNode),
chunkNameOption(importArgNode)
idOption(t, importArgNode),
fileOption(t, p),
loadOption(t, loadTemplate, p, importArgNode, cssOptions), // only when not on a babel-server
pathOption(t, pathTemplate, p, importArgNode),
resolveOption(t, resolveTemplate, importArgNode),
chunkNameOption(t, chunkNameTemplate, importArgNode)
]

@@ -240,2 +232,1 @@

}
{
"name": "babel-plugin-universal-import",
"version": "1.3.3",
"version": "1.3.4",
"description": "Babel plugin to transform import() into its Universal counterpart",

@@ -20,3 +20,3 @@ "main": "index.js",

"format": "prettier --single-quote --parser=flow --semi=false --write '{src,__tests__,__test-helpers__}/**/*.js' && npm run lint",
"precommit": "lint-staged --verbose && npm test",
"precommit": "lint-staged && npm test",
"cm": "git-cz",

@@ -26,10 +26,12 @@ "semantic-release": "semantic-release pre && npm publish && semantic-release post"

"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-tester": "^3.1.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"@babel/cli": "^7.0.0-beta.32",
"@babel/core": "^7.0.0-beta.32",
"@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.32",
"@babel/preset-es2015": "^7.0.0-beta.32",
"@babel/preset-react": "^7.0.0-beta.32",
"@babel/preset-stage-2": "^7.0.0-beta.32",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.0.2",
"babel-jest": "^21.2.0",
"babel-plugin-tester": "^5.0.0",
"babylon-options": "^1.1.2",

@@ -45,4 +47,4 @@ "commitizen": "^2.9.6",

"husky": "^0.14.1",
"jest": "^20.0.4",
"lint-staged": "^4.0.0",
"jest": "^21.2.1",
"lint-staged": "^5.0.0",
"prettier": "^1.5.2",

@@ -59,9 +61,14 @@ "rimraf": "^2.5.4",

"lint-staged": {
"*.js": [
"prettier --single-quote --parser=flow --semi=false --write",
"eslint --fix",
"git add"
]
"linters": {
"*.js": [
"prettier --single-quote --parser=flow --semi=false --write",
"eslint --fix",
"git add"
]
},
"verbose": true
},
"dependencies": {}
"dependencies": {
"@babel/helper-module-imports": "^7.0.0-beta.32"
}
}

@@ -200,2 +200,1 @@ <a href="https://gitter.im/Reactlandia/Lobby" target="_blank">

- [redux-first-router](https://github.com/faceyspacey/redux-first-router). It's made to work perfectly with *Universal*. Together they comprise our *"frameworkless"* Redux-based approach to what Next.js does (splitting, SSR, prefetching, routing).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc