filesystem-routing 0.4.1 → 0.5.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/dist/convention.js +3 -2
- package/dist/tree.js +3 -1
- package/dist/vite/pick-exports.d.ts +5 -0
- package/dist/vite/pick-exports.js +935 -0
- package/dist/vite/tree-shake.js +5 -441
- package/package.json +4 -4
package/dist/convention.js
CHANGED
|
@@ -12,8 +12,9 @@ export function routePathFromFile(routeFile) {
|
|
|
12
12
|
const routePath = routeFile
|
|
13
13
|
// remove the initial slash
|
|
14
14
|
.slice(1)
|
|
15
|
-
// only strip a whole `index` segment, not a name that merely ends in "index" (e.g. `reindex`)
|
|
16
|
-
|
|
15
|
+
// only strip a whole `index` segment, not a name that merely ends in "index" (e.g. `reindex`);
|
|
16
|
+
// group prefixes such as SolidBase's `(0)index` ordering stay for the adapters to strip
|
|
17
|
+
.replace(/(^|\/)((?:\([^/()]*\))*)index$/, "$1$2")
|
|
17
18
|
.replace(/\[([^/]+)\]/g, (_, m) => {
|
|
18
19
|
if (m.length > 3 && m.startsWith("...")) {
|
|
19
20
|
return `*${m.slice(3)}`;
|
package/dist/tree.js
CHANGED
|
@@ -20,8 +20,10 @@ export function buildRouteTree(entries) {
|
|
|
20
20
|
}
|
|
21
21
|
processRoute(parentRoute.children || (parentRoute.children = []), route, id.slice(parentRoute.id.length));
|
|
22
22
|
}
|
|
23
|
+
// Ties break by UTF-16 code unit, as the scan sorts files, not by
|
|
24
|
+
// `localeCompare`: the generated output must not depend on the machine's locale.
|
|
23
25
|
return [...entries]
|
|
24
|
-
.sort((a, b) =>
|
|
26
|
+
.sort((a, b) => a.path.length - b.path.length || (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))
|
|
25
27
|
.reduce((routes, route) => {
|
|
26
28
|
processRoute(routes, route, route.path);
|
|
27
29
|
return routes;
|