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

Farm Roadmap v2.0 🎉 #1589

Open
ErKeLost opened this issue Jul 11, 2024 · 7 comments · May be fixed by #1835
Open

Farm Roadmap v2.0 🎉 #1589

ErKeLost opened this issue Jul 11, 2024 · 7 comments · May be fixed by #1835
Assignees
Labels
enhancement New feature or request feature New feature request pr welcome Welcome contributions for newcomers refactor refactor some feature v2.0 v2.0 version

Comments

@ErKeLost
Copy link
Member

ErKeLost commented Jul 11, 2024

This refactoring will ensure that a large number of api and property break changes will not be designed

  1. Optimize existing @farmfe/core config logic design

  2. Add debug debugging to the node layer

  3. Replace koa with connect

  4. Try to adapt some hmr, jsPlugin Hook, etc. to farm native servers, rather than putting pressure on farm's vite compatibility layer, which will cause excessive pressure on subsequent maintenance

  5. The middleware design needs to be re-considered to adapt to the existing koa middleware and user-written middleware or the reimplementation of other native middleware that needs to be replaced.

Currently, we are still thinking about design and finally achieve the goal of farm development rust ecosystem, and js ecosystem reuses vite ecosystem.

Now considering the initial stage, we are still in the process of design thinking, and may mainly consider it in the mojor version

Reasons for refactoring this node layer

Only by making the underlying infrastructure good enough can it better serve the stability of the upper framework.

This major and important update is mainly to accompany the sustainable development of the vite ecosystem, so that farm can follow the footsteps of vite's js ecosystem for a long time to come.

Progress till MVP

New Docs

Refctor functions

Node Side

vite adapter

Refactoring all vite proxy logic mainly targets errors caused by invalid configurations such as esbuild ,rollup options
Elegant optimized performance
Compatible with more vite plugins

@farmfe/cli

  • refactor cli (Without affecting the operation of coredao, all functions of this package have been reconstructed.)
    • Optimize cli logic to make cli logic clearer and more readable
    • refactor start command
    • refactor build command
    • refactor watch command
    • refactor preview command
    • optimize clean command
    • All api method attribute configuration types are rewritten
    • remove watch command save dev and build

@farmfe/core

Config

  • Determine whether to turn on the server based on the current environment ----------pending-----------
  • Correlate all error return messages
  • hide vite plugin adapter warning flag option
  • provide cli shortcuts
  • add server.watch options remove hmr.watch
  • add cacheDir options
  • clearScreen logic
  • rewrite all types
  • refactor logger
    • Optimize the usage logic of logger and the logic passed to different methods
  • add debug Set debug mode
  • All api method attribute configuration types are rewritten
  • Write js doc with methods
  • Add performance analysis function (speedscope analysis cpu profiler)
  • resolveConfig fn remove server options
  • Access all cli storage method functions
    • start methods
    • build methods
    • preview methods
    • clean methods
  • optimize resolveUserConfig logic
    • Optimize function method logic code logic
    • Optimize readConfigFile logic We should determine whether to load this method based on whether to pass configFile instead of rootPath
    • [Refactor Node]: redefine publicPath logic #1776
    • rewrite zod schema with farm config
    • Go through all api methods and logic, and the ultimate goal is to use the api to successfully run all cli projects API methods

Server

  • [Feature Request]: in viteplugin and farmplugin PostHooks after server return with configureServer hook #1786
  • optimize configureCompiler and configureServer hooks, and sortPlugin utils pluginHookUtils
  • add appType ['spa' | 'mpa' | 'custom']
  • Extract the logic of the server (At present, all config logic is in the resolveConfig method. We should abstract away the server-related methods. However, because we have runtime transfer properties, we still need to consider whether this method is feasible.)
  • normalize server options
  • All api method attribute configuration types are rewritten
  • write js doc with methods
  • use connect instead of koa
  • rewrite middleware
    • publilcPathMiddleware
    • resourceMiddleware
    • publicMiddleware
    • proxyMiddleware
    • corsMiddleware
    • lazyCompilationMiddleware
    • staticMiddleware
    • htmlFallbackMiddleware
    • optimize all middwares (logic and types)
  • refactor resolve compiler logic
  • refactor watcher logic
  • refactor hmr logic
  • optimize handle error

jsplugin

vite

  • refactor vite adaptor

Currently testing all supported vite and unplugin plugins in the new version

vite plugins

unplugin plugins

other

unit Test

  • add more unit test test
    • complete unit tests covering all api
    • complete unit test js plugin api

The entire node layer will be explained in more detail later, and everyone is welcome to participate and learn together. All code is in v2-dev branch,If you are interested, you can discuss the claim below

Rust Side

Persistent Cache Refactor

  • Cache of static assets and css modules should be stored with module, instead of using plugin cache
  • Reduce the number of files that write to disk
  • Optimize Cache invalidate logic, support only invalidating the package that are updated, instead of disable all cache when lockfile is changed

Plugin Hooks

  • Add a plugin that can process all the modules after the module graph is built
  • Support Rollup style moduleParsed hook
  • Analyze deps support new Worker(new URL(xxx))
  • Support handling resolve call cycle, currently caller is a string and it can not trace the caller chain

HMR Optimize

  • Support add and remove event when HMR

Resolver

Module Federation

Refactor

Css Implementation Refactor

Grocery

  • Upgrade SWC to optimize performance
  • Support swc_plugin_proxy to enable accessing global swc marks
  • Make migration from existing frameworks easier

Rust Plugins - All in Rust

  • @farmfe/plugin-worker
  • @farmfe/plugin-wasm
  • @farmfe/plugin-mdx
  • @farmfe/plugin-vue
  • @farmfe/plugin-vue-jsx
  • @farmfe/plugin-sass (using grass)
  • @farmfe/plugin-svg-icons

Feature request

@ErKeLost ErKeLost added the enhancement: pending triage Untriaged enhancement label Jul 11, 2024
@ErKeLost ErKeLost self-assigned this Jul 11, 2024
@ErKeLost ErKeLost added enhancement New feature or request feature New feature request refactor refactor some feature and removed enhancement: pending triage Untriaged enhancement labels Jul 11, 2024
@ErKeLost ErKeLost pinned this issue Jul 11, 2024
@ErKeLost ErKeLost changed the title [Feature Request]: Refactor node layer Refactor node layer Jul 12, 2024
@ErKeLost ErKeLost changed the title Refactor node layer 📦 Refactor node layer Jul 12, 2024
@ErKeLost ErKeLost added the pr welcome Welcome contributions for newcomers label Jul 12, 2024
@ErKeLost
Copy link
Member Author

ErKeLost commented Jul 15, 2024

this issues will be resolved

#1403

#1455

#1711

@callqh
Copy link
Member

callqh commented Jul 18, 2024

It seems that the processing of the config in the core was a bit complicated before, and config was modified in almost many places. It feels like it can be unified and processed in one place.

@ErKeLost ErKeLost changed the title 📦 Refactor node layer 📦 Refactor node layer RoadMap Jul 23, 2024
@ErKeLost ErKeLost changed the title 📦 Refactor node layer RoadMap node layer RoadMap Jul 27, 2024
@ErKeLost ErKeLost changed the title node layer RoadMap Node Layer RoadMap Jul 29, 2024
@ErKeLost ErKeLost changed the title Node Layer RoadMap [Refactor] Node Layer RoadMap Jul 31, 2024
@ErKeLost ErKeLost changed the title [Refactor] Node Layer RoadMap [Refactor]: Node Layer RoadMap Jul 31, 2024
@ErKeLost
Copy link
Member Author

ErKeLost commented Sep 15, 2024

Final implementation version and roadmap (new Docs)

  1. A new preview version of farm is expected to begin deploying in early October using https://github.com/stackblitz-labs/pkg.pr.new

  2. Better vite support includes plugins and custom plugins

  3. Better development experience and ui ux

  4. More stable server-side functional integrity

  5. More interesting new farm features, more customization options

  6. A new bundle model is coming soon

@ErKeLost
Copy link
Member Author

ErKeLost commented Sep 18, 2024

change previews (WIP)

  1. new overlay page

with farm

image image

with vite(WIP)

image

@fu050409
Copy link
Member

Great and elegant design!

@ErKeLost ErKeLost added the v2.0 v2.0 version label Sep 26, 2024
@ErKeLost ErKeLost changed the title [Refactor]: Node Layer RoadMap [Refactor]: v2.0 Sep 26, 2024
@ErKeLost ErKeLost changed the title [Refactor]: v2.0 v2.0 Sep 26, 2024
@ErKeLost ErKeLost changed the title v2.0 Farm v2.0 Sep 26, 2024
@ErKeLost ErKeLost changed the title Farm v2.0 Farm Roadmap v2.0 🎉 Sep 27, 2024
@remloyal
Copy link

HMR wants batch updates

@wre232114
Copy link
Member

it's already supported

@fu050409 fu050409 linked a pull request Nov 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New feature request pr welcome Welcome contributions for newcomers refactor refactor some feature v2.0 v2.0 version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants