Skip to content

Commit 0b66715

Browse files
♻️ move hook and merge utilities from browser-core to @datadog/js-core (#4797)
1 parent 982444c commit 0b66715

82 files changed

Lines changed: 242 additions & 166 deletions

File tree

Some content is hidden

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

eslint-local-rules/disallowSideEffects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const pathsWithSideEffect = new Set([
4545

4646
// Those packages are known to have no side effects when evaluated
4747
const packagesWithoutSideEffect = new Set([
48+
'@datadog/js-core/assembly',
4849
'@datadog/js-core/time',
4950
'@datadog/js-core/util',
5051
'@datadog/js-core/monitor',

packages/browser-core/src/domain/context/contextManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deepClone } from '../../tools/mergeInto'
1+
import { deepClone } from '@datadog/js-core/util'
22
import { sanitize } from '../../tools/serialisation/sanitize'
33
import type { Context } from '../../tools/serialisation/context'
44
import { Observable } from '../../tools/observable'

packages/browser-core/src/domain/context/contextUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { getType } from '@datadog/js-core/util'
12
import type { Context } from '../../tools/serialisation/context'
23
import { display } from '../../tools/display'
3-
import { getType } from '../../tools/utils/typeUtils'
44

55
/**
66
* Simple check to ensure an object is a valid context

packages/browser-core/src/domain/context/storeContextManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { combine } from '@datadog/js-core/util'
12
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
23
import type { Context } from '../../tools/serialisation/context'
3-
import { combine } from '../../tools/mergeInto'
44
import { isEmptyObject } from '../../tools/utils/objectUtils'
55
import type { ContextManager } from './contextManager'
66
import type { CustomerDataType } from './contextConstants'

packages/browser-core/src/domain/contexts/accountContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RelativeTime } from '@datadog/js-core/time'
2+
import type { Hook } from '@datadog/js-core/assembly'
3+
import { createHook } from '@datadog/js-core/assembly'
24
import { registerCleanupTask } from '../../../test'
35
import { mockRumConfiguration } from '../../../../browser-rum-core/test'
46
import type { ContextManager } from '../context/contextManager'
57
import { display } from '../../tools/display'
68
import { removeStorageListeners } from '../context/storeContextManager'
7-
import type { Hook } from '../../tools/abstractHooks'
8-
import { createHook } from '../../tools/abstractHooks'
99
import { startAccountContext } from './accountContext'
1010

1111
describe('account context', () => {

packages/browser-core/src/domain/contexts/accountContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { Hook } from '@datadog/js-core/assembly'
2+
import { SKIPPED } from '@datadog/js-core/assembly'
13
import type { Configuration } from '../configuration'
24
import { CustomerDataType } from '../context/contextConstants'
35
import { storeContextManager } from '../context/storeContextManager'
4-
import type { Hook } from '../../tools/abstractHooks'
5-
import { SKIPPED } from '../../tools/abstractHooks'
66
import { isEmptyObject } from '../../tools/utils/objectUtils'
77
import { createContextManager } from '../context/contextManager'
88

packages/browser-core/src/domain/contexts/globalContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RelativeTime } from '@datadog/js-core/time'
2+
import type { Hook } from '@datadog/js-core/assembly'
3+
import { createHook } from '@datadog/js-core/assembly'
24
import { registerCleanupTask } from '../../../test'
35
import type { LogsConfiguration } from '../../../../browser-logs/src/domain/configuration'
46
import type { ContextManager } from '../context/contextManager'
57
import { removeStorageListeners } from '../context/storeContextManager'
68
import type { Configuration } from '../configuration'
7-
import type { Hook } from '../../tools/abstractHooks'
8-
import { createHook } from '../../tools/abstractHooks'
99
import { startGlobalContext } from './globalContext'
1010

1111
describe('logs global context', () => {

packages/browser-core/src/domain/contexts/globalContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Hook } from '../../tools/abstractHooks'
1+
import type { Hook } from '@datadog/js-core/assembly'
22
import { CustomerDataType } from '../context/contextConstants'
33
import { storeContextManager } from '../context/storeContextManager'
44
import { createContextManager } from '../context/contextManager'

packages/browser-core/src/domain/contexts/tabContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RelativeTime } from '@datadog/js-core/time'
2+
import type { Hook } from '@datadog/js-core/assembly'
3+
import { createHook } from '@datadog/js-core/assembly'
24
import { registerCleanupTask } from '../../../test'
3-
import type { Hook } from '../../tools/abstractHooks'
4-
import { createHook } from '../../tools/abstractHooks'
55
import { TAB_ID_STORAGE_KEY, resetCachedTabId, startTabContext } from './tabContext'
66

77
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/

packages/browser-core/src/domain/contexts/tabContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Hook } from '../../tools/abstractHooks'
1+
import type { Hook } from '@datadog/js-core/assembly'
22
import { generateUUID } from '../../tools/utils/stringUtils'
33

44
export const TAB_ID_STORAGE_KEY = '_dd_tab_id'

0 commit comments

Comments
 (0)