@cqse/commons 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +3 -3
- package/lib/index.mjs +2 -2
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:process`);c=s(c);let l=require(`node:crypto`);var u=class extends Error{constructor(e){super(`Implement me!`),this._implementMeFor=e}get message(){return this._implementMeFor?`Implement me for: ${this._implementMeFor}`:`Implement me!`}},d=class extends Error{},f=class extends Error{},p=class extends Error{},m=class{static require(e,t){if(!e)throw new f(t)}static requireDefined(e,t){if(e||typeof e==`number`||typeof e==`boolean`||typeof e==`string`||e instanceof String)return e;throw t?new f(t):new f(`Reference must be defined.`)}static requireNonEmpty(e,t){if(this.requireDefined(e),e.length===0)throw new f(t);return e}static requireStringPattern(e,t,n){if(this.requireDefined(e),this.requireDefined(t),!e.match(t))throw new f(n);return e}};function h(e,t){return t.startsWith(e)?t.substring(e.length):t}const g={order:999,title:`Application`};function _(e){if(e.type===`int`||e.type===`string`)return 1;if(e.type===`bool`)return 0;if(e.type===`string[]`)return 1/0;throw new p(`Unsupported parameter type "${e.type}" for parameter "${e.longParameter}".`)}function v(e){return e.replace(/^-+/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function y(e){return e.replace(/^--/,``).toUpperCase().replace(/-/g,`_`)}var b=class e{constructor(){this.parameters=new Map,this.shortToLongParameterMap=new Map,this.sequentialParameters=[],this.argumentChecks=[]}addParameter(e,t,n,r={}){let i=v(t),a=y(t);this.describeParameter(i,{parameterId:i,longParameter:t,type:n,shortParameter:e,help:r.help??``,default:r.default,internal:r.internal??!1,group:r.group,environmentVariableName:a})}addArgumentCheck(e){this.argumentChecks.push(e)}addRequiredArgumentFor(e){let t=this.lookupParameter(e);if(t===void 0)throw new p(`Unknown parameter "${e}".`);if(t.default!==void 0)throw new p(`Parameter "${e}" is required, but has a default value.`);this.argumentChecks.push(n=>{if(n[e]===void 0)return`Missing required argument for parameter "${t.longParameter}"\n\tParameter description: ${t.help}`})}describeParameter(e,t){if(this.parameters.set(e,t),t.shortParameter){let n=t.shortParameter.replace(/^-/,``).trim().toLowerCase();if(n.length<1||n.length>3)throw new p(`Short parameter "${n}" is invalid.`);let r=this.shortToLongParameterMap.get(n);if(r!==void 0&&r!==e)throw new p(`Short parameter "${n}" is already mapped to parameter "${r}".`);this.shortToLongParameterMap.set(n,t.parameterId)}t.longParameter.startsWith(`--`)||this.sequentialParameters.push(e)}lookupParameter(e){let t=this.parameters.get(e);if(t===void 0){let n=this.shortToLongParameterMap.get(e);n!==void 0&&(t=this.parameters.get(n))}return t}getParameters(){return Array.from(this.parameters.values())}getArgumentChecks(){return this.argumentChecks}getSequentialParameters(){return this.sequentialParameters}clone(){let t=new e;for(let e of this.parameters.values())t.describeParameter(e.parameterId,e);for(let e of this.argumentChecks)t.addArgumentCheck(e);return t}addAllOf(e){for(let t of e.getParameters())this.describeParameter(t.parameterId,t);for(let t of e.getArgumentChecks())this.addArgumentCheck(t)}};function x(e,t){let n={},r,i=[],a=0;function o(){if(r){if(a<1/0&&a>0)throw new p(`Missing value for parameter "${r.longParameter}".`);if(r.type===`bool`)n[r.parameterId]=!0,r=void 0;else if(r.type===`string[]`){let e=n[r.parameterId],t=C(i.join(`,`));T(e)?n[r.parameterId]=e.concat(t):n[r.parameterId]=t}else{if(i.length!==1)throw new p(`Invalid value for parameter "${r.longParameter}": Expected a single value, got ${i.length}.`);n[r.parameterId]=w(i[0],r)}r=void 0,i=[]}}for(let n of e){if(n.startsWith(`-`)){o();let e=v(n);if(r=t.lookupParameter(e),!r)throw new p(`Unknown configuration parameter: ${n}`);a=_(r)}else{if(!r)throw new p(`Unexpected or unnamed argument, or unknown parameter '${n}' supplied. Please specify a parameter name (for example, --input) for each argument.`);i.push(n),a--}a===0&&o()}o();for(let e of t.getParameters())if(n[e.parameterId]===void 0){n[e.parameterId]=e.default;let t=c.default.env[e.environmentVariableName];t&&!e.disableEnvironmentVariableOverride&&(n[e.parameterId]=w(t,e))}return n}function S(e){return e=e.trim(),e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith("`")&&e.endsWith("`")?e.substring(1,e.length-1):e}function C(e){return e?e.split(`,`).map(e=>S(e)):[]}function w(e,t){if(t.type===`int`){let n=parseInt(e,10);if(isNaN(n))throw new p(`Invalid value for parameter "${t.longParameter}": Expected an integer, got "${e}".`);return n}else if(t.type===`bool`){let n=e.toLowerCase();if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new p(`Invalid value for parameter "${t.longParameter}": Expected a boolean, got "${e}".`)}else if(t.type===`string`)return S(e);else if(t.type===`string[]`)return C(e);else throw new p(`Unsupported parameter type "${t.type}" for parameter "${t.longParameter}".`)}function T(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function E(e,t){let n={},r=[];for(let i of e.split(`
|
|
2
|
-
`)){let e=i.trim();if(e.startsWith(`#`)||e.length===0)continue;if(!e.includes(`=`)&&t.getSequentialParameters().length>0){r.push(e);continue}let[a,o]=e.split(`=`),s=v(a),c=t.lookupParameter(s);if(c)if(T(n[s])&&c.type===`string[]`){let e=w(o,c);if(T(e))n[s]=n[s].concat(e);else throw new p(`Invalid value for parameter "${c.longParameter}": Expected a list of strings, got "${o}".`)}else n[s]=w(o,c);else throw new p(`Unknown configuration parameter: ${a}`)}return{options:n,unnamedArguments:r}}function D(e,t,n=!1){let r=[];t&&(r.push(t),r.push(``)),n||r.push(`Usage:`);let i=A(e);for(let e of i){e.groupTitle&&(r.push(``),r.push(`# ${e.groupTitle}`),r.push(``)),e.groupHint&&(r.push(O(e.groupHint,80)),r.push(``));for(let t of e.parameters){if(t.internal)continue;function
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:process`);c=s(c);let l=require(`node:crypto`);var u=class extends Error{_implementMeFor;constructor(e){super(`Implement me!`),this._implementMeFor=e}get message(){return this._implementMeFor?`Implement me for: ${this._implementMeFor}`:`Implement me!`}},d=class extends Error{},f=class extends Error{},p=class extends Error{},m=class{static require(e,t){if(!e)throw new f(t)}static requireDefined(e,t){if(e||typeof e==`number`||typeof e==`boolean`||typeof e==`string`||e instanceof String)return e;throw t?new f(t):new f(`Reference must be defined.`)}static requireNonEmpty(e,t){if(this.requireDefined(e),e.length===0)throw new f(t);return e}static requireStringPattern(e,t,n){if(this.requireDefined(e),this.requireDefined(t),!e.match(t))throw new f(n);return e}};function h(e,t){return t.startsWith(e)?t.substring(e.length):t}const g={order:999,title:`Application`};function _(e){if(e.type===`int`||e.type===`string`)return 1;if(e.type===`bool`)return 0;if(e.type===`string[]`)return 1/0;throw new p(`Unsupported parameter type "${e.type}" for parameter "${e.longParameter}".`)}function v(e){return e.replace(/^-+/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function y(e){return e.replace(/^--/,``).toUpperCase().replace(/-/g,`_`)}var b=class e{parameters;shortToLongParameterMap;sequentialParameters;argumentChecks;constructor(){this.parameters=new Map,this.shortToLongParameterMap=new Map,this.sequentialParameters=[],this.argumentChecks=[]}addParameter(e,t,n,r={}){let i=v(t),a=y(t);this.describeParameter(i,{parameterId:i,longParameter:t,type:n,shortParameter:e,help:r.help??``,default:r.default,internal:r.internal??!1,group:r.group,environmentVariableName:a})}addArgumentCheck(e){this.argumentChecks.push(e)}addRequiredArgumentFor(e){let t=this.lookupParameter(e);if(t===void 0)throw new p(`Unknown parameter "${e}".`);if(t.default!==void 0)throw new p(`Parameter "${e}" is required, but has a default value.`);this.argumentChecks.push(n=>{if(n[e]===void 0)return`Missing required argument for parameter "${t.longParameter}"\n\tParameter description: ${t.help}`})}describeParameter(e,t){if(this.parameters.set(e,t),t.shortParameter){let n=t.shortParameter.replace(/^-/,``).trim().toLowerCase();if(n.length<1||n.length>3)throw new p(`Short parameter "${n}" is invalid.`);let r=this.shortToLongParameterMap.get(n);if(r!==void 0&&r!==e)throw new p(`Short parameter "${n}" is already mapped to parameter "${r}".`);this.shortToLongParameterMap.set(n,t.parameterId)}t.longParameter.startsWith(`--`)||this.sequentialParameters.push(e)}lookupParameter(e){let t=this.parameters.get(e);if(t===void 0){let n=this.shortToLongParameterMap.get(e);n!==void 0&&(t=this.parameters.get(n))}return t}getParameters(){return Array.from(this.parameters.values())}getArgumentChecks(){return this.argumentChecks}getSequentialParameters(){return this.sequentialParameters}clone(){let t=new e;for(let e of this.parameters.values())t.describeParameter(e.parameterId,e);for(let e of this.argumentChecks)t.addArgumentCheck(e);return t}addAllOf(e){for(let t of e.getParameters())this.describeParameter(t.parameterId,t);for(let t of e.getArgumentChecks())this.addArgumentCheck(t)}};function x(e,t){let n={},r,i=[],a=0;function o(){if(r){if(a<1/0&&a>0)throw new p(`Missing value for parameter "${r.longParameter}".`);if(r.type===`bool`)n[r.parameterId]=!0,r=void 0;else if(r.type===`string[]`){let e=n[r.parameterId],t=C(i.join(`,`));T(e)?n[r.parameterId]=e.concat(t):n[r.parameterId]=t}else{if(i.length!==1)throw new p(`Invalid value for parameter "${r.longParameter}": Expected a single value, got ${i.length}.`);n[r.parameterId]=w(i[0],r)}r=void 0,i=[]}}for(let n of e){if(n.startsWith(`-`)){o();let e=v(n);if(r=t.lookupParameter(e),!r)throw new p(`Unknown configuration parameter: ${n}`);a=_(r)}else{if(!r)throw new p(`Unexpected or unnamed argument, or unknown parameter '${n}' supplied. Please specify a parameter name (for example, --input) for each argument.`);i.push(n),a--}a===0&&o()}o();for(let e of t.getParameters())if(n[e.parameterId]===void 0){n[e.parameterId]=e.default;let t=c.default.env[e.environmentVariableName];t&&!e.disableEnvironmentVariableOverride&&(n[e.parameterId]=w(t,e))}return n}function S(e){return e=e.trim(),e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith("`")&&e.endsWith("`")?e.substring(1,e.length-1):e}function C(e){return e?e.split(`,`).map(e=>S(e)):[]}function w(e,t){if(t.type===`int`){let n=parseInt(e,10);if(isNaN(n))throw new p(`Invalid value for parameter "${t.longParameter}": Expected an integer, got "${e}".`);return n}else if(t.type===`bool`){let n=e.toLowerCase();if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new p(`Invalid value for parameter "${t.longParameter}": Expected a boolean, got "${e}".`)}else if(t.type===`string`)return S(e);else if(t.type===`string[]`)return C(e);else throw new p(`Unsupported parameter type "${t.type}" for parameter "${t.longParameter}".`)}function T(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function E(e,t){let n={},r=[];for(let i of e.split(`
|
|
2
|
+
`)){let e=i.trim();if(e.startsWith(`#`)||e.length===0)continue;if(!e.includes(`=`)&&t.getSequentialParameters().length>0){r.push(e);continue}let[a,o]=e.split(`=`),s=v(a),c=t.lookupParameter(s);if(c)if(T(n[s])&&c.type===`string[]`){let e=w(o,c);if(T(e))n[s]=n[s].concat(e);else throw new p(`Invalid value for parameter "${c.longParameter}": Expected a list of strings, got "${o}".`)}else n[s]=w(o,c);else throw new p(`Unknown configuration parameter: ${a}`)}return{options:n,unnamedArguments:r}}function D(e,t,n=!1){let r=[];t&&(r.push(t),r.push(``)),n||r.push(`Usage:`);let i=A(e);for(let e of i){e.groupTitle&&(r.push(``),r.push(`# ${e.groupTitle}`),r.push(``)),e.groupHint&&(r.push(O(e.groupHint,80)),r.push(``));for(let t of e.parameters){if(t.internal)continue;function a(){let e=t.environmentVariableName;return t.type===`bool`?``:t.type===`string[]`?` ${e}, .., ${e}`:` ${e}`}let e=[];n?e.push(`Parameter "${t.parameterId}" (${t.type})`):(t.shortParameter&&e.push(`${t.shortParameter}${a()}`),e.push(`${t.longParameter}${a()}`));let i=k(O(t.help,80)),o=t.default?`Default: ${t.default}`:void 0;r.push(` ${e.join(`, `)}`),i&&r.push(`\t${i}`),o&&r.push(`\t${o}`)}}r.push(``),console.log(r.join(`
|
|
3
3
|
`))}function O(e,t){e=e.replace(/\n/g,` `);let n=e.split(` `),r=[],i=``;for(let e of n)i.length+e.length+1>t&&(r.push(i),i=``),i.length>0&&(i+=` `),i+=e;return i.length>0&&r.push(i),r.join(`
|
|
4
4
|
`)}function k(e){if(e)return e.replace(/\n/g,`
|
|
5
5
|
`)}function A(e){let t=new Map,n=new Map,r=new Map;for(let i of e.getParameters()){let e=i.group?.title;i.group&&n.set(e,i.group.order),i.group?.hints&&r.set(e,i.group?.hints);let a=t.get(e)||[];a.push(i),t.set(e,a)}return Array.from(t.entries()).sort(([e],[t])=>(n.get(e)??Number.MAX_VALUE)-(n.get(t)??Number.MAX_VALUE)).map(([e,t])=>({groupTitle:e,groupHint:r.get(e),parameters:t.sort((e,t)=>e.longParameter.localeCompare(t.longParameter))}))}function j(e,t,n){let r=!0;n||=e=>{console.error(e)};for(let i of e.getArgumentChecks()){let e=i(t);e&&(n(`Invalid configuration: `+e),r=!1)}return r}function M(e,t,n,r){n??=c.default.argv.slice(2);let i=e.clone();i.addParameter(`-h`,`--help`,`bool`,{help:`Show this help message and exit.`,group:g,disableEnvironmentVariableOverride:!0}),i.addParameter(`-v`,`--version`,`bool`,{help:`Show the version number and exit.`,group:g,disableEnvironmentVariableOverride:!0});let a=x(n,i);return a.version&&(console.log(`${t.name} v${t.version}`),c.default.exit(0)),a.help&&(D(i,t.about),c.default.exit(0)),r&&r(a),j(i,a)||(console.error(`
|
|
6
|
-
Arguments were missing or invalid. Please check the --help for more information. Exiting with error code 1.`),c.default.exit(1)),a}function N(e,t){let n=e.clone();return n.addAllOf(t),n}var P=class e{constructor(e,t,n,r){this.baseConfiguration=m.requireDefined(n),this.redefinableParameters=m.requireDefined(t),this.allParameters=m.requireDefined(e),this.overwrites=r??{},this.hash=void 0}get(e){return this.assertParameterExists(e),this.overwrites[e]??this.baseConfiguration[e]}set(e,t){if(this.redefinableParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`);this.overwriteConfig(e,t),this.hash=void 0}overwriteConfig(e,t){let n=v(e);if(this.assertParameterExists(n),t===void 0){delete this.overwrites[n];return}this.overwrites[n]=this.castConfigArgument(n,t),this.hash=void 0}castConfigArgument(e,t){let n=this.getParameter(e).type;if(n===`int`){if(typeof t==`number`)return Math.floor(t);if(typeof t==`string`)return parseInt(t,10);if(typeof t==`boolean`)return
|
|
6
|
+
Arguments were missing or invalid. Please check the --help for more information. Exiting with error code 1.`),c.default.exit(1)),a}function N(e,t){let n=e.clone();return n.addAllOf(t),n}var P=class e{baseConfiguration;redefinableParameters;allParameters;overwrites;hash;constructor(e,t,n,r){this.baseConfiguration=m.requireDefined(n),this.redefinableParameters=m.requireDefined(t),this.allParameters=m.requireDefined(e),this.overwrites=r??{},this.hash=void 0}get(e){return this.assertParameterExists(e),this.overwrites[e]??this.baseConfiguration[e]}set(e,t){if(this.redefinableParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`);this.overwriteConfig(e,t),this.hash=void 0}overwriteConfig(e,t){let n=v(e);if(this.assertParameterExists(n),t===void 0){delete this.overwrites[n];return}this.overwrites[n]=this.castConfigArgument(n,t),this.hash=void 0}castConfigArgument(e,t){let n=this.getParameter(e).type;if(n===`int`){if(typeof t==`number`)return Math.floor(t);if(typeof t==`string`)return parseInt(t,10);if(typeof t==`boolean`)return+!!t}else if(n===`bool`){if(typeof t==`boolean`)return t;if(typeof t==`string`)return t.toLowerCase()===`true`;if(typeof t==`number`)return t!==0}else if(n===`string[]`){if(t===void 0||t==null)return[];if(Array.isArray(t))return t.map(String);if(typeof t==`string`)return t.split(`,`).map(e=>e.trim())}else return String(t);throw Error(`Cannot cast value of type ${typeof t} to ${n}`)}assertParameterExists(e){if(this.allParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`)}getParameter(e){let t=this.redefinableParameters.lookupParameter(e);if(t===void 0)throw Error(`Unknown configuration parameter: ${e}`);return t}getHash(){if(this.hash===void 0){let e=(0,l.createHash)(`sha256`);for(let[t,n]of Object.entries(this.baseConfiguration))e.update(t),e.update(String(n));for(let[t,n]of Object.entries(this.overwrites))e.update(t),e.update(String(n));this.hash=e.digest(`hex`)}return this.hash}copy(){let t=JSON.parse(JSON.stringify(this.overwrites));return new e(this.allParameters,this.redefinableParameters,this.baseConfiguration,t)}};function F(e){return new Proxy(e,{get(t,n){return e.get(n.toString())},set(t,n,r){return e.set(n.toString(),r),!0}})}const I={order:1,title:`Collector Connectivity`},L={order:1,title:`Teamscale Server`},R={order:2,title:`Upload to Teamscale`,hints:"NOTE: We generally recommend to set these parameters per app during the instrumentation process, that is, on the instrumenter side, for example, by setting `--config-id` or specifying single options via `--collector-option`. The following parameters are supposed to take effect if the application is instrumented with the `--coverage-target-from-collector` flag."},z={order:3,title:`Coverage Dumping`},B={order:4,title:`Upload to Artifactory`},V={order:5,title:`Logging Behavior`};function H(){let e=new b;function t(t,n,r,i){e.addParameter(t,n,r,i)}return t(`-k`,`--keep-coverage-files`,`bool`,{help:`Whether to keep the coverage files on disk after a successful upload to Teamscale.`,default:!1,group:z}),t(`-t`,`--dump-after-mins`,`int`,{help:`Dump the coverage information every N minutes.`,default:120,group:z}),t(void 0,`--artifactory-server-url`,`string`,{help:`Upload the coverage to the given Artifactory server URL. The URL may include a subpath on the artifactory server, e.g. https://artifactory.acme.com/my-repo/my/subpath`,group:B}),t(void 0,`--artifactory-user`,`string`,{help:`The user for uploading coverage to Artifactory. Only needed when not using the --artifactory-access-token option`,group:B}),t(void 0,`--artifactory-password`,`string`,{help:`The password for uploading coverage to Artifactory. Only needed when not using the --artifactory-access-token option`,group:B}),t(void 0,`--artifactory-access-token`,`string`,{help:`The access_token for uploading coverage to Artifactory.`,group:B}),t(void 0,`--artifactory-path-suffix`,`string`,{help:`(optional): The path within the storage location between the default path and the uploaded artifact.`,group:B}),t(void 0,`--teamscale-project`,`string`,{help:`The project ID to upload coverage to.`,group:R}),t(void 0,`--teamscale-partition`,`string`,{help:`The partition to upload coverage to.`,group:R}),t(void 0,`--teamscale-repository`,`string`,{help:`The repository to upload coverage for. Optional: Only needed when uploading via revision to a project that has more than one connector.`,group:R}),t(void 0,`--teamscale-message`,`string`,{help:`The commit message shown within Teamscale for the coverage upload.`,default:`JavaScript coverage upload`,group:R}),e}function U(){let e=H();function t(t,n,r,i){e.addParameter(t,n,r,i)}return t(`-p`,`--port`,`int`,{help:`The port to receive coverage information on.`,default:54678,group:I,disableEnvironmentVariableOverride:!0}),t(`-l`,`--log-to-file`,`string`,{help:`Log file`,default:`logs/collector-combined.log`,group:V,disableEnvironmentVariableOverride:!0}),t(`-e`,`--log-level`,`string`,{help:`Log level`,default:`info`,group:V,disableEnvironmentVariableOverride:!0}),t(`-j`,`--json-log`,`bool`,{help:`Additional JSON-like log file format.`,group:V,disableEnvironmentVariableOverride:!0}),t(`-c`,`--enable-control-port`,`int`,{help:`Enables the remote control API on the specified port (<=0 means "disabled").`,default:0,group:I}),t(`-s`,`--teamscale-server-url`,`string`,{help:`Upload the coverage to the given Teamscale server URL, for example, https://teamscale.dev.example.com:8080/production.`,group:L}),t(`-u`,`--teamscale-user`,`string`,{help:`The user for uploading coverage to Teamscale.`,group:L}),t(`-a`,`--teamscale-access-token`,`string`,{help:`The API key to use for uploading to Teamscale.`,group:L}),t(void 0,`--http-proxy`,`string`,{help:`(optional): The HTTP/HTTPS proxy address that should be used in the format: http://host:port/ or http://username:password@host:port/.`,group:I}),t(`-f`,`--dump-folder`,`string`,{help:`Target folder for coverage files.`,default:`./coverage`,group:z}),e.addArgumentCheck(e=>{if(e.teamscaleServerUrl&&(!e.teamscaleUser||!e.teamscaleAccessToken))return`The Teamscale user name and access token must be given if the Teamscale server URL is given.`}),e}function W(){let e=H();function t(t,n,r,i){e.addParameter(t,n,r,i)}function n(e,n,r){t(void 0,e,n,r)}return n(`--dump-to-folder`,`string`,{help:`Coverage should be dumped to a folder on the server that the collector is running on.
|
|
7
7
|
Specifies the name of the subfolder within the collector's dump folder (--dump-folder of the collector) where coverage files should be placed.`,group:z}),e}function G(e){if(typeof e==`string`){if(/^[a-zA-Z0-9_-]+:([0-9]+|HEAD|head)$/.test(e))return!0;if(/^[0-9]+$/.test(e))return!1;if(/^[a-zA-Z0-9]{7,40}$/.test(e))return!0}return!1}exports.CONFIG_GROUP_APP=g,exports.ConfigurationParameters=b,exports.ConfigurationWithOverwrites=P,exports.Contract=m,exports.IllegalArgumentException=f,exports.IllegalStateException=d,exports.ImplementMeException=u,exports.InvalidConfigurationException=p,exports.buildPredefinableParameters=H,exports.buildReconfigurableCollectorParameters=W,exports.buildStaticCollectorParameters=U,exports.checkArguments=j,exports.isValidCommitInfo=G,exports.longParameterToEnvironmentVariableName=y,exports.makeConfigProxy=F,exports.parameterNameToParameterId=v,exports.parameterUnion=N,exports.parseArguments=x,exports.parseConfigFile=E,exports.printHelp=D,exports.processCommandLine=M,exports.removePrefix=h;
|
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from"node:process";import{createHash as t}from"node:crypto";var n=class extends Error{constructor(e){super(`Implement me!`),this._implementMeFor=e}get message(){return this._implementMeFor?`Implement me for: ${this._implementMeFor}`:`Implement me!`}},r=class extends Error{},i=class extends Error{},a=class extends Error{},o=class{static require(e,t){if(!e)throw new i(t)}static requireDefined(e,t){if(e||typeof e==`number`||typeof e==`boolean`||typeof e==`string`||e instanceof String)return e;throw t?new i(t):new i(`Reference must be defined.`)}static requireNonEmpty(e,t){if(this.requireDefined(e),e.length===0)throw new i(t);return e}static requireStringPattern(e,t,n){if(this.requireDefined(e),this.requireDefined(t),!e.match(t))throw new i(n);return e}};function s(e,t){return t.startsWith(e)?t.substring(e.length):t}const c={order:999,title:`Application`};function l(e){if(e.type===`int`||e.type===`string`)return 1;if(e.type===`bool`)return 0;if(e.type===`string[]`)return 1/0;throw new a(`Unsupported parameter type "${e.type}" for parameter "${e.longParameter}".`)}function u(e){return e.replace(/^-+/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function d(e){return e.replace(/^--/,``).toUpperCase().replace(/-/g,`_`)}var f=class e{constructor(){this.parameters=new Map,this.shortToLongParameterMap=new Map,this.sequentialParameters=[],this.argumentChecks=[]}addParameter(e,t,n,r={}){let i=u(t),a=d(t);this.describeParameter(i,{parameterId:i,longParameter:t,type:n,shortParameter:e,help:r.help??``,default:r.default,internal:r.internal??!1,group:r.group,environmentVariableName:a})}addArgumentCheck(e){this.argumentChecks.push(e)}addRequiredArgumentFor(e){let t=this.lookupParameter(e);if(t===void 0)throw new a(`Unknown parameter "${e}".`);if(t.default!==void 0)throw new a(`Parameter "${e}" is required, but has a default value.`);this.argumentChecks.push(n=>{if(n[e]===void 0)return`Missing required argument for parameter "${t.longParameter}"\n\tParameter description: ${t.help}`})}describeParameter(e,t){if(this.parameters.set(e,t),t.shortParameter){let n=t.shortParameter.replace(/^-/,``).trim().toLowerCase();if(n.length<1||n.length>3)throw new a(`Short parameter "${n}" is invalid.`);let r=this.shortToLongParameterMap.get(n);if(r!==void 0&&r!==e)throw new a(`Short parameter "${n}" is already mapped to parameter "${r}".`);this.shortToLongParameterMap.set(n,t.parameterId)}t.longParameter.startsWith(`--`)||this.sequentialParameters.push(e)}lookupParameter(e){let t=this.parameters.get(e);if(t===void 0){let n=this.shortToLongParameterMap.get(e);n!==void 0&&(t=this.parameters.get(n))}return t}getParameters(){return Array.from(this.parameters.values())}getArgumentChecks(){return this.argumentChecks}getSequentialParameters(){return this.sequentialParameters}clone(){let t=new e;for(let e of this.parameters.values())t.describeParameter(e.parameterId,e);for(let e of this.argumentChecks)t.addArgumentCheck(e);return t}addAllOf(e){for(let t of e.getParameters())this.describeParameter(t.parameterId,t);for(let t of e.getArgumentChecks())this.addArgumentCheck(t)}};function p(t,n){let r={},i,o=[],s=0;function c(){if(i){if(s<1/0&&s>0)throw new a(`Missing value for parameter "${i.longParameter}".`);if(i.type===`bool`)r[i.parameterId]=!0,i=void 0;else if(i.type===`string[]`){let e=r[i.parameterId],t=h(o.join(`,`));_(e)?r[i.parameterId]=e.concat(t):r[i.parameterId]=t}else{if(o.length!==1)throw new a(`Invalid value for parameter "${i.longParameter}": Expected a single value, got ${o.length}.`);r[i.parameterId]=g(o[0],i)}i=void 0,o=[]}}for(let e of t){if(e.startsWith(`-`)){c();let t=u(e);if(i=n.lookupParameter(t),!i)throw new a(`Unknown configuration parameter: ${e}`);s=l(i)}else{if(!i)throw new a(`Unexpected or unnamed argument, or unknown parameter '${e}' supplied. Please specify a parameter name (for example, --input) for each argument.`);o.push(e),s--}s===0&&c()}c();for(let t of n.getParameters())if(r[t.parameterId]===void 0){r[t.parameterId]=t.default;let n=e.env[t.environmentVariableName];n&&!t.disableEnvironmentVariableOverride&&(r[t.parameterId]=g(n,t))}return r}function m(e){return e=e.trim(),e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith("`")&&e.endsWith("`")?e.substring(1,e.length-1):e}function h(e){return e?e.split(`,`).map(e=>m(e)):[]}function g(e,t){if(t.type===`int`){let n=parseInt(e,10);if(isNaN(n))throw new a(`Invalid value for parameter "${t.longParameter}": Expected an integer, got "${e}".`);return n}else if(t.type===`bool`){let n=e.toLowerCase();if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new a(`Invalid value for parameter "${t.longParameter}": Expected a boolean, got "${e}".`)}else if(t.type===`string`)return m(e);else if(t.type===`string[]`)return h(e);else throw new a(`Unsupported parameter type "${t.type}" for parameter "${t.longParameter}".`)}function _(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function v(e,t){let n={},r=[];for(let i of e.split(`
|
|
1
|
+
import e from"node:process";import{createHash as t}from"node:crypto";var n=class extends Error{_implementMeFor;constructor(e){super(`Implement me!`),this._implementMeFor=e}get message(){return this._implementMeFor?`Implement me for: ${this._implementMeFor}`:`Implement me!`}},r=class extends Error{},i=class extends Error{},a=class extends Error{},o=class{static require(e,t){if(!e)throw new i(t)}static requireDefined(e,t){if(e||typeof e==`number`||typeof e==`boolean`||typeof e==`string`||e instanceof String)return e;throw t?new i(t):new i(`Reference must be defined.`)}static requireNonEmpty(e,t){if(this.requireDefined(e),e.length===0)throw new i(t);return e}static requireStringPattern(e,t,n){if(this.requireDefined(e),this.requireDefined(t),!e.match(t))throw new i(n);return e}};function s(e,t){return t.startsWith(e)?t.substring(e.length):t}const c={order:999,title:`Application`};function l(e){if(e.type===`int`||e.type===`string`)return 1;if(e.type===`bool`)return 0;if(e.type===`string[]`)return 1/0;throw new a(`Unsupported parameter type "${e.type}" for parameter "${e.longParameter}".`)}function u(e){return e.replace(/^-+/,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function d(e){return e.replace(/^--/,``).toUpperCase().replace(/-/g,`_`)}var f=class e{parameters;shortToLongParameterMap;sequentialParameters;argumentChecks;constructor(){this.parameters=new Map,this.shortToLongParameterMap=new Map,this.sequentialParameters=[],this.argumentChecks=[]}addParameter(e,t,n,r={}){let i=u(t),a=d(t);this.describeParameter(i,{parameterId:i,longParameter:t,type:n,shortParameter:e,help:r.help??``,default:r.default,internal:r.internal??!1,group:r.group,environmentVariableName:a})}addArgumentCheck(e){this.argumentChecks.push(e)}addRequiredArgumentFor(e){let t=this.lookupParameter(e);if(t===void 0)throw new a(`Unknown parameter "${e}".`);if(t.default!==void 0)throw new a(`Parameter "${e}" is required, but has a default value.`);this.argumentChecks.push(n=>{if(n[e]===void 0)return`Missing required argument for parameter "${t.longParameter}"\n\tParameter description: ${t.help}`})}describeParameter(e,t){if(this.parameters.set(e,t),t.shortParameter){let n=t.shortParameter.replace(/^-/,``).trim().toLowerCase();if(n.length<1||n.length>3)throw new a(`Short parameter "${n}" is invalid.`);let r=this.shortToLongParameterMap.get(n);if(r!==void 0&&r!==e)throw new a(`Short parameter "${n}" is already mapped to parameter "${r}".`);this.shortToLongParameterMap.set(n,t.parameterId)}t.longParameter.startsWith(`--`)||this.sequentialParameters.push(e)}lookupParameter(e){let t=this.parameters.get(e);if(t===void 0){let n=this.shortToLongParameterMap.get(e);n!==void 0&&(t=this.parameters.get(n))}return t}getParameters(){return Array.from(this.parameters.values())}getArgumentChecks(){return this.argumentChecks}getSequentialParameters(){return this.sequentialParameters}clone(){let t=new e;for(let e of this.parameters.values())t.describeParameter(e.parameterId,e);for(let e of this.argumentChecks)t.addArgumentCheck(e);return t}addAllOf(e){for(let t of e.getParameters())this.describeParameter(t.parameterId,t);for(let t of e.getArgumentChecks())this.addArgumentCheck(t)}};function p(t,n){let r={},i,o=[],s=0;function c(){if(i){if(s<1/0&&s>0)throw new a(`Missing value for parameter "${i.longParameter}".`);if(i.type===`bool`)r[i.parameterId]=!0,i=void 0;else if(i.type===`string[]`){let e=r[i.parameterId],t=h(o.join(`,`));_(e)?r[i.parameterId]=e.concat(t):r[i.parameterId]=t}else{if(o.length!==1)throw new a(`Invalid value for parameter "${i.longParameter}": Expected a single value, got ${o.length}.`);r[i.parameterId]=g(o[0],i)}i=void 0,o=[]}}for(let e of t){if(e.startsWith(`-`)){c();let t=u(e);if(i=n.lookupParameter(t),!i)throw new a(`Unknown configuration parameter: ${e}`);s=l(i)}else{if(!i)throw new a(`Unexpected or unnamed argument, or unknown parameter '${e}' supplied. Please specify a parameter name (for example, --input) for each argument.`);o.push(e),s--}s===0&&c()}c();for(let t of n.getParameters())if(r[t.parameterId]===void 0){r[t.parameterId]=t.default;let n=e.env[t.environmentVariableName];n&&!t.disableEnvironmentVariableOverride&&(r[t.parameterId]=g(n,t))}return r}function m(e){return e=e.trim(),e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith("`")&&e.endsWith("`")?e.substring(1,e.length-1):e}function h(e){return e?e.split(`,`).map(e=>m(e)):[]}function g(e,t){if(t.type===`int`){let n=parseInt(e,10);if(isNaN(n))throw new a(`Invalid value for parameter "${t.longParameter}": Expected an integer, got "${e}".`);return n}else if(t.type===`bool`){let n=e.toLowerCase();if(n===`true`||n===`1`)return!0;if(n===`false`||n===`0`)return!1;throw new a(`Invalid value for parameter "${t.longParameter}": Expected a boolean, got "${e}".`)}else if(t.type===`string`)return m(e);else if(t.type===`string[]`)return h(e);else throw new a(`Unsupported parameter type "${t.type}" for parameter "${t.longParameter}".`)}function _(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function v(e,t){let n={},r=[];for(let i of e.split(`
|
|
2
2
|
`)){let e=i.trim();if(e.startsWith(`#`)||e.length===0)continue;if(!e.includes(`=`)&&t.getSequentialParameters().length>0){r.push(e);continue}let[o,s]=e.split(`=`),c=u(o),l=t.lookupParameter(c);if(l)if(_(n[c])&&l.type===`string[]`){let e=g(s,l);if(_(e))n[c]=n[c].concat(e);else throw new a(`Invalid value for parameter "${l.longParameter}": Expected a list of strings, got "${s}".`)}else n[c]=g(s,l);else throw new a(`Unknown configuration parameter: ${o}`)}return{options:n,unnamedArguments:r}}function y(e,t,n=!1){let r=[];t&&(r.push(t),r.push(``)),n||r.push(`Usage:`);let i=S(e);for(let e of i){e.groupTitle&&(r.push(``),r.push(`# ${e.groupTitle}`),r.push(``)),e.groupHint&&(r.push(b(e.groupHint,80)),r.push(``));for(let t of e.parameters){if(t.internal)continue;function e(){let e=t.environmentVariableName;return t.type===`bool`?``:t.type===`string[]`?` ${e}, .., ${e}`:` ${e}`}let i=[];n?i.push(`Parameter "${t.parameterId}" (${t.type})`):(t.shortParameter&&i.push(`${t.shortParameter}${e()}`),i.push(`${t.longParameter}${e()}`));let a=x(b(t.help,80)),o=t.default?`Default: ${t.default}`:void 0;r.push(` ${i.join(`, `)}`),a&&r.push(`\t${a}`),o&&r.push(`\t${o}`)}}r.push(``),console.log(r.join(`
|
|
3
3
|
`))}function b(e,t){e=e.replace(/\n/g,` `);let n=e.split(` `),r=[],i=``;for(let e of n)i.length+e.length+1>t&&(r.push(i),i=``),i.length>0&&(i+=` `),i+=e;return i.length>0&&r.push(i),r.join(`
|
|
4
4
|
`)}function x(e){if(e)return e.replace(/\n/g,`
|
|
5
5
|
`)}function S(e){let t=new Map,n=new Map,r=new Map;for(let i of e.getParameters()){let e=i.group?.title;i.group&&n.set(e,i.group.order),i.group?.hints&&r.set(e,i.group?.hints);let a=t.get(e)||[];a.push(i),t.set(e,a)}return Array.from(t.entries()).sort(([e],[t])=>(n.get(e)??Number.MAX_VALUE)-(n.get(t)??Number.MAX_VALUE)).map(([e,t])=>({groupTitle:e,groupHint:r.get(e),parameters:t.sort((e,t)=>e.longParameter.localeCompare(t.longParameter))}))}function C(e,t,n){let r=!0;n||=e=>{console.error(e)};for(let i of e.getArgumentChecks()){let e=i(t);e&&(n(`Invalid configuration: `+e),r=!1)}return r}function w(t,n,r,i){r??=e.argv.slice(2);let a=t.clone();a.addParameter(`-h`,`--help`,`bool`,{help:`Show this help message and exit.`,group:c,disableEnvironmentVariableOverride:!0}),a.addParameter(`-v`,`--version`,`bool`,{help:`Show the version number and exit.`,group:c,disableEnvironmentVariableOverride:!0});let o=p(r,a);return o.version&&(console.log(`${n.name} v${n.version}`),e.exit(0)),o.help&&(y(a,n.about),e.exit(0)),i&&i(o),C(a,o)||(console.error(`
|
|
6
|
-
Arguments were missing or invalid. Please check the --help for more information. Exiting with error code 1.`),e.exit(1)),o}function T(e,t){let n=e.clone();return n.addAllOf(t),n}var E=class e{constructor(e,t,n,r){this.baseConfiguration=o.requireDefined(n),this.redefinableParameters=o.requireDefined(t),this.allParameters=o.requireDefined(e),this.overwrites=r??{},this.hash=void 0}get(e){return this.assertParameterExists(e),this.overwrites[e]??this.baseConfiguration[e]}set(e,t){if(this.redefinableParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`);this.overwriteConfig(e,t),this.hash=void 0}overwriteConfig(e,t){let n=u(e);if(this.assertParameterExists(n),t===void 0){delete this.overwrites[n];return}this.overwrites[n]=this.castConfigArgument(n,t),this.hash=void 0}castConfigArgument(e,t){let n=this.getParameter(e).type;if(n===`int`){if(typeof t==`number`)return Math.floor(t);if(typeof t==`string`)return parseInt(t,10);if(typeof t==`boolean`)return
|
|
6
|
+
Arguments were missing or invalid. Please check the --help for more information. Exiting with error code 1.`),e.exit(1)),o}function T(e,t){let n=e.clone();return n.addAllOf(t),n}var E=class e{baseConfiguration;redefinableParameters;allParameters;overwrites;hash;constructor(e,t,n,r){this.baseConfiguration=o.requireDefined(n),this.redefinableParameters=o.requireDefined(t),this.allParameters=o.requireDefined(e),this.overwrites=r??{},this.hash=void 0}get(e){return this.assertParameterExists(e),this.overwrites[e]??this.baseConfiguration[e]}set(e,t){if(this.redefinableParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`);this.overwriteConfig(e,t),this.hash=void 0}overwriteConfig(e,t){let n=u(e);if(this.assertParameterExists(n),t===void 0){delete this.overwrites[n];return}this.overwrites[n]=this.castConfigArgument(n,t),this.hash=void 0}castConfigArgument(e,t){let n=this.getParameter(e).type;if(n===`int`){if(typeof t==`number`)return Math.floor(t);if(typeof t==`string`)return parseInt(t,10);if(typeof t==`boolean`)return+!!t}else if(n===`bool`){if(typeof t==`boolean`)return t;if(typeof t==`string`)return t.toLowerCase()===`true`;if(typeof t==`number`)return t!==0}else if(n===`string[]`){if(t===void 0||t==null)return[];if(Array.isArray(t))return t.map(String);if(typeof t==`string`)return t.split(`,`).map(e=>e.trim())}else return String(t);throw Error(`Cannot cast value of type ${typeof t} to ${n}`)}assertParameterExists(e){if(this.allParameters.lookupParameter(e)===void 0)throw Error(`Unknown configuration parameter: ${e}`)}getParameter(e){let t=this.redefinableParameters.lookupParameter(e);if(t===void 0)throw Error(`Unknown configuration parameter: ${e}`);return t}getHash(){if(this.hash===void 0){let e=t(`sha256`);for(let[t,n]of Object.entries(this.baseConfiguration))e.update(t),e.update(String(n));for(let[t,n]of Object.entries(this.overwrites))e.update(t),e.update(String(n));this.hash=e.digest(`hex`)}return this.hash}copy(){let t=JSON.parse(JSON.stringify(this.overwrites));return new e(this.allParameters,this.redefinableParameters,this.baseConfiguration,t)}};function D(e){return new Proxy(e,{get(t,n){return e.get(n.toString())},set(t,n,r){return e.set(n.toString(),r),!0}})}const O={order:1,title:`Collector Connectivity`},k={order:1,title:`Teamscale Server`},A={order:2,title:`Upload to Teamscale`,hints:"NOTE: We generally recommend to set these parameters per app during the instrumentation process, that is, on the instrumenter side, for example, by setting `--config-id` or specifying single options via `--collector-option`. The following parameters are supposed to take effect if the application is instrumented with the `--coverage-target-from-collector` flag."},j={order:3,title:`Coverage Dumping`},M={order:4,title:`Upload to Artifactory`},N={order:5,title:`Logging Behavior`};function P(){let e=new f;function t(t,n,r,i){e.addParameter(t,n,r,i)}return t(`-k`,`--keep-coverage-files`,`bool`,{help:`Whether to keep the coverage files on disk after a successful upload to Teamscale.`,default:!1,group:j}),t(`-t`,`--dump-after-mins`,`int`,{help:`Dump the coverage information every N minutes.`,default:120,group:j}),t(void 0,`--artifactory-server-url`,`string`,{help:`Upload the coverage to the given Artifactory server URL. The URL may include a subpath on the artifactory server, e.g. https://artifactory.acme.com/my-repo/my/subpath`,group:M}),t(void 0,`--artifactory-user`,`string`,{help:`The user for uploading coverage to Artifactory. Only needed when not using the --artifactory-access-token option`,group:M}),t(void 0,`--artifactory-password`,`string`,{help:`The password for uploading coverage to Artifactory. Only needed when not using the --artifactory-access-token option`,group:M}),t(void 0,`--artifactory-access-token`,`string`,{help:`The access_token for uploading coverage to Artifactory.`,group:M}),t(void 0,`--artifactory-path-suffix`,`string`,{help:`(optional): The path within the storage location between the default path and the uploaded artifact.`,group:M}),t(void 0,`--teamscale-project`,`string`,{help:`The project ID to upload coverage to.`,group:A}),t(void 0,`--teamscale-partition`,`string`,{help:`The partition to upload coverage to.`,group:A}),t(void 0,`--teamscale-repository`,`string`,{help:`The repository to upload coverage for. Optional: Only needed when uploading via revision to a project that has more than one connector.`,group:A}),t(void 0,`--teamscale-message`,`string`,{help:`The commit message shown within Teamscale for the coverage upload.`,default:`JavaScript coverage upload`,group:A}),e}function F(){let e=P();function t(t,n,r,i){e.addParameter(t,n,r,i)}return t(`-p`,`--port`,`int`,{help:`The port to receive coverage information on.`,default:54678,group:O,disableEnvironmentVariableOverride:!0}),t(`-l`,`--log-to-file`,`string`,{help:`Log file`,default:`logs/collector-combined.log`,group:N,disableEnvironmentVariableOverride:!0}),t(`-e`,`--log-level`,`string`,{help:`Log level`,default:`info`,group:N,disableEnvironmentVariableOverride:!0}),t(`-j`,`--json-log`,`bool`,{help:`Additional JSON-like log file format.`,group:N,disableEnvironmentVariableOverride:!0}),t(`-c`,`--enable-control-port`,`int`,{help:`Enables the remote control API on the specified port (<=0 means "disabled").`,default:0,group:O}),t(`-s`,`--teamscale-server-url`,`string`,{help:`Upload the coverage to the given Teamscale server URL, for example, https://teamscale.dev.example.com:8080/production.`,group:k}),t(`-u`,`--teamscale-user`,`string`,{help:`The user for uploading coverage to Teamscale.`,group:k}),t(`-a`,`--teamscale-access-token`,`string`,{help:`The API key to use for uploading to Teamscale.`,group:k}),t(void 0,`--http-proxy`,`string`,{help:`(optional): The HTTP/HTTPS proxy address that should be used in the format: http://host:port/ or http://username:password@host:port/.`,group:O}),t(`-f`,`--dump-folder`,`string`,{help:`Target folder for coverage files.`,default:`./coverage`,group:j}),e.addArgumentCheck(e=>{if(e.teamscaleServerUrl&&(!e.teamscaleUser||!e.teamscaleAccessToken))return`The Teamscale user name and access token must be given if the Teamscale server URL is given.`}),e}function I(){let e=P();function t(t,n,r,i){e.addParameter(t,n,r,i)}function n(e,n,r){t(void 0,e,n,r)}return n(`--dump-to-folder`,`string`,{help:`Coverage should be dumped to a folder on the server that the collector is running on.
|
|
7
7
|
Specifies the name of the subfolder within the collector's dump folder (--dump-folder of the collector) where coverage files should be placed.`,group:j}),e}function L(e){if(typeof e==`string`){if(/^[a-zA-Z0-9_-]+:([0-9]+|HEAD|head)$/.test(e))return!0;if(/^[0-9]+$/.test(e))return!1;if(/^[a-zA-Z0-9]{7,40}$/.test(e))return!0}return!1}export{c as CONFIG_GROUP_APP,f as ConfigurationParameters,E as ConfigurationWithOverwrites,o as Contract,i as IllegalArgumentException,r as IllegalStateException,n as ImplementMeException,a as InvalidConfigurationException,P as buildPredefinableParameters,I as buildReconfigurableCollectorParameters,F as buildStaticCollectorParameters,C as checkArguments,L as isValidCommitInfo,d as longParameterToEnvironmentVariableName,D as makeConfigProxy,u as parameterNameToParameterId,T as parameterUnion,p as parseArguments,v as parseConfigFile,y as printHelp,w as processCommandLine,s as removePrefix};
|
|
8
8
|
//# sourceMappingURL=index.mjs.map
|