UNPKG

whats-that-gerber

Version:

Identify Gerber and drill files by filenamee

2 lines 8.84 kB
var whatsThatGerber=function(_){var t={};function e(A){if(t[A])return t[A].exports;var c=t[A]={i:A,l:!1,exports:{}};return _[A].call(c.exports,c,c.exports,e),c.l=!0,c.exports}return e.m=_,e.c=t,e.d=function(_,t,A){e.o(_,t)||Object.defineProperty(_,t,{enumerable:!0,get:A})},e.r=function(_){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})},e.t=function(_,t){if(1&t&&(_=e(_)),8&t)return _;if(4&t&&"object"==typeof _&&_&&_.__esModule)return _;var A=Object.create(null);if(e.r(A),Object.defineProperty(A,"default",{enumerable:!0,value:_}),2&t&&"string"!=typeof _)for(var c in _)e.d(A,c,function(t){return _[t]}.bind(null,c));return A},e.n=function(_){var t=_&&_.__esModule?function(){return _.default}:function(){return _};return e.d(t,"a",t),t},e.o=function(_,t){return Object.prototype.hasOwnProperty.call(_,t)},e.p="",e(e.s=3)}([function(_,t,e){"use strict";_.exports={TYPE_COPPER:"copper",TYPE_SOLDERMASK:"soldermask",TYPE_SILKSCREEN:"silkscreen",TYPE_SOLDERPASTE:"solderpaste",TYPE_DRILL:"drill",TYPE_OUTLINE:"outline",TYPE_DRAWING:"drawing",SIDE_TOP:"top",SIDE_BOTTOM:"bottom",SIDE_INNER:"inner",SIDE_ALL:"all",_CAD_KICAD:"kicad",_CAD_ALTIUM:"altium",_CAD_ALLEGRO:"allegro",_CAD_EAGLE:"eagle",_CAD_EAGLE_LEGACY:"eagle-legacy",_CAD_EAGLE_OSHPARK:"eagle-oshpark",_CAD_EAGLE_PCBNG:"eagle-pcbng",_CAD_GEDA_PCB:"geda-pcb",_CAD_ORCAD:"orcad",_CAD_DIPTRACE:"diptrace"}},function(_,t,e){"use strict";_.exports=function(_,t){return _.reduce((function(_,e){return _.concat(t(e))}),[])}},function(_,t,e){"use strict";var A=e(0);_.exports=[{type:null,side:null,matchers:[{ext:"gpi",cad:[A._CAD_EAGLE,A._CAD_EAGLE_LEGACY,A._CAD_EAGLE_OSHPARK,A._CAD_EAGLE_PCBNG]},{ext:"dri",cad:[A._CAD_EAGLE,A._CAD_EAGLE_LEGACY,A._CAD_EAGLE_OSHPARK,A._CAD_EAGLE_PCBNG]},{ext:"csv",cad:null},{match:/pnp_bom/,cad:A._CAD_EAGLE_PCBNG}]},{type:A.TYPE_COPPER,side:A.SIDE_TOP,matchers:[{ext:"cmp",cad:A._CAD_EAGLE_LEGACY},{ext:"top",cad:[A._CAD_EAGLE_LEGACY,A._CAD_ORCAD]},{ext:"gtl",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"toplayer\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/top\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/f[._]cu/,cad:A._CAD_KICAD},{match:/copper_top/,cad:A._CAD_EAGLE},{match:/top_copper/,cad:A._CAD_EAGLE_PCBNG},{match:/top copper/,cad:null}]},{type:A.TYPE_SOLDERMASK,side:A.SIDE_TOP,matchers:[{ext:"stc",cad:A._CAD_EAGLE_LEGACY},{ext:"tsm",cad:A._CAD_EAGLE_LEGACY},{ext:"gts",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"smt",cad:A._CAD_ORCAD},{ext:"topsoldermask\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/topmask\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/f[._]mask/,cad:A._CAD_KICAD},{match:/soldermask_top/,cad:A._CAD_EAGLE},{match:/top_mask/,cad:A._CAD_EAGLE_PCBNG},{match:/top solder resist/,cad:null}]},{type:A.TYPE_SILKSCREEN,side:A.SIDE_TOP,matchers:[{ext:"plc",cad:A._CAD_EAGLE_LEGACY},{ext:"tsk",cad:A._CAD_EAGLE_LEGACY},{ext:"gto",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"sst",cad:A._CAD_ORCAD},{ext:"topsilkscreen\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/topsilk\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/f[._]silks/,cad:A._CAD_KICAD},{match:/silkscreen_top/,cad:A._CAD_EAGLE},{match:/top_silk/,cad:A._CAD_EAGLE_PCBNG},{match:/top silk screen/,cad:null}]},{type:A.TYPE_SOLDERPASTE,side:A.SIDE_TOP,matchers:[{ext:"crc",cad:A._CAD_EAGLE_LEGACY},{ext:"tsp",cad:A._CAD_EAGLE_LEGACY},{ext:"gtp",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"spt",cad:A._CAD_ORCAD},{ext:"tcream\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/toppaste\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/f[._]paste/,cad:A._CAD_KICAD},{match:/solderpaste_top/,cad:A._CAD_EAGLE},{match:/top_paste/,cad:A._CAD_EAGLE_PCBNG}]},{type:A.TYPE_COPPER,side:A.SIDE_BOTTOM,matchers:[{ext:"sol",cad:A._CAD_EAGLE_LEGACY},{ext:"bot",cad:[A._CAD_EAGLE_LEGACY,A._CAD_ORCAD]},{ext:"gbl",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"bottomlayer\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/bottom\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/b[._]cu/,cad:A._CAD_KICAD},{match:/copper_bottom/,cad:A._CAD_EAGLE},{match:/bottom_copper/,cad:A._CAD_EAGLE_PCBNG},{match:/bottom copper/,cad:null}]},{type:A.TYPE_SOLDERMASK,side:A.SIDE_BOTTOM,matchers:[{ext:"sts",cad:A._CAD_EAGLE_LEGACY},{ext:"bsm",cad:A._CAD_EAGLE_LEGACY},{ext:"gbs",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"smb",cad:A._CAD_ORCAD},{ext:"bottomsoldermask\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/bottommask\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/b[._]mask/,cad:A._CAD_KICAD},{match:/soldermask_bottom/,cad:A._CAD_EAGLE},{match:/bottom_mask/,cad:A._CAD_EAGLE_PCBNG},{match:/bottom solder resist/,cad:null}]},{type:A.TYPE_SILKSCREEN,side:A.SIDE_BOTTOM,matchers:[{ext:"pls",cad:A._CAD_EAGLE_LEGACY},{ext:"bsk",cad:A._CAD_EAGLE_LEGACY},{ext:"gbo",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"ssb",cad:A._CAD_ORCAD},{ext:"bottomsilkscreen\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/bottomsilk\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/b[._]silks/,cad:A._CAD_KICAD},{match:/silkscreen_bottom/,cad:A._CAD_EAGLE},{match:/bottom_silk/,cad:A._CAD_EAGLE_PCBNG},{match:/bottom silk screen/,cad:null}]},{type:A.TYPE_SOLDERPASTE,side:A.SIDE_BOTTOM,matchers:[{ext:"crs",cad:A._CAD_EAGLE_LEGACY},{ext:"bsp",cad:A._CAD_EAGLE_LEGACY},{ext:"gbp",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"spb",cad:A._CAD_ORCAD},{ext:"bcream\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/bottompaste\.\w+$/,cad:[A._CAD_GEDA_PCB,A._CAD_DIPTRACE]},{match:/b[._]paste/,cad:A._CAD_KICAD},{match:/solderpaste_bottom/,cad:A._CAD_EAGLE},{match:/bottom_paste/,cad:A._CAD_EAGLE_PCBNG}]},{type:A.TYPE_COPPER,side:A.SIDE_INNER,matchers:[{ext:"ly\\d+",cad:A._CAD_EAGLE_LEGACY},{ext:"gp?\\d+",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"in\\d+",cad:A._CAD_ORCAD},{ext:"internalplane\\d+\\.ger",cad:A._CAD_EAGLE_OSHPARK},{match:/in(?:ner)?\d+[._]cu/,cad:A._CAD_KICAD},{match:/inner/,cad:A._CAD_DIPTRACE}]},{type:A.TYPE_OUTLINE,side:A.SIDE_ALL,matchers:[{ext:"dim",cad:A._CAD_EAGLE_LEGACY},{ext:"mil",cad:A._CAD_EAGLE_LEGACY},{ext:"gml",cad:A._CAD_EAGLE_LEGACY},{ext:"gm\\d+",cad:[A._CAD_KICAD,A._CAD_ALTIUM]},{ext:"gko",cad:A._CAD_ALTIUM},{ext:"fab",cad:A._CAD_ORCAD},{ext:"drd",cad:A._CAD_ORCAD},{match:/outline/,cad:[A._CAD_GEDA_PCB,A._CAD_EAGLE_PCBNG]},{match:/boardoutline/,cad:[A._CAD_EAGLE_OSHPARK,A._CAD_DIPTRACE]},{match:/edge[._]cuts/,cad:A._CAD_KICAD},{match:/profile/,cad:A._CAD_EAGLE},{match:/mechanical \d+/,cad:null}]},{type:A.TYPE_DRILL,side:A.SIDE_ALL,matchers:[{ext:"txt",cad:[A._CAD_EAGLE_LEGACY,A._CAD_ALTIUM]},{ext:"xln",cad:[A._CAD_EAGLE,A._CAD_EAGLE_LEGACY,A._CAD_EAGLE_OSHPARK]},{ext:"exc",cad:A._CAD_EAGLE_LEGACY},{ext:"drd",cad:A._CAD_EAGLE_LEGACY},{ext:"drl",cad:[A._CAD_KICAD,A._CAD_DIPTRACE]},{ext:"tap",cad:A._CAD_ORCAD},{ext:"npt",cad:A._CAD_ORCAD},{ext:"plated-drill\\.cnc",cad:A._CAD_GEDA_PCB},{match:/fab/,cad:A._CAD_GEDA_PCB},{match:/npth/,cad:A._CAD_KICAD},{match:"/drill/",cad:A._CAD_EAGLE_PCBNG}]},{type:A.TYPE_DRAWING,side:null,matchers:[{ext:"pos",cad:A._CAD_KICAD},{ext:"art",cad:A._CAD_ALLEGRO},{ext:"gbr",cad:null},{ext:"gbx",cad:null},{ext:"ger",cad:null},{ext:"pho",cad:null}]}]},function(_,t,e){"use strict";var A=e(0),c=e(1),a=e(4),C=e(5),E=e(2);_.exports=function(_){"string"==typeof _&&(_=[_]);var t=c(_,C),e=a(t);return _.reduce((function(_,A){var c=function(_,t,e){var A=_.filter((function(_){return _.filename===t}));return A.find((function(_){return _.cad===e}))||A[0]||null}(t,A,e);return _[A]=c?{type:c.type,side:c.side}:{type:null,side:null},_}),{})},_.exports.validate=function(_){return{valid:E.some((function(t){return t.side===_.side&&t.type===_.type})),side:E.some((function(t){return t.side===_.side}))?_.side:null,type:E.some((function(t){return t.type===_.type}))?_.type:null}},_.exports.getAllLayers=function(){return E.map((function(_){return{type:_.type,side:_.side}})).filter((function(_){return null!==_.type}))},Object.keys(A).forEach((function(t){_.exports[t]=A[t]}))},function(_,t,e){"use strict";_.exports=function(_){var t=_.reduce((function(_,t){return _[t.cad]=_[t.cad]+1||1,_}),{});return Object.keys(t).reduce((function(_,e){var A=t[e];return A>_.max?{max:A,name:e}:_}),{max:0,name:null}).name}},function(_,t,e){"use strict";var A=e(6),c=e(7);_.exports=function(_){return c.map((function(t){return t.match.test(_)?A(t,{filename:_}):null})).filter(Boolean)}},function(_,t){_.exports=function(){for(var _={},t=0;t<arguments.length;t++){var A=arguments[t];for(var c in A)e.call(A,c)&&(_[c]=A[c])}return _};var e=Object.prototype.hasOwnProperty},function(_,t,e){"use strict";var A=e(1),c=e(2);_.exports=A(c,(function(_){return A(_.matchers,(function(t){var e=t.ext?new RegExp("\\."+t.ext+"$","i"):new RegExp(t.match,"i");return[].concat(t.cad).map((function(t){return{type:_.type,side:_.side,match:e,cad:t}}))}))}))}]); //# sourceMappingURL=whats-that-gerber.min.js.map