Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd debug tooling babel plugins. #133
Conversation
rwjblue
force-pushed the
rwjblue:add-stripping
branch
from
94ce290
to
33d656c
Apr 22, 2017
stefanpenner
requested changes
Apr 24, 2017
This looks awesome (but i did leave some nit-picks) |
@@ -95,6 +95,92 @@ treeForAddon(tree) { | |||
} | |||
``` | |||
|
|||
### Debug Tooling | |||
|
|||
In order to allow addons to easily provide good development mode ergonomics (assertions, deprecations, etc) but |
This comment has been minimized.
This comment has been minimized.
// ...snip... | ||
init() { | ||
this._super.init.apply(this, arguments); |
This comment has been minimized.
This comment has been minimized.
stefanpenner
Apr 24, 2017
Member
Is it worth documenting how an addon would do this? This seems quite off the beaten path
rwjblue
force-pushed the
rwjblue:add-stripping
branch
from
33d656c
to
665ef6d
Apr 27, 2017
This comment has been minimized.
This comment has been minimized.
Pushed an update for the two README tweaks that @stefanpenner mentioned... |
rwjblue
force-pushed the
rwjblue:add-stripping
branch
from
665ef6d
to
bf1c6b5
Apr 27, 2017
stefanpenner
requested changes
Apr 27, 2017
|
||
#### Debug Macros | ||
|
||
To add convienient deprecations and assertions, consumers (in either an app or an addon) can do the following: |
This comment has been minimized.
This comment has been minimized.
stefanpenner
Apr 27, 2017
Member
can you add a bulleted list of available macros, or a link to where they are documented?
This comment has been minimized.
This comment has been minimized.
rwjblue
force-pushed the
rwjblue:add-stripping
branch
from
bf1c6b5
to
a4c476d
Apr 27, 2017
stefanpenner
approved these changes
Apr 28, 2017
This comment has been minimized.
This comment has been minimized.
|
rwjblue
merged commit cf36136
into
babel:master
Apr 28, 2017
rwjblue
deleted the
rwjblue:add-stripping
branch
Apr 28, 2017
This comment has been minimized.
This comment has been minimized.
@rwjblue shouldn't this be |
This comment has been minimized.
This comment has been minimized.
Nope |
This comment has been minimized.
This comment has been minimized.
that seems very confusing given that the above helpers are imported from |
This comment has been minimized.
This comment has been minimized.
also what about |
This comment has been minimized.
This comment has been minimized.
I'll add a brief explanation RE: @glimmer/env to the README shortly. RE: runInDebug, it is not forgotten, you would just use if (DEBUG) like in the example below. I can try to explain that better in the README also. |
rwjblue commentedApr 22, 2017
•
edited
Implements ember-cli/rfcs#50 and the
@ember/debug
portion of emberjs/rfcs#176.Below is the documentation being added to the README explaining the feature.
Debug Tooling
In order to allow addons to easily provide good development mode ergonomics (assertions, deprecations, etc) but still perform well in production mode ember-cli-babel automatically manages stripping / removing certain debug statements. This concept was originally proposed in ember-cli/rfcs#50, but has been slightly modified during implementation (after researching what works well and what does not).
Debug Macros
To add convienient deprecations and assertions, consumers (apps and/or addons) can do the following:
In testing and development environments those statements will be executed (and assert or deprecate as appropriate), but
in production builds they will be inert (and stripped during minification).
General Purpose Env Flags
In some cases you may have the need to do things in debug builds that isn't related to asserts/deprecations/etc. For
example, you may expose certain API's for debugging only. You can do that via the
DEBUG
environment flag:In testing and development environments
DEBUG
will be replaced by the boolean literaltrue
, and in production builds it will be replaced byfalse
. When ran through a minifier (with dead code elimination) the entire section will be stripped.Disabling Debug Tooling Support
If for some reason you need to disable this debug tooling, you can opt-out via configuration.
In an app that would look like:
In an addon that would look like: