0b9b218f3fb1f1b252867d29cf3fd1f6de93d486fc94b247e1c9263a5281533a854f053d9f102ccebc2822d51d5290b38d48ceeb3fabdc5a4c234bbac050d4 953 B

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.pathArg = void 0;
  4. const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
  5. const path_1 = require("path");
  6. const pathArg = (path) => {
  7. if (/\0/.test(path)) {
  8. // simulate same failure that node raises
  9. throw Object.assign(new TypeError('path must be a string without null bytes'), {
  10. path,
  11. code: 'ERR_INVALID_ARG_VALUE',
  12. });
  13. }
  14. path = (0, path_1.resolve)(path);
  15. if (platform === 'win32') {
  16. const badWinChars = /[*|"<>?:]/;
  17. const { root } = (0, path_1.parse)(path);
  18. if (badWinChars.test(path.substring(root.length))) {
  19. throw Object.assign(new Error('Illegal characters in path.'), {
  20. path,
  21. code: 'EINVAL',
  22. });
  23. }
  24. }
  25. return path;
  26. };
  27. exports.pathArg = pathArg;
  28. //# sourceMappingURL=path-arg.js.map