From 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 28 May 2017 00:38:50 +0200 Subject: add linting (and some initial fixes) --- node_modules/default-require-extensions/js.js | 9 +++++ node_modules/default-require-extensions/json.js | 14 +++++++ node_modules/default-require-extensions/license | 21 +++++++++++ .../default-require-extensions/package.json | 43 ++++++++++++++++++++++ node_modules/default-require-extensions/readme.md | 32 ++++++++++++++++ 5 files changed, 119 insertions(+) create mode 100644 node_modules/default-require-extensions/js.js create mode 100644 node_modules/default-require-extensions/json.js create mode 100644 node_modules/default-require-extensions/license create mode 100644 node_modules/default-require-extensions/package.json create mode 100644 node_modules/default-require-extensions/readme.md (limited to 'node_modules/default-require-extensions') diff --git a/node_modules/default-require-extensions/js.js b/node_modules/default-require-extensions/js.js new file mode 100644 index 000000000..ff8261291 --- /dev/null +++ b/node_modules/default-require-extensions/js.js @@ -0,0 +1,9 @@ +'use strict'; + +var fs = require('fs'); +var stripBom = require('strip-bom'); + +module.exports = function (module, filename) { + var content = fs.readFileSync(filename, 'utf8'); + module._compile(stripBom(content), filename); +}; diff --git a/node_modules/default-require-extensions/json.js b/node_modules/default-require-extensions/json.js new file mode 100644 index 000000000..5e07dc27f --- /dev/null +++ b/node_modules/default-require-extensions/json.js @@ -0,0 +1,14 @@ +'use strict'; + +var fs = require('fs'); +var stripBom = require('strip-bom'); + +module.exports = function (module, filename) { + var content = fs.readFileSync(filename, 'utf8'); + try { + module.exports = JSON.parse(stripBom(content)); + } catch (err) { + err.message = filename + ': ' + err.message; + throw err; + } +}; diff --git a/node_modules/default-require-extensions/license b/node_modules/default-require-extensions/license new file mode 100644 index 000000000..37c150b64 --- /dev/null +++ b/node_modules/default-require-extensions/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Copyright Node.js contributors, James Talmage (github.com/jamestalmage). All rights reserved. + +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/default-require-extensions/package.json b/node_modules/default-require-extensions/package.json new file mode 100644 index 000000000..74eeb1d2b --- /dev/null +++ b/node_modules/default-require-extensions/package.json @@ -0,0 +1,43 @@ +{ + "name": "default-require-extensions", + "version": "1.0.0", + "description": "Node's default require extensions as a separate module", + "license": "MIT", + "repository": "jamestalmage/default-require-extensions", + "author": { + "name": "James Talmage", + "email": "james@talmage.io", + "url": "github.com/jamestalmage" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "main": "js.js", + "files": [ + "js.js", + "json.js" + ], + "keywords": [ + "require", + "extension", + "default", + "node" + ], + "dependencies": { + "strip-bom": "^2.0.0" + }, + "devDependencies": { + "ava": "^0.11.0", + "nyc": "^5.3.0", + "xo": "^0.12.1" + }, + "nyc": { + "exclude": [ + "test.js", + "fixture" + ] + } +} diff --git a/node_modules/default-require-extensions/readme.md b/node_modules/default-require-extensions/readme.md new file mode 100644 index 000000000..08ed4c5a4 --- /dev/null +++ b/node_modules/default-require-extensions/readme.md @@ -0,0 +1,32 @@ +# default-require-extensions [![Build Status](https://travis-ci.org/jamestalmage/default-require-extensions.svg?branch=master)](https://travis-ci.org/jamestalmage/default-require-extensions) + +> Node's default require extensions as a separate module + +Handy for require extension authors that want reliable access to the default extension implementations. + +By the time your extension is loaded, the default extension may have already been replaced. This provides extensions functionally identical to the default ones, which you know you can access reliably, no matter what extensions have been installed previously. + +## Install + +``` +$ npm install --save default-require-extensions +``` + + +## Usage + +```js +const js = require('default-require-extensions/js'); +const json = require('default-require-extensions/json'); + +require.extensions['.js'] = js; +require.extensions['.js'] = json; + +``` + +*Note: * You would never actually do the above. Use these in your custom require extensions instead. + + +## License + +MIT © Node.js contributors, [James Talmage](http://github.com/jamestalmage) -- cgit v1.2.3