refactor: move browser utils to browser-common#3897
Draft
dustinbyrne wants to merge 8 commits into
Draft
Conversation
Contributor
|
Too many files changed for review. ( |
|
@dustinbyrne is attempting to deploy a commit to the PostHog Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or 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
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
@posthog/browser-commonis intended to host shared browser SDK code for both v1 and v2. The v1 browser package still owned the utility layer locally, which would make moving extensions over harder and duplicate common runtime helpers.Changes
packages/browser/src/utilsimplementation intopackages/browser-common/src/utilsand exported those modules from@posthog/browser-common.packages/browsersource and tests to import utilities from@posthog/browser-common.ActionMatcherpath as a compatibility re-export while the extensions themselves remain inpackages/browser.Validation run locally:
pnpm --filter=@posthog/browser-common lintpnpm --filter=@posthog/browser-common buildpnpm --filter=@posthog/browser-common test:unitpnpm --filter=posthog-js lintpnpm --filter=posthog-js exec jest src/__tests__/utils/event-utils.test.ts src/__tests__/utils/survey-event-receiver.test.ts src/__tests__/utils/product-tour-event-receiver.test.ts src/__tests__/request-utils.test.ts src/__tests__/utils/elements-chain-utils.test.ts src/__tests__/utils/request-router.test.ts --runInBandKnown local limitation:
pnpm --filter=posthog-js buildcurrently stops before bundling because the rrweb workspace packages are not built locally (@posthog/rrweb*type declarations missing). Attempting to build@posthog/rrweb-typesis blocked by existing TypeScript 6 deprecation errors in that package's tsconfig.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented with Pi. The user asked to prepare
@posthog/browser-commonfor shared v1/v2 browser code by moving the browser utility layer first, before moving extensions. I kept extension implementation code inpackages/browser, except for the survey action matcher which is now shared as a utility and re-exported from the old path for compatibility.