前端代码

This commit is contained in:
ChloeChen0423
2025-05-12 16:42:36 +09:00
commit 7c63f2f07b
4531 changed files with 656010 additions and 0 deletions

15
node_modules/server-destroy/LICENSE generated vendored Normal file
View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

21
node_modules/server-destroy/README.md generated vendored Normal file
View File

@ -0,0 +1,21 @@
# server-destroy
Enable destroying a server, and all currently open connections.
## Usage
```javascript
var enableDestroy = require('server-destroy');
var server = http.createServer(function(req, res) {
// do stuff, blah blah blah
});
server.listen(PORT);
// enhance with a 'destroy' function
enableDestroy(server);
// some time later...
server.destroy();
```

19
node_modules/server-destroy/index.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = enableDestroy;
function enableDestroy(server) {
var connections = {}
server.on('connection', function(conn) {
var key = conn.remoteAddress + ':' + conn.remotePort;
connections[key] = conn;
conn.on('close', function() {
delete connections[key];
});
});
server.destroy = function(cb) {
server.close(cb);
for (var key in connections)
connections[key].destroy();
};
}

17
node_modules/server-destroy/package.json generated vendored Normal file
View File

@ -0,0 +1,17 @@
{
"name": "server-destroy",
"version": "1.0.1",
"description": "Enable destroying a server, and all currently open connections.",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/server-destroy"
},
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"license": "ISC",
"readmeFilename": "README.md",
"gitHead": "71e22162bacb9368de045db4283f95f02194479b"
}

31
node_modules/server-destroy/test.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
var net = require('net');
var assert = require('assert');
var enableDestroy = require('./index.js');
var server = net.createServer(function(conn) {
var i = setInterval(function() {
conn.read();
conn.write('hi\n');
}, 100);
i.unref();
});
server.listen(1337);
enableDestroy(server);
var connected = 0;
for (var i = 0; i < 10; i++) {
var client = net.connect(1337);
client.on('connect', function() {
connected++;
if (connected === 10) setTimeout(destroy);
});
// just ignore the resets
client.on('error', function() {});
}
function destroy() {
server.destroy(function() {
console.log('ok');
});
}