@embroider/macros 0.47.2 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +22 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -186,6 +186,28 @@ if (macroCondition(getOwnConfig().shouldIncludeMinifiedLibrary)) {
186
186
  <button class="{{macroGetOwnConfig "themeColor"}}">My Themed Button</button>
187
187
  ```
188
188
 
189
+ ### isTesting, isDevelopingApp
190
+
191
+ These methods can be used in conjunction with `macroCondition` to tree-shake code for specific environments.
192
+
193
+ ```js
194
+ import { isTesting, isDevelopingApp, macroCondition } from '@embroider/macros';
195
+
196
+ if (macroCondition(isTesting()) {
197
+ // some test code - stripped out when not running tests
198
+ } else {
199
+ // some none-test code
200
+ }
201
+
202
+ if (macroCondition(isDevelopingApp()) {
203
+ // some code when app is in development environment - stripped out in production builds
204
+ } else {
205
+ // some production code
206
+ }
207
+ ```
208
+
209
+ Note that these can be used in combination - e.g. if you run tests in the production environment, `isTesting()` will be true, but `isDevelopingApp()` will be false.
210
+
189
211
  ## Real world examples
190
212
 
191
213
  Below are a list of addons that have started using `@embroider/macros` so that you can get a feel for common use cases that can be solved via the macro system.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/macros",
3
- "version": "0.47.2",
3
+ "version": "0.50.0",
4
4
  "private": false,
5
5
  "description": "Standardized build-time macros for ember apps.",
6
6
  "keywords": [
@@ -24,7 +24,7 @@
24
24
  "test": "jest"
25
25
  },
26
26
  "dependencies": {
27
- "@embroider/shared-internals": "0.47.2",
27
+ "@embroider/shared-internals": "0.50.0",
28
28
  "assert-never": "^1.2.1",
29
29
  "ember-cli-babel": "^7.26.6",
30
30
  "find-up": "^5.0.0",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.14.5",
37
37
  "@babel/traverse": "^7.14.5",
38
- "@embroider/core": "0.47.2",
38
+ "@embroider/core": "0.50.0",
39
39
  "@embroider/test-support": "0.36.0",
40
40
  "@types/babel__core": "^7.1.14",
41
41
  "@types/babel__generator": "^7.6.2",