{"_id":"@botfather/vite-plugin-units","_rev":"4-9fdca3768894d1cf56369528990a0c2f","name":"@botfather/vite-plugin-units","dist-tags":{"latest":"2.0.2"},"versions":{"1.0.0":{"name":"@botfather/vite-plugin-units","version":"1.0.0","license":"MIT","_id":"@botfather/vite-plugin-units@1.0.0","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"homepage":"https://github.com/Botfather/units/tree/main/packages/vite-plugin-units","bugs":{"url":"https://github.com/Botfather/units/issues"},"dist":{"shasum":"0cdf574a67fde64204b6d33d335abff32f76c94a","tarball":"https://registry.npmjs.org/@botfather/vite-plugin-units/-/vite-plugin-units-1.0.0.tgz","fileCount":4,"integrity":"sha512-CfLliUhwU4MP9+DaXSEC2SgwoBBc9uvJAM+IYnbYZpNZwueUPTH+Vx7Tm5ZS2v1hxFh/87MKQBbtmXIKxfv4ow==","signatures":[{"sig":"MEUCIHV33sBuhayHKWevga5ofr1ZOu2BW551jxmhm2oqlSWJAiEAgcr13KGJHcnYRbSNjwRSYZAexWekz7aJ7+wURMJ5QkE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2fvite-plugin-units@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":4086},"main":"./index.js","type":"module","_from":"file:botfather-vite-plugin-units-1.0.0.tgz","types":"./index.d.ts","exports":{".":"./index.js"},"_npmUser":{"name":"botfather","email":"mohan.tushar.11@gmail.com"},"_resolved":"/tmp/124dc8edc3fe4f52d871788142053a1b/botfather-vite-plugin-units-1.0.0.tgz","_integrity":"sha512-CfLliUhwU4MP9+DaXSEC2SgwoBBc9uvJAM+IYnbYZpNZwueUPTH+Vx7Tm5ZS2v1hxFh/87MKQBbtmXIKxfv4ow==","repository":{"url":"git+https://github.com/Botfather/units.git","type":"git","directory":"packages/vite-plugin-units"},"_npmVersion":"10.8.2","description":"Vite plugin for loading Units .ui files as AST.","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@botfather/units":"1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"vite":">=4"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-units_1.0.0_1772457775088_0.8304512084205091","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@botfather/vite-plugin-units","version":"2.0.0","license":"MIT","_id":"@botfather/vite-plugin-units@2.0.0","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"homepage":"https://github.com/Botfather/units/tree/main/packages/vite-plugin-units","bugs":{"url":"https://github.com/Botfather/units/issues"},"dist":{"shasum":"82abe22a1593d220dc63476dfda8eb3e7a963121","tarball":"https://registry.npmjs.org/@botfather/vite-plugin-units/-/vite-plugin-units-2.0.0.tgz","fileCount":4,"integrity":"sha512-BJbpZ2P9bzzKvDyj9aQa2vMkPrTDkmjxUjbUS8/JAZTlNRITsoP3emDfYl3n2otGkKinIWcbKjPfe5NEDsfEug==","signatures":[{"sig":"MEQCICTUzK/6RtzU2YgP4OzjxVwDYW1p3QGmaknXdi7nb0MkAiAkDatM9b5kqu0KAzANIl/nu8IR7Xmprse4lr5iW0MG/w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2fvite-plugin-units@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":4086},"main":"./index.js","type":"module","_from":"file:botfather-vite-plugin-units-2.0.0.tgz","types":"./index.d.ts","exports":{".":"./index.js"},"_npmUser":{"name":"botfather","email":"mohan.tushar.11@gmail.com"},"_resolved":"/tmp/5b275754c946765a178df29ea0ab15b7/botfather-vite-plugin-units-2.0.0.tgz","_integrity":"sha512-BJbpZ2P9bzzKvDyj9aQa2vMkPrTDkmjxUjbUS8/JAZTlNRITsoP3emDfYl3n2otGkKinIWcbKjPfe5NEDsfEug==","repository":{"url":"git+https://github.com/Botfather/units.git","type":"git","directory":"packages/vite-plugin-units"},"_npmVersion":"10.8.2","description":"Vite plugin for loading Units .ui files as AST.","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@botfather/units":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"vite":">=4"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-units_2.0.0_1772462415223_0.8968264601874512","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@botfather/vite-plugin-units","version":"2.0.1","license":"MIT","_id":"@botfather/vite-plugin-units@2.0.1","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"homepage":"https://github.com/Botfather/units/tree/main/packages/vite-plugin-units","bugs":{"url":"https://github.com/Botfather/units/issues"},"dist":{"shasum":"b4efac1c126125601546980160853fd5f7a85a32","tarball":"https://registry.npmjs.org/@botfather/vite-plugin-units/-/vite-plugin-units-2.0.1.tgz","fileCount":5,"integrity":"sha512-e0OVqOKeKUXiBhUS9JsG+gGiyYsAkiljnFMEJq8yX9CjssUHsL3e6RF+4M/xRRb1PejCN1ebd5WL+SodXHCcYA==","signatures":[{"sig":"MEUCIQD2XQkGv6AkXA+V9TTK2yTUV5OXTUJRj//0IaySQIOjVAIgZZFF3r2JsZTqEO/EScunqZhaHjRZ0U6JYpWYb+XIUlE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2fvite-plugin-units@2.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":7003},"main":"./index.js","type":"module","_from":"file:botfather-vite-plugin-units-2.0.1.tgz","types":"./index.d.ts","exports":{".":"./index.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9bc4202a-d208-48c6-8086-2d0dde67b68f"}},"_resolved":"/tmp/7f2cf8409f47bd7dc504eb845f6fed66/botfather-vite-plugin-units-2.0.1.tgz","_integrity":"sha512-e0OVqOKeKUXiBhUS9JsG+gGiyYsAkiljnFMEJq8yX9CjssUHsL3e6RF+4M/xRRb1PejCN1ebd5WL+SodXHCcYA==","repository":{"url":"git+https://github.com/Botfather/units.git","type":"git","directory":"packages/vite-plugin-units"},"_npmVersion":"11.17.0","description":"Vite plugin for loading Units .ui files as AST.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"@botfather/units":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"vite":">=4"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-units_2.0.1_1782204409756_0.5620108805587263","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@botfather/vite-plugin-units","version":"2.0.2","description":"Vite plugin for loading Units .ui files as AST.","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/Botfather/units.git","directory":"packages/vite-plugin-units"},"homepage":"https://github.com/Botfather/units/tree/main/packages/vite-plugin-units","bugs":{"url":"https://github.com/Botfather/units/issues"},"main":"./index.js","types":"./index.d.ts","exports":{".":"./index.js"},"dependencies":{"@botfather/units":"2.0.1"},"peerDependencies":{"vite":">=4"},"publishConfig":{"access":"public"},"_id":"@botfather/vite-plugin-units@2.0.2","_integrity":"sha512-G8Ud+uaQ7fsMwYOLVXnDquZZV8auvW/Embo0PI78X9N8gFuayK1Ts09qSSVdMK6GP9alDJw567aL/quCeFduFw==","_resolved":"/tmp/49e13459ab7d71c6ae37c84cddc3cf03/botfather-vite-plugin-units-2.0.2.tgz","_from":"file:botfather-vite-plugin-units-2.0.2.tgz","_nodeVersion":"24.16.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-G8Ud+uaQ7fsMwYOLVXnDquZZV8auvW/Embo0PI78X9N8gFuayK1Ts09qSSVdMK6GP9alDJw567aL/quCeFduFw==","shasum":"aee132a1d5ca05762a4f2090fbf23cc2df0051e9","tarball":"https://registry.npmjs.org/@botfather/vite-plugin-units/-/vite-plugin-units-2.0.2.tgz","fileCount":5,"unpackedSize":7003,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@botfather%2fvite-plugin-units@2.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDbiCJl2PUOkW5BIxckugTy2TSBwgFElmekQi7LBmh7FgIgC1Ow+v6Yjw0/C1bGtg2JYqVWpbYCIi8S8krBOIS7irc="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9bc4202a-d208-48c6-8086-2d0dde67b68f"}},"directories":{},"maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-units_2.0.2_1782219356208_0.22860829239860925"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-02T13:22:54.985Z","modified":"2026-06-23T12:55:56.654Z","1.0.0":"2026-03-02T13:22:55.226Z","2.0.0":"2026-03-02T14:40:15.372Z","2.0.1":"2026-06-23T08:46:49.895Z","2.0.2":"2026-06-23T12:55:56.346Z"},"bugs":{"url":"https://github.com/Botfather/units/issues"},"license":"MIT","homepage":"https://github.com/Botfather/units/tree/main/packages/vite-plugin-units","repository":{"type":"git","url":"git+https://github.com/Botfather/units.git","directory":"packages/vite-plugin-units"},"description":"Vite plugin for loading Units .ui files as AST.","maintainers":[{"name":"botfather","email":"mohan.tushar.11@gmail.com"}],"readme":"# @botfather/vite-plugin-units\n\nVite plugin that transforms `.ui` files into importable ES modules, making Units templates first-class build-time assets.\n\n## What is it?\n\nThis plugin hooks into Vite's module resolution and load pipeline to process `.ui` files. Each file is parsed at build time and exposed as a module that exports the raw source string and the pre-parsed AST. The AST is ready to pass directly to `renderUnits` without any runtime parsing overhead.\n\nAn optional sidecar cache mechanism pairs with the `units-emit` CLI tool: if a `.ui.ast.json` file exists next to a `.ui` file and is newer, the plugin loads the pre-built AST instead of re-parsing — making cold starts faster in large projects.\n\n## Installation\n\n```sh\nnpm install --save-dev @botfather/vite-plugin-units\n```\n\nPeer dependency: Vite >= 4.\n\n## Setup\n\n```js\n// vite.config.js\nimport { defineConfig } from \"vite\";\nimport unitsPlugin from \"@botfather/vite-plugin-units\";\n\nexport default defineConfig({\n  plugins: [unitsPlugin()],\n});\n```\n\n## Usage\n\nWith the plugin active, any `.ui` file can be imported directly:\n\n```js\nimport { ast, source } from \"./app.ui\";\nimport { renderUnits } from \"@botfather/units/runtime\";\n\nconst element = renderUnits(ast, scope, { components });\n```\n\n### TypeScript\n\nAdd the type reference to your app's entry point or a `.d.ts` file:\n\n```ts\n/// <reference types=\"@botfather/units/ui\" />\n```\n\nThis gives you typed imports for `ast`, `source`, and the query variants (`?format`, `?tokens`, `?highlight` — provided by `vite-plugin-units-tools`).\n\n## Module output\n\nEach `.ui` import resolves to a synthetic module with this shape:\n\n```js\nexport const source = '<raw .ui source text>';\nexport const ast = { type: 'document', body: [...] };\nexport default ast;\n```\n\n## Options\n\n```ts\nunitsPlugin(options?: {\n  emitSource?: boolean;   // Include `source` export. Default: true\n  emitAst?: boolean;      // Include `ast` export and default export. Default: true\n  useAstCache?: boolean;  // Load *.ui.ast.json sidecar when available. Default: true\n  include?: RegExp;       // Only process paths matching this pattern\n  exclude?: RegExp;       // Skip paths matching this pattern\n})\n```\n\n### AST sidecar cache\n\nWhen `useAstCache` is enabled (the default), the plugin looks for a `<file>.ui.ast.json` alongside each `.ui` file. If the sidecar's modification time is equal to or newer than the source file, it is used directly — skipping parsing entirely.\n\nTo pre-build sidecars before starting the dev server or running a build:\n\n```sh\nnpx units-emit src/\n```\n\nOr add it as a pre-script:\n\n```json\n{\n  \"scripts\": {\n    \"predev\": \"units-emit src/\",\n    \"prebuild\": \"units-emit src/\"\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}