@opentelemetry/instrumentation
Advanced tools
Comparing version 0.25.1-alpha.21 to 0.25.1-alpha.22
@@ -11,2 +11,3 @@ import * as types from '../../types'; | ||
constructor(instrumentationName: string, instrumentationVersion: string, config?: types.InstrumentationConfig); | ||
private _extractPackageVersion; | ||
private _onRequire; | ||
@@ -13,0 +14,0 @@ enable(): void; |
@@ -60,2 +60,13 @@ /* | ||
} | ||
InstrumentationBase.prototype._extractPackageVersion = function (baseDir) { | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
var version = require(path.join(baseDir, 'package.json')).version; | ||
return typeof version === 'string' ? version : undefined; | ||
} | ||
catch (error) { | ||
diag.warn('Failed extracting version', baseDir); | ||
} | ||
return undefined; | ||
}; | ||
InstrumentationBase.prototype._onRequire = function (module, exports, name, baseDir) { | ||
@@ -70,9 +81,7 @@ var _a; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
var version = require(path.join(baseDir, 'package.json')).version; | ||
var version = this._extractPackageVersion(baseDir); | ||
module.moduleVersion = version; | ||
if (module.name === name) { | ||
// main module | ||
if (typeof version === 'string' && | ||
isSupported(module.supportedVersions, version, module.includePrerelease)) { | ||
if (isSupported(module.supportedVersions, version, module.includePrerelease)) { | ||
if (typeof module.patch === 'function') { | ||
@@ -157,2 +166,6 @@ module.moduleExports = exports; | ||
function isSupported(supportedVersions, version, includePrerelease) { | ||
if (typeof version === 'undefined') { | ||
// If we don't have the version, accept the wildcard case only | ||
return supportedVersions.includes('*'); | ||
} | ||
return supportedVersions.some(function (supportedVersion) { | ||
@@ -159,0 +172,0 @@ return satisfies(version, supportedVersion, { includePrerelease: includePrerelease }); |
@@ -11,2 +11,3 @@ import * as types from '../../types'; | ||
constructor(instrumentationName: string, instrumentationVersion: string, config?: types.InstrumentationConfig); | ||
private _extractPackageVersion; | ||
private _onRequire; | ||
@@ -13,0 +14,0 @@ enable(): void; |
@@ -45,2 +45,13 @@ "use strict"; | ||
} | ||
_extractPackageVersion(baseDir) { | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const version = require(path.join(baseDir, 'package.json')).version; | ||
return typeof version === 'string' ? version : undefined; | ||
} | ||
catch (error) { | ||
api_1.diag.warn('Failed extracting version', baseDir); | ||
} | ||
return undefined; | ||
} | ||
_onRequire(module, exports, name, baseDir) { | ||
@@ -55,9 +66,7 @@ var _a; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const version = require(path.join(baseDir, 'package.json')).version; | ||
const version = this._extractPackageVersion(baseDir); | ||
module.moduleVersion = version; | ||
if (module.name === name) { | ||
// main module | ||
if (typeof version === 'string' && | ||
isSupported(module.supportedVersions, version, module.includePrerelease)) { | ||
if (isSupported(module.supportedVersions, version, module.includePrerelease)) { | ||
if (typeof module.patch === 'function') { | ||
@@ -131,2 +140,6 @@ module.moduleExports = exports; | ||
function isSupported(supportedVersions, version, includePrerelease) { | ||
if (typeof version === 'undefined') { | ||
// If we don't have the version, accept the wildcard case only | ||
return supportedVersions.includes('*'); | ||
} | ||
return supportedVersions.some(supportedVersion => { | ||
@@ -133,0 +146,0 @@ return semver_1.satisfies(version, supportedVersion, { includePrerelease }); |
{ | ||
"name": "@opentelemetry/instrumentation", | ||
"version": "0.25.1-alpha.21+0ef1fc28", | ||
"version": "0.25.1-alpha.22+3acebdcc", | ||
"description": "Base class for node which OpenTelemetry instrumentation modules extend", | ||
@@ -47,3 +47,5 @@ "author": "OpenTelemetry Authors", | ||
"version": "node ../../scripts/version-update.js", | ||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" | ||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", | ||
"precompile": "lerna run version --scope $(npm pkg get name) --include-filtered-dependencies", | ||
"prewatch": "npm run precompile" | ||
}, | ||
@@ -63,3 +65,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@opentelemetry/api-metrics": "^0.25.1-alpha.21+0ef1fc28", | ||
"@opentelemetry/api-metrics": "^0.25.0", | ||
"require-in-the-middle": "^5.0.3", | ||
@@ -76,3 +78,3 @@ "semver": "^7.3.2", | ||
"@types/mocha": "8.2.3", | ||
"@types/node": "14.17.9", | ||
"@types/node": "14.17.11", | ||
"@types/semver": "7.3.8", | ||
@@ -103,3 +105,3 @@ "@types/shimmer": "1.0.2", | ||
}, | ||
"gitHead": "0ef1fc28d366b74d98b73b5d6334ffdc75342fe2" | ||
"gitHead": "3acebdcc070cf736e932c9ab9b683eb047c5cabc" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
126985
1885
+ Added@opentelemetry/api-metrics@0.25.0(transitive)
- Removed@opentelemetry/api-metrics@0.25.1-alpha.21(transitive)