Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server hash url parser #141

Merged
merged 20 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"buildCommand": "build",
"packages": ["/"],
"sandboxes": ["/examples/example-client", "/examples/example-ssr"],
"node": "18"
}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -20,6 +20,6 @@ jobs:

- name: build
run: npm run build

- name: test
run: npm run test
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 90
"printWidth": 90,
"semi": true,
}
2 changes: 1 addition & 1 deletion examples/example-client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
<script type="module" src="./src/index.tsx"></script>
</body>
</html>
14 changes: 7 additions & 7 deletions examples/example-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"build": "vite build"
},
"dependencies": {
"@cher-ami/router": "latest",
"@cher-ami/router": "^3.1.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"gsap": "^3.12.2"
},
"devDependencies": {
"@types/node": "^20.8.2",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"@types/node": "^20.8.7",
"@types/react": "^18.2.29",
"@types/react-dom": "^18.2.13",
"@vitejs/plugin-react": "^4.1.0",
"gsap": "^3.12.2",
"typescript": "^5.2.2",
"vite": "^4.4.10"
"vite": "^4.5.0"
}
}
13 changes: 11 additions & 2 deletions examples/example-client/src/pages/ArticlePage.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { ForwardedRef, forwardRef, useRef } from "react";
import React, {ForwardedRef, forwardRef, useEffect, useRef} from "react"
import { useLocation } from "@cher-ami/router";
import { useStack } from "@cher-ami/router";
import { useStack } from "@cher-ami/router";
import { transitionsHelper } from "../helper/transitionsHelper";
import debug from "@wbe/debug";

interface IProps {
params?: {
id: string;
};
time: {
datetime: string
};
}

const componentName = "ArticlePage";
Expand All @@ -28,8 +31,14 @@ export const ArticlePage = forwardRef((props: IProps, handleRef: ForwardedRef<an
playOut: () => transitionsHelper(rootRef.current, false, { x: -0 }, { x: 50 }),
});

useEffect(()=>
{
log("props.time",props.time)
},[props.time])
return (
<div className={componentName} ref={rootRef}>
<div>fetch props datetime: {props.time?.datetime}</div>
<br />
{componentName} - id: {props?.params?.id}
<br />
<br />
Expand Down
7 changes: 6 additions & 1 deletion examples/example-client/src/pages/YoloPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { useLocation, useStack } from "@cher-ami/router";
import { transitionsHelper } from "../helper/transitionsHelper";
const componentName: string = "YoloPage";

interface IProps {}
interface IProps {
time: {
datetime: string;
};
}

const YoloPage = forwardRef((props: IProps, handleRef: ForwardedRef<any>) => {
const rootRef = useRef(null);
Expand All @@ -21,6 +25,7 @@ const YoloPage = forwardRef((props: IProps, handleRef: ForwardedRef<any>) => {
return (
<div className={componentName} ref={rootRef}>
{componentName}
<div>fetch props datetime: {props.time?.datetime}</div>

<br />
<br />
Expand Down
10 changes: 10 additions & 0 deletions examples/example-client/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export const routesList: TRoute[] = [
{
path: "/yolo",
component: YoloPage,
getStaticProps: async (props, currentLang) => {
const res = await fetch("https://worldtimeapi.org/api/ip");
const time = await res.json();
return { time };
},
},
{
path: "/hello",
Expand Down Expand Up @@ -61,6 +66,11 @@ export const routesList: TRoute[] = [
props: {
color: "red",
},
getStaticProps: async (props, currentLang) => {
const res = await fetch("https://worldtimeapi.org/api/ip");
const time = await res.json();
return { time };
},
},
{
path: "/:rest",
Expand Down
1 change: 1 addition & 0 deletions examples/example-client/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
30 changes: 16 additions & 14 deletions examples/example-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"compilerOptions": {

"module": "esnext",
"target": "esnext",
"lib": ["es2015.promise", "es6", "dom", "esnext"],
"jsx": "react",
"moduleResolution": "node",
"types": ["node"],
"declaration": true,
"isolatedModules": false,
"noImplicitAny": false,
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"preserveConstEnums": true,
"strictNullChecks": false
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["./**/*"],
"exclude": ["dist"]
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
9 changes: 9 additions & 0 deletions examples/example-client/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
154 changes: 0 additions & 154 deletions examples/example-ssr/config/helpers/mfs.js

This file was deleted.

Loading
Loading