Socket
Socket
Sign inDemoInstall

elysia

Package Overview
Dependencies
Maintainers
1
Versions
410
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elysia - npm Package Compare versions

Comparing version 0.5.0-exp-230507.1507 to 0.5.0-exp-230507.1517

2

dist/compose.js

@@ -1,2 +0,2 @@

import{parse as e}from"fast-querystring";import{mapEarlyResponse as r,mapResponse as t}from"./handler";import{SCHEMA as s,DEFS as a}from"./utils";import{ParseError as o,NotFoundError as n,ValidationError as c,InternalServerError as l}from"./error";let d="AsyncFunction",i=e=>e.constructor.name===d,u=new Headers,f=RegExp(" (\\w+) = context","g");export const isFnUse=(e,r)=>{let t=r.slice(r.indexOf("(")+1,r.indexOf(")"));if(""===t)return!1;if(123===t.charCodeAt(0))return!!(t.includes(`{ ${e}`)||t.includes(`, ${e}`));if(r.match(RegExp(`${t}.(${e}|["${e}"])`)))return!0;let s=[t];for(let e of r.matchAll(f))s.push(e[1]);let a=RegExp(`{.*?} = (${s.join("|")})`,"g");for(let[t]of r.matchAll(a))if(t.includes(`{ ${e}`)||t.includes(`, ${e}`))return!0;return!1};export const composeHandler=({path:f,method:p,hooks:h,validator:y,handler:m,handleError:$,meta:b})=>{let w="try {\n",q="string"==typeof h.type,E=y||"GET"!==p?[m,...h.transform,...h.beforeHandle,...h.afterHandle].map(e=>e.toString()):[],k="GET"!==p&&(y.body||q||E.some(e=>isFnUse("body",e))),g=y.headers||E.some(e=>isFnUse("headers",e));g&&(w+=u.toJSON?`c.headers = c.request.headers.toJSON()
import{parse as e}from"fast-querystring";import{mapEarlyResponse as r,mapResponse as t}from"./handler";import{SCHEMA as s,DEFS as a}from"./utils";import{ParseError as o,NotFoundError as n,ValidationError as c,InternalServerError as l}from"./error";let d="AsyncFunction",i=e=>e.constructor.name===d,u=new Headers,f=RegExp(" (\\w+) = context","g");export const isFnUse=(e,r)=>{let t=r.slice(r.indexOf("(")+1,r.indexOf(")"));if(""===t)return!1;if(123===t.charCodeAt(0))return!!(t.includes(`{ ${e}`)||t.includes(`, ${e}`));if(r.match(RegExp(`${t}(.${e}|\\["${e}"\\])`)))return!0;let s=[t];for(let e of r.matchAll(f))s.push(e[1]);let a=RegExp(`{.*?} = (${s.join("|")})`,"g");for(let[t]of r.matchAll(a))if(t.includes(`{ ${e}`)||t.includes(`, ${e}`))return!0;return!1};export const composeHandler=({path:f,method:p,hooks:h,validator:y,handler:m,handleError:$,meta:b})=>{let w="try {\n",q="string"==typeof h.type,E=y||"GET"!==p?[m,...h.transform,...h.beforeHandle,...h.afterHandle].map(e=>e.toString()):[],k="GET"!==p&&(y.body||q||E.some(e=>isFnUse("body",e))),g=y.headers||E.some(e=>isFnUse("headers",e));g&&(w+=u.toJSON?`c.headers = c.request.headers.toJSON()
`:`c.headers = {}

@@ -3,0 +3,0 @@ for (const key of c.request.headers.keys())

{
"name": "elysia",
"description": "Fast, and friendly Bun web framework",
"version": "0.5.0-exp-230507.1507",
"version": "0.5.0-exp-230507.1517",
"author": {

@@ -6,0 +6,0 @@ "name": "saltyAom",

@@ -50,4 +50,5 @@ import type { Elysia } from '.'

// Match dot notation and named access
if (fnLiteral.match(new RegExp(`${argument}.(${keyword}|["${keyword}"])`)))
if (fnLiteral.match(new RegExp(`${argument}(.${keyword}|\\["${keyword}"\\])`))) {
return true
}

@@ -433,4 +434,2 @@ const aliases = [argument]

// console.log(fnLiteral)
fnLiteral = `const {

@@ -437,0 +436,0 @@ handler,

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