babel-plugin-react-compiler 0.0.0-experimental-c134c19-20250508 → 0.0.0-experimental-ec81157-20250508

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.
Files changed (2) hide show
  1. package/dist/index.js +43 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -80158,6 +80158,49 @@ function evaluateInstruction(constants, instr) {
80158
80158
  }
80159
80159
  return null;
80160
80160
  }
80161
+ case "TemplateLiteral": {
80162
+ if (value.subexprs.length === 0) {
80163
+ const result2 = {
80164
+ kind: "Primitive",
80165
+ value: value.quasis.map((q) => q.cooked).join(""),
80166
+ loc: value.loc
80167
+ };
80168
+ instr.value = result2;
80169
+ return result2;
80170
+ }
80171
+ if (value.subexprs.length !== value.quasis.length - 1) {
80172
+ return null;
80173
+ }
80174
+ if (value.quasis.some((q) => q.cooked === void 0)) {
80175
+ return null;
80176
+ }
80177
+ let quasiIndex = 0;
80178
+ let resultString = value.quasis[quasiIndex].cooked;
80179
+ ++quasiIndex;
80180
+ for (const subExpr of value.subexprs) {
80181
+ const subExprValue = read2(constants, subExpr);
80182
+ if (!subExprValue || subExprValue.kind !== "Primitive") {
80183
+ return null;
80184
+ }
80185
+ const expressionValue = subExprValue.value;
80186
+ if (typeof expressionValue !== "number" && typeof expressionValue !== "string" && typeof expressionValue !== "boolean" && !(typeof expressionValue === "object" && expressionValue === null)) {
80187
+ return null;
80188
+ }
80189
+ const suffix = value.quasis[quasiIndex].cooked;
80190
+ ++quasiIndex;
80191
+ if (suffix === void 0) {
80192
+ return null;
80193
+ }
80194
+ resultString = resultString.concat(expressionValue, suffix);
80195
+ }
80196
+ const result = {
80197
+ kind: "Primitive",
80198
+ value: resultString,
80199
+ loc: value.loc
80200
+ };
80201
+ instr.value = result;
80202
+ return result;
80203
+ }
80161
80204
  case "LoadLocal": {
80162
80205
  const placeValue = read2(constants, value.place);
80163
80206
  if (placeValue !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-plugin-react-compiler",
3
- "version": "0.0.0-experimental-c134c19-20250508",
3
+ "version": "0.0.0-experimental-ec81157-20250508",
4
4
  "description": "Babel plugin for React Compiler.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",