Skip to content

Commit b147407

Browse files
committed
Merge remote-tracking branch 'refs/remotes/oss/apps-only' into kdy1/merge-oss
2 parents 3dd72c0 + b18f1f7 commit b147407

File tree

114 files changed

+7493
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+7493
-0
lines changed

swc-plugins/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.d.ts
2+
/lib/generated
3+
/components/ui

swc-plugins/.eslintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "next/core-web-vitals",
3+
"rules": {
4+
"@typescript-eslint/no-unused-vars": "off",
5+
"@next/next/no-server-import-in-page": "off",
6+
"@typescript-eslint/ban-types": "off"
7+
}
8+
}

swc-plugins/.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
# scripts
39+
.cache/

swc-plugins/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

swc-plugins/app/(home)/page.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Logo } from "@/components/logo";
2+
import { RuntimeVersionSelector } from "@/components/runtime-version-selector";
3+
import { Button } from "@/components/ui/button";
4+
import { Metadata } from "next";
5+
import Link from "next/link";
6+
import { FC } from "react";
7+
8+
export const metadata: Metadata = {
9+
title: "SWC Plugins",
10+
description: "A collection of SWC plugins, ready to use in your project.",
11+
};
12+
13+
const Home: FC = () => (
14+
<main className="flex h-screen w-full flex-col items-center justify-center align-middle">
15+
<div className="flex flex-col items-center gap-8">
16+
<Logo />
17+
<div className="flex flex-col gap-2">
18+
<h1 className="max-w-[330px] text-center text-3xl font-bold leading-tight tracking-tighter md:min-w-[540px] md:text-4xl lg:leading-[1.1]">
19+
SWC Plugins
20+
</h1>
21+
<p className="text-muted-foreground max-w-[750px] text-center text-lg">
22+
A collection of SWC plugins, ready to use in your project.
23+
</p>
24+
</div>
25+
<RuntimeVersionSelector />
26+
<Button variant="link" asChild>
27+
<Link href="/versions/range">or see all versions</Link>
28+
</Button>
29+
</div>
30+
</main>
31+
);
32+
33+
export default Home;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"use client";
2+
3+
import { apiClient } from "@/lib/trpc/web-client";
4+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5+
import { httpBatchLink } from "@trpc/client";
6+
import { PropsWithChildren, useState } from "react";
7+
import superjson from "superjson";
8+
9+
export function ApiClientProvider({ children }: PropsWithChildren<{}>) {
10+
const [queryClient] = useState(
11+
() =>
12+
new QueryClient({
13+
defaultOptions: {
14+
queries: {
15+
queryKeyHashFn: (queryKey) =>
16+
superjson.stringify(queryKey),
17+
},
18+
},
19+
})
20+
);
21+
const [trpcClient] = useState(() =>
22+
apiClient.createClient({
23+
links: [
24+
httpBatchLink({
25+
url: "/api/trpc",
26+
transformer: superjson,
27+
}),
28+
],
29+
})
30+
);
31+
return (
32+
<apiClient.Provider client={trpcClient} queryClient={queryClient}>
33+
<QueryClientProvider client={queryClient}>
34+
{children}
35+
</QueryClientProvider>
36+
</apiClient.Provider>
37+
);
38+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { handlers } from "@/lib/auth";
2+
export const { GET, POST } = handlers;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { handler } from "@/lib/api/server";
2+
3+
export { handler as GET, handler as POST };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { UpdateRuntimesInputSchema } from "@/lib/api/updater/router";
2+
import { createCaller } from "@/lib/server";
3+
import { NextRequest, NextResponse } from "next/server";
4+
5+
export const POST = async (req: NextRequest) => {
6+
const body = UpdateRuntimesInputSchema.parse(await req.json());
7+
8+
const api = await createCaller();
9+
10+
await api.updater.updateRuntimes(body);
11+
12+
return NextResponse.json({ ok: true });
13+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { UpdateWasmPluginsInputSchema } from "@/lib/api/updater/router";
2+
import { createCaller } from "@/lib/server";
3+
import { NextRequest, NextResponse } from "next/server";
4+
5+
export const POST = async (req: NextRequest) => {
6+
const body = UpdateWasmPluginsInputSchema.parse(await req.json());
7+
8+
const api = await createCaller();
9+
10+
await api.updater.updateWasmPlugins(body);
11+
12+
return NextResponse.json({ ok: true });
13+
};

swc-plugins/app/client-providers.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use client";
2+
3+
import { ThemeProvider } from "next-themes";
4+
import { PropsWithChildren } from "react";
5+
import { ApiClientProvider } from "./api-client-provider";
6+
7+
export function ClientProviders({ children }: PropsWithChildren) {
8+
return (
9+
<ThemeProvider attribute="class">
10+
<ApiClientProvider>{children}</ApiClientProvider>
11+
</ThemeProvider>
12+
);
13+
}

swc-plugins/app/favicon.ico

25.3 KB
Binary file not shown.

swc-plugins/app/globals.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
@layer base {
6+
:root {
7+
--background: 0 0% 100%;
8+
--foreground: 222.2 84% 4.9%;
9+
--card: 0 0% 100%;
10+
--card-foreground: 222.2 84% 4.9%;
11+
--popover: 0 0% 100%;
12+
--popover-foreground: 222.2 84% 4.9%;
13+
--primary: 222.2 47.4% 11.2%;
14+
--primary-foreground: 210 40% 98%;
15+
--secondary: 210 40% 96.1%;
16+
--secondary-foreground: 222.2 47.4% 11.2%;
17+
--muted: 210 40% 96.1%;
18+
--muted-foreground: 215.4 16.3% 46.9%;
19+
--accent: 210 40% 96.1%;
20+
--accent-foreground: 222.2 47.4% 11.2%;
21+
--destructive: 0 84.2% 60.2%;
22+
--destructive-foreground: 210 40% 98%;
23+
--border: 214.3 31.8% 91.4%;
24+
--input: 214.3 31.8% 91.4%;
25+
--ring: 222.2 84% 4.9%;
26+
--radius: 0.5rem;
27+
--chart-1: 12 76% 61%;
28+
--chart-2: 173 58% 39%;
29+
--chart-3: 197 37% 24%;
30+
--chart-4: 43 74% 66%;
31+
--chart-5: 27 87% 67%;
32+
}
33+
34+
.dark {
35+
--background: 222.2 84% 4.9%;
36+
--foreground: 210 40% 98%;
37+
--card: 222.2 84% 4.9%;
38+
--card-foreground: 210 40% 98%;
39+
--popover: 222.2 84% 4.9%;
40+
--popover-foreground: 210 40% 98%;
41+
--primary: 210 40% 98%;
42+
--primary-foreground: 222.2 47.4% 11.2%;
43+
--secondary: 217.2 32.6% 17.5%;
44+
--secondary-foreground: 210 40% 98%;
45+
--muted: 217.2 32.6% 17.5%;
46+
--muted-foreground: 215 20.2% 65.1%;
47+
--accent: 217.2 32.6% 17.5%;
48+
--accent-foreground: 210 40% 98%;
49+
--destructive: 0 62.8% 30.6%;
50+
--destructive-foreground: 210 40% 98%;
51+
--border: 217.2 32.6% 17.5%;
52+
--input: 217.2 32.6% 17.5%;
53+
--ring: 212.7 26.8% 83.9%;
54+
--chart-1: 220 70% 50%;
55+
--chart-2: 160 60% 45%;
56+
--chart-3: 30 80% 55%;
57+
--chart-4: 280 65% 60%;
58+
--chart-5: 340 75% 55%;
59+
}
60+
}
61+
62+
@layer base {
63+
* {
64+
@apply border-border;
65+
}
66+
body {
67+
@apply bg-background text-foreground;
68+
}
69+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { db } from "@/lib/prisma";
2+
import fs from "node:fs/promises";
3+
4+
export default async function Page() {
5+
if (process.env.NODE_ENV === "production") {
6+
return <div>Not allowed</div>;
7+
}
8+
9+
const ranges: { min: string; max: string }[] = JSON.parse(
10+
await fs.readFile("./data/ranges.json", "utf8")
11+
);
12+
13+
for (const { min, max } of ranges) {
14+
await db.compatRange.upsert({
15+
where: {
16+
from_to: {
17+
from: min,
18+
to: max,
19+
},
20+
},
21+
update: {},
22+
create: {
23+
from: min,
24+
to: max,
25+
},
26+
});
27+
}
28+
29+
const runtimes = ["@swc/core", "next", "rspack", "farm"];
30+
31+
for (const runtime of runtimes) {
32+
await db.swcRuntime.upsert({
33+
where: {
34+
name: runtime,
35+
},
36+
update: {},
37+
create: {
38+
name: runtime,
39+
},
40+
});
41+
}
42+
43+
return <div>Done</div>;
44+
}
45+
46+
export const dynamic = "force-dynamic";

0 commit comments

Comments
 (0)