@immense/vue-pom-generator 1.0.101 → 1.0.102

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/README.md CHANGED
@@ -298,6 +298,32 @@ if (import.meta.env.DEV) {
298
298
  }
299
299
  ```
300
300
 
301
+ ### Annotator overlay
302
+
303
+ The generator can inject its floating annotator overlay into either a Vite dev server
304
+ or a built application. Keep the environment decision in the Vite config and enable
305
+ the metadata and UI together:
306
+
307
+ ```ts
308
+ const pomConfig = defineVuePomGeneratorConfig({
309
+ runtime: {
310
+ annotator: {
311
+ enabled: true,
312
+ ui: {
313
+ enabled: true,
314
+ outputDetail: "forensic",
315
+ copyToClipboard: false,
316
+ showComponentTree: true,
317
+ },
318
+ },
319
+ },
320
+ });
321
+ ```
322
+
323
+ When `runtime.annotator.ui.enabled` is true, the same browser-only client is injected
324
+ for both `vite serve` and `vite build`. Disable it for production in your conditional
325
+ Vite config when the overlay is intended only for development or preview artifacts.
326
+
301
327
  ## Basic Nuxt setup
302
328
 
303
329
  ```ts
package/RELEASE_NOTES.md CHANGED
@@ -1,31 +1,34 @@
1
- I'll verify which PRs actually fall within the release window by querying the GitHub API for merge
2
- timestamps.
3
-
4
- Only PR #64 is in the v1.0.100..HEAD range. Let me examine the diff to write accurate notes.
5
-
6
1
  Highlights
7
2
 
8
- - Generator-injected dynamic bindings (e.g. :data-testid, annotator metadata attributes) now retain
9
- correct runtime scope, resolving against setup vars, props, and v-for/slot locals just like
10
- authored bindings.
11
- - upsertAttribute processes template-literal expressions through Vue's processExpression when
12
- prefixIdentifiers is active, so injected identifiers are properly rewritten ($props.subject.id,
13
- $setup.getPanelKey($setup.state), _ctx.subject.key).
14
- - Slot-scope fallback key expressions in the cross-file key registry are likewise scope-preserved.
15
- - New regression tests cover both cross-file key expressions and keyed component-instance markers.
3
+ - The annotator overlay can now be mounted in configured builds (vite build), not just vite serve
4
+ (#65).
5
+ - Browser-only safety: the annotator client is explicitly excluded from SSR builds, and SSR
6
+ transforms are skipped.
7
+ - New packed smoke checks verify the overlay ships in browser bundles, that no Node-only generator
8
+ code leaks into them, and that SSR builds stay clean.
16
9
 
17
10
  Changes
18
11
 
19
- - transform.ts: slot-scope fallback key expression is now run through createSimpleExpression +
20
- processExpression before being resolved, ensuring runtime identifiers are prefixed correctly;
21
- context is threaded into upsertAttribute calls for POM-instance and option-prefix attributes.
22
- - utils.ts: upsertAttribute gains an optional TransformContext parameter; template-kind bindings
23
- are processed via processExpression when context.prefixIdentifiers is set. applyResolvedDataTestId
24
- forwards context to all annotator metadata and data-testid attribute writes.
25
- - tests/transform.test.ts: compileWithRuntimeTemplateOptions extended with inline,
26
- crossFileKeyRegistry, vueFilesPathMap, and wrapperSearchRoots options; added tests asserting
27
- runtime-scope rewriting for cross-file key expressions and keyed component-instance markers; updated
28
- an existing assertion to expect _ctx.subject.* prefixes.
12
+ Runtime annotator
13
+
14
+ - Changed the annotator UI plugin's apply logic so it runs during vite serve or any non-SSR vite
15
+ build, instead of the previous serve-only restriction (#65).
16
+ - Skipped the annotator transform for SSR requests (transformOptions?.ssr) so the browser-only
17
+ client never reaches server bundles (#65).
18
+ - Updated option documentation: runtime.annotator and runtime.annotator.ui are no longer described
19
+ as dev-only; both vite serve and vite build inject the same browser-side overlay when enabled (#65).
20
+
21
+ Documentation
22
+
23
+ - Added an "Annotator overlay" section to the README showing how to enable metadata + UI together
24
+ in the Vite config, and how to keep it out of production via conditional config (#65).
25
+
26
+ Tooling / CI
27
+
28
+ - Extended the packed smoke check to enable runtime.annotator and assert on built output: the
29
+ vpg-annotator-toolbar client must be present in browser assets, Node-only code (createRequire) must
30
+ be absent, and an SSR build (vite build --ssr) must neither include the client nor fail to evaluate
31
+ its emitted entry (#65).
29
32
 
30
33
  Breaking Changes
31
34
 
@@ -33,12 +36,12 @@ None.
33
36
 
34
37
  Pull Requests Included
35
38
 
36
- - ]8;id=md-b07zz4;https://github.com/immense/vue-pom-generator/pull/64#64 — fix: preserve injected expression scope]8;;]8;; (@dkattan)]8;;
39
+ - #65 fix: mount annotator in configured builds —
40
+ ]8;id=md-ba7lo3;https://github.com/immense/vue-pom-generator/pull/65https://github.com/immense/vue-pom-generator/pull/65]8;;
37
41
 
38
42
  Testing
39
43
 
40
- Added regression tests in tests/transform.test.ts verifying that injected cross-file key expressions
41
- resolve to $props.subject.id and keyed component-instance markers resolve to
42
- $setup.getPanelKey($setup.state), with assertions that bare-identifier forms no longer appear in
43
- compiled output.
44
+ - Packed smoke check extended with new assertions: annotator client present in the browser build,
45
+ no Node-only generator code in the client, and the SSR build excludes the annotator and evaluates
46
+ cleanly.
44
47
 
package/dist/index.cjs CHANGED
@@ -10997,7 +10997,9 @@ function createAnnotatorUiPlugin(options) {
10997
10997
  });
10998
10998
  return {
10999
10999
  name: "vue-pom-generator:annotator-ui",
11000
- apply: "serve",
11000
+ apply(config, { command }) {
11001
+ return command === "serve" || !config.build?.ssr;
11002
+ },
11001
11003
  resolveId(id) {
11002
11004
  if (id === ANNOTATOR_CLIENT_VIRTUAL_ID) {
11003
11005
  return ANNOTATOR_CLIENT_RESOLVED_ID;
@@ -11013,8 +11015,8 @@ function createAnnotatorUiPlugin(options) {
11013
11015
  ""
11014
11016
  ].join("\n");
11015
11017
  },
11016
- transform(code, id) {
11017
- if (!options.enabled) {
11018
+ transform(code, id, transformOptions) {
11019
+ if (!options.enabled || transformOptions?.ssr) {
11018
11020
  return null;
11019
11021
  }
11020
11022
  const normalizedId = normalizePathSeparators(id);