Skip to content

Commit

Permalink
feat: add ESM builds for packages used in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
t2t2 committed Apr 28, 2021
1 parent 45e8751 commit bfbad7a
Show file tree
Hide file tree
Showing 16 changed files with 138 additions and 24 deletions.
6 changes: 3 additions & 3 deletions examples/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/auto-instrumentations-web": "^0.15.0",
"@opentelemetry/auto-instrumentations-web": "^0.16.0",
"@opentelemetry/context-zone": "^0.19.0",
"@opentelemetry/core": "^0.19.0",
"@opentelemetry/exporter-collector": "^0.19.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/instrumentation-document-load": "^0.15.0",
"@opentelemetry/instrumentation-user-interaction": "^0.15.0",
"@opentelemetry/instrumentation-document-load": "^0.16.0",
"@opentelemetry/instrumentation-user-interaction": "^0.16.0",
"@opentelemetry/instrumentation-xml-http-request": "^0.19.0",
"@opentelemetry/propagator-b3": "^0.19.0",
"@opentelemetry/tracing": "^0.19.0",
Expand Down
7 changes: 4 additions & 3 deletions metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
"access": "public"
},
"main": "build/src/index.js",
"module": "build/esm/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"clean": "tsc --build --clean",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"compile": "tsc --build",
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"prepare": "npm run compile",
"test:browser": "nyc karma start --single-run",
"version": "node ../../scripts/version-update.js",
"watch": "tsc --build --watch"
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
},
"bugs": {
"url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues"
Expand Down
12 changes: 12 additions & 0 deletions metapackages/auto-instrumentations-web/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"skipLibCheck": true,
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
8 changes: 5 additions & 3 deletions packages/opentelemetry-id-generator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
"publishConfig": {
"access": "public"
},
"module": "build/esm/index.js",
"browser": {
"./src/platform/index.ts": "./src/platform/browser/index.ts",
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
},
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"precompile": "tsc --version",
"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": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:browser": "nyc karma start --single-run",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"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",
"prepare": "npm run compile"
},
"keywords": [
Expand Down
11 changes: 11 additions & 0 deletions packages/opentelemetry-id-generator-aws-xray/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"version": "0.16.0",
"description": "OpenTelemetry document-load automatic instrumentation package.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"clean": "rimraf build/*",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
"compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json",
"prepare": "npm run compile",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
"watch": "tsc -w"
"watch": "tsc --build -watch tsconfig.json tsconfig.esm.json"
},
"keywords": [
"opentelemetry",
Expand All @@ -32,7 +33,11 @@
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
"build/esm/**/*.map",
"build/esm/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.map",
"build/src/**/*.d.ts",
"doc",
"LICENSE",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"version": "0.16.0",
"description": "OpenTelemetry UserInteraction automatic instrumentation package.",
"main": "build/src/index.js",
"module": "build/esm/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": "rimraf build/*",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
"compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json",
"prepare": "npm run compile",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
"watch": "tsc -w"
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
},
"keywords": [
"opentelemetry",
Expand All @@ -32,7 +33,11 @@
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
"build/esm/**/*.map",
"build/esm/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.map",
"build/src/**/*.d.ts",
"doc",
"LICENSE",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"skipLibCheck": true,
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"files": [ "node_modules/zone.js/dist/zone.js.d.ts"],
"include": [
"src/**/*.ts"
]
}
11 changes: 8 additions & 3 deletions plugins/web/opentelemetry-plugin-react-load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"version": "0.16.0",
"description": "OpenTelemetry React loading automatic instrumentation package.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"clean": "rimraf build/*",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
"compile": "npm run version:update && tsc --build tsconfig.json tsconfig.esm.json",
"prepare": "npm run compile",
"tdd": "karma start",
"test:browser": "nyc karma start --single-run",
"watch": "tsc -w"
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json"
},
"keywords": [
"opentelemetry",
Expand All @@ -32,7 +33,11 @@
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
"build/esm/**/*.map",
"build/esm/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.map",
"build/src/**/*.d.ts",
"doc",
"LICENSE",
Expand Down
12 changes: 12 additions & 0 deletions plugins/web/opentelemetry-plugin-react-load/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"jsx": "react",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
10 changes: 7 additions & 3 deletions propagators/opentelemetry-propagator-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
"version": "0.16.0",
"description": "OpenTelemetry AWS Xray propagator provides context propagation for systems that are using AWS X-Ray format.",
"main": "build/src/index.js",
"module": "build/esm/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"precompile": "tsc --version",
"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": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:browser": "nyc karma start --single-run",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"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",
"prepare": "npm run compile"
},
"keywords": [
Expand All @@ -31,6 +32,9 @@
"node": ">=8.0.0"
},
"files": [
"build/esm/**/*.js",
"build/esm/**/*.js.map",
"build/esm/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.js.map",
"build/src/**/*.d.ts",
Expand Down
11 changes: 11 additions & 0 deletions propagators/opentelemetry-propagator-aws-xray/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
10 changes: 7 additions & 3 deletions propagators/opentelemetry-propagator-ot-trace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
"version": "0.16.0",
"description": "The OpenTelemetry OTTracepropagator implements the propagation format used by the \"basic tracer\" implementations from the OpenTracing project",
"main": "build/src/index.js",
"module": "build/esm/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"precompile": "tsc --version",
"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": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:browser": "nyc karma start --single-run",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"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",
"prepare": "npm run compile"
},
"keywords": [
Expand All @@ -33,6 +34,9 @@
"node": ">=8.5.0"
},
"files": [
"build/esm/**/*.js",
"build/esm/**/*.js.map",
"build/esm/**/*.d.ts",
"build/src/**/*.js",
"build/src/**/*.js.map",
"build/src/**/*.d.ts",
Expand Down
11 changes: 11 additions & 0 deletions propagators/opentelemetry-propagator-ot-trace/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
7 changes: 7 additions & 0 deletions tsconfig.base.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "ES6",
"moduleResolution": "node"
}
}

0 comments on commit bfbad7a

Please sign in to comment.