From 06acb2b06a69317c3ee490a2aa455a8024fd72fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serkan=20=C3=96ZAL?= Date: Sun, 19 Jan 2025 19:54:49 +0300 Subject: [PATCH] feat(opentelemetry-instrumentation-{http|grpc}): generate esm build files too --- .../package.json | 10 +++-- .../tsconfig.esm.json | 34 +++++++++++++++++ .../package.json | 10 +++-- .../tsconfig.esm.json | 37 +++++++++++++++++++ 4 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.esm.json create mode 100644 experimental/packages/opentelemetry-instrumentation-http/tsconfig.esm.json diff --git a/experimental/packages/opentelemetry-instrumentation-grpc/package.json b/experimental/packages/opentelemetry-instrumentation-grpc/package.json index 089b1d9af1..92c74f91d1 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 0000000000..49107c82b6 --- /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": "../opentelemetry-instrumentation" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/opentelemetry-core" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + } + ] +} diff --git a/experimental/packages/opentelemetry-instrumentation-http/package.json b/experimental/packages/opentelemetry-instrumentation-http/package.json index 8ab97f19d3..e8115e53c6 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 0000000000..8e1ce2b634 --- /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": "../../../packages/opentelemetry-core" + }, + { + "path": "../opentelemetry-instrumentation" + }, + { + "path": "../../../semantic-conventions" + }, + { + "path": "../../../api" + }, + { + "path": "../../../packages/opentelemetry-context-async-hooks" + }, + { + "path": "../../../packages/sdk-metrics" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-base" + }, + { + "path": "../../../packages/opentelemetry-sdk-trace-node" + } + ] +}