Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on node:module #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am loathe to spread this kind of incorrect code further through the ecosystem.

I think this is a bug in tsup: egoist/tsup#1078

We don't need to use tsup, I'm fine with using babel or tsc directly instead.


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