@immense/vue-pom-generator 1.0.17 → 1.0.19

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,20 +1,31 @@
1
- ## v1.0.17
1
+ ```markdown
2
+ ## Highlights
2
3
 
3
- ### Highlights
4
- - Fixed TypeScript declaration file emission during build to ensure `.d.ts` files are generated
5
- alongside compiled output
6
- - Updated `.gitignore` to exclude generated declaration files from source control
7
- - Build process now includes explicit `tsc --emitDeclarationOnly` step after Vite compilation
4
+ - Fixed CJS runtime file resolution issue with Rollup 4.x builds
5
+ - Improved compatibility when running in JSDOM-shimmed environments
6
+ - Added try/catch fallback pattern for robust path resolution across ESM and CJS contexts
8
7
 
9
- ### Changes
10
- - **Build**: Added TypeScript compiler step to emit declaration files, as Vite alone does not
11
- generate `.d.ts` even with `declaration:true` in tsconfig
12
- - **Configuration**: Updated `.gitignore` to ignore generated TypeScript declaration outputs
8
+ ## Changes
9
+
10
+ - **File Resolution:** Implemented try/catch fallback to `__dirname` for CJS runtime file
11
+ resolution in class generation module
12
+ - Addresses Rollup 4.x behavior where `import.meta.dirname` transforms to `void 0` in CJS
13
+ output
14
+ - Uses `fileURLToPath` with `import.meta.url` first (ESM), falls back to `path.resolve` with
15
+ `__dirname` (CJS)
16
+ - Handles JSDOM-shimmed document scenarios where `import.meta.url` resolves to `https://` URLs
17
+
18
+ ## Breaking Changes
19
+
20
+ None
21
+
22
+ ## Pull Requests Included
13
23
 
14
- ### Pull Requests Included
15
24
  - [#1 Add PR release-notes preview
16
- comments](https://github.com/immense/vue-pom-generator/pull/1) by @dkattan (merged 2026-02-02)
25
+ comments](https://github.com/immense/vue-pom-generator/pull/1) by @dkattan
26
+
27
+ ## Testing
17
28
 
18
- ### Testing
19
- All existing tests continue to pass.
29
+ Not explicitly mentioned in commits
30
+ ```
20
31
 
@@ -1484,12 +1484,24 @@ async function generateAggregatedFiles(
1484
1484
 
1485
1485
  // Copy runtime dependencies into the output folder so the aggregated POM file can
1486
1486
  // import them without relying on workspace package resolution.
1487
- const clickInstrumentationAbs = fileURLToPath(new URL("../click-instrumentation.ts", import.meta.url));
1488
- // These runtime .ts files must resolve correctly both when running from source
1489
- // (e.g. during development/tests) and when bundled into dist/index.* for npm.
1490
- // Resolving via package-root `class-generation/*` is stable across both.
1491
- const pointerAbs = fileURLToPath(new URL("../class-generation/Pointer.ts", import.meta.url));
1492
- const playwrightTypesAbs = fileURLToPath(new URL("../class-generation/playwright-types.ts", import.meta.url));
1487
+ // Resolve paths to bundled runtime files. Mirror the pattern in support-plugins.ts:
1488
+ // try fileURLToPath(new URL(..., import.meta.url)) (works in ESM where import.meta.url
1489
+ // is a proper file:// URL), then fall back to __dirname (available in the CJS bundle
1490
+ // via Node's module wrapper). The fallback is needed because ensureDomShim() in
1491
+ // router-introspection sets globalThis.document via JSDOM (url "https://example.test/"),
1492
+ // after which Rollup's CJS shim for import.meta.url resolves to document.baseURI
1493
+ // ("https://example.test/index.cjs") — not a file:// URL — causing fileURLToPath to throw.
1494
+ const resolvePluginAsset = (relative: string): string => {
1495
+ try {
1496
+ return fileURLToPath(new URL(relative, import.meta.url));
1497
+ }
1498
+ catch {
1499
+ return path.resolve(__dirname, relative);
1500
+ }
1501
+ };
1502
+ const clickInstrumentationAbs = resolvePluginAsset("../click-instrumentation.ts");
1503
+ const pointerAbs = resolvePluginAsset("../class-generation/Pointer.ts");
1504
+ const playwrightTypesAbs = resolvePluginAsset("../class-generation/playwright-types.ts");
1493
1505
 
1494
1506
  const runtimeFiles: Array<{ filePath: string; content: string }> = [
1495
1507
  {
package/dist/index.cjs CHANGED
@@ -3700,9 +3700,16 @@ export * from "./page-object-models.g";
3700
3700
  throw new Error(`Failed to read ${description} at ${absPath}`);
3701
3701
  }
3702
3702
  };
3703
- const clickInstrumentationAbs = node_url.fileURLToPath(new URL("../click-instrumentation.ts", typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
3704
- const pointerAbs = node_url.fileURLToPath(new URL("../class-generation/Pointer.ts", typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
3705
- const playwrightTypesAbs = node_url.fileURLToPath(new URL("../class-generation/playwright-types.ts", typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
3703
+ const resolvePluginAsset = (relative) => {
3704
+ try {
3705
+ return node_url.fileURLToPath(new URL(relative, typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href));
3706
+ } catch {
3707
+ return path.resolve(__dirname, relative);
3708
+ }
3709
+ };
3710
+ const clickInstrumentationAbs = resolvePluginAsset("../click-instrumentation.ts");
3711
+ const pointerAbs = resolvePluginAsset("../class-generation/Pointer.ts");
3712
+ const playwrightTypesAbs = resolvePluginAsset("../class-generation/playwright-types.ts");
3706
3713
  const runtimeFiles = [
3707
3714
  {
3708
3715
  filePath: path.join(runtimeDirAbs, "click-instrumentation.ts"),