diff --git a/node_modules/.bin/tiny-server b/node_modules/.bin/tiny-server deleted file mode 100644 index 712330c..0000000 --- a/node_modules/.bin/tiny-server +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../tiny-server/bin/index" "$@" -else - exec node "$basedir/../tiny-server/bin/index" "$@" -fi diff --git a/node_modules/.bin/tiny-server.cmd b/node_modules/.bin/tiny-server.cmd deleted file mode 100644 index 323f330..0000000 --- a/node_modules/.bin/tiny-server.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\tiny-server\bin\index" %* diff --git a/node_modules/.bin/tiny-server.ps1 b/node_modules/.bin/tiny-server.ps1 deleted file mode 100644 index ed7cc4b..0000000 --- a/node_modules/.bin/tiny-server.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../tiny-server/bin/index" $args - } else { - & "$basedir/node$exe" "$basedir/../tiny-server/bin/index" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../tiny-server/bin/index" $args - } else { - & "node$exe" "$basedir/../tiny-server/bin/index" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index b282be4..0000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "performance-bug-unmuted-window", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/tiny-server": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tiny-server/-/tiny-server-1.1.1.tgz", - "integrity": "sha512-UZdFJFqms0+mvWOs1LRuf2C/ONjERZvaAXXyvqHXGGZtFeFUfeunmVi7OFdI8OgCiBUM1Rq+BfYJ2guVUeXnUg==", - "bin": { - "tiny-server": "bin/index" - } - } - } -} diff --git a/node_modules/tiny-server/README.md b/node_modules/tiny-server/README.md deleted file mode 100644 index 4bd6497..0000000 --- a/node_modules/tiny-server/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# tiny-server - -A tiny Web Server - - -## Install - -You can install to global - -```shell -npm install -g tiny-server -``` - -or as a module - -```shell -npm install tiny-server -``` - - -## Usage - -### global - -```shell -tiny-server -``` - -It will use terminal's current working directory as the web server's root directory. -And the server's port is 3000. - -You can specify a path as web server's root directory: - -```shell -tiny-server ./www -``` - -You can export environment `PORT` value as the server's port: - -```shell -export PORT=3001 && tiny-server; -``` - diff --git a/node_modules/tiny-server/bin/index b/node_modules/tiny-server/bin/index deleted file mode 100644 index 5d01018..0000000 --- a/node_modules/tiny-server/bin/index +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env node - -var Server = require("../lib/server"); - -var argv = process.argv.slice(2); - -var cwd = argv[0] || process.cwd(); - -var port = process.env["PORT"] || 3000; - -var server = new Server(cwd); - -server.listen(port, function () { - console.log("============= start ============"); - console.log(cwd); - console.log("http://localhost:" + port); -}).once("error", function (err) { - if (err.code === "EADDRINUSE") { - console.log("=============== ERROR ==============="); - console.error("Port: " + port + " already in use"); - console.log("====================================="); - } - process.exit(1); -}); diff --git a/node_modules/tiny-server/index.js b/node_modules/tiny-server/index.js deleted file mode 100644 index 9164f12..0000000 --- a/node_modules/tiny-server/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/server"); diff --git a/node_modules/tiny-server/lib/detect.js b/node_modules/tiny-server/lib/detect.js deleted file mode 100644 index 0dafed7..0000000 --- a/node_modules/tiny-server/lib/detect.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = function () { - var unknowMIMEType = "application/octet-stream"; - var mimeTypes = new Map([ - ["txt", "text/plain"], - ["htm", "text/html"], - ["html", "text/html"], - ["xml", "text/xml"], - ["css", "text/css"], - ["js", "application/javascript"], - ["json", "application/json"], - - ["mp3", "audio/mpeg"], - ["wav", "audio/wav"], - - ["gif", "image/gif"], - ["jpg", "image/jpeg"], - ["jpeg", "image/jpeg"], - ["png", "image/png"], - ["bmp", "image/bmp"], - ["svg", "image/svg+xml"], - - ["avi", "video/avi"], - ["mp4", "video/mpeg"], - ]); - - return function (ext) { - if (!ext || typeof ext !== "string") { - return unknowMIMEType; - } - if (/^\./.test(ext)) { - ext = ext.slice(1); - } - - ext = ext.toLowerCase(); - - if (mimeTypes.has(ext)) { - return mimeTypes.get(ext); - } else { - return unknowMIMEType; - } - }; -}; diff --git a/node_modules/tiny-server/lib/mime.js b/node_modules/tiny-server/lib/mime.js deleted file mode 100644 index 1c4f6a7..0000000 --- a/node_modules/tiny-server/lib/mime.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -var detect = require("./detect")(); - -module.exports = function () { - var mimeTypes = new Map(); - var unknowMIMEType = "application/octet-stream"; - - return function (ext) { - if (!ext) { - return unknowMIMEType; - } - if (mimeTypes.has(ext)) { - return mimeTypes.get(ext); - } else { - var mimeType = detect(ext); - if (!mimeType) { - mimeType = unknowMIMEType; - } - mimeTypes.set(ext, mimeType); - return mimeType; - } - }; -}; diff --git a/node_modules/tiny-server/lib/server.js b/node_modules/tiny-server/lib/server.js deleted file mode 100644 index a235a5d..0000000 --- a/node_modules/tiny-server/lib/server.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -var fs = require("fs"); -var http = require("http"); -var path = require("path"); -var querystring = require("querystring"); -var stream = require("stream"); -var util = require("util"); -var url = require("url"); - -var mime = require("./mime")(); - -var Server = function Server(cwd, middlewares) { - if (!(this instanceof Server)) { - return new Server(cwd, middlewares); - } - if (!cwd) { - cwd = process.cwd(); - } - if (typeof middlewares === "function") { - middlewares = [middlewares]; - } else if (!Array.isArray(middlewares)) { - middlewares = []; - } - - http.Server.call(this); - - this.cwd = cwd; - this.middlewares = middlewares; - - var requestHandler = this.handler.bind(this); - this.on("request", requestHandler); - this.once("close", function () { - this.removeListener("request", requestHandler); - }); -}; -util.inherits(Server, http.Server); - -Server.prototype.handler = function (req, res) { - - var pathname = url.parse(req.url).pathname; - var filename = path.join(this.cwd, path.normalize(querystring.unescape(pathname))); - - var that = this; - fs.exists(filename, function (exists) { - if (exists) { - fs.stat(filename, function (err, stats) { - if (err) { - return that.notFound(res); - } - if (stats.isFile()) { - var ext = path.extname(filename); - var mimeType = mime(ext); - res.writeHead(200, { - "Content-Type": mimeType, - "Access-Control-Allow-Origin": "*" - }); - fs.createReadStream(filename).pipe(res); - } else if (stats.isDirectory()) { - if (!/\/$/.test(pathname)) { - res.writeHead(301, { - "Location": path.join(pathname, "/") - }); - res.end(); - return; - } - fs.readdir(filename, function (err, files) { - if (err) { - return that.notFound(res); - } - - var len = files.length; - if (!len) { - dir(files); - return; - } - - var items = []; - - files.forEach(function (file) { - fs.stat(path.join(filename, file), function (err, stats) { - if (!err) { - items.push(stats.isDirectory() ? path.join(file, "/") : file); - } - --len; - if (!len) { - dir(items); - } - }); - }); - - function dir(files) { - res.writeHead(200, { - "Content-Type": "text/html", - "Access-Control-Allow-Origin": "*" - }); - res.end(["", - '', - '', - ' ', - ' ', - ' ', - ' Index of ' + pathname + '', - ' ', - ' ', - '

Index of ' + pathname + '

', - '
', - ' ', - '
', - ' ', - '', - ""].join("\n")); - } - }); - - } else { - that.notFound(res); - } - }); - } else { - that.notFound(res); - } - }); - -}; -Server.prototype.notFound = function (res) { - res.writeHead(404, { - "Content-Type": "text/html", - "Access-Control-Allow-Origin": "*" - }); - - var file = path.join(this.cwd, "404.html"); - fs.exists(file, function (exists) { - if (exists) { - fs.createReadStream(file).pipe(res); - } else { - default404Reader().pipe(res); - } - }); - - function default404Reader() { - var f404 = new stream.Readable(); - f404._read = function () { - - this.push(["", - '', - '', - ' ', - ' ', - ' Not Found!', - ' ', - ' ', - '

File Not Found!

', - ' ', - '', - ""].join("\n")); - this.push(null); - - }; - return f404; - } -}; - - -module.exports = Server; diff --git a/node_modules/tiny-server/package.json b/node_modules/tiny-server/package.json deleted file mode 100644 index 4688c6b..0000000 --- a/node_modules/tiny-server/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "tiny-server", - "version": "1.1.1", - "description": "a tiny Web Server", - "main": "index.js", - "scripts": { - "test": "mocha ./test/index.js" - }, - "bin": { - "tiny-server": "./bin/index" - }, - "keywords": [ - "http", - "web", - "server", - "tiny" - ], - "author": "zbinlin", - "license": "MIT", - "directories": { - "test": "test" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/zbinlin/tiny-server.git" - }, - "bugs": { - "url": "https://github.com/zbinlin/tiny-server/issues" - }, - "homepage": "https://github.com/zbinlin/tiny-server#readme", - "devDependencies": { - "mocha": "^10.0.0" - } -} diff --git a/node_modules/tiny-server/test/detect-test.js b/node_modules/tiny-server/test/detect-test.js deleted file mode 100644 index 1148648..0000000 --- a/node_modules/tiny-server/test/detect-test.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -var assert = require("assert"); - -var detect = require("../lib/detect")(); - -describe("test lib/detect", function () { - it("非法参数时,返回 application/octet-stream", function () { - assert.equal(detect(), "application/octet-stream"); - }); - it("扩展名不区别大小写", function () { - var mimeType = "text/plain"; - assert.equal(detect("txt"), mimeType); - assert.equal(detect("TXT"), mimeType); - }); - it("扩展名前可带 .,如 .txt", function () { - var mimeType = "text/plain"; - assert.equal(detect(".txt"), mimeType); - }); - it("未知扩展名,返回 application/octet-stream", function () { - assert.equal(detect(".xxx"), "application/octet-stream"); - }); -}); diff --git a/node_modules/tiny-server/test/index.js b/node_modules/tiny-server/test/index.js deleted file mode 100644 index 4d0799a..0000000 --- a/node_modules/tiny-server/test/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -require("./detect-test"); -require("./mime-test"); -require("./server-test"); diff --git a/node_modules/tiny-server/test/mime-test.js b/node_modules/tiny-server/test/mime-test.js deleted file mode 100644 index 3278c55..0000000 --- a/node_modules/tiny-server/test/mime-test.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -var assert = require("assert"); - -var mime = require("../lib/mime")(); - -describe("test lib/mime", function () { - it("非法参数时,返回 application/octet-stream", function () { - assert.equal(mime(), "application/octet-stream"); - }); - it(".txt 返回 text/plain", function () { - assert.equal(mime(".txt"), "text/plain"); - assert.equal(mime(".txt"), "text/plain"); - }); - it("未知扩展名,返回 application/octet-stream", function () { - assert.equal(mime(".xxx"), "application/octet-stream"); - }); -}); - diff --git a/node_modules/tiny-server/test/server-test.js b/node_modules/tiny-server/test/server-test.js deleted file mode 100644 index e69de29..0000000