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

fix(gatsby): Validate sub plugins options #37804

Merged
merged 3 commits into from
Mar 30, 2023
Merged

fix(gatsby): Validate sub plugins options #37804

merged 3 commits into from
Mar 30, 2023

Conversation

Talaxy009
Copy link
Contributor

Description

The gatsby-plugin-mdx uses gatsbyRemarkPlugins as its sub plugin key, but gatsby only checks for the plugins key, which causes issue #37792 .

Related Issues

Fixes #37792

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 29, 2023
@pieh pieh added topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) topic: remark/mdx Related to Markdown, remark & MDX ecosystem and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 30, 2023
@pieh
Copy link
Contributor

pieh commented Mar 30, 2023

Hey @Talaxy009 - I massaged your PR a bit not to hardcode gatsbyRemarkPlugins in gatsby core (plugins being hardcoded is for legacy reasons). It still achieves desired outcome you mentioned in the issue:

test
plugin init
plugin run
{ plugins: [], ping: 'Hello', test: 'Can you see me?' }

@Talaxy009
Copy link
Contributor Author

@pieh Got it, thanks for optimizing♥️

@LekoArts LekoArts changed the title fix(gatsby): validate sub plugins options of gatsby-plugin-mdx fix(gatsby): Validate sub plugins options Mar 30, 2023
@pieh pieh merged commit f013bc3 into gatsbyjs:master Mar 30, 2023
@pieh
Copy link
Contributor

pieh commented Mar 30, 2023

This is now available in gatsby@5.9.0-next.2 (waiting a bit before backporting it to latest)

TylerBarnes pushed a commit that referenced this pull request Mar 30, 2023
* fix(gatsby): validate sub plugins options of gatsby-plugin-mdx

* revert hardcoded path to subplugins

* validate subplugins if they are not under 'options.plugins' field

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
pieh added a commit that referenced this pull request Apr 18, 2023
* add touch nodes optout action

* cleanup

* start adding backreference cache

* revert formatting

* remove unused variable

* remove unused var

* switch from opting out types from stale nodes to opting out entire plugin

* add no nodes warning

* fix bug where double bound actions are ignored when there are no args

* update progress mock

* get owner from plugin

* rename type

* rename types

* use redux types instead of pulling from lmdb

* remove unused line

* Update source-nodes.ts

* use CREATE_NODE action instead of adding a new type owner action

* add typeowners test

* test touchNodes and enableStatefulSourceNodes()

* fix contentful tests

* snapshot updates

* chore(changelogs): update changelogs (#37808)

* fix(deps): update starters and examples - gatsby to ^5.8.1 (#37806)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(gatsby): Validate sub plugins options (#37804)

* fix(gatsby): validate sub plugins options of gatsby-plugin-mdx

* revert hardcoded path to subplugins

* validate subplugins if they are not under 'options.plugins' field

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>

* fix(create-gatsby): Use correct name in summary message (#37809)

* actual fix

* other misc changes

* chore(release): Publish next

 - create-gatsby@3.9.0-next.1
 - gatsby-cli@5.9.0-next.1
 - gatsby-plugin-sharp@5.9.0-next.1
 - gatsby-transformer-sqip@5.9.0-next.1
 - gatsby@5.9.0-next.2

* remove testing timeout

* minimal docs

* reword

* add comment

* reportOnce instead of throwing an error

* consolidate typeOwners

* use new typesToPlugins Map keys instead of pluginsToTypes Map values

* consolidate remaining typeOwners object checks into new typeOwners reducer

* fix missing owner error

* fix type errors and incorrect plugin object reference

* maybe fix unit tests

* make SitePage nodes owned by internal-data-bridge

* add missing fields on some TOUCH_NODE actions

* skip owner checks when deleting child nodes

* sp

* Update yarn.lock

* reduce memory usage by storing minimal backreference info and not blocking the event loop

* remove coment

* remove extra logs

* add helper to explain what the setImmediate promise is for

* remove unneeded entryNode condition

* refactor createAssetNodes to use async/await

* add cached node counts by assets vs content

* refactor to fix linting failure

* fix tests

* ensure mutated existing node data is applied during updates

* restore previous logging behaviour

* fix test state

* always reset memory node count when existingNodes is empty

* revert more logging

* update test to use new createAssetNodes changes

* store count instead of huge set of id's to use less memory

* remove debugger

* make sure sys.type exists before checking

* move enableStatefulSourceNodes call to main sourceNodes fn

* use util

* fix e2e test - ContentfulTag node doesn't have sys.type

* always exclude ContentfulTag nodes from memory Map cache

* fix linting (consistent return)

---------

Co-authored-by: GatsbyJS Bot <core-team@gatsbyjs.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Taozc <41264828+Talaxy009@users.noreply.github.com>
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) topic: remark/mdx Related to Markdown, remark & MDX ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use pluginOptionsSchema when using remark plugins in gatsby-plugin-mdx
3 participants