Skip to content

fix(v7/cdn): Stop using Object.assign to be ES5 compatible #17080

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

Open
wants to merge 1 commit into
base: v7
Choose a base branch
from
Open
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
18 changes: 9 additions & 9 deletions packages/core/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
Client,
Event,
EventHint,
EventProcessor,
Integration,
IntegrationClass,
IntegrationFn,
Expand Down Expand Up @@ -148,9 +149,9 @@ export function setupIntegration(client: Client, integration: Integration, integ
if (client.addEventProcessor && typeof integration.processEvent === 'function') {
const callback = integration.processEvent.bind(integration) as typeof integration.processEvent;

const processor = Object.assign((event: Event, hint: EventHint) => callback(event, hint, client), {
id: integration.name,
});
const processor: EventProcessor = (event: Event, hint: EventHint): ReturnType<typeof callback> =>
callback(event, hint, client);
processor.id = integration.name;

client.addEventProcessor(processor);
}
Expand Down Expand Up @@ -191,12 +192,11 @@ export function convertIntegrationFnToClass<Fn extends IntegrationFn>(
name: string,
fn: Fn,
): IntegrationClass<Integration> {
return Object.assign(
function ConvertedIntegration(...args: Parameters<Fn>): Integration {
return fn(...args);
},
{ id: name },
) as unknown as IntegrationClass<Integration>;
const ConvertedIntegration = function ConvertedIntegration(...args: Parameters<Fn>): Integration {
return fn(...args);
};
ConvertedIntegration.id = name;
return ConvertedIntegration as unknown as IntegrationClass<Integration>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ module.exports = {
const functionName = node.callee.property.name;

const es6ArrayFunctions = ['copyWithin', 'values', 'fill'];
const es6ObjectFunctions = ['assign'];
const es6StringFunctions = ['repeat'];

const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions);
const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions, es6ObjectFunctions);
if (es6Functions.indexOf(functionName) > -1) {
context.report({
node: node.callee.property,
Expand Down
14 changes: 5 additions & 9 deletions packages/tracing-internal/src/browser/web-vitals/lib/observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ export const observe = <K extends keyof PerformanceEntryMap>(
const po = new PerformanceObserver(list => {
callback(list.getEntries() as PerformanceEntryMap[K]);
});
po.observe(
Object.assign(
{
type,
buffered: true,
},
opts || {},
) as PerformanceObserverInit,
);
po.observe({
type,
buffered: true,
...opts,
} as PerformanceObserverInit);
return po;
}
} catch (e) {
Expand Down
Loading