Skip to content

Commit

Permalink
Merge branch 'main' into prerelease-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan committed Jul 10, 2023
2 parents 251a484 + a623ff3 commit 206edb6
Show file tree
Hide file tree
Showing 35 changed files with 4,667 additions and 4,555 deletions.
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ module.exports = {
},
},
{
files: ['scripts/**/*.js'],
files: ['scripts/**/*.js', 'packages/*/scripts/**/*.js'],
rules: {
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
'local-rules/secure-command-execution': 'error',
Expand Down Expand Up @@ -256,7 +256,14 @@ module.exports = {
},
{
// Files executed by nodejs
files: ['**/webpack.*.js', 'scripts/**/*.js', 'test/**/*.js', 'eslint-local-rules/**/*.js', '.eslintrc.js'],
files: [
'**/webpack.*.js',
'scripts/**/*.js',
'test/**/*.js',
'eslint-local-rules/**/*.js',
'.eslintrc.js',
'packages/*/scripts/**/*.js',
],
env: {
node: true,
},
Expand Down
1 change: 1 addition & 0 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ paths:
- packages/rum/src
- packages/rum-core/src
- packages/rum-slim/src
- packages/worker/src
paths-ignore:
- '**/*.spec.ts'
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
CURRENT_STAGING: staging-27
CURRENT_STAGING: staging-28
APP: 'browser-sdk'
CURRENT_CI_IMAGE: 49
BUILD_STABLE_REGISTRY: '486234852809.dkr.ecr.us-east-1.amazonaws.com'
Expand Down
2 changes: 1 addition & 1 deletion .wokeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ yarn.lock
.yarn/releases

# code import
deflateWorker.js
packages/worker/src/domain/deflate.js
6 changes: 5 additions & 1 deletion eslint-local-rules/disallowSideEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const pathsWithSideEffect = new Set([
])

// Those packages are known to have no side effects when evaluated
const packagesWithoutSideEffect = new Set(['@datadog/browser-core', '@datadog/browser-rum-core'])
const packagesWithoutSideEffect = new Set([
'@datadog/browser-core',
'@datadog/browser-rum-core',
'@datadog/browser-worker/string',
])

/**
* Iterate over the given node and its children, and report any node that may have a side effect
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"performances"
],
"scripts": {
"postinstall": "scripts/cli init_submodule",
"postinstall": "scripts/cli init_submodule && yarn workspace @datadog/browser-worker build",
"build": "lerna run build --stream",
"build:bundle": "lerna run build:bundle --stream",
"format": "prettier --check .",
Expand Down
14 changes: 13 additions & 1 deletion packages/core/src/domain/tracekit/tracekit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { instrumentMethodAndCallOriginal } from '../../tools/instrumentMethod'
import { jsonStringify } from '../../tools/serialisation/jsonStringify'
import { computeStackTrace } from './computeStackTrace'
import type { UnhandledErrorCallback, StackTrace } from './types'

Expand Down Expand Up @@ -77,7 +78,18 @@ function tryToParseMessage(messageObj: unknown) {
let name
let message
if ({}.toString.call(messageObj) === '[object String]') {
;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
try {
;[, name, message] = ERROR_TYPES_RE.exec(messageObj as string)!
} catch (error) {
throw new Error(
`Tracekit try parse error: ${String(error)} ${jsonStringify({
messageObj,
// eslint-disable-next-line @typescript-eslint/unbound-method
exec: String(RegExp.prototype.exec),
ERROR_TYPES_RE: String(ERROR_TYPES_RE),
})!}`
)
}
}
return { name, message }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('warnIfCustomerDataLimitReached', () => {
const warned = warnIfCustomerDataLimitReached(CUSTOMER_DATA_BYTES_LIMIT + 1, CustomerDataType.User)
expect(warned).toEqual(true)
expect(displaySpy).toHaveBeenCalledWith(
"The user data is over 3KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth."
'The user data exceeds the recommended 3KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning'
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const enum CustomerDataType {
export function warnIfCustomerDataLimitReached(bytesCount: number, customerDataType: CustomerDataType): boolean {
if (bytesCount > CUSTOMER_DATA_BYTES_LIMIT) {
display.warn(
`The ${customerDataType} data is over ${
`The ${customerDataType} data exceeds the recommended ${
CUSTOMER_DATA_BYTES_LIMIT / ONE_KIBI_BYTE
}KiB. On low connectivity, the SDK has the potential to exhaust the user's upload bandwidth.`
}KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-3kib-warning`
)
return true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rum-slim/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*
!/bundle/datadog-rum.js
!/bundle/datadog-rum-slim.js
!/cjs/**/*
!/esm/**/*
!/src/**/*
Expand Down
3 changes: 2 additions & 1 deletion packages/rum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"dependencies": {
"@datadog/browser-core": "5.0.0-alpha.0",
"@datadog/browser-rum-core": "5.0.0-alpha.0"
"@datadog/browser-rum-core": "5.0.0-alpha.0",
"@datadog/browser-worker": "5.0.0-alpha.0"
},
"peerDependencies": {
"@datadog/browser-logs": "5.0.0-alpha.0"
Expand Down
Loading

0 comments on commit 206edb6

Please sign in to comment.