{"id":14156002,"url":"https://github.com/offen/esbuild-plugin-jsonschema","last_synced_at":"2025-04-12T04:20:59.930Z","repository":{"id":42491324,"uuid":"336732935","full_name":"offen/esbuild-plugin-jsonschema","owner":"offen","description":"Compile and pack JSON schema definitions on import using esbuild","archived":false,"fork":false,"pushed_at":"2024-02-24T19:43:32.000Z","size":221,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-01T09:46:06.528Z","etag":null,"topics":["esbuild","json-schema"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/offen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-07T07:56:20.000Z","updated_at":"2024-06-16T13:14:20.997Z","dependencies_parsed_at":"2024-06-16T13:14:20.548Z","dependency_job_id":"f79d6b1d-5371-46b2-9c1b-39446c3b2308","html_url":"https://github.com/offen/esbuild-plugin-jsonschema","commit_stats":{"total_commits":20,"total_committers":4,"mean_commits":5.0,"dds":0.6,"last_synced_commit":"dacd2e6bc8663e754da9ce16ebf7a8552881c5da"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fesbuild-plugin-jsonschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fesbuild-plugin-jsonschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fesbuild-plugin-jsonschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offen%2Fesbuild-plugin-jsonschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/offen","download_url":"https://codeload.github.com/offen/esbuild-plugin-jsonschema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514395,"owners_count":21116952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esbuild","json-schema"],"created_at":"2024-08-17T08:05:09.188Z","updated_at":"2025-04-12T04:20:59.906Z","avatar_url":"https://github.com/offen.png","language":"JavaScript","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"\u003ca href=\"https://www.offen.software/\"\u003e\n  \u003cimg src=\"https://offen.github.io/press-kit/avatars/avatar-OS-header.svg\" alt=\"offen.software logo\" title=\"offen.software\" width=\"60px\"/\u003e\n\u003c/a\u003e\n\n# esbuild-plugin-jsonschema\nCompile and pack JSON schema definitions on import using esbuild\n\n## Installation\n\nThe package is released to npm as `@offen/esbuild-plugin-jsonschema`:\n\n```\nnpm install @offen/esbuild-plugin-jsonschema -D\n```\n\n## Usage\n\nIn the default configuration, the transform is applied to all files with a `.schema` or `.schema.json` extension. The transformed module will export the packed AJV `validate` function.\n\nIn your application:\n\n```js\nconst validateFoo = require('./foo.schema')\n\nconst ok = validateFoo({ foo: true })\nif (!ok) {\n  console.log(validateFoo.errors)\n  throw new Error('Foo did not validate')\n}\n```\n\nWhen bundling:\n\n```js\nconst esbuild = require('esbuild')\nconst jsonschemaPlugin = require('@offen/esbuild-plugin-jsonschema')\n\nesbuild.build({\n  entryPoints: ['app.js'],\n  bundle: true,\n  plugins: [jsonschemaPlugin()],\n  outdir: './public'\n})\n```\n\n### Defining schemas\n\nSchemas are expected to be defined in JSON format and saved as `.schema` files:\n\n```json\n{\n  \"type\": \"string\",\n  \"maxLength\": 128\n}\n```\n\n## Options\n\nThe transform accepts the following options as its 2nd arguments:\n\n### `secure`\n\nBy default, this plugin only compiles [\"secure\" schemas][secure]. This can be disabled by passing `secure: false` to the transform.\n\n[secure]: https://github.com/ajv-validator/ajv/tree/521c3a53f15f5502fb4a734194932535d311267c#security-considerations\n\n### `filter`\n\nBy default, files with a `.schema` or a `.schema.json` extension are compiled. If you have different requirements you can pass a Regexp to `filter` for the plugin to use.\n\n### `addFormats`\n\nIncludes [ajv-formats](https://github.com/ajv-validator/ajv-formats). Default `true`.\n\n### `ajvOptions`\n\nCustom [options](https://ajv.js.org/options.html) to be passed to Ajv constructor.\n\n## Releasing a new version\n\nNew versions can be released using `npm version \u003cpatch|minor|major\u003e`. Make sure you are authenticated against the `@offen` scope with npm.\n\n## License\n\nCopyright 2021 Frederik Ring - Available under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffen%2Fesbuild-plugin-jsonschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffen%2Fesbuild-plugin-jsonschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffen%2Fesbuild-plugin-jsonschema/lists"}