This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

BIN
node_modules/require-like/.Readme.md.un~ generated vendored Normal file

Binary file not shown.

2
node_modules/require-like/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
*.un~
/node_modules

BIN
node_modules/require-like/.package.json.un~ generated vendored Normal file

Binary file not shown.

4
node_modules/require-like/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- 0.4
- 0.6

19
node_modules/require-like/License generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com)
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.

7
node_modules/require-like/Makefile generated vendored Normal file
View File

@@ -0,0 +1,7 @@
SHELL := /bin/bash
NODE = node
test:
@$(NODE) ./test/run.js
.PHONY: test

51
node_modules/require-like/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,51 @@
# require-like
[![Build Status](https://secure.travis-ci.org/felixge/node-require-like.png)](http://travis-ci.org/felixge/node-require-like)
Generates require functions that act as if they were operating in a given path.
## Install
``` bash
npm install require-like
```
## Usage
A require function that acts as if it was executed in `'./lib/bar'`:
``` javascript
var requireLike = require('require-like');
var myRequire = requireLike(__dirname + '/lib/bar.js');
var myFoo = myRequire('./foo.js');
var foo = require('./lib/foo');
require('assert').strictEqual(myFoo, foo);
```
## API
### requireLike(path, [uncached])
Returns a require function that acts as if it was operating in the given
`path`.
Setting the `uncached` parameter to true returns a function that by-passes the
module cache.
## Implementation Details
This module works by accessing some private node APIs. You shouldn't worry about
that so, since I will make sure this module does not break in the future by
either patching it, or making a patch for node that makes the needed APIs
public.
## What to do with this
I use this library for dependency injection in unit tests. However, you could
also use it to create experimental require addons yourself.
## License
require-like is licensed under the MIT license.

40
node_modules/require-like/lib/require-like.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
var Module = require('module');
var dirname = require('path').dirname;
module.exports = function requireLike(path, uncached) {
var parentModule = new Module(path);
parentModule.filename = path;
parentModule.paths = Module._nodeModulePaths(dirname(path));
function requireLike(file) {
var cache = Module._cache;
if (uncached) {
Module._cache = {};
}
var exports = Module._load(file, parentModule);
Module._cache = cache;
return exports;
};
requireLike.resolve = function(request) {
var resolved = Module._resolveFilename(request, parentModule);
// Module._resolveFilename returns a string since node v0.6.10,
// it used to return an array prior to that
return (resolved instanceof Array) ? resolved[1] : resolved;
}
try {
requireLike.paths = require.paths;
} catch (e) {
//require.paths was deprecated in node v0.5.x
//it now throws an exception when called
}
requireLike.main = process.mainModule;
requireLike.extensions = require.extensions;
requireLike.cache = require.cache;
return requireLike;
};

24
node_modules/require-like/package.json generated vendored Normal file
View File

@@ -0,0 +1,24 @@
{
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
"name": "require-like",
"description": "Generates require functions that act as if they were operating in a given path.",
"version": "0.1.2",
"homepage": "https://github.com/felixge/node-require-like",
"repository": {
"type": "git",
"url": "git://github.com/felixge/node-require-like.git"
},
"main": "./lib/require-like",
"engines": {
"node": "*"
},
"scripts": {
"test": "make test"
},
"dependencies": {},
"devDependencies": {
"hashish": "0.0.3",
"urun": "0.0.4"
},
"optionalDependencies": {}
}

11
node_modules/require-like/test/common.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
var common = exports;
var path = require('path');
var root = path.dirname(__dirname);
common.dir = {
lib: root + '/lib',
fixture: root + '/test/fixture',
};
common.assert = require('assert');

1
node_modules/require-like/test/fixture/foo.js generated vendored Normal file
View File

@@ -0,0 +1 @@
exports.foo = ['foo'];

View File

@@ -0,0 +1,55 @@
var common = require('../common');
var assert = common.assert;
var requireLike = require(common.dir.lib + '/require-like');
(function testWithCache() {
var foo = require(common.dir.fixture + '/foo.js');
var myRequire = requireLike(common.dir.fixture + '/bar.js');
var myFoo = myRequire('./foo');
assert.strictEqual(myFoo, foo);
})();
(function testWithoutCache() {
var foo = require(common.dir.fixture + '/foo.js');
var myRequire = requireLike(common.dir.fixture + '/bar.js', true);
var myFoo = myRequire('./foo');
assert.notStrictEqual(myFoo, foo);
assert.deepEqual(myFoo, foo);
})();
(function testResolve() {
var myRequire = requireLike(common.dir.fixture + '/bar.js');
var fooPath = myRequire.resolve('./foo');
assert.strictEqual(fooPath, common.dir.fixture + '/foo.js');
})();
if (process.version <= 'v0.5') {
(function testPaths() {
var myRequire = requireLike(common.dir.fixture + '/bar.js');
assert.strictEqual(myRequire.paths, require.paths);
})();
}
(function testMain() {
var myRequire = requireLike(common.dir.fixture + '/bar.js');
assert.strictEqual(myRequire.main, process.mainModule);
})();
(function testExtensions() {
var myRequire = requireLike(common.dir.fixture + '/bar.js');
assert.strictEqual(myRequire.extensions, require.extensions);
})();
(function testCache() {
var myRequire = requireLike(common.dir.fixture + '/bar.js');
assert.strictEqual(myRequire.cache, require.cache);
})();
(function testLoadNodeModule() {
var myRequire = requireLike(common.dir.lib + '/foo.js', true);
myRequire('hashish');
})();

1
node_modules/require-like/test/run.js generated vendored Normal file
View File

@@ -0,0 +1 @@
require('urun')(__dirname);