Skip to content

Commit

Permalink
remove collection function
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed Oct 13, 2024
1 parent 489960a commit 63b15c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
17 changes: 17 additions & 0 deletions .changeset/fast-impalas-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'renoun': patch
---

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:

```tsx
import { Collection } from 'renoun/collections'

const posts = new Collection({
filePattern: 'posts/*.mdx',
})
```
18 changes: 0 additions & 18 deletions packages/renoun/src/collections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1175,24 +1175,6 @@ export class CompositeCollection<Collections extends CollectionSource<any>[]>
}
}

/**
* Creates a collection of file system sources based on a file pattern.
* Note, a dynamic import getter will automatically be generated for each file extension at the call site of this collection.
*
* @deprecated Use the `Collection` class directly.
* @param options - Settings for the collection, including base directory, base path, TypeScript config file path, and a custom sort function.
* @param getImport - A dynamic import getter function that returns the module exports for a given slug. This is automatically generated based on the `filePattern` extensions.
* @returns A collection object that provides methods to retrieve all sources or an individual source that match the file pattern.
*/
export function collection<
AllExports extends { [key: string]: any } = { [key: string]: any },
>(
options: CollectionOptions<AllExports>,
getImport?: GetImport | GetImport[]
): CollectionSource<AllExports> {
return new Collection<AllExports>(options, getImport)
}

/** Get all sources for a file pattern. */
function getSourceFilesAndDirectories(
project: Project,
Expand Down

0 comments on commit 63b15c8

Please sign in to comment.