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

Implement absolute path babel transform #49766

Closed

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Oct 30, 2019

Fixes #40446 (POC)

This implements a babel plugin to support importing from src/* and x-pack/* from any babel-transpiled code. In addition to the babel transform this work includes an extension to the custom module-migration ESLint rule to rewrite imports for ../../../../../../src/* with src/*. Those fixes are not included in this PR, but are instead autofixed in CI temporarily so that while we work on this unnecessary conflicts won't pile up.

spalger added 14 commits October 29, 2019 10:59
…olute-path-babel-transform

# Conflicts:
#	x-pack/legacy/plugins/lens/public/indexpattern_plugin/auto_date.ts
…olute-path-babel-transform

# Conflicts:
#	x-pack/legacy/plugins/apm/public/components/shared/KueryBar/index.tsx
#	x-pack/legacy/plugins/canvas/types/index.ts
#	x-pack/legacy/plugins/lens/public/datatable_visualization_plugin/expression.tsx
#	x-pack/legacy/plugins/lens/public/indexpattern_plugin/auto_date.ts
#	x-pack/legacy/plugins/lens/public/indexpattern_plugin/plugin.tsx
@spalger spalger added Team:Operations Team label for Operations Team v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.6.0 labels Oct 30, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

spalger added 3 commits November 1, 2019 13:23
…olute-path-babel-transform

# Conflicts:
#	x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts
…not necessary and can't be installed outside of the repo
@elasticmachine

This comment has been minimized.

@epixa
Copy link
Contributor

epixa commented Nov 19, 2019

I suspect that a symlink approach might save you a few hundred lines of code, but overall I'd be fine with this approach if this is the preferred way from your end. I think the lack of support for root level imports is increasingly problematic, so trying to pick the one right solution from a handful of good options is doing more harm than good.

Since this is more of a whitelist, I suspect we'll want an import from the root level test directory as well. That can optionally be handled in a followup though if the point is contentious.

@elastic/kibana-platform fyi

@lukeelmers lukeelmers mentioned this pull request Nov 19, 2019
3 tasks
@spalger
Copy link
Contributor Author

spalger commented Nov 20, 2019

Eh, idk, the babel transform (vs symlinks) is implemented in like 40 lines here. The rest of the changes are eslint changes that would be desirable either way I think.

…olute-path-babel-transform

# Conflicts:
#	src/legacy/core_plugins/data/public/index_patterns/fields/field.ts
#	src/legacy/ui/public/registry/field_formats.d.ts
#	x-pack/legacy/plugins/canvas/public/functions/to.ts
#	x-pack/legacy/plugins/graph/public/render_app.ts
#	x-pack/legacy/plugins/xpack_main/server/telemetry_collection/get_stats_with_xpack.ts
@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💔 Build Failed

History

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

@LeeDr LeeDr removed the v7.6.0 label Feb 4, 2020
@spalger
Copy link
Contributor Author

spalger commented Mar 6, 2020

When we get back to this we can reopen it

@spalger spalger closed this Mar 6, 2020
@spalger spalger deleted the implement/absolute-path-babel-transform branch March 6, 2020 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An alternative to relative imports for local source code
4 participants