{"_id":"@digitalbazaar/vocabulary-to-context","_rev":"2-a002de6bb7dce3139c1d7a60ebd4f918","name":"@digitalbazaar/vocabulary-to-context","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@digitalbazaar/vocabulary-to-context","version":"1.0.0","author":{"url":"https://digitalbazaar.com/","name":"Digital Bazaar, Inc.","email":"support@digitalbazaar.com"},"license":"BSD-3-Clause","_id":"@digitalbazaar/vocabulary-to-context@1.0.0","maintainers":[{"name":"dlongley","email":"dlongley@digitalbazaar.com"},{"name":"msporny","email":"msporny@digitalbazaar.com"},{"name":"davidlehn","email":"dil@lehn.org"},{"name":"gannan","email":"gannan@digitalbazaar.com"}],"homepage":"https://github.com/digitalbazaar/vocabulary-to-context#readme","bugs":{"url":"https://github.com/digitalbazaar/vocabulary-to-context/issues"},"dist":{"shasum":"d65c2052d60ddd5b7d30d5b6883e88fde7aab648","tarball":"https://registry.npmjs.org/@digitalbazaar/vocabulary-to-context/-/vocabulary-to-context-1.0.0.tgz","fileCount":5,"integrity":"sha512-+Aq8H6ag4BEbI7A3yjBDxsYuucRHHlsmqOIAexePh3ZmdzV2/rNkvx/nLaZsr3PoiT2cGJ/K/eyDX0JJZQ1mMw==","signatures":[{"sig":"MEUCIQC3Kg1aIdLTlG5bZJ+zlcsiLcg8yMW04yK8UQNBgaUWZAIgDmaV3YCcHBrrx7U4S2srXhdUtbju5HBYS0e3hGyy4eg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11312},"type":"module","engines":{"node":">=24"},"exports":"./index.js","gitHead":"6fcb6b5afbcad6573d650b232d1f0fd537f8b1ef","scripts":{"lint":"eslint .","test":"node --test"},"_npmUser":{"name":"davidlehn","email":"dil@lehn.org"},"repository":{"url":"git+https://github.com/digitalbazaar/vocabulary-to-context.git","type":"git"},"_npmVersion":"12.0.2","description":"Build yml2vocab vocabularies and JSON-LD contexts from an HTML template","directories":{},"_nodeVersion":"24.17.0","dependencies":{"js-yaml":"^5.3.0","yml2vocab":"1.6.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^6.2.2","eslint":"^10.9.1","@digitalbazaar/eslint-config":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vocabulary-to-context_1.0.0_1787767284267_0.06322955100632721","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"_id":"@digitalbazaar/vocabulary-to-context@1.0.1","bugs":{"url":"https://github.com/digitalbazaar/vocabulary-to-context/issues"},"dist":{"shasum":"c19c9e99afb771c2491e2e7803e2facabd738148","tarball":"https://registry.npmjs.org/@digitalbazaar/vocabulary-to-context/-/vocabulary-to-context-1.0.1.tgz","fileCount":5,"integrity":"sha512-FY0NgYEU3lmqMq0wl58Yk5sfJjt1V82UPZNadOPryxPRz2dRtlAxIBWCKk5V4pKCUwLqQSD12nusG3mcQkgy6A==","signatures":[{"sig":"MEUCIQDey/VZFhb6oK0VD6zm6PVT7qdeceMU4akVlFe3OYahmQIgMr1eUIqGG0NgBy4K3Omq0fUObSYKNBa/FPkTyl5nBbE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDxowLjkvDwfE3inFV6niZEKLUTIiPidHlgswD3Z1GMGQIhAJfcfKMGq08K/ICtLtEhXPBzORHRA9VOpFAVv57AqHUc"}],"unpackedSize":11333},"name":"@digitalbazaar/vocabulary-to-context","type":"module","author":{"url":"https://digitalbazaar.com/","name":"Digital Bazaar, Inc.","email":"support@digitalbazaar.com"},"engines":{"node":">=24"},"exports":"./index.js","gitHead":"7a4da4668d251d01db8902a97423820c96c87cc3","license":"BSD-3-Clause","scripts":{"lint":"eslint .","test":"node --test"},"version":"1.0.1","_npmUser":{"name":"davidlehn","email":"dil@lehn.org"},"homepage":"https://github.com/digitalbazaar/vocabulary-to-context#readme","repository":{"url":"git+https://github.com/digitalbazaar/vocabulary-to-context.git","type":"git"},"_npmVersion":"12.0.2","description":"Build yml2vocab vocabularies and JSON-LD contexts from an HTML template","directories":{},"maintainers":[{"name":"dlongley","email":"dlongley@digitalbazaar.com"},{"name":"msporny","email":"msporny@digitalbazaar.com"},{"name":"davidlehn","email":"dil@lehn.org"},{"name":"gannan","email":"gannan@digitalbazaar.com"}],"_nodeVersion":"24.17.0","dependencies":{"js-yaml":"^5.3.0","yml2vocab":"1.6.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^6.2.2","eslint":"^10.9.1","@digitalbazaar/eslint-config":"^9.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vocabulary-to-context_1.0.1_1789514197672_0.8748664988817123"}}},"time":{"created":"2026-08-26T18:01:23.817Z","modified":"2026-09-15T23:16:38.008Z","1.0.0":"2026-08-26T18:01:24.405Z","1.0.1":"2026-09-15T23:16:37.758Z"},"bugs":{"url":"https://github.com/digitalbazaar/vocabulary-to-context/issues"},"author":{"url":"https://digitalbazaar.com/","name":"Digital Bazaar, Inc.","email":"support@digitalbazaar.com"},"license":"BSD-3-Clause","homepage":"https://github.com/digitalbazaar/vocabulary-to-context#readme","repository":{"url":"git+https://github.com/digitalbazaar/vocabulary-to-context.git","type":"git"},"description":"Build yml2vocab vocabularies and JSON-LD contexts from an HTML template","maintainers":[{"name":"dlongley","email":"dlongley@digitalbazaar.com"},{"name":"msporny","email":"msporny@digitalbazaar.com"},{"name":"davidlehn","email":"dil@lehn.org"},{"name":"gannan","email":"gannan@digitalbazaar.com"}],"readme":"# @digitalbazaar/vocabulary-to-context\n\nBuild a YAML vocabulary into consistent HTML, JSON-LD, JSON-LD context, and\nTurtle files. This package provides a small wrapper around\n[`yml2vocab`](https://github.com/w3c/yml2vocab).\n\n## Environment\n\n- Node.js 24 or newer.\n- An ES module project with a YAML vocabulary and HTML template.\n\n## Setup\n\n1. Install the package:\n\n   ```sh\n   npm install --save-dev @digitalbazaar/vocabulary-to-context\n   ```\n\n2. Add these files to the vocabulary project:\n\n   - `vocabulary.yaml` (or `vocabulary.yml`)\n   - `template.html`\n\n3. Create a build script:\n\n   ```js\n   // build.js\n   import {buildVocab} from '@digitalbazaar/vocabulary-to-context';\n\n   await buildVocab();\n   ```\n\n4. Run the script:\n\n   ```sh\n   node build.js\n   ```\n\n## What it does\n\nThe build reads the YAML vocabulary, alphabetizes its class and property\ndefinitions, and passes the vocabulary and template to `yml2vocab`. It writes:\n\n- `vocabulary.html`\n- `vocabulary.context.jsonld`\n- `vocabulary.jsonld`\n- `vocabulary.ttl`\n\n## Options\n\nUse `baseDir` for a vocabulary in another directory, or explicitly provide the\nYAML and template paths:\n\n```js\nawait buildVocab({\n  baseDir: './vocabulary',\n  // yamlFilePath: './vocabulary/vocabulary.yaml',\n  // templateFilePath: './vocabulary/template.html'\n});\n```\n\n### JSON-LD aliases\n\nBy default, the generated context adds `id: \"@id\"` and `type: \"@type\"` at\nthe top level and in nested contexts. This is an opinionated convenience that\nlets consumers use `id` and `type` without the `@` prefix.\n\nDisable the aliases:\n\n```js\nawait buildVocab({jsonLdAliases: false});\n```\n\nOr replace them with your own names:\n\n```js\nawait buildVocab({\n  jsonLdAliases: {\n    identifier: '@id',\n    kind: '@type'\n  }\n});\n```\n\nCustom aliases replace the defaults and are applied recursively. Alias names\nshould not collide with vocabulary terms.\n\n## Development\n\nRun `npm test` and `npm run lint`. The project uses\n[`@digitalbazaar/eslint-config`](https://github.com/digitalbazaar/eslint-config-digitalbazaar).\n\n## Commercial Support\n\nCommercial support for this library is available upon request from\nDigital Bazaar: support@digitalbazaar.com\n\n## License\n\n[BSD-3-Clause](LICENSE) Copyright 2026 Digital Bazaar, Inc.\n","readmeFilename":"README.md"}