@embroider/macros 1.21.1 → 1.21.3

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 +25 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @embroider/macros
2
2
 
3
- A standardized solution for modifying your package's Javascript and Glimmer templates at app-compilation-time.
3
+ A standardized solution for modifying your package's JavaScript and Glimmer templates at app-compilation-time.
4
4
 
5
5
  ## Motivation
6
6
 
@@ -222,6 +222,30 @@ if (macroCondition(dependencySatisfies('ember-qunit', '*'))) {
222
222
  {{macroDependencySatisfies 'qunit' '^2.8.0'}}
223
223
  ```
224
224
 
225
+ ### appEmberSatisfies
226
+
227
+ Added in `@embroider/macros` 1.19.0.
228
+
229
+ Tests whether the app's version of `ember-source` satisfies the given semver range. The argument must be a string in the syntax of [semver's satisfies](https://github.com/npm/node-semver#usage) method.
230
+
231
+ The macro always reads `ember-source` from the app, not from the package that contains the call. An addon can use it without a peer dependency on `ember-source`.
232
+
233
+ If the app does not depend on `ember-source`, the result is `false`. Prerelease versions also match, so `6.1.0-beta.1` satisfies `>= 6.0.0`.
234
+
235
+ ```js
236
+ import { macroCondition, appEmberSatisfies } from '@embroider/macros';
237
+
238
+ if (macroCondition(appEmberSatisfies('>= 6.0.0'))) {
239
+ // code for ember-source 6 and later
240
+ } else {
241
+ // code for older versions of ember-source
242
+ }
243
+ ```
244
+
245
+ ```hbs
246
+ {{macroAppEmberSatisfies '>= 6.0.0'}}
247
+ ```
248
+
225
249
  ### getOwnConfig, getConfig, and getGlobalConfig
226
250
 
227
251
  A common pattern is to have a set of configuration properties that you define (or a consumer defines for you) which you base certain build time conditions around. This is achieved via the `getOwnConfig`, `getConfig`, and `getGlobalConfig` macros (depending on which config you want to read).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/macros",
3
- "version": "1.21.1",
3
+ "version": "1.21.3",
4
4
  "private": false,
5
5
  "description": "Standardized build-time macros for ember apps.",
6
6
  "keywords": [
@@ -54,7 +54,7 @@
54
54
  "scenario-tester": "^3.0.1",
55
55
  "typescript": "^5.4.5",
56
56
  "vitest": "^3.2.4",
57
- "@embroider/core": "4.6.7",
57
+ "@embroider/core": "4.6.9",
58
58
  "@embroider/test-support": "0.36.0"
59
59
  },
60
60
  "peerDependencies": {