@immense/vue-pom-generator 1.0.82 → 1.0.84
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/RELEASE_NOTES.md +54 -54
- package/class-generation/playwright-types.ts +120 -2
- package/dist/class-generation/playwright-types.d.ts +256 -2
- package/dist/class-generation/playwright-types.d.ts.map +1 -1
- package/dist/compiler-metadata-utils.d.ts.map +1 -1
- package/dist/eslint.config.d.ts.map +1 -1
- package/dist/index.cjs +37 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +37 -41
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/runtime/annotator/client.d.ts +13 -0
- package/dist/plugin/runtime/annotator/client.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/format.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/plugin.d.ts +16 -0
- package/dist/plugin/runtime/annotator/plugin.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/text-utils.d.ts +15 -0
- package/dist/plugin/runtime/annotator/text-utils.d.ts.map +1 -0
- package/dist/plugin/runtime/annotator/vue-detector.d.ts +49 -0
- package/dist/plugin/runtime/annotator/vue-detector.d.ts.map +1 -1
- package/dist/pom-discoverability.d.ts.map +1 -1
- package/dist/pom-patterns.d.ts +28 -4
- package/dist/pom-patterns.d.ts.map +1 -1
- package/dist/tests/annotator-runtime-helpers.test.d.ts +2 -0
- package/dist/tests/annotator-runtime-helpers.test.d.ts.map +1 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts +2 -0
- package/dist/tests/broad/accessibility-audit-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts +2 -0
- package/dist/tests/broad/class-generation-base-page-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts +2 -0
- package/dist/tests/broad/compiler-metadata-utils-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts +162 -0
- package/dist/tests/broad/helpers/fake-runtime.d.ts.map +1 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts +2 -0
- package/dist/tests/broad/manifest-generator-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts +2 -0
- package/dist/tests/broad/metadata-collector-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-logger-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-resolved-generation-options-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts +2 -0
- package/dist/tests/broad/plugin-runtime-annotator-format-ts.test.d.ts.map +1 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts +2 -0
- package/dist/tests/broad/typescript-codegen-ts.test.d.ts.map +1 -0
- package/dist/tests/helpers/typed-mocks.d.ts +58 -0
- package/dist/tests/helpers/typed-mocks.d.ts.map +1 -0
- package/dist/transform.d.ts +36 -5
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +261 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/plugin/runtime/annotator/client.ts +24 -12
- package/plugin/runtime/annotator/format.ts +5 -7
- package/plugin/runtime/annotator/plugin.ts +24 -6
- package/plugin/runtime/annotator/text-utils.ts +23 -0
- package/plugin/runtime/annotator/vue-detector.ts +56 -0
|
@@ -17,6 +17,15 @@ export interface ResolvedVueComponentInfo {
|
|
|
17
17
|
formatted?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Matches well-known synthetic component names Vue's runtime emits that carry no
|
|
22
|
+
* useful component identity (e.g. `template`, `slot`, `transition`). These come
|
|
23
|
+
* from Vue's runtime registry, not source code, so a regex test is appropriate.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ignoredComponentNamePattern.test("template") // true
|
|
27
|
+
* ignoredComponentNamePattern.test("UserCard") // false
|
|
28
|
+
*/
|
|
20
29
|
/* eslint-disable no-restricted-syntax -- matching well-known synthetic component names from Vue's runtime (not source-code parsing) */
|
|
21
30
|
const ignoredComponentNamePattern = /^(?:items\[\d+\]\.template|template|anonymous|slot|transition|transition-group)$/i;
|
|
22
31
|
/* eslint-enable no-restricted-syntax */
|
|
@@ -37,12 +46,30 @@ function getDirectVueInstances(element: Element): VueInstance[] {
|
|
|
37
46
|
return instances;
|
|
38
47
|
}
|
|
39
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Strip a trailing `:line:column` position from a component file path (e.g.
|
|
51
|
+
* `src/Foo.vue:12:3` → `src/Foo.vue`). Operates on a runtime file-path string,
|
|
52
|
+
* not source code.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* stripSourcePosition("src/Foo.vue:12:3") // "src/Foo.vue"
|
|
56
|
+
* stripSourcePosition("src/Foo.vue") // "src/Foo.vue"
|
|
57
|
+
*/
|
|
40
58
|
function stripSourcePosition(sourcePath: string): string {
|
|
41
59
|
/* eslint-disable no-restricted-syntax -- stripping a trailing line:column position from a file path string, not parsing source code */
|
|
42
60
|
return sourcePath.replace(/:\d+:\d+$/, "");
|
|
43
61
|
/* eslint-enable no-restricted-syntax */
|
|
44
62
|
}
|
|
45
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Derive a component name from its file path, or `null` when none can be
|
|
66
|
+
* determined. Operates on a runtime file-path string, not source code.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* inferNameFromFile("src/widgets/Item.vue") // "Item"
|
|
70
|
+
* inferNameFromFile("src/widgets/Item.vue:4:2") // "Item"
|
|
71
|
+
* inferNameFromFile("") // null
|
|
72
|
+
*/
|
|
46
73
|
function inferNameFromFile(filePath: string): string | null {
|
|
47
74
|
/* eslint-disable no-restricted-syntax -- deriving a component name from a file path string, not parsing source code */
|
|
48
75
|
const fileName = stripSourcePosition(filePath).split("/").pop();
|
|
@@ -59,12 +86,33 @@ function isMeaningfulComponentName(name: string | null | undefined): name is str
|
|
|
59
86
|
return !!name && !ignoredComponentNamePattern.test(name.trim());
|
|
60
87
|
}
|
|
61
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Whether a runtime component tag looks like a real Vue component — PascalCase
|
|
91
|
+
* or kebab-case — rather than a plain HTML element. Operates on a runtime tag
|
|
92
|
+
* string, not source code.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* isComponentLikeSourceTag("UserCard") // true
|
|
96
|
+
* isComponentLikeSourceTag("my-button") // true
|
|
97
|
+
* isComponentLikeSourceTag("div") // false
|
|
98
|
+
*/
|
|
62
99
|
function isComponentLikeSourceTag(tag: string | null | undefined): tag is string {
|
|
63
100
|
/* eslint-disable no-restricted-syntax -- checking whether a runtime component tag looks like a Vue component (PascalCase or kebab), not parsing source code */
|
|
64
101
|
return !!tag && (/[A-Z]/.test(tag.trim()) || tag.includes("-"));
|
|
65
102
|
/* eslint-enable no-restricted-syntax */
|
|
66
103
|
}
|
|
67
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Format a component source path for display, optionally keeping its
|
|
107
|
+
* `:line:column` position and trimming it to the `frontend/src/...` portion
|
|
108
|
+
* when present. Operates on a runtime file-path string for display, not source
|
|
109
|
+
* code.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* formatSourceLabel("/x/frontend/src/Foo.vue:4:2") // "src/Foo.vue:4:2"
|
|
113
|
+
* formatSourceLabel("/x/frontend/src/Foo.vue:4:2", false) // "src/Foo.vue"
|
|
114
|
+
* formatSourceLabel("src/Foo.vue") // "src/Foo.vue"
|
|
115
|
+
*/
|
|
68
116
|
export function formatSourceLabel(sourcePath: string, includePosition = true): string {
|
|
69
117
|
/* eslint-disable no-restricted-syntax -- parsing a file-path-with-optional-position string for display, not parsing source code */
|
|
70
118
|
const match = sourcePath.match(/^(.*?)(?::(\d+):(\d+))?$/);
|
|
@@ -228,3 +276,11 @@ export function resolveVueComponentInfo(element: Element, options: VueDetectorOp
|
|
|
228
276
|
|
|
229
277
|
return bestInfo;
|
|
230
278
|
}
|
|
279
|
+
|
|
280
|
+
// Exposed for unit tests. These are pure string helpers (no DOM access).
|
|
281
|
+
export const __internal = {
|
|
282
|
+
ignoredComponentNamePattern,
|
|
283
|
+
stripSourcePosition,
|
|
284
|
+
inferNameFromFile,
|
|
285
|
+
isComponentLikeSourceTag,
|
|
286
|
+
};
|