From 2698bb1a5a4de5a5c6272643d6e50180db874d64 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Fri, 10 Nov 2023 01:46:06 -0800 Subject: [PATCH] feat: add esnext target for web instrumentations (#1776) Co-authored-by: Daniel Dyla Co-authored-by: Marc Pichler --- .../package.json | 10 +++++++--- .../tsconfig.esnext.json | 11 +++++++++++ .../package.json | 10 +++++++--- .../tsconfig.esnext.json | 12 ++++++++++++ .../package.json | 10 +++++++--- .../tsconfig.esnext.json | 13 +++++++++++++ .../opentelemetry-plugin-react-load/package.json | 10 +++++++--- .../tsconfig.esnext.json | 12 ++++++++++++ tsconfig.base.esnext.json | 9 +++++++++ 9 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json create mode 100644 plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json create mode 100644 plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json create mode 100644 plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json create mode 100644 tsconfig.base.esnext.json diff --git a/plugins/web/opentelemetry-instrumentation-document-load/package.json b/plugins/web/opentelemetry-instrumentation-document-load/package.json index 5bee7e0b05..256bb452d4 100644 --- a/plugins/web/opentelemetry-instrumentation-document-load/package.json +++ b/plugins/web/opentelemetry-instrumentation-document-load/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry document-load automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-document-load --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build -watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build -watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", diff --git a/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json new file mode 100644 index 0000000000..cb78dd6ff3 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-document-load/tsconfig.esnext.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-long-task/package.json b/plugins/web/opentelemetry-instrumentation-long-task/package.json index 1ea45db5da..9e498a976c 100644 --- a/plugins/web/opentelemetry-instrumentation-long-task/package.json +++ b/plugins/web/opentelemetry-instrumentation-long-task/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry long task API automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", diff --git a/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json new file mode 100644 index 0000000000..b2380afb29 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-long-task/tsconfig.esnext.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "files": [ "node_modules/zone.js/dist/zone.js.d.ts"], + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index 823c8336a0..a3055a275c 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry UserInteraction automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-user-interaction --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json b/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json new file mode 100644 index 0000000000..c593d54802 --- /dev/null +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/tsconfig.esnext.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "skipLibCheck": true, + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "files": [ "node_modules/zone.js/dist/zone.js.d.ts"], + "include": [ + "src/**/*.ts" + ] +} diff --git a/plugins/web/opentelemetry-plugin-react-load/package.json b/plugins/web/opentelemetry-plugin-react-load/package.json index 5922c9e6f4..3d87ab766b 100644 --- a/plugins/web/opentelemetry-plugin-react-load/package.json +++ b/plugins/web/opentelemetry-plugin-react-load/package.json @@ -4,20 +4,21 @@ "description": "OpenTelemetry React loading automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", + "esnext": "build/esnext/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js-contrib", "scripts": { - "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json", + "clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/plugin-react-load --include-dependencies", "prewatch": "npm run precompile", "version:update": "node ../../../scripts/version-update.js", - "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json", + "compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json", "prepare": "npm run compile", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json" + "watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json" }, "keywords": [ "opentelemetry", @@ -36,6 +37,9 @@ "build/esm/**/*.js", "build/esm/**/*.map", "build/esm/**/*.d.ts", + "build/esnext/**/*.js", + "build/esnext/**/*.map", + "build/esnext/**/*.d.ts", "build/src/**/*.js", "build/src/**/*.map", "build/src/**/*.d.ts", diff --git a/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json b/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json new file mode 100644 index 0000000000..96f396167e --- /dev/null +++ b/plugins/web/opentelemetry-plugin-react-load/tsconfig.esnext.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.base.esnext.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "build/esnext", + "jsx": "react", + "tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] +} diff --git a/tsconfig.base.esnext.json b/tsconfig.base.esnext.json new file mode 100644 index 0000000000..7875da812e --- /dev/null +++ b/tsconfig.base.esnext.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "module": "esnext", + // target should be aligned with tsconfig.base.json + "target": "es2017", + "moduleResolution": "node" + }, +}