Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elysiajs/static

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/static - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/index.d.ts

@@ -38,3 +38,3 @@ import type { Elysia } from 'elysia';

}) => (app: Elysia) => Elysia<import("elysia").ElysiaInstance<{
store: {};
store: Record<typeof import("elysia").SCHEMA, {}>;
request: {};

@@ -41,0 +41,0 @@ schema: {};

@@ -38,20 +38,20 @@ import { readdirSync, existsSync } from 'fs';

return;
app.get(`/${join(prefix, file.replace(`${path}/`, ''))}`, () => new Response(Bun.file(file)));
const response = new Response(Bun.file(file));
app.get(`/${join(prefix, file.replace(`${path}/`, ''))}`, () => response.clone());
});
else {
else
app.get(`${prefix}/*`, ({ params }) => {
const file = `${path}/${params['*']}`;
if (shouldIgnore(file))
return new Response('Not Found', {
return new Response('NOT_FOUND', {
status: 404
});
return existsSync(file)
? new Response(Bun.file(file))
: new Response('Not Found', {
status: 404
});
if (existsSync(file))
return new Response(Bun.file(file));
return new Response('NOT_FOUND', {
status: 404
});
});
}
return app;
};
export default staticPlugin;
{
"name": "@elysiajs/static",
"description": "Plugin for Elysia for serving static folder",
"version": "0.1.0",
"version": "0.1.1",
"author": {

@@ -39,9 +39,10 @@ "name": "saltyAom",

"bun-types": "^0.2.2",
"elysia": "^0.1.2",
"eslint": "^8.26.0",
"elysia": "^0.1.0-rc.5",
"mitata": "^0.1.6",
"typescript": "^4.8.4"
},
"peerDependencies": {
"elysia": ">= 0.1.0-rc.5"
"elysia": ">= 0.1.0"
}
}

@@ -89,8 +89,9 @@ import type { Elysia } from 'elysia'

app.get(
`/${join(prefix, file.replace(`${path}/`, ''))}`,
() => new Response(Bun.file(file))
const response = new Response(Bun.file(file))
app.get(`/${join(prefix, file.replace(`${path}/`, ''))}`, () =>
response.clone()
)
})
else {
else
app.get(`${prefix}/*`, ({ params }) => {

@@ -100,13 +101,12 @@ const file = `${path}/${(params as any)['*']}`

if (shouldIgnore(file))
return new Response('Not Found', {
return new Response('NOT_FOUND', {
status: 404
})
return existsSync(file)
? new Response(Bun.file(file))
: new Response('Not Found', {
status: 404
})
if (existsSync(file)) return new Response(Bun.file(file))
return new Response('NOT_FOUND', {
status: 404
})
})
}

@@ -113,0 +113,0 @@ return app

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