@liascript/devserver 1.0.5--0.9.49 β 1.0.5--0.9.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/views/main.hbs +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QCba":[function(require,module,exports) {
|
|
3
|
-
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),require("dotenv").config();var o=e(require("express")),r=o.default(),t=e(require("open")),i=e(require("fs")),s=e(require("path")),n=require("cors"),l=require("express-handlebars"),a=require("minimist")(process.argv.slice(2)),c=require("ip"),d=s.default.normalize(__dirname+"/../node_modules/@liascript/editor/dist"),p=s.default.normalize(__dirname+"/../node_modules/reloadsh.js/reloader.browser.js");function u(){console.log(" _ _ ____ _ _"),console.log("| | (_) __ _/ ___| ___ _ __(_)_ __ | |_"),console.log("| | | |/ _` \\___ \\ / __| '__| | '_ \\| __|"),console.log("| |___| | (_| |___) | (__| | | | |_) | |_ "),console.log("|_____|_|\\__,_|____/ \\___|_| |_| .__/ \\__|"),console.log(" |_|"),console.log()}(a.v||a.version)&&(console.log("DevServer: 1.0.5"),console.log("LiaScript: 0.9.
|
|
3
|
+
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),require("dotenv").config();var o=e(require("express")),r=o.default(),t=e(require("open")),i=e(require("fs")),s=e(require("path")),n=require("cors"),l=require("express-handlebars"),a=require("minimist")(process.argv.slice(2)),c=require("ip"),d=s.default.normalize(__dirname+"/../node_modules/@liascript/editor/dist"),p=s.default.normalize(__dirname+"/../node_modules/reloadsh.js/reloader.browser.js");function u(){console.log(" _ _ ____ _ _"),console.log("| | (_) __ _/ ___| ___ _ __(_)_ __ | |_"),console.log("| | | |/ _` \\___ \\ / __| '__| | '_ \\| __|"),console.log("| |___| | (_| |___) | (__| | | | |_) | |_ "),console.log("|_____|_|\\__,_|____/ \\___|_| |_| .__/ \\__|"),console.log(" |_|"),console.log()}(a.v||a.version)&&(console.log("DevServer: 1.0.5"),console.log("LiaScript: 0.9.51"),process.exit()),(a.h||a.help)&&(u(),console.log("-h --help show this help"),console.log("-v --version show version information"),console.log("-i --input input README.md file or folder (default: .)"),console.log("-n --hostname hostname of your server (default: localhost)"),console.log("-p --port used port number (default: 3000)"),console.log("-l --live do live reload on file change"),console.log("-o --open open in default browser"),console.log("-t --test test online on https://LiaScript.github.io"),console.log(),console.log("-r --responsiveVoice add optional responsiveVoice support,"),console.log(" or pass your own responsiveVoice key."),console.log(" Adding this feature might slow down"),console.log(" the reloading speed."),console.log(" For more information visit:"),console.log(" https://responsivevoice.org"),process.exit());var _,h=a.p||a.port||3e3,f=a.n||a.hostname||"localhost",m=a.o||a.open,g=a.i||a.input||".",v=a.l||a.live||!1,y=a.t||a.test;if(a.r||a.responsiveVoice){var x=a.r||a.responsiveVoice;_="string"==typeof x?x:process.env.RESPONSIVE_VOICE_KEY}var w={path:null,readme:null};if(g){var j=i.default.lstatSync(g);j.isDirectory()?w.path=g:j.isFile()&&(w.path=s.default.dirname(g),w.readme=s.default.basename(g))}r.set("view engine","hbs"),r.engine("hbs",l({layoutsDir:s.default.normalize(__dirname+"/../views/layouts"),defaultLayout:"main",extname:"hbs"})),r.set("views",s.default.normalize(__dirname+"/../views")),r.get("/",function(e,o){o.redirect("/home")}),r.get("/home*",function(e,o){var r=w.path+"/"+e.params[0],t=i.default.lstatSync(r);if(t.isDirectory()){for(var s=i.default.readdirSync(r).filter(function(e){return"."!==e[0]}),n="/home",l=e.params[0].split("/").filter(function(e){return""!==e}),a=[],c=0;c<l.length;c++)n+="/"+l[c],a.push({name:l[c],href:n});o.render("main",{layout:"index",path:a,file:s.map(function(o){return{name:o,href:"http://"+f+":"+h+"/home"+e.params[0]+"/"+o,isDirectory:i.default.lstatSync(r+"/"+o).isDirectory()}}).sort(function(e,o){return e.isDirectory&&!o.isDirectory?-1:!e.isDirectory&&o.isDirectory?1:e.name.toLocaleLowerCase()<o.name.toLocaleLowerCase()?-1:1})})}else t.isFile()?e.params[0].toLocaleLowerCase().endsWith(".md")?y?o.redirect("https://LiaScript.github.io/course/?http://"+f+":"+h+"/"+e.params[0]):o.redirect("/liascript/index.html?http://"+f+":"+h+"/"+e.params[0]):o.sendFile(e.params[0],{root:w.path}):o.send("ups, something went wrong")}),r.get("/liascript/",function(e,o){o.redirect("/liascript/index.html")}),r.get("/liascript/index.html",function(e,o){v&&_?i.default.readFile(d+"/index.html","utf8",function(e,r){o.send(r.replace("</head>","<script type='text/javascript' src='/reloader/reloader.js'><\/script>\n <script type='text/javascript' src='https://code.responsivevoice.org/responsivevoice.js?key="+_+"'><\/script>\n </head>"))}):v?i.default.readFile(d+"/index.html","utf8",function(e,r){o.send(r.replace("</head>","<script type='text/javascript' src='/reloader/reloader.js'><\/script></head>"))}):_?i.default.readFile(d+"/index.html","utf8",function(e,r){o.send(r.replace("</head>","<script type='text/javascript' src='https://code.responsivevoice.org/responsivevoice.js?key="+_+"'><\/script></head>"))}):o.sendFile(d+"/index.html")}),r.get("/liascript/*",function(e,o){o.sendFile(e.params[0],{root:d})}),r.get("/sw.js",function(e,o){}),r.get("/favicon.ico",function(e,o){}),r.get("/reloader/reloader.js",function(e,o){o.sendFile(p)}),r.get("/*",n(),function(e,o){o.sendFile(e.originalUrl,{root:w.path})});var b="http://"+f+":"+h;w.path&&w.readme&&(b+="/liascript/index.html?http://"+f+":"+h+"/"+w.readme),y&&w.readme&&(b="https://LiaScript.github.io/course/?http://"+f+":"+h+"/"+w.readme),u();var D=require("reloadsh.js")(r,v?[s.default.join(w.path,w.readme||"")]:[]);v&&console.log('β¨ watching for changes on: "'+s.default.join(w.path,w.readme||"")+'"'),D.on("error",function(e){console.error("π¨ error =>",e.message),process.exit()}),D.listen(h),m&&t.default(b),console.log("π‘ starting server"),console.log(" - local: "+b),console.log(" - on your network: "+b.replace(b,c.address())),console.log("β¨ hit Ctrl-c to close the server");
|
|
4
4
|
},{}]},{},["QCba"], null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liascript/devserver",
|
|
3
|
-
"version": "1.0.5--0.9.
|
|
3
|
+
"version": "1.0.5--0.9.51",
|
|
4
4
|
"description": "Run a development server for LiaScript locally",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "AndrΓ© Dietrich",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@liascript/editor": "^1.0.4--0.9.
|
|
33
|
+
"@liascript/editor": "^1.0.4--0.9.51",
|
|
34
34
|
"cors": "^2.8.5",
|
|
35
35
|
"dotenv": "^5.0.1",
|
|
36
36
|
"express": "^4.17.1",
|