New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ecklf-tmp-runtime-test

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecklf-tmp-runtime-test - npm Package Compare versions

Comparing version 1.0.128 to 1.0.129

21

dist/lib/routes.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateRoutes = void 0;
const lodash_1 = require("lodash");
const CatchPriority = {
Static: 0,
Dynamic: 1,
CatchAll: 2,
OptionalCatchAll: 2,
};
function generateRoutes(files) {
return files.map((key) => {
const routes = files.map((key) => {
const route = key.endsWith('.rs') ? key.slice(0, -3) : key;

@@ -11,2 +18,3 @@ const segments = route.split('/');

if (segment.startsWith('[...') && segment.endsWith(']')) {
acc.catchType = CatchPriority.CatchAll;
acc.src.push('(\\S+)');

@@ -17,2 +25,3 @@ return acc;

if (segment.startsWith('[[...') && segment.endsWith(']]')) {
acc.catchType = CatchPriority.OptionalCatchAll;
acc.src.push('(/\\S+)?');

@@ -24,2 +33,3 @@ return acc;

const parameterName = segment.replace('[', '').replace(']', '');
acc.catchType = CatchPriority.Dynamic;
acc.src.push(`(?<${parameterName}>[^/]+)`);

@@ -30,5 +40,7 @@ acc.searchParams.set(parameterName, `$${parameterName}`);

// Static route
acc.catchType = CatchPriority.Static;
acc.src.push(segment);
return acc;
}, {
catchType: null,
src: [],

@@ -42,5 +54,12 @@ searchParams: new URLSearchParams(),

dest: `/api/vercel/index${queryString}`,
depth: segments.length,
catchType: result.catchType,
};
});
const orderedRoutes = (0, lodash_1.orderBy)(routes, ['catchType', 'depth'], ['asc', 'desc']);
return orderedRoutes.map((r) => ({
src: r.src,
dest: r.dest,
}));
}
exports.generateRoutes = generateRoutes;

18

dist/lib/routes.test.js

@@ -11,7 +11,7 @@ "use strict";

"dest": "/api/vercel/index",
"src": "/api/foo",
"src": "/api/bar/baz",
},
{
"dest": "/api/vercel/index",
"src": "/api/bar/baz",
"src": "/api/foo",
},

@@ -29,9 +29,9 @@ ]

{
"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?id=$id&commentId=$commentId",
"src": "/api/post/(?<id>[^/]+)/comments/(?<commentId>[^/]+)",
},
]

@@ -50,11 +50,11 @@ `);

"dest": "/api/vercel/index",
"src": "/api/(\\S+)",
"src": "/api/all/(\\S+)",
},
{
"dest": "/api/vercel/index",
"src": "/api/all/(\\S+)",
"src": "/api/optional/(/\\S+)?",
},
{
"dest": "/api/vercel/index",
"src": "/api/optional/(/\\S+)?",
"src": "/api/(\\S+)",
},

@@ -61,0 +61,0 @@ ]

{
"name": "ecklf-tmp-runtime-test",
"version": "1.0.128",
"version": "1.0.129",
"description": "Rust runtime for Vercel Functions.",

@@ -26,2 +26,3 @@ "homepage": "https://github.com/vercel-community/rust",

"execa": "5",
"lodash": "^4.17.21",
"typescript": "^4.9.4"

@@ -32,2 +33,3 @@ },

"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.191",
"@types/ms": "^0.7.31",

@@ -34,0 +36,0 @@ "@types/node": "^18.11.18",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc