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.
03.1k
1import { createRequire } from "node:module";2import { parse as parseBinding, parseSync as parseSyncBinding } from "./bindings.js";3import { wrap } from "./wrap.js";4 5export { default as visitorKeys } from "./generated/visit/keys.js";6export { Visitor } from "./visit/index.js";7 8export {9 ExportExportNameKind,10 ExportImportNameKind,11 ExportLocalNameKind,12 ImportNameKind,13 ParseResult,14 Severity,15} from "./bindings.js";16export { rawTransferSupported } from "./raw-transfer/supported.js";17 18const require = createRequire(import.meta.url);19 20// Lazily loaded as needed21let parseSyncRaw = null,22 parseRaw,23 parseSyncLazy = null,24 parseLazy,25 LazyVisitor;26 27/**28 * Lazy-load code related to raw transfer.29 * @returns {undefined}30 */31function loadRawTransfer() {32 if (parseSyncRaw === null) {33 ({ parseSyncRaw, parse: parseRaw } = require("./raw-transfer/eager.js"));34 }35}36 37/**38 * Lazy-load code related to raw transfer lazy deserialization.39 * @returns {undefined}40 */41function loadRawTransferLazy() {42 if (parseSyncLazy === null) {43 ({ parseSyncLazy, parse: parseLazy, Visitor: LazyVisitor } = require("./raw-transfer/lazy.js"));44 }45}46 47/**48 * Parse JS/TS source synchronously on current thread.49 *50 * @param {string} filename - Filename51 * @param {string} sourceText - Source text of file52 * @param {Object|undefined} options - Parsing options53 * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`54 * @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,55 * and raw transfer is not supported on this platform56 */57export function parseSync(filename, sourceText, options) {58 if (options?.experimentalRawTransfer) {59 loadRawTransfer();60 return parseSyncRaw(filename, sourceText, options);61 }62 if (options?.experimentalLazy) {63 loadRawTransferLazy();64 return parseSyncLazy(filename, sourceText, options);65 }66 return wrap(parseSyncBinding(filename, sourceText, options));67}68 69/**70 * Parse JS/TS source asynchronously on a separate thread.71 *72 * Note that not all of the workload can happen on a separate thread.73 * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects74 * has to happen on current thread. This synchronous deserialization work typically outweighs75 * the asynchronous parsing by a factor of between 3 and 20.76 *77 * i.e. the majority of the workload cannot be parallelized by using this method.78 *79 * Generally `parseSync` is preferable to use as it does not have the overhead of spawning a thread.80 * If you need to parallelize parsing multiple files, it is recommended to use worker threads.81 *82 * @param {string} filename - Filename83 * @param {string} sourceText - Source text of file84 * @param {Object|undefined} options - Parsing options85 * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`86 * @throws {Error} - If `experimentalRawTransfer` or `experimentalLazy` option is enabled,87 * and raw transfer is not supported on this platform88 */89export async function parse(filename, sourceText, options) {90 if (options?.experimentalRawTransfer) {91 loadRawTransfer();92 return await parseRaw(filename, sourceText, options);93 }94 if (options?.experimentalLazy) {95 loadRawTransferLazy();96 return await parseLazy(filename, sourceText, options);97 }98 return wrap(await parseBinding(filename, sourceText, options));99}100 101/**102 * Get `Visitor` class to construct visitors with.103 * @returns {function} - `Visitor` class104 */105export function experimentalGetLazyVisitor() {106 loadRawTransferLazy();107 return LazyVisitor;108}109 