@immense/vue-pom-generator 1.0.114 → 1.0.115

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,35 +1,35 @@
1
- I'll verify the actual contents of the compare range and the PR's changes before writing the notes.
2
-
3
- The range contains exactly one commit (#79). Let me review its diff to describe the feature
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
4
3
  accurately.
5
4
 
5
+ v1.0.115
6
+
6
7
  Highlights
7
8
 
8
- - Generated POMs now expose BasePage.screenshot() as a first-class proof-capture seam — no more
9
- reaching for the raw Page escape hatch to save evidence screenshots.
10
- - Options mirror Playwright's own page.screenshot (path, fullPage, timeout) and pass through
11
- verbatim; the method resolves to the image buffer and writes the file when path is set.
12
- - screenshot is recognized as a value-returning method in the fluent chain, so awaited destination
13
- POMs (e.g. after goTo...()) can capture screenshots directly.
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.
14
16
 
15
17
  Changes
16
18
 
17
- POM class generation
19
+ Plugin
18
20
 
19
- - Added BasePage.screenshot(options?) as a thin delegate to Playwright's page.screenshot — no
20
- animation, callout, or annotation side effects (]8;id=md-78o31g;https://github.com/immense/vue-pom-generator/blob/main/class-generation/base-page.tsbase-page.ts]8;;]8;;).]8;;
21
- - Added BasePageScreenshotOptions (path, fullPage, timeout) and wired screenshot into the narrowed
22
- BasePagePage interface (]8;id=md-14v2psc;https://github.com/immense/vue-pom-generator/blob/main/class-generation/playwright-types.tsplaywright-types.ts]8;;]8;;).]8;;
23
- - Extended fluent-chain handling so screenshot joins getObjectId/getObjectIdAsInt as a
24
- value-returning method, returning the awaited image buffer.
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.
25
27
 
26
- Tests
28
+ Path and scope resolution
27
29
 
28
- - New Playwright spec tests/playwright/pom-screenshot.spec.ts covering: writing a real PNG file
29
- (path) and verifying the resolved buffer matches it, capturing without options, and the consumer
30
- pattern of screenshotting an awaited fluent destination POM.
31
- - Extended broad unit coverage for base-page.ts and updated the fake-runtime test helper to support
32
- the new seam.
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.
33
33
 
34
34
  Breaking Changes
35
35
 
@@ -37,11 +37,12 @@ None.
37
37
 
38
38
  Pull Requests Included
39
39
 
40
- - ]8;id=md-fq4e9m;https://github.com/immense/vue-pom-generator/pull/79#79 — feat(pom): BasePage.screenshot proof-capture seam]8;;]8;; (@dkattan)]8;;
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;;
41
41
 
42
42
  Testing
43
43
 
44
- - Unit tests for base-page generation extended in
45
- tests/broad/class-generation-base-page-ts.test.ts.
46
- - New Playwright end-to-end spec validates buffer content, PNG magic bytes, and file-write parity.
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).
47
48
 
package/dist/index.cjs CHANGED
@@ -4168,6 +4168,14 @@ function writeGeneratedOutputs(outDir, files, sharedFiles, projectRoot = path.di
4168
4168
  writeFile(manifestPath, `${JSON.stringify(next, null, 2)}
4169
4169
  `);
4170
4170
  }
4171
+ function toPosixSlashes(value) {
4172
+ let out = "";
4173
+ for (let i = 0; i < value.length; i++) {
4174
+ const ch = value[i];
4175
+ out += ch === "\\" ? "/" : ch;
4176
+ }
4177
+ return out;
4178
+ }
4171
4179
  function safeRealpath(value) {
4172
4180
  try {
4173
4181
  if (fs.existsSync(value)) {
@@ -4203,18 +4211,18 @@ function resolveComponentNameFromPath(options) {
4203
4211
  const { projectRoot, viewsDirAbs, sourceDirs, extraRoots = [] } = options;
4204
4212
  const cleanFilename = options.filename.includes("?") ? options.filename.substring(0, options.filename.indexOf("?")) : options.filename;
4205
4213
  const absFilename = path.isAbsolute(cleanFilename) ? cleanFilename : path.resolve(projectRoot, cleanFilename);
4206
- const normalizedAbsFilename = path.normalize(safeRealpath(absFilename));
4214
+ const normalizedAbsFilename = toPosixSlashes(path.normalize(safeRealpath(absFilename)));
4207
4215
  const rootBases = [projectRoot, ...extraRoots.filter((r) => r !== projectRoot)];
4208
4216
  const roots = [
4209
4217
  viewsDirAbs,
4210
4218
  ...sourceDirs.flatMap((dir) => path.isAbsolute(dir) ? [dir] : rootBases.map((base) => path.resolve(base, dir)))
4211
4219
  ];
4212
- const potentialRoots = Array.from(new Set(roots.map((r) => path.normalize(safeRealpath(r))))).sort((a, b) => b.length - a.length);
4220
+ const potentialRoots = Array.from(new Set(roots.map((r) => toPosixSlashes(path.normalize(safeRealpath(r)))))).sort((a, b) => b.length - a.length);
4213
4221
  for (const root of potentialRoots) {
4214
- if (normalizedAbsFilename.startsWith(root + path.sep) || normalizedAbsFilename === root) {
4215
- const rel = path.relative(root, normalizedAbsFilename);
4216
- const parsed = path.parse(rel);
4217
- const segments = path.join(parsed.dir, parsed.name);
4222
+ if (normalizedAbsFilename.startsWith(`${root}/`) || normalizedAbsFilename === root) {
4223
+ const rel = path.posix.relative(root, normalizedAbsFilename);
4224
+ const parsed = path.posix.parse(rel);
4225
+ const segments = path.posix.join(parsed.dir, parsed.name);
4218
4226
  return toPascalCase(segments);
4219
4227
  }
4220
4228
  }
@@ -10580,7 +10588,8 @@ function createVuePluginWithTestIds(options) {
10580
10588
  runtimeNodeTransform
10581
10589
  ]
10582
10590
  };
10583
- const collectSource = async (code, cleanPath) => {
10591
+ const collectSource = async (code, rawPath) => {
10592
+ const cleanPath = toPosixSlashes(rawPath);
10584
10593
  const componentName = getComponentNameFromPath(cleanPath);
10585
10594
  loggerRef.current.debug(`Collecting metadata for ${cleanPath} (component: ${componentName})`);
10586
10595
  const compilerSfc2 = await import("@vue/compiler-sfc");
@@ -10813,7 +10822,7 @@ function createDevProcessorPlugin(options) {
10813
10822
  const { descriptor } = compilerSfc.parse(source, { filename });
10814
10823
  if (!descriptor.script && !descriptor.scriptSetup)
10815
10824
  return { bindings: void 0, isScriptSetup: false };
10816
- const scriptBlock = compilerSfc.compileScript(descriptor, { id: filename });
10825
+ const scriptBlock = compilerSfc.compileScript(descriptor, { id: toPosixSlashes(filename) });
10817
10826
  return { bindings: scriptBlock.bindings, isScriptSetup: !!descriptor.scriptSetup };
10818
10827
  } catch {
10819
10828
  return { bindings: void 0, isScriptSetup: false };