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

chore: refactor server #1658

Merged
merged 66 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
fa0dfcd
chore: optimize code
ErKeLost Jul 23, 2024
95a5fba
chore: update http server
ErKeLost Jul 23, 2024
5be9275
chore: update code
ErKeLost Jul 23, 2024
48884f4
Merge branch 'refactor/node' into refactor/server
ErKeLost Jul 24, 2024
5683a29
chore: update http test
ErKeLost Jul 24, 2024
2debfec
Merge branch 'refactor/node' into refactor/server
ErKeLost Jul 26, 2024
71cf8fa
chore: finish generateResourceMiddleware
ErKeLost Jul 26, 2024
aa7cc38
chore: progress with htmlFallback middleware
ErKeLost Jul 27, 2024
3c6b54d
chore: prepare publicMiddleware
ErKeLost Jul 27, 2024
7fc0c1e
chore: set send req res
ErKeLost Jul 28, 2024
f748067
chore: set send req res
ErKeLost Jul 28, 2024
1a810dd
chore: set send req res
ErKeLost Jul 28, 2024
da45909
chore: prepare websocket and hmr system
ErKeLost Jul 28, 2024
9fd2692
Merge branch 'refactor/node' into refactor/server
ErKeLost Jul 28, 2024
3d2d616
Merge branch 'refactor/node' into refactor/server
ErKeLost Jul 29, 2024
01762d2
chore: test binary performance
ErKeLost Jul 29, 2024
3ffa686
chore: update code
ErKeLost Jul 30, 2024
69391da
feat: add the pulicMiddleware (#1673)
Nirvana-Jie Jul 30, 2024
2c5d802
chore: test public middleware
ErKeLost Jul 31, 2024
7e81dfa
chore: update hmr
ErKeLost Jul 31, 2024
7165d69
chore: update code
ErKeLost Aug 1, 2024
b6dd495
Merge branch 'refactor/node' into refactor/server
ErKeLost Aug 1, 2024
758f12f
chore: add handlePing middleware
ErKeLost Aug 1, 2024
9a27062
Merge branch 'refactor/server' of https://github.com/farm-fe/farm int…
ErKeLost Aug 1, 2024
a42bc42
fix: initial methods params modify
ErKeLost Aug 6, 2024
1e0a8c3
Merge remote-tracking branch 'upstream/refactor/node' into refactor/s…
ErKeLost Aug 6, 2024
aa6e126
chore: update ws error
ErKeLost Aug 6, 2024
6973fc9
fix: optimize the judgment conditions for warning
Aug 6, 2024
f9c1a63
chore: perf server code (#1697)
ErKeLost Aug 7, 2024
ba15ef9
fix: vite hmr reload page (#1701)
ErKeLost Aug 8, 2024
fe05078
Merge branch 'refactor/node' into refactor/server
ErKeLost Aug 9, 2024
5217d40
chore: update format timer config and show cache text logic
ErKeLost Aug 9, 2024
c31bc2a
chore: adaptor vite vue plugin middleware
ErKeLost Aug 9, 2024
9fe5d78
chore: update methods
ErKeLost Aug 9, 2024
9858541
chore: update methods
ErKeLost Aug 9, 2024
c24ac3c
fix: vite hmr error
ErKeLost Aug 9, 2024
d1ccbee
chore: add code spell and remove biome lips
ErKeLost Aug 9, 2024
78be76d
chore: update code
ErKeLost Aug 12, 2024
3dcf65d
chore: add proxy and cors middlewares
ErKeLost Aug 12, 2024
4b55853
chore: add test
ErKeLost Aug 12, 2024
9cb32c4
chore: finish lazy compilation middleware
ErKeLost Aug 12, 2024
4189526
chore: public middleware
ErKeLost Aug 12, 2024
4d97490
chore: pref export ways
ErKeLost Aug 12, 2024
005fb76
chore: add publicPath redirect middleware
ErKeLost Aug 12, 2024
bcd6b71
feat: add publicResource middleware and resource middleware
ErKeLost Aug 13, 2024
1c30d7c
chore: remove unless code
ErKeLost Aug 13, 2024
e8ce078
chore: remove unless code
ErKeLost Aug 13, 2024
2fe709c
fix: sirv middleware load public dir assets
ErKeLost Aug 13, 2024
c37fbad
fix: publicPath resolve hmr error ws connect error
ErKeLost Aug 13, 2024
b53d2cd
fix: public path cause redirect path error
ErKeLost Aug 13, 2024
b9b2986
chore: finish base middleware
ErKeLost Aug 14, 2024
e60c3e9
chore: remove unless code
ErKeLost Aug 14, 2024
d328c66
Merge branch 'refactor/node' into refactor/server
ErKeLost Aug 14, 2024
2141f8a
chore: update 404 middleware, publicPath middleware
ErKeLost Aug 14, 2024
9acd2e3
chore: test svelte publicPath
ErKeLost Aug 15, 2024
12c1651
fix: if exist publicDir and public middleware logic
ErKeLost Aug 15, 2024
da04dd3
refactor: delay the creation of the entire compiler to resolve port c…
ErKeLost Aug 15, 2024
b6ba9f6
feat: add base httpServer class
ErKeLost Aug 15, 2024
61c9bce
chore: resolveUrl finished
ErKeLost Aug 15, 2024
af14aa7
Merge branch 'refactor/node' into refactor/server
ErKeLost Aug 16, 2024
7333b37
fix: bootstrap error
ErKeLost Aug 16, 2024
6d248b2
chore: add open browser
ErKeLost Aug 16, 2024
d334062
chore: update newServer logic
ErKeLost Aug 19, 2024
897846d
chore: update ws logic
ErKeLost Aug 19, 2024
4b6525c
chore: add todo
ErKeLost Aug 19, 2024
f7c16e5
Merge branch 'refactor/node' into refactor/server
ErKeLost Aug 20, 2024
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"hashbrown",
"hasher",
"Hensel",
"HMRPing",
"icns",
"idents",
"IHDR",
Expand Down
5 changes: 3 additions & 2 deletions examples/public-dir/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React, { useState } from "react";
import "./main.css";
import reactLogo from "./assets/react.svg";
// import FarmLogo from "../public/logo.png";
import FarmLogo from "/new-logo.png";
// import FarmLogo from "../newPublic/new-logo.png";
export function Main() {
const [count, setCount] = useState(0);

return (
<>
<div>
<a href="https://farmfe.org/" target="_blank">
{/* <img src={FarmLogo} className="logo" alt="Farm logo" /> */}
<img src={FarmLogo} className="logo" alt="Farm logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
Expand Down
4 changes: 4 additions & 0 deletions examples/react/farm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export default defineConfig(() => {
compilation: {
sourcemap: true,
// persistentCache: false,
persistentCache: {
// cacheDir: "node_modules/.farm/adny",
cacheDir: "node_modules/adny/cache",
},
presetEnv: false,
progress: false
// output: {
Expand Down
1 change: 1 addition & 0 deletions examples/react/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/react/src/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions examples/refactor-react/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
im about page
</body>
</html>
8 changes: 5 additions & 3 deletions examples/refactor-react/farm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { defineConfig } from "@farmfe/core";
import react from "@farmfe/plugin-react";
export default defineConfig({
plugins: [react()],
server: {
// port: 3005,
},
compilation: {
output: {
publicPath: '/aaa/',
}
}
});
5 changes: 3 additions & 2 deletions examples/refactor-react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<!-- <link rel="icon" type="image/svg+xml" href="/favicon.ico" /> -->
<link rel="icon" type="image/svg+xml" href='/react.svg' />
<title>Farm + React + TS</title>
</head>
<body>
<div id="root"></div>
<script src="./src/index.tsx"></script>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions examples/refactor-react/public/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/refactor-react/src/assets/base/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/refactor-react/src/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
filter: drop-shadow(0 0 2em #9F1A8Faa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
filter: drop-shadow(0 0 2em #9761fbaa);
}

@keyframes logo-spin {
Expand Down
8 changes: 4 additions & 4 deletions examples/refactor-react/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React, { useState } from "react";
import { useState } from "react";
import "./main.css";
import reactLogo from "./assets/react.svg";
import reactLogo from "/react.svg";
import FarmLogo from "./assets/logo.png";
export function Main() {
const [count, setCount] = useState(0);

return (
<>
<div>
<a href="https://farmfe.org/" target="_blank">
{/* <a href="https://farmfe.org/" target="_blank">
<img src={FarmLogo} className="logo" alt="Farm logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</a> */}
</div>
<h1>Farm + React</h1>
<div className="card">
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-adapter-react/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import FarmLogo from '../assets/logo.png';
import reactLogo from '../assets/react.svg';
import './main.css';

export default function () {
export default function () {
const [count, setCount] = useState(0);
const go = useNavigate();

Expand Down
14 changes: 6 additions & 8 deletions examples/vite-adapter-svelte/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<script lang="ts">
import svelteLogo from './assets/svelte.svg'
import farmLogo from '/logo.png'
import Counter from './lib/Counter.svelte'
import svelteLogo from "./assets/svelte.svg";
import farmLogo from "/logo.png";
import Counter from "./lib/Counter.svelte";
</script>

<main>
<div>
<dbiv>
<a href="https://farmfe.org" target="_blank" rel="noreferrer">
<img src={farmLogo} class="logo" alt="Farm Logo" />
</a>
<a href="https://svelte.dev" target="_blank" rel="noreferrer">
<img src={svelteLogo} class="logo svelte" alt="Svelte Logo" />
</a>
</div>
</dbiv>
<h1>Farm + Svelte</h1>

<div class="card">
Expand All @@ -23,9 +23,7 @@
Powered by <a href="https://farmfe.org">Farm</a> and svelet vite plugin
</p>

<p class="read-the-docs">
Click on the Farm and Svelte logos to learn more
</p>
<p class="read-the-docs">Click on the Farm and Svelte logos to learn more</p>
</main>

<style>
Expand Down
5 changes: 3 additions & 2 deletions examples/vite-adapter-vue/farm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export default defineConfig({
// persistentCache: false
output:{
path: "build",
publicPath: "/vue-public-path/",
// publicPath: "/vue-public-path/",
},
persistentCache: false,
// persistentCache: false,
// lazyCompilation: false,
sourcemap: false,
},
plugins: [
Expand Down
2 changes: 0 additions & 2 deletions examples/vite-adapter-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"vue-router": "^4.2.1"
},
"devDependencies": {
"@farmfe/cli": "workspace:*",
"@farmfe/core": "workspace:*",
"@farmfe/js-plugin-less": "workspace:^",
"@farmfe/js-plugin-postcss": "workspace:^",
"@farmfe/js-plugin-sass": "workspace:^",
Expand Down
14 changes: 7 additions & 7 deletions examples/vite-adapter-vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<template>
<div>
<img src="/logo.png" alt="">
<img src="/logo.png" alt="" />
<test />
<test1 />
<aboute />
<home/>
<home />
</div>
<router-view />
</template>

<script lang="ts" setup>
import test1 from './components/test1.vue';
import test from './components/test.vue';
import home from './pages/index.vue';
import aboute from '../deps/node_modules/my-ui/index.vue'
import test1 from "./components/test1.vue";
import test from "./components/test.vue";
import home from "./pages/index.vue";
import aboute from "../deps/node_modules/my-ui/index.vue";

import './test';
import "./test";
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-adapter-vue/src/components/Formatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ const format = async () => {

<style lang="scss" scoped>
/* build error */
</style>
</style>
6 changes: 3 additions & 3 deletions examples/vue-antdv/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<RouterLink to="/test">To Test</RouterLink>
</a-menu-item>
<a-menu-item key="2">
<RouterLink to="/">To Main</RouterLink>
<RouterLink to="/">To </RouterLink>
</a-menu-item>
<a-menu-item key="3">
<RouterLink to="/test1/test2">To Nest Test3</RouterLink>
<RouterLink to="/test1/test2">To Nest Test3222222</RouterLink>
</a-menu-item>
</a-menu>
</a-layout-header>
Expand Down Expand Up @@ -122,4 +122,4 @@ export default defineComponent({
.site-layout-background {
background: #fff;
}
</style>
</style>
37 changes: 37 additions & 0 deletions examples/vue3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Farm + Vue

This template should help you start developing using Vue and TypeScript in Farm.

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm start
```

Build the app for production:

```bash
pnpm build
```

Preview the Production build product:

```bash
pnpm preview
```

Clear persistent cache local files

```bash
pnpm clean
```
Loading
Loading