sveltejs / kit

web development, streamlined
https://svelte.dev/docs/kit
MIT License
18.71k stars 1.94k forks source link

Add option to consider `lib/**/server/**` as server files #12732

Open rChaoz opened 1 month ago

rChaoz commented 1 month ago

Describe the problem

Sometimes client-side and server-side code is tightly coupled, and it make senses to keep it together, but I don't want a bunch of abc.server.ts files. Instead, I'd like to group all serverside files into a directory.

Describe the proposed solution

Add an option to consider consider lib/**/server/** files as server-side, instead of lib/server/**. This would allow for folder structures like:

lib/
  services/
    email/
      model.ts
      client.ts
      server/
        client.ts
        api.ts
        config.ts
    content/
      urls.ts
      model.ts
      upload_request.ts
      server/
        upload.ts
        manage.ts

Alternatives considered

Just name all serverside files with .server in their name.

Importance

would make my life easier

Kapsonfire-DE commented 1 month ago

https://github.com/sveltejs/kit/issues/12477

https://github.com/sveltejs/kit/issues/12529