@docusaurus/utils
Version:
Node utility functions for Docusaurus packages.
20 lines • 798 B
JavaScript
"use strict";
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeShellArg = escapeShellArg;
// TODO move from shelljs to execa later?
// Execa is well maintained and widely used
// Even shelljs recommends execa for security / escaping:
// https://github.com/shelljs/shelljs/wiki/Security-guidelines
// Inspired by https://github.com/xxorax/node-shell-escape/blob/master/shell-escape.js
function escapeShellArg(s) {
let res = `'${s.replace(/'/g, "'\\''")}'`;
res = res.replace(/^(?:'')+/g, '').replace(/\\'''/g, "\\'");
return res;
}
//# sourceMappingURL=shellUtils.js.map