@immense/vue-pom-generator 1.0.106 → 1.0.108

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.
Files changed (36) hide show
  1. package/README.md +54 -0
  2. package/RELEASE_NOTES.md +36 -24
  3. package/class-generation/index.ts +111 -190
  4. package/dist/class-generation/index.d.ts +3 -0
  5. package/dist/class-generation/index.d.ts.map +1 -1
  6. package/dist/index.cjs +775 -707
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.mjs +776 -708
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/manifest-generator.d.ts +2 -1
  13. package/dist/manifest-generator.d.ts.map +1 -1
  14. package/dist/plugin/create-vue-pom-generator-plugins.d.ts +2 -0
  15. package/dist/plugin/create-vue-pom-generator-plugins.d.ts.map +1 -1
  16. package/dist/plugin/generate-vue-poms.d.ts +10 -0
  17. package/dist/plugin/generate-vue-poms.d.ts.map +1 -0
  18. package/dist/plugin/generated-outputs.d.ts +7 -0
  19. package/dist/plugin/generated-outputs.d.ts.map +1 -0
  20. package/dist/plugin/internal/build-plugin.d.ts +3 -10
  21. package/dist/plugin/internal/build-plugin.d.ts.map +1 -1
  22. package/dist/plugin/internal/dev-plugin.d.ts.map +1 -1
  23. package/dist/plugin/internal-plugins.d.ts +2 -1
  24. package/dist/plugin/internal-plugins.d.ts.map +1 -1
  25. package/dist/plugin/vue-plugin.d.ts +1 -0
  26. package/dist/plugin/vue-plugin.d.ts.map +1 -1
  27. package/dist/tests/generate-vue-poms.test.d.ts +2 -0
  28. package/dist/tests/generate-vue-poms.test.d.ts.map +1 -0
  29. package/dist/tests/generated-outputs.test.d.ts +2 -0
  30. package/dist/tests/generated-outputs.test.d.ts.map +1 -0
  31. package/dist/tests/incremental-generation.test.d.ts +2 -0
  32. package/dist/tests/incremental-generation.test.d.ts.map +1 -0
  33. package/dist/typescript-codegen.d.ts +14 -1
  34. package/dist/typescript-codegen.d.ts.map +1 -1
  35. package/dist/utils.d.ts.map +1 -1
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -298,6 +298,60 @@ if (import.meta.env.DEV) {
298
298
  }
299
299
  ```
300
300
 
301
+ ### Generate before typechecking
302
+
303
+ Use the one-shot API when a typechecker needs generated imports before the application
304
+ starts. Share the same generator options with your application's Vite configuration:
305
+
306
+ ```ts
307
+ // scripts/generate-poms.ts
308
+ import { generateVuePoms } from "@immense/vue-pom-generator";
309
+ import { pomConfig } from "../pom.config";
310
+
311
+ await generateVuePoms(pomConfig);
312
+ ```
313
+
314
+ Run this script with your TypeScript runner, then run `vue-tsc --noEmit` using `&&`
315
+ so generation errors stop the typecheck. `generateVuePoms` always scans the configured
316
+ source directories; there is no timestamp cache. It returns only after generation
317
+ finishes and rejects on invalid source or output errors. An empty source directory is
318
+ valid and removes its previous component outputs; no existing source directories is
319
+ an error.
320
+
321
+ The optional second argument accepts Vite `root`, `mode`, `resolve`, `plugins`, and
322
+ `logLevel`. Relative output paths resolve against `root`. The application Vite config
323
+ is **not** loaded implicitly: pass only companion plugins needed for generation. For
324
+ `vuePluginOwnership: "external"`, include your app-owned `vue()` plugin there. Other
325
+ generated declarations, such as those from a component auto-import plugin, remain that
326
+ plugin's responsibility.
327
+
328
+ Internally this uses a generation-only Vite build with no application entry, asset
329
+ output, public-directory copy, or application server. It shares source analysis,
330
+ compiler metadata, router introspection, and emitters with the regular generator.
331
+ It is a Vue entry point, not a replacement for Nuxt's project preparation lifecycle.
332
+
333
+ ### Generated output ownership
334
+
335
+ Each successful generation records its outputs in
336
+ `<generation.outDir>/.vue-pom-generator-outputs.json`. Later runs remove only unchanged
337
+ files recorded there that are no longer emitted. This covers renamed/deleted components,
338
+ split/aggregate switches, disabled languages, and moved/disabled VTU or fixture outputs.
339
+ Handwritten neighbors and files absent from the ownership manifest are never pruned.
340
+ An obsolete generated file edited by hand causes an error naming that file; move or
341
+ remove it explicitly before regenerating. Output-file/directory symlinks are rejected.
342
+
343
+ All outputs are rendered and validated before publication. Pruning happens only after
344
+ the new files are written. A failed source compilation or emission leaves the previous
345
+ files and manifest intact; a filesystem write failure can leave some new files, but
346
+ does not prune old ones. Shared `.gitattributes` files remain consumer-owned.
347
+
348
+ Keep the ownership manifest with its generated output (commit or ignore both together).
349
+ The first run does not guess ownership of files produced by older releases. Changing
350
+ the primary `generation.outDir` starts a new ownership set; clean the old directory
351
+ explicitly. Do not run multiple generation processes against the same output directory.
352
+ Calls to `generateVuePoms` in one process must also be awaited sequentially because
353
+ router introspection uses process-wide state; overlapping calls fail explicitly.
354
+
301
355
  ### Annotator overlay
302
356
 
303
357
  The generator can inject its floating annotator overlay into either a Vite dev server
package/RELEASE_NOTES.md CHANGED
@@ -1,40 +1,52 @@
1
- The range contains only PR #69 (v1.0.105 tag sits at the #68 merge; #69 merged at 16:02:56Z, inside
2
- the window). Let me review the actual diff to summarize it accurately.
3
-
4
- v1.0.106
1
+ Release window confirmed: only #72 and #71 fall in range (commit log matches). Now let me review the
2
+ actual diffs to write accurate notes.
5
3
 
6
4
  Highlights
7
5
 
8
- - New ESLint rule no-page-goto-in-specs bans raw page.goto(...) / playwrightPage.goto(...) in
9
- Playwright spec files, steering specs toward generated POM goTo() methods that navigate via Vue
10
- Router instead of re-bootstrapping the SPA.
11
- - Catches both direct (page.goto(...)) and computed (page["goto"](...)) member access.
12
- - Enabled as "error" in the flat/recommended config — upgrading may surface new lint failures in
13
- specs that use raw goto.
14
- - Rule is exported as noPageGotoInSpecsRule for custom configs.
6
+ - No more HMR regeneration loops on save: unchanged POM renders are now reused, and generated files
7
+ are only rewritten when their bytes actually change — keeping mtimes and Vite watcher state intact
8
+ (]8;id=md-di7kpu;https://github.com/immense/vue-pom-generator/pull/71#71]8;;]8;;).]8;;
9
+ - Faster dev-server saves: a per-dev-server render cache memoizes TypeScript codegen per output
10
+ file, keyed on the serialized render structure (]8;id=md-di7kpu;https://github.com/immense/vue-pom-generator/pull/71#71]8;;]8;;).]8;;
11
+ - Correct v-for alias shadowing: slot-scope callback detection now uses Vue's parsed v-for bindings
12
+ (value/key/index, including destructuring, defaults, and rest) instead of re-parsing alias
13
+ expressions (]8;id=md-d87z0v;https://github.com/immense/vue-pom-generator/pull/72#72]8;;]8;;).]8;;
14
+ - Clean lint is enforced: the release workflow now fails on any lint warning (--max-warnings 0)
15
+ (]8;id=md-d87z0v;https://github.com/immense/vue-pom-generator/pull/72#72]8;;]8;;).]8;;
15
16
 
16
17
  Changes
17
18
 
18
- ESLint
19
+ Incremental generation (]8;id=md-di7kpu;https://github.com/immense/vue-pom-generator/pull/71#71]8;;]8;;)]8;;
19
20
 
20
- - Add @immense/vue-pom-generator/no-page-goto-in-specs rule, registered in the plugin and
21
- re-exported from eslint/index.ts (#69).
22
- - Restrict flagging to direct receivers named page or playwrightPage — chained calls like
23
- page.screencast.goto() are not flagged.
24
- - Follow-up fix: widen the spec-file suffix set to match no-page-fixture-in-specs (adds
25
- .cts/.mts/.cjs/.mjs variants) and clean up the receiver doc comment.
21
+ - Add TypeScriptRenderCache and renderStructuredSourceFile in typescript-codegen.ts: renders are
22
+ memoized per output path, with writer closures resolved to their emitted text before comparison so
23
+ changed selectors, routes, and child methods still invalidate the cache.
24
+ - Refactor class-generation/index.ts to render through cached structured structures; the dev plugin
25
+ owns one cache per dev server and passes it into generateFiles.
26
+ - Skip writing generated files when content is unchanged, repairing removed or externally modified
27
+ outputs.
28
+ - Render the POM manifest module via the structured, cache-aware path (manifest-generator.ts).
29
+ - Add regression coverage (tests/incremental-generation.test.ts, tests/generated-outputs.test.ts)
30
+ plus a repro script and write-up (scripts/repro-hmr-regeneration.mjs,
31
+ docs/hmr-regeneration-reproduction.md).
26
32
 
27
- Breaking Changes
33
+ Vue template semantics & lint (]8;id=md-d87z0v;https://github.com/immense/vue-pom-generator/pull/72#72]8;;]8;;)]8;;
28
34
 
29
- None (additive rule and export; note the new recommended-config error above).
35
+ - Track v-for alias shadowing via Vue's forParseResult bindings; binding-pattern parsing now
36
+ matches Vue's function-parameter semantics for object/array destructuring.
37
+ - Update test fixtures (MyList, MyRadioGroup) to use canonical Vue loop bindings and satisfy lint
38
+ rules.
39
+ - Add a Lint step (--max-warnings 0) to the release workflow.
30
40
 
31
41
  Pull Requests Included
32
42
 
33
- - #69 feat(eslint): no-page-goto-in-specs rule —
34
- ]8;id=md-em2tzr;https://github.com/immense/vue-pom-generator/pull/69https://github.com/immense/vue-pom-generator/pull/69]8;;
43
+ - ]8;id=md-d87z0v;https://github.com/immense/vue-pom-generator/pull/72#72]8;;]8;; — fix: use Vue loop bindings and enforce clean lint]8;;
44
+ - ]8;id=md-di7kpu;https://github.com/immense/vue-pom-generator/pull/71#71]8;;]8;; — fix: avoid rebuilding unchanged POMs on save]8;;
35
45
 
36
46
  Testing
37
47
 
38
- New test coverage added in tests/eslint.test.ts for the rule's detection and bypass behavior; not
39
- run as part of these notes.
48
+ - Added tests/incremental-generation.test.ts covering cache reuse and invalidation; extended
49
+ tests/utils.test.ts with v-for alias shadowing cases (simple, nested/defaulted/renamed/rest object
50
+ patterns, array patterns with of) and updated tests/generated-outputs.test.ts.
51
+ - Release CI now also runs the lint suite with warnings disallowed.
40
52