diff --git a/.changeset/chatty-fireants-repeat.md b/.changeset/chatty-fireants-repeat.md deleted file mode 100644 index 6a6a48f0..00000000 --- a/.changeset/chatty-fireants-repeat.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'renoun': minor ---- - -Renames `Directory` and `File` `getParentDirectory` methods to `getParent` to better align with `getSiblings`. This also aligns more closely with the web File System API's [getParent](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/getParent) method. - -### Breaking Changes - -- `Directory.getParentDirectory` is now `Directory.getParent` -- `File.getParentDirectory` is now `File.getParent` diff --git a/.changeset/cuddly-news-kneel.md b/.changeset/cuddly-news-kneel.md deleted file mode 100644 index 15cac5fd..00000000 --- a/.changeset/cuddly-news-kneel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@renoun/mdx': patch ---- - -Fixes inline code language inference by considering language aliases. diff --git a/.changeset/dirty-poems-kneel.md b/.changeset/dirty-poems-kneel.md deleted file mode 100644 index 65241d67..00000000 --- a/.changeset/dirty-poems-kneel.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'renoun': minor ---- - -Adds `pathCasing` option to `Directory` for setting the casing of all path methods. This is useful for ensuring that all paths are in a consistent casing, regardless of the underlying file system. - -```ts -import { Directory } from 'renoun/file-system' - -const directory = new Directory({ - path: 'components', - pathCasing: 'kebab', -}) -const file = await directory.getFileOrThrow('button') - -file.getPath() // '/button' - -const directory = await directory.getDirectoryOrThrow('card') - -directory.getPath() // '/card' -``` diff --git a/.changeset/fair-goats-thank.md b/.changeset/fair-goats-thank.md deleted file mode 100644 index d7e9adc2..00000000 --- a/.changeset/fair-goats-thank.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': patch ---- - -Fixes nested ordered files not using a unique key causing them to be filtered. diff --git a/.changeset/green-yaks-yell.md b/.changeset/green-yaks-yell.md deleted file mode 100644 index 9ac575a0..00000000 --- a/.changeset/green-yaks-yell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': patch ---- - -Closes WebSocket connections with a code allowing the Node process to properly exit. More info [here](https://x.com/schickling/status/1869081922846220583). diff --git a/.changeset/hot-colts-repair.md b/.changeset/hot-colts-repair.md deleted file mode 100644 index 6f28ad24..00000000 --- a/.changeset/hot-colts-repair.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'renoun': minor ---- - -Renames the `MDXContent` component to `MDXRenderer`. This was causing confusion with the `MDXContent` type exported from `renoun/mdx` and better reflects the purpose of the component. - -### Breaking Changes - -- Rename any `MDXContent` component references from `renoun/components` to `MDXRenderer`. diff --git a/.changeset/hungry-birds-attack.md b/.changeset/hungry-birds-attack.md deleted file mode 100644 index 9cf5eb43..00000000 --- a/.changeset/hungry-birds-attack.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -'renoun': minor ---- - -Refactors the `Directory` builder pattern to move back to an object configuration with the addition of a new `withSchema` helper, allowing strong type inference and colocated file export type definitions: - -```ts -import { Directory, withSchema } from 'renoun/file-system' -import { z } from 'zod' - -export const Posts = new Directory({ - path: 'posts', - include: '*.mdx', - loaders: { - mdx: withSchema( - { - frontmatter: z.object({ - title: z.string(), - description: z.string(), - date: z.date(), - tags: z.array(z.string()).optional(), - }), - }, - (path) => import(`@/posts/${path}.mdx`) - ), - }, -}) -``` - -Note, some additional changes have also been made: - -- `withModule` has been replaced in favor of a `loaders` option. -- `withFilter` has been replaced by an `include` option to better align with TypeScript's configuration naming. -- The new `include` filter now also accepts a string glob file pattern e.g. `*.mdx`. -- An extension **must** be provided for loaders, this ensures that arbitrary file extensions are not loaded by mistake. -- [Standard Schema](https://github.com/standard-schema/standard-schema) is now used to automatically infer types from libraries that adhere to the spec (Zod, Valibot, Arktype). -- The `MDXContent` type is now included by default for MDX file `default` exports. -- Internally, the `JavaScriptFileWithRuntime` class was collapsed into `JavaScriptFile`. This was originally added to provide strong types when a runtime loader was or was not available, but caused too much complexity. In the future, a runtime loader will be added automatically if not explicitly defined. - -### Breaking Changes - -The builder pattern configuration for `Directory` has been refactored to use an object configuration with the addition of a new `withSchema` helper. This change is breaking for any existing code that uses the `Directory` builder pattern. The `withSchema` helper is now required to provide strong type inference and colocated file export type definitions. - -#### Before - -```ts -import { Directory } from 'renoun/file-system' - -interface PostTypes { - mdx: { - default: MDXContent - } -} - -const posts = new Directory('posts').withModule( - (path) => import(`./posts/${path}`) -) -``` - -#### After - -```ts -import { Directory } from 'renoun/file-system' - -const posts = new Directory({ - path: 'posts', - loaders: { - mdx: (path) => import(`./posts/${path}.mdx`), - }, -}) -``` diff --git a/.changeset/hungry-taxis-learn.md b/.changeset/hungry-taxis-learn.md deleted file mode 100644 index 972f1b37..00000000 --- a/.changeset/hungry-taxis-learn.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -'renoun': patch ---- - -Fixes `Directory#getFile` not considering file name modifiers. - -```ts -const directory = new Directory({ path: 'components' }) -const file = await directory.getFileOrThrow(['APIReference', 'examples']) - -file.getAbsolutePath() // '/APIReference.examples.tsx' -``` diff --git a/.changeset/long-walls-kneel.md b/.changeset/long-walls-kneel.md deleted file mode 100644 index 98926d13..00000000 --- a/.changeset/long-walls-kneel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': minor ---- - -Marks the `Directory#duplicate` method as private since this was previously only exposed for `EntryGroup` which no longer requires a new instance to be created. diff --git a/.changeset/loud-pans-sit.md b/.changeset/loud-pans-sit.md deleted file mode 100644 index d24c5d5c..00000000 --- a/.changeset/loud-pans-sit.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -'renoun': minor ---- - -Removes `getEditPath` in favor of `getEditUrl` and `getEditorUri` for a more explicit API. Prior, the `getEditPath` method switched between the editor and the git provider source based on the environment. This was confusing and not always the desired behavior. Now you can explicitly choose the behavior you want. - -### Breaking Changes - -The `getEditPath` method has been removed. Use `getEditUrl` and `getEditorUri` instead. - -To get the same behavior as `getEditPath` you can use both `getEditUrl` and `getEditorUri` together: - -```ts -import { Directory } from 'renoun/file-system' - -const directory = new Directory('src/components') -const file = directory.getFileOrThrow('Button', 'tsx') -const editUrl = - process.env.NODE_ENV === 'development' - ? file.getEditorUri() - : file.getEditUrl() -``` diff --git a/.changeset/slow-toys-smoke.md b/.changeset/slow-toys-smoke.md deleted file mode 100644 index 22363178..00000000 --- a/.changeset/slow-toys-smoke.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'renoun': minor -'@renoun/mdx': minor ---- - -Renames `@renoun/mdx` `Headings` type to `MDXHeadings`. This adds better clarity and consistency with the other `MDX` prefixed types. - -### Breaking Changes - -- Rename any `Headings` references from `@renoun/mdx` to `MDXHeadings`. diff --git a/.changeset/twelve-seas-doubt.md b/.changeset/twelve-seas-doubt.md deleted file mode 100644 index a54afb6c..00000000 --- a/.changeset/twelve-seas-doubt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@renoun/mdx': patch ---- - -Removes `mdast` dependency. This was added by mistake and is not needed since `@types/mdast` is already a dependency. diff --git a/.changeset/twenty-ears-report.md b/.changeset/twenty-ears-report.md deleted file mode 100644 index ac8d55ca..00000000 --- a/.changeset/twenty-ears-report.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renoun': patch ---- - -Fixes `Directory#getFile` not prioritizing base files over files with modifiers e.g. `Button.tsx` over `Button.examples.tsx`. diff --git a/packages/mdx/CHANGELOG.md b/packages/mdx/CHANGELOG.md index 5f34fe2b..85a927e1 100644 --- a/packages/mdx/CHANGELOG.md +++ b/packages/mdx/CHANGELOG.md @@ -1,5 +1,20 @@ # @renoun/mdx +## 1.3.0 + +### Minor Changes + +- 97bc268: Renames `@renoun/mdx` `Headings` type to `MDXHeadings`. This adds better clarity and consistency with the other `MDX` prefixed types. + + ### Breaking Changes + + - Rename any `Headings` references from `@renoun/mdx` to `MDXHeadings`. + +### Patch Changes + +- ece3cc2: Fixes inline code language inference by considering language aliases. +- df4d29d: Removes `mdast` dependency. This was added by mistake and is not needed since `@types/mdast` is already a dependency. + ## 1.2.1 ### Patch Changes diff --git a/packages/mdx/package.json b/packages/mdx/package.json index 3e7a5143..b10d2f87 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -1,6 +1,6 @@ { "name": "@renoun/mdx", - "version": "1.2.1", + "version": "1.3.0", "description": "MDX plugins for renoun", "author": "Travis Arnold", "license": "MIT", diff --git a/packages/renoun/CHANGELOG.md b/packages/renoun/CHANGELOG.md index 2d39ea6e..d715b867 100644 --- a/packages/renoun/CHANGELOG.md +++ b/packages/renoun/CHANGELOG.md @@ -1,5 +1,153 @@ # renoun +## 7.9.0 + +### Minor Changes + +- 3022d63: Renames `Directory` and `File` `getParentDirectory` methods to `getParent` to better align with `getSiblings`. This also aligns more closely with the web File System API's [getParent](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry/getParent) method. + + ### Breaking Changes + + - `Directory.getParentDirectory` is now `Directory.getParent` + - `File.getParentDirectory` is now `File.getParent` + +- ba2d5e1: Adds `pathCasing` option to `Directory` for setting the casing of all path methods. This is useful for ensuring that all paths are in a consistent casing, regardless of the underlying file system. + + ```ts + import { Directory } from 'renoun/file-system' + + const directory = new Directory({ + path: 'components', + pathCasing: 'kebab', + }) + const file = await directory.getFileOrThrow('button') + + file.getPath() // '/button' + + const directory = await directory.getDirectoryOrThrow('card') + + directory.getPath() // '/card' + ``` + +- 87e380b: Renames the `MDXContent` component to `MDXRenderer`. This was causing confusion with the `MDXContent` type exported from `renoun/mdx` and better reflects the purpose of the component. + + ### Breaking Changes + + - Rename any `MDXContent` component references from `renoun/components` to `MDXRenderer`. + +- 4149b39: Refactors the `Directory` builder pattern to move back to an object configuration with the addition of a new `withSchema` helper, allowing strong type inference and colocated file export type definitions: + + ```ts + import { Directory, withSchema } from 'renoun/file-system' + import { z } from 'zod' + + export const Posts = new Directory({ + path: 'posts', + include: '*.mdx', + loaders: { + mdx: withSchema( + { + frontmatter: z.object({ + title: z.string(), + description: z.string(), + date: z.date(), + tags: z.array(z.string()).optional(), + }), + }, + (path) => import(`@/posts/${path}.mdx`) + ), + }, + }) + ``` + + Note, some additional changes have also been made: + + - `withModule` has been replaced in favor of a `loaders` option. + - `withFilter` has been replaced by an `include` option to better align with TypeScript's configuration naming. + - The new `include` filter now also accepts a string glob file pattern e.g. `*.mdx`. + - An extension **must** be provided for loaders, this ensures that arbitrary file extensions are not loaded by mistake. + - [Standard Schema](https://github.com/standard-schema/standard-schema) is now used to automatically infer types from libraries that adhere to the spec (Zod, Valibot, Arktype). + - The `MDXContent` type is now included by default for MDX file `default` exports. + - Internally, the `JavaScriptFileWithRuntime` class was collapsed into `JavaScriptFile`. This was originally added to provide strong types when a runtime loader was or was not available, but caused too much complexity. In the future, a runtime loader will be added automatically if not explicitly defined. + + ### Breaking Changes + + The builder pattern configuration for `Directory` has been refactored to use an object configuration with the addition of a new `withSchema` helper. This change is breaking for any existing code that uses the `Directory` builder pattern. The `withSchema` helper is now required to provide strong type inference and colocated file export type definitions. + + #### Before + + ```ts + import { Directory } from 'renoun/file-system' + + interface PostTypes { + mdx: { + default: MDXContent + } + } + + const posts = new Directory('posts').withModule( + (path) => import(`./posts/${path}`) + ) + ``` + + #### After + + ```ts + import { Directory } from 'renoun/file-system' + + const posts = new Directory({ + path: 'posts', + loaders: { + mdx: (path) => import(`./posts/${path}.mdx`), + }, + }) + ``` + +- 80ae7f2: Marks the `Directory#duplicate` method as private since this was previously only exposed for `EntryGroup` which no longer requires a new instance to be created. +- 1f6603d: Removes `getEditPath` in favor of `getEditUrl` and `getEditorUri` for a more explicit API. Prior, the `getEditPath` method switched between the editor and the git provider source based on the environment. This was confusing and not always the desired behavior. Now you can explicitly choose the behavior you want. + + ### Breaking Changes + + The `getEditPath` method has been removed. Use `getEditUrl` and `getEditorUri` instead. + + To get the same behavior as `getEditPath` you can use both `getEditUrl` and `getEditorUri` together: + + ```ts + import { Directory } from 'renoun/file-system' + + const directory = new Directory('src/components') + const file = directory.getFileOrThrow('Button', 'tsx') + const editUrl = + process.env.NODE_ENV === 'development' + ? file.getEditorUri() + : file.getEditUrl() + ``` + +- 97bc268: Renames `@renoun/mdx` `Headings` type to `MDXHeadings`. This adds better clarity and consistency with the other `MDX` prefixed types. + + ### Breaking Changes + + - Rename any `Headings` references from `@renoun/mdx` to `MDXHeadings`. + +### Patch Changes + +- 5d8bd25: Fixes nested ordered files not using a unique key causing them to be filtered. +- dc323ab: Closes WebSocket connections with a code allowing the Node process to properly exit. More info [here](https://x.com/schickling/status/1869081922846220583). +- 679da2c: Fixes `Directory#getFile` not considering file name modifiers. + + ```ts + const directory = new Directory({ path: 'components' }) + const file = await directory.getFileOrThrow(['APIReference', 'examples']) + + file.getAbsolutePath() // '/APIReference.examples.tsx' + ``` + +- 5b558c1: Fixes `Directory#getFile` not prioritizing base files over files with modifiers e.g. `Button.tsx` over `Button.examples.tsx`. +- Updated dependencies [ece3cc2] +- Updated dependencies [97bc268] +- Updated dependencies [df4d29d] + - @renoun/mdx@1.3.0 + ## 7.8.0 ### Minor Changes diff --git a/packages/renoun/package.json b/packages/renoun/package.json index 1dfb4256..dc64f6e0 100644 --- a/packages/renoun/package.json +++ b/packages/renoun/package.json @@ -1,6 +1,6 @@ { "name": "renoun", - "version": "7.8.0", + "version": "7.9.0", "description": "The Technical Content Toolkit for React", "author": "Travis Arnold", "license": "AGPL-3.0-or-later",