File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed
addon/instance-initializers Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export function initialize(appInstance) {
46
46
47
47
const {
48
48
turnAuditOff : configuredTurnAuditOff ,
49
- excludeAxeCore,
49
+ excludeAxeCore = false ,
50
50
axeOptions = { } ,
51
51
axeCallback,
52
52
visualNoiseLevel : configuredVisualNoiseLevel ,
@@ -59,7 +59,10 @@ export function initialize(appInstance) {
59
59
60
60
// Avoid modifying the Component class if the visual audit feature is configured disabled
61
61
// and axe-core is excluded from the dev build
62
- if ( turnAuditOff && excludeAxeCore ) { return ; }
62
+ if ( ( turnAuditOff && excludeAxeCore ) || typeof axe === 'undefined' ) {
63
+ hasRan = true ;
64
+ return ;
65
+ }
63
66
64
67
Component . reopen ( {
65
68
/**
Original file line number Diff line number Diff line change @@ -59,11 +59,34 @@ module.exports = {
59
59
treeForApp : function ( tree ) {
60
60
var checker = new VersionChecker ( this ) ;
61
61
var isProductionBuild = process . env . EMBER_ENV === 'production' ;
62
- var isOldEmber = checker . for ( 'ember' , 'bower' ) . lt ( '1.13.0' ) ;
62
+ var isOldEmber = checker . forEmber ( ) . lt ( '1.13.0' ) ;
63
63
64
64
if ( isProductionBuild || isOldEmber ) {
65
65
tree = new Funnel ( tree , {
66
- exclude : [ / i n s t a n c e - i n i t i a l i z e r s \/ a x e - c o m p o n e n t | v i o l a t i o n s - h e l p e r .j s / ]
66
+ exclude : [ / i n s t a n c e - i n i t i a l i z e r s \/ ( a x e - c o m p o n e n t | v i o l a t i o n s - h e l p e r ) \. j s / ]
67
+ } ) ;
68
+ }
69
+
70
+ return tree ;
71
+ } ,
72
+
73
+ /**
74
+ * Exclude all addon code during build if this is a
75
+ * production build or if the version of Ember being used is less than 1.13.
76
+ * @override
77
+ */
78
+ treeForAddon : function ( ) {
79
+ var tree = this . _super . treeForAddon . apply ( this , arguments ) ;
80
+ var checker = new VersionChecker ( this ) ;
81
+ var isProductionBuild = process . env . EMBER_ENV === 'production' ;
82
+ var isOldEmber = checker . forEmber ( ) . lt ( '1.13.0' ) ;
83
+
84
+ if ( isProductionBuild || isOldEmber ) {
85
+ tree = new Funnel ( tree , {
86
+ exclude : [
87
+ / i n s t a n c e - i n i t i a l i z e r s \/ ( a x e - c o m p o n e n t | v i o l a t i o n s - h e l p e r ) \. j s / ,
88
+ / u t i l s \/ ( c o n c u r r e n t - a x e | f o r m a t - v i o l a t i o n | i s - b a c k g r o u n d - r e p l a c e d - e l e m e n t | v i o l a t i o n s - h e l p e r ) \. j s /
89
+ ]
67
90
} ) ;
68
91
}
69
92
You can’t perform that action at this time.
0 commit comments