1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-11-23 17:50:19 +01:00

Refactored static files compression

This commit is contained in:
zneix 2020-08-26 16:04:20 +02:00
parent c585e3b815
commit 78aabf90bb
7 changed files with 968 additions and 367 deletions

2
.gitignore vendored
View file

@ -7,4 +7,4 @@ data
*.DS_Store *.DS_Store
npm-debug.log npm-debug.log
static/application.min.js static/*.min.js

663
package-lock.json generated
View file

@ -1,9 +1,286 @@
{ {
"name": "haste", "name": "haste",
"version": "0.1.0", "version": "0.2.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@babel/code-frame": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
"requires": {
"@babel/highlight": "^7.10.4"
}
},
"@babel/core": {
"version": "7.11.4",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.4.tgz",
"integrity": "sha512-5deljj5HlqRXN+5oJTY7Zs37iH3z3b++KjiKtIsJy1NrjOOVSEaJHEetLBhyu0aQOSNNZ/0IuEAan9GzRuDXHg==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/generator": "^7.11.4",
"@babel/helper-module-transforms": "^7.11.0",
"@babel/helpers": "^7.10.4",
"@babel/parser": "^7.11.4",
"@babel/template": "^7.10.4",
"@babel/traverse": "^7.11.0",
"@babel/types": "^7.11.0",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
"json5": "^2.1.2",
"lodash": "^4.17.19",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
}
}
},
"@babel/generator": {
"version": "7.11.4",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.4.tgz",
"integrity": "sha512-Rn26vueFx0eOoz7iifCN2UHT6rGtnkSGWSoDRIy8jZN3B91PzeSULbswfLoOWuTuAcNwpG/mxy+uCTDnZ9Mp1g==",
"requires": {
"@babel/types": "^7.11.0",
"jsesc": "^2.5.1",
"source-map": "^0.5.0"
}
},
"@babel/helper-function-name": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
"integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
"requires": {
"@babel/helper-get-function-arity": "^7.10.4",
"@babel/template": "^7.10.4",
"@babel/types": "^7.10.4"
}
},
"@babel/helper-get-function-arity": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
"integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
"requires": {
"@babel/types": "^7.10.4"
}
},
"@babel/helper-member-expression-to-functions": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz",
"integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==",
"requires": {
"@babel/types": "^7.11.0"
}
},
"@babel/helper-module-imports": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz",
"integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==",
"requires": {
"@babel/types": "^7.10.4"
}
},
"@babel/helper-module-transforms": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz",
"integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==",
"requires": {
"@babel/helper-module-imports": "^7.10.4",
"@babel/helper-replace-supers": "^7.10.4",
"@babel/helper-simple-access": "^7.10.4",
"@babel/helper-split-export-declaration": "^7.11.0",
"@babel/template": "^7.10.4",
"@babel/types": "^7.11.0",
"lodash": "^4.17.19"
}
},
"@babel/helper-optimise-call-expression": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz",
"integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==",
"requires": {
"@babel/types": "^7.10.4"
}
},
"@babel/helper-replace-supers": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz",
"integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==",
"requires": {
"@babel/helper-member-expression-to-functions": "^7.10.4",
"@babel/helper-optimise-call-expression": "^7.10.4",
"@babel/traverse": "^7.10.4",
"@babel/types": "^7.10.4"
}
},
"@babel/helper-simple-access": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz",
"integrity": "sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw==",
"requires": {
"@babel/template": "^7.10.4",
"@babel/types": "^7.10.4"
}
},
"@babel/helper-split-export-declaration": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz",
"integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==",
"requires": {
"@babel/types": "^7.11.0"
}
},
"@babel/helper-validator-identifier": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
"integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw=="
},
"@babel/helpers": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.4.tgz",
"integrity": "sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA==",
"requires": {
"@babel/template": "^7.10.4",
"@babel/traverse": "^7.10.4",
"@babel/types": "^7.10.4"
}
},
"@babel/highlight": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
"integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
"requires": {
"@babel/helper-validator-identifier": "^7.10.4",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"@babel/parser": {
"version": "7.11.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.11.4.tgz",
"integrity": "sha512-MggwidiH+E9j5Sh8pbrX5sJvMcsqS5o+7iB42M9/k0CD63MjYbdP4nhSh7uB5wnv2/RVzTZFTxzF/kIa5mrCqA=="
},
"@babel/template": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz",
"integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/parser": "^7.10.4",
"@babel/types": "^7.10.4"
}
},
"@babel/traverse": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.11.0.tgz",
"integrity": "sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg==",
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/generator": "^7.11.0",
"@babel/helper-function-name": "^7.10.4",
"@babel/helper-split-export-declaration": "^7.11.0",
"@babel/parser": "^7.11.0",
"@babel/types": "^7.11.0",
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "^4.17.19"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"@babel/types": {
"version": "7.11.0",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz",
"integrity": "sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA==",
"requires": {
"@babel/helper-validator-identifier": "^7.10.4",
"lodash": "^4.17.19",
"to-fast-properties": "^2.0.0"
}
},
"@dabh/diagnostics": { "@dabh/diagnostics": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
@ -100,6 +377,244 @@
"lru-cache": "^4.0.0" "lru-cache": "^4.0.0"
} }
}, },
"babel-helper-evaluate-path": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.5.0.tgz",
"integrity": "sha512-mUh0UhS607bGh5wUMAQfOpt2JX2ThXMtppHRdRU1kL7ZLRWIXxoV2UIV1r2cAeeNeU1M5SB5/RSUgUxrK8yOkA=="
},
"babel-helper-flip-expressions": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz",
"integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0="
},
"babel-helper-is-nodes-equiv": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz",
"integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ="
},
"babel-helper-is-void-0": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz",
"integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4="
},
"babel-helper-mark-eval-scopes": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz",
"integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI="
},
"babel-helper-remove-or-void": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz",
"integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA="
},
"babel-helper-to-multiple-sequence-expressions": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.5.0.tgz",
"integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA=="
},
"babel-minify": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-minify/-/babel-minify-0.5.1.tgz",
"integrity": "sha512-ftEYu5OCDXEqaX/eINIaekPgkCaVPJNwFHzXKKARnRLggK8g4a9dEOflLKDgRNYOwhcLVoicUchZG6FYyOpqSA==",
"requires": {
"@babel/core": "^7.1.0",
"babel-preset-minify": "^0.5.1",
"fs-readdir-recursive": "^1.1.0",
"lodash": "^4.17.11",
"mkdirp": "^0.5.1",
"util.promisify": "^1.0.0",
"yargs-parser": "^10.0.0"
},
"dependencies": {
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0="
},
"yargs-parser": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz",
"integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==",
"requires": {
"camelcase": "^4.1.0"
}
}
}
},
"babel-plugin-minify-builtins": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz",
"integrity": "sha512-wpqbN7Ov5hsNwGdzuzvFcjgRlzbIeVv1gMIlICbPj0xkexnfoIDe7q+AZHMkQmAE/F9R5jkrB6TLfTegImlXag=="
},
"babel-plugin-minify-constant-folding": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.5.0.tgz",
"integrity": "sha512-Vj97CTn/lE9hR1D+jKUeHfNy+m1baNiJ1wJvoGyOBUx7F7kJqDZxr9nCHjO/Ad+irbR3HzR6jABpSSA29QsrXQ==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0"
}
},
"babel-plugin-minify-dead-code-elimination": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.1.tgz",
"integrity": "sha512-x8OJOZIrRmQBcSqxBcLbMIK8uPmTvNWPXH2bh5MDCW1latEqYiRMuUkPImKcfpo59pTUB2FT7HfcgtG8ZlR5Qg==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-mark-eval-scopes": "^0.4.3",
"babel-helper-remove-or-void": "^0.4.3",
"lodash": "^4.17.11"
}
},
"babel-plugin-minify-flip-comparisons": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz",
"integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=",
"requires": {
"babel-helper-is-void-0": "^0.4.3"
}
},
"babel-plugin-minify-guarded-expressions": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.4.tgz",
"integrity": "sha512-RMv0tM72YuPPfLT9QLr3ix9nwUIq+sHT6z8Iu3sLbqldzC1Dls8DPCywzUIzkTx9Zh1hWX4q/m9BPoPed9GOfA==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-flip-expressions": "^0.4.3"
}
},
"babel-plugin-minify-infinity": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz",
"integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco="
},
"babel-plugin-minify-mangle-names": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.5.0.tgz",
"integrity": "sha512-3jdNv6hCAw6fsX1p2wBGPfWuK69sfOjfd3zjUXkbq8McbohWy23tpXfy5RnToYWggvqzuMOwlId1PhyHOfgnGw==",
"requires": {
"babel-helper-mark-eval-scopes": "^0.4.3"
}
},
"babel-plugin-minify-numeric-literals": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz",
"integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw="
},
"babel-plugin-minify-replace": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.5.0.tgz",
"integrity": "sha512-aXZiaqWDNUbyNNNpWs/8NyST+oU7QTpK7J9zFEFSA0eOmtUNMU3fczlTTTlnCxHmq/jYNFEmkkSG3DDBtW3Y4Q=="
},
"babel-plugin-minify-simplify": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.5.1.tgz",
"integrity": "sha512-OSYDSnoCxP2cYDMk9gxNAed6uJDiDz65zgL6h8d3tm8qXIagWGMLWhqysT6DY3Vs7Fgq7YUDcjOomhVUb+xX6A==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-flip-expressions": "^0.4.3",
"babel-helper-is-nodes-equiv": "^0.0.1",
"babel-helper-to-multiple-sequence-expressions": "^0.5.0"
}
},
"babel-plugin-minify-type-constructors": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz",
"integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=",
"requires": {
"babel-helper-is-void-0": "^0.4.3"
}
},
"babel-plugin-transform-inline-consecutive-adds": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz",
"integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE="
},
"babel-plugin-transform-member-expression-literals": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz",
"integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8="
},
"babel-plugin-transform-merge-sibling-variables": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz",
"integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4="
},
"babel-plugin-transform-minify-booleans": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz",
"integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg="
},
"babel-plugin-transform-property-literals": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz",
"integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=",
"requires": {
"esutils": "^2.0.2"
}
},
"babel-plugin-transform-regexp-constructors": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz",
"integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU="
},
"babel-plugin-transform-remove-console": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
"integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A="
},
"babel-plugin-transform-remove-debugger": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz",
"integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI="
},
"babel-plugin-transform-remove-undefined": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.5.0.tgz",
"integrity": "sha512-+M7fJYFaEE/M9CXa0/IRkDbiV3wRELzA1kKQFCJ4ifhrzLKn/9VCCgj9OFmYWwBd8IB48YdgPkHYtbYq+4vtHQ==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0"
}
},
"babel-plugin-transform-simplify-comparison-operators": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz",
"integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk="
},
"babel-plugin-transform-undefined-to-void": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz",
"integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA="
},
"babel-preset-minify": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.5.1.tgz",
"integrity": "sha512-1IajDumYOAPYImkHbrKeiN5AKKP9iOmRoO2IPbIuVp0j2iuCcj0n7P260z38siKMZZ+85d3mJZdtW8IgOv+Tzg==",
"requires": {
"babel-plugin-minify-builtins": "^0.5.0",
"babel-plugin-minify-constant-folding": "^0.5.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
"babel-plugin-minify-flip-comparisons": "^0.4.3",
"babel-plugin-minify-guarded-expressions": "^0.4.4",
"babel-plugin-minify-infinity": "^0.4.3",
"babel-plugin-minify-mangle-names": "^0.5.0",
"babel-plugin-minify-numeric-literals": "^0.4.3",
"babel-plugin-minify-replace": "^0.5.0",
"babel-plugin-minify-simplify": "^0.5.1",
"babel-plugin-minify-type-constructors": "^0.4.3",
"babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
"babel-plugin-transform-member-expression-literals": "^6.9.4",
"babel-plugin-transform-merge-sibling-variables": "^6.9.4",
"babel-plugin-transform-minify-booleans": "^6.9.4",
"babel-plugin-transform-property-literals": "^6.9.4",
"babel-plugin-transform-regexp-constructors": "^0.4.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-remove-debugger": "^6.9.4",
"babel-plugin-transform-remove-undefined": "^0.5.0",
"babel-plugin-transform-simplify-comparison-operators": "^6.9.4",
"babel-plugin-transform-undefined-to-void": "^6.9.4",
"lodash": "^4.17.11"
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -361,6 +876,21 @@
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
}, },
"convert-source-map": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
"integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==",
"requires": {
"safe-buffer": "~5.1.1"
},
"dependencies": {
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}
}
},
"cookie": { "cookie": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
@ -394,7 +924,6 @@
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
"dev": true,
"requires": { "requires": {
"object-keys": "^1.0.12" "object-keys": "^1.0.12"
} }
@ -453,7 +982,6 @@
"version": "1.17.6", "version": "1.17.6",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
"integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
"dev": true,
"requires": { "requires": {
"es-to-primitive": "^1.2.1", "es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
@ -501,7 +1029,6 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
"integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
"dev": true,
"requires": { "requires": {
"is-callable": "^1.1.4", "is-callable": "^1.1.4",
"is-date-object": "^1.0.1", "is-date-object": "^1.0.1",
@ -525,6 +1052,11 @@
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true "dev": true
}, },
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
},
"etag": { "etag": {
"version": "1.8.1", "version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
@ -651,6 +1183,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
}, },
"fs-readdir-recursive": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
"integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA=="
},
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -667,8 +1204,12 @@
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"dev": true },
"gensync": {
"version": "1.0.0-beta.1",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz",
"integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg=="
}, },
"get-caller-file": { "get-caller-file": {
"version": "2.0.5", "version": "2.0.5",
@ -699,6 +1240,11 @@
"is-glob": "^4.0.1" "is-glob": "^4.0.1"
} }
}, },
"globals": {
"version": "11.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
},
"graceful-fs": { "graceful-fs": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
@ -715,7 +1261,6 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1" "function-bind": "^1.1.1"
} }
@ -729,8 +1274,7 @@
"has-symbols": { "has-symbols": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg=="
"dev": true
}, },
"he": { "he": {
"version": "1.2.0", "version": "1.2.0",
@ -812,14 +1356,12 @@
"is-callable": { "is-callable": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz",
"integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw=="
"dev": true
}, },
"is-date-object": { "is-date-object": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g=="
"dev": true
}, },
"is-extglob": { "is-extglob": {
"version": "2.1.1", "version": "2.1.1",
@ -864,7 +1406,6 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
"dev": true,
"requires": { "requires": {
"has-symbols": "^1.0.1" "has-symbols": "^1.0.1"
} }
@ -890,7 +1431,6 @@
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
"integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
"dev": true,
"requires": { "requires": {
"has-symbols": "^1.0.1" "has-symbols": "^1.0.1"
} }
@ -922,6 +1462,11 @@
"iterate-iterator": "^1.0.1" "iterate-iterator": "^1.0.1"
} }
}, },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
"js-yaml": { "js-yaml": {
"version": "3.14.0", "version": "3.14.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
@ -932,6 +1477,19 @@
"esprima": "^4.0.0" "esprima": "^4.0.0"
} }
}, },
"jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
},
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"requires": {
"minimist": "^1.2.5"
}
},
"kuler": { "kuler": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
@ -946,6 +1504,11 @@
"p-locate": "^5.0.0" "p-locate": "^5.0.0"
} }
}, },
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"log-symbols": { "log-symbols": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz",
@ -1025,6 +1588,19 @@
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"requires": {
"minimist": "^1.2.5"
}
},
"mocha": { "mocha": {
"version": "8.1.2", "version": "8.1.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.2.tgz", "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.2.tgz",
@ -1094,20 +1670,17 @@
"object-inspect": { "object-inspect": {
"version": "1.8.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
"integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA=="
"dev": true
}, },
"object-keys": { "object-keys": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
"dev": true
}, },
"object.assign": { "object.assign": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz",
"integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==",
"dev": true,
"requires": { "requires": {
"define-properties": "^1.1.2", "define-properties": "^1.1.2",
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
@ -1115,6 +1688,15 @@
"object-keys": "^1.0.11" "object-keys": "^1.0.11"
} }
}, },
"object.getownpropertydescriptors": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz",
"integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==",
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.0-next.1"
}
},
"on-finished": { "on-finished": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@ -1186,6 +1768,11 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true "dev": true
}, },
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
},
"path-to-regexp": { "path-to-regexp": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
@ -1405,6 +1992,14 @@
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"dev": true "dev": true
}, },
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"requires": {
"path-parse": "^1.0.6"
}
},
"safe-buffer": { "safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -1486,6 +2081,11 @@
"is-arrayish": "^0.3.1" "is-arrayish": "^0.3.1"
} }
}, },
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
},
"split": { "split": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
@ -1549,7 +2149,6 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz",
"integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==",
"dev": true,
"requires": { "requires": {
"define-properties": "^1.1.3", "define-properties": "^1.1.3",
"es-abstract": "^1.17.5" "es-abstract": "^1.17.5"
@ -1559,7 +2158,6 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
"integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==",
"dev": true,
"requires": { "requires": {
"define-properties": "^1.1.3", "define-properties": "^1.1.3",
"es-abstract": "^1.17.5" "es-abstract": "^1.17.5"
@ -1607,6 +2205,11 @@
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
}, },
"to-fast-properties": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
"integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
},
"to-regex-range": { "to-regex-range": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@ -1635,11 +2238,6 @@
"mime-types": "~2.1.24" "mime-types": "~2.1.24"
} }
}, },
"uglify-js": {
"version": "3.10.2",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.2.tgz",
"integrity": "sha512-GXCYNwqoo0MbLARghYjxVBxDCnU0tLqN7IPLdHHbibCb1NI5zBkU2EPcy/GaVxc0BtTjqyGXJCINe6JMR2Dpow=="
},
"unpipe": { "unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@ -1650,6 +2248,17 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
}, },
"util.promisify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz",
"integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==",
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.2",
"has-symbols": "^1.0.1",
"object.getownpropertydescriptors": "^2.1.0"
}
},
"utils-merge": { "utils-merge": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",

View file

@ -1,6 +1,6 @@
{ {
"name": "haste", "name": "haste",
"version": "0.2.0", "version": "0.2.1",
"description": "Private Pastebin Server - continued by zneix", "description": "Private Pastebin Server - continued by zneix",
"keywords": [ "keywords": [
"paste", "paste",
@ -15,6 +15,7 @@
}, },
"main": "server.js", "main": "server.js",
"dependencies": { "dependencies": {
"babel-minify": "^0.5.1",
"busboy": "^0.3.1", "busboy": "^0.3.1",
"express": "^4.17.1", "express": "^4.17.1",
"express-rate-limit": "^5.1.3", "express-rate-limit": "^5.1.3",
@ -22,7 +23,6 @@
"redis": "^3.0.2", "redis": "^3.0.2",
"redis-url": "^1.2.1", "redis-url": "^1.2.1",
"st": "^2.0.0", "st": "^2.0.0",
"uglify-js": "^3.10.2",
"winston": "^3.3.3" "winston": "^3.3.3"
}, },
"devDependencies": { "devDependencies": {

View file

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const winston = require('winston'); const winston = require('winston');
const uglify = require('uglify-js'); const minify = require('babel-minify');
const st = require('st'); const st = require('st');
const app = require('express')(); const app = require('express')();
const expressRateLimit = require('express-rate-limit'); const expressRateLimit = require('express-rate-limit');
@ -48,17 +48,17 @@ else {
//compress static javascript assets //compress static javascript assets
if (config.recompressStaticAssets){ if (config.recompressStaticAssets){
let files = fs.readdirSync('./static'); let files = fs.readdirSync('./static');
//https://regex101.com/r/5cJagJ/2
for (const file of files){ for (const file of files){
if ((file.indexOf('.js') == file.length - 3) && (file.indexOf('.min.js') == -1)){ let info = file.match(/^((.+)(?<!\.min)(\.js))$/);
let dest = `${file.substring(0, file.length - 3)}.min${file.substring(file.length - 3)}`; if (!info) continue;
let origCode = fs.readFileSync(`./static/${file}`, 'utf8'); const dest = `${info[2]}.min${info[3]}`;
const code = fs.readFileSync(`./static/${file}`, 'utf8');
fs.writeFileSync(`./static/${dest}`, uglify.minify(origCode).code, 'utf8'); const {code: newCode} = minify(code);
winston.info(`compressed ${file} into ${dest}`); fs.writeFileSync(`./static/${dest}`, newCode, 'utf8');
} winston.info(`compressed ${file} into ${dest}`);
} }
} }
//send the static documents into the preferred store, skipping expirations //send the static documents into the preferred store, skipping expirations
for (const name in config.documents){ for (const name in config.documents){
let path = config.documents[name]; let path = config.documents[name];

View file

@ -2,162 +2,158 @@
///// represents a single document ///// represents a single document
var haste_document = function() { let haste_document = function(){
this.locked = false; this.locked = false;
}; };
// Escapes HTML tag characters // Escapes HTML tag characters
haste_document.prototype.htmlEscape = function(s) { haste_document.prototype.htmlEscape = function(s){
return s return s
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
.replace(/>/g, '&gt;') .replace(/>/g, '&gt;')
.replace(/</g, '&lt;') .replace(/</g, '&lt;')
.replace(/"/g, '&quot;'); .replace(/"/g, '&quot;');
}; };
// Get this document from the server and lock it here // Get this document from the server and lock it here
haste_document.prototype.load = function(key, callback, lang) { haste_document.prototype.load = function(key, callback, lang){
var _this = this; let _this = this;
$.ajax('/documents/' + key, { $.ajax(`/documents/${key}`, {
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
success: function(res) { success: function(res){
_this.locked = true; _this.locked = true;
_this.key = key; _this.key = key;
_this.data = res.data; _this.data = res.data;
try { let high;
var high; try {
if (lang == 'txt') { if (lang == 'txt'){
high = { value: _this.htmlEscape(res.data) }; high = { value: _this.htmlEscape(res.data) };
} }
else if (lang) { else if (lang){
high = hljs.highlight(lang, res.data); high = hljs.highlight(lang, res.data);
} }
else { else {
high = hljs.highlightAuto(res.data); high = hljs.highlightAuto(res.data);
} }
} catch(err) { }
// failed highlight, fall back on auto catch(err){
high = hljs.highlightAuto(res.data); // failed highlight, fall back on auto
} high = hljs.highlightAuto(res.data);
callback({ }
value: high.value, callback({
key: key, value: high.value,
language: high.language || lang, key: key,
lineCount: res.data.split('\n').length language: high.language || lang,
}); lineCount: res.data.split('\n').length
}, });
error: function() { },
callback(false); error: function(){
} callback(false);
}); }
});
}; };
// Save this document to the server and lock it here // Save this document to the server and lock it here
haste_document.prototype.save = function(data, callback) { haste_document.prototype.save = function(data, callback){
if (this.locked) { if (this.locked) return false;
return false; this.data = data;
} let _this = this;
this.data = data; $.ajax('/documents', {
var _this = this; type: 'post',
$.ajax('/documents', { data: data,
type: 'post', dataType: 'json',
data: data, contentType: 'application/json; charset=utf-8',
dataType: 'json', success: function(res){
contentType: 'application/json; charset=utf-8', _this.locked = true;
success: function(res) { _this.key = res.key;
_this.locked = true; let high = hljs.highlightAuto(data);
_this.key = res.key; callback(null, {
var high = hljs.highlightAuto(data); value: high.value,
callback(null, { key: res.key,
value: high.value, language: high.language,
key: res.key, lineCount: data.split('\n').length
language: high.language, });
lineCount: data.split('\n').length },
}); error: function(res){
}, try {
error: function(res) { callback($.parseJSON(res.responseText));
try { }
callback($.parseJSON(res.responseText)); catch (e){
} callback({message: 'Something went wrong!'});
catch (e) { }
callback({message: 'Something went wrong!'}); }
} });
}
});
}; };
///// represents the paste application ///// represents the paste application
var haste = function(appName, options) { let haste = function(appName, options){
this.appName = appName; this.appName = appName;
this.$textarea = $('textarea'); this.$textarea = $('textarea');
this.$box = $('#box'); this.$box = $('#box');
this.$code = $('#box code'); this.$code = $('#box code');
this.$linenos = $('#linenos'); this.$linenos = $('#linenos');
this.options = options; this.options = options;
this.configureShortcuts(); this.configureShortcuts();
this.configureButtons(); this.configureButtons();
// If twitter is disabled, hide the button // If twitter is disabled, hide the button
if (!options.twitter) { if (!options.twitter) $('#box2 .twitter').hide();
$('#box2 .twitter').hide();
}
}; };
// Set the page title - include the appName // Set the page title - include the appName
haste.prototype.setTitle = function(ext) { haste.prototype.setTitle = function(ext){
var title = ext ? this.appName + ' - ' + ext : this.appName; document.title = `${this.appName}${ext ? ` - ${ext}` : ''}`;
document.title = title;
}; };
// Show a message box // Show a message box
haste.prototype.showMessage = function(msg, cls) { haste.prototype.showMessage = function(msg, cls){
var msgBox = $('<li class="'+(cls || 'info')+'">'+msg+'</li>'); let msgBox = $(`<li class="${cls || 'info'}">${msg}</li>`);
$('#messages').prepend(msgBox); $('#messages').prepend(msgBox);
setTimeout(function() { setTimeout(function(){
msgBox.slideUp('fast', function() { $(this).remove(); }); msgBox.slideUp('fast', function(){ $(this).remove(); });
}, 3000); }, 3000);
}; };
// Show the light key // Show the light key
haste.prototype.lightKey = function() { haste.prototype.lightKey = function(){
this.configureKey(['new', 'save']); this.configureKey(['new', 'save']);
}; };
// Show the full key // Show the full key
haste.prototype.fullKey = function() { haste.prototype.fullKey = function(){
this.configureKey(['new', 'duplicate', 'twitter', 'raw']); this.configureKey(['new', 'duplicate', 'twitter', 'raw']);
}; };
// Set the key up for certain things to be enabled // Set the key up for certain things to be enabled
haste.prototype.configureKey = function(enable) { haste.prototype.configureKey = enable => {
var $this, i = 0; let $this;
$('#box2 .function').each(function() { $('#box2 .function').each(function(){
$this = $(this); $this = $(this);
for (i = 0; i < enable.length; i++) { for (el of enable){
if ($this.hasClass(enable[i])) { if ($this.hasClass(el)){
$this.addClass('enabled'); $this.addClass('enabled');
return true; return true;
} }
} }
$this.removeClass('enabled'); $this.removeClass('enabled');
}); });
}; };
// Remove the current document (if there is one) // Remove the current document (if there is one)
// and set up for a new one // and set up for a new one
haste.prototype.newDocument = function(hideHistory) { haste.prototype.newDocument = function(hideHistory){
this.$box.hide(); this.$box.hide();
this.doc = new haste_document(); this.doc = new haste_document();
if (!hideHistory) { if (!hideHistory){
window.history.pushState(null, this.appName, '/'); window.history.pushState(null, this.appName, '/');
} }
this.setTitle(); this.setTitle();
this.lightKey(); this.lightKey();
this.$textarea.val('').show('fast', function() { this.$textarea.val('').show('fast', function(){
this.focus(); this.focus();
}); });
this.removeLineNumbers(); this.removeLineNumbers();
}; };
// Map of common extensions // Map of common extensions
@ -165,235 +161,231 @@ haste.prototype.newDocument = function(hideHistory) {
// due to the behavior of lookupTypeByExtension and lookupExtensionByType // due to the behavior of lookupTypeByExtension and lookupExtensionByType
// Note: optimized for lookupTypeByExtension // Note: optimized for lookupTypeByExtension
haste.extensionMap = { haste.extensionMap = {
rb: 'ruby', py: 'python', pl: 'perl', php: 'php', scala: 'scala', go: 'go', rb: 'ruby', py: 'python', pl: 'perl', php: 'php', scala: 'scala', go: 'go',
xml: 'xml', html: 'xml', htm: 'xml', css: 'css', js: 'javascript', vbs: 'vbscript', xml: 'xml', html: 'xml', htm: 'xml', css: 'css', js: 'javascript', vbs: 'vbscript',
lua: 'lua', pas: 'delphi', java: 'java', cpp: 'cpp', cc: 'cpp', m: 'objectivec', lua: 'lua', pas: 'delphi', java: 'java', cpp: 'cpp', cc: 'cpp', m: 'objectivec',
vala: 'vala', sql: 'sql', sm: 'smalltalk', lisp: 'lisp', ini: 'ini', vala: 'vala', sql: 'sql', sm: 'smalltalk', lisp: 'lisp', ini: 'ini',
diff: 'diff', bash: 'bash', sh: 'bash', tex: 'tex', erl: 'erlang', hs: 'haskell', diff: 'diff', bash: 'bash', sh: 'bash', tex: 'tex', erl: 'erlang', hs: 'haskell',
md: 'markdown', txt: '', coffee: 'coffee', json: 'javascript', md: 'markdown', txt: '', coffee: 'coffee', json: 'javascript',
swift: 'swift' swift: 'swift'
}; };
// Look up the extension preferred for a type // Look up the extension preferred for a type
// If not found, return the type itself - which we'll place as the extension // If not found, return the type itself - which we'll place as the extension
haste.prototype.lookupExtensionByType = function(type) { haste.prototype.lookupExtensionByType = function(type){
for (var key in haste.extensionMap) { for (let key in haste.extensionMap){
if (haste.extensionMap[key] == type) return key; if (haste.extensionMap[key] == type) return key;
} }
return type; return type;
}; };
// Look up the type for a given extension // Look up the type for a given extension
// If not found, return the extension - which we'll attempt to use as the type // If not found, return the extension - which we'll attempt to use as the type
haste.prototype.lookupTypeByExtension = function(ext) { haste.prototype.lookupTypeByExtension = function(ext){
return haste.extensionMap[ext] || ext; return haste.extensionMap[ext] || ext;
}; };
// Add line numbers to the document // Add line numbers to the document
// For the specified number of lines // For the specified number of lines
haste.prototype.addLineNumbers = function(lineCount) { haste.prototype.addLineNumbers = function(lineCount){
var h = ''; let h = '';
for (var i = 0; i < lineCount; i++) { for (let i = 0; i < lineCount; i++){
h += (i + 1).toString() + '<br/>'; h += (i + 1).toString() + '<br/>';
} }
$('#linenos').html(h); $('#linenos').html(h);
}; };
// Remove the line numbers // Remove the line numbers
haste.prototype.removeLineNumbers = function() { haste.prototype.removeLineNumbers = function(){
$('#linenos').html('&gt;'); $('#linenos').html('&gt;');
}; };
// Load a document and show it // Load a document and show it
haste.prototype.loadDocument = function(key) { haste.prototype.loadDocument = function(key){
// Split the key up // Split the key up
var parts = key.split('.', 2); let parts = key.split('.', 2);
// Ask for what we want // Ask for what we want
var _this = this; let _this = this;
_this.doc = new haste_document(); _this.doc = new haste_document();
_this.doc.load(parts[0], function(ret) { _this.doc.load(parts[0], function(ret){
if (ret) { if (ret){
_this.$code.html(ret.value); _this.$code.html(ret.value);
_this.setTitle(ret.key); _this.setTitle(ret.key);
_this.fullKey(); _this.fullKey();
_this.$textarea.val('').hide(); _this.$textarea.val('').hide();
_this.$box.show().focus(); _this.$box.show().focus();
_this.addLineNumbers(ret.lineCount); _this.addLineNumbers(ret.lineCount);
} }
else { else {
_this.newDocument(); _this.newDocument();
} }
}, this.lookupTypeByExtension(parts[1])); }, this.lookupTypeByExtension(parts[1]));
}; };
// Duplicate the current document - only if locked // Duplicate the current document - only if locked
haste.prototype.duplicateDocument = function() { haste.prototype.duplicateDocument = function(){
if (this.doc.locked) { if (this.doc.locked){
var currentData = this.doc.data; let currentData = this.doc.data;
this.newDocument(); this.newDocument();
this.$textarea.val(currentData); this.$textarea.val(currentData);
} }
}; };
// Lock the current document // Lock the current document
haste.prototype.lockDocument = function() { haste.prototype.lockDocument = function(){
var _this = this; let _this = this;
this.doc.save(this.$textarea.val(), function(err, ret) { this.doc.save(this.$textarea.val(), function(err, ret){
if (err) { if (err){
_this.showMessage(err.message, 'error'); _this.showMessage(err.message, 'error');
} }
else if (ret) { else if (ret){
_this.$code.html(ret.value); _this.$code.html(ret.value);
_this.setTitle(ret.key); _this.setTitle(ret.key);
var file = '/' + ret.key; let file = `/${ret.key}`;
if (ret.language) { if (ret.language){
file += '.' + _this.lookupExtensionByType(ret.language); file += `.${_this.lookupExtensionByType(ret.language)}`;
} }
window.history.pushState(null, _this.appName + '-' + ret.key, file); window.history.pushState(null, `${_this.appName}-${ret.key}`, file);
_this.fullKey(); _this.fullKey();
_this.$textarea.val('').hide(); _this.$textarea.val('').hide();
_this.$box.show().focus(); _this.$box.show().focus();
_this.addLineNumbers(ret.lineCount); _this.addLineNumbers(ret.lineCount);
} }
}); });
}; };
haste.prototype.configureButtons = function() { haste.prototype.configureButtons = function(){
var _this = this; let _this = this;
this.buttons = [ this.buttons = [
{ {
$where: $('#box2 .save'), $where: $('#box2 .save'),
label: 'Save', label: 'Save',
shortcutDescription: 'control + s', shortcutDescription: 'control + s',
shortcut: function(evt) { shortcut: function(evt){
return evt.ctrlKey && (evt.keyCode == 83); return evt.ctrlKey && (evt.keyCode == 83);
}, },
action: function() { action: function(){
if (_this.$textarea.val().replace(/^\s+|\s+$/g, '') !== '') { if (_this.$textarea.val().replace(/^\s+|\s+$/g, '') != ''){
_this.lockDocument(); _this.lockDocument();
} }
} }
}, },
{ {
$where: $('#box2 .new'), $where: $('#box2 .new'),
label: 'New', label: 'New',
shortcut: function(evt) { shortcut: function(evt){
return evt.ctrlKey && evt.keyCode == 78; return evt.ctrlKey && evt.keyCode == 78;
}, },
shortcutDescription: 'control + n', shortcutDescription: 'control + n',
action: function() { action: function(){
_this.newDocument(!_this.doc.key); _this.newDocument(!_this.doc.key);
} }
}, },
{ {
$where: $('#box2 .duplicate'), $where: $('#box2 .duplicate'),
label: 'Duplicate & Edit', label: 'Duplicate & Edit',
shortcut: function(evt) { shortcut: function(evt){
return _this.doc.locked && evt.ctrlKey && evt.keyCode == 68; return _this.doc.locked && evt.ctrlKey && evt.keyCode == 68;
}, },
shortcutDescription: 'control + d', shortcutDescription: 'control + d',
action: function() { action: function(){
_this.duplicateDocument(); _this.duplicateDocument();
} }
}, },
{ {
$where: $('#box2 .raw'), $where: $('#box2 .raw'),
label: 'Just Text', label: 'Just Text',
shortcut: function(evt) { shortcut: function(evt){
return evt.ctrlKey && evt.shiftKey && evt.keyCode == 82; return evt.ctrlKey && evt.shiftKey && evt.keyCode == 82;
}, },
shortcutDescription: 'control + shift + r', shortcutDescription: 'control + shift + r',
action: function() { action: function(){
window.location.href = '/raw/' + _this.doc.key; window.location.href = `/raw/${_this.doc.key}`;
} }
}, },
{ {
$where: $('#box2 .twitter'), $where: $('#box2 .twitter'),
label: 'Twitter', label: 'Twitter',
shortcut: function(evt) { shortcut: function(evt){
return _this.options.twitter && _this.doc.locked && evt.shiftKey && evt.ctrlKey && evt.keyCode == 84; return _this.options.twitter && _this.doc.locked && evt.shiftKey && evt.ctrlKey && evt.keyCode == 84;
}, },
shortcutDescription: 'control + shift + t', shortcutDescription: 'control + shift + t',
action: function() { action: function(){
window.open('https://twitter.com/share?url=' + encodeURI(window.location.href)); window.open(`https://twitter.com/share?url=${encodeURI(window.location.href)}`);
} }
} }
]; ];
for (var i = 0; i < this.buttons.length; i++) { for (button of this.buttons){
this.configureButton(this.buttons[i]); this.configureButton(button);
} }
}; };
haste.prototype.configureButton = function(options) { haste.prototype.configureButton = function(options){
// Handle the click action // Handle the click action
options.$where.click(function(evt) { options.$where.click(function(evt){
evt.preventDefault(); evt.preventDefault();
if (!options.clickDisabled && $(this).hasClass('enabled')) { if (!options.clickDisabled && $(this).hasClass('enabled')){
options.action(); options.action();
} }
}); });
// Show the label // Show the label
options.$where.mouseenter(function() { options.$where.mouseenter(function(){
$('#box3 .label').text(options.label); $('#box3 .label').text(options.label);
$('#box3 .shortcut').text(options.shortcutDescription || ''); $('#box3 .shortcut').text(options.shortcutDescription || '');
$('#box3').show(); $('#box3').show();
$(this).append($('#pointer').remove().show()); $(this).append($('#pointer').remove().show());
}); });
// Hide the label // Hide the label
options.$where.mouseleave(function() { options.$where.mouseleave(function(){
$('#box3').hide(); $('#box3').hide();
$('#pointer').hide(); $('#pointer').hide();
}); });
}; };
// Configure keyboard shortcuts for the textarea // Configure keyboard shortcuts for the textarea
haste.prototype.configureShortcuts = function() { haste.prototype.configureShortcuts = function(){
var _this = this; let _this = this;
$(document.body).keydown(function(evt) { $(document.body).keydown(function(evt){
var button; for (button of _this.buttons){
for (var i = 0 ; i < _this.buttons.length; i++) { if (button.shortcut && button.shortcut(evt)){
button = _this.buttons[i]; evt.preventDefault();
if (button.shortcut && button.shortcut(evt)) { button.action();
evt.preventDefault(); return;
button.action(); }
return; }
} });
}
});
}; };
///// Tab behavior in the textarea - 2 spaces per tab ///// Tab behavior in the textarea - 2 spaces per tab
$(function() { $(function(){
$('textarea').keydown(function(evt){
$('textarea').keydown(function(evt) { if (evt.keyCode == 9){
if (evt.keyCode == 9) { evt.preventDefault();
evt.preventDefault(); let myValue = ' ';
var myValue = ' '; // http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery
// http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery // For browsers like Internet Explorer
// For browsers like Internet Explorer if (document.selection){
if (document.selection) { this.focus();
this.focus(); let sel = document.selection.createRange();
var sel = document.selection.createRange(); sel.text = myValue;
sel.text = myValue; this.focus();
this.focus(); }
} // Mozilla and Webkit
// Mozilla and Webkit else if (this.selectionStart || this.selectionStart == '0'){
else if (this.selectionStart || this.selectionStart == '0') { let startPos = this.selectionStart;
var startPos = this.selectionStart; let endPos = this.selectionEnd;
var endPos = this.selectionEnd; let scrollTop = this.scrollTop;
var scrollTop = this.scrollTop; this.value = this.value.substring(0, startPos) + myValue +
this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos,this.value.length);
this.value.substring(endPos,this.value.length); this.focus();
this.focus(); this.selectionStart = startPos + myValue.length;
this.selectionStart = startPos + myValue.length; this.selectionEnd = startPos + myValue.length;
this.selectionEnd = startPos + myValue.length; this.scrollTop = scrollTop;
this.scrollTop = scrollTop; }
} else {
else { this.value += myValue;
this.value += myValue; this.focus();
this.focus(); }
} }
} });
});
}); });

View file

@ -10,14 +10,14 @@ describe('document_handler', function() {
describe('randomKey', function() { describe('randomKey', function() {
it('should choose a key of the proper length', function() { it('should choose a key of the proper length', function() {
var gen = new Generator(); let gen = new Generator();
var dh = new DocumentHandler({ keyLength: 6, keyGenerator: gen }); let dh = new DocumentHandler({ keyLength: 6, keyGenerator: gen });
assert.equal(6, dh.acceptableKey().length); assert.equal(6, dh.acceptableKey().length);
}); });
it('should choose a default key length', function() { it('should choose a default key length', function() {
var gen = new Generator(); let gen = new Generator();
var dh = new DocumentHandler({ keyGenerator: gen }); let dh = new DocumentHandler({ keyGenerator: gen });
assert.equal(dh.keyLength, DocumentHandler.defaultKeyLength); assert.equal(dh.keyLength, DocumentHandler.defaultKeyLength);
}); });

View file

@ -20,7 +20,7 @@ describe('redis_document_store', function() {
describe('set', function() { describe('set', function() {
it('should be able to set a key and have an expiration set', function(done) { it('should be able to set a key and have an expiration set', function(done) {
var store = new RedisDocumentStore({ expire: 10 }); let store = new RedisDocumentStore({ expire: 10 });
store.set('hello1', 'world', function() { store.set('hello1', 'world', function() {
RedisDocumentStore.client.ttl('hello1', function(err, res) { RedisDocumentStore.client.ttl('hello1', function(err, res) {
assert.ok(res > 1); assert.ok(res > 1);
@ -30,7 +30,7 @@ describe('redis_document_store', function() {
}); });
it('should not set an expiration when told not to', function(done) { it('should not set an expiration when told not to', function(done) {
var store = new RedisDocumentStore({ expire: 10 }); let store = new RedisDocumentStore({ expire: 10 });
store.set('hello2', 'world', function() { store.set('hello2', 'world', function() {
RedisDocumentStore.client.ttl('hello2', function(err, res) { RedisDocumentStore.client.ttl('hello2', function(err, res) {
assert.equal(-1, res); assert.equal(-1, res);
@ -40,7 +40,7 @@ describe('redis_document_store', function() {
}); });
it('should not set an expiration when expiration is off', function(done) { it('should not set an expiration when expiration is off', function(done) {
var store = new RedisDocumentStore({ expire: false }); let store = new RedisDocumentStore({ expire: false });
store.set('hello3', 'world', function() { store.set('hello3', 'world', function() {
RedisDocumentStore.client.ttl('hello3', function(err, res) { RedisDocumentStore.client.ttl('hello3', function(err, res) {
assert.equal(-1, res); assert.equal(-1, res);