diff --git a/.changeset/calm-sloths-wave.md b/.changeset/calm-sloths-wave.md deleted file mode 100644 index 20dd9b21..00000000 --- a/.changeset/calm-sloths-wave.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -'renoun': major ---- - -Removes `renoun/collections` package export and all related types and utilities that were deprecated in [v7.8.0](https://github.com/souporserious/renoun/releases/tag/renoun%407.8.0). - -### Breaking Changes - -The `renoun/collections` package was removed. To upgrade, move to the `renoun/file-system` package and use the `Directory` class instead. In most cases, you can replace `Collection` with `Directory` and `CompositeCollection` with `EntryGroup`. - -#### Before - -```tsx -import { Collection, CompositeCollection } from 'renoun/collections' - -const docs = new Collection({ - filePattern: '*.mdx', - baseDirectory: 'docs', -}) -const components = new Collection({ - filePattern: '*.{ts,tsx}', - baseDirectory: 'src/components', -}) -const compositeCollection = new CompositeCollection(docs, components) -``` - -#### After - -```tsx -import { Directory, EntryGroup } from 'renoun/file-system' - -const docs = new Directory({ - path: 'docs', - include: '*.mdx', -}) -const components = new Directory({ - path: 'src/components', - include: '*.{ts,tsx}', -}) -const entryGroup = new EntryGroup({ - entries: [docs, components], -}) -``` diff --git a/.changeset/curvy-news-speak.md b/.changeset/curvy-news-speak.md deleted file mode 100644 index 89d206dd..00000000 --- a/.changeset/curvy-news-speak.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': minor ---- - -Now `Directory#getParent` throws when called for the root directory. This makes the method easier to work with and aligns better with `File#getParent` always returning a `Directory` instance. diff --git a/.changeset/fair-candles-grin.md b/.changeset/fair-candles-grin.md deleted file mode 100644 index 70000313..00000000 --- a/.changeset/fair-candles-grin.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'renoun': major ---- - -Removes all `*OrThrow` methods from `Directory` and `EntryGroup`. This also exports two new custom errors, `FileNotFoundError` and `FileExportNotFoundError` to handle missing files and exports. - -### Breaking Changes - -`Directory` and `EntryGroup` no longer have `*OrThrow` methods, use the respective methods instead. To get the same functionality as before, you can catch the error and handle it accordingly: - -```ts -import { Directory } from 'renoun/file-system' - -const posts = new Directory({ path: 'posts' }) - -posts.getFile('hello-world', 'mdx').catch((error) => { - if (error instanceof FileNotFoundError) { - return undefined - } - throw error -}) -``` diff --git a/.changeset/few-swans-call.md b/.changeset/few-swans-call.md deleted file mode 100644 index 236d0dfb..00000000 --- a/.changeset/few-swans-call.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -'renoun': minor ---- - -Adds a default `mdx` loader to `JavaScriptFile` that uses the `MDXRenderer` component. This allows MDX files without imports to be rendered easily: - -```tsx -import { Directory } from 'renoun/file-system' - -const posts = new Directory({ path: 'posts' }) - -export default async function Page({ - params, -}: { - params: Promise<{ slug: string }> -}) { - const slug = (await params).slug - const post = await posts.getFile(slug, 'mdx') - const Content = await post.getExportValue('default') - - return -} -``` diff --git a/.changeset/moody-guests-drive.md b/.changeset/moody-guests-drive.md deleted file mode 100644 index b8c8bef0..00000000 --- a/.changeset/moody-guests-drive.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': minor ---- - -Adds `File#getText` method for retrieving the text contents of the file. diff --git a/.changeset/neat-shoes-yell.md b/.changeset/neat-shoes-yell.md deleted file mode 100644 index b02bf691..00000000 --- a/.changeset/neat-shoes-yell.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -'renoun': minor ---- - -Allows instantiating `File` and `JavaScriptFile` more easily using only a `path`: - -```ts -import { JavaScriptFile } from 'renoun/file-system' - -const indexFile = new JavaScriptFile({ path: 'src/index.ts' }) -const indexFileExports = await indexFile.getExports() -``` diff --git a/.changeset/shaggy-scissors-whisper.md b/.changeset/shaggy-scissors-whisper.md deleted file mode 100644 index a821eb64..00000000 --- a/.changeset/shaggy-scissors-whisper.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': minor ---- - -Configures the [JavaScript RegExp Engine](https://shiki.style/guide/regex-engines#javascript-regexp-engine) for `shiki`. diff --git a/.changeset/silly-mice-fix.md b/.changeset/silly-mice-fix.md deleted file mode 100644 index 30fb0c0b..00000000 --- a/.changeset/silly-mice-fix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': patch ---- - -Fixes `getType` erroring when inferring a re-exported type. diff --git a/.changeset/slimy-cheetahs-swim.md b/.changeset/slimy-cheetahs-swim.md deleted file mode 100644 index e7614bc5..00000000 --- a/.changeset/slimy-cheetahs-swim.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'renoun': minor ---- - -Adds an option for specifying the `port` number when using `createServer` from `renoun/server`: - -```ts -import { createServer } from 'renoun/server' - -createServer({ port: 3001 }) -``` diff --git a/.changeset/tiny-ears-whisper.md b/.changeset/tiny-ears-whisper.md deleted file mode 100644 index 60e2cb28..00000000 --- a/.changeset/tiny-ears-whisper.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': patch ---- - -Fixes duplicate exports when there are overloads. diff --git a/.changeset/witty-hounds-explode.md b/.changeset/witty-hounds-explode.md deleted file mode 100644 index 0a0c20ed..00000000 --- a/.changeset/witty-hounds-explode.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'renoun': minor ---- - -Exports `FileSystem`, `MemoryFileSystem`, and `NodeFileSystem` classes for creating custom file systems as well as `Repository` for normalizing git providers. - -```js -import { Directory, MemoryFileSystem } from 'renoun/file-system' - -const fileSystem = new MemoryFileSystem({ - 'index.mdx': '# Hello, World!', -}) -const directory = new Directory({ fileSystem }) -``` diff --git a/packages/renoun/CHANGELOG.md b/packages/renoun/CHANGELOG.md index d715b867..17ff9e37 100644 --- a/packages/renoun/CHANGELOG.md +++ b/packages/renoun/CHANGELOG.md @@ -1,5 +1,126 @@ # renoun +## 8.0.0 + +### Major Changes + +- 02facb1: Removes `renoun/collections` package export and all related types and utilities that were deprecated in [v7.8.0](https://github.com/souporserious/renoun/releases/tag/renoun%407.8.0). + + ### Breaking Changes + + The `renoun/collections` package was removed. To upgrade, move to the `renoun/file-system` package and use the `Directory` class instead. In most cases, you can replace `Collection` with `Directory` and `CompositeCollection` with `EntryGroup`. + + #### Before + + ```tsx + import { Collection, CompositeCollection } from 'renoun/collections' + + const docs = new Collection({ + filePattern: '*.mdx', + baseDirectory: 'docs', + }) + const components = new Collection({ + filePattern: '*.{ts,tsx}', + baseDirectory: 'src/components', + }) + const compositeCollection = new CompositeCollection(docs, components) + ``` + + #### After + + ```tsx + import { Directory, EntryGroup } from 'renoun/file-system' + + const docs = new Directory({ + path: 'docs', + include: '*.mdx', + }) + const components = new Directory({ + path: 'src/components', + include: '*.{ts,tsx}', + }) + const entryGroup = new EntryGroup({ + entries: [docs, components], + }) + ``` + +- eda5977: Removes all `*OrThrow` methods from `Directory` and `EntryGroup`. This also exports two new custom errors, `FileNotFoundError` and `FileExportNotFoundError` to handle missing files and exports. + + ### Breaking Changes + + `Directory` and `EntryGroup` no longer have `*OrThrow` methods, use the respective methods instead. To get the same functionality as before, you can catch the error and handle it accordingly: + + ```ts + import { Directory } from 'renoun/file-system' + + const posts = new Directory({ path: 'posts' }) + + posts.getFile('hello-world', 'mdx').catch((error) => { + if (error instanceof FileNotFoundError) { + return undefined + } + throw error + }) + ``` + +### Minor Changes + +- fcd11af: Now `Directory#getParent` throws when called for the root directory. This makes the method easier to work with and aligns better with `File#getParent` always returning a `Directory` instance. +- 71aa01f: Adds a default `mdx` loader to `JavaScriptFile` that uses the `MDXRenderer` component. This allows MDX files without imports to be rendered easily: + + ```tsx + import { Directory } from 'renoun/file-system' + + const posts = new Directory({ path: 'posts' }) + + export default async function Page({ + params, + }: { + params: Promise<{ slug: string }> + }) { + const slug = (await params).slug + const post = await posts.getFile(slug, 'mdx') + const Content = await post.getExportValue('default') + + return + } + ``` + +- 21a952a: Adds `File#getText` method for retrieving the text contents of the file. +- e107c2f: Allows instantiating `File` and `JavaScriptFile` more easily using only a `path`: + + ```ts + import { JavaScriptFile } from 'renoun/file-system' + + const indexFile = new JavaScriptFile({ path: 'src/index.ts' }) + const indexFileExports = await indexFile.getExports() + ``` + +- 919b73d: Configures the [JavaScript RegExp Engine](https://shiki.style/guide/regex-engines#javascript-regexp-engine) for `shiki`. +- 213cc11: Adds an option for specifying the `port` number when using `createServer` from `renoun/server`: + + ```ts + import { createServer } from 'renoun/server' + + createServer({ port: 3001 }) + ``` + +- 446effc: Exports `FileSystem`, `MemoryFileSystem`, and `NodeFileSystem` classes for creating custom file systems as well as `Repository` for normalizing git providers. + + ```js + import { Directory, MemoryFileSystem } from 'renoun/file-system' + + const fileSystem = new MemoryFileSystem({ + 'index.mdx': '# Hello, World!', + }) + const directory = new Directory({ fileSystem }) + ``` + +### Patch Changes + +- 7b90440: Fixes `getType` erroring when inferring a re-exported type. +- 54eeb9e: Fixes duplicate exports when there are overloads. + ## 7.9.0 ### Minor Changes diff --git a/packages/renoun/package.json b/packages/renoun/package.json index 793f16ef..61e2f0db 100644 --- a/packages/renoun/package.json +++ b/packages/renoun/package.json @@ -1,6 +1,6 @@ { "name": "renoun", - "version": "7.9.0", + "version": "8.0.0", "description": "The Technical Content Toolkit for React", "author": "Travis Arnold", "license": "AGPL-3.0-or-later",