{"_id":"@angius/astro-jsonc","name":"@angius/astro-jsonc","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@angius/astro-jsonc","version":"1.0.0","description":"A simple JSON With Comments parser to allow its usage in Astro.","repository":{"type":"git","url":"git+https://github.com/Atulin/astro-jsonc.git"},"main":"./dist/index.js","types":"./dist/index.d.ts","type":"module","scripts":{"build":"tsc"},"keywords":["astro-integration","jsonc","comments","json"],"author":{"name":"Atulin"},"license":"MIT","peerDependencies":{"astro":"^4.0.0"},"devDependencies":{"@biomejs/biome":"^1.7.3","@types/html-escaper":"^3.0.0","@types/node":"^20.5.3","astro":"^4.0.0","typescript":"^5.1.6"},"_id":"@angius/astro-jsonc@1.0.0","gitHead":"f37cca4e78dbb09f73505303636652da05569ca5","bugs":{"url":"https://github.com/Atulin/astro-jsonc/issues"},"homepage":"https://github.com/Atulin/astro-jsonc#readme","_nodeVersion":"21.6.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-VKCGzzNNKJcC5mMKEOm3xPNxw4KNJ+Pe5Tx/CHCCXoevqGzT2BQ3/MzYwxkddXCvaJMJZxEDBZn4Trj8MlFsOA==","shasum":"f7a05e939f03d40a096d28c3e84f51cb78be6495","tarball":"https://registry.npmjs.org/@angius/astro-jsonc/-/astro-jsonc-1.0.0.tgz","fileCount":6,"unpackedSize":6563,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEz+J3gQG8zBucGqUL//pkE7QIDi6THHfw2gA3fAuhwUAiEA4vPVRvlk0UjueYmfjvtIB2NdOPaPlka0wA3wmOd6380="}]},"_npmUser":{"name":"angius","email":"koumarin@gmail.com"},"directories":{},"maintainers":[{"name":"angius","email":"koumarin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/astro-jsonc_1.0.0_1717113062050_0.29308961652190213"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-30T23:51:01.821Z","1.0.0":"2024-05-30T23:51:02.246Z","modified":"2024-05-30T23:51:02.698Z"},"maintainers":[{"name":"angius","email":"koumarin@gmail.com"}],"description":"A simple JSON With Comments parser to allow its usage in Astro.","homepage":"https://github.com/Atulin/astro-jsonc#readme","keywords":["astro-integration","jsonc","comments","json"],"repository":{"type":"git","url":"git+https://github.com/Atulin/astro-jsonc.git"},"author":{"name":"Atulin"},"bugs":{"url":"https://github.com/Atulin/astro-jsonc/issues"},"license":"MIT","readme":"# @angius/astro-jsonc\n\nThis is a very simple Astro Integration to allow you to use JSON with comments files as `data` collections.\n\n## Quick Installation\n\n```sh\n# global\nastro add @angius/astro-jsonc\n# or npm\nnpx astro add @angius/astro-jsonc\n# or yarn\nyarn dlx astro add @angius/astro-jsonc\n# or pnpm\npnpm dlx astro add @angius/astro-jsonc\n# or bun\nbunx astro add @angius/astro-jsonc\n```\n\n## Manual Installation\n\nFirst, install the `@angius/astro-jsonc` package using your package manager.\n\n```sh\n# or npm\nnpm install @angius/astro-jsonc\n# or yarn\nyarn add @angius/astro-jsonc\n# or pnpm\npnpm add @angius/astro-jsonc\n# or bun\nbun i @angius/astro-jsonc\n```\n\nNext, add the integration to your `astro.config.*` file. There is currently no set of configuration options.\n\n```typescript\nimport { defineConfig } from \"astro/config\";\nimport jsonc from \"@angius/astro-jsonc\";\n\nexport default defineConfig({\n  // ...\n  integrations: [jsonc()],\n});\n```\n\n## Usage\n\nJSON with comment files can only be used within content collections of the `data` type. Add entries to any content collection using the .jsonc extension:\n\n```\nsrc/content/my-stuff/\n  data-1.jsonc\n  data-2.jsonc\n```\n\nDefine a collection and its schema in your `content/config.ts` file.\n\n```typescript\nimport { z, defineCollection } from \"astro:content\";\n\nconst jsoncCollection = defineCollection({\n  // MUST BE 'data'. 'content' will not work.\n  type: \"data\",\n  // Schema must match what is in your TOML files.\n  schema: z.object({\n    title: z.string(),\n    tags: z.array(z.string()),\n    image: z.string().optional(),\n  }),\n});\n\nexport const collections = {\n  // ...\n  'my-stuff': jsoncCollection,\n};\n```\n\n```astro\n---\nimport { getEntryBySlug } from 'astro:content';\n\nconst entry = await getEntryBySlug('my-stuff', 'data-1');\n---\n\n<!--Access frontmatter properties with `data`-->\n<h1>{entry.data.title}</h1>\n```\n","readmeFilename":"README.md"}