plugins icon indicating copy to clipboard operation
plugins copied to clipboard

feat(json): Add `extensions` option to load JSON files with custom extensions.

Open altinokdarici opened this issue 8 months ago • 3 comments

Rollup Plugin Name: json

This PR contains:

  • [ ] bugfix
  • [x] feature
  • [ ] refactor
  • [ ] documentation
  • [ ] other

Are tests included?

  • [x] yes (bugfixes and features will not be merged without tests)
  • [ ] no

Breaking Changes?

  • [ ] yes (breaking changes will not be merged unless absolutely necessary)
  • [x] no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Description

This PR adds support for custom file extensions in the JSON plugin, allowing handling beyond the default .json files. Previously, the plugin only handled .json files, limiting use with custom formats (such as .resjson)

Changes

  • packages/json/README.md: Added documentation for the new extensions option that allows specifying a list of file extensions to be handled by the plugin.
  • packages/json/src/index.js: Introduced the extensions option in the JSON plugin's configuration, allowing users to specify which file extensions should be processed.
  • packages/json/test/fixtures/custom-file-extension/config.customjson: Added a test fixture with a custom file extension to verify the new feature.
  • packages/json/test/fixtures/custom-file-extension/main.js: Added a test case to import and validate the custom file extension handling.
  • packages/json/test/test.js: Added new test cases to ensure the plugin correctly processes files with custom extensions and ignores non-custom extensions.

altinokdarici avatar Mar 24 '25 21:03 altinokdarici

Small nits on the docs for this feature. Once those are tackled we can merge. Thank you for the PR.

@shellscape I’ve gone ahead and addressed your comments. Let me know if there’s anything else I missed.

altinokdarici avatar Jun 17 '25 18:06 altinokdarici

Hey @shellscape, I've addressed your comments. Can you review this PR again when you have time?

altinokdarici avatar Aug 31 '25 04:08 altinokdarici

@altinokdarici looks like there's a prettier issue. please run lint and tag me again when you update

shellscape avatar Oct 05 '25 22:10 shellscape