Template Upload
This commit is contained in:
3
node_modules/require-main-filename/.npmignore
generated
vendored
Normal file
3
node_modules/require-main-filename/.npmignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
.nyc_output
|
8
node_modules/require-main-filename/.travis.yml
generated
vendored
Normal file
8
node_modules/require-main-filename/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4.1"
|
||||
- "node"
|
14
node_modules/require-main-filename/LICENSE.txt
generated
vendored
Normal file
14
node_modules/require-main-filename/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Copyright (c) 2016, 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.
|
26
node_modules/require-main-filename/README.md
generated
vendored
Normal file
26
node_modules/require-main-filename/README.md
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# require-main-filename
|
||||
|
||||
[](https://travis-ci.org/yargs/require-main-filename)
|
||||
[](https://coveralls.io/r/yargs/require-main-filename?branch=master)
|
||||
[](https://www.npmjs.com/package/require-main-filename)
|
||||
|
||||
`require.main.filename` is great for figuring out the entry
|
||||
point for the current application. This can be combined with a module like
|
||||
[pkg-conf](https://www.npmjs.com/package/pkg-conf) to, _as if by magic_, load
|
||||
top-level configuration.
|
||||
|
||||
Unfortunately, `require.main.filename` sometimes fails when an application is
|
||||
executed with an alternative process manager, e.g., [iisnode](https://github.com/tjanczuk/iisnode).
|
||||
|
||||
`require-main-filename` is a shim that addresses this problem.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var main = require('require-main-filename')()
|
||||
// use main as an alternative to require.main.filename.
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
18
node_modules/require-main-filename/index.js
generated
vendored
Normal file
18
node_modules/require-main-filename/index.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = function (_require) {
|
||||
_require = _require || require
|
||||
var main = _require.main
|
||||
if (main && isIISNode(main)) return handleIISNode(main)
|
||||
else return main ? main.filename : process.cwd()
|
||||
}
|
||||
|
||||
function isIISNode (main) {
|
||||
return /\\iisnode\\/.test(main.filename)
|
||||
}
|
||||
|
||||
function handleIISNode (main) {
|
||||
if (!main.children.length) {
|
||||
return main.filename
|
||||
} else {
|
||||
return main.children[0].filename
|
||||
}
|
||||
}
|
85
node_modules/require-main-filename/package.json
generated
vendored
Normal file
85
node_modules/require-main-filename/package.json
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"require-main-filename@^1.0.1",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\yargs"
|
||||
]
|
||||
],
|
||||
"_from": "require-main-filename@>=1.0.1-0 <2.0.0-0",
|
||||
"_id": "require-main-filename@1.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/require-main-filename",
|
||||
"_nodeVersion": "3.2.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-6-west.internal.npmjs.com",
|
||||
"tmp": "tmp/require-main-filename-1.0.1.tgz_1455688492890_0.0750324921682477"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "ben@npmjs.com",
|
||||
"name": "bcoe"
|
||||
},
|
||||
"_npmVersion": "3.3.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "require-main-filename",
|
||||
"raw": "require-main-filename@^1.0.1",
|
||||
"rawSpec": "^1.0.1",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.1-0 <2.0.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
|
||||
"_shasum": "97f717b69d48784f5f526a6c5aa8ffdda055a4d1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "require-main-filename@^1.0.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\yargs",
|
||||
"author": {
|
||||
"email": "ben@npmjs.com",
|
||||
"name": "Ben Coe"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/require-main-filename/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "shim for require.main.filename() that works in as many environments as possible",
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"standard": "^6.0.5",
|
||||
"tap": "^5.2.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "97f717b69d48784f5f526a6c5aa8ffdda055a4d1",
|
||||
"tarball": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz"
|
||||
},
|
||||
"gitHead": "6dd2291332bed764c56302ccdd14da8a213249a1",
|
||||
"homepage": "https://github.com/yargs/require-main-filename#readme",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"iisnode",
|
||||
"require",
|
||||
"shim"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "bcoe",
|
||||
"email": "ben@npmjs.com"
|
||||
}
|
||||
],
|
||||
"name": "require-main-filename",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/yargs/require-main-filename.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "standard",
|
||||
"test": "tap --coverage test.js"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
36
node_modules/require-main-filename/test.js
generated
vendored
Normal file
36
node_modules/require-main-filename/test.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/* global describe, it */
|
||||
|
||||
var requireMainFilename = require('./')
|
||||
|
||||
require('tap').mochaGlobals()
|
||||
require('chai').should()
|
||||
|
||||
describe('require-main-filename', function () {
|
||||
it('returns require.main.filename in normal circumstances', function () {
|
||||
requireMainFilename().should.match(/test\.js/)
|
||||
})
|
||||
|
||||
it('should use children[0].filename when running on iisnode', function () {
|
||||
var main = {
|
||||
filename: 'D:\\Program Files (x86)\\iisnode\\interceptor.js',
|
||||
children: [ {filename: 'D:\\home\\site\\wwwroot\\server.js'} ]
|
||||
}
|
||||
requireMainFilename({
|
||||
main: main
|
||||
}).should.match(/server\.js/)
|
||||
})
|
||||
|
||||
it('should not use children[0] if no children exist', function () {
|
||||
var main = {
|
||||
filename: 'D:\\Program Files (x86)\\iisnode\\interceptor.js',
|
||||
children: []
|
||||
}
|
||||
requireMainFilename({
|
||||
main: main
|
||||
}).should.match(/interceptor\.js/)
|
||||
})
|
||||
|
||||
it('should default to process.cwd() if require.main is undefined', function () {
|
||||
requireMainFilename({}).should.match(/require-main-filename/)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user