├── .gitignore ├── .github └── FUNDING.yml ├── index.js ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: localjo 2 | patreon: localjo 3 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { exec } = require('child_process'); 2 | const loaderUtils = require('loader-utils'); 3 | 4 | module.exports = function(source) { 5 | const callback = this.async(); 6 | const { script, ...options } = loaderUtils.getOptions(this); 7 | const command = exec(script, options, function(err, result) { 8 | if (err) return callback(err); 9 | callback(null, result); 10 | }); 11 | command.stdin.write(source); 12 | command.stdin.end(); 13 | }; 14 | module.exports.raw = true; 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shell-loader", 3 | "version": "1.2.1", 4 | "description": "A Webpack loader that runs an arbitrary script on matching files", 5 | "keywords": [ 6 | "webpack", 7 | "webpack-loader", 8 | "loader", 9 | "bash", 10 | "bash-script", 11 | "shell", 12 | "shell-script" 13 | ], 14 | "main": "index.js", 15 | "scripts": { 16 | "test": "echo \"Error: no test specified\" && exit 1" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/localjo/shell-loader.git" 21 | }, 22 | "author": "josiah.sprague@gmail.com", 23 | "license": "MIT", 24 | "dependencies": { 25 | "loader-utils": "^1.1.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://www.npmjs.com/package/shell-loader) 2 | 3 |