feat!: set compilation target to `es2022` for all packages but api and semantic-conventions (#5456)

Co-authored-by: Trent Mick <trentm@gmail.com>
This commit is contained in:
David Luna 2025-02-21 09:16:15 +01:00 committed by GitHub
parent 492ed355cb
commit f2d4e54975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 125 additions and 74 deletions

View File

@ -120,6 +120,8 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
* (user-facing): `ENVIRONMENT` has been removed without replacement
* (user-facing): `RAW_ENVIRONMENT` has been removed without replacement
* (user-facing): `parseEnvironment` has been removed without replacement
* feat!: set compilation target to ES2022 for all packages except `@opentelemetry/api`, `@opentelemetry/api-logs`, `@opentelemetry/api-events`, and `@opentelemetry/semantic-conventions` [#5456](https://github.com/open-telemetry/opentelemetry-js/pull/5456) @david-luna
* (user-facing): drops browser runtimes which do not support ES2022 features
### :rocket: (Enhancement)

View File

@ -141,9 +141,9 @@ underlying language features used.
The current minumum language feature support is set as [ECMAScript 2020](https://262.ecma-international.org/11.0/) that are available
in all modern browsers / runtimes.
This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2020, you will need
This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2022, you will need
to transpile the code and provide any necessary polyfills for the missing features to ensure compatibility with your target
environments. Any support issues that arise from using a browser or runtime that does not support ES2020 will be closed as "won't fix".
environments. Any support issues that arise from using a browser or runtime that does not support ES2022 will be closed as "won't fix".
This minimum support level is subject to change as the project evolves and as the underlying language features evolve.

View File

@ -74,7 +74,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/sinon": "17.0.3",
"@types/webpack": "5.28.5",
"@types/webpack-env": "1.16.3",

View File

@ -34,5 +34,5 @@ export const _globalThis: typeof globalThis =
: typeof window === 'object'
? window
: typeof global === 'object'
? global
? (global as unknown as typeof globalThis)
: ({} as typeof globalThis);

View File

@ -52,7 +52,9 @@ describe('Baggage', () => {
const entry = bag.getEntry('key');
assert.ok(entry);
entry.value = 'mutated';
if (entry) {
entry.value = 'mutated';
}
assert.strictEqual(bag.getEntry('key')?.value, 'value');
});

View File

@ -17,7 +17,7 @@
import * as assert from 'assert';
import { webpack, Stats } from 'webpack';
import * as path from 'path';
import { Union } from 'unionfs';
import { IFS, Union } from 'unionfs';
import { fs as mfs } from 'memfs';
import * as realFs from 'fs';
@ -86,7 +86,7 @@ describe('tree-shaking', function () {
});
const fs = new Union();
fs.use(mfs as any).use(realFs);
fs.use(mfs as any).use(realFs as unknown as IFS);
// direct webpack to use unionfs for file input
// needs workaround from https://github.com/webpack/webpack/issues/18242#issuecomment-2018116985 since webpack 5.91.0

View File

@ -1,8 +1,13 @@
{
"extends": "../tsconfig.base.esm.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esm",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../tsconfig.base.esnext.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esnext",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build",
"rootDir": "."
"rootDir": ".",
"target": "es2017"
},
"files": [],
"include": [

View File

@ -40,7 +40,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": "^18.19.0 || >=20.6.0"
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
@ -65,7 +65,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",

View File

@ -35,5 +35,5 @@ export const _globalThis: typeof globalThis =
: typeof window === 'object'
? window
: typeof global === 'object'
? global
? (global as unknown as typeof globalThis)
: ({} as typeof globalThis);

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.esm.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esm",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.esnext.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esnext",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build",
"rootDir": "."
"rootDir": ".",
"target": "es2017"
},
"files": [],
"include": [

View File

@ -40,7 +40,7 @@
"author": "OpenTelemetry Authors",
"license": "Apache-2.0",
"engines": {
"node": "^18.19.0 || >=20.6.0"
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
@ -64,7 +64,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",

View File

@ -35,5 +35,5 @@ export const _globalThis: typeof globalThis =
: typeof window === 'object'
? window
: typeof global === 'object'
? global
? (global as unknown as typeof globalThis)
: ({} as typeof globalThis);

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.esm.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esm",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.esnext.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build/esnext",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,13 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "build",
"rootDir": "."
"rootDir": ".",
"target": "es2017"
},
"files": [],
"include": [

View File

@ -95,10 +95,10 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
/** keep track on spans not ended */
private readonly _spanNotEnded: WeakSet<Span> = new WeakSet<Span>();
private _headerCapture;
private _oldHttpServerDurationHistogram!: Histogram;
private _stableHttpServerDurationHistogram!: Histogram;
private _oldHttpClientDurationHistogram!: Histogram;
private _stableHttpClientDurationHistogram!: Histogram;
declare private _oldHttpServerDurationHistogram: Histogram;
declare private _stableHttpServerDurationHistogram: Histogram;
declare private _oldHttpClientDurationHistogram: Histogram;
declare private _stableHttpClientDurationHistogram: Histogram;
private _semconvStability = SemconvStability.OLD;

77
package-lock.json generated
View File

@ -61,7 +61,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/sinon": "17.0.3",
"@types/webpack": "5.28.5",
"@types/webpack-env": "1.16.3",
@ -90,11 +90,10 @@
}
},
"api/node_modules/@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"dev": true,
"license": "MIT"
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"api/node_modules/webpack": {
"version": "5.96.1",
@ -391,7 +390,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",
@ -409,15 +408,14 @@
"webpack": "5.96.1"
},
"engines": {
"node": "^18.19.0 || >=20.6.0"
"node": ">=8.0.0"
}
},
"experimental/packages/api-events/node_modules/@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"dev": true,
"license": "MIT"
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"experimental/packages/api-events/node_modules/webpack": {
"version": "5.96.1",
@ -475,7 +473,7 @@
},
"devDependencies": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",
@ -493,15 +491,14 @@
"webpack": "5.96.1"
},
"engines": {
"node": "^18.19.0 || >=20.6.0"
"node": ">=8.0.0"
}
},
"experimental/packages/api-logs/node_modules/@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"dev": true,
"license": "MIT"
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"experimental/packages/api-logs/node_modules/webpack": {
"version": "5.96.1",
@ -34358,7 +34355,7 @@
"@size-limit/time": "^11.0.1",
"@size-limit/webpack": "^11.0.1",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^14.18.63",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",
"lerna": "6.6.2",
@ -34375,9 +34372,9 @@
}
},
"semantic-conventions/node_modules/@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"version": "14.18.63",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
"integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==",
"dev": true
}
},
@ -37346,7 +37343,7 @@
"version": "file:api",
"requires": {
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/sinon": "17.0.3",
"@types/webpack": "5.28.5",
"@types/webpack-env": "1.16.3",
@ -37372,9 +37369,9 @@
},
"dependencies": {
"@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"webpack": {
@ -37416,7 +37413,7 @@
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/api-logs": "0.57.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",
@ -37435,9 +37432,9 @@
},
"dependencies": {
"@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"webpack": {
@ -37478,7 +37475,7 @@
"requires": {
"@opentelemetry/api": "^1.3.0",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^8.10.66",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "7.0.0",
"cross-var": "1.1.0",
@ -37497,9 +37494,9 @@
},
"dependencies": {
"@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"webpack": {
@ -43061,7 +43058,7 @@
"@size-limit/time": "^11.0.1",
"@size-limit/webpack": "^11.0.1",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^14.18.63",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",
"lerna": "6.6.2",
@ -43075,9 +43072,9 @@
},
"dependencies": {
"@types/node": {
"version": "18.6.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
"integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
"version": "14.18.63",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz",
"integrity": "sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==",
"dev": true
}
}

View File

@ -67,7 +67,7 @@
"@size-limit/time": "^11.0.1",
"@size-limit/webpack": "^11.0.1",
"@types/mocha": "10.0.10",
"@types/node": "18.6.5",
"@types/node": "^14.18.63",
"@types/sinon": "17.0.3",
"cross-var": "1.1.0",
"lerna": "6.6.2",

View File

@ -1,8 +1,12 @@
{
"extends": "../tsconfig.base.esm.json",
"compilerOptions": {
"lib": [
"es2017"
],
"outDir": "build/esm",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,12 @@
{
"extends": "../tsconfig.base.esnext.json",
"compilerOptions": {
"lib": [
"es2017"
],
"outDir": "build/esnext",
"rootDir": "src",
"target": "es2017",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"include": [

View File

@ -1,8 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"lib": [
"es2017"
],
"outDir": "build",
"rootDir": "."
"rootDir": ".",
"target": "es2017"
},
"files": [],
"include": [

View File

@ -1,7 +0,0 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "es5",
"downlevelIteration": true
}
}

View File

@ -1,7 +1,7 @@
{
"extends": "./tsconfig.base.es5.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "ES6",
"module": "es2022",
"moduleResolution": "node16"
}
}

View File

@ -3,7 +3,7 @@
"compilerOptions": {
"module": "esnext",
// target should be aligned with tsconfig.base.json
"target": "es2017",
"target": "es2022",
"moduleResolution": "node16"
},
}

View File

@ -22,10 +22,10 @@
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "es2017",
"target": "es2022",
"useUnknownInCatchVariables": false,
"lib": [
"es2017",
"es2022",
"dom",
"dom.iterable"
]