Skip to content
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

Enhancement: Static site generation #22

Open
langston-barrett opened this issue Feb 15, 2019 · 1 comment
Open

Enhancement: Static site generation #22

langston-barrett opened this issue Feb 15, 2019 · 1 comment

Comments

@langston-barrett
Copy link

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.

@alexwl
Copy link
Owner

alexwl commented Feb 16, 2019

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:

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));
}
}
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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants