@webjourney/vite-plugins 1.2.7-2 → 1.2.8-0

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/dist/cli.js CHANGED
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,uBAAuB;;;oBAKnB,MAAM,MAAM,MAAM;;;;EA0MrC;AAED,wBAAgB,sBAAsB;;;6BAKT,MAAM;EAIlC;AAED,wBAAgB,iBAAiB;;;oBAvNb,MAAM,MAAM,MAAM;;;;;;;6BAiNT,MAAM;KAUlC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,uBAAuB;;;oBAKnB,MAAM,MAAM,MAAM;;;;EA0MrC;AAED,wBAAgB,sBAAsB;;;6BAKT,MAAM;EAelC;AAED,wBAAgB,iBAAiB;;;oBAlOb,MAAM,MAAM,MAAM;;;;;;;6BAiNT,MAAM;KAqBlC"}
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ export function webjourneyElementTagger() {
69
69
  const nonTextChildren = path.node.children.filter((child) => !t.isJSXText(child) || (t.isJSXText(child) && child.value.trim() === ''));
70
70
  if (textNodes.length > 0) {
71
71
  // Case 1: Single text node child (no other elements)
72
- if (textNodes.length === 1 && nonTextChildren.length === 0) {
72
+ if (nonTextChildren.length === 0) {
73
73
  // Add data-wj-* attributes to the current element
74
74
  const elementId = `${relativePath}:${lineNumber}`;
75
75
  openingElement.attributes.push(t.jsxAttribute(t.jsxIdentifier('data-wj-file'), t.stringLiteral(relativePath)), t.jsxAttribute(t.jsxIdentifier('data-wj-line'), t.stringLiteral(String(lineNumber))), t.jsxAttribute(t.jsxIdentifier('data-wj-type'), t.stringLiteral('text')), t.jsxAttribute(t.jsxIdentifier('data-wj-id'), t.stringLiteral(elementId)));
@@ -143,7 +143,13 @@ export function webjourneyPluginScript() {
143
143
  name: 'webjourney-plugin-script',
144
144
  enforce: 'pre',
145
145
  transformIndexHtml(html) {
146
- return html.replace('</head>', `<script src="${webjourneyPluginScriptHost}/plugins/plugin.iife.js"></script></head>`);
146
+ // Get project ID from environment variable
147
+ const projectId = process.env.WEBJOURNEY_PROJECT_ID;
148
+ // Build the meta tag if project ID exists
149
+ const metaTag = projectId
150
+ ? `<meta name="webjourney-project-id" content="${projectId}">\n `
151
+ : '';
152
+ return html.replace('</head>', `${metaTag}<script src="${webjourneyPluginScriptHost}/plugins/plugin.iife.js"></script></head>`);
147
153
  }
148
154
  };
149
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjourney/vite-plugins",
3
- "version": "1.2.7-2",
3
+ "version": "1.2.8-0",
4
4
  "description": "Vite plugins for Webjourney WYSIWYG editing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",