-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(types)!: fix @netlify/headers-parser
types
#6104
base: main
Are you sure you want to change the base?
Changes from 3 commits
698febd
46a428d
1fa08ca
6618e0a
58dc8cc
27e6287
3af49f6
41e53b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,8 @@ import { mergeHeaders } from './merge.js' | |||||
import { parseConfigHeaders } from './netlify_config_parser.js' | ||||||
import { normalizeHeaders } from './normalize.js' | ||||||
import { splitResults, concatResults } from './results.js' | ||||||
import type { Header, MinimalHeader } from './types.js' | ||||||
export type { Header, MinimalHeader } | ||||||
serhalp marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
// Parse all headers from `netlify.toml` and `_headers` file, then normalize | ||||||
// and validate those. | ||||||
|
@@ -11,6 +13,11 @@ export const parseAllHeaders = async function ({ | |||||
netlifyConfigPath, | ||||||
configHeaders = [], | ||||||
minimal = false, | ||||||
}: { | ||||||
headersFiles?: undefined | string[] | ||||||
netlifyConfigPath?: undefined | string | ||||||
configHeaders: undefined | MinimalHeader[] | ||||||
minimal: undefined | boolean | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should these two be optional? |
||||||
}) { | ||||||
const [ | ||||||
{ headers: fileHeaders, errors: fileParseErrors }, | ||||||
|
@@ -37,12 +44,12 @@ export const parseAllHeaders = async function ({ | |||||
return { headers, errors } | ||||||
} | ||||||
|
||||||
const getFileHeaders = async function (headersFiles) { | ||||||
const getFileHeaders = async function (headersFiles: string[]) { | ||||||
const resultsArrays = await Promise.all(headersFiles.map(parseFileHeaders)) | ||||||
return concatResults(resultsArrays) | ||||||
} | ||||||
|
||||||
const getConfigHeaders = async function (netlifyConfigPath) { | ||||||
const getConfigHeaders = async function (netlifyConfigPath?: undefined | string) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if (netlifyConfigPath === undefined) { | ||||||
return splitResults([]) | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { parseAllHeaders } from './all.js' | ||
export { parseAllHeaders, type Header, type MinimalHeader } from './all.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this down to this specific package so I could enable it in the base config