Skip to content

Commit

Permalink
Remove dependency on node:module
Browse files Browse the repository at this point in the history
Should allow this package to be used in non-node environments. Resolves ef4#20
  • Loading branch information
davidtaylorhq committed Apr 25, 2024
1 parent cf22508 commit a5b0c07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type * as Babel from "@babel/core";
import type { types as t, NodePath } from "@babel/core";
import { createRequire } from "node:module";
import { ImportUtil } from "babel-import-util";
import { globalId } from "./global-id.ts";
const req = createRequire(import.meta.url);
const { default: decoratorSyntax } = req("@babel/plugin-syntax-decorators");

// @ts-expect-error no upstream types
import PluginSyntaxDecorators from "@babel/plugin-syntax-decorators";
const decoratorSyntax =
PluginSyntaxDecorators.default || PluginSyntaxDecorators;

interface State extends Babel.PluginPass {
currentClassBodies: t.ClassBody[];
Expand Down

0 comments on commit a5b0c07

Please sign in to comment.