Skip to content

Releases: souporserious/renoun

renoun@7.7.0

21 Nov 23:36
1c715a5
Compare
Choose a tag to compare

Minor Changes

  • a1aa042: Removes managing of auto-generated dynamic imports for collections as this was causing issues with build processes.

Patch Changes

  • f2e5608: Fixes getAbsolutePath and getEditPath for Directory.
  • c59cd9c: Normalizes pathSegments to remove order prefix.
  • 784945a: Normalizes incoming path for readDirectory in VirtualFileSystem to match Node.js behavior.

renoun@7.6.0

20 Nov 18:20
Compare
Choose a tag to compare

Minor Changes

  • 0c67c7c: Removes isJavaScriptFile type guard in favor of isFileWithExtension that narrows types better.

  • bf56af0: Adds support for passing JavaScriptFile and JavaScriptFileExport to the APIReference component.

  • 4fc9781: Returns a JavaScriptExport instance now from getExports to align with getExport.

  • 73bb769: Adds Fast Refresh to <JavaScriptExport>.getRuntimeValue for Next.js.

  • 3eec7ff: Removes getDirectories and getFiles from Directory now that the filter 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 the isFileWithExtension type guard to consolidate the API.

Patch Changes

  • 8d2b7f3: Fixes the <Directory>.getEntries method recursive option not considering nested entries.

renoun@7.5.0

19 Nov 20:14
49d875d
Compare
Choose a tag to compare

Minor Changes

  • abb441d: Improves error handling for the CodeBlock component when falsey values are provided.

  • 0b6e426: Adds sort method to Directory 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 to Directory 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 a projectId added to the base FileSystem class. This ensures the TypeScript project is unique to the virtual file system it is instantiated with.

Patch Changes

  • 1c77620: Fixes the <Directory>.getEntries method recursive option to only recurse in getEntries instead of the file system.

renoun@7.4.0

18 Nov 20:13
8f463b2
Compare
Choose a tag to compare

Minor Changes

  • e71de2f: Adds shouldFormat prop to CodeBlock 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

  • bf0c510: Fixes File System recursive options not calculating the appropriate relative paths.
  • eab583f: Explicitly sets the prettier parser option instead of relying on inference from filepath to avoid false-positive errors when parsing code blocks without a provided filename.

renoun@7.3.0

16 Nov 23:51
6fec13d
Compare
Choose a tag to compare

Minor Changes

  • 4c1f7d5: Adds recursive option to getEntries, getDirectories, and getFiles.
  • ff8d9ae: Implements getType for JavaScriptFileExport.

Patch Changes

  • 51506d8: Fixes internal resolveType utility trimming the filePath in getType incorrectly.
  • d83d265: Fixes order prefixes being added to File System getPath methods.

renoun@7.2.0

16 Nov 10:26
a8cf202
Compare
Choose a tag to compare

Minor Changes

  • 9d67bdf: Add getFiles and getDirectories to Directory.

  • 1bd1de3: Adds hasExtension method to File 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 to getEntries for controlling default filtering of index and readme 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 to JavaScriptFileExport.

renoun@7.1.0

16 Nov 02:00
589e36a
Compare
Choose a tag to compare

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 for CodeInline component to prevent type errors.

renoun@7.0.0

15 Nov 18:10
b60a3fc
Compare
Choose a tag to compare

Major Changes

  • 90bbe5b: Simplifies how baseDirectory works for Collection. 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 for Collection is now required to be separate from filePattern:

    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 the renoun/collections API, which will be removed in a future major release.

    • New Classes:
      • NodeFileSystem, VirtualFileSystem, Directory, File, JavaScriptFile, and JavaScriptFileExport.
    • Improvements:
      • Optimized performance, stronger TypeScript support, and in-memory support with VirtualFileSystem.

    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.

  • 7cbb112: Updates the <Collection>.getSource method to be asynchronous and return a Promise 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 a Collection and CompositeCollection now returns a Promise that resolves to the source. This means that you will need to await 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 the instrumentation.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

  • 359e5e7: Fixes APIReference component not allowing FileSystemSource.
  • ef4448e: Fixes client and server collections getting out of sync causing an error when resolving types from updated files.
  • 7020585: Updates all dependencies to latest version.
  • Updated dependencies [7020585]
    • @renoun/mdx@1.2.1

@renoun/mdx@1.2.1

15 Nov 18:10
b60a3fc
Compare
Choose a tag to compare

Patch Changes

  • 7020585: Updates all dependencies to latest version.

renoun@6.1.0

24 Oct 19:21
2a39b8d
Compare
Choose a tag to compare

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. The CodeBlock 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