tempo-sdk 0.0.4 → 0.0.5

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.js CHANGED
@@ -111,6 +111,17 @@ function annotateFile(source, filename, computeAnnotatedProps) {
111
111
  return { annotatedSource: chunks.join(""), elementsAnnotated: insertions.length, parseResult };
112
112
  }
113
113
 
114
+ // ../../modules/annotation/has-expression-children.ts
115
+ function hasJsxExpressionChild(element) {
116
+ for (const child of element.children) {
117
+ if (child.type !== "JSXExpressionContainer") continue;
118
+ const expression = child.expression;
119
+ if (!expression || expression.type === "JSXEmptyExpression") continue;
120
+ return true;
121
+ }
122
+ return false;
123
+ }
124
+
114
125
  // index.ts
115
126
  import { createFilter } from "@rollup/pluginutils";
116
127
 
@@ -901,15 +912,18 @@ function tempoVitePlugin(options = {}) {
901
912
  const typeInfo = typeAnalyzer?.analyzeFileTypes(cleanId, source);
902
913
  const result = annotateFile(source, cleanId, (info) => {
903
914
  const userProps = computeAnnotatedProps(info, filepath, modifiedtsMs);
915
+ const dynamicTextProp = hasJsxExpressionChild(info.element) ? { "data-tempo-text-dynamic": true } : {};
904
916
  if (isIntrinsicElement(info.tagName)) {
905
917
  return {
906
918
  ...userProps,
919
+ ...dynamicTextProp,
907
920
  "data-tempo-supports-children": !HTML_VOID_ELEMENTS.has(info.tagName)
908
921
  };
909
922
  }
910
923
  const support = typeInfo?.get(info.element.openingElement.start);
911
924
  return {
912
925
  ...userProps,
926
+ ...dynamicTextProp,
913
927
  "data-tempo-supports-style": support?.supportsStyle ?? false,
914
928
  "data-tempo-supports-classname": support?.supportsClassName ?? false,
915
929
  "data-tempo-supports-children": support?.supportsChildren ?? false