@react-router/fs-routes 0.0.0-experimental-4b431ca46 → 0.0.0-experimental-7c6c0664d

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/README.md CHANGED
@@ -3,5 +3,5 @@
3
3
  File system routing conventions for [React Router.](https://github.com/remix-run/react-router)
4
4
 
5
5
  ```sh
6
- npm i @react-router/fs-routes
6
+ npm install @react-router/fs-routes
7
7
  ```
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/fs-routes v0.0.0-experimental-4b431ca46
2
+ * @react-router/fs-routes v0.0.0-experimental-7c6c0664d
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -75,6 +75,7 @@ function flatRoutes(appDirectory, ignoredFilePatterns = [], prefix = "routes") {
75
75
  if (!fs__default["default"].existsSync(rootRoute)) {
76
76
  throw new Error(`Could not find the routes directory: ${routesDir}. Did you forget to create it?`);
77
77
  }
78
+
78
79
  // Only read the routes directory
79
80
  let entries = fs__default["default"].readdirSync(routesDir, {
80
81
  withFileTypes: true,
@@ -101,6 +102,7 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
101
102
  let prefixLookup = new PrefixLookupTrie();
102
103
  let uniqueRoutes = new Map();
103
104
  let routeIdConflicts = new Map();
105
+
104
106
  // id -> file
105
107
  let routeIds = new Map();
106
108
  for (let file of routes) {
@@ -142,6 +144,7 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
142
144
  }
143
145
  }
144
146
  }
147
+
145
148
  // path creation
146
149
  let parentChildrenMap = new Map();
147
150
  for (let [routeId] of sortedRouteIds) {
@@ -156,11 +159,12 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
156
159
  let originalPathname = config.path || "";
157
160
  let pathname = config.path;
158
161
  let parentConfig = config.parentId ? routeManifest[config.parentId] : null;
159
- if (parentConfig?.path && pathname) {
162
+ if (parentConfig !== null && parentConfig !== void 0 && parentConfig.path && pathname) {
160
163
  pathname = pathname.slice(parentConfig.path.length).replace(/^\//, "").replace(/\/$/, "");
161
164
  }
162
165
  if (!config.parentId) config.parentId = "root";
163
166
  config.path = pathname || undefined;
167
+
164
168
  /**
165
169
  * We do not try to detect path collisions for pathless layout route
166
170
  * files because, by definition, they create the potential for route
@@ -216,6 +220,7 @@ function flatRoutesUniversal(appDirectory, routes, prefix = "routes") {
216
220
  console.error(getRouteIdConflictErrorMessage(routeId, files));
217
221
  }
218
222
  }
223
+
219
224
  // report conflicts
220
225
  if (urlConflicts.size > 0) {
221
226
  for (let [path, routes] of urlConflicts.entries()) {
@@ -241,6 +246,7 @@ function findRouteModuleForFolder(appDirectory, filepath, ignoredFileRegex) {
241
246
  if (isIgnored) return null;
242
247
  let routeRouteModule = findFile(filepath, "route", routeModuleExts);
243
248
  let routeIndexModule = findFile(filepath, "index", routeModuleExts);
249
+
244
250
  // if both a route and index module exist, throw a conflict error
245
251
  // preferring the route module over the index module
246
252
  if (routeRouteModule && routeIndexModule) {
@@ -277,6 +283,7 @@ function getRouteSegments(routeId) {
277
283
  while (index < routeId.length) {
278
284
  let char = routeId[index];
279
285
  index++; //advance to next char
286
+
280
287
  switch (state) {
281
288
  case "NORMAL":
282
289
  {
@@ -362,6 +369,7 @@ function getRouteSegments(routeId) {
362
369
  }
363
370
  }
364
371
  }
372
+
365
373
  // process remaining segment
366
374
  pushRouteSegment(routeSegment, rawRouteSegment);
367
375
  return [routeSegments, rawRouteSegments];
@@ -374,10 +382,12 @@ function createRoutePath(routeSegments, rawRouteSegments, isIndex) {
374
382
  for (let index = 0; index < routeSegments.length; index++) {
375
383
  let segment = routeSegments[index];
376
384
  let rawSegment = rawRouteSegments[index];
385
+
377
386
  // skip pathless layout segments
378
387
  if (segment.startsWith("_") && rawSegment.startsWith("_")) {
379
388
  continue;
380
389
  }
390
+
381
391
  // remove trailing slash
382
392
  if (segment.endsWith("_") && rawSegment.endsWith("_")) {
383
393
  segment = segment.slice(0, -1);
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/fs-routes v0.0.0-experimental-4b431ca46
2
+ * @react-router/fs-routes v0.0.0-experimental-7c6c0664d
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/manifest.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/fs-routes v0.0.0-experimental-4b431ca46
2
+ * @react-router/fs-routes v0.0.0-experimental-7c6c0664d
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @react-router/fs-routes v0.0.0-experimental-4b431ca46
2
+ * @react-router/fs-routes v0.0.0-experimental-7c6c0664d
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-router/fs-routes",
3
- "version": "0.0.0-experimental-4b431ca46",
3
+ "version": "0.0.0-experimental-7c6c0664d",
4
4
  "description": "File system routing conventions for React Router",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/react-router/issues"
@@ -25,11 +25,11 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "typescript": "^5.1.6",
28
- "@react-router/dev": "0.0.0-experimental-4b431ca46"
28
+ "@react-router/dev": "0.0.0-experimental-7c6c0664d"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "typescript": "^5.1.0",
32
- "@react-router/dev": "^0.0.0-experimental-4b431ca46"
32
+ "@react-router/dev": "^0.0.0-experimental-7c6c0664d"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "typescript": {
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  "engines": {
40
- "node": ">=18.0.0"
40
+ "node": ">=20.0.0"
41
41
  },
42
42
  "files": [
43
43
  "dist/",
package/CHANGELOG.md DELETED
@@ -1,8 +0,0 @@
1
- # @react-router/fs-routes
2
-
3
- ## 7.0.0-pre.0
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies:
8
- - `@react-router/dev@7.0.0-pre.0`