Proposal:
Vue\Codebase exposes only whereElement/whereTag (template elements) and whereTypeDeclaration (TS object types). There is no way to select statements or expressions inside a .ts module, so a whole class of frontend rule cannot be written. Concretely I wanted a 'client-decides' detector for a backend-driven UI: flag a module under resources/js/view that (a) branches on a domain word read off the DOM (an if/switch comparing dataset.* or getAttribute('data-*') against a string literal), (b) finds its target with a meaning-selector it invented rather than a name the server sent (querySelector with '[autofocus], input, textarea', ':scope > .v-node', '#app > [data-tag=surface]'), or (c) holds a policy constant (a duration, a distance, a threshold, a key chord). All three are AST-detectable given a TS statement/expression query; none is detectable today. The Vue/Ts/Parser and Vue/Expr/Parser already exist, so the parsing is there — what is missing is a Codebase selector that opens a Query over their nodes, the frontend twin of the backend whereMethodDeclaration/whereIf/whereCall selectors. I have written the skill and sin (.commandments/custom/ClientDecidesSkill.php, ClientDecides.php) and had to leave the detector unwritten.
Filed via commandments feature-request from a consumer project.
Proposal:
Vue\Codebase exposes only whereElement/whereTag (template elements) and whereTypeDeclaration (TS object types). There is no way to select statements or expressions inside a .ts module, so a whole class of frontend rule cannot be written. Concretely I wanted a 'client-decides' detector for a backend-driven UI: flag a module under resources/js/view that (a) branches on a domain word read off the DOM (an if/switch comparing dataset.* or getAttribute('data-*') against a string literal), (b) finds its target with a meaning-selector it invented rather than a name the server sent (querySelector with '[autofocus], input, textarea', ':scope > .v-node', '#app > [data-tag=surface]'), or (c) holds a policy constant (a duration, a distance, a threshold, a key chord). All three are AST-detectable given a TS statement/expression query; none is detectable today. The Vue/Ts/Parser and Vue/Expr/Parser already exist, so the parsing is there — what is missing is a Codebase selector that opens a Query over their nodes, the frontend twin of the backend whereMethodDeclaration/whereIf/whereCall selectors. I have written the skill and sin (.commandments/custom/ClientDecidesSkill.php, ClientDecides.php) and had to leave the detector unwritten.
Filed via
commandments feature-requestfrom a consumer project.