Releases: souporserious/renoun
renoun@7.4.0
Minor Changes
-
e71de2f: Adds
shouldFormat
prop toCodeBlock
component to allow disabling code formatting. This is useful for MDX code blocks that are already formatted by an IDE or CI environment.export function useMDXComponents() { return { pre: (props) => { return <CodeBlock shouldFormat={false} {...restProps} /> }, } }
-
f44b9c5: Adds support for passing an array to
isFileWithExtension
and<File>.hasExtension
.
Patch Changes
renoun@7.3.0
renoun@7.2.0
Minor Changes
-
9d67bdf: Add
getFiles
andgetDirectories
toDirectory
. -
1bd1de3: Adds
hasExtension
method toFile
to help constrain the type:import { Directory } from 'renoun/file-system' const posts = new Directory<{ mdx: { frontmatter: { title: string } } }>({ path: 'posts', }) const mdxFiles = await posts .getFiles() .filter((post) => post.hasExtension('mdx'))
-
4d263fe: Add
includeIndexAndReadme
option togetEntries
for controlling default filtering ofindex
andreadme
files. -
e09a837: Adds
isFileWithExtension
utility:const fileSystem = new VirtualFileSystem({ 'Button.tsx': '', }) const directory = new Directory<{ tsx: { metadata: {} } }>({ fileSystem, }) const file = await directory.getFileOrThrow('Button') if (isFileWithExtension(file, 'tsx')) { // file is typed as File<{ tsx: { metadata: {} } }> }
-
a36058f: Add
getEditPath
method toJavaScriptFileExport
.
renoun@7.1.0
Minor Changes
-
16a475f: Adds javascript file export metadata to
renoun/file-system
:import { VirtualFileSystem, Directory } from 'renoun/file-system' const fileSystem = new VirtualFileSystem({ 'index.ts': `/**\n * Say hello.\n * @category greetings\n */\nexport default function hello() {}`, }) const directory = new Directory({ fileSystem }) const file = await directory.getFileOrThrow('index', 'ts') const fileExport = file.getExport('default') await fileExport.getName() // 'hello' await fileExport.getDescription() // 'Say hello.' await fileExport.getTags() // [{ name: 'category', value: 'greetings' }]
Patch Changes
- e1b908e: Removes
async
modifier forCodeInline
component to prevent type errors.
renoun@7.0.0
Major Changes
-
90bbe5b: Simplifies how
baseDirectory
works forCollection
. This was from a legacy implementation that was not well thought out and caused confusion. This change makes it more explicit and easier to understand.Breaking Changes
The
baseDirectory
option forCollection
is now required to be separate fromfilePattern
:import { Collection } from 'renoun/collections' const components = new Collection({ -- filePattern: 'src/components/**/*.ts', ++ filePattern: '**/*.ts', -- baseDirectory: 'components', ++ baseDirectory: 'src/components', })
-
93da61f: Introduces more performant, type-safe file system from utilities exported from
renoun/file-system
to replace therenoun/collections
API, which will be removed in a future major release.- New Classes:
NodeFileSystem
,VirtualFileSystem
,Directory
,File
,JavaScriptFile
, andJavaScriptFileExport
.
- Improvements:
- Optimized performance, stronger TypeScript support, and in-memory support with
VirtualFileSystem
.
- Optimized performance, stronger TypeScript support, and in-memory support with
Migration Example
Before:
const collection = new Collection({ filePattern: 'src/**/*.{ts,tsx}', baseDirectory: 'src', }) const sources = await collection.getSources()
After:
const directory = new Directory({ path: 'src' }) const entries = await directory.getEntries()
The new file system utilities offer clearer APIs, better performance, and improved developer experience. This is still experimental and API parity with the old collections API is still in progress. Please report any issues you encounter.
- New Classes:
-
7cbb112: Updates the
<Collection>.getSource
method to be asynchronous and return aPromise
that resolves to the source. This allows for more flexibility for a source to communicate with the web socket server.Breaking Changes
The
getSource
method for aCollection
andCompositeCollection
now returns aPromise
that resolves to the source. This means that you will need toawait
the result when calling this method:import { Collection } from 'renoun/collections' const posts = new Collection({ filePattern: 'posts/*.mdx', }) export default async function Page({ params }: { params: Promise<{ slug: string }> }) { -- const post = posts.getSource(params.slug) ++ const post = await posts.getSource(params.slug) if (!post) { return <div>Post not found</div> } const Content = await post.getExport('default').getValue() return <Content /> }
Minor Changes
-
b2ba1e4: Adds
renoun/server
export for more control of running the WebSocket server. For example, in Next.js this can be used with theinstrumentation.ts
file:import { createServer } from 'renoun/server' export async function register() { if ( process.env.NODE_ENV === 'development' && process.env.NEXT_RUNTIME === 'nodejs' ) { createServer() } }
Patch Changes
@renoun/mdx@1.2.1
Patch Changes
- 7020585: Updates all dependencies to latest version.
renoun@6.1.0
Minor Changes
- cd963a0: Marks pseudo-private methods in collection classes as these are not meant to be used publicly and will not adhere to semver.
- 7642f56: Filters out private class members that start with
#
or_
when using<Export>.getType()
.
Patch Changes
- 72a2e98: Fixes specifying a
language
for inline MDX code. - eca091b: Fixes constraint text in generated generics text.
- 6753e12: Waits for any active refreshing source files before resolving types.
- 9ac5434: Fixes bug in
CodeBlock
when targeting renoun filenames. TheCodeBlock
source files now use a unique identifier that does not clash with renoun exports. - 619abd9: Fixes class type resolution not accounting for filter and file dependencies.
- Updated dependencies [72a2e98]
- @renoun/mdx@1.2.0
@renoun/mdx@1.2.0
Minor Changes
- 72a2e98: Fixes specifying a
language
for inline MDX code.
renoun@6.0.0
Major Changes
-
0e6279a: Removes the deprecated
collection
function.Breaking Changes
The
collection
function has been removed. You can now use theCollection
class directly to create a collection:import { Collection } from 'renoun/collections' const posts = new Collection({ filePattern: 'posts/*.mdx', })
Minor Changes
-
ebdfb16: Adds
getFileSystemPath
method toFileSystemSource
andExportSource
to allow getting types for a file inAPIReference
. -
489960a: Adds the ability to specify the set of languages loaded for syntax highlighting using the
languages
field in therenoun.json
configuration file. This allows you to reduce the bundle size by only loading the languages you need:{ "languages": ["sh", "ts", "tsx"] }
-
ed8fb6a: Adds support for formatting the
CodeBlock
component source text usingprettier
if it is available to the workspace.
Patch Changes
- cab837b: Fixes issue with trying to format dynamic imports added to collections from CLI causing issues with linters. Now, formatting will only occur if the workspace has access to
prettier
.
renoun@5.5.0
Minor Changes
- 555815e: Adds a cache to the
<ExportSource>.getType
method to prevent unnecessary processing of types since this is an expensive operation. Types will now only be resolved the first time they are requested and then cached for subsequent requests unless one of the file dependencies has changed.