UNPKG

dd-trace

Version:

Datadog APM tracing client for JavaScript

1 lines 3.45 kB
(()=>{"use strict";var e={"./shell-quote/parse.js"(e){for(var t="(?:\\|\\||\\&\\&|;;|\\|\\&|\\<\\(|\\<\\<\\<|>>|>\\&|<\\&|[&;()|<>])",r=RegExp("^"+t+"$"),n="|&;()<> \\t",o=/^#$/,i="",a=0;a<4;a++)i+=(0x100000000*Math.random()).toString(16);var s=RegExp("^"+i);function matchAll(e,t){for(var r,n=t.lastIndex,o=[];r=t.exec(e);)o.push(r),t.lastIndex===r.index&&(t.lastIndex+=1);return t.lastIndex=n,o}function getVar(e,t,r){var n="function"==typeof e?e(r):e[r];return(void 0===n&&""!=r?n="":void 0===n&&(n="$"),"object"==typeof n)?t+i+JSON.stringify(n)+i:t+n}function parseInternal(e,i,a){a||(a={});var s=a.escape||"\\",p=matchAll(e,RegExp(["("+t+")","("+("(\\"+s+"['\""+n+"]|[^\\s'\""+n)+"])+|\"((\\\\\"|[^\"])*?)\"|'((\\\\'|[^'])*?)')+"].join("|"),"g"));if(0===p.length)return[];i||(i={});var u=!1;return p.map(function(t){var n,a=t[0];if(a&&!u){if(r.test(a))return{op:a};var p=!1,c=!1,f="",l=!1;for(n=0;n<a.length;n++){var g=a.charAt(n);if(l=l||!p&&("*"===g||"?"===g),c)f+=g,c=!1;else if(p)g===p?p=!1:"'"==p?f+=g:g===s?(n+=1,'"'===(g=a.charAt(n))||g===s||"$"===g?f+=g:f+=s+g):"$"===g?f+=parseEnvVar():f+=g;else if('"'===g||"'"===g)p=g;else if(r.test(g))return{op:a};else if(o.test(g)){u=!0;var v={comment:e.slice(t.index+n+1)};if(f.length)return[f,v];return[v]}else g===s?c=!0:"$"===g?f+=parseEnvVar():f+=g}return l?{op:"glob",pattern:f}:f}function parseEnvVar(){n+=1;var e,t,r=a.charAt(n);if("{"===r){if(n+=1,"}"===a.charAt(n))throw Error("Bad substitution: "+a.slice(n-2,n+1));if((e=a.indexOf("}",n))<0)throw Error("Bad substitution: "+a.slice(n));t=a.slice(n,e),n=e}else if(/[*@#?$!_-]/.test(r))t=r,n+=1;else{var o=a.slice(n);(e=o.match(/[^\w\d_]/))?(t=o.slice(0,e.index),n+=e.index-1):(t=o,n=a.length)}return getVar(i,"",t)}}).reduce(function(e,t){return void 0===t?e:e.concat(t)},[])}e.exports=function(e,t,r){var n=parseInternal(e,t,r);return"function"!=typeof t?n:n.reduce(function(e,t){if("object"==typeof t)return e.concat(t);var r=t.split(RegExp("("+i+".*?"+i+")","g"));return 1===r.length?e.concat(r[0]):e.concat(r.filter(Boolean).map(function(e){return s.test(e)?JSON.parse(e.split(i)[1]):e}))},[])}},"./shell-quote/quote.js"(e){var t=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],r=/[\n\r\u2028\u2029]/,n=/[\s#!"$&'():;<=>@\\^`|]/g;e.exports=function(e){return e.map(function(e){if(""===e)return"''";if(e&&"object"==typeof e){if("glob"===e.op){if("string"!=typeof e.pattern)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(n,"\\$&")}if("string"==typeof e.op){if(0>t.indexOf(e.op))throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,"\\$&")}if("string"==typeof e.comment){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return"#"+e.comment}throw TypeError("unrecognized object token shape")}return/["\s\\]/.test(e)&&!/'/.test(e)?"'"+e.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(e)?'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"':String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}}},t={};function __webpack_require__(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,__webpack_require__),o.exports}var r={};r.quote=__webpack_require__("./shell-quote/quote.js"),r.parse=__webpack_require__("./shell-quote/parse.js"),module.exports=r})();