UNPKG

botbuilder

Version:

Bot Builder is a framework for building rich bots on virtually any platform.

101 lines (97 loc) 4.19 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/filenamify/index.js var index_exports = {}; __export(index_exports, { default: () => filenamify, filenamifyPath: () => filenamifyPath }); module.exports = __toCommonJS(index_exports); // ../../node_modules/filename-reserved-regex/index.js function filenameReservedRegex() { return /[<>:"/\\|?*\u0000-\u001F]/g; } function windowsReservedNameRegex() { return /^(con|prn|aux|nul|com\d|lpt\d)$/i; } // node_modules/filenamify/filenamify.js var MAX_FILENAME_LENGTH = 100; var reRelativePath = /^\.+(\\|\/)|^\.+$/; var reTrailingPeriods = /\.+$/; function filenamify(string, options = {}) { const reControlChars = /[\u0000-\u001F\u0080-\u009F]/g; const reRepeatedReservedCharacters = /([<>:"/\\|?*\u0000-\u001F]){2,}/g; if (typeof string !== "string") { throw new TypeError("Expected a string"); } const replacement = options.replacement === void 0 ? "!" : options.replacement; if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { throw new Error("Replacement string cannot contain reserved filename characters"); } if (replacement.length > 0) { string = string.replace(reRepeatedReservedCharacters, "$1"); } string = string.normalize("NFD"); string = string.replace(reRelativePath, replacement); string = string.replace(filenameReservedRegex(), replacement); string = string.replace(reControlChars, replacement); string = string.replace(reTrailingPeriods, ""); if (replacement.length > 0) { const startedWithDot = string[0] === "."; if (!startedWithDot && string[0] === ".") { string = replacement + string; } if (string[string.length - 1] === ".") { string += replacement; } } string = windowsReservedNameRegex().test(string) ? string + replacement : string; const allowedLength = typeof options.maxLength === "number" ? options.maxLength : MAX_FILENAME_LENGTH; if (string.length > allowedLength) { const extensionIndex = string.lastIndexOf("."); if (extensionIndex === -1) { string = string.slice(0, allowedLength); } else { const filename = string.slice(0, extensionIndex); const extension = string.slice(extensionIndex); string = filename.slice(0, Math.max(1, allowedLength - extension.length)) + extension; } } return string; } // node_modules/filenamify/filenamify-path.js var import_node_path = __toESM(require("path"), 1); function filenamifyPath(filePath, options) { filePath = import_node_path.default.resolve(filePath); return import_node_path.default.join(import_node_path.default.dirname(filePath), filenamify(import_node_path.default.basename(filePath), options)); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { filenamifyPath }); //# sourceMappingURL=index.js.map