Skip to content

Commit 7bd5316

Browse files
authored
Merge branch 'main' into jacksonweber/sampler-without-exporter
2 parents a639e1c + ac75b70 commit 7bd5316

File tree

13 files changed

+702
-114
lines changed

13 files changed

+702
-114
lines changed

api/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ All notable changes to this project will be documented in this file.
55
## Unreleased
66

77
* feat(api): add SugaredTracer for functions not defined in the spec
8-
9-
## Unreleased
8+
* fix(api): fix unreachable @opentelemetry/api/experimental entry [#4446](https://github.com/open-telemetry/opentelemetry-js/pull/4446) @legendecas
109

1110
## 1.7.0
1211

api/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"default": "./build/src/index.js"
2121
},
2222
"./experimental": {
23-
"module": "./build/esm/experimental.js",
24-
"esnext": "./build/esnext/experimental.js",
25-
"types": "./build/src/experimental.d.ts",
26-
"default": "./build/src/experimental.js"
23+
"module": "./build/esm/experimental/index.js",
24+
"esnext": "./build/esnext/experimental/index.js",
25+
"types": "./build/src/experimental/index.d.ts",
26+
"default": "./build/src/experimental/index.js"
2727
}
2828
},
2929
"repository": "open-telemetry/opentelemetry-js",

eslint.base.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module.exports = {
55
"node",
66
"prettier"
77
],
8-
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
8+
extends: ["eslint:recommended", "plugin:prettier/recommended"],
99
parser: "@typescript-eslint/parser",
1010
parserOptions: {
11-
"project": "./tsconfig.json"
11+
"project": null,
1212
},
1313
rules: {
1414
"quotes": ["error", "single", { "avoidEscape": true }],
@@ -29,6 +29,11 @@ module.exports = {
2929
overrides: [
3030
{
3131
files: ['*.ts'],
32+
// Enable typescript-eslint for ts files.
33+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
34+
parserOptions: {
35+
"project": "./tsconfig.json"
36+
},
3237
rules: {
3338
"@typescript-eslint/no-floating-promises": "error",
3439
"@typescript-eslint/no-this-alias": "off",
@@ -50,21 +55,33 @@ module.exports = {
5055
}
5156
}],
5257
"@typescript-eslint/no-shadow": ["warn"],
58+
"prefer-rest-params": "off",
5359
}
5460
},
5561
{
5662
files: ["test/**/*.ts"],
63+
// Enable typescript-eslint for ts files.
64+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
65+
parserOptions: {
66+
"project": "./tsconfig.json"
67+
},
5768
rules: {
5869
"no-empty": "off",
5970
"@typescript-eslint/ban-ts-ignore": "off",
71+
"@typescript-eslint/ban-types": ["warn", {
72+
"types": {
73+
"Function": null,
74+
}
75+
}],
6076
"@typescript-eslint/no-empty-function": "off",
6177
"@typescript-eslint/no-explicit-any": "off",
6278
"@typescript-eslint/no-unused-vars": "off",
6379
"@typescript-eslint/no-var-requires": "off",
6480
"@typescript-eslint/no-shadow": ["off"],
6581
"@typescript-eslint/no-floating-promises": ["off"],
6682
"@typescript-eslint/no-non-null-assertion": ["off"],
67-
"@typescript-eslint/explicit-module-boundary-types": ["off"]
83+
"@typescript-eslint/explicit-module-boundary-types": ["off"],
84+
"prefer-rest-params": "off",
6885
}
6986
}
7087
]

packages/opentelemetry-exporter-jaeger/src/version.js renamed to integration-tests/api/.eslintrc.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"use strict";
21
/*
32
* Copyright The OpenTelemetry Authors
43
*
@@ -14,7 +13,12 @@
1413
* See the License for the specific language governing permissions and
1514
* limitations under the License.
1615
*/
17-
Object.defineProperty(exports, "__esModule", { value: true });
18-
exports.VERSION = void 0;
19-
// this is autogenerated file, see scripts/version-update.js
20-
exports.VERSION = '1.16.0';
16+
module.exports = {
17+
env: {
18+
mocha: true,
19+
commonjs: true,
20+
node: true,
21+
browser: true,
22+
},
23+
...require('../../eslint.base.js'),
24+
};

integration-tests/api/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `opentelemetry/integration-tests-api`
2+
3+
This is an integration test suite for `@opentelemetry/api` that verifies the
4+
api package works as expected when being imported.
5+
6+
## Test
7+
8+
```sh
9+
npm run test
10+
```

integration-tests/api/package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "@opentelemetry/integration-tests-api",
3+
"version": "1.21.0",
4+
"private": true,
5+
"publishConfig": {
6+
"access": "restricted"
7+
},
8+
"description": "Verifies @opentelemetry/api in integration tests",
9+
"author": "OpenTelemetry Authors",
10+
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/integration-tests/api",
11+
"license": "Apache-2.0",
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/open-telemetry/opentelemetry-js.git"
15+
},
16+
"bugs": {
17+
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
18+
},
19+
"engines": {
20+
"node": ">=14"
21+
},
22+
"scripts": {
23+
"compile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
24+
"pretest": "npm run compile",
25+
"test": "nyc mocha test/**/*.test.js",
26+
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
27+
"lint": "eslint . --ext .js",
28+
"lint:fix": "eslint . --ext .js --fix"
29+
},
30+
"devDependencies": {
31+
"@opentelemetry/api": "^1.0.0",
32+
"@types/mocha": "9.1.1",
33+
"@types/node": "18.6.5",
34+
"codecov": "3.8.3",
35+
"cross-var": "1.1.0",
36+
"lerna": "6.6.2",
37+
"mocha": "10.0.0",
38+
"nyc": "15.1.0"
39+
}
40+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
const assert = require('assert');
18+
19+
// TypeScript v4.4.4 doesn't support `node16` or `nodenext` in
20+
// [Module Resolution](https://www.typescriptlang.org/tsconfig#moduleResolution)
21+
// which is required for typescript to resolve the `package.json#exports`
22+
// entries.
23+
// Additionally, using `node16` or `nodenext` in `tsconfig.json#moduleResolution`
24+
// requires the TypeScript to generate ESModule outputs. This is a breaking
25+
// change for CJS users.
26+
// So we have to use plain JavaScript to verity the `package.json#exports` here.
27+
28+
describe('@opentelemetry/api entries', () => {
29+
it('should import root entry', async () => {
30+
const mod = await import('@opentelemetry/api');
31+
assert.ok(mod.trace != null);
32+
});
33+
34+
it('should require root entry', () => {
35+
const mod = require('@opentelemetry/api');
36+
assert.ok(mod.trace != null);
37+
});
38+
39+
it('should import experimental entry', async () => {
40+
const mod = await import('@opentelemetry/api/experimental');
41+
assert.ok(mod.wrapTracer != null);
42+
});
43+
44+
it('should require experimental entry', () => {
45+
const mod = require('@opentelemetry/api/experimental');
46+
assert.ok(mod.wrapTracer != null);
47+
});
48+
});

0 commit comments

Comments
 (0)