From 07895d8c3fa303f45eab7e1d22da32ee772596a9 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Sun, 8 Sep 2019 09:57:29 -0700 Subject: [PATCH] Remove code for generating unused url parser. --- generator/src/elm-file-constants.js | 2 -- generator/src/generate-records.js | 24 ------------------------ 2 files changed, 26 deletions(-) diff --git a/generator/src/elm-file-constants.js b/generator/src/elm-file-constants.js index 0794fb41..a5d344d1 100644 --- a/generator/src/elm-file-constants.js +++ b/generator/src/elm-file-constants.js @@ -10,8 +10,6 @@ ${staticRoutes.allRoutes} ${staticRoutes.routeRecord} -${staticRoutes.urlParser} - ${staticRoutes.imageAssetsRecord} allImages : List (Path PathKey Path.ToImage) diff --git a/generator/src/generate-records.js b/generator/src/generate-records.js index efd50434..41b847b4 100644 --- a/generator/src/generate-records.js +++ b/generator/src/generate-records.js @@ -62,7 +62,6 @@ function generate(scanned) { var routeRecord = {}; var allRoutes = []; - var urlParser = []; var routeToMetadata = []; var routeToExt = []; var routeToSource = []; @@ -85,19 +84,15 @@ function generate(scanned) { if (!is404) { captureRouteRecord(pathFragments, elmType, routeRecord); allRoutes.push(elmType); - urlParser.push(formatUrlParser(elmType, pathFragments)); // routeToMetadata.push(formatCaseInstance(elmType, scanned[i].metadata)); // routeToExt.push(formatCaseInstance(elmType, ext)); // routeToSource.push(formatCaseInstance(elmType, scanned[i].path)); } } return { - exposing: "(simple, Route, all, pages, urlParser, routeToString, assets)", // routes: toFlatRouteType(allRoutes), allRoutes: formatAsElmList("all", allRoutes), routeRecord: toElmRecord("pages", routeRecord, true), - urlParser: formatAsElmUrlParser(urlParser), - // urlToString: formatAsElmUrlToString(urlParser), // routeToMetadata: formatCaseStatement("toMetadata", routeToMetadata), // routeToDocExtension: formatCaseStatement("toExt", routeToExt), // routeToSource: formatCaseStatement("toSourcePath", routeToSource), @@ -233,17 +228,6 @@ ${name} route = ${branches.join("\n\n")}`; } -function formatUrlParser(elmType, filepathPieces) { - const urlParser = filepathPieces.map(literalUrl).join(" "); - - const urlStringList = filepathPieces.map(quote).join(", "); - - return { - toString: ` ${elmType} ->\n Url.Builder.absolute [ ${urlStringList} ] []`, - parser: `Url.map ${elmType} (${urlParser})` - }; -} - function formatAsElmUrlToString(pieces) { var toString = pieces.map(p => p.toString).join("\n\n"); @@ -252,11 +236,3 @@ routeToString route = case route of ${toString} `; } - -function formatAsElmUrlParser(pieces) { - var parser = - " [ " + pieces.map(p => p.parser).join("\n , ") + "\n ]"; - - return `urlParser : Url.Parser (Path PathKey Path.ToPage -> a) a -urlParser =\n Url.oneOf\n ${parser} `; -}