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

netlify-headers-parser

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netlify-headers-parser - npm Package Compare versions

Comparing version 6.0.0 to 6.0.1

16

package.json
{
"name": "netlify-headers-parser",
"version": "6.0.0",
"version": "6.0.1",
"description": "Parses Netlify headers into a JavaScript object representation",

@@ -9,6 +9,7 @@ "type": "module",

"scripts": {
"prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
"prepublishOnly": "npm ci && npm test",
"test": "run-s format test:dev",
"test:dev": "ava",
"test:ci": "nyc -r lcovonly -r text -r json ava",
"test:ci": "c8 -r lcovonly -r text -r json ava",
"format": "run-s format:check-fix:*",

@@ -43,5 +44,6 @@ "format:ci": "run-s format:check:*",

"devDependencies": {
"@netlify/eslint-config-node": "^3.3.11",
"@netlify/eslint-config-node": "^4.1.4",
"ava": "^3.0.0",
"nyc": "^15.1.0",
"c8": "^7.11.0",
"husky": "^7.0.4",
"test-each": "^2.0.1"

@@ -58,8 +60,2 @@ },

},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-push": "npm run format"
}
},
"repository": {

@@ -66,0 +62,0 @@ "type": "git",

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

import fs from 'fs'
import { promisify } from 'util'
import { promises as fs } from 'fs'

@@ -8,4 +7,2 @@ import pathExists from 'path-exists'

const readFileAsync = promisify(fs.readFile)
// Parse `_headers` file to an array of objects following the same syntax as

@@ -35,4 +32,4 @@ // the `headers` property in `netlify.toml`

try {
return await readFileAsync(headersFile, 'utf-8')
} catch (error) {
return await fs.readFile(headersFile, 'utf-8')
} catch {
return new Error(`Could not read headers file: ${headersFile}`)

@@ -39,0 +36,0 @@ }

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

import { readFile } from 'fs'
import { promisify } from 'util'
import { promises as fs } from 'fs'

@@ -9,4 +8,2 @@ import pathExists from 'path-exists'

const pReadFile = promisify(readFile)
// Parse `headers` field in "netlify.toml" to an array of objects.

@@ -27,3 +24,3 @@ // This field is already an array of objects so it only validates and

try {
const configString = await pReadFile(configPath, 'utf8')
const configString = await fs.readFile(configPath, 'utf8')
const config = loadToml(configString)

@@ -30,0 +27,0 @@ // Convert `null` prototype objects to normal plain objects

@@ -14,6 +14,4 @@ // If one header fails to parse, we still try to return the other ones

export const concatResults = function (resultsArrays) {
// eslint-disable-next-line unicorn/prefer-spread
const headers = [].concat(...resultsArrays.map(getHeaders))
// eslint-disable-next-line unicorn/prefer-spread
const errors = [].concat(...resultsArrays.map(getErrors))
const headers = resultsArrays.flatMap(getHeaders)
const errors = resultsArrays.flatMap(getErrors)
return { headers, errors }

@@ -20,0 +18,0 @@ }

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