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

@cyia/vscode-valibot-config

v1.0.8

Published

VSCode configuration manager based on Valibot schemas

Readme

@cyia/vscode-valibot-config

🌐 English | 中文

VSCode configuration manager based on Valibot schemas. Provides reactive signals that automatically sync with VS Code's workspace settings, with built-in validation and real-time update support.

Features

  • Schema Validation: Define configuration structure using Valibot schemas
  • Reactive Signals: Configuration values are exposed as writable signals with automatic change detection
  • Deep Nesting: Full support for nested object configurations
  • Real-time Updates: Automatically listens to VS Code configuration changes
  • JSON Schema Export: Generate VSCode-compatible JSON Schema from Valibot schemas
  • Type Safety: End-to-end TypeScript type inference from schema definitions
  • Deep Equality: Uses deep comparison to prevent unnecessary signal updates
  • Union & Variant Support: Handles complex union types and discriminated unions

Installation

npm install @cyia/vscode-valibot-config
# or
pnpm add @cyia/vscode-valibot-config

Usage

Basic Example

import * as v from 'valibot';
import { createConfig } from '@cyia/vscode-valibot-config';

// Define configuration schema
const configSchema = v.object({
  enabled: v.boolean(),
  timeout: v.pipe(v.number(), v.minValue(100), v.maxValue(5000)),
  theme: v.picklist(['dark', 'light', 'auto']),
  tags: v.array(v.string()),
  nested: v.object({
    host: v.string(),
    port: v.number(),
  }),
});

// Create reactive configuration
const proxy = createConfig(configSchema, 'myExtension');
const config = proxy.root();

// Read values (call as function)
console.log(config.enabled()); // true
console.log(config.timeout()); // 1000
console.log(config.nested.host()); // "localhost"

// Set values
await config.enabled.set(false);
await config.timeout.set(2000);

// Update values with function
await config.theme.update((current) => (current === 'dark' ? 'light' : 'dark'));

// Nested objects
await config.nested.set({ host: 'api.example.com', port: 8080 });

Signal API

Each configuration property returns a signal with the following methods:

| Method | Description | | ------------------- | ---------------------------------------- | | signal() | Get current value | | signal.set(value) | Set new value (updates VS Code settings) | | signal.update(fn) | Update using previous value |

JSON Schema Generation

Convert Valibot schemas to VSCode contributes.configuration.properties format:

import * as v from 'valibot';
import { valibotToVscodeConfig } from '@cyia/vscode-valibot-config';
import { asVirtualGroup } from '@piying/valibot-visit';

const schema = v.object({
  name: v.pipe(v.string(), v.description('The user name')),
  role: v.pipe(
    v.picklist(['admin', 'user']),
    v.metadata({
      enumOptions: [
        { label: 'Administrator', description: 'Full access' },
        { label: 'Regular User', description: 'Limited access' },
      ],
    }),
  ),
});

const jsonSchema = valibotToVscodeConfig(schema, {
  title: 'My Extension Config',
  prefix: 'myExtension',
  id: 'myExtension.schema.json',
  order: 1,
});

Writing to package.json

Use writePackageJsonConfig to automatically write configuration into your VS Code extension's package.json file:

import * as v from 'valibot';
import { writePackageJsonConfig } from '@cyia/vscode-valibot-config';

const schema = v.object({
  apiKey: v.string(),
  maxRetries: v.pipe(v.number(), v.minValue(1), v.maxValue(10)),
});

// Write to file
const writer = writePackageJsonConfig(schema, {
  title: 'My Extension Config',
  prefix: 'myExtension',
});
await writer('./package.json');
// The generated package.json will automatically add:
// "contributes": {
//   "configuration": {
//     "title": "My Extension Config",
//     "properties": {
//       "myExtension.apiKey": { "type": "string" },
//       "myExtension.maxRetries": { "type": "number" }
//     }
//   }
// }

// Or manipulate the object directly
const packageJson = {
  name: 'my-extension',
  contributes: {} as any,
};
writer(packageJson);

Advanced Options

Using metadata for Enhanced UI

const schema = v.object({
  mode: v.pipe(
    v.picklist(['fast', 'balanced', 'quality']),
    v.metadata({
      isOptional: true,
      enumOptions: [
        { label: 'Fast', description: 'Best performance' },
        { label: 'Balanced', description: 'Balanced trade-off' },
        { label: 'Quality', description: 'Best output quality' },
      ],
    }),
  ),
});

Virtual Groups

Objects inside intersect are merged, allowing nested merging:

import { asVirtualGroup } from '@piying/valibot-visit';

const schema = v.object({
  network: v.pipe(
    v.intersect([
      v.object({ proxy: v.string() }),
      v.object({ timeout: v.number() }),
    ]),
    asVirtualGroup(),
  ),
});