Skip to content

Commit

Permalink
Use @embroider/macros to chose the correct get/set Owner api
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jun 6, 2024
1 parent 1b552a2 commit 9d1a025
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 98 deletions.
14 changes: 13 additions & 1 deletion addon/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ import EmberObject from '@ember/object';
import { dasherize, classify, underscore } from './string';
import { DEBUG } from '@glimmer/env';
import classFactory from './utils/class-factory';
import { getOwner } from '@ember/owner';
import {
macroCondition,
dependencySatisfies,
importSync,
} from '@embroider/macros';

let getOwner;

if (macroCondition(dependencySatisfies('ember-source', '>= 4.11'))) {
getOwner = importSync('@ember/owner').getOwner;
} else {
getOwner = importSync('@ember/application').getOwner;
}

import { TEMPLATES } from './template-cache';

Expand Down
2 changes: 1 addition & 1 deletion addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
},
"scripts": {},
"dependencies": {
"@embroider/macros": "^1.16.2",
"ember-cli-babel": "^7.26.11"
},
"devDependencies": {},
"peerDependencies": {
"ember-source": "^4.8.3 || >= 5.0.0"
},
Expand Down
Loading

0 comments on commit 9d1a025

Please sign in to comment.