npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vtima.me/ucode-types

v0.1.3

Published

TypeScript declarations for ucode (OpenWrt scripting language)

Downloads

315

Readme

@vtima.me/ucode-types

npm license

TypeScript-декларации для ucode — скриптового языка, используемого в OpenWrt.

Обеспечивает автодополнение, проверку типов и встроенную документацию для встроенных функций и стандартных модулей ucode. Документация взята из официальных исходников ucode на C.

English version

Что включено

Глобальные встроенные функцииprintf, sprintf, print, warn, push, pop, shift, unshift, map, filter, reduce, sort, reverse, splice, slice, uniq, join, split, replace, match, regexp, wildcard, type, length, keys, values, exists, proto, substr, trim, ltrim, rtrim, lc, uc, chr, uchr, ord, hex, int, abs, min, max, b64enc, b64dec, hexenc, hexdec, json, iptoarr, arrtoip, system, signal, sleep, time, clock, localtime, gmtime, timelocal, timegm, die, exit, assert, getenv, require, include, render, loadstring, loadfile, call, sourcepath, trace, gc.

Модули стандартной библиотеки:

| Модуль | Описание | |--------|----------| | fs | Файловая система — open, read, write, stat, glob, pipes, временные файлы, работа с каталогами | | uci | Конфигурация OpenWrt — cursor, get/set/foreach, commit, list append/remove | | ubus | IPC OpenWrt — call, defer, publish, subscribe, events, channels | | uloop | Цикл событий — таймеры, интервалы, handles, процессы, задачи, сигналы | | math | Математика — тригонометрия, pow, sqrt, log, floor/ceil, rand, isnan/isinf | | socket | Сеть — TCP/UDP/Unix-сокеты, DNS-резолвинг, poll | | struct | Бинарные данные — pack/unpack с форматными строками, потоковые буферы | | log | Логирование — syslog + OpenWrt ulog с уровнями приоритета | | digest | Хеширование — md5, sha1, sha256, sha384, sha512, fnv1a64 (строки + файлы) | | zlib | Сжатие — deflate/inflate, потоковое, поддержка gzip | | io | Низкоуровневый ввод/вывод — операции с fd, pipes, fcntl, ioctl | | debug | Отладка — traceback, sourcepos, инспекция локальных переменных и upvalue | | nl80211 | Wi-Fi — nl80211 netlink-запросы, слушатели событий | | rtnl | Маршрутизация — routing netlink-запросы, управление интерфейсами/маршрутами/соседями | | resolv | DNS — запросы с опциями type/nameserver/timeout |

Установка

npm install -D @vtima.me/ucode-types

Настройка

Синтаксис ucode близок к JavaScript, поэтому рекомендуется писать .js файлы и ассоциировать .uc файлы с JavaScript в IDE.

1. Создайте src/env.d.ts:

/// <reference types="@vtima.me/ucode-types" />

2. Создайте tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2015",
    "module": "ES2015",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": false,
    "noEmit": true
  },
  "include": ["src"]
}

3. Пишите ucode-скрипты как .js файлы:

import { readfile, stat, lsdir } from 'fs';
import { cursor } from 'uci';
import { connect } from 'ubus';

let uci = cursor();
uci.load('network');

uci.foreach('network', 'interface', (s) => {
    printf("%s: proto=%s\n", s['.name'], s.proto);
});

let conn = connect();
let info = conn.call('system', 'info');
printf("Uptime: %ds\n", info.uptime);
conn.disconnect();

IDE будет подсказывать типы, автодополнение и встроенную документацию для всех функций и модулей ucode.

Известные ограничения

  • for...in vs for...of — в ucode for (let x in arr) итерирует значения (как JS for...of). В .js файлах используйте for...of для корректного вывода типов в IDE.
  • Функция length() — глобальная функция length() конфликтует со свойством Array.length в JS. Используйте свойство .length для массивов и строк.
  • Предупреждения о модулях — IDE может предупреждать, что fs, uci и др. отсутствуют в package.json. Это модули среды выполнения ucode — подавьте через настройки инспекций IDE.
  • Ключевое слово delete — глобальная функция delete(obj, key) в ucode конфликтует с оператором delete в JS и не может быть объявлена как глобальная функция.

Лицензия

MIT