Skip to content

Refactor raven-js to use CommonJS modules, class instances [WIP] #421

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

Merged
merged 17 commits into from
Dec 28, 2015

Conversation

benvinegar
Copy link
Contributor

Changes:

  • Raven is now a class; can be initialized as new Raven() (only via CommonJS)
  • No more global mangling / via header/footer.js
  • Tests mock functions directly on Raven prototype (via global shenanigans)
  • Can now import Raven via CommonJS directly from src
  • raven-js distributables:
    • still have Raven singleton (API hasn't changed)
    • are built using Browserify
    • auto-add/initialize plugins (as before)
  • Moved util-like functions (e.g. isError) into src/utils.js
  • Separated test files for utils, TraceKit
  • Plugins loaded via CommonJS don't auto-initialize / add themselves to ecosystem
  • File-size changes: TBA (definitely bigger)

Still WIP:

  • How plugins fit into this new system

Thoughts:

This is a huge set of changes. It makes Raven more "OO" – which I'm sure will spur some debate. But the result is that there is no longer bunch of global variables whose state is mysteriously mutated between raven.js / raven.test.js, and tests (IMHO) are much easier to follow.

}

module.exports = {
isUndefined: isUndefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol tabs

@benvinegar
Copy link
Contributor Author

Hmm, so now that I see StackTrace is a singleton ... and it maintains state (e.g. TraceKit.remoteFetching and TraceKit.linesOfContext), that means that two distinct Raven instances will just fight over TraceKit state ...

So, beginning to wonder if this is a good idea or not (class instances).

@benvinegar benvinegar merged commit dc1dfef into master Dec 28, 2015
@mattrobenolt mattrobenolt deleted the modules branch January 4, 2016 17:29
kamilogorek pushed a commit that referenced this pull request Jun 12, 2018
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