Skip to content

Commit 2c5ff7c

Browse files
author
Robert Jackson
committed
Fixup README...
1 parent 5d80595 commit 2c5ff7c

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,43 @@ This provides debug macros and feature flagging.
44

55
## Setup
66

7-
The plugin takes 5 types options: `envFlags`, `features`, `debugTools`, `externalizeHelpers` and `svelte`. The `importSpecifier` is used as a hint to this plugin as to where macros are being imported and completely configurable by the host. Like Babel you can supply your own helpers using the `externalizeHelpers` options.
7+
The plugin takes 4 types options: `flags`, `svelte`, `debugTools`, and
8+
`externalizeHelpers`. The `importSpecifier` is used as a hint to this plugin as
9+
to where macros are being imported and completely configurable by the host.
10+
11+
Like Babel you can supply your own helpers using the `externalizeHelpers`
12+
options.
813

914
```js
1015
{
1116
plugins: [
1217
['babel-debug-macros', {
13-
// @required
14-
envFlags: {
15-
source: '@ember/env-flags',
16-
flags: { DEBUG: true }
17-
},
1818
// @required
1919
debugTools: {
20+
isDebug: true,
2021
source: 'debug-tools',
2122
// @optional
2223
assertPredicateIndex: 0
2324
},
24-
// @optional
25-
features: {
26-
name: 'ember-source',
27-
source: '@ember/features',
28-
flags: { FEATURE_A: false, FEATURE_B: true, DEPRECATED_CONTROLLERS: "2.12.0" }
29-
},
25+
26+
flags: [
27+
{ source: '@ember/env-flags', flags: { DEBUG: true } },
28+
{
29+
name: 'ember-source',
30+
source: '@ember/features',
31+
flags: {
32+
FEATURE_A: false,
33+
FEATURE_B: true,
34+
DEPRECATED_CONTROLLERS: "2.12.0"
35+
}
36+
}
37+
],
38+
3039
// @optional
3140
svelte: {
3241
'ember-source': "2.15.0"
3342
},
43+
3444
// @optional
3545
externalizeHelpers: {
3646
module: true,
@@ -66,12 +76,12 @@ woot();
6676
Transforms to:
6777

6878
```javascript
69-
if (true) {
79+
if (true /* DEBUG */) {
7080
console.log('Hello from debug');
7181
}
7282

7383
let woot;
74-
if (false) {
84+
if (false /* FEATURE_A */) {
7585
woot = () => 'woot';
7686
} else if (true) {
7787
woot = () => 'toow';
@@ -141,7 +151,9 @@ let foo = 2;
141151

142152
## Externalized Helpers
143153

144-
When you externalize helpers you must provide runtime implementations for the above macros. An expansion will still occur, however we will emit references to those runtime helpers.
154+
When you externalize helpers you must provide runtime implementations for the
155+
above macros. An expansion will still occur, however we will emit references to
156+
those runtime helpers.
145157

146158
A global expansion looks like the following:
147159

@@ -173,26 +185,28 @@ Expands into:
173185

174186
# Svelte
175187

176-
Svelte allows for consumers to opt into stripping deprecated code from your dependecies. By adding a package name and minimum version that contains no deprecations, that code will be compiled away.
188+
Svelte allows for consumers to opt into stripping deprecated code from your
189+
dependecies. By adding a package name and minimum version that contains no
190+
deprecations, that code will be compiled away.
177191

178-
For example, consider you are on `[email protected]` and you have no deprecations. All deprecated code in `ember-source` that is `<=2.10.0` will be removed.
192+
For example, consider you are on `[email protected]` and you have no
193+
deprecations. All deprecated code in `ember-source` that is `<=2.10.0` will be
194+
removed.
179195

180196
```
181-
...
197+
182198
svelte: {
183199
"ember-source": "2.10.0"
184200
}
185-
...
201+
186202
```
187203

188-
Now if you bump to `[email protected]` you may encounter new deprecations. The workflow would then be to clear out all deprecations and then bump the version in the `svelte` options.
204+
Now if you bump to `[email protected]` you may encounter new deprecations.
205+
The workflow would then be to clear out all deprecations and then bump the
206+
version in the `svelte` options.
189207

190208
```
191209
svelte: {
192210
"ember-source": "2.11.0"
193211
}
194212
```
195-
196-
# Hygenic
197-
198-
As you may notice that we inject `DEBUG` into the code when we expand the macro. We guarantee that the binding is unique when injected and follow the local binding name if it is imported directly.

0 commit comments

Comments
 (0)