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

@jsenv/server

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/server - npm Package Compare versions

Comparing version 12.6.0 to 12.6.1

2

package.json
{
"name": "@jsenv/server",
"version": "12.6.0",
"version": "12.6.1",
"description": "Write your Node.js server using pure functions",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -42,3 +42,3 @@ /*

canReadDirectory = false,
rootDirectoryUrl,
rootDirectoryUrl, // = `${pathToFileURL(process.cwd())}/`,
} = {},

@@ -48,3 +48,3 @@ ) => {

if (!urlString) {
return send500DueToFilesystemUrlParameter(
return create500Response(
`fetchFileSystem first parameter must be a file url, got ${filesystemUrl}`,

@@ -54,6 +54,23 @@ )

if (!urlString.startsWith("file://")) {
return send500DueToFilesystemUrlParameter(
return create500Response(
`fetchFileSystem url must use "file://" scheme, got ${filesystemUrl}`,
)
}
if (rootDirectoryUrl) {
let rootDirectoryUrlString = asUrlString(rootDirectoryUrl)
if (!rootDirectoryUrlString) {
return create500Response(
`rootDirectoryUrl must be a string or an url, got ${rootDirectoryUrl}`,
)
}
if (!rootDirectoryUrlString.endsWith("/")) {
rootDirectoryUrlString = `${rootDirectoryUrlString}/`
}
if (!urlString.startsWith(rootDirectoryUrlString)) {
return create500Response(
`fetchFileSystem url must be inside root directory, got ${urlString}`,
)
}
rootDirectoryUrl = rootDirectoryUrlString
}

@@ -186,3 +203,3 @@ // here you might be tempted to add || cacheControl === 'no-cache'

const send500DueToFilesystemUrlParameter = (message) => {
const create500Response = (message) => {
return {

@@ -426,3 +443,2 @@ status: 500,

}
if (typeof value === "string") {

@@ -432,3 +448,2 @@ if (isFileSystemPath(value)) {

}
try {

@@ -441,4 +456,3 @@ const urlObject = new URL(value)

}
return null
}

@@ -31,3 +31,2 @@ // https://github.com/node-fetch/node-fetch/blob/8c197f8982a238b3c345c64b17bfa92e16b4f7c4/src/response.js#L1

if (url.startsWith("file://")) {
const origin = new URL(url).origin
const responseProperties = await fetchFileSystem(url, {

@@ -37,3 +36,3 @@ signal,

headers,
rootDirectoryUrl: origin,
rootDirectoryUrl: "file://",
cacheStrategy,

@@ -40,0 +39,0 @@ canReadDirectory,

import { readdirSync } from "node:fs"
import { pathToFileURL } from "node:url"

@@ -8,3 +7,3 @@ import { negotiateContentType } from "./content_negotiation/negotiateContentType.js"

url,
{ headers = {}, rootDirectoryUrl = `${pathToFileURL(process.cwd())}/` } = {},
{ headers = {}, rootDirectoryUrl } = {},
) => {

@@ -11,0 +10,0 @@ url = String(url)

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