├── .npmrc
├── examples
├── next
│ ├── .env
│ ├── public
│ │ ├── favicon.ico
│ │ ├── vercel.svg
│ │ └── next.svg
│ ├── tsconfig.client.json
│ ├── .eslintrc.json
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── pages
│ │ └── index.tsx
│ ├── compose.yaml
│ ├── default.vcl
│ ├── tsconfig.server.json
│ ├── README.md
│ ├── tsconfig.json
│ ├── components
│ │ └── MyFragment.tsx
│ ├── package.json
│ └── server.tsx
└── express
│ ├── src
│ ├── entry-client.tsx
│ ├── entry-server.tsx
│ ├── pages
│ │ └── App.tsx
│ ├── components
│ │ └── MyFragment.tsx
│ └── server.tsx
│ ├── esbuild.config.mjs
│ ├── default.vcl
│ ├── README.md
│ ├── tsconfig.json
│ ├── compose.yaml
│ ├── tsconfig.server.json
│ ├── tsconfig.client.json
│ └── package.json
├── .prettierrc.json
├── pnpm-workspace.yaml
├── .github
├── FUNDING.yml
└── workflows
│ └── test.yml
├── .prettierignore
├── lib
├── tsconfig.build.json
├── src
│ ├── __tests__
│ │ ├── client
│ │ │ ├── __snapshots__
│ │ │ │ └── withESI.test.tsx.snap
│ │ │ └── withESI.test.tsx
│ │ └── server
│ │ │ ├── __snapshots__
│ │ │ ├── withESI.test.tsx.snap
│ │ │ └── server.test.tsx.snap
│ │ │ ├── withESI.test.tsx
│ │ │ └── server.test.tsx
│ ├── server.tsx
│ └── withESI.tsx
├── jest.config.ts
├── tsconfig.json
└── package.json
├── .dockerignore
├── .vscode
├── extensions.json
└── settings.json
├── .editorconfig
├── SECURITY.md
├── .gitignore
├── .eslintrc.json
├── package.json
├── LICENSE
├── Dockerfile
└── README.md
/.npmrc:
--------------------------------------------------------------------------------
1 | link-workspace-packages=false
--------------------------------------------------------------------------------
/examples/next/.env:
--------------------------------------------------------------------------------
1 | REACT_ESI_SECRET=secret
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "es5"
3 | }
4 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - "lib"
3 | - "examples/*"
4 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: dunglas
2 | tidelift: "npm/react-esi"
3 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | **/.git
2 | **/.svn
3 | **/.hg
4 | **/node_modules
5 | **/.next
6 | **/dist
7 | /lib/lib
8 |
--------------------------------------------------------------------------------
/lib/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "exclude": ["**/__tests__"]
4 | }
5 |
--------------------------------------------------------------------------------
/examples/next/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dunglas/react-esi/HEAD/examples/next/public/favicon.ico
--------------------------------------------------------------------------------
/examples/next/tsconfig.client.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["./components/*.tsx"]
4 | }
5 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | Dockerfile
3 | compose.yaml
4 | .git
5 | .gitignore
6 | *.md
7 | dist
8 | .github
9 | .vscode
10 | .next
11 | lib/lib
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "dbaeumer.vscode-eslint",
4 | "esbenp.prettier-vscode",
5 | "orta.vscode-jest"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/examples/express/src/entry-client.tsx:
--------------------------------------------------------------------------------
1 | import { hydrateRoot } from "react-dom/client";
2 | import App from "./pages/App";
3 |
4 | hydrateRoot(document.getElementById("root")!,
{this.props.greeting /* access to the props as usual */}
23 |{this.props.dataFromAnAPI}
24 |{this.props.greeting /* access to the props as usual */}
24 |{this.props.dataFromAnAPI}
25 |( 55 | WrappedComponent: ComponentType
,
56 | fragmentID: string
57 | ): ComponentClass {
59 | public static WrappedComponent = WrappedComponent;
60 | public static displayName = `WithESI(${
61 | WrappedComponent.displayName || WrappedComponent.name || "Component"
62 | })`;
63 | public static propTypes = {
64 | esi: PropTypes.shape({
65 | attrs: PropTypes.objectOf(PropTypes.string), // extra attributes to add to the