@webjourney/vite-plugins 1.2.7 → 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 +0 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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 (
|
|
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
|
-
|
|
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
|
}
|