ecklf-tmp-runtime-test
Advanced tools
Comparing version 1.0.127 to 1.0.128
@@ -22,2 +22,3 @@ "use strict"; | ||
const utils_1 = require("./lib/utils"); | ||
const routes_1 = require("./lib/routes"); | ||
function buildHandler(options) { | ||
@@ -69,5 +70,5 @@ var _a; | ||
}); | ||
// const handlerFiles = await glob('api/**/*.rs', workPath); | ||
// const routes = generateRoutes(Object.keys(handlerFiles)); | ||
// debug(JSON.stringify(routes, null, 2)); | ||
const handlerFiles = yield (0, build_utils_1.glob)('api/**/*.rs', workPath); | ||
const routes = (0, routes_1.generateRoutes)(Object.keys(handlerFiles)); | ||
(0, build_utils_1.debug)(JSON.stringify(routes, null, 2)); | ||
return { | ||
@@ -81,29 +82,29 @@ output: lambda, | ||
// \/product(\/\S+)? | ||
/* routes, */ | ||
routes: [ | ||
{ | ||
src: '/api/foo', | ||
dest: '/api/vercel/index', | ||
}, | ||
{ | ||
src: '/api/bar/baz', | ||
dest: '/api/vercel/index', | ||
}, | ||
{ | ||
src: '/api/dynamic/(?<path>[^/]+)', | ||
dest: '/api/vercel/index?path=$path', | ||
}, | ||
{ | ||
src: '/api/all/(\\S+)', | ||
dest: '/api/vercel/index', | ||
}, | ||
{ | ||
src: '/api/optional/(/\\S+)?', | ||
dest: '/api/vercel/index', | ||
}, | ||
{ | ||
src: '/api/(\\S+)', | ||
dest: '/api/vercel/index', | ||
}, | ||
], | ||
routes, | ||
/* routes: [ */ | ||
/* { */ | ||
/* src: '/api/foo', */ | ||
/* dest: '/api/index', */ | ||
/* }, */ | ||
/* { */ | ||
/* src: '/api/bar/baz', */ | ||
/* dest: '/api/index', */ | ||
/* }, */ | ||
/* { */ | ||
/* src: '/api/dynamic/(?<path>[^/]+)', */ | ||
/* dest: '/api/index?path=$path', */ | ||
/* }, */ | ||
/* { */ | ||
/* src: '/api/all/(\\S+)', */ | ||
/* dest: '/api/index', */ | ||
/* }, */ | ||
/* { */ | ||
/* src: '/api/optional/(/\\S+)?', */ | ||
/* dest: '/api/index', */ | ||
/* }, */ | ||
/* { */ | ||
/* src: '/api/(\\S+)', */ | ||
/* dest: '/api/index', */ | ||
/* }, */ | ||
/* ], */ | ||
}; | ||
@@ -134,2 +135,3 @@ }); | ||
shouldServe: (options) => __awaiter(void 0, void 0, void 0, function* () { | ||
// TODO | ||
/* debug(`Requested ${options.requestPath} for ${options.entrypoint}`); */ | ||
@@ -136,0 +138,0 @@ /* return Promise.resolve(options.requestPath === options.entrypoint); */ |
@@ -61,2 +61,45 @@ "use strict"; | ||
}); | ||
it('should sort all routes correctly', () => { | ||
const allRoutes = [ | ||
'api/foo.rs', | ||
'api/bar/baz.rs', | ||
'api/post/[id].rs', | ||
'api/post/[id]/comments/[commentId].rs', | ||
'api/[...rootAll].rs', | ||
'api/all/[...all].rs', | ||
'api/optional/[[...id]].rs', | ||
]; | ||
expect((0, routes_1.generateRoutes)(allRoutes)).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"dest": "/api/vercel/index", | ||
"src": "/api/bar/baz", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index", | ||
"src": "/api/foo", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index?id=$id&commentId=$commentId", | ||
"src": "/api/post/(?<id>[^/]+)/comments/(?<commentId>[^/]+)", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index?id=$id", | ||
"src": "/api/post/(?<id>[^/]+)", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index", | ||
"src": "/api/all/(\\S+)", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index", | ||
"src": "/api/optional/(/\\S+)?", | ||
}, | ||
{ | ||
"dest": "/api/vercel/index", | ||
"src": "/api/(\\S+)", | ||
}, | ||
] | ||
`); | ||
}); | ||
}); |
{ | ||
"name": "ecklf-tmp-runtime-test", | ||
"version": "1.0.127", | ||
"version": "1.0.128", | ||
"description": "Rust runtime for Vercel Functions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/vercel-community/rust", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25071
429