@mapl/router 0.4.6 → 0.4.8
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/method/compiler.d.ts +1 -1
- package/method/compiler.js +1 -1
- package/package.json +1 -1
- package/path/compiler.js +1 -1
- package/transform.d.ts +1 -1
package/method/compiler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Compiler } from '../tree/compiler.js';
|
|
2
2
|
import { type Router } from './index.js';
|
|
3
|
-
declare const _default: (router: Router<string>, compile: Compiler, methodInput: string, startIndex: 0 | 1) => string;
|
|
3
|
+
declare const _default: (router: Router<string>, compile: Compiler, methodInput: string, parsePath: string, startIndex: 0 | 1) => string;
|
|
4
4
|
export default _default;
|
package/method/compiler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default (router,compile,methodInput,startIndex)=>{let str="switch("+methodInput+"){";for(let key in router)str+='case"'+key+'":'+compilePath(router[key],compile,startIndex)+"break;";str+="}";let all=router[ALL];if(all!=null)str+=compilePath(all,compile,startIndex);return str};import{ALL}from"./index.js";import compilePath from"../path/compiler.js";
|
|
1
|
+
export default (router,compile,methodInput,parsePath,startIndex)=>{let str="switch("+methodInput+"){";for(let key in router)str+='case"'+key+'":{'+parsePath+compilePath(router[key],compile,startIndex)+"break;}";str+="}";let all=router[ALL];if(all!=null)str+=parsePath+compilePath(all,compile,startIndex);return str};import{ALL}from"./index.js";import compilePath from"../path/compiler.js";
|
package/package.json
CHANGED
package/path/compiler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default (router,compile,startIndex)=>router[0].map((pair)=>'if(p==="'+pair[0].slice(startIndex)+'"){'+pair[1]+"}").join("")+(router[1]===null?"":"
|
|
1
|
+
export default (router,compile,startIndex)=>router[0].map((pair)=>'if(p==="'+pair[0].slice(startIndex)+'"){'+pair[1]+"}").join("")+(router[1]===null?"":"let l=p.length;"+compile(router[1],0,-startIndex,""));
|
package/transform.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type PathTransformer = (path: string) => PathTransformResult;
|
|
|
7
7
|
export type InferNormalRoute<T extends string> = T extends `${string}*${infer Next}` ? Next extends '*' ? [string] : [...InferNormalRoute<Next>, string] : [];
|
|
8
8
|
export type InferFSRoute<T extends string> = T extends `${string}[${infer Current}]${infer Rest}` ? Current extends `...${string}` ? [string] : [...InferFSRoute<Rest>, string] : [];
|
|
9
9
|
export declare const transformFSRoute: PathTransformer;
|
|
10
|
-
export type InferRoute<T extends string> = T extends `${string}:${infer Current}` ? Current extends `${string}/${infer Rest}` ? [...InferRoute<Rest>, string] : [string] : T extends
|
|
10
|
+
export type InferRoute<T extends string> = T extends `${string}:${infer Current}` ? Current extends `${string}/${infer Rest}` ? [...InferRoute<Rest>, string] : [string] : T extends `${string}*` ? [string] : [];
|
|
11
11
|
export declare const transformRoute: PathTransformer;
|