From 98a9106d7446f6622c77f3daff16a3828b6c62e5 Mon Sep 17 00:00:00 2001 From: Tommy Chen Date: Wed, 20 Mar 2024 19:19:28 +0800 Subject: [PATCH] chore(release): Update release note --- .changeset/breezy-cobras-joke.md | 15 --------------- .changeset/famous-shirts-train.md | 2 +- .changeset/hot-ants-enjoy.md | 12 ++++++++---- .changeset/sharp-oranges-relax.md | 20 +++++++++++++++++++- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.changeset/breezy-cobras-joke.md b/.changeset/breezy-cobras-joke.md index 5f6d871f1..e1bda0a11 100644 --- a/.changeset/breezy-cobras-joke.md +++ b/.changeset/breezy-cobras-joke.md @@ -3,18 +3,3 @@ --- Add `validateAllManifests` option to `generate` function. You can use this option to run a custom validation function for all manifests. This function will be called after all manifests are resolved. - -```ts -generate(values, { - validateAllManifests(manifests) { - for (const manifest of manifests) { - if (!manifest.metadata.namespace) { - manifest.report({ - severity: "error", - message: "Namespace is required" - }); - } - } - } -}); -``` diff --git a/.changeset/famous-shirts-train.md b/.changeset/famous-shirts-train.md index 742617d12..977adc16b 100644 --- a/.changeset/famous-shirts-train.md +++ b/.changeset/famous-shirts-train.md @@ -2,4 +2,4 @@ "@kosko/require": minor --- -Add `resolveModule` function. +Add `resolveModule` function. This function supports both module name and path resolution. Unlike `resolvePath` function which only supports path resolution. diff --git a/.changeset/hot-ants-enjoy.md b/.changeset/hot-ants-enjoy.md index 66086ce05..1f3535599 100644 --- a/.changeset/hot-ants-enjoy.md +++ b/.changeset/hot-ants-enjoy.md @@ -4,13 +4,17 @@ Add `validateManifest` option to `generate` and `resolve` function. You can use this option to run a custom validation function for each manifest. This function will be called after the `transform` function and the `validate` method of a manifest. +The following example shows how to use this option to validate that a manifest has a namespace. + ```ts resolve(values, { validateManifest(manifest) { - manifest.report({ - severity: "error", - message: "This is an error message" - }); + if (!manifest.metadata.namespace) { + manifest.report({ + severity: "error", + message: "Namespace is required" + }); + } } }); ``` diff --git a/.changeset/sharp-oranges-relax.md b/.changeset/sharp-oranges-relax.md index fd116f68b..41a245957 100644 --- a/.changeset/sharp-oranges-relax.md +++ b/.changeset/sharp-oranges-relax.md @@ -2,4 +2,22 @@ "@kosko/generate": major --- -`path` and `index` properties are replaced by `position` property in `Manifest` type, `ResolveErrorOptions` type and `ResolveError` class. +`path` and `index` properties are replaced by `position` property in `Manifest` type, `ResolveErrorOptions` type and `ResolveError` class.' + +```ts +// Before +{ + path: string; + index: number[]; + data: unknown; +} + +// After +{ + position: { + path: string; + index: number[]; + }; + data: unknown; +} +```