Skip to content

Commit

Permalink
flag packages without side effects (#173351)
Browse files Browse the repository at this point in the history
## Summary

Add the `sideEffects` meta to packages without side effects to optimize
tree-shaking on browser-side bundles.


Notes:
- it mostly impacts the `securitySolution` app (almost 2mb reduction)
- it's not always beneficial for all apps, some apps gain some weight,
likely related to the way webpack optimizes the chunks, but I feel like
it's still overall beneficial (don't hesitate to say if you think
otherwise)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
pgayvallet and kibanamachine authored Dec 19, 2023
1 parent cd02e8d commit 02bafbd
Show file tree
Hide file tree
Showing 32 changed files with 69 additions and 31 deletions.
3 changes: 2 additions & 1 deletion packages/kbn-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"version": "1.0.0",
"description": "Kibana Analytics tool",
"author": "Kibana Core",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-crypto-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/crypto-browser",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-custom-integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/custom-integrations",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
5 changes: 4 additions & 1 deletion packages/kbn-dom-drag-drop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@kbn/dom-drag-drop",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": [
"*.scss"
]
}
3 changes: 2 additions & 1 deletion packages/kbn-es-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/es-query",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-expandable-flyout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/expandable-flyout",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-guided-onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/guided-onboarding",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-io-ts-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/io-ts-utils",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-language-documentation-popover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/language-documentation-popover",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"private": true,
"author": "Kibana Core",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-profiling-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/profiling-utils",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-resizable-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/resizable-layout",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-rule-data-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/rule-data-utils",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
5 changes: 4 additions & 1 deletion packages/kbn-search-index-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@kbn/search-index-documents",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": [
"*.scss"
]
}
5 changes: 4 additions & 1 deletion packages/kbn-search-response-warnings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@kbn/search-response-warnings",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": [
"*.scss"
]
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "Security Solution auto complete",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-ecs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/securitysolution-ecs",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-es-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "security solution elastic search utilities to use across plugins such lists, security_solution, cases, etc...",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/securitysolution-exception-list-components",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-grouping/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/securitysolution-grouping",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-hook-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "Security Solution utilities for React hooks",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "io ts utilities and types to be shared with plugins from the security solution project",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-io-ts-list-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "io ts utilities and types to be shared with plugins from the security solution project",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-io-ts-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "io ts utilities and types to be shared with plugins from the security solution project",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-io-ts-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "io ts utilities and types to be shared with plugins from the security solution project",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-list-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "Security solution list ReactJS hooks",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-list-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "security solution list utilities",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"description": "security solution utilities to use across plugins such lists, security_solution, cases, etc...",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true
"private": true,
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-shared-ux-utility/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/shared-ux-utility",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
1 change: 1 addition & 0 deletions packages/kbn-std/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"version": "1.0.0",
"author": "Kibana Core",
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false,
"private": true
}
3 changes: 2 additions & 1 deletion packages/kbn-user-profile-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/user-profile-components",
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/kbn-zod-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"license": "SSPL-1.0 OR Elastic License 2.0",
"name": "@kbn/zod-helpers",
"private": true,
"version": "1.0.0"
"version": "1.0.0",
"sideEffects": false
}

0 comments on commit 02bafbd

Please sign in to comment.