UNPKG

dd-trace

Version:

Datadog APM tracing client for JavaScript

1 lines 2.08 kB
(()=>{"use strict";var e={"./detect-newline/index.js":function(e){let r=e=>{if("string"!=typeof e)throw TypeError("Expected a string");let r=e.match(/(?:\r?\n)/g)||[];if(0===r.length)return;let t=r.filter(e=>"\r\n"===e).length,n=r.length-t;return t>n?"\r\n":"\n"};e.exports=r,e.exports.graceful=e=>"string"==typeof e&&r(e)||"\n"},os:function(e){e.exports=require("os")}},r={};function t(n){var i=r[n];if(void 0!==i)return i.exports;var l=r[n]={exports:{}};return e[n](l,l.exports,t),l.exports}var n={};(()=>{function e(){let r=t("os");return e=function(){return r},r}function r(){var e;let n=(e=t("./detect-newline/index.js"))&&e.__esModule?e:{default:e};return r=function(){return n},n}Object.defineProperty(n,"__esModule",{value:!0}),n.extract=function(e){let r=e.match(a);return r?r[0].trimLeft():""},n.parse=function(e){return g(e).pragmas},n.parseWithComments=g,n.print=function({comments:t="",pragmas:n={}}){let i=(0,r().default)(t)??e().EOL,l=Object.keys(n),a=l.flatMap(e=>m(e,n[e])).map(e=>` * ${e}${i}`).join("");if(!t){if(0===l.length)return"";if(1===l.length&&!Array.isArray(n[l[0]])){let e=n[l[0]];return`/** ${m(l[0],e)[0]} */`}}let o=t.split(i).map(e=>` * ${e}`).join(i)+i;return"/**"+i+(t?o:"")+(t&&l.length?" *"+i:"")+a+" */"},n.strip=function(e){let r=e.match(a);return r&&r[0]?e.substring(r[0].length):e};let i=/\*\/$/,l=/^\/\*\*?/,a=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,o=/(^|\s+)\/\/([^\r\n]*)/g,u=/^(\r?\n)+/,c=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,s=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,p=/(\r?\n|^) *\* ?/g,f=[];function g(t){let n,a=(0,r().default)(t)??e().EOL;t=t.replace(l,"").replace(i,"").replace(p,"$1");let g="";for(;g!==t;)g=t,t=t.replace(c,`${a}$1 $2${a}`);t=t.replace(u,"").trimRight();let m=Object.create(null),h=t.replace(s,"").replace(u,"").trimRight();for(;n=s.exec(t);){let e=n[2].replace(o,"");"string"==typeof m[n[1]]||Array.isArray(m[n[1]])?m[n[1]]=f.concat(m[n[1]],e):m[n[1]]=e}return{comments:h,pragmas:m}}function m(e,r){return f.concat(r).map(r=>`@${e} ${r}`.trim())}})(),module.exports=n})();