@vercel/routing-utils 2.0.1 → 2.1.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/append.js +10 -0
- package/dist/types.d.ts +2 -1
- package/package.json +2 -2
package/dist/append.js
CHANGED
|
@@ -23,6 +23,16 @@ function appendRoutesToPhase({ routes: prevRoutes, newRoutes, phase, }) {
|
|
|
23
23
|
if (isInPhase) {
|
|
24
24
|
routes.push(...newRoutes);
|
|
25
25
|
}
|
|
26
|
+
else if (phase === null) {
|
|
27
|
+
// If the phase is null, we want to insert the routes at the beginning
|
|
28
|
+
const lastPhase = routes.findIndex(r => index_1.isHandler(r) && r.handle);
|
|
29
|
+
if (lastPhase === -1) {
|
|
30
|
+
routes.push(...newRoutes);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
routes.splice(lastPhase, 0, ...newRoutes);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
26
36
|
else if (insertIndex > -1) {
|
|
27
37
|
routes.splice(insertIndex, 0, ...newRoutes);
|
|
28
38
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export interface AppendRoutesToPhaseProps {
|
|
|
107
107
|
newRoutes: Route[] | null;
|
|
108
108
|
/**
|
|
109
109
|
* The phase to append the routes such as `filesystem`.
|
|
110
|
+
* If the phase is `null`, the routes will be appended prior to the first handle being found.
|
|
110
111
|
*/
|
|
111
|
-
phase: HandleValue;
|
|
112
|
+
phase: HandleValue | null;
|
|
112
113
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/routing-utils",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Vercel routing utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"optionalDependencies": {
|
|
31
31
|
"ajv": "^6.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "a630e1989613052f64411fd7e5468de58c5999ba"
|
|
34
34
|
}
|