-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(cli): add sourcemap remapping #29786
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76b0e33
to
3e566a7
Compare
3e566a7
to
09270fa
Compare
daibhin
approved these changes
Mar 12, 2025
oliverb123
approved these changes
Mar 12, 2025
14a69c6
to
2498e22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds sourcemap remapping functionality to the PostHog CLI, enabling proper handling of sourcemaps when source files are modified, with automatic chunk ID injection and mapping adjustments.
- Added sourcemap remapping with
magic_string
andsourcemap
crates in/rust/posthog-cli/src/utils/sourcemaps.rs
to handle source file modifications - Implemented chunk ID injection with runtime tracking via
CODE_SNIPPET_TEMPLATE
in/rust/posthog-cli/src/utils/constant.rs
- Added comprehensive test cases in
/rust/posthog-cli/tests/sourcemap.rs
for verifying sourcemap pair reading and chunk ID injection - Simplified CLI interface by removing optional output directory in
/rust/posthog-cli/src/commands/mod.rs
- Note: There's a typo "CHUNCK" in the chunk ID placeholder constants that should be fixed
18 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When changing source files, sourcemaps need to be offset.