-
Notifications
You must be signed in to change notification settings - Fork 245
/
Copy pathEs5Tokens.ts
137 lines (134 loc) · 6.08 KB
/
Es5Tokens.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { IEs5CheckKeyword, IEs5Keyword } from "./Interfaces";
export const defaultEs5Tokens:IEs5Keyword[] = [
];
export const defaultEs5CheckTokens:IEs5CheckKeyword[] = [
{
funcNames: [ /\bObject\.(is|fromEntries|entries|setPrototypeOf)\(/g ],
errorMsg: "[%funcName%] is not supported in a IE/ES5 environment, use a helper function or add explicit check for existence"
},
{
funcNames: [ /\bObject\.(assign)\(/g ],
errorMsg: "[%funcName%] is not supported in a IE/ES5 environment, use a helper function or add explicit check for existence",
ignoreIds: [
"applicationinsights-react-js", // Don't break build if these exist in the final react extension
"object-assign\\index.js", // object-assign node module contains a pre existence check before usage
"object-assign/index.js" // object-assign node module contains a pre existence check before usage
]
},
{
funcNames: [ /\bObject\.(keys|hasOwn)\(/g ],
errorMsg: "[%funcName%] is not supported in a IE/ES5 environment, use a helper function or add explicit check for existence",
ignoreIds: [
"react.production.min.js", // Don't break build if these exist in the react prod source code
"react.development.js", // Don't break build if these exist in the react dev source code
"applicationinsights-react-js", // Don't break build if these exist in the final react extension
"object-assign\\index.js", // object-assign node module contains a pre existence check before usage
"object-assign/index.js" // object-assign node module contains a pre existence check before usage
]
},
{
funcNames: [ /\bObject\.(getOwnPropertySymbols)\(/g ],
errorMsg: "[%funcName%] is not supported in a IE/ES5 environment, use a helper function or add explicit check for existence",
ignoreIds: [
"tslib.es6", // tslib.es6 library has a pre existence check before usage
"object-assign\\index.js", // object-assign node module contains a pre existence check before usage
"object-assign/index.js" // object-assign node module contains a pre existence check before usage
]
},
{
funcNames: [ /([\w0-9]*)\.(trim|substr|trimEnd|trimStart|includes|padStart|padEnd)[\s]*\(/g ],
errorMsg: "[%funcName%] is not a supported string method in a IE/ES5 environment, use strTrim*(), strSubstr(), strIncludes().",
ignoreFuncMatch: [
"Util.trim", // Make sure this isn't a reference to Util.trim()
"DataSanitizer.trim" // Make sure this isn't a reference to Util.trim()
]
},
{
funcNames: [ /([\w0-9]*)\.(startsWith)[\s]*\(/g ],
errorMsg: "[%funcName%] is not a supported string method in a IE/ES5 environment, use strStartsWith().",
ignoreFuncMatch: [
"this.startsWith",
"_this.startsWith",
"self.startsWith",
"_self.startsWith"
]
},
{
funcNames: [ /([\w0-9]*)\.(endsWith)[\s]*\(/g ],
errorMsg: "[%funcName%] is not a supported string method in a IE/ES5 environment, use strEndsWith().",
ignoreFuncMatch: [
"this.endsWith",
"_this.endsWith",
"self.endsWith",
"_self.endsWith"
]
},
{
funcNames: [ /([\w0-9]*)\.(find|findIndex|findLast|findLastIndex)[\s]*\(/g ],
errorMsg: "[%funcName%] is not supported array method in a IE/ES5 environment, use a helper function or add explicit check for existence.",
ignoreFuncMatch: [
"_this.find",
"this.find",
"_self.find",
"self.find",
"_this.findIndex",
"this.findIndex",
"_self.findIndex",
"self.findIndex",
"_this.findLast",
"this.findLast",
"_self.findLast",
"self.findLast",
"_this.findLastIndex",
"this.findLastIndex",
"_self.findLastIndex",
"self.findLastIndex"
]
},
{
funcNames: [ /[^\w\"\']Date\.(now)\(/g ],
errorMsg: "[%funcName%] is not supported Date method in a IE/ES5 environment, use a helper function or add explicit check for existence"
},
{
funcNames: [ /[^\w\"\']new\s+Promise[\s]*\(/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence",
ignoreIds: [
"ms.localstorage-",
"ms.localstorage.",
"ms.sigs-",
"ms.sigs.",
"promise\\nativePromise.js",
"promise/nativePromise.js"
]
},
{
funcNames: [ /[^\w\"\']Promise\.(all|race|reject|resolve|allSettled|reject)[\s]*\(/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence"
},
{
funcNames: [ /[^\w\"\'](await)\b/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence",
ignoreFuncMatch: [
"/await",
"\\await"
]
},
{
funcNames: [ /[^\w\"\'](async)\s+[\w]+/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence",
ignoreFuncMatch: [
"/async",
"\\async"
]
},
{
funcNames: [ /[^\w\"\']Symbol\s*\(/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence"
},
{
funcNames: [ /[^\w\"\'](Symbol\.\w+)/g ],
errorMsg: "[%funcName%] is not supported in all IE/ES5 environments, use a helper function or add explicit check for existence"
}
];