Skip to content

Commit cf8edbe

Browse files
robbkiddJamieDanielsontrentmpichlermarc
authored
refactor: remove "export *" in favor of explicit named exports (open-telemetry#4880)
Co-authored-by: Jamie Danielson <[email protected]> Co-authored-by: Trent Mick <[email protected]> Co-authored-by: Marc Pichler <[email protected]>
1 parent 5cc3dc2 commit cf8edbe

File tree

62 files changed

+521
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+521
-133
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
2727
### :house: (Internal)
2828

2929
* refactor: Simplify the code for the `getEnv` function [#4799](https://github.com/open-telemetry/opentelemetry-js/pull/4799) @danstarns
30+
* refactor: remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
31+
* Packages updated:
32+
* opentelemetry-context-zone
33+
* opentelemetry-core
34+
* opentelemetry-exporter-jaeger
35+
* opentelemetry-exporter-zipkin
36+
* opentelemetry-propagator-b3
37+
* opentelemetry-propagator-jaeger
38+
* opentelemetry-sdk-trace-base
39+
* opentelemetry-sdk-trace-node
40+
* opentelemetry-sdk-trace-web
41+
* propagator-aws-xray
42+
* sdk-metrics
3043

3144
## 1.25.1
3245

api/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ All notable changes to this project will be documented in this file.
1515

1616
### :house: (Internal)
1717

18+
* refactor(api): remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
19+
1820
## 1.9.0
1921

2022
### :rocket: (Enhancement)

api/src/platform/browser/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

api/src/platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './node';
17+
export { _globalThis } from './node';

api/src/platform/node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

eslint.base.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module.exports = {
5555
}
5656
}],
5757
"@typescript-eslint/no-shadow": ["warn"],
58+
"no-restricted-syntax": ["error", "ExportAllDeclaration"],
5859
"prefer-rest-params": "off",
5960
}
6061
},

experimental/CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ All notable changes to experimental packages in this project will be documented
3131
### :house: (Internal)
3232

3333
* refactor: Simplify the code for the `getEnv` function [#4799](https://github.com/open-telemetry/opentelemetry-js/pull/4799) @danstarns
34+
* refactor: remove "export *" in favor of explicit named exports [#4880](https://github.com/open-telemetry/opentelemetry-js/pull/4880) @robbkidd
35+
* Packages updated:
36+
* api-events
37+
* api-logs
38+
* opentelemetry-browser-detector
39+
* opentelemetry-exporter-prometheus
40+
* opentelemetry-instrumentation-fetch
41+
* opentelemetry-instrumentation-http
42+
* opentelemetry-instrumentation-xml-http-request
43+
* opentelemetry-instrumentation
3444

3545
## 0.52.1
3646

experimental/packages/api-events/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './types/EventLogger';
18-
export * from './types/EventLoggerProvider';
19-
export * from './types/Event';
20-
export * from './types/EventLoggerOptions';
17+
export { EventLogger } from './types/EventLogger';
18+
export { EventLoggerProvider } from './types/EventLoggerProvider';
19+
export { Event } from './types/Event';
20+
export { EventLoggerOptions } from './types/EventLoggerOptions';
2121

2222
import { EventsAPI } from './api/events';
2323
export const events = EventsAPI.getInstance();

experimental/packages/api-events/src/platform/browser/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

experimental/packages/api-events/src/platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './node';
17+
export { _globalThis } from './node';

experimental/packages/api-events/src/platform/node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

experimental/packages/api-logs/src/index.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './types/Logger';
18-
export * from './types/LoggerProvider';
19-
export * from './types/LogRecord';
20-
export * from './types/LoggerOptions';
21-
export * from './types/AnyValue';
22-
export * from './NoopLogger';
23-
export * from './NoopLoggerProvider';
17+
export { Logger } from './types/Logger';
18+
export { LoggerProvider } from './types/LoggerProvider';
19+
export {
20+
LogAttributes,
21+
LogBody,
22+
LogRecord,
23+
SeverityNumber,
24+
} from './types/LogRecord';
25+
export { LoggerOptions } from './types/LoggerOptions';
26+
export { AnyValue, AnyValueMap } from './types/AnyValue';
27+
export { NOOP_LOGGER, NoopLogger } from './NoopLogger';
28+
export { NOOP_LOGGER_PROVIDER, NoopLoggerProvider } from './NoopLoggerProvider';
2429

2530
import { LogsAPI } from './api/logs';
2631
export const logs = LogsAPI.getInstance();

experimental/packages/api-logs/src/platform/browser/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

experimental/packages/api-logs/src/platform/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './node';
17+
export { _globalThis } from './node';

experimental/packages/api-logs/src/platform/node/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './globalThis';
17+
export { _globalThis } from './globalThis';

experimental/packages/exporter-logs-otlp-grpc/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPLogExporter';

experimental/packages/exporter-trace-otlp-grpc/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPTraceExporter';

experimental/packages/exporter-trace-otlp-http/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './platform';

experimental/packages/exporter-trace-otlp-http/src/platform/browser/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPTraceExporter';

experimental/packages/exporter-trace-otlp-http/src/platform/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './node';

experimental/packages/exporter-trace-otlp-http/src/platform/node/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPTraceExporter';

experimental/packages/opentelemetry-browser-detector/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './BrowserDetector';
17+
export { browserDetector } from './BrowserDetector';

experimental/packages/opentelemetry-exporter-metrics-otlp-grpc/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPMetricExporter';

experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './platform';
1821
export * from './OTLPMetricExporterOptions';
1922
export * from './OTLPMetricExporterBase';

experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/browser/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPMetricExporter';

experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './node';

experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/platform/node/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPMetricExporter';

experimental/packages/opentelemetry-exporter-metrics-otlp-proto/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * from './OTLPMetricExporter';

experimental/packages/opentelemetry-exporter-prometheus/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './PrometheusExporter';
18-
export * from './PrometheusSerializer';
19-
export * from './export/types';
17+
export { PrometheusExporter } from './PrometheusExporter';
18+
export { PrometheusSerializer } from './PrometheusSerializer';
19+
export { ExporterConfig } from './export/types';

experimental/packages/opentelemetry-instrumentation-fetch/src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './fetch';
17+
export {
18+
FetchCustomAttributeFunction,
19+
FetchInstrumentation,
20+
FetchInstrumentationConfig,
21+
} from './fetch';

experimental/packages/opentelemetry-instrumentation-http/src/index.ts

+46-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,49 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './http';
18-
export * from './types';
19-
export * from './utils';
17+
export { HttpInstrumentation } from './http';
18+
export {
19+
Err,
20+
Func,
21+
GetFunction,
22+
Http,
23+
HttpCallback,
24+
HttpCallbackOptional,
25+
HttpCustomAttributeFunction,
26+
HttpInstrumentationConfig,
27+
HttpRequestArgs,
28+
HttpRequestCustomAttributeFunction,
29+
HttpResponseCustomAttributeFunction,
30+
Https,
31+
IgnoreIncomingRequestFunction,
32+
IgnoreMatcher,
33+
IgnoreOutgoingRequestFunction,
34+
ParsedRequestOptions,
35+
RequestFunction,
36+
RequestSignature,
37+
StartIncomingSpanCustomAttributeFunction,
38+
StartOutgoingSpanCustomAttributeFunction,
39+
} from './types';
40+
export {
41+
extractHostnameAndPort,
42+
getAbsoluteUrl,
43+
getIncomingRequestAttributes,
44+
getIncomingRequestAttributesOnResponse,
45+
getIncomingRequestMetricAttributes,
46+
getIncomingRequestMetricAttributesOnResponse,
47+
getOutgoingRequestAttributes,
48+
getOutgoingRequestAttributesOnResponse,
49+
getOutgoingRequestMetricAttributes,
50+
getOutgoingRequestMetricAttributesOnResponse,
51+
getRequestInfo,
52+
headerCapture,
53+
isCompressed,
54+
isIgnored,
55+
isValidOptionsType,
56+
parseResponseStatus,
57+
satisfiesPattern,
58+
setAttributesFromHttpKind,
59+
setRequestContentLengthAttribute,
60+
setResponseContentLengthAttribute,
61+
setSpanWithError,
62+
} from './utils';

experimental/packages/opentelemetry-instrumentation-xml-http-request/src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
export * from './xhr';
17+
export {
18+
XHRCustomAttributeFunction,
19+
XMLHttpRequestInstrumentation,
20+
XMLHttpRequestInstrumentationConfig,
21+
} from './xhr';

experimental/packages/opentelemetry-instrumentation/src/index.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ export { registerInstrumentations } from './autoLoader';
1818
export { InstrumentationBase } from './platform/index';
1919
export { InstrumentationNodeModuleDefinition } from './instrumentationNodeModuleDefinition';
2020
export { InstrumentationNodeModuleFile } from './instrumentationNodeModuleFile';
21-
export * from './types';
22-
export * from './types_internal';
23-
export * from './utils';
21+
export {
22+
Instrumentation,
23+
InstrumentationConfig,
24+
InstrumentationModuleDefinition,
25+
InstrumentationModuleFile,
26+
ShimWrapped,
27+
SpanCustomizationHook,
28+
} from './types';
29+
export { AutoLoaderOptions, AutoLoaderResult } from './types_internal';
30+
export {
31+
isWrapped,
32+
safeExecuteInTheMiddle,
33+
safeExecuteInTheMiddleAsync,
34+
} from './utils';

experimental/packages/opentelemetry-sdk-node/src/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1720
export * as api from '@opentelemetry/api';
1821
export * as contextBase from '@opentelemetry/api';
1922
export * as core from '@opentelemetry/core';
@@ -22,5 +25,5 @@ export * as metrics from '@opentelemetry/sdk-metrics';
2225
export * as node from '@opentelemetry/sdk-trace-node';
2326
export * as resources from '@opentelemetry/resources';
2427
export * as tracing from '@opentelemetry/sdk-trace-base';
25-
export * from './sdk';
26-
export * from './types';
28+
export { LoggerProviderConfig, MeterProviderConfig, NodeSDK } from './sdk';
29+
export { NodeSDKConfiguration } from './types';

experimental/packages/otlp-exporter-base/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
/* eslint no-restricted-syntax: ["warn", "ExportAllDeclaration"] --
18+
* TODO: Replace export * with named exports before next major version
19+
*/
1620
export * from './platform';
1721
export { OTLPExporterBase } from './OTLPExporterBase';
1822
export {

integration-tests/api/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"@opentelemetry/api": "^1.0.0",
32+
"@opentelemetry/core": "^1.0.0",
3233
"@types/mocha": "10.0.7",
3334
"@types/node": "18.6.5",
3435
"codecov": "3.8.3",

0 commit comments

Comments
 (0)