From 077947d22aac51b55e5bb2c33cda9c717d19780b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serkan=20=C3=96ZAL?= Date: Sun, 19 Jan 2025 20:18:56 +0300 Subject: [PATCH] feat(opentelemetry-instrumentation-http, opentelemetry-instrumentation-grpc): generate esm build files too --- CHANGELOG.md | 2 + .../package.json | 10 +++-- .../tsconfig.esm.json | 34 +++++++++++++++++ .../tsconfig.esnext.json | 34 +++++++++++++++++ .../package.json | 10 +++-- .../tsconfig.esm.json | 37 +++++++++++++++++++ .../tsconfig.esnext.json | 37 +++++++++++++++++++ tsconfig.esm.json | 6 +++ tsconfig.esnext.json | 6 +++ 9 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json create mode 100644 experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esnext.json create mode 100644 experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json create mode 100644 experimental/packages/opentelemetry-instrumentation-http/tsconfig.esnext.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2745d32a537..303c12ece56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,8 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se ### :rocket: (Enhancement) +* feat(opentelemetry-instrumentation-http, opentelemetry-instrumentation-grpc): generate esm build files too [5351](https://github.com/open-telemetry/opentelemetry-js/pull/5351) @serkan-ozal + ### :bug: (Bug Fix) * fix(sdk-metrics): do not export from `PeriodicExportingMetricReader` when there are no metrics to export. [#5288](https://github.com/open-telemetry/opentelemetry-js/pull/5288) @jacksonweber diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index 089b1d9af14..92c74f91d1f 100644 --- a/experimental/packages/opentelemetry-instrumentation-grpc/package.json +++ b/experimental/packages/opentelemetry-instrumentation-grpc/package.json @@ -3,18 +3,19 @@ "version": "0.57.0", "description": "OpenTelemetry instrumentation for `@grpc/grpc-js` rpc client and server for gRPC framework", "main": "build/src/index.js", + "module": "build/esm/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js", "scripts": { "prepublishOnly": "npm run compile", - "compile": "tsc --build", - "clean": "tsc --build --clean", + "compile": "tsc --build tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", "test": "npm run protos:generate && nyc mocha test/**/*.test.ts", "tdd": "npm run test -- --watch-extensions ts --watch", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", - "watch": "tsc --build --watch", + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -35,6 +36,9 @@ "node": ">=18" }, "files": [ + "build/esm/**/*.js", + "build/esm/**/*.js.map", + "build/esm/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.js.map", "build/src/**/*.d.ts", diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json new file mode 100644 index 00000000000..dc1436dfae7 --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json @@ -0,0 +1,34 @@ +{ + "extends": "../../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "build/esm", + "rootDir": "src", + "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../opentelemetry-instrumentation" + } + ] +} diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esnext.json b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esnext.json new file mode 100644 index 00000000000..cc4864cab74 --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esnext.json @@ -0,0 +1,34 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "outDir": "build/esnext", + "rootDir": "src", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../opentelemetry-instrumentation" + } + ] +} diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 8ab97f19d3d..e8115e53c6b 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/package.json +++ b/experimental/packages/opentelemetry-instrumentation-http/package.json @@ -3,12 +3,13 @@ "version": "0.57.0", "description": "OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules", "main": "build/src/index.js", + "module": "build/esm/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js", "scripts": { "prepublishOnly": "npm run compile", - "compile": "tsc --build", - "clean": "tsc --build --clean", + "compile": "tsc --build tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", "test:cjs": "nyc mocha test/**/*.test.ts", "test:esm": "nyc node --experimental-loader=@opentelemetry/instrumentation/hook.mjs ../../../node_modules/mocha/bin/mocha 'test/**/*.test.mjs'", "test": "npm run test:cjs && npm run test:esm", @@ -16,7 +17,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../../scripts/version-update.js", - "watch": "tsc --build --watch", + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json", "precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies", "prewatch": "node ../../../scripts/version-update.js", "peer-api-check": "node ../../../scripts/peer-api-check.js", @@ -37,6 +38,9 @@ "node": ">=18" }, "files": [ + "build/esm/**/*.js", + "build/esm/**/*.js.map", + "build/esm/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.js.map", "build/src/**/*.d.ts", diff --git a/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json new file mode 100644 index 00000000000..750e697b70c --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json @@ -0,0 +1,37 @@ +{ + "extends": "../../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "build/esm", + "rootDir": "src", + "tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../packages/sdk-metrics" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../opentelemetry-instrumentation" + } + ] +} diff --git a/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esnext.json b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esnext.json new file mode 100644 index 00000000000..c506f634b23 --- /dev/null +++ b/experimental/packages/opentelemetry-instrumentation-http/tsconfig.esnext.json @@ -0,0 +1,37 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "outDir": "build/esnext", + "rootDir": "src", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ], + "references": [ + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + }, + { + "path": "../../../packages/sdk-metrics" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../opentelemetry-instrumentation" + } + ] +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 1a99e986fd2..3c280b0b09f 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -38,6 +38,12 @@ { "path": "experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.esm.json" }, + { + "path": "experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json" + }, { "path": "experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.esm.json" }, diff --git a/tsconfig.esnext.json b/tsconfig.esnext.json index 1ed2cfadb57..ac7c500283f 100644 --- a/tsconfig.esnext.json +++ b/tsconfig.esnext.json @@ -38,6 +38,12 @@ { "path": "experimental/packages/opentelemetry-instrumentation-fetch/tsconfig.esnext.json" }, + { + "path": "experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esnext.json" + }, + { + "path": "experimental/packages/opentelemetry-instrumentation-http/tsconfig.esnext.json" + }, { "path": "experimental/packages/opentelemetry-instrumentation-xml-http-request/tsconfig.esnext.json" },