Solan Standard Library
An 18-module stdlib index with detailed CSV, package, LSP, cache, logging, formatting, worker, and template APIs linked to their source files.
Library overview
18 Solan-written modules bundled with the executable
These modules are written in Solan and bundled in the executable; they do not need separate installation. Import a module by name, then call its functions—for example, استورد "نصوص" followed by نصوص.كلمات(text). Check availability with نظام.مكتبة_قياسية("name"). The internal حزم and خادم_اللغة modules power runtime tools.
| Module | Area and notable API |
|---|---|
نصوص | Arabic normalization, trimming/padding, case conversion, similarity/edit distance, string builder. |
مسارات | Join, parse, normalize and inspect paths; containment, glob and search. |
مجموعات | Set, queue, stack, deque, priority queue, counters and list grouping utilities. |
عرض | Formatting numbers, sizes, currency, durations, and Arabic number words; details below. |
تواريخ | Date/time arithmetic, Gregorian/Hijri calendar, ISO and strftime. |
جداول | CSV/TSV, headers/columns, sort/group/statistics; API details below. |
قوالب | Text/HTML templates with conditions, loops, filters, and HTML escaping; details below. |
مخطط | Data-shape rules, validation, and path-aware errors. |
نتيجة | Result/Option types, transformations, collection, and retry helpers. |
ألوان | Terminal ANSI colors, frames, progress bars, visible width. |
اختبار | Suites, tests, hooks, assertions, mocks, and test reports. |
سجل | Level-based loggers, files, formats, and custom handlers. |
ذاكرة | Cache with optional expiry and statistics; details below. |
بث | Event emitter with persistent or one-shot listeners. |
عمال | Worker processes, channels, promises, and pools; details below. |
وسائط | Command-line option parsing, help, and subcommands. |
حزم | Manifest/lock/dependency/store management and verification. |
خادم_اللغة | JSON-RPC/stdio LSP server. |
This index distinguishes README-documented APIs from signatures extracted directly from module definitions. Not every module has the same level of detail here; each source file is linked below.
README API index
Other module APIs
| Module | API names documented in README |
|---|---|
نصوص | هل_فارغ, نظف_يسار/يمين, ازل_بادئة/لاحقة, اقتطع, كلمات, عد, املأ_يسار/يمين, وسّط, طبّع_عربي, هل_عربي, الى_هندية, مفكك, ثعباني, جمل, وصلة_رابط, مسافة, تشابه, اقرب, جديد. |
مسارات | ضم, الاسم, المجلد, الامتداد, طبّع_المسار, حلل, نسبي, هل_داخل, مطابق, ابحث, مجلد_مؤقت. |
مجموعات | مجموعة_من, طابور, مكدس, ثنائي_الطرف, كومة, عداد, دفعات, نوافذ, ازواج, جمّع, قسّم_حسب, عينة, ادمج_قواميس. |
تواريخ | انشئ, اجزاء, اضف, اطرح, فرق, day/month/year/week boundaries, leap-year checks, Arabic names, ISO, and Hijri conversion helpers. |
مخطط | سلسلة, عدد, منطقي, قائمة_من, كائن, اي, صالح, افحص, افتح. |
نتيجة | نجاح, فشل, محاولة, اعد_المحاولة, تجميع, تجميع_اخطاء, شيء, غائب, من_قيمة, من_قاموس, من_قائمة, plus Result/Option methods. |
ألوان | ANSI color names, غامق, لون, لون256, rgb, هيكس, وسوم, ازل, طول_مرئي, اطار, شريط_تقدم. |
اختبار | مجموعة, اختبر, ارجئ, فقط, before/after hooks, equality/type/content/error assertions, وهمية, call-count helpers, شغل_الكل. |
بث | جديد; object methods: على, مرة, الغ, امسح, ارسل, عدد_المستمعين, اسماء_الاحداث. |
وسائط | حلل, مساعدة, حلل_او_اخرج, حلل_اوامر, مساعدة_اوامر. |
This is a README name index, not a complete contract for every argument type or implementation branch. Check the linked source files for the current branch.
Detailed source-derived APIs
جداول: CSV and TSV
| Signature | Source-derived behavior |
|---|---|
كشف_فاصل(text) | Counts delimiters on the first line among comma, semicolon, tab, and pipe; ties keep the first candidate. |
حلل(text, separator=",") | Parses rows and quoted fields, including doubled quote escaping; LF ends a row and CR is ignored. |
حلل_رؤوس(text, separator=",") | Uses the first row as headers and fills missing cells with an empty string. |
حول_انواع(maps) | Returns new maps and converts string values using _قيمة rules. |
كتب(rows, separator=",") | Writes rows, quoting cells and doubling embedded quotes when needed. |
اعمدة(maps) | Collects map keys in first-seen order without duplicates. |
كتب_قواميس(maps, headers=عدم, separator=",") | Writes a header row and rows by column order. |
اقرا(path, separator=عدم) | Reads a file and parses header maps; detects a separator when omitted. Depends on ملفات. |
احفظ(path, data, separator=",") | Writes rows or maps to a file; depends on ملفات. |
حلل_tsv(text) / كتب_tsv(maps) | Tab-separated shortcuts. |
اختر(maps, columns) | Returns new maps containing selected keys. |
رتب_حسب(maps, column, descending=غلط) | Sorts a copy by a column; mixed-type comparison behavior is not specified here. |
جمّع_حسب(maps, column) / فريد_حسب(maps, column) | Groups by column value or keeps the first map per value. |
مجموع / متوسط / اعلى / ادنى(maps, column) | Statistics over numeric values; mean/min/max return nil when none are available. |
عمود(maps, column) | Returns values from a column. |
اعرض(data, headers=عدم, limit=40) | Formats a terminal table, aligns numeric values, and truncates cells. Depends on ألوان and نصوص. |
The source does not explicitly reject an unclosed quote or extra data fields beyond header count; do not assume validation it does not specify. These functions were not executed while preparing this page.
Detailed source-derived APIs
Packages and language server
These internal modules power Solan tools. The inspected files have no explicit export declarations; the signatures below describe source definitions, not a promise that every function is importable by ordinary programs.
| Module | Signature / limit |
|---|---|
حزم | البيان="solan.json", القفل="solan.lock"; source limits: 5,000 files, 50 MiB, 500 dependencies, 500 registered project roots. |
بصمة(directory) | Collects files, ignores .git and .solan-meta, rejects symlinks, computes SHA-256; may raise file/count/size errors. |
ثبت_الكل(frozen=غلط, quiet=غلط, local=غلط) | Resolves manifest/lock and installs dependencies; frozen mode requires a valid lock and checks hashes. |
اضف(spec, name=عدم) | Updates dependency and installs; restores/removes the dependency if installation fails. |
احذف(name) | Removes a dependency from the manifest and rebuilds the lock; does not remove it from the shared store. |
حدّث(name=عدم, major=غلط) | Resolves one/all dependencies; can change a Git version range with major. |
اعرض(tree=غلط, store=غلط) / لماذا(name) / قديمة() | Lists dependencies, tree/store, dependency provenance, or available updates. |
تحقق() / نظف_المتجر(dry_run=غلط) / نظف_الكاش() | Checks lock hashes, removes unused packages (or previews), and clears temporary downloads. |
بدء(library=غلط) / انشر(dry_run=غلط, push=غلط) | Initializes project/library and validates release tags; dry-run does not create a tag. |
خادم_اللغة.شغل() | JSON-RPC/LSP loop; advertises full sync, dot-triggered completion, hover, definition, document symbols, and document/diagnostic messages. |
The package module depends on git, files/JSON/system, and hashing. Git packages have no digital signature in README; integrity uses the locked commit and SHA-256. See the security page.
Detailed source-derived APIs
Cache, logging, and formatting
| API | Source-described behavior |
|---|---|
ذاكرة.جديد(capacity=0, age=0) | Creates a cache; zero means no capacity eviction/expiry. |
ذاكرة_مؤقتة.ضع(key, value, age=عدم) | Stores a value and optional expiry; once a positive capacity is exceeded, removes the first key returned by the backing map. |
خذ(key, default=عدم) / يوجد(key) | Lazy expiry; خذ updates hit/miss counters, while يوجد neither deletes nor changes counters. |
احذف / امسح / نظف / حجم / مفاتيح | Delete/clear/clean expired/measure/list keys. Clear does not reset hit statistics. |
احسب(key, fn, age=عدم) / احصائيات() | Computes on a cache miss; statistics include hits, misses, hit ratio, and size. |
ذاكرة.احفظ_نتيجة(fn, age=0, capacity=0) | Returns a function closed over a result cache. |
سجل.مستوى(level) / ملف(path) / صيغة(format) | Sets threshold, output path, or text/JSON format. Levels: debug=10, info=20, warning=30, error=40, critical=50. |
اضف_معالج(fn) / امسح_المعالجات() | Manage handlers receiving a record with level, message, logger, fields, and line. |
سجل.جديد(name="", fields={}) | Creates a logger with level methods, مع(fields), and فرعي(name). |
سجل(level, ...values) and shortcuts | تصحيح, معلومة, تحذير, خطأ, حرج; messages below the configured threshold are ignored. |
عرض.ارقام_مفصولة(n, separator=",", decimals=عدم) | Formats digit groups; scientific-number strings are preserved. |
حجم_ملف(bytes, decimals=1, Arabic=غلط) / نسبة / عملة | Formats 1024-based sizes, percentages, and currency. |
عدد_معدود(n, singular, dual, plural, many=عدم) | Selects an Arabic noun form based on number. |
مدة(seconds, limit=2) / مدة_قصيرة(seconds) | Formats durations in long or compact units. |
عدد_بالحروف(n) | Converts a number to Arabic words; raises “العدد كبير جدا” past the scale table. |
The cache source does not guarantee map-key order for eviction or specify argument types/callback error handling. Check the linked source for your version.
Detailed source-derived APIs
Workers and templates
| API | Source-described behavior |
|---|---|
عمال.انشئ(fn) | Creates an isolated worker process and line-oriented JSON channel; returns a worker object. |
عامل.اطلب(message) | Sends an incrementing request ID and returns a promise; replies resolve a value or reject with an error; EOF rejects pending promises. |
عامل.ارسل(message) / استقبل() / عند_رسالة(fn) / انهِ() | Send/receive, handle unsolicited messages, and close the worker/socket/process. |
عمال.خادم_طلبات(handler) | Runs a request loop and sends a result or error string for each request. |
عمال.مجمع_جديد(count, handler) | Creates a pool of the requested size and initializes per-worker busy counters. |
مجمع.نفذ(data) / حول(list) / اغلق() | Dispatches to a least-busy worker, returns a promise or parallel results, then closes workers. |
قوالب.هرب_html(text) | Escapes &, <, >, double quote, and single quote to HTML entities. |
قوالب.صرّف(template) | Parses a template into tokens; checks #اذا/#لكل closure and errors on unbalanced syntax. |
قوالب.ارسم(template, data={}, escape=غلط) | Renders text or a token tree with {{...}}, paths, filters, conditions, and loops. |
قوالب.ارسم_html(template, data={}) | Same as render but enables HTML escaping for non-raw values. |
- Template syntax includes
{{name}}, a raw form recognized by the tokenizer, and{{#اذا ...}}/{{#لكل ...}}blocks withوالا. - Worker requests use JSON per line. Do not assume map key order or the origin of worker promises without checking runtime sources.
Library overview
Dependencies and accuracy boundaries
Detailed source inspection in this page covers eight files: جداول, حزم, خادم_اللغة, ذاكرة, سجل, عرض, عمال, and قوالب. Other modules are indexed from README with direct links to their files.
- README and illustrative samples here were not executed as part of this task; they are not execution tests.
- Several files have no explicit export declarations or argument/return types; this reference does not invent those contracts.
- Modules may depend on other modules such as
ملفات,جيسون,نظام,زمن,ألوان,نصوص, or language built-ins. - See the dedicated pages for installation and CLI instructions; they are not duplicated here.
Source files
Direct links pinned to the source snapshot used by this reference; the main branch may change later.
- README.md
- src/vm/stdlib_embed.inc
- stdlib/ألوان.سو
- stdlib/اختبار.سو
- stdlib/بث.سو
- stdlib/تواريخ.سو
- stdlib/جداول.سو
- stdlib/حزم.سو
- stdlib/خادم_اللغة.سو
- stdlib/ذاكرة.سو
- stdlib/سجل.سو
- stdlib/عرض.سو
- stdlib/عمال.سو
- stdlib/قوالب.سو
- stdlib/مجموعات.سو
- stdlib/مخطط.سو
- stdlib/مسارات.سو
- stdlib/نتيجة.سو
- stdlib/نصوص.سو
- stdlib/وسائط.سو