oslabs-beta / SvelteSlicer

MIT License
20 stars 5 forks source link

Switch to capture state #30

Closed heatherbarney closed 2 years ago

heatherbarney commented 2 years ago

Under the hood changes that switch devtool's primary data source from Svelte's "ctx" to instead utilize "$capture_state."

Our old implementation relied on both the ctx and data drawn from the AST to parse variables in state. It also relied on string manipulation and the assumption that store variables would always be sourced from a file with "store" in the file name. Using "$capture_state" instead allows us to fully separate state from the AST, which is important so that part of the tool still works even if the AST data is unavailable. It also allows us to recognize store variables regardless of what the name of their source file is.

This version should be more robust and generalizable. All existing features should work as previously on sites they already worked on, and should now work on some sites that they didn't previously work on.