@eventra_dev/cli-plugin-vue 1.0.2 → 1.0.4

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.
package/README.md CHANGED
@@ -7,8 +7,8 @@
7
7
  <p align="center">
8
8
  <a href="https://www.npmjs.com/package/@eventra_dev/cli-plugin-vue"><img alt="npm version" src="https://img.shields.io/npm/v/@eventra_dev/cli-plugin-vue.svg?style=flat-square&color=blue"></a>
9
9
  <a href="https://www.npmjs.com/package/@eventra_dev/cli-plugin-vue"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@eventra_dev/cli-plugin-vue.svg?style=flat-square&color=blue"></a>
10
- <img alt="tests passing" src="https://img.shields.io/badge/tests-16%20passing-brightgreen?style=flat-square&logo=vitest&logoColor=white">
11
- <img alt="coverage" src="https://img.shields.io/badge/coverage-95%25-brightgreen?style=flat-square&logo=vitest&logoColor=white">
10
+ <img alt="tests passing" src="https://img.shields.io/badge/tests-20%20passing-brightgreen?style=flat-square&logo=vitest&logoColor=white">
11
+ <img alt="coverage" src="https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square&logo=vitest&logoColor=white">
12
12
  <img alt="node" src="https://img.shields.io/node/v/@eventra_dev/cli-plugin-vue?style=flat-square&color=darkgreen&logo=node.js&logoColor=white">
13
13
  <a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-ready-blue?style=flat-square&logo=typescript&logoColor=white"></a>
14
14
  <img alt="license" src="https://img.shields.io/npm/l/@eventra_dev/cli-plugin-vue?style=flat-square&color=lightgrey">
@@ -96,7 +96,7 @@ The expression is copied as-is into the same module scope as the script. If it r
96
96
 
97
97
  Nuxt pages, layouts, and components are ordinary `.vue` SFCs — parsed identically, no extra configuration needed.
98
98
 
99
- Composables auto-imported without an explicit `import` statement (Nuxt's own composables, or your own from `composables/`/`utils/`) are intended to resolve **once the project has run `nuxt prepare`/`nuxt dev`** (so `.nuxt/` exists and is wired into `tsconfig.json` — the CLI analyzes the project's real `tsconfig.json`, so Nuxt's generated ambient types are visible to it like any other TypeScript project). The CLI's resolver understands the `declare const x: typeof import("./module")["name"]` shape Nuxt/`unplugin-auto-import` generate for these bindings, and this is covered by a unit test that hand-writes that ambient shape (`@eventra_dev/eventra-cli`'s `nuxtAutoImportCompat.test.ts`) — but running a real `nuxt prepare`/`nuxt build` end-to-end has not been verified in this environment (blocked by a sandbox GLIBC incompatibility with Nuxt's native build tooling), so this is not confirmed against a real generated `.nuxt/imports.d.ts`.
99
+ Composables auto-imported without an explicit `import` statement (Nuxt's own composables, or your own from `composables/`/`utils/`) are intended to resolve **once the project has run `nuxt prepare`/`nuxt dev`** (so `.nuxt/` exists and is wired into `tsconfig.json` — the CLI analyzes the project's real `tsconfig.json`, so Nuxt's generated ambient types are visible to it like any other TypeScript project). The host CLI's resolver understands the `declare const x: typeof import("./module")["name"]` shape Nuxt/`unplugin-auto-import` generate for these bindings (verified against a hand-written fixture reproducing that ambient shape) — but running a real `nuxt prepare`/`nuxt build` end-to-end has not been verified in this environment (blocked by a sandbox GLIBC incompatibility with Nuxt's native build tooling), so this is not confirmed against a real generated `.nuxt/imports.d.ts`.
100
100
 
101
101
  ---
102
102
 
@@ -134,9 +134,9 @@ No dependency on `@eventra_dev/eventra-cli` — the CLI adapts this shape intern
134
134
 
135
135
  ## Test Coverage
136
136
 
137
- **95% statement coverage** (79.2% branch, 100% function, 96.6% line — v8 provider, `pnpm test:coverage`).
137
+ **100% statement/branch/function/line coverage** (v8 provider, `pnpm test:coverage`), enforced via a `coverage.thresholds` block in `vitest.config.ts`.
138
138
 
139
- **16 unit tests** (vitest), covering:
139
+ **20 unit tests** (vitest), covering:
140
140
 
141
141
  | Area | Covers |
142
142
  |---|---|
@@ -147,7 +147,7 @@ No dependency on `@eventra_dev/eventra-cli` — the CLI adapts this shape intern
147
147
  | Virtual module output | Single combined `.vue.ts`, export stub when script/template are empty |
148
148
  | Plugin contract | `match()`, `includeGlobs`, `staticSinks`, `transform()` |
149
149
 
150
- The Nuxt ambient auto-import shape (`declare const x: typeof import(...)`) is covered by a unit test in `@eventra_dev/eventra-cli` (`nuxtAutoImportCompat.test.ts`) that hand-writes that shape — this is not the same as an end-to-end run against a real `nuxt prepare`/`nuxt build`, which has not been verified in this environment (see the [Nuxt](#nuxt) section above).
150
+ The Nuxt ambient auto-import shape (`declare const x: typeof import(...)`) is covered by a unit test in the host CLI that hand-writes that shape — this is not the same as an end-to-end run against a real `nuxt prepare`/`nuxt build`, which has not been verified in this environment (see the [Nuxt](#nuxt) section above).
151
151
 
152
152
  Run locally:
153
153
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,kBAAkB,IAAI,YAAY,CAejD;;AAED,wBAAoC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,kBAAkB,IAAI,YAAY,CAejD;;AAED,wBAAoC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.scriptVirtualPath = exports.parseVueSfc = exports.buildScriptModule = exports.transformVueSfc = void 0;
4
7
  exports.createCliPluginVue = createCliPluginVue;
8
+ const package_json_1 = __importDefault(require("../package.json"));
5
9
  const transform_1 = require("./transform");
6
10
  function createCliPluginVue() {
7
11
  return {
8
12
  id: "vue",
9
- version: "0.1.0",
13
+ version: package_json_1.default.version,
10
14
  includeGlobs: ["**/*.vue"],
11
15
  staticSinks: [
12
16
  {
@@ -1 +1 @@
1
- {"version":3,"file":"parse-vue-sfc.d.ts","sourceRoot":"","sources":["../src/parse-vue-sfc.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,0GAA0G;IAC1G,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAyDD,iHAAiH;AACjH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiC1E;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAID;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA+B9D"}
1
+ {"version":3,"file":"parse-vue-sfc.d.ts","sourceRoot":"","sources":["../src/parse-vue-sfc.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,8EAA8E;AAC9E,MAAM,WAAW,oBAAoB;IACnC,0GAA0G;IAC1G,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAyDD,iHAAiH;AACjH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CA6C1E;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAID;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA+B9D"}
@@ -82,17 +82,30 @@ function parseVueSfc(source, filePath) {
82
82
  if (template.ast) {
83
83
  collectEventBindings(template.ast, templateEvents);
84
84
  }
85
- else if (template.src) {
86
- const external = readSrcFile(filePath, template.src);
87
- if (external) {
88
- collectEventBindings((0, compiler_dom_1.parse)(external), templateEvents);
85
+ else {
86
+ // @vue/compiler-sfc only ever leaves `ast` unset when `src` is set
87
+ // (external template file) - the `else` here is a defensive fallback,
88
+ // not a reachable third case
89
+ /* v8 ignore else */
90
+ if (template.src) {
91
+ const external = readSrcFile(filePath, template.src);
92
+ if (external) {
93
+ collectEventBindings((0, compiler_dom_1.parse)(external), templateEvents);
94
+ }
89
95
  }
90
96
  }
91
97
  }
92
98
  return {
93
99
  scripts,
94
100
  templateEvents,
95
- errors: errors.map((error) => (error instanceof Error ? error.message : String(error))),
101
+ errors: errors.map((error) => {
102
+ // @vue/compiler-sfc errors are always Error instances
103
+ /* v8 ignore else */
104
+ if (error instanceof Error)
105
+ return error.message;
106
+ /* v8 ignore next */
107
+ return String(error);
108
+ }),
96
109
  };
97
110
  }
98
111
  /** Map `App.vue` → `App.vue.ts` (single virtual TS module for the compiler). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/cli-plugin-vue",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Eventra CLI plugin — extract track() calls from Vue SFC (.vue) files",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",