Registry / devops / volar-service-yaml

volar-service-yaml

JSON →
library0.0.70jsnpmunverified

volar-service-yaml is a dedicated Volar plugin designed to integrate the robust `yaml-language-server` into Volar-powered development environments. This integration provides comprehensive language features for YAML files, including syntax highlighting, intelligent auto-completion, real-time schema validation, and diagnostic reporting, directly within projects utilizing Volar's language service, commonly found in Vue.js applications. Currently at version 0.0.70, this package primarily acts as a bridge, enabling sophisticated YAML tooling to function seamlessly within Volar's architecture. Its release cadence is generally synchronized with updates to the main Volar language service (specifically targeting `~2.4.0`), ensuring ongoing compatibility and leveraging an established, widely used YAML language server to offer superior developer experience for YAML configuration files within the Volar ecosystem.

npm install volar-service-yaml
INSTALL
IMPORT
SIG · VOLAR-SERVICE-YAML
V
volar-service-yaml
devopsjavascriptv0.0.70
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

create
import { create } from 'volar-service-yaml';
import volarServiceYaml from 'volar-service-yaml'; // or import { default as create } from 'volar-service-yaml';
For ESM environments or TypeScript projects. Volar v2 is ESM-first, so this is the recommended import style.
create
const { create } = require('volar-service-yaml');
const create = require('volar-service-yaml').create;
CommonJS named import for Node.js environments, often used in `volar.config.js` files.
ServicePlugin
import type { ServicePlugin } from '@volar/language-service';
This is a type import for defining a Volar service plugin, primarily for type-checking and autocompletion when creating custom services. Although not directly from `volar-service-yaml`, it's crucial for Volar plugin development.

Demonstrates how to integrate the YAML language service into your Volar configuration file to enable YAML features.

/* volar.config.js */ module.exports = { services: [ require('volar-service-yaml').create(), ], }; // For a TypeScript-based Volar config (e.g., volar.config.ts with ts-node): // import { create } from 'volar-service-yaml'; // import type { VolarConfig } from '@volar/language-service'; // export default <VolarConfig>{ // services: [ // create(), // ], // };
Debug
Known issues
breakingThis plugin is designed for Volar v2.x and is not compatible with Volar v1.x (or the legacy 'Volar Language Features' VSCode extension). Attempting to use it with older Volar versions will lead to failures.
fix
Ensure your project and VSCode extension ('Vue - Official') are running Volar v2.x or newer. Migrate your Volar configuration if coming from v1.x.
affects: <2.0.0
gotchaThe `volar.config.js` file typically runs in a CommonJS environment, even if your project is otherwise ESM-enabled. Use `require()` for importing plugins within this configuration file.
fix
Stick to `require('volar-service-yaml').create()` in `volar.config.js`. If you use `volar.config.ts` with `ts-node` or similar, ESM imports (`import { create } from 'volar-service-yaml';`) might be necessary, but verify your specific setup.
affects: >=0.0.0
gotchaIncorrect or missing YAML schemas can lead to inaccurate diagnostics and missing auto-completion. The YAML Language Server relies on properly configured schemas.
fix
Review the documentation for `yaml-language-server` on how to configure schemas (e.g., via `.vscode/settings.json` or directly in YAML files) relevant to your project's YAML files.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'volar-service-yaml'
The package is not installed or the import path is incorrect, or there's a module resolution issue in a mixed CJS/ESM project.
fix
Run `npm install volar-service-yaml` or `yarn add volar-service-yaml`. Double-check the import/require path. If using a custom Volar config, ensure Node.js can resolve the module in that context.
TypeError: (0 , volar_service_yaml_1.create) is not a function
This typically indicates an ESM/CommonJS interop issue where a CommonJS `require` is trying to access a named export like a default export, or vice-versa, or incorrect bundling.
fix
Ensure you are using the correct import syntax for your module environment. For `volar.config.js`, use `require('volar-service-yaml').create()`. For ESM TypeScript, use `import { create } from 'volar-service-yaml';`.
Volar service 'yaml' failed to initialize: [...]
The underlying `yaml-language-server` might be failing to start or encountering configuration errors.
fix
Check your editor's output channels for detailed errors from the Volar language server or the YAML language server. Verify your YAML files for syntax errors or invalid schema references. Ensure no conflicting YAML extensions are active.
Upgrade
Version history
0.0.70latest on npm
Audit
Dependencies
@volar/language-servicerequiredCore peer dependency for Volar language service functionality. This plugin integrates into Volar's architecture.
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
volar-service-yaml — npm install volar-service-yaml · libregistry