From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/require-from-string/index.js | 30 +++++++++++++ node_modules/require-from-string/license | 21 +++++++++ node_modules/require-from-string/package.json | 62 +++++++++++++++++++++++++++ node_modules/require-from-string/readme.md | 56 ++++++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 node_modules/require-from-string/index.js create mode 100644 node_modules/require-from-string/license create mode 100644 node_modules/require-from-string/package.json create mode 100644 node_modules/require-from-string/readme.md (limited to 'node_modules/require-from-string') diff --git a/node_modules/require-from-string/index.js b/node_modules/require-from-string/index.js new file mode 100644 index 0000000..d3d380a --- /dev/null +++ b/node_modules/require-from-string/index.js @@ -0,0 +1,30 @@ +'use strict'; + +var Module = require('module'); +var path = require('path'); + +module.exports = function requireFromString(code, filename, opts) { + if (typeof filename === 'object') { + opts = filename; + filename = undefined; + } + + opts = opts || {}; + filename = filename || ''; + + opts.appendPaths = opts.appendPaths || []; + opts.prependPaths = opts.prependPaths || []; + + if (typeof code !== 'string') { + throw new Error('code must be a string, not ' + typeof code); + } + + var paths = Module._nodeModulePaths(path.dirname(filename)); + + var m = new Module(filename, module.parent); + m.filename = filename; + m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); + m._compile(code, filename); + + return m.exports; +}; diff --git a/node_modules/require-from-string/license b/node_modules/require-from-string/license new file mode 100644 index 0000000..1aeb74f --- /dev/null +++ b/node_modules/require-from-string/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +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. diff --git a/node_modules/require-from-string/package.json b/node_modules/require-from-string/package.json new file mode 100644 index 0000000..9fdd176 --- /dev/null +++ b/node_modules/require-from-string/package.json @@ -0,0 +1,62 @@ +{ + "_args": [ + [ + "require-from-string@1.2.1", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "require-from-string@1.2.1", + "_id": "require-from-string@1.2.1", + "_inBundle": false, + "_integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", + "_location": "/require-from-string", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "require-from-string@1.2.1", + "name": "require-from-string", + "escapedName": "require-from-string", + "rawSpec": "1.2.1", + "saveSpec": null, + "fetchSpec": "1.2.1" + }, + "_requiredBy": [ + "/cosmiconfig" + ], + "_resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", + "_spec": "1.2.1", + "_where": "/home/dstaesse/git/website", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "bugs": { + "url": "https://github.com/floatdrop/require-from-string/issues" + }, + "dependencies": {}, + "description": "Require module from string", + "devDependencies": { + "mocha": "*" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/floatdrop/require-from-string#readme", + "keywords": [], + "license": "MIT", + "name": "require-from-string", + "repository": { + "type": "git", + "url": "git+https://github.com/floatdrop/require-from-string.git" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.2.1" +} diff --git a/node_modules/require-from-string/readme.md b/node_modules/require-from-string/readme.md new file mode 100644 index 0000000..1b4e6bc --- /dev/null +++ b/node_modules/require-from-string/readme.md @@ -0,0 +1,56 @@ +# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string) + +Load module from string in Node. + +## Install + +``` +$ npm install --save require-from-string +``` + + +## Usage + +```js +var requireFromString = require('require-from-string'); + +requireFromString('module.exports = 1'); +//=> 1 +``` + + +## API + +### requireFromString(code, [filename], [options]) + +#### code + +*Required* +Type: `string` + +Module code. + +#### filename +Type: `string` +Default: `''` + +Optional filename. + + +#### options +Type: `object` + +##### appendPaths +Type: `Array` + +List of `paths`, that will be appended to module `paths`. Useful, when you want +to be able require modules from these paths. + +##### prependPaths +Type: `Array` + +Same as `appendPath`, but paths will be prepended. + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) -- cgit v1.2.3