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

Prevent overwriting plugins #723

Closed

Conversation

asmockler
Copy link

Addresses #713

First started looking for a way to fix this because I was bumping into this issue: developit/microbundle#74

Since plugins was hanging out in the global scope, it was possible for plugins to be overwritten. This PR moves the plugins object inside the Parser class to avoid overwriting between parser instances. I've left the global plugins object as well since it is needed here:

acorn/src/index.js

Lines 73 to 78 in 832c308

export let parse_dammit, LooseParser, pluginsLoose // eslint-disable-line camelcase
export function addLooseExports(parse, Parser, plugins) {
parse_dammit = parse // eslint-disable-line camelcase
LooseParser = Parser
pluginsLoose = plugins
}

@marijnh
Copy link
Member

marijnh commented Aug 31, 2018

I am interested in changing the plugin system to avoid this issue, but I don't think this PR is what we're looking for — it further complicates the way plugins work, without really addressing the underlying issue.

@asmockler
Copy link
Author

Is there a proposal or do you have a preferred way you would like the plugin system to be changed? I don't have a lot of context but would be willing to implement if there is a somewhat straightforward implementation plan.

@marijnh
Copy link
Member

marijnh commented Sep 4, 2018

Unfortunately, there's no plan yet, so the main work would be to design one. I've been kind of distracted from this project but enough stuff has piled that would warrant a breaking new version that I guess I should look into it soon. See also #656. I'll try to make time next week.

@asmockler asmockler closed this Sep 10, 2018
@asmockler asmockler deleted the prevent-plugin-overwriting branch September 10, 2018 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants