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

@andyjinxi/sii-lang

v1.2.203

Published

Sii programming language compiler - Show is ideal

Readme

中文 | English

Sii Language

Sii 是一门基于 TypeScript 开发的领域特定语言 DSL,用于现代全栈 Web 应用开发。语言强调强类型与声明式风格,让你以简洁直观的语法构建可维护的用户界面与业务逻辑。

核心特性

CLI 命令

Sii 提供内置 CLI 覆盖项目初始化、编译运行、语言与镜像设置、以及第三方库管理等工作流。

# 项目初始化
sii init MyProj                   # 初始化通用项目
sii init-web MyWeb               # 初始化 Web 模板项目

# 编译 / 运行
sii compile src/index.sii -o dist/index.ts   # 编译单个文件到 TS
sii run src/index.sii                        # 直接运行单个 Sii 文件
sii run --web . --serve                      # Web 项目开发预览(本地服务+自动编译)
sii run --web . --build                      # Web 项目仅构建(产出 dist/pages)

# CLI 自身版本
sii version                     # 显示当前 Sii CLI 版本
sii update                      # 升级到最新 Sii CLI(加 --check-only 仅检查)

# 语言设置
sii language --current          # 查看当前 CLI 语言
sii language --list             # 列出可用语言(zh-CN / en)
sii language --set en           # 切换为英文(示例:en / zh-CN)

# 镜像源管理
sii mirror --list                                   # 列出可用镜像
sii mirror --current                                # 查看当前默认镜像
sii mirror --add "myMirror https://registry.example.com"   # 新增镜像(名称 URL)
sii mirror --remove myMirror                        # 移除镜像
sii mirror --set-default npm                        # 设为默认镜像

# 第三方库管理(lib.*)
sii install math                  # 安装库(以安装math库为示例)
sii list                          # 查看已安装库
sii uninstall math                # 卸载库
sii versions math                 # 查看某个库的全部版本
sii update-lib                    # 更新所有已安装库到最新
sii update-lib math               # 更新指定库到最新
sii update-lib math:0.0.2         # 更新到指定版本(name:version)

声明式 UI 构建

通过组件化的方式构建用户界面,使用 @Component@BuilderUI@BuilderLogic 注解分离UI结构和业务逻辑。支持链式属性调用和组件嵌套,让界面代码更加直观易读。

@Component
struct HomePage {
    @BuilderUI {
        Col()
            .gap(24)
            .padding(20)
            .align("center")
        {
            Text("欢迎使用 Sii")
                .fontSize(24)
                .color("#1976d2")
                .margin(16)
            
            Button("开始探索")
                .onClick(this.handleStart)
                .backgroundColor("#22c55e")
                .color("white")
                .padding(12)
                .borderRadius(8)
        }
    }
    
    @BuilderLogic {
        func handleStart(): void {
            // handle click
        }
    }
}

强类型系统

内置完整的类型系统,支持 intsinglefstringbool 等基础类型,以及类型推断和显式类型注解。编译时进行类型检查,有效减少运行时错误,提高代码质量和开发效率。

// Type-safe, compile-time checked
func calculateArea(width: singlef, height: singlef): singlef {
    back width * height;
}

// Type inference
let area: singlef = calculateArea(10.5, 20.3);

控制流

提供现代化的控制流语法,支持条件分支 if/esle if/else、循环控制 forloopwhile,以及 continue/break 语句。语法简洁直观,让程序逻辑更加清晰易读。

// Conditional branches
if (score >= 90) {
    back "优秀";
} esle if (score >= 60) {
    back "良好";
} else {
    back "需要努力";
}

// Loop control
forloop (let i: int = 0; i < items.length; i++) {
    processItem(items[i]);
}

模块化与库管理

采用 cite 语法进行模块导入,支持标准库 sii.* 和第三方库 lib.* 的统一管理。通过库中心提供版本控制、依赖解析和自动更新功能,让代码复用和项目管理更加便捷。

// Import standard libraries
cite { add, multiply, sqrt } from lib.math;
cite { formatDate, parseTime } from lib.time;

// Use library functions
let result: singlef = sqrt(add(16, 9)); // 5.0

标准库概览

sii 内置标准库(47+)

  • readText 读取文本文件
  • writeText 写入文本文件
  • exists 检查文件是否存在
  • mkdirs 创建目录
  • pathJoin 路径拼接
  • cwd 获取当前工作目录
  • env 获取环境变量
  • Date 时间日期格式化
  • length 获取长度
  • jsonParse JSON解析
  • jsonStringify JSON序列化
  • exec 执行系统命令
  • execOut 执行命令并获取输出
  • get HTTP GET请求
  • post HTTP POST请求
  • put HTTP PUT请求
  • delete HTTP DELETE请求
  • options HTTP OPTIONS请求
  • head HTTP HEAD请求
  • listen 启动HTTP服务器
  • respText 响应文本
  • respJson 响应JSON
  • respHtml 响应HTML
  • log 控制台日志
  • warn 控制台警告
  • error 控制台错误
  • bindDOM DOM绑定
  • routerGet 获取当前路由
  • routerSet 设置路由
  • routerRegister 注册路由
  • routerSubscribe 订阅路由变化
  • routerUseGuard 路由守卫
  • routerOnAfterEach 路由后置钩子
  • routerLoad 路由加载器
  • portal 门户组件
  • lockBody 锁定页面滚动
  • unlockBody 解锁页面滚动
  • focusTrap 焦点陷阱
  • vlistCreate 创建虚拟列表
  • theme 设置主题
  • themeScope 设置主题作用域
  • createSignal 创建响应式信号
  • createMemo 创建记忆化计算
  • createEffect 创建副作用
  • createResource 创建资源
  • renderToString 渲染为字符串
  • hydrate 水合
  • devtoolsSubscribe 订阅开发工具
  • devtoolsEmit 发送开发工具事件

lib. 第三方库生态

Sii 提供了完整的第三方库生态系统,库中心是云端的公共仓库。当项目需要第三方库作为依赖时,开发者使用 CLI 从云端库中心拉取到本地;为提升可用性,CLI 支持配置多个“镜像”,安装时将从当前默认镜像下载。

镜像的配置命令已在上文 CLI 小节说明,此处不再赘述。使用 sii install <库名> 安装库,sii update-lib 更新已安装库。

目前第三方库数量较少、使用频度也相对不高,暂提供“提交想法”流程:开发者通过提交想法表单提交库的名称、简介、作者等信息,管理员审核通过后由管理员上传至云端库中心,随后用户即可通过 CLI 安装使用。你也可以参考“库开发指南”完善库的实现与文档,提高通过率。

快速开始

安装

npm install -g @andyjinxi/sii-lang

创建 Web 项目

# 初始化项目
sii init-web MyApp
cd MyApp

# 开发模式 支持热重载
sii run --web . --serve

# 生产构建
sii run --web . --build

项目结构

MyApp/
├── pages/           # 页面文件
│   └── Index.sii    # 首页组件
├── assets/          # 静态资源
└── dist/            # 编译输出
    └── pages/       # 生成的 TypeScript 代码

为什么选择 Sii

  • 声明式UI:组件化开发,UI与逻辑分离,代码更易维护
  • 强类型安全:编译时类型检查,减少运行时错误,提升开发效率
  • 统一前后端:一套语法同时支持前端界面和后端逻辑开发
  • 丰富标准库:47+内置API覆盖文件、网络、UI、路由等全栈开发需求
  • 现代语法:简洁直观的控制流和模块化设计,学习成本低
  • TypeScript生态:编译为TypeScript,无缝集成现有前端工具链

开发工具

SiiDeal IDE - 专为 Sii 语言设计的现代化集成开发环境,参考 JetBrains 和 VSCode 的设计理念,提供完整的开发体验。

核心功能

  • 智能编辑器:基于 Monaco Editor,支持语法高亮、智能补全、代码折叠、多光标编辑
  • 项目管理:文件资源管理器、多标签编辑、全局搜索
  • 开发工具:集成终端、问题面板、输出面板、调试控制台
  • 现代化界面:深色/浅色主题、响应式设计、流畅动画效果
  • 调试支持:断点设置、变量监视、调用堆栈、调试控制台
  • 代码分析:错误标记、警告提示、代码格式化、括号匹配
  • 个性化设置:主题切换、字体调节、编辑器配置、CLI环境自配置

学习与生态


开始你的 Sii 编程之旅 → sii 主页


Sii Language (English)

Sii is a TypeScript-based domain specific language for modern full‑stack web development. It emphasizes strong typing and a declarative style so you can build maintainable UI and business logic with concise syntax.

Core Features

CLI Commands

Sii CLI covers project initialization, compile/run, language and mirror settings, and third‑party library management.

# Project initialization
sii init MyProj                   # Initialize a general project
sii init-web MyWeb               # Initialize a web template project

# Compile / Run
sii compile src/index.sii -o dist/index.ts   # Compile single file to TS
sii run src/index.sii                        # Run a single Sii file
sii run --web . --serve                      # Web dev preview (local server + auto build)
sii run --web . --build                      # Web build only (outputs dist/pages)

# CLI version
sii version                     # Show current Sii CLI version
sii update                      # Upgrade Sii CLI (use --check-only to only check)

# Language settings
sii language --current          # Show current CLI language
sii language --list             # List available languages (zh-CN / en)
sii language --set en           # Switch language (e.g., en / zh-CN)

# Mirror management
sii mirror --list                                   # List available mirrors
sii mirror --current                                # Show current default mirror
sii mirror --add "myMirror https://registry.example.com"   # Add mirror (name URL)
sii mirror --remove myMirror                        # Remove mirror
sii mirror --set-default npm                        # Set default mirror

# Third‑party libraries (lib.*)
sii install math                  # Install library (use math as example)
sii list                          # List installed libraries
sii uninstall math                # Uninstall library
sii versions math                 # Show all versions of a library
sii update-lib                    # Update all installed libraries to latest
sii update-lib math               # Update the specified library to latest
sii update-lib math:0.0.2         # Update to a specific version (name:version)

Declarative UI

Build UI with components, using @Component, @BuilderUI, and @BuilderLogic to separate structure from logic. Supports chained properties and nested components for readable layouts.

@Component
struct HomePage {
    @BuilderUI {
        Col()
            .gap(24)
            .padding(20)
            .align("center")
        {
            Text("Hello Sii")
                .fontSize(24)
                .color("#1976d2")
                .margin(16)
            
            Button("Get Started")
                .onClick(this.handleStart)
                .backgroundColor("#22c55e")
                .color("white")
                .padding(12)
                .borderRadius(8)
        }
    }
    
    @BuilderLogic {
        func handleStart(): void {
            // handle click
        }
    }
}

Strong Type System

Built-in types like int, singlef, string, bool, with inference and explicit annotations. Compile-time checks reduce runtime errors and improve reliability.

// Type-safe, compile-time checked
func calculateArea(width: singlef, height: singlef): singlef {
    back width * height;
}

// Type inference
let area: singlef = calculateArea(10.5, 20.3);

Control Flow

Modern control flow with if / esle if / else, forloop, while, plus continue and break for clear, readable logic.

// Conditional branches
if (score >= 90) {
    back "Excellent";
} esle if (score >= 60) {
    back "Good";
} else {
    back "Needs improvement";
}

// Loop control
forloop (let i: int = 0; i < items.length; i++) {
    processItem(items[i]);
}

Modules and Libraries

Import with cite, supporting both standard sii.* APIs and third‑party lib.* libraries. The library center provides versioning, dependency resolution, and auto updates.

// Import standard libraries
cite { add, multiply, sqrt } from lib.math;
cite { formatDate, parseTime } from lib.time;

// Use library functions
let result: singlef = sqrt(add(16, 9)); // 5.0

Standard Library Overview (47+)

  • readText Read text file
  • writeText Write text file
  • exists Check file existence
  • mkdirs Create directory
  • pathJoin Join paths
  • cwd Current working directory
  • env Read environment variable
  • Date Format current time
  • length Get length
  • jsonParse Parse JSON
  • jsonStringify Stringify JSON
  • exec Run shell command
  • execOut Run command and capture output
  • get HTTP GET
  • post HTTP POST
  • put HTTP PUT
  • delete HTTP DELETE
  • options HTTP OPTIONS
  • head HTTP HEAD
  • listen Start HTTP server
  • respText Send text response
  • respJson Send JSON response
  • respHtml Send HTML response
  • log Console log
  • warn Console warn
  • error Console error
  • bindDOM Bind DOM runtime
  • routerGet Get current route
  • routerSet Set route
  • routerRegister Register routes
  • routerSubscribe Subscribe route changes
  • routerUseGuard Route guard
  • routerOnAfterEach After-each hook
  • routerLoad Route data loader
  • portal Portal mount
  • lockBody Lock body scroll
  • unlockBody Unlock body scroll
  • focusTrap Focus trap
  • vlistCreate Virtual list
  • theme Set theme tokens
  • themeScope Scoped theme
  • createSignal Reactive signal
  • createMemo Reactive memo
  • createEffect Reactive effect
  • createResource Resource/Suspense
  • renderToString SSR render to string
  • hydrate Hydrate on client
  • devtoolsSubscribe Devtools subscribe
  • devtoolsEmit Devtools emit

lib. Third‑party Library Ecosystem

Sii provides a cloud‑hosted library registry (library center). When a project depends on a third‑party library, the CLI pulls it from the cloud registry to your local environment. For availability, the CLI supports configuring multiple mirrors (different endpoints of the same registry); installation downloads from the current default mirror.

Mirror commands were described in the CLI section above, so they are not repeated here. Use sii install <library> to install and sii update-lib to update installed libraries.

For now, the number of third‑party libraries is small and usage is relatively low. We temporarily provide a "Submit Idea" process: developers can submit library name, description, author and related info via the submit idea form. After admin review, the admin will upload the library to the cloud registry, and then users can install it via the CLI. You can also follow "Library Authoring" to improve your library and docs to increase approval likelihood.

Quick Start

Install

npm install -g @andyjinxi/sii-lang

Create Web project

sii init-web MyApp
cd MyApp

# Dev mode with hot reload
sii run --web . --serve

# Production build
sii run --web . --build

Project layout

MyApp/
├── pages/           # Pages
│   └── Index.sii    # Home component
├── assets/          # Static assets
└── dist/            # Build output
    └── pages/       # Generated TypeScript code

Why Choose Sii

  • Declarative UI: componentized, UI and logic separation
  • Strong typing: compile‑time checks
  • Unified front and back ends: one language for UI and server logic
  • Rich standard library: 47+ built‑ins for files, network, UI, routing
  • Modern syntax: concise control flow and modules
  • TypeScript ecosystem: compiles to TypeScript and fits existing toolchains

Develop Tools

SiiDeal IDE — a modern IDE purpose‑built for Sii. Based on Monaco Editor with syntax highlighting and completions, project explorer and global search, integrated terminal and problem/output panels, dark/light themes and responsive UI, debugging aids, diagnostics and formatting, plus customizable settings for themes, fonts, editor options and CLI environment.

Learn and Ecosystem

Start with Sii → Homepage