Skip to content

Enhancement: Static site generation #22

Description

@langston-barrett

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.

Activity

  1. alexwl commented on Feb 16, 2019

    @alexwl
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions