@eventra_dev/cli-plugin-vue 1.3.3 → 1.3.5
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 +3 -3
- package/dist/parse-vue-sfc.d.ts.map +1 -1
- package/dist/parse-vue-sfc.js +23 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
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-
|
|
10
|
+
<img alt="tests passing" src="https://img.shields.io/badge/tests-170%20passing-brightgreen?style=flat-square&logo=vitest&logoColor=white">
|
|
11
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>
|
|
@@ -88,7 +88,7 @@ The expression is copied as-is into the same module scope as the script. If it r
|
|
|
88
88
|
|
|
89
89
|
### External blocks
|
|
90
90
|
|
|
91
|
-
`<script src="./logic.ts">` and `<template src="./view.html">` are resolved and read from disk.
|
|
91
|
+
`<script src="./logic.ts">` and `<template src="./view.html">` are resolved and read from disk, when the file is a regular file of at most 5 MB inside the project (the folder the command runs in) or inside the component's own folder. A `src` that points anywhere else (an absolute path, a link to a file outside the project, a device) is reported as a file that is not there.
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
@@ -196,7 +196,7 @@ No dependency on `@eventra_dev/eventra-cli` - the CLI adapts this shape internal
|
|
|
196
196
|
|
|
197
197
|
**100% statement/branch/function/line coverage** (v8 provider, `pnpm test:coverage`), enforced via a `coverage.thresholds` block in `vitest.config.ts`.
|
|
198
198
|
|
|
199
|
-
**
|
|
199
|
+
**170 unit tests** (vitest), covering:
|
|
200
200
|
|
|
201
201
|
| Area | Covers |
|
|
202
202
|
|---|---|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-vue-sfc.d.ts","sourceRoot":"","sources":["../src/parse-vue-sfc.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;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,6GAA6G;AAC7G,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,+GAA+G;AAC/G,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sHAAsH;IACtH,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,iIAAiI;AACjI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,10 +13,32 @@ const component_1 = require("./component");
|
|
|
13
13
|
const layout_1 = require("./layout");
|
|
14
14
|
const compiler_dom_1 = require("@vue/compiler-dom");
|
|
15
15
|
const compiler_core_1 = require("@vue/compiler-core");
|
|
16
|
+
// no real component keeps its script or template in a file this big; it stops a device or a huge file that a
|
|
17
|
+
// `src` points at from being read into memory
|
|
18
|
+
const MAX_SRC_BYTES = 5 * 1024 * 1024;
|
|
19
|
+
/** Whether `file` (a real path) is the folder `root` (a real path) or something inside it. */
|
|
20
|
+
function isInside(root, file) {
|
|
21
|
+
const relative = node_path_1.default.relative(root, file);
|
|
22
|
+
return relative === "" || (!relative.startsWith("..") && !node_path_1.default.isAbsolute(relative));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The text a `<script src>` or `<template src>` points at, or null when it is not there or must not be read.
|
|
26
|
+
* A repository decides what `src` says, so it is read only when it is a regular file of moderate size inside the
|
|
27
|
+
* project being scanned (the folder the command runs in) or inside the folder of the component itself, after
|
|
28
|
+
* links are resolved. `src="/etc/passwd"`, a link to a file outside the project and a device such as
|
|
29
|
+
* `/dev/zero` (which would fill the memory) are all treated as a file that is not there.
|
|
30
|
+
*/
|
|
16
31
|
function readSrcFile(sfcPath, src) {
|
|
17
32
|
const resolved = node_path_1.default.resolve(node_path_1.default.dirname(sfcPath), src);
|
|
18
33
|
try {
|
|
19
|
-
|
|
34
|
+
const real = node_fs_1.default.realpathSync(resolved);
|
|
35
|
+
const roots = [process.cwd(), node_path_1.default.dirname(sfcPath)].map((dir) => node_fs_1.default.realpathSync(dir));
|
|
36
|
+
if (!roots.some((root) => isInside(root, real)))
|
|
37
|
+
return null;
|
|
38
|
+
const stat = node_fs_1.default.statSync(real);
|
|
39
|
+
if (!stat.isFile() || stat.size > MAX_SRC_BYTES)
|
|
40
|
+
return null;
|
|
41
|
+
return node_fs_1.default.readFileSync(real, "utf8");
|
|
20
42
|
}
|
|
21
43
|
catch {
|
|
22
44
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventra_dev/cli-plugin-vue",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Eventra CLI plugin — extract track() calls from Vue SFC (.vue) files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"test:watch": "vitest",
|
|
37
37
|
"test:coverage": "vitest run --coverage",
|
|
38
38
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
39
|
-
"test:mutation": "stryker run"
|
|
39
|
+
"test:mutation": "stryker run",
|
|
40
|
+
"lint": "eslint src tests"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@vue/compiler-core": "^3.5.40",
|
|
@@ -44,11 +45,15 @@
|
|
|
44
45
|
"@vue/compiler-sfc": "^3.5.40"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.18.0",
|
|
47
49
|
"@stryker-mutator/core": "9.6.1",
|
|
48
50
|
"@stryker-mutator/vitest-runner": "9.6.1",
|
|
49
51
|
"@types/node": "^20.0.0",
|
|
50
52
|
"@vitest/coverage-v8": "^4.1.7",
|
|
53
|
+
"eslint": "^9.18.0",
|
|
54
|
+
"globals": "^16.0.0",
|
|
51
55
|
"typescript": "^5.3.0",
|
|
56
|
+
"typescript-eslint": "^8.20.0",
|
|
52
57
|
"vitest": "^4.1.7"
|
|
53
58
|
},
|
|
54
59
|
"keywords": [
|