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

Commit

Permalink
try something new with babel
Browse files Browse the repository at this point in the history
  • Loading branch information
OrJDev committed Mar 2, 2023
1 parent 2c4ff92 commit 9178e1c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-elephants-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@prpc/vite': patch
---

try something new with babel
7 changes: 7 additions & 0 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
"vite": "^4.1.2",
"vitest": "^0.29.2"
},
"dependencies": {
"@babel/core": "^7.20.12",
"@babel/preset-typescript": "^7.18.6"
},
"peerDependencies": {
"vite": "^3 || ^4"
},
"engines": {
"node": ">=16"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/vite/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { transform, type template, type types } from '@babel/core'
import * as babel from '@babel/core'
import type { Plugin } from 'vite'

export function prpc(): Plugin {
Expand All @@ -11,7 +11,7 @@ export function prpc(): Plugin {
(code.includes('query$(') || code.includes('mutation$(')) &&
id.endsWith('.ts')
) {
const transformed = transform(code, {
const transformed = babel.transform(code, {
presets: ['@babel/preset-typescript'],
plugins: [transformpRPC$],
filename: id,
Expand All @@ -29,8 +29,8 @@ export function transformpRPC$({
types: t,
template: temp,
}: {
types: typeof types
template: typeof template
types: typeof babel.types
template: typeof babel.template
}) {
return {
visitor: {
Expand Down
5 changes: 5 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 9178e1c

@vercel
Copy link

@vercel vercel bot commented on 9178e1c Mar 2, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

prpc-docs – ./

prpc.vercel.app
prpc-docs-git-main-orjdev.vercel.app
prpc-docs-orjdev.vercel.app
prpc-docs.vercel.app

Please sign in to comment.