@immense/vue-pom-generator 1.0.101 → 1.0.103

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,44 +1,25 @@
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.
1
+ v1.0.103
5
2
 
6
3
  Highlights
7
4
 
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.
5
+ - Fixed bundling of the annotator HTML import so the annotator client works correctly from
6
+ packed/published builds (#66)
7
+ - Extended the packed-build smoke check to guard the fix
16
8
 
17
9
  Changes
18
10
 
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.
29
-
30
- Breaking Changes
11
+ Fixes
31
12
 
32
- None.
13
+ - Bundled the annotator HTML import in the plugin runtime instead of relying on an unpackaged file
14
+ reference (plugin/runtime/annotator/plugin.ts) ([be0dcd4])
15
+ - Updated scripts/packed-smoke-check.mjs to cover the packaged output alongside the fix
33
16
 
34
17
  Pull Requests Included
35
18
 
36
- - ]8;id=md-b07zz4;https://github.com/immense/vue-pom-generator/pull/64#64 — fix: preserve injected expression scope]8;;]8;; (@dkattan)]8;;
19
+ - ]8;id=md-bk77d2;https://github.com/immense/vue-pom-generator/pull/66#66]8;;]8;; — fix: bundle annotator HTML import (@dkattan)]8;;
37
20
 
38
21
  Testing
39
22
 
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.
23
+ - No test runs were performed while preparing these notes; scripts/packed-smoke-check.mjs was
24
+ updated to validate the packed bundle as part of the change.
44
25
 
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);
@@ -11030,17 +11032,20 @@ ${code}`,
11030
11032
  map: null
11031
11033
  };
11032
11034
  },
11033
- transformIndexHtml() {
11034
- if (!options.enabled) {
11035
- return void 0;
11035
+ transformIndexHtml: {
11036
+ order: "pre",
11037
+ handler() {
11038
+ if (!options.enabled) {
11039
+ return void 0;
11040
+ }
11041
+ const tag = {
11042
+ tag: "script",
11043
+ attrs: { type: "module" },
11044
+ children: `import ${JSON.stringify(ANNOTATOR_CLIENT_VIRTUAL_ID)};`,
11045
+ injectTo: "body"
11046
+ };
11047
+ return [tag];
11036
11048
  }
11037
- const tag = {
11038
- tag: "script",
11039
- attrs: { type: "module" },
11040
- children: `import ${JSON.stringify(ANNOTATOR_CLIENT_VIRTUAL_ID)};`,
11041
- injectTo: "body"
11042
- };
11043
- return [tag];
11044
11049
  }
11045
11050
  };
11046
11051
  }