Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(front-matter): remove createExtractor() #5266

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Jul 3, 2024

What's changed

@std/front-matter/create-extractor has been made private. It is still used in the underlying package implementation.

Motivation

This module was removed because it exposed implementation details of @std/front-matter's extract() functions and wasn't used (correctly) according to GitHub search. Making this code private allows us to more easily make improvements in the backend without breaking user code.

Migration guide

The previously mentioned GitHub search showed there are some codebases which are mistakenly using createExtractor(), which is the primary function for @std/front-matter/create-extractor. Ensure you're using one of the extractor() methods, instead of manually creating an extractor().

- import { createExtractor } from "@std/front-matter";
- import { parse as parseYAML } from "@std/yaml";
+ import { extract } from "@std/front-matter/yaml";

- const extract = createExtractor({ yaml: parseYAML as Parser });

  // ...

  const yamlObject = extract(yamlString);

Related

Closes #5265
Towards #5016

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 86.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 95.70%. Comparing base (735609e) to head (288ae1b).

Files Patch % Lines
front_matter/_create_extractor.ts 84.78% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5266      +/-   ##
==========================================
- Coverage   95.70%   95.70%   -0.01%     
==========================================
  Files         459      459              
  Lines       38025    38017       -8     
  Branches     5563     5563              
==========================================
- Hits        36393    36385       -8     
  Misses       1591     1591              
  Partials       41       41              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iuioiua iuioiua marked this pull request as ready for review July 3, 2024 05:53
@iuioiua iuioiua requested a review from kt3k as a code owner July 3, 2024 05:53
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: createExtractor was for supporting arbitrary combination for front-matter language, but we couldn't find any correct usage in github open source search.

LGTM

@iuioiua iuioiua merged commit ebf8eee into main Jul 3, 2024
15 checks passed
@iuioiua iuioiua deleted the front-matter-remove-createExtractor branch July 3, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

suggestion: make createExtractor module private in @std/front-matter
2 participants