@plugjs/plug
Version:
PlugJS Build System ===================
43 lines (41 loc) • 1.65 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// plugs/exec.ts
var exec_exports = {};
module.exports = __toCommonJS(exec_exports);
var import_pipe = require("../pipe.cjs");
var import_exec = require("../utils/exec.cjs");
var import_options = require("../utils/options.cjs");
(0, import_pipe.install)("exec", class Exec {
_cmd;
_args;
_options;
constructor(...args) {
const { params, options } = (0, import_options.parseOptions)(args, {});
const [_cmd, ..._args] = params;
this._cmd = _cmd;
this._args = _args;
this._options = options;
}
async pipe(files, context) {
const { relativePaths = true, ...options } = this._options;
if (!options.cwd) options.cwd = files.directory;
const params = [...relativePaths ? files : files.absolutePaths()];
if (options.shell) params.forEach((s, i, a) => a[i] = JSON.stringify(s));
await (0, import_exec.execChild)(this._cmd, [...this._args, ...params], options, context);
return files;
}
});
//# sourceMappingURL=exec.cjs.map