mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 14:34:18 +03:00
Remove obsolete field.
This commit is contained in:
parent
8990555331
commit
5652b9b3d1
@ -229,17 +229,6 @@ async function outputString(
|
||||
|
||||
/** @typedef { { head: any[]; errors: any[]; contentJson: any[]; html: string; route: string; title: string; } } Arg */
|
||||
|
||||
/**
|
||||
* @param {string} string
|
||||
*/
|
||||
function jsonOrNull(string) {
|
||||
try {
|
||||
return JSON.parse(string);
|
||||
} catch (e) {
|
||||
return { invalidJson: e.toString() };
|
||||
}
|
||||
}
|
||||
|
||||
async function runHttpJob(app, mode, requestToPerform, fs, hasFsAccess) {
|
||||
pendingDataSourceCount += 1;
|
||||
try {
|
||||
@ -342,7 +331,6 @@ async function readFileJobNew(req, patternsToWatch) {
|
||||
parsedFrontmatter: parsedFile.data,
|
||||
withoutFrontmatter: parsedFile.content,
|
||||
rawFile: fileContents,
|
||||
jsonFile: jsonOrNull(fileContents),
|
||||
});
|
||||
} catch (error) {
|
||||
throw {
|
||||
|
@ -43,6 +43,7 @@ plain old JSON in Elm.
|
||||
-}
|
||||
|
||||
import DataSource exposing (DataSource)
|
||||
import DataSource.File
|
||||
import DataSource.Http
|
||||
import DataSource.Internal.Request
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
@ -273,7 +274,14 @@ The Decode will strip off any unused JSON data.
|
||||
-}
|
||||
jsonFile : Decoder a -> String -> DataSource a
|
||||
jsonFile jsonFileDecoder filePath =
|
||||
read filePath (Decode.field "jsonFile" jsonFileDecoder)
|
||||
rawFile filePath
|
||||
|> DataSource.andThen
|
||||
(\jsonString ->
|
||||
jsonString
|
||||
|> Decode.decodeString jsonFileDecoder
|
||||
|> Result.mapError Decode.errorToString
|
||||
|> DataSource.fromResult
|
||||
)
|
||||
|
||||
|
||||
{-| Gives us the file's content without stripping off frontmatter.
|
||||
|
Loading…
Reference in New Issue
Block a user