Add ".es" to recognised ECMAScript extensions

* Add ".es" to recognised JavaScript extensions
* Add heuristic to differentiate Erlang from ECMAScript
* Add test-case for .es heuristic
This commit is contained in:
John Gardner
2016-03-30 06:36:13 +11:00
committed by Arfon Smith
parent 7c8bc8561d
commit 24b368a30c
8 changed files with 194 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
import axios from "axios";
export default {
async getIndex(prefix) {
const {data} = await axios.get((prefix || "") + "/index.json");
return data;
},
async getContent(path, prefix) {
const {data} = await axios.get((prefix || "") + "/" + path + ".json");
return data;
}
}

View File

@@ -0,0 +1,35 @@
import config from "../webpack.config";
import webpackDevMiddleware from "webpack-dev-middleware";
import webpackHot from "webpack-hot-middleware";
import webpack from "webpack";
import express from "express";
app.use(webpackDevMiddleware(compiler, {
noInfo: false,
quiet: false,
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
}));
app.get("/(:root).json", (req, resp) => {
resp.send(indexer.index(req.params.root));
});
export default function(){
const server = http.createServer(app);
server.listen(3000);
const wss = new WebSocketServer({server});
let id = 1;
wss.on("connection", (ws) => {
console.log("Hello", " world");
let wsId = id++;
sessions[wsId] = ws;
ws.on("close", () => {
delete sessions[wsId]
});
});
};