@immense/vue-pom-generator 1.0.115 → 1.0.116

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 CHANGED
@@ -1,48 +1,34 @@
1
- The picture is clear: only #81 falls in the v1.0.114..HEAD range (#79 is the tagged v1.0.114 release
2
- itself; the long PR list is historical). Let me inspect the actual diff of #81 to summarize it
3
- accurately.
4
-
5
- v1.0.115
1
+ v1.0.116
6
2
 
7
3
  Highlights
8
4
 
9
- - Fixed Windows dev-server crashes during POM generation: backslash paths handed to the Vue
10
- compiler were embedded verbatim in generated useCssVars code, producing SyntaxError: Bad character
11
- escape sequence for paths containing \u, \x, \8, or \9 (fixes #80).
12
- - SFC ids passed to compileScript are now posix-normalized in both the build collection path and
13
- the dev plugin, so binding metadata is no longer silently dropped for affected components.
14
- - Component-name resolution now compares paths in posix form, restoring correct hierarchical names
15
- for files under directories whose names contain a backslash.
5
+ - Wrapper targeting fixed: a component's own fallthrough target is now matched by element, not by
6
+ offset in the wrapper contract (#83) — wrappers no longer bind to the wrong node when sibling
7
+ structure shifts.
8
+ - Corrected the corresponding logic in transform.ts so generated wrappers stay consistent with the
9
+ new element-based matching.
10
+ - Added regression coverage in tests/transform.test.ts and trimmed the offset-based assumptions in
11
+ tests/wrapper-contract.test.ts.
16
12
 
17
13
  Changes
18
14
 
19
- Plugin
20
-
21
- - Exported the existing toPosixSlashes helper from plugin/path-utils.ts and applied it wherever
22
- paths become compiler ids: collectSource in plugin/vue-plugin.ts and getScriptInfo in
23
- plugin/internal/dev-plugin.ts.
24
- - collectSource now canonicalizes the two collection passes (native paths from the filesystem walk,
25
- posix module ids from Vite) to posix once, so naming, metadata, and generated manifests agree
26
- across passes.
27
-
28
- Path and scope resolution
15
+ Fixed
29
16
 
30
- - resolveComponentNameFromPath posix-normalizes the filename and candidate roots and uses
31
- path.posix.relative/parse/join for prefix matching, so a configured root on POSIX that contains a
32
- backslash in a directory name still matches and no longer drops components to their basename.
17
+ - wrapper-contract: match a component's own fallthrough target by element rather than by positional
18
+ offset (#83).
19
+ - transform: updated transform behavior to align with element-based fallthrough matching.
33
20
 
34
- Breaking Changes
21
+ Tests
35
22
 
36
- None.
23
+ - tests/transform.test.ts: new cases covering element-based fallthrough target matching.
24
+ - tests/wrapper-contract.test.ts: updated expectations for the corrected matching behavior.
37
25
 
38
26
  Pull Requests Included
39
27
 
40
- - ]8;id=md-1czplt1;https://github.com/immense/vue-pom-generator/pull/81#81]8;;]8;; — fix(plugin): posix-normalize SFC ids handed to the Vue compiler (@steve-price-immybot)]8;;
28
+ - #83 — fix(wrappers): match a component's own fallthrough target by element, not offset —
29
+ ]8;id=md-1cfqef3;https://github.com/immense/vue-pom-generator/pull/83@darrenator[bot]]8;;
41
30
 
42
31
  Testing
43
32
 
44
- - Added regression tests: supplementing v-bind() components whose paths contain backslash
45
- separators, preserving hierarchical names for nested files under backslash directories, and a new
46
- toPosixSlashes unit suite covering Windows-separator conversion and untouched posix paths
47
- (tests/generate-vue-poms.test.ts, tests/path-utils-scope.test.ts).
33
+ - Unit tests added/updated for transform and wrapper-contract matching behavior.
48
34
 
package/dist/index.cjs CHANGED
@@ -9037,9 +9037,8 @@ function analyzeWrapperContractFromSfc(options) {
9037
9037
  role: null,
9038
9038
  targetRoles: [],
9039
9039
  forwardedTestIdTargetOffsets: /* @__PURE__ */ new Set(),
9040
- forwardedTestIdTargetSfcOffsets: /* @__PURE__ */ new Set(),
9041
- explicitlyForwardedTestIdTargetOffsets: /* @__PURE__ */ new Set(),
9042
- explicitlyForwardedTestIdTargetSfcOffsets: /* @__PURE__ */ new Set()
9040
+ attrsObjectNames: /* @__PURE__ */ new Set(),
9041
+ attrsFunctionNames: /* @__PURE__ */ new Set()
9043
9042
  };
9044
9043
  }
9045
9044
  const scriptMetadata = analyzeScriptForwardingMetadata(
@@ -9048,7 +9047,6 @@ function analyzeWrapperContractFromSfc(options) {
9048
9047
  );
9049
9048
  const ast = compilerDom.parse(template, { comments: false });
9050
9049
  const targets = /* @__PURE__ */ new Map();
9051
- const explicitTargetOffsets = /* @__PURE__ */ new Set();
9052
9050
  if (scriptMetadata.inheritAttrs) {
9053
9051
  for (const element of getRenderedRootElements(ast)) {
9054
9052
  targets.set(element.loc.start.offset, element);
@@ -9057,7 +9055,6 @@ function analyzeWrapperContractFromSfc(options) {
9057
9055
  walkTemplate(ast, (element) => {
9058
9056
  if (elementExplicitlyForwardsTestId(element, options.testIdAttribute, scriptMetadata)) {
9059
9057
  targets.set(element.loc.start.offset, element);
9060
- explicitTargetOffsets.add(element.loc.start.offset);
9061
9058
  }
9062
9059
  });
9063
9060
  const targetRoles = [...targets.values()].map((element) => {
@@ -9072,17 +9069,12 @@ function analyzeWrapperContractFromSfc(options) {
9072
9069
  });
9073
9070
  const uniqueRoles = new Set(targetRoles);
9074
9071
  const role = uniqueRoles.size === 1 && !uniqueRoles.has(null) ? targetRoles[0] ?? null : null;
9075
- const templateContentStartOffset = descriptor.template?.loc.start.offset ?? 0;
9076
- const toSfcOffsets = (offsets) => new Set(
9077
- [...offsets].map((offset) => offset + templateContentStartOffset)
9078
- );
9079
9072
  return {
9080
9073
  role,
9081
9074
  targetRoles,
9082
9075
  forwardedTestIdTargetOffsets: new Set(targets.keys()),
9083
- forwardedTestIdTargetSfcOffsets: toSfcOffsets(targets.keys()),
9084
- explicitlyForwardedTestIdTargetOffsets: explicitTargetOffsets,
9085
- explicitlyForwardedTestIdTargetSfcOffsets: toSfcOffsets(explicitTargetOffsets)
9076
+ attrsObjectNames: scriptMetadata.attrsObjectNames,
9077
+ attrsFunctionNames: scriptMetadata.attrsFunctionNames
9086
9078
  };
9087
9079
  }
9088
9080
  function resolveWrapperContractForTag(options) {
@@ -9751,8 +9743,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
9751
9743
  }
9752
9744
  }
9753
9745
  const ownWrapperContract = getWrapperContract(componentName);
9754
- const elementStartOffset = element.loc.start.offset;
9755
- const isExplicitFallthroughTarget = ownWrapperContract?.explicitlyForwardedTestIdTargetOffsets.has(elementStartOffset) || ownWrapperContract?.explicitlyForwardedTestIdTargetSfcOffsets.has(elementStartOffset);
9746
+ const isExplicitFallthroughTarget = !!ownWrapperContract && elementExplicitlyForwardsTestId(element, testIdAttribute, ownWrapperContract);
9756
9747
  if (!dependencies.isView && isExplicitFallthroughTarget) {
9757
9748
  return;
9758
9749
  }