Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+27
@@ -13,6 +13,9 @@ const routePathCases: Array<{
|
||||
}> = [
|
||||
{ routeId: "index", expected: undefined, note: "root index" },
|
||||
{ routeId: "admin/index", expected: "admin", note: "nested index" },
|
||||
{ routeId: "_index", expected: undefined, note: "v2 flat root index" },
|
||||
{ routeId: "app.$tenant/files._index", expected: "app/:tenant/files", note: "v2 flat module index strips trailing _index" },
|
||||
{ routeId: "app.$tenant/files.$id", expected: "app/:tenant/files/:id", note: "v2 flat nested param sibling" },
|
||||
{ routeId: "__auth/login", expected: "login", note: "pathless layout segment" },
|
||||
{ routeId: "account/(settings)", expected: "account/settings?", note: "optional segment" },
|
||||
{ routeId: "docs/[sitemap.xml]", expected: "docs/sitemap.xml", note: "escaped dot segment" },
|
||||
@@ -151,6 +154,30 @@ describe("v1 route convention path creation", () => {
|
||||
expect(Object.values(promotedTenantRoutes).every((entry) => typeof entry.file === "string")).toBe(true);
|
||||
});
|
||||
|
||||
it("registers v2 flat _index module routes at the parent path, not /_index", () => {
|
||||
tempAppDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "v1-route-convention-"));
|
||||
|
||||
writeRouteFixture("routes/_index.tsx");
|
||||
writeRouteFixture("routes/app.$tenant.tsx");
|
||||
writeRouteFixture("routes/app.$tenant/files._index.tsx");
|
||||
writeRouteFixture("routes/app.$tenant/files.$id.tsx");
|
||||
writeRouteFixture("routes/app.$tenant/contacts._index.tsx");
|
||||
|
||||
const manifest = createRoutesFromFolders(defineRouteManifest, {
|
||||
appDirectory: tempAppDirectory,
|
||||
});
|
||||
const byId = Object.fromEntries(Object.values(manifest).map((entry) => [entry.id, { path: entry.path, index: entry.index }]));
|
||||
|
||||
// Root _index is the index of the layout tree (no path).
|
||||
expect(byId["routes/_index"]).toEqual({ path: undefined, index: true });
|
||||
// A flat module _index becomes the leaf route AT the module path (renders /:tenant/files),
|
||||
// not a literal "/files/_index" segment, and is not itself an index route.
|
||||
expect(byId["routes/app.$tenant/files._index"]).toEqual({ path: "files", index: undefined });
|
||||
expect(byId["routes/app.$tenant/contacts._index"]).toEqual({ path: "contacts", index: undefined });
|
||||
// Sibling param route keeps its nested path.
|
||||
expect(byId["routes/app.$tenant/files.$id"]).toEqual({ path: "files/:id", index: undefined });
|
||||
});
|
||||
|
||||
it("ignores server-only files when requested by the route config", () => {
|
||||
tempAppDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "v1-route-convention-"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user