-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swc-plugin): Add version data of
swc_core
and `swc_plugin_runn…
…er` (#53)
- Loading branch information
Showing
9 changed files
with
332 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# scripts | ||
.cache/ |
12 changes: 0 additions & 12 deletions
12
apps/swc-plugins/app/api/versions/from-plugin-runner/[version]/page.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { createCaller } from "@/lib/server"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { z } from "zod"; | ||
|
||
const CoreVersionSchema = z.object({ | ||
version: z.string(), | ||
pluginRunnerReq: z.string(), | ||
}); | ||
|
||
const BodySchema = z.object({ | ||
coreVersions: z.array(CoreVersionSchema), | ||
pluginRunnerVersions: z.array(z.string()), | ||
}); | ||
|
||
export async function POST(req: NextRequest) { | ||
const api = await createCaller(); | ||
const { coreVersions, pluginRunnerVersions } = BodySchema.parse( | ||
await req.json() | ||
); | ||
|
||
await api.compatRange.addCacheForCrates({ | ||
coreVersions, | ||
pluginRunnerVersions, | ||
}); | ||
|
||
return NextResponse.json({ | ||
ok: true, | ||
}); | ||
} |
19 changes: 19 additions & 0 deletions
19
apps/swc-plugins/app/versions/from-plugin-runner/[version]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createCaller } from "@/lib/server"; | ||
import { redirect } from "next/navigation"; | ||
|
||
export default async function Page({ | ||
params: { version }, | ||
}: { | ||
params: { version: string }; | ||
}) { | ||
const api = await createCaller(); | ||
const compatRange = await api.compatRange.byPluginRunnerVersion({ | ||
version, | ||
}); | ||
|
||
if (compatRange) { | ||
return redirect(`/compat/range/${compatRange.id}`); | ||
} | ||
|
||
return <div>No compat range found for swc_plugin_runner@{version}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.