-
-
Notifications
You must be signed in to change notification settings - Fork 337
/
misc.ts
65 lines (56 loc) · 1.62 KB
/
misc.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
import { getGlobalThis } from '@intlify/shared'
/**
* Vue I18n Version
*
* @remarks
* Semver format. Same format as the package.json `version` field.
*
* @VueI18nGeneral
*/
export const VERSION = __VERSION__
/**
* This is only called in esm-bundler builds.
* istanbul-ignore-next
*/
export function initFeatureFlags(): void {
let needWarn = false
if (typeof __FEATURE_FULL_INSTALL__ !== 'boolean') {
needWarn = true
getGlobalThis().__VUE_I18N_FULL_INSTALL__ = true
}
if (typeof __FEATURE_LEGACY_API__ !== 'boolean') {
needWarn = true
getGlobalThis().__VUE_I18N_LEGACY_API__ = true
}
if (typeof __FEATURE_PROD_VUE_DEVTOOLS__ !== 'boolean') {
needWarn = true
getGlobalThis().__VUE_I18N_PROD_DEVTOOLS__ = false
}
if (typeof __FEATURE_PROD_INTLIFY_DEVTOOLS__ !== 'boolean') {
getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false
}
if (__DEV__ && typeof __FEATURE_ESM_BUNDLER_WARN__ === 'boolean') {
needWarn = __FEATURE_ESM_BUNDLER_WARN__
}
if (__DEV__ && needWarn) {
console.warn(
`You are running the esm-bundler build of vue-i18n. It is recommended to ` +
`configure your bundler to explicitly replace feature flag globals ` +
`with boolean literals to get proper tree-shaking in the final bundle.`
)
}
}
/**
* This is only called development env
* istanbul-ignore-next
*/
export function initDev(): void {
if (__BROWSER__) {
if (!__ESM_BUNDLER__) {
console.info(
`You are running a development build of vue-i18n.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`
)
}
}
}