Repository navigation
Enhancement: Static site generation #22
Copy link
Copy link
Open
Description
Activity
Most features of HCE (cross-package 'go to definition', 'find references', identifier search,...) rely on server-side logic, so currently it's not possible to deploy the app as a collection of static files.
The server (
app/Server.hs) responds to HTTP requests from the JS app. There are 11 HTTP endpoints:3 endpoints are "static": the server simply sends a file. 8 endpoints are "dynamic": the server needs to do multiple lookups in an in-memory data structures and to paginate the results if needed.haskell-code-explorer/javascript/app/utils/api-urls.js
Lines 18 to 50 in d65f021
export const urls = { packageInfoUrl : function(packageId) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/packageInfo.json"; }, fileUrl : function(packageId,filePath) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+filePath; }, haskellModuleUrl : function (packageId,filePath) { return config.APP.staticUrlPrefix+"/"+packageId+"/"+config.APP.haskellCodeExplorerDirectory+"/"+encodeURIComponent(encodeURIComponent(filePath))+ ".json"; }, packagesUrl : config.APP.apiUrlPrefix + "/packages", identifierDefinitionSiteUrl : function(packageId,moduleName,componentId,entity,name) { return config.APP.apiUrlPrefix + "/definitionSite/" + packageId+"/"+componentId+"/"+moduleName+"/"+entity+"/"+fixDots(encodeURIComponent(name)); }, modulePathUrl : function (packageId,moduleName,componentId) { return config.APP.apiUrlPrefix + "/modulePath/"+packageId+"/"+componentId+"/"+moduleName; }, expressionsUrl : function (packageId,modulePath,lineStart,columnStart,lineEnd,columnEnd) { return config.APP.apiUrlPrefix + "/expressions/"+packageId+"/"+encodeURIComponent(modulePath) +"/"+lineStart+"/"+columnStart+"/"+lineEnd+"/"+columnEnd; }, referencesUrl : function (packageId,externalId) { return config.APP.apiUrlPrefix + "/references/"+packageId+"/"+encodeURIComponent(externalId); }, identifierSearchUrl : function (packageId,query) { return config.APP.apiUrlPrefix + "/identifiers/"+packageId+"/"+fixDots(encodeURIComponent(query)); }, globalReferencesUrl : function (externalId) { return config.APP.apiUrlPrefix + "/globalReferences/"+encodeURIComponent(externalId); }, globalIdentifiersUrl : function (query) { return config.APP.apiUrlPrefix + "/globalIdentifiers/"+fixDots(encodeURIComponent(query)); } } In principle, it's possible to create a version of HCE without features that require server-side logic, but I'm not sure if such a limited version will be useful.
Metadata
Metadata
Assignees
Labels
No labels
I'd love to index a package set and host the results on e.g. Github's static site feature. Is that at all realistic? I see that the
app/folder contains quite a bit of server code, so this might be out of reach.