Releases: souporserious/renoun
renoun@7.7.0
Minor Changes
- a1aa042: Removes managing of auto-generated dynamic imports for collections as this was causing issues with build processes.
Patch Changes
renoun@7.6.0
Minor Changes
-
0c67c7c: Removes
isJavaScriptFile
type guard in favor ofisFileWithExtension
that narrows types better. -
bf56af0: Adds support for passing
JavaScriptFile
andJavaScriptFileExport
to theAPIReference
component. -
4fc9781: Returns a
JavaScriptExport
instance now fromgetExports
to align withgetExport
. -
73bb769: Adds Fast Refresh to
<JavaScriptExport>.getRuntimeValue
for Next.js. -
3eec7ff: Removes
getDirectories
andgetFiles
fromDirectory
now that thefilter
method is available:import { Directory, isFileWithExtension } from 'renoun/file-system' const directory = new Directory() const files = directory .filter((entry) => isFileWithExtension(entry, ['ts', 'tsx'])) .getEntries()
-
5390b16: Removes
<File>.hasExtension
method in favor of theisFileWithExtension
type guard to consolidate the API.
Patch Changes
- 8d2b7f3: Fixes the
<Directory>.getEntries
methodrecursive
option not considering nested entries.
renoun@7.5.0
Minor Changes
-
abb441d: Improves error handling for the
CodeBlock
component when falsey values are provided. -
0b6e426: Adds
sort
method toDirectory
to allow sorting all entries within each directory:import { Directory, isFileWithExtension } from 'renoun' type PostType = { frontmatter: { title: string } } const posts = new Directory<{ mdx: PostType }>({ path: 'posts' }) .filter((entry) => isFileWithExtension(entry, 'mdx')) .sort(async (a, b) => { const aFrontmatter = await a.getExport('frontmatter').getRuntimeValue() const bFrontmatter = await b.getExport('frontmatter').getRuntimeValue() return aFrontmatter.title.localeCompare(bFrontmatter.title) }) const files = await posts.getEntries() // JavaScriptFile<PostType>[] sorted by front matter title
-
cac71c1: Improves
<VirtualFileSystem>.transpileFile
error handling. -
2c55b51: Adds
filter
method toDirectory
to allow filtering all entries within each directory:import { Directory, isFileWithExtension } from 'renoun' type PostType = { frontmatter: { title: string } } const posts = new Directory<{ mdx: PostType }>({ path: 'posts' }).filter( (entry) => isFileWithExtension(entry, 'mdx') ) const files = await posts.getEntries() // JavaScriptFile<PostType>[]
-
40c6cdd: Scopes
VirtualFileSystem
using aprojectId
added to the baseFileSystem
class. This ensures the TypeScript project is unique to the virtual file system it is instantiated with.
Patch Changes
- 1c77620: Fixes the
<Directory>.getEntries
methodrecursive
option to only recurse ingetEntries
instead of the file system.
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