refactor(core): simplify packages/core — dead code, dedup, perf#1413
Merged
Conversation
079bcae to
08fc606
Compare
- Delete unused mediaPreloader module, 5 dead RuntimeState fields, emitPerformanceMetric, lintScriptUrls, 5 variable type guards - Consolidate compiler utilities: unify CSS URL regex, relative URL predicate, MIME map, @import regex, bulk asset rewrite delegation - Cache extractGsapWindows per script (eliminates 2 redundant recast parses per lint run), share stripJsComments and script extraction - Deduplicate GSAP parser: share serializeValue/safeJsKey, centralize converted-id fallback (6 sites), keyframe codegen (3 sites), waypoint extraction, insert-after-anchor, script hoisting - Replace 88 bare any annotations with typed AstNode/AstPath interfaces - Derive RuntimeBridgeControlAction from HyperframeControlAction, alias RuntimePickerElementInfo, share macOS font profiler - Gate generateHyperframesStyles on includeStyles, collapse 4 GSAP property mutation cases into 2 - Extract magic numbers into named constants, replace 5 double casts with type guards and typed accessors (runtime/globals.ts), reduce function complexity in htmlParser and files route
08fc606 to
127fdcb
Compare
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.
Summary
Systematic simplification of
packages/core/across 6 focused commits:mediaPreloadermodule (170 lines), 5 deadRuntimeStatefields, unusedemitPerformanceMetric, unexportedlintScriptUrls, 5 unused variable type guardsREBASE_URL_RE→CSS_URL_RE,isRelativeUrl→isNonRelativeUrl, collapse 3 MIME helpers into a map, reuse@importregex, delegate bulkrewriteAssetPathsto single-path helperextractGsapWindowsper script content (eliminates 2 redundant recast parses per lint run), move robuststripJsCommentsto shared utils (replaces weak inline regex in 2 rules), extractextractScriptTextsAndSrcsserializeValue/safeJsKeyfromgsapSerialize, replace local duplicates ingsapParser; addlocateAnimationWithFallbackto centralize 6 inline converted-id retry blocksRuntimeBridgeControlActionfromHyperframeControlAction, aliasRuntimePickerElementInfotoHyperframePickerElementInfogenerateHyperframesStylesonincludeStylesflag, merge 4 GSAP property mutation switch cases into 2Net: -1019 lines across 22 files. All tests pass. No behavioral changes.
Test plan
bun run --cwd packages/core typecheck— passesbun run --cwd packages/core test— 1427 tests pass (parser golden tests confirm identical output)