前端代码

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

26
node_modules/dev-ip/.jshintrc generated vendored Normal file
View File

@ -0,0 +1,26 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"laxbreak": false,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"plusplus": true,
"sub": true,
"undef": true,
"quotmark": "double",
"unused": true,
"indent": 4,
"eqnull": true,
"node": true,
"strict": true,
"mocha": true,
"jasmine": true,
"globals": {
"browser": false,
"by": false,
"element": false,
"protractor": false
}
}

3
node_modules/dev-ip/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
.idea
npm-debug.log

5
node_modules/dev-ip/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,5 @@
language: node_js
node_js:
- '0.10'
before_script:
- npm install -g gulp

22
node_modules/dev-ip/LICENSE-MIT generated vendored Normal file
View File

@ -0,0 +1,22 @@
Copyright (c) 2013 Shane Osbourne
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

32
node_modules/dev-ip/README.md generated vendored Normal file
View File

@ -0,0 +1,32 @@
# dev-ip [![Build Status](https://travis-ci.org/shakyShane/dev-ip.png?branch=master)](https://travis-ci.org/shakyShane/dev-ip)
Find a suitable IP host to view local websites on.
## Command line
Install it globally to use on the command line:
`sudo npm install -g dev-ip`
then run:
`dev-ip`
> "http://192.168.1.46"
## In your project
`npm install dev-ip`
```javascript
var devip = require('dev-ip');
devip(); // "192.168.1.76" or false if nothing found (ie, offline user)
```
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Run lint & tests with `gulp`.
## Release History
_(Nothing yet)_
## License
Copyright (c) 2013 Shane Osbourne
Licensed under the MIT license.

4
node_modules/dev-ip/example.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
var devip = require("./lib/dev-ip");
var ip = devip();
console.log(ip);

44
node_modules/dev-ip/lib/dev-ip.js generated vendored Normal file
View File

@ -0,0 +1,44 @@
#! /usr/bin/env node
/*
* dev-ip
* https://github.com/shakyshane/dev-ip
*
* Copyright (c) 2013 Shane Osbourne
* Licensed under the MIT license.
*/
"use strict";
var messages = {
error: "Couldn't find a suitable IP for you to use. (You're probably offline!)"
};
/**
* @returns {Array}
*/
function getIp() {
var networkInterfaces = require("os").networkInterfaces();
var matches = [];
Object.keys(networkInterfaces).forEach(function (item) {
networkInterfaces[item].forEach(function (address) {
if (address.internal === false && address.family === "IPv4") {
matches.push(address.address);
}
});
});
return matches;
};
module.exports = getIp;
if (require.main === module) {
var out = getIp();
if (!out.length) {
return console.log(messages.error);
}
console.log(getIp("cli"));
}

43
node_modules/dev-ip/package.json generated vendored Normal file
View File

@ -0,0 +1,43 @@
{
"name": "dev-ip",
"description": "Find a suitable IP host to view local websites on.",
"version": "1.0.1",
"homepage": "https://github.com/shakyshane/dev-ip",
"author": {
"name": "Shane Osbourne",
"email": "shane.osbourne8@gmail.com"
},
"repository": {
"type": "git",
"url": "git://github.com/shakyshane/dev-ip.git"
},
"bugs": {
"url": "https://github.com/shakyshane/dev-ip/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/shakyshane/dev-ip/blob/master/LICENSE-MIT"
}
],
"main": "lib/dev-ip",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"lint": "jshint lib/*.js test/*.js",
"unit": "mocha",
"test": "npm run lint && npm run unit"
},
"devDependencies": {
"chai": "^1.10.0",
"jshint": "^2.5.11",
"mocha": "^2.1.0",
"sinon": "^1.12.2"
},
"keywords": [],
"bin": {
"dev-ip": "lib/dev-ip.js"
},
"dependencies": {}
}

26
node_modules/dev-ip/test/.jshintrc generated vendored Normal file
View File

@ -0,0 +1,26 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"sub": true,
"undef": false,
"unused": false,
"quotmark": "double",
"boss": true,
"eqnull": true,
"node": true,
"globals": {
"describe" : false,
"it" : false,
"expect" : false,
"runs" : false,
"waitsFor" : false,
"beforeEach" : false,
"afterEach" : false,
"before" : false,
"after" : false
}
}

77
node_modules/dev-ip/test/devip.js generated vendored Normal file
View File

@ -0,0 +1,77 @@
"use strict";
var devIp = require("../lib/dev-ip");
var respNone = require("./fixtures/resp-none");
var respSingle = require("./fixtures/resp-single");
var respMultiple = require("./fixtures/resp-multiple");
var sinon = require("sinon");
var assert = require("chai").assert;
var os = require("os");
// From the resp files
var match1 = "10.104.103.181";
var match2 = "10.104.100.12";
var regex = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
describe("Getting the IP with a single result", function () {
var osStub;
var result;
before(function () {
osStub = sinon.stub(os, "networkInterfaces").returns(respSingle);
});
beforeEach(function () {
result = devIp(null);
});
after(function () {
osStub.restore();
});
it("should return the IP when a single match found", function () {
var expected = match1;
assert.deepEqual(result, [expected]);
});
it("should return a string matching the regex", function () {
var actual = regex.exec(result);
assert.isNotNull(actual);
});
});
describe("Getting the IP with Multiple results", function () {
var osStub;
var result;
before(function () {
osStub = sinon.stub(os, "networkInterfaces").returns(respMultiple);
});
beforeEach(function () {
result = devIp(null);
});
after(function () {
osStub.restore();
});
it("should return an array of results", function () {
assert.equal(result[0], match1);
assert.equal(result[1], match2);
});
it("should return a string matching the regex", function () {
var actual = regex.exec(result[0]);
assert.isNotNull(actual);
actual = regex.exec(result[1]);
assert.isNotNull(actual);
});
});
describe("Getting the IP with no results", function () {
var osStub;
var result;
before(function () {
osStub = sinon.stub(os, "networkInterfaces").returns(respNone);
});
after(function () {
osStub.restore();
});
it("should return empty array", function () {
var actual = devIp();
assert.isArray(actual);
assert.equal(actual.length, 0);
});
});

35
node_modules/dev-ip/test/fixtures/resp-multiple.js generated vendored Normal file
View File

@ -0,0 +1,35 @@
module.exports = {
lo0: [
{
address: 'fe80::1',
family: 'IPv6',
internal: true
},
{
address: '127.0.0.1',
family: 'IPv4',
internal: true
},
{
address: '::1',
family: 'IPv6',
internal: true
}
],
en0: [
{
address: 'fe80::22c9:d0ff:fe44:6415',
family: 'IPv6',
internal: false },
{
address: '10.104.103.181',
family: 'IPv4',
internal: false
},
{
address: '10.104.100.12',
family: 'IPv4',
internal: false
}
]
}

19
node_modules/dev-ip/test/fixtures/resp-none.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
lo0: [
{
address: 'fe80::1',
family: 'IPv6',
internal: true
},
{
address: '127.0.0.1',
family: 'IPv4',
internal: true
},
{
address: '::1',
family: 'IPv6',
internal: true
}
]
}

30
node_modules/dev-ip/test/fixtures/resp-single.js generated vendored Normal file
View File

@ -0,0 +1,30 @@
module.exports = {
lo0: [
{
address: 'fe80::1',
family: 'IPv6',
internal: true
},
{
address: '127.0.0.1',
family: 'IPv4',
internal: true
},
{
address: '::1',
family: 'IPv6',
internal: true
}
],
en0: [
{
address: 'fe80::22c9:d0ff:fe44:6415',
family: 'IPv6',
internal: false },
{
address: '10.104.103.181',
family: 'IPv4',
internal: false
}
]
}