Skip to content
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

[Presentation] Remove uses of export * from in Presentation Util plugin #145633

Merged
merged 5 commits into from
Nov 18, 2022

Conversation

nickpeihl
Copy link
Member

@nickpeihl nickpeihl commented Nov 17, 2022

Fixes #110893

Summary

Replaces uses of export * with of explicit imports in public/index.ts in Presentation Util plugin.

For reviewers:

This may look daunting as it touches many files across several plugins. I recommend looking at the change on this line first. Prior to this PR this line exports modules from the common/lib directory in the public module. This should not be necessary since other plugins should be able to access these modules from @kbn/presentation-util-plugin/common directly.

resolveWithMissingImage,
encode,
parseDataUrl,
} from './lib';
Copy link
Member Author

@nickpeihl nickpeihl Nov 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about exporting these modules from common/index.ts. It might not be necessary since, unlike the public and server directories, other plugins can import deeply from common directories (ex. import { fontStyle } from '@kbn/presentation-util-plugin/common/lib). But maybe it's better practice to publish these modules from the top level of common as we do with public and server?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like this approach a lot. I'm not sure why common is considered an exception to this deep imports rule.

@nickpeihl nickpeihl added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas technical debt Improvement of the software architecture and operational architecture release_note:skip Skip the PR/issue when compiling release notes v8.7.0 labels Nov 18, 2022
@nickpeihl nickpeihl marked this pull request as ready for review November 18, 2022 15:37
@nickpeihl nickpeihl requested a review from a team as a code owner November 18, 2022 15:37
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This looks a lot cleaner and easier to grok. I like keeping the separation between common and public very obvious rather than re-exporting items from public.

It looks like it didn't result in any major bundle size changes either. LGTM!

@@ -6,9 +6,6 @@
* Side Public License, v 1.
*/

// TODO: https://github.com/elastic/kibana/issues/110893
/* eslint-disable @kbn/eslint/no_export_all */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

resolveWithMissingImage,
encode,
parseDataUrl,
} from './lib';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like this approach a lot. I'm not sure why common is considered an exception to this deep imports rule.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
presentationUtil 186 171 -15

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
presentationUtil 8 7 -1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1.0MB 1.0MB +24.0B
expressionError 13.2KB 13.2KB +2.0B
presentationUtil 130.6KB 130.8KB +152.0B
total +178.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
canvas 13.3KB 13.3KB -4.0B
expressionError 5.0KB 5.2KB +154.0B
expressionImage 4.4KB 4.3KB -167.0B
expressionMetric 5.7KB 5.9KB +154.0B
expressionRepeatImage 6.3KB 6.3KB -4.0B
expressionRevealImage 6.3KB 6.3KB -8.0B
expressionShape 14.0KB 14.1KB +154.0B
presentationUtil 41.5KB 40.7KB -827.0B
total -548.0B
Unknown metric groups

API count

id before after diff
presentationUtil 242 227 -15

ESLint disabled in files

id before after diff
osquery 1 2 +1
presentationUtil 2 0 -2
total -1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 442 448 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
presentationUtil 12 10 -2
securitySolution 519 525 +6
total +18

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nickpeihl nickpeihl merged commit 92fb6fc into elastic:main Nov 18, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 18, 2022
nickpeihl added a commit that referenced this pull request Apr 4, 2023
…154385)

## Summary

Fixes a regression where the image upload component does not load for
Canvas image elements.

Starting with PR #145633 modules in
`@kbn/presentation-util-plugin/common` are no longer exported from the
`@kbn/presentation-util-plugin/public` module. The imports in the
`ImageUpload` module should have also been updated to the
`@kbn/presentation-util-plugin/common` module.

Fixes #154356
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 4, 2023
…lastic#154385)

## Summary

Fixes a regression where the image upload component does not load for
Canvas image elements.

Starting with PR elastic#145633 modules in
`@kbn/presentation-util-plugin/common` are no longer exported from the
`@kbn/presentation-util-plugin/public` module. The imports in the
`ImageUpload` module should have also been updated to the
`@kbn/presentation-util-plugin/common` module.

Fixes elastic#154356

(cherry picked from commit 8724518)
kibanamachine added a commit that referenced this pull request Apr 4, 2023
…nts (#154385) (#154393)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Canvas] Fix image upload component not loading for image elements
(#154385)](#154385)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nick
Peihl","email":"nick.peihl@elastic.co"},"sourceCommit":{"committedDate":"2023-04-04T20:38:58Z","message":"[Canvas]
Fix image upload component not loading for image elements
(#154385)\n\n## Summary\r\n\r\nFixes a regression where the image upload
component does not load for\r\nCanvas image elements.\r\n\r\nStarting
with PR #145633 modules in\r\n`@kbn/presentation-util-plugin/common` are
no longer exported from the\r\n`@kbn/presentation-util-plugin/public`
module. The imports in the\r\n`ImageUpload` module should have also been
updated to the\r\n`@kbn/presentation-util-plugin/common`
module.\r\n\r\nFixes
#154356","sha":"8724518804e1755587de90b9d22a9a04512d2ea6","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","loe:hours","impact:high","Feature:Canvas","v8.8.0","v8.7.1"],"number":154385,"url":"https://github.com/elastic/kibana/pull/154385","mergeCommit":{"message":"[Canvas]
Fix image upload component not loading for image elements
(#154385)\n\n## Summary\r\n\r\nFixes a regression where the image upload
component does not load for\r\nCanvas image elements.\r\n\r\nStarting
with PR #145633 modules in\r\n`@kbn/presentation-util-plugin/common` are
no longer exported from the\r\n`@kbn/presentation-util-plugin/public`
module. The imports in the\r\n`ImageUpload` module should have also been
updated to the\r\n`@kbn/presentation-util-plugin/common`
module.\r\n\r\nFixes
#154356","sha":"8724518804e1755587de90b9d22a9a04512d2ea6"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/154385","number":154385,"mergeCommit":{"message":"[Canvas]
Fix image upload component not loading for image elements
(#154385)\n\n## Summary\r\n\r\nFixes a regression where the image upload
component does not load for\r\nCanvas image elements.\r\n\r\nStarting
with PR #145633 modules in\r\n`@kbn/presentation-util-plugin/common` are
no longer exported from the\r\n`@kbn/presentation-util-plugin/public`
module. The imports in the\r\n`ImageUpload` module should have also been
updated to the\r\n`@kbn/presentation-util-plugin/common`
module.\r\n\r\nFixes
#154356","sha":"8724518804e1755587de90b9d22a9a04512d2ea6"}},{"branch":"8.7","label":"v8.7.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nick Peihl <nick.peihl@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas technical debt Improvement of the software architecture and operational architecture v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[presentation] Remove export* syntax from plugin index files
5 participants