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

feat(remix-dev): flat routes #4880

Merged
merged 62 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
45e1669
feat: add flat routes convention
kiliman Nov 30, 2022
2a0c205
chore: include future v2_routeConvention flag
kiliman Dec 13, 2022
7e08ddb
fix: update readConfig test to include new v2_routeConvention flag
kiliman Dec 13, 2022
30319da
fix: replace default route dir
kiliman Dec 13, 2022
c330861
chore: slim
mcansh Dec 14, 2022
88c0cbe
chore: remove unused eslint-disable coment
mcansh Dec 14, 2022
50a4393
chore(flat-routes): add support for optional and escape route segments
mcansh Dec 20, 2022
c525b4c
initial import
mcansh Dec 21, 2022
ba964ae
chore: index routes use underscores
mcansh Dec 21, 2022
459030c
feat: add support for optional segments
mcansh Dec 21, 2022
1db590d
chore: flat routes
mcansh Dec 21, 2022
c1df59d
feat: nested escaping inside optional
mcansh Dec 21, 2022
f6a3f94
chore: remove TODO comment
mcansh Dec 21, 2022
434836f
feat: handle opting out of parent layout, but keeping url segment
mcansh Dec 21, 2022
940d794
chore: use `isSegmentSeparator` to account for windows paths
mcansh Dec 22, 2022
fae3dfa
chore: helpers no longer need to be exported from `routesConvention`
mcansh Dec 22, 2022
a4b0b35
chore: don't return separators from `getRouteSegments`
mcansh Dec 22, 2022
bf0ba0a
chore: rename test
mcansh Dec 22, 2022
e64fe6a
chore: don't treat escaped separator as new segment
mcansh Dec 22, 2022
34d3db5
chore: undo some unneeded changes to `routesConvention`
mcansh Dec 22, 2022
b9892a1
test: route hierarchy
mcansh Dec 22, 2022
c377df9
test: add more test cases
mcansh Dec 22, 2022
5911430
fix: glob
mcansh Dec 22, 2022
da0716d
chore: handle opting out of layout
mcansh Dec 22, 2022
c8660ec
chore: lil clean
mcansh Dec 22, 2022
81c83b4
chore: more tests, add substate type
mcansh Jan 3, 2023
72d2790
chore: re-add lookahead/lookbehind when exiting optional/escape modes
mcansh Jan 3, 2023
647b78d
chore: remove duplicate cases
mcansh Jan 3, 2023
413d3f8
test: update test name
mcansh Jan 3, 2023
e9246d3
chore: advance char earlier, fix bugggg
mcansh Jan 3, 2023
9ceb89f
chore: prevent `/` in route segments
mcansh Jan 4, 2023
3afc886
test: update test name
mcansh Jan 4, 2023
83cd4d8
test: add cases for splitBySegments
mcansh Jan 4, 2023
e00255b
test: add cases for joinByDelimiter
mcansh Jan 4, 2023
0100169
Update packages/remix-dev/config/flat-routes.ts
mcansh Jan 4, 2023
e03efca
Update packages/remix-dev/config/flat-routes.ts
mcansh Jan 4, 2023
a34b7ad
Update packages/remix-dev/config/flat-routes.ts
mcansh Jan 4, 2023
5ab63af
test: remove duplicate routes
mcansh Jan 4, 2023
1436c31
chore: combine jacob's and kiliman's approaches
mcansh Jan 4, 2023
16a97d3
chore: remove console.log
mcansh Jan 4, 2023
ac0cc8c
test: add tests for generically creating route paths
mcansh Jan 4, 2023
7a24b9e
test: add case for skipping layouts other than the top level
mcansh Jan 4, 2023
8679fa0
chore: make tests pass on windows
mcansh Jan 4, 2023
388d89f
chore: use for...of to be consistent
mcansh Jan 4, 2023
e575458
chore: for...of on routeMap
mcansh Jan 5, 2023
4f569fd
fixup! chore: for...of on routeMap
mcansh Jan 5, 2023
6fc6b9f
chore: extract getRouteMap
mcansh Jan 5, 2023
d4d87d0
chore: address feedback
mcansh Jan 5, 2023
4779e24
chore: set default parentId to "root" in defineRoutes
mcansh Jan 5, 2023
0d6c4fb
test: update defineConventionalRoutes test for default root parentId
mcansh Jan 5, 2023
0a8edbf
chore: remove comment
mcansh Jan 5, 2023
7b54735
chore: remove unnecessary else block
mcansh Jan 5, 2023
be8f00c
test: update defineRoutes test per 4779e2458499d15ba31791ff785cdcdf3b…
mcansh Jan 5, 2023
4c9d619
chore: add brief description of what each state/substate means
mcansh Jan 5, 2023
f521c20
chore: remove nesting via early return
mcansh Jan 5, 2023
758a90a
chore: condense state/substate
mcansh Jan 5, 2023
f6e2615
chore: update routePaths to account for folders
mcansh Jan 5, 2023
d54ba0f
chore: error when escaping `:` or `*`
mcansh Jan 5, 2023
c4955a6
chore: remove console.log
mcansh Jan 5, 2023
7515c19
chore: include routeId in error message
mcansh Jan 5, 2023
df340a4
chore: error when using `:` or `*`, not just escaping
mcansh Jan 5, 2023
3f3129e
chore: normalize error messages, move tests to getRouteSegments
mcansh Jan 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-forks-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Add flat routes convention
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.changeset/*.md
.changeset/*.md
14 changes: 7 additions & 7 deletions packages/remix-dev/__tests__/defineRoutes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ describe("defineRoutes", () => {
"file": "routes/home.js",
"id": "routes/home",
"index": undefined,
"parentId": undefined,
"parentId": "root",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should double-check that parentId wasn't intentionally undefined for some reason. Like does parentId get surfaced in the route meta that is available to users? Do users rely on it being undefined? Or is this value solely used for defining routes internally?

"path": "/",
},
"routes/inbox": Object {
"caseSensitive": undefined,
"file": "routes/inbox.js",
"id": "routes/inbox",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "inbox",
},
"routes/inbox/$messageId": Object {
Expand Down Expand Up @@ -73,15 +73,15 @@ describe("defineRoutes", () => {
"file": "one.md",
"id": "one",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "one",
},
"two": Object {
"caseSensitive": undefined,
"file": "two.md",
"id": "two",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "two",
},
}
Expand All @@ -102,23 +102,23 @@ describe("defineRoutes", () => {
"file": "routes/other-route.tsx",
"id": "routes/other-route",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "/other",
},
"user": Object {
"caseSensitive": undefined,
"file": "routes/index.tsx",
"id": "user",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "/user",
},
"user-by-id": Object {
"caseSensitive": undefined,
"file": "routes/index.tsx",
"id": "user-by-id",
"index": undefined,
"parentId": undefined,
"parentId": "root",
"path": "/user/:id",
},
}
Expand Down