Skip to content

Commit

Permalink
fix: don't use anything from "@babel/types" in runtime (#2132)
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei-iatsenko authored Dec 23, 2024
1 parent 5ae8363 commit 7ebb88d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/babel-plugin-extract-messages/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type * as BabelTypesNamespace from "@babel/types"
import {
import type {
Expression,
Identifier,
Node,
ObjectExpression,
ObjectProperty,
isObjectExpression,
} from "@babel/types"
import type { PluginObj, PluginPass, NodePath } from "@babel/core"
import type { Hub } from "@babel/traverse"
Expand Down Expand Up @@ -161,7 +160,7 @@ function extractFromObjectExpression(
;(exp.properties as ObjectProperty[]).forEach(({ key, value }, i) => {
const name = (key as Identifier).name

if (name === "values" && isObjectExpression(value)) {
if (name === "values" && t.isObjectExpression(value)) {
props.placeholders = valuesObjectExpressionToPlaceholdersRecord(
t,
value,
Expand Down Expand Up @@ -274,7 +273,7 @@ export default function ({ types: t }: { types: BabelTypes }): PluginObj {
if (
key === "values" &&
t.isJSXExpressionContainer(item.value) &&
isObjectExpression(item.value.expression)
t.isObjectExpression(item.value.expression)
) {
acc.placeholders = valuesObjectExpressionToPlaceholdersRecord(
t,
Expand Down

0 comments on commit 7ebb88d

Please sign in to comment.