Skip to content

Commit

Permalink
add changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
nksaraf committed Aug 27, 2023
1 parent 6992747 commit 5834c1a
Show file tree
Hide file tree
Showing 76 changed files with 3,319 additions and 1,538 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
11 changes: 11 additions & 0 deletions .changeset/metal-lizards-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@vinxi/plugin-references": patch
"@vinxi/solid-start": patch
"@vinxi/react": patch
"@vinxi/solid": patch
"vinxi": patch
"@vinxi/plugin-mdx": patch
"@vinxi/react-server": patch
---

add changesets support
1 change: 1 addition & 0 deletions examples/react/rsc/fw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vercel
3 changes: 3 additions & 0 deletions examples/react/rsc/fw/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from "@vinxi/react-server";

export default defineConfig();
27 changes: 27 additions & 0 deletions examples/react/rsc/fw/app/Counter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use client";

import { fetchServerAction } from "@vinxi/react-server/client";
import { useState } from "react";

import { sayHello } from "./actions";

document.addEventListener("click", async (e) => {
console.log(sayHello, "hello");

const result = await fetchServerAction("/_server", sayHello["$$id"], []);
console.log(result);
// sayHello();
});
export function Counter({ onChange }) {
const [count, setCount] = useState(0);
return (
<button
onClick={() => {
setCount((c) => c + 1);
onChange();
}}
>
Count: {count}
</button>
);
}
12 changes: 12 additions & 0 deletions examples/react/rsc/fw/app/actions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use server";

let store = { count: 0 };
export function sayHello() {
console.log("Hello World");
store.count++;
return store.count;
}

export function getStore() {
return store.count;
}
23 changes: 23 additions & 0 deletions examples/react/rsc/fw/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Counter } from "./Counter";
import { getStore, sayHello } from "./actions";
import "./style.css";

export default function App({ assets }) {
return (
<html lang="en">
<head>
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<section>
<h1>Hello AgentConf with ya asdo!!!</h1>
<div>Hello World</div>

{getStore()}
<Counter onChange={sayHello} />
</section>
</body>
</html>
);
}
5 changes: 5 additions & 0 deletions examples/react/rsc/fw/app/client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="vinxi/client" />
import { ServerComponent } from "@vinxi/react-server/client";
import { createRoot } from "react-dom/client";

createRoot(document).render(<ServerComponent url={window.location.pathname} />);
7 changes: 7 additions & 0 deletions examples/react/rsc/fw/app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

* {
color: red;
}
13 changes: 13 additions & 0 deletions examples/react/rsc/fw/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="icon" href="/favicon.ico" />
</head>
<body>
<div id="root"></div>
<script src="./app/client.tsx" type="module"></script>
</body>
</html>
24 changes: 24 additions & 0 deletions examples/react/rsc/fw/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "example-react-server",
"type": "module",
"private": true,
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start"
},
"dependencies": {
"@picocss/pico": "^1.5.10",
"@vinxi/react-server": "workspace:^",
"@vinxi/react-server-dom": "^0.0.3",
"autoprefixer": "^10.4.15",
"react": "0.0.0-experimental-035a41c4e-20230704",
"react-dom": "0.0.0-experimental-035a41c4e-20230704",
"tailwindcss": "^3.3.3",
"vinxi": "workspace:^"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7"
}
}
6 changes: 6 additions & 0 deletions examples/react/rsc/fw/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file added examples/react/rsc/fw/public/favicon.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions examples/react/rsc/fw/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/**/*.tsx", "./app/**/*.ts", "./app/**/*.js"],
theme: {
extend: {},
},
plugins: [],
};
15 changes: 15 additions & 0 deletions examples/react/rsc/fw/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"types": ["vinxi/client", "react/experimental"],
"isolatedModules": true
}
}
4 changes: 3 additions & 1 deletion examples/react/rsc/spa/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export default createApp({
build: {
target: "browser",
plugins: () => [
references.clientRouterPlugin(),
references.clientRouterPlugin({
runtime: "@vinxi/react-server-dom/runtime",
}),
reactRefresh(),
references.clientComponents(),
],
Expand Down
2 changes: 1 addition & 1 deletion examples/react/rsc/spa/app/client.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference types="vinxi/client" />
import { createModuleLoader } from "@vinxi/react-server-dom-vite/runtime";
import { createModuleLoader } from "@vinxi/react-server-dom/runtime";
import React, { Suspense, startTransition } from "react";
import { Root, createRoot, hydrateRoot } from "react-dom/client";
import "vinxi/runtime/client";
Expand Down
4 changes: 2 additions & 2 deletions examples/react/rsc/spa/app/fetchServerAction.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
createFromFetch,
encodeReply,
} from "@vinxi/react-server-dom-vite/client";
} from "@vinxi/react-server-dom/client";

export async function fetchServerAction(
base,
Expand All @@ -15,7 +15,7 @@ export async function fetchServerAction(
method: "POST",
headers: {
Accept: "text/x-component",
"rsc-action": id,
"server-action": id,
},
body: await encodeReply(args),
});
Expand Down
6 changes: 3 additions & 3 deletions examples/react/rsc/spa/app/react-server.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderAsset } from "@vinxi/react";
import { renderToPipeableStream } from "@vinxi/react-server-dom-vite/server";
import { renderToPipeableStream } from "@vinxi/react-server-dom/server";
import { Suspense } from "react";
import { eventHandler } from "vinxi/runtime/server";

Expand Down Expand Up @@ -27,9 +27,9 @@ export default eventHandler(async (event) => {
decodeReply,
decodeReplyFromBusboy,
decodeAction,
} = await import("@vinxi/react-server-dom-vite/server");
} = await import("@vinxi/react-server-dom/server");
console.log(event.node.req.headers);
const serverReference = event.node.req.headers["rsc-action"];
const serverReference = event.node.req.headers["server-action"];
if (serverReference) {
// This is the client-side case
const [filepath, name] = serverReference.split("#");
Expand Down
6 changes: 3 additions & 3 deletions examples/react/rsc/spa/app/server-action.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { renderAsset } from "@vinxi/react";
// import { renderToPipeableStream } from "@vinxi/react-server-dom-vite/server";
// import { renderToPipeableStream } from "@vinxi/react-server-dom/server";
// import React, { Suspense } from "react";
import { eventHandler, sendStream } from "vinxi/runtime/server";

Expand Down Expand Up @@ -27,8 +27,8 @@ export default eventHandler(async (event) => {
decodeReply,
decodeReplyFromBusboy,
decodeAction,
} = await import("@vinxi/react-server-dom-vite/server");
const serverReference = event.node.req.headers["rsc-action"];
} = await import("@vinxi/react-server-dom/server");
const serverReference = event.node.req.headers["server-action"];
if (serverReference) {
// This is the client-side case
const [filepath, name] = serverReference.split("#");
Expand Down
2 changes: 1 addition & 1 deletion examples/react/rsc/spa/app/server-component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createFromFetch } from "@vinxi/react-server-dom-vite/client";
import { createFromFetch } from "@vinxi/react-server-dom/client";
import * as React from "react";
import { startTransition, use, useState } from "react";
import ReactDOM from "react-dom/client";
Expand Down
4 changes: 2 additions & 2 deletions examples/react/rsc/spa/app/server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference types="vinxi/server" />
import viteServer from "#vite-dev-server";
import { renderAsset } from "@vinxi/react";
import * as ReactServerDOM from "@vinxi/react-server-dom-vite/client";
import { createModuleLoader } from "@vinxi/react-server-dom-vite/runtime";
import * as ReactServerDOM from "@vinxi/react-server-dom/client";
import { createModuleLoader } from "@vinxi/react-server-dom/runtime";
import React, { Suspense } from "react";
import { renderToPipeableStream } from "react-dom/server";
import { H3Event, eventHandler, fetchWithEvent } from "vinxi/runtime/server";
Expand Down
17 changes: 9 additions & 8 deletions examples/react/rsc/spa/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"type": "module",
"name": "app",
"private": true,
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start"
},
"dependencies": {
"@picocss/pico": "^1.5.7",
"@picocss/pico": "^1.5.10",
"@vinxi/plugin-references": "workspace:^",
"@vinxi/react": "workspace:^",
"@vinxi/react-server-dom-vite": "^0.0.2",
"@vitejs/plugin-react": "^4.0.1",
"@vinxi/react-server-dom": "^0.0.3",
"@vitejs/plugin-react": "^4.0.4",
"acorn-loose": "^8.3.0",
"autoprefixer": "^10.4.14",
"autoprefixer": "^10.4.15",
"react": "0.0.0-experimental-035a41c4e-20230704",
"react-dom": "0.0.0-experimental-035a41c4e-20230704",
"tailwindcss": "^3.3.2",
"tailwindcss": "^3.3.3",
"vinxi": "workspace:^"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6"
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7"
}
}
16 changes: 8 additions & 8 deletions examples/react/rsc/ssr/app.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import serverComponent from "@vinxi/react-server-dom-vite/plugin";
import serverComponent from "@vinxi/react-server-dom/plugin";
import reactRefresh from "@vitejs/plugin-react";
import { readFileSync } from "fs";
import { join } from "path";
Expand Down Expand Up @@ -72,7 +72,7 @@ function serverComponents() {
"react",
"react-dom",
"react/jsx-dev-runtime",
"@vinxi/react-server-dom-vite",
"@vinxi/react-server-dom",
],
},
};
Expand Down Expand Up @@ -133,19 +133,19 @@ function clientComponents() {

return {
ssr: {
external: ["react", "react-dom", "@vinxi/react-server-dom-vite"],
external: ["react", "react-dom", "@vinxi/react-server-dom"],
},
optimizeDeps: {
include: [
"@vinxi/react-server-dom-vite",
"@vinxi/react-server-dom",
"react-server-dom-vite",
"react",
"react-dom",
],
}, // optimizeDeps: {
// include: [
// "@vinxi/react-server-dom-vite/client.browser",
// "@vinxi/react-server-dom-vite/runtime",
// "@vinxi/react-server-dom/client.browser",
// "@vinxi/react-server-dom/runtime",
// "react",
// "react-dom",
// ],
Expand Down Expand Up @@ -182,7 +182,7 @@ function clientComponents() {
return {
optimizeDeps: {
include: [
"@vinxi/react-server-dom-vite",
"@vinxi/react-server-dom",
"react-server-dom-vite",
"react",
"react-dom",
Expand All @@ -192,7 +192,7 @@ function clientComponents() {
external: [
"react",
"react-dom",
"@vinxi/react-server-dom-vite",
"@vinxi/react-server-dom",
"react-server-dom-vite",
],
},
Expand Down
20 changes: 3 additions & 17 deletions examples/react/rsc/ssr/app/client.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
/// <reference types="vinxi/client" />
import { createModuleLoader } from "@vinxi/react-server-dom-vite/runtime";
import React, { Suspense, startTransition } from "react";
import { Root, hydrateRoot } from "react-dom/client";
import "vinxi/runtime/client";

import { ServerComponent } from "./server-component";

globalThis.__vite__ = createModuleLoader({
loadModule: async (id) => {
return import(
/* @vite-ignore */ import.meta.env.MANIFEST["client"].chunks[id].output
.path
);
},
});

import { startTransition } from "react";
import { hydrateRoot } from "react-dom/client";
import { ServerComponent } from "@vinxi/react-rsc/client";
startTransition(() => {
hydrateRoot(document, <ServerComponent url={window.location.pathname} />);
});
Loading

0 comments on commit 5834c1a

Please sign in to comment.