@webjourney/vite-plugins 1.2.7-0 → 1.2.7-1
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/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/package.json +1 -1
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;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,uBAAuB;;;oBAKnB,MAAM,MAAM,MAAM;;;;EA6KrC;AAED,wBAAgB,sBAAsB;;;6BAKT,MAAM;EAIlC;AAED,wBAAgB,iBAAiB;;;oBA1Lb,MAAM,MAAM,MAAM;;;;;;;6BAoLT,MAAM;KAUlC"}
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,16 @@ export function webjourneyElementTagger() {
|
|
|
34
34
|
traverse(ast, {
|
|
35
35
|
JSXElement(path) {
|
|
36
36
|
const openingElement = path.node.openingElement;
|
|
37
|
+
// Skip wrapper spans we created (they have data-wj-text attribute)
|
|
38
|
+
const isWrapperSpan = t.isJSXIdentifier(openingElement.name) &&
|
|
39
|
+
openingElement.name.name === 'span' &&
|
|
40
|
+
openingElement.attributes.some((attr) => t.isJSXAttribute(attr) &&
|
|
41
|
+
t.isJSXIdentifier(attr.name) &&
|
|
42
|
+
attr.name.name === 'data-wj-text');
|
|
43
|
+
if (isWrapperSpan) {
|
|
44
|
+
path.skip(); // Don't traverse into our wrapper spans
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
37
47
|
const lineNumber = openingElement.loc?.start.line ?? 0;
|
|
38
48
|
// Process children to wrap text nodes
|
|
39
49
|
const newChildren = [];
|