mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
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:
committed by
Arfon Smith
parent
7c8bc8561d
commit
24b368a30c
13
samples/JavaScript/axios.es
Normal file
13
samples/JavaScript/axios.es
Normal 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;
|
||||
}
|
||||
}
|
||||
35
samples/JavaScript/index.es
Normal file
35
samples/JavaScript/index.es
Normal 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]
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user