Skip to content

Releases: souporserious/renoun

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

@renoun/mdx@1.2.0

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

Minor Changes

  • 72a2e98: Fixes specifying a language for inline MDX code.

renoun@6.0.0

14 Oct 09:29
11cb7ce
Compare
Choose a tag to compare

Major Changes

  • 0e6279a: Removes the deprecated collection function.

    Breaking Changes

    The collection function has been removed. You can now use the Collection class directly to create a collection:

    import { Collection } from 'renoun/collections'
    
    const posts = new Collection({
      filePattern: 'posts/*.mdx',
    })

Minor Changes

  • ebdfb16: Adds getFileSystemPath method to FileSystemSource and ExportSource to allow getting types for a file in APIReference.

  • 489960a: Adds the ability to specify the set of languages loaded for syntax highlighting using the languages field in the renoun.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 using prettier 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

12 Oct 22:56
617e9d6
Compare
Choose a tag to compare

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.

Patch Changes

  • c8760f7: Runs initial script to write collections in parallel when starting the dev server. This needed to run synchronously in a previous implementation.
  • d6c374b: Handles CLI sub-process clean up better if an error in the WebSocket server occurs.