UNPKG

kotori-bot

Version:

Cross-platform chatbot framework base on Node.js and TypeScript

75 lines (74 loc) 2.95 kB
/** * @Package kotori-bot * @Version 1.7.0 * @Author Arimura Sena <me@hotaru.icu> * @Copyright 2024-2025 Hotaru. All rights reserved. * @License BAN-ZHINESE-USING * @Link https://github.com/kotorijs/kotori * @Date 17:26:14 */ "use strict"; 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); var common_exports = {}; __export(common_exports, { CWD: () => CWD, ensureWorkspaceRoot: () => ensureWorkspaceRoot, isMatch: () => isMatch, matchesFilter: () => matchesFilter }); module.exports = __toCommonJS(common_exports); var import_node_fs = require("node:fs"); var import_node_path = __toESM(require("node:path")); var import_shelljs = __toESM(require("shelljs")); var import_picomatch = __toESM(require("picomatch")); const CWD = process.cwd(); function ensureWorkspaceRoot() { if (!(0, import_node_fs.existsSync)(import_node_path.default.join(CWD, "pnpm-workspace.yaml"))) { console.error("Please run this commamd from workspace root directory"); import_shelljs.default.exit(1); } } function isMatch(patterns, input) { return (0, import_picomatch.default)(patterns)(input); } function matchesFilter(pkg, filter) { if (!filter || filter === "*") return true; if (filter.startsWith("./")) { const [filterPath, pkgPath] = [import_node_path.default.resolve(CWD, filter), import_node_path.default.resolve(CWD, pkg.dir)]; return pkgPath.startsWith(filterPath) || isMatch(filterPath, pkgPath); } return isMatch(filter, pkg.packageJson.name); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { CWD, ensureWorkspaceRoot, isMatch, matchesFilter });