pax_global_header 0000666 0000000 0000000 00000000064 13054211044 0014504 g ustar 00root root 0000000 0000000 52 comment=ae5764b4f8c70249f65c0ed66a6652506424c687
exports-loader-0.6.4/ 0000775 0000000 0000000 00000000000 13054211044 0014463 5 ustar 00root root 0000000 0000000 exports-loader-0.6.4/.gitignore 0000664 0000000 0000000 00000000015 13054211044 0016447 0 ustar 00root root 0000000 0000000 node_modules
exports-loader-0.6.4/LICENSE 0000664 0000000 0000000 00000002057 13054211044 0015474 0 ustar 00root root 0000000 0000000 Copyright JS Foundation and other contributors
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.
exports-loader-0.6.4/README.md 0000664 0000000 0000000 00000004451 13054211044 0015746 0 ustar 00root root 0000000 0000000 [![npm][npm]][npm-url]
[![deps][deps]][deps-url]
[![chat][chat]][chat-url]
Exports Loader
Exports variables from inside the file by appending `exports[...] = ...` statements..
Install
```bash
npm i exports-loader --save
```
Usage
``` javascript
require("exports-loader?file,parse=helpers.parse!./file.js");
// adds below code the the file's source:
// exports["file"] = file;
// exports["parse"] = helpers.parse;
require("exports-loader?file!./file.js");
// adds below code the the file's source:
// module.exports = file;
```
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
Maintainers
[npm]: https://img.shields.io/npm/v/exports-loader.svg
[npm-url]: https://npmjs.com/package/exports-loader
[deps]: https://david-dm.org/webpack-contrib/exports-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/exports-loader
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack
exports-loader-0.6.4/index.js 0000664 0000000 0000000 00000002342 13054211044 0016131 0 ustar 00root root 0000000 0000000 /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var loaderUtils = require("loader-utils");
var SourceNode = require("source-map").SourceNode;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var FOOTER = "/*** EXPORTS FROM exports-loader ***/\n";
module.exports = function(content, sourceMap) {
if(this.cacheable) this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var exports = [];
var keys = Object.keys(query);
if(keys.length == 1 && typeof query[keys[0]] == "boolean") {
exports.push("module.exports = " + keys[0] + ";");
} else {
keys.forEach(function(name) {
var mod = name;
if(typeof query[name] == "string") {
mod = query[name];
}
exports.push("exports[" + JSON.stringify(name) + "] = (" + mod + ");");
});
}
if(sourceMap) {
var currentRequest = loaderUtils.getCurrentRequest(this);
var node = SourceNode.fromStringWithSourceMap(content, new SourceMapConsumer(sourceMap));
node.add("\n\n" + FOOTER + exports.join("\n"));
var result = node.toStringWithSourceMap({
file: currentRequest
});
this.callback(null, result.code, result.map.toJSON());
return;
}
return content + "\n\n" + FOOTER + exports.join("\n");
}
exports-loader-0.6.4/package.json 0000664 0000000 0000000 00000000636 13054211044 0016756 0 ustar 00root root 0000000 0000000 {
"name": "exports-loader",
"version": "0.6.4",
"author": "Tobias Koppers @sokra",
"description": "exports loader module for webpack",
"dependencies": {
"loader-utils": "^1.0.2",
"source-map": "0.5.x"
},
"repository": {
"type": "git",
"url": "git@github.com:webpack/exports-loader.git"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
]
}