@react-router/fs-routes 7.12.0 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # `@react-router/fs-routes`
2
2
 
3
+ ## 7.13.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix route file paths when routes directory is outside of the app directory ([#13937](https://github.com/remix-run/react-router/pull/13937))
8
+ - Updated dependencies:
9
+ - `@react-router/dev@7.13.0`
10
+
3
11
  ## 7.12.0
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/fs-routes v7.12.0
2
+ * @react-router/fs-routes v7.13.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -174,13 +174,14 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
174
174
  let prefixLookup = new PrefixLookupTrie();
175
175
  let uniqueRoutes = /* @__PURE__ */ new Map();
176
176
  let routeIdConflicts = /* @__PURE__ */ new Map();
177
+ let normalizedApp = normalizeSlashes(appDirectory);
178
+ let appWithPrefix = import_node_path2.default.posix.join(normalizedApp, prefix);
177
179
  let routeIds = /* @__PURE__ */ new Map();
178
180
  for (let file of routes) {
179
181
  let normalizedFile = normalizeSlashes(file);
180
182
  let routeExt = import_node_path2.default.extname(normalizedFile);
181
183
  let routeDir = import_node_path2.default.dirname(normalizedFile);
182
- let normalizedApp = normalizeSlashes(appDirectory);
183
- let routeId = routeDir === import_node_path2.default.posix.join(normalizedApp, prefix) ? import_node_path2.default.posix.relative(normalizedApp, normalizedFile).slice(0, -routeExt.length) : import_node_path2.default.posix.relative(normalizedApp, routeDir);
184
+ let routeId = routeDir === appWithPrefix ? import_node_path2.default.posix.relative(normalizedApp, normalizedFile).slice(0, -routeExt.length) : import_node_path2.default.posix.relative(normalizedApp, routeDir);
184
185
  let conflict = routeIds.get(routeId);
185
186
  if (conflict) {
186
187
  let currentConflicts = routeIdConflicts.get(routeId);
@@ -201,7 +202,7 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
201
202
  let [segments, raw] = getRouteSegments(routeId.slice(prefix.length + 1));
202
203
  let pathname = createRoutePath(segments, raw, index);
203
204
  routeManifest[routeId] = {
204
- file: file.slice(appDirectory.length + 1),
205
+ file: import_node_path2.default.posix.relative(normalizedApp, file),
205
206
  id: routeId,
206
207
  path: pathname
207
208
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/fs-routes",
3
- "version": "7.12.0",
3
+ "version": "7.13.0",
4
4
  "description": "File system routing conventions for React Router, for use within routes.ts",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/react-router/issues"
@@ -41,11 +41,11 @@
41
41
  "tsup": "^8.3.0",
42
42
  "typescript": "^5.4.5",
43
43
  "wireit": "0.14.9",
44
- "@react-router/dev": "7.12.0"
44
+ "@react-router/dev": "7.13.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "typescript": "^5.1.0",
48
- "@react-router/dev": "^7.12.0"
48
+ "@react-router/dev": "^7.13.0"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "typescript": {