MyGit

v0.7.0

solidjs/solid-start

版本发布时间: 2024-03-09 04:45:40

solidjs/solid-start最新发布版本:v1.0.0-rc.0(2024-03-22 06:38:16)

This is a smaller release that doesn't fundamentally change anything you are already doing in Solid Start but it needed to happen since there were some circular dependency issues and I used this as an opportunity to cleanup some of the config. So this release is very much a precursor to us getting to 1.0 RC candidates. If you have been watching the repo the issue count is down to the lowest it has ever been (even after I went issue bankrupt with Beta 1). We've been slowly getting key enhancements in and fixing bugs. There are a couple things outstanding like the ultimate decision on Base Path and some weird cache issues during HMR but the general behavior is coming together nicely.

Changes

FileRoutes have moved

Honestly I should have done this ages ago but we just keep getting weird circular deps issues due to them. Now they are their own export. This means changing your entry point import to:

import { FileRoutes } from "@solidjs/start/router";

But this should address a lot of the weirdness there.

Support for breaking out of nested routes

Sometimes you don't want to nest routes. Now you can represent paths with "." to avoid matching with parents. For example if you had users listing page under "/users" and you wanted the details to be under "/user/:id" but they don't share a layout or data fetching. Now you can name your files.

users.tsx
users.[id].tsx

And they won't try to nest. These can also each be their own nested routes as well by using "." notation on folders. Thanks to Remix V1 router for the inspiration, and Vinxi for making this implementable in about 30 seconds.

UPDATE: The above API was replaced with a simpler mechanism we already have. You can use (name) to differentiate paths. The text between the paranthesis is not included on the path but it prevents nested matching.

users(list).tsx
users/
  - [id].tsx

getServerFunctionMeta

This is a specific helper but it is useful sometimes to get the underlying information about your running server function. You can do that now by calling this method. So far it only returns an id but it can help give you a stable reference across different environments this way. Thanks @katywings for making this happen.

import { getServerFunctionMeta } from "@solidjs/start/server";
 
// or some in-memory db
const appCache: any = globalThis;
 
const counter = async () => {
  "use server";
  const { id } = getServerFunctionMeta()!;
  const key = `counter_${id}`;
  appCache[key] = appCache[key] ?? 0;
  appCache[key]++;
 
  return appCache[key] as number;
};

Dropped Direct Interop with Solid's Request Event and H3

This is mostly unnecessary with our response wrapper and ALS. And was causing extra complication that was unnecessary. If you want to use Vinxi HTTP helpers or H3 utilities directly just use the .nativeEvent property on our Request Event.

Conclusion

There are another half a dozen smaller changes so see the changelog for more details. But things are getting closer. Thank you everyone who is participating in the beta and reporting issues. We appreciate your patience and look forward to your continued participation.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2024-03-09发行的版本