Skip to content

Commit

Permalink
♻️ [RUM-232] create a @datadog/browser-worker package (DataDog#2319)
Browse files Browse the repository at this point in the history
* ♻️ [RUM-232] create a @datadog/browser-worker package

* 👷 [RUM-232] add a worker/string entry point

* ♻️ [RUM-232] use the worker package in RUM

* ♻️ [RUM-232] move deflate worker implementation to startDeflateWorker

The old `deflateWorker.js` module was there mainly to contain pako and
the worker implementation. Now that it's been moved, there is little
benefit to keep the old module. Putting the code to
`startDeflateWorker.ts` removes the confusion between the two modules.

* 👌 [RUM-232] move worker "boot" logic in a dedicated module

This follow other packages design
  • Loading branch information
BenoitZugmeyer authored Jul 7, 2023
1 parent 03677a1 commit 2dcd8db
Show file tree
Hide file tree
Showing 30 changed files with 4,649 additions and 4,549 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 .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
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": "4.44.0",
"@datadog/browser-rum-core": "4.44.0"
"@datadog/browser-rum-core": "4.44.0",
"@datadog/browser-worker": "4.44.0"
},
"peerDependencies": {
"@datadog/browser-logs": "4.44.0"
Expand Down
Loading

0 comments on commit 2dcd8db

Please sign in to comment.