{"_id":"@dsplay/template-manifest","_rev":"5-e0a79b5d3892e05dae3932e399a0859e","name":"@dsplay/template-manifest","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@dsplay/template-manifest","version":"1.0.0","license":"MIT","_id":"@dsplay/template-manifest@1.0.0","maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"bin":{"dsplay-scan-template":"cli.js"},"dist":{"shasum":"9842a7c585ed9803fcfdbe953512122b2137d4fe","tarball":"https://registry.npmjs.org/@dsplay/template-manifest/-/template-manifest-1.0.0.tgz","fileCount":5,"integrity":"sha512-GOy0XUQSH+5XORowycvfjhIlr6bsxkVNBOjmjJkOl6CJbrpAsuRxr17OKITze+iAwS3uzaHLAvY/yzAok5mzLA==","signatures":[{"sig":"MEYCIQD9B3Q8d6QRzTF0PHCxGhMPX65zTdtVEbrJmeW8AdwrKwIhAJgYVDt/Ne3tTxg46DYgAyBvKjFeVudXHSeb8SEaM1Hi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20726},"main":"./core.js","type":"module","engines":{"node":">=24"},"exports":{".":"./core.js","./vite-plugin":"./vite-plugin.js","./package.json":"./package.json"},"gitHead":"2b2865f94b45c0cc5ebb7532b6ca9f62e1e3d248","_npmUser":{"name":"pcmnac","email":"pcmnac@gmail.com"},"_npmVersion":"11.16.0","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","directories":{},"_nodeVersion":"24.18.1","dependencies":{"@babel/parser":"^7.29.7","@babel/traverse":"^7.29.7"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/template-manifest_1.0.0_1786539102054_0.8731277830449626","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dsplay/template-manifest","version":"1.0.1","license":"MIT","_id":"@dsplay/template-manifest@1.0.1","maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"bin":{"dsplay-scan-template":"cli.js"},"dist":{"shasum":"b68146dd4ab63386a23cbac8d890acc90b95fc8d","tarball":"https://registry.npmjs.org/@dsplay/template-manifest/-/template-manifest-1.0.1.tgz","fileCount":5,"integrity":"sha512-Mv5hnMXAd2p4woM//+JEJo1AupUefmOem1VDv9wWzVWc7eov8Xlg6mbrU8OSPaLKlTHfylevZWgwcGa/ZO6YPQ==","signatures":[{"sig":"MEQCIAy6asZ1hPGXVPheNK9I5BxoO/l94xLC7xZt4Wl+XoCLAiB4mvzQt57qKSP4B2wyMX/0Zh+9d4X1G2moooHomVyOxg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20726},"main":"./core.js","type":"module","engines":{"node":">=24"},"exports":{".":"./core.js","./vite-plugin":"./vite-plugin.js","./package.json":"./package.json"},"gitHead":"d36da0e0b31dcdd58020e7161acd06eb13a1f9f3","_npmUser":{"name":"pcmnac","email":"pcmnac@gmail.com"},"_npmVersion":"11.16.0","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","directories":{},"_nodeVersion":"24.18.1","dependencies":{"@babel/parser":"^7.29.7","@babel/traverse":"^7.29.7"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/template-manifest_1.0.1_1786539435574_0.3143857924362947","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@dsplay/template-manifest","version":"1.0.2","license":"MIT","_id":"@dsplay/template-manifest@1.0.2","maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"bin":{"dsplay-scan-template":"cli.js"},"dist":{"shasum":"969dfdf1e53122cfbd1b8577f0aa08026f2c46b6","tarball":"https://registry.npmjs.org/@dsplay/template-manifest/-/template-manifest-1.0.2.tgz","fileCount":5,"integrity":"sha512-DWMOhfeXSISoS76rJ6Y2z10UDqfL35iclJhgTSKICOdboVfzZTmLaDlfYjb+VJ4JHvnhO7YDs1MJRkq6RYaCNQ==","signatures":[{"sig":"MEYCIQDITSzzLBKLaKd3EE4LpGEJrdddrg24irSpyGa6ATwQUgIhAL4d6mpf7vVmPixc8b45wpYUohcpQGkwqYQsvaYpddBE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20988},"main":"./core.js","type":"module","engines":{"node":">=24"},"exports":{".":"./core.js","./vite-plugin":"./vite-plugin.js","./package.json":"./package.json"},"gitHead":"edb05e298e7da65513e78ad9b4855b5468a11659","_npmUser":{"name":"pcmnac","email":"pcmnac@gmail.com"},"_npmVersion":"11.16.0","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","directories":{},"_nodeVersion":"24.18.1","dependencies":{"@babel/parser":"^7.29.7","@babel/traverse":"^7.29.7"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/template-manifest_1.0.2_1786562656960_0.5530695786840649","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@dsplay/template-manifest","version":"1.0.3","license":"MIT","_id":"@dsplay/template-manifest@1.0.3","maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"bin":{"dsplay-scan-template":"cli.js"},"dist":{"shasum":"b2255ac2c906fa51de5859e2f44fa5af1c3874ad","tarball":"https://registry.npmjs.org/@dsplay/template-manifest/-/template-manifest-1.0.3.tgz","fileCount":5,"integrity":"sha512-qmWlOWnEDaD989nDag4zbdm9yYh0F4T3Cwmtm8n33Yah/dMVHcVCY2uX0Rgje+gQnFLirRRhSYreObV8o+lnBg==","signatures":[{"sig":"MEQCIB42lZxB6M5orSElHgW2pz9XlMvTie97mOWfTNtzIA0fAiAa4VVQmWY51BB1+tqAsn8kczgP1kH3BNSrWzEwdhdP8w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21178},"main":"./core.js","type":"module","engines":{"node":">=24"},"exports":{".":"./core.js","./vite-plugin":"./vite-plugin.js","./package.json":"./package.json"},"gitHead":"777f91a33224ee5154243c760288633e1ddc8149","_npmUser":{"name":"pcmnac","email":"pcmnac@gmail.com"},"_npmVersion":"11.16.0","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","directories":{},"_nodeVersion":"24.18.1","dependencies":{"@babel/parser":"^7.29.7","@babel/traverse":"^7.29.7"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/template-manifest_1.0.3_1786625888689_0.28489801709249685","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@dsplay/template-manifest","version":"1.0.4","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","type":"module","main":"./core.js","exports":{".":"./core.js","./vite-plugin":"./vite-plugin.js","./package.json":"./package.json"},"bin":{"dsplay-scan-template":"cli.js"},"engines":{"node":">=24"},"license":"MIT","dependencies":{"@babel/parser":"^7.29.7","@babel/traverse":"^7.29.7"},"gitHead":"fa7675da2394114d599cdf832078dbfd436e6e24","_id":"@dsplay/template-manifest@1.0.4","_nodeVersion":"24.18.1","_npmVersion":"11.16.0","dist":{"integrity":"sha512-HibJ8u6EjrKWqoWtcVM7aHZzccGunSS+qT1F3aDRkn/r6YT+tillWCMcYiZ14eZ3z+sZxaM8+2hDau3kBQP83Q==","shasum":"83ba7525d4cd89dccc149b721e41a9487a8e2775","tarball":"https://registry.npmjs.org/@dsplay/template-manifest/-/template-manifest-1.0.4.tgz","fileCount":5,"unpackedSize":22920,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF4yPXrLrxrgdHfyQ17vqb9nk667HFODtc7Hg2kCMM8nAiEAzW34HlrvKf63S7qYTpqx6I7t1rVGMv1nyT+AUyn+R7k="}]},"_npmUser":{"name":"pcmnac","email":"pcmnac@gmail.com"},"directories":{},"maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/template-manifest_1.0.4_1786809944344_0.09243599651540757"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T12:51:41.785Z","modified":"2026-08-15T16:05:44.743Z","1.0.0":"2026-08-12T12:51:42.204Z","1.0.1":"2026-08-12T12:57:15.711Z","1.0.2":"2026-08-12T19:24:17.154Z","1.0.3":"2026-08-13T12:58:08.828Z","1.0.4":"2026-08-15T16:05:44.515Z"},"license":"MIT","description":"Statically scans a DSPLAY HTML template's source for its dsplay_template variables and captures its dsplay-data.js as example preview data, producing template-variables.json + template-example-data.json for the CMS to auto-detect variables and seed defaul","maintainers":[{"name":"pc-dsplay","email":"contact@dsplay.tv"},{"name":"pcmnac","email":"pcmnac@gmail.com"}],"readme":"# @dsplay/template-manifest\n\nA build-time scanner for [DSPLAY HTML templates](https://developers.dsplay.tv/docs/html-templates) ([DSPLAY - Digital Signage](https://dsplay.tv/)).\n\nIt statically scans a template's source for its `dsplay_template` variable reads and captures its `dsplay-data.js` mock as example data, producing two JSON files a template ships inside its `template.zip`:\n\n- **`template-variables.json`** — the detected variables, e.g.:\n  ```json\n  {\n    \"variables\": [\n      { \"key\": \"title\", \"type\": \"string\", \"default\": \"Default Value\" },\n      { \"key\": \"expanded\", \"type\": \"boolean\", \"default\": true },\n      { \"key\": \"logo\", \"type\": \"string\", \"subtypeGuess\": \"image\" }\n    ]\n  }\n  ```\n- **`template-example-data.json`** — the `{ config, media, template }` example values captured from `dsplay-data.js`.\n\nThe DSPLAY CMS reads these files to auto-detect a template's variables and seed default values for an in-browser preview, instead of requiring the variables to be registered by hand.\n\n## What it detects\n\n- `tval` / `tbval` / `tival` / `tfval` and `useTemplateVal` / `useTemplateBoolVal` / `useTemplateIntVal` / `useTemplateFloatVal` calls, imported from `@dsplay/template-utils` / `@dsplay/react-template-utils` **or** called off the `dsplayTemplateUtils` global UMD alias (`u.tval(...)`) used by bundler-less templates.\n- Direct property access or destructuring off the template object, with no helper call at all — `template.title`, `useTemplate().title`, `const { title } = template`, `u.template.title` — including type promotion when wrapped in `parseInt`/`parseFloat`.\n- A best-effort `default` value, resolved through local consts and chained `tval(...)`-as-default calls using each reference's own lexical scope (never a global cross-file lookup, since two files can legitimately use the same key with different local defaults). Defaults that are computed at runtime (e.g. `list.join(',')`) are left unresolved rather than guessed.\n- A `subtypeGuess` (`image`, `video`, `color`) from the variable's key name, for `string`-typed variables — always a suggestion, never authoritative.\n\n## Installation\n\n```sh\nnpm install --save-dev @dsplay/template-manifest\n```\n\n## Usage\n\n### Vite plugin\n\nFor templates built with Vite:\n\n```js\n// vite.config.js\nimport templateManifest from '@dsplay/template-manifest/vite-plugin';\n\nexport default defineConfig({\n  plugins: [\n    // ...\n    templateManifest(),\n  ],\n});\n```\n\nIt writes `template-variables.json` and `template-example-data.json` into the build output directory on `closeBundle`, so they end up inside `template.zip` alongside `index.html` and the rest of the build.\n\nBy default it scans `src` and reads `public/dsplay-data.js` (both resolved relative to the Vite root). Override with:\n\n```js\ntemplateManifest({ srcDir: 'source', dsplayDataPath: 'public/mock-data.js' });\n```\n\n### CLI\n\nFor templates with no bundler (e.g. the vanilla-js and jQuery boilerplates) or on an older build stack, run the `dsplay-scan-template` CLI from your packaging script (e.g. `pack.sh`):\n\n```sh\nnpx dsplay-scan-template --src scripts --dsplay-data scripts/dsplay-data.js --out .\n```\n\n| Flag             | Default                 | Description                                  |\n|------------------|--------------------------|-----------------------------------------------|\n| `--src`          | `src`                    | Directory to scan recursively for `.js`/`.jsx` files |\n| `--dsplay-data`  | `public/dsplay-data.js`  | Path to the template's `dsplay-data.js` mock  |\n| `--out`          | `build`                  | Directory to write the two JSON files into    |\n\n### Programmatic API\n\n```js\nimport { scanTemplateVariables, scanExampleData, generateManifest } from '@dsplay/template-manifest';\n\nconst variables = scanTemplateVariables('src'); // [{key, type, default?, subtypeGuess?}]\nconst example = scanExampleData('public/dsplay-data.js'); // {config?, media?, template?}\n\ngenerateManifest({ srcDir: 'src', dsplayDataPath: 'public/dsplay-data.js', outDir: 'build' });\n```\n\n## Why a separate package\n\nThis scanner depends on `@babel/parser`/`@babel/traverse`, which are only needed at build time by templates that opt into this tool. Bundling it inside `@dsplay/template-utils` would have forced those dependencies onto every consumer of that package — including every React template via `@dsplay/react-template-utils` — even though the vast majority never use the scanner.\n","readmeFilename":"README.md"}