Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: widen peer dependency range to include zone.js v0.15.0 #2571

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0",
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0"
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0 || ^0.15.0"
},
"devDependencies": {
"@babel/core": "7.24.6",
Expand Down
36 changes: 16 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"webpack": "5.94.0",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0",
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0"
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0 || ^0.15.0"
},
"dependencies": {
"@opentelemetry/core": "^1.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"webpack": "5.94.0",
"webpack-cli": "5.1.4",
"webpack-merge": "5.10.0",
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0"
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0 || ^0.15.0"
},
"dependencies": {
"@opentelemetry/core": "^1.8.0",
Expand All @@ -85,7 +85,7 @@
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0",
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0"
"zone.js": "^0.11.4 || ^0.13.0 || ^0.14.0 || ^0.15.0"
},
"sideEffects": false,
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/web/opentelemetry-instrumentation-user-interaction#readme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ export class UserInteractionInstrumentation extends InstrumentationBase<UserInte
* implements enable function
*/
override enable() {
const ZoneWithPrototype = this.getZoneWithPrototype();
const ZoneWithPrototype = this._getZoneWithPrototype();
this._diag.debug(
'applying patch to',
this.moduleName,
Expand Down Expand Up @@ -645,7 +645,7 @@ export class UserInteractionInstrumentation extends InstrumentationBase<UserInte
* implements unpatch function
*/
override disable() {
const ZoneWithPrototype = this.getZoneWithPrototype();
const ZoneWithPrototype = this._getZoneWithPrototype();
this._diag.debug(
'removing patch from',
this.moduleName,
Expand Down Expand Up @@ -680,7 +680,7 @@ export class UserInteractionInstrumentation extends InstrumentationBase<UserInte
/**
* returns Zone
*/
getZoneWithPrototype(): ZoneTypeWithPrototype | undefined {
private _getZoneWithPrototype(): ZoneTypeWithPrototype | undefined {
Copy link
Member Author

@pichlermarc pichlermarc Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer note: this is the breaking change - IIUC this was not intended to be exposed to the end-user. ZoneWithPrototype is in from internal-types and it leaked Zone.js types to the public API.

const _window: WindowWithZone = window as unknown as WindowWithZone;
return _window.Zone;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

/// <reference types="zone.js" />
import { HrTime } from '@opentelemetry/api';
import { EventName } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ describe('UserInteractionInstrumentation', () => {
});

sandbox
.stub(userInteractionInstrumentation, 'getZoneWithPrototype')
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore this is private, but it exists
.stub(userInteractionInstrumentation, '_getZoneWithPrototype')
.callsFake(() => {
return false as any;
});
Expand Down
Loading