@eventra_dev/cli-plugin-vue 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +13 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -112,8 +112,10 @@ The prop does not have to be named `event`. If a component sends one of its prop
112
112
  ```vue
113
113
  <!-- Button.vue -->
114
114
  <script setup lang="ts">
115
+ import { Eventra } from '@eventra_dev/eventra-sdk'
116
+ const tracker = new Eventra({ apiKey: 'YOUR_KEY' })
115
117
  const props = defineProps<{ analyticsName: string }>()
116
- function onClick() { trackEvent(props.analyticsName) }
118
+ function onClick() { tracker.track(props.analyticsName) }
117
119
  </script>
118
120
  <template><button @click="onClick"><slot /></button></template>
119
121
 
@@ -124,9 +126,17 @@ import Button from './Button.vue'
124
126
  <template><Button analytics-name="checkout.cta">Pay</Button></template>
125
127
  ```
126
128
 
127
- `checkout.cta` is found. It works with `defineProps<{ ... }>()`, `defineProps([...])`, `defineProps({ ... })`, `withDefaults(...)`, a props object (`const props = defineProps(...)`) and a destructuring (`const { analyticsName } = defineProps(...)`), and also when the template reads the prop by its bare name (`@click="trackEvent(analyticsName)"`). A prop handed on to another component (`<Inner :name="props.analyticsName" />`) is followed. Props the component never tracks are not events. A prop that comes from a `v-for` variable is reported as a dynamic occurrence.
129
+ `checkout.cta` is found. It works with `defineProps<{ ... }>()`, `defineProps([...])`, `defineProps({ ... })`, `withDefaults(...)`, a props object (`const props = defineProps(...)`) and a destructuring (`const { analyticsName } = defineProps(...)`), and also when the template reads the prop by its bare name (`@click="tracker.track(analyticsName)"`). A prop handed on to another component (`<Inner :name="props.analyticsName" />`) is followed. Props the component never tracks are not events. A prop that comes from a `v-for` variable is reported as a dynamic occurrence.
128
130
 
129
- Not followed: Options API components (`props: [...]` read through `this`), `v-bind="obj"` spreads, components registered by name instead of imported, and a component whose normal `<script>` has its own `export default`.
131
+ **Not followed** (those components are scanned as before, so nothing is lost, but a prop that only they use is not found):
132
+
133
+ - Options API components (`props: [...]` read through `this`).
134
+ - `v-bind="obj"` spreads.
135
+ - Components registered by name instead of imported, and dynamic components (`<component :is="X">`).
136
+ - Nuxt auto-imported components (used with no `import`): the tag is not matched to its file.
137
+ - A component whose normal `<script>` has its own `export default`, an `export` other than a type in `<script setup>`, an import after other code, or a `src=` script.
138
+
139
+ A value the CLI cannot resolve to a plain string (a `v-for` variable, a prop of the page itself) is listed under "Dynamic event names" instead of becoming an event. The same list shows the tracking call inside the component itself, one line per component, because what it tracks is whatever each caller passes; the callers that pass a literal are still found.
130
140
 
131
141
  ## Nuxt
132
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/cli-plugin-vue",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Eventra CLI plugin — extract track() calls from Vue SFC (.vue) files",
5
5
  "license": "MIT",
6
6
  "author": {