Use app blocks as theme graph entry points#1211
Draft
graygilmore wants to merge 2 commits into
Draft
Conversation
0767699 to
65730e7
Compare
Theme graph construction needs to know whether it is running against a full theme or a theme app extension before it can vary entrypoint semantics. Add an optional mode to the graph dependencies and pass the resolved config context from the Node runner and language server. Keep the graph defaulting to theme mode so existing callers preserve the same behavior unless they pass app context explicitly. Add the missing TypeScript path for theme-check-node so type-checks use the local graph source while developing this cross-package boundary.
Theme app extension blocks are rendered by Shopify without an in-repo template or section parent. Use app blocks as additional entry points in app mode so snippets rendered from app blocks get recorded references. Keep theme blocks on the existing schema-driven reachability path so unused theme block trees can still be reported as dead code.
65730e7 to
8e63afa
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
Fixes a false positive where
OrphanedSnippetreported snippets in theme app extensions as unused even when they were rendered by app blocks.Theme app extension blocks are rendered by Shopify directly, without an in-repo template or section parent. The theme graph only used templates and sections as entrypoints, so the graph never traversed app blocks and never recorded their
{% render %}references.What changed
blocks/*.liquidas graph entrypoints only incontext: appContext
This became visible in
shopify app devafter the CLI picked up theme-check-node 3.25.0.OrphanedSnippetexisted before then, but the Node runner did not providegetReferences, so the check no-op'd in CLI mode. OncegetReferenceswas wired through for other cross-file checks, the existing graph entrypoint gap started surfacing as orphaned snippet warnings.Tests