Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 9178e1c

Browse files
committed
try something new with babel
1 parent 2c4ff92 commit 9178e1c

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

.changeset/wicked-elephants-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@prpc/vite': patch
3+
---
4+
5+
try something new with babel

packages/vite/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
"vite": "^4.1.2",
3232
"vitest": "^0.29.2"
3333
},
34+
"dependencies": {
35+
"@babel/core": "^7.20.12",
36+
"@babel/preset-typescript": "^7.18.6"
37+
},
38+
"peerDependencies": {
39+
"vite": "^3 || ^4"
40+
},
3441
"engines": {
3542
"node": ">=16"
3643
},

packages/vite/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { transform, type template, type types } from '@babel/core'
2+
import * as babel from '@babel/core'
33
import type { Plugin } from 'vite'
44

55
export function prpc(): Plugin {
@@ -11,7 +11,7 @@ export function prpc(): Plugin {
1111
(code.includes('query$(') || code.includes('mutation$(')) &&
1212
id.endsWith('.ts')
1313
) {
14-
const transformed = transform(code, {
14+
const transformed = babel.transform(code, {
1515
presets: ['@babel/preset-typescript'],
1616
plugins: [transformpRPC$],
1717
filename: id,
@@ -29,8 +29,8 @@ export function transformpRPC$({
2929
types: t,
3030
template: temp,
3131
}: {
32-
types: typeof types
33-
template: typeof template
32+
types: typeof babel.types
33+
template: typeof babel.template
3434
}) {
3535
return {
3636
visitor: {

pnpm-lock.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)