-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathindex.ts
85 lines (71 loc) · 2.62 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { ENV } from '@ember/-internals/environment';
import { assign } from '@ember/polyfills';
/**
Set `EmberENV.FEATURES` in your application's `config/environment.js` file
to enable canary features in your application.
See the [feature flag guide](https://guides.emberjs.com/release/configuring-ember/feature-flags/)
for more details.
@module @ember/canary-features
@public
*/
export const DEFAULT_FEATURES = {
EMBER_LIBRARIES_ISREGISTERED: false,
EMBER_IMPROVED_INSTRUMENTATION: false,
EMBER_NAMED_BLOCKS: false,
EMBER_MODULE_UNIFICATION: false,
EMBER_CUSTOM_COMPONENT_ARG_PROXY: true,
EMBER_GLIMMER_SET_COMPONENT_TEMPLATE: true,
EMBER_ROUTING_MODEL_ARG: true,
EMBER_GLIMMER_IN_ELEMENT: true,
EMBER_CACHE_API: false,
};
/**
The hash of enabled Canary features. Add to this, any canary features
before creating your application.
@class FEATURES
@static
@since 1.1.0
@public
*/
export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
/**
Determine whether the specified `feature` is enabled. Used by Ember's
build tools to exclude experimental features from beta/stable builds.
You can define the following configuration options:
* `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly
enabled/disabled.
@method isEnabled
@param {String} feature The feature to check
@return {Boolean}
@since 1.1.0
@public
*/
export function isEnabled(feature: string): boolean {
let featureValue = FEATURES[feature];
if (featureValue === true || featureValue === false) {
return featureValue;
} else if (ENV.ENABLE_OPTIONAL_FEATURES) {
return true;
} else {
return false;
}
}
function featureValue(value: null | boolean) {
if (ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
return true;
}
return value;
}
export const EMBER_LIBRARIES_ISREGISTERED = featureValue(FEATURES.EMBER_LIBRARIES_ISREGISTERED);
export const EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
export const EMBER_NAMED_BLOCKS = featureValue(FEATURES.EMBER_NAMED_BLOCKS);
export const EMBER_MODULE_UNIFICATION = featureValue(FEATURES.EMBER_MODULE_UNIFICATION);
export const EMBER_CUSTOM_COMPONENT_ARG_PROXY = featureValue(
FEATURES.EMBER_CUSTOM_COMPONENT_ARG_PROXY
);
export const EMBER_GLIMMER_SET_COMPONENT_TEMPLATE = featureValue(
FEATURES.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE
);
export const EMBER_ROUTING_MODEL_ARG = featureValue(FEATURES.EMBER_ROUTING_MODEL_ARG);
export const EMBER_GLIMMER_IN_ELEMENT = featureValue(FEATURES.EMBER_GLIMMER_IN_ELEMENT);
export const EMBER_CACHE_API = featureValue(FEATURES.EMBER_CACHE_API);