Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
webServerPlugin.js210 linesDownload Raw Back to plugins
1"use strict";2var __create = Object.create;3var __defProp = Object.defineProperty;4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;5var __getOwnPropNames = Object.getOwnPropertyNames;6var __getProtoOf = Object.getPrototypeOf;7var __hasOwnProp = Object.prototype.hasOwnProperty;8var __export = (target, all) => {9  for (var name in all)10    __defProp(target, name, { get: all[name], enumerable: true });11};12var __copyProps = (to, from, except, desc) => {13  if (from && typeof from === "object" || typeof from === "function") {14    for (let key of __getOwnPropNames(from))15      if (!__hasOwnProp.call(to, key) && key !== except)16        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });17  }18  return to;19};20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(21  // If the importer is in node compatibility mode or this is not an ESM22  // file that has been converted to a CommonJS file using a Babel-23  // compatible transform (i.e. "__esModule" has not been set), then set24  // "default" to the CommonJS "module.exports" for node compatibility.25  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,26  mod27));28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);29var webServerPlugin_exports = {};30__export(webServerPlugin_exports, {31  WebServerPlugin: () => WebServerPlugin,32  webServer: () => webServer,33  webServerPluginsForConfig: () => webServerPluginsForConfig34});35module.exports = __toCommonJS(webServerPlugin_exports);36var import_net = __toESM(require("net"));37var import_path = __toESM(require("path"));38var import_utils = require("playwright-core/lib/utils");39var import_utils2 = require("playwright-core/lib/utils");40var import_utilsBundle = require("playwright-core/lib/utilsBundle");41const DEFAULT_ENVIRONMENT_VARIABLES = {42  "BROWSER": "none",43  // Disable that create-react-app will open the page in the browser44  "FORCE_COLOR": "1",45  "DEBUG_COLORS": "1"46};47const debugWebServer = (0, import_utilsBundle.debug)("pw:webserver");48class WebServerPlugin {49  constructor(options, checkPortOnly) {50    this.name = "playwright:webserver";51    this._options = options;52    this._checkPortOnly = checkPortOnly;53  }54  async setup(config, configDir, reporter) {55    this._reporter = reporter;56    this._isAvailableCallback = this._options.url ? getIsAvailableFunction(this._options.url, this._checkPortOnly, !!this._options.ignoreHTTPSErrors, this._reporter.onStdErr?.bind(this._reporter)) : void 0;57    this._options.cwd = this._options.cwd ? import_path.default.resolve(configDir, this._options.cwd) : configDir;58    try {59      await this._startProcess();60      await this._waitForProcess();61    } catch (error) {62      await this.teardown();63      throw error;64    }65  }66  async teardown() {67    debugWebServer(`Terminating the WebServer`);68    await this._killProcess?.();69    debugWebServer(`Terminated the WebServer`);70  }71  async _startProcess() {72    let processExitedReject = (error) => {73    };74    this._processExitedPromise = new Promise((_, reject) => processExitedReject = reject);75    const isAlreadyAvailable = await this._isAvailableCallback?.();76    if (isAlreadyAvailable) {77      debugWebServer(`WebServer is already available`);78      if (this._options.reuseExistingServer)79        return;80      const port = new URL(this._options.url).port;81      throw new Error(`${this._options.url ?? `http://localhost${port ? ":" + port : ""}`} is already used, make sure that nothing is running on the port/url or set reuseExistingServer:true in config.webServer.`);82    }83    if (!this._options.command)84      throw new Error("config.webServer.command cannot be empty");85    debugWebServer(`Starting WebServer process ${this._options.command}...`);86    const { launchedProcess, gracefullyClose } = await (0, import_utils.launchProcess)({87      command: this._options.command,88      env: {89        ...DEFAULT_ENVIRONMENT_VARIABLES,90        ...process.env,91        ...this._options.env92      },93      cwd: this._options.cwd,94      stdio: "stdin",95      shell: true,96      attemptToGracefullyClose: async () => {97        if (process.platform === "win32")98          throw new Error("Graceful shutdown is not supported on Windows");99        if (!this._options.gracefulShutdown)100          throw new Error("skip graceful shutdown");101        const { signal, timeout = 0 } = this._options.gracefulShutdown;102        process.kill(-launchedProcess.pid, signal);103        return new Promise((resolve, reject) => {104          const timer = timeout !== 0 ? setTimeout(() => reject(new Error(`process didn't close gracefully within timeout`)), timeout) : void 0;105          launchedProcess.once("close", (...args) => {106            clearTimeout(timer);107            resolve();108          });109        });110      },111      log: () => {112      },113      onExit: (code) => processExitedReject(new Error(code ? `Process from config.webServer was not able to start. Exit code: ${code}` : "Process from config.webServer exited early.")),114      tempDirectories: []115    });116    this._killProcess = gracefullyClose;117    debugWebServer(`Process started`);118    launchedProcess.stderr.on("data", (data) => {119      if (debugWebServer.enabled || (this._options.stderr === "pipe" || !this._options.stderr))120        this._reporter.onStdErr?.(prefixOutputLines(data.toString(), this._options.name));121    });122    launchedProcess.stdout.on("data", (data) => {123      if (debugWebServer.enabled || this._options.stdout === "pipe")124        this._reporter.onStdOut?.(prefixOutputLines(data.toString(), this._options.name));125    });126  }127  async _waitForProcess() {128    if (!this._isAvailableCallback) {129      this._processExitedPromise.catch(() => {130      });131      return;132    }133    debugWebServer(`Waiting for availability...`);134    const launchTimeout = this._options.timeout || 60 * 1e3;135    const cancellationToken = { canceled: false };136    const { timedOut } = await Promise.race([137      (0, import_utils.raceAgainstDeadline)(() => waitFor(this._isAvailableCallback, cancellationToken), (0, import_utils.monotonicTime)() + launchTimeout),138      this._processExitedPromise139    ]);140    cancellationToken.canceled = true;141    if (timedOut)142      throw new Error(`Timed out waiting ${launchTimeout}ms from config.webServer.`);143    debugWebServer(`WebServer available`);144  }145}146async function isPortUsed(port) {147  const innerIsPortUsed = (host) => new Promise((resolve) => {148    const conn = import_net.default.connect(port, host).on("error", () => {149      resolve(false);150    }).on("connect", () => {151      conn.end();152      resolve(true);153    });154  });155  return await innerIsPortUsed("127.0.0.1") || await innerIsPortUsed("::1");156}157async function waitFor(waitFn, cancellationToken) {158  const logScale = [100, 250, 500];159  while (!cancellationToken.canceled) {160    const connected = await waitFn();161    if (connected)162      return;163    const delay = logScale.shift() || 1e3;164    debugWebServer(`Waiting ${delay}ms`);165    await new Promise((x) => setTimeout(x, delay));166  }167}168function getIsAvailableFunction(url, checkPortOnly, ignoreHTTPSErrors, onStdErr) {169  const urlObject = new URL(url);170  if (!checkPortOnly)171    return () => (0, import_utils.isURLAvailable)(urlObject, ignoreHTTPSErrors, debugWebServer, onStdErr);172  const port = urlObject.port;173  return () => isPortUsed(+port);174}175const webServer = (options) => {176  return new WebServerPlugin(options, false);177};178const webServerPluginsForConfig = (config) => {179  const shouldSetBaseUrl = !!config.config.webServer;180  const webServerPlugins = [];181  for (const webServerConfig of config.webServers) {182    if (webServerConfig.port && webServerConfig.url)183      throw new Error(`Either 'port' or 'url' should be specified in config.webServer.`);184    let url;185    if (webServerConfig.port || webServerConfig.url) {186      url = webServerConfig.url || `http://localhost:${webServerConfig.port}`;187      if (shouldSetBaseUrl && !webServerConfig.url)188        process.env.PLAYWRIGHT_TEST_BASE_URL = url;189    }190    webServerPlugins.push(new WebServerPlugin({ ...webServerConfig, url }, webServerConfig.port !== void 0));191  }192  return webServerPlugins;193};194function prefixOutputLines(output, prefixName = "WebServer") {195  const lastIsNewLine = output[output.length - 1] === "\n";196  let lines = output.split("\n");197  if (lastIsNewLine)198    lines.pop();199  lines = lines.map((line) => import_utils2.colors.dim(`[${prefixName}] `) + line);200  if (lastIsNewLine)201    lines.push("");202  return lines.join("\n");203}204// Annotate the CommonJS export names for ESM import in node:2050 && (module.exports = {206  WebServerPlugin,207  webServer,208  webServerPluginsForConfig209});210 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai