swc_ecma_preset_env/corejs2/
data.rs

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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
use crate::util::DataMap;

static ARRAY_NATURE_ITERATORS: &[&str] = &[
    "es6.object.to-string",
    "es6.array.iterator",
    "web.dom.iterable",
];

static COMMON_ITERATORS: &[&str] = &[
    "es6.string.iterator",
    "es6.object.to-string",
    "es6.array.iterator",
    "web.dom.iterable",
];

static PROMISE_DEPENDENCIES: &[&str] = &["es6.object.to-string", "es6.promise"];

pub static BUILTIN_TYPES: DataMap<&[&str]> = data_map!(Map {
    DataView: "es6.typed.data-view",
    Float32Array: "es6.typed.float32-array",
    Float64Array: "es6.typed.float64-array",
    Int8Array: "es6.typed.int8-array",
    Int16Array: "es6.typed.int16-array",
    Int32Array: "es6.typed.int32-array",
    Map: [
        "es6.map",
        "es6.string.iterator",
        "es6.object.to-string",
        "es6.array.iterator",
        "web.dom.iterable",
    ],
    Number: "es6.number.constructor",
    Promise: PROMISE_DEPENDENCIES,
    RegExp: ["es6.regexp.constructor"],
    Set: [
        "es6.set",
        "es6.string.iterator",
        "es6.object.to-string",
        "es6.array.iterator",
        "web.dom.iterable",
    ],
    Symbol: ["es6.symbol", "es7.symbol.async-iterator"],
    Uint8Array: "es6.typed.uint8-array",
    Uint8ClampedArray: "es6.typed.uint8-clamped-array",
    Uint16Array: "es6.typed.uint16-array",
    Uint32Array: "es6.typed.uint32-array",
    WeakMap: [
        "es6.weak-map",
        "es6.string.iterator",
        "es6.object.to-string",
        "es6.array.iterator",
        "web.dom.iterable",
    ],
    WeakSet: [
        "es6.weak-set",
        "es6.string.iterator",
        "es6.object.to-string",
        "es6.array.iterator",
        "web.dom.iterable",
    ],
});

pub static INSTANCE_PROPERTIES: DataMap<&[&str]> = data_map!(Map {
    __defineGetter__: ["es7.object.define-getter"],
    __defineSetter__: ["es7.object.define-setter"],
    __lookupGetter__: ["es7.object.lookup-getter"],
    __lookupSetter__: ["es7.object.lookup-setter"],
    anchor: ["es6.string.anchor"],
    big: ["es6.string.big"],
    bind: ["es6.function.bind"],
    blink: ["es6.string.blink"],
    bold: ["es6.string.bold"],
    codePointAt: ["es6.string.code-point-at"],
    copyWithin: ["es6.array.copy-within"],
    endsWith: ["es6.string.ends-with"],
    entries: ARRAY_NATURE_ITERATORS,
    every: ["es6.array.is-array"],
    fill: ["es6.array.fill"],
    filter: ["es6.array.filter"],
    finally: ["es7.promise.finally", "es6.object.to-string", "es6.promise"],
    find: ["es6.array.find"],
    findIndex: ["es6.array.find-index"],
    fixed: ["es6.string.fixed"],
    flags: ["es6.regexp.flags"],
    flatMap: ["es7.array.flat-map"],
    fontcolor: ["es6.string.fontcolor"],
    fontsize: ["es6.string.fontsize"],
    forEach: ["es6.array.for-each"],
    includes: ["es6.string.includes", "es7.array.includes"],
    indexOf: ["es6.array.index-of"],
    italics: ["es6.string.italics"],
    keys: ARRAY_NATURE_ITERATORS,
    lastIndexOf: ["es6.array.last-index-of"],
    link: ["es6.string.link"],
    map: ["es6.array.map"],
    match: ["es6.regexp.match"],
    name: ["es6.function.name"],
    padStart: ["es7.string.pad-start"],
    padEnd: ["es7.string.pad-end"],
    reduce: ["es6.array.reduce"],
    reduceRight: ["es6.array.reduce-right"],
    repeat: ["es6.string.repeat"],
    replace: ["es6.regexp.replace"],
    search: ["es6.regexp.search"],
    slice: ["es6.array.slice"],
    small: ["es6.string.small"],
    some: ["es6.array.some"],
    sort: ["es6.array.sort"],
    split: ["es6.regexp.split"],
    startsWith: ["es6.string.starts-with"],
    strike: ["es6.string.strike"],
    sub: ["es6.string.sub"],
    sup: ["es6.string.sup"],
    toISOString: ["es6.date.to-iso-string"],
    toJSON: ["es6.date.to-json"],
    toString: [
        "es6.object.to-string",
        "es6.date.to-string",
        "es6.regexp.to-string",
    ],
    trim: ["es6.string.trim"],
    trimEnd: ["es7.string.trim-right"],
    trimLeft: ["es7.string.trim-left"],
    trimRight: ["es7.string.trim-right"],
    trimStart: ["es7.string.trim-left"],
    values: ARRAY_NATURE_ITERATORS,
});

pub static STATIC_PROPERTIES: DataMap<DataMap<&[&str]>> = data_map!(Map {
    Array: Map {
        from: ["es6.array.from", "es6.string.iterator"],
        isArray: "es6.array.is-array",
        of: "es6.array.of",
    },

    Date: Map {
        now: "es6.date.now",
    },

    Object: Map {
        assign: "es6.object.assign",
        create: "es6.object.create",
        defineProperty: "es6.object.define-property",
        defineProperties: "es6.object.define-properties",
        entries: "es7.object.entries",
        freeze: "es6.object.freeze",
        getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
        getOwnPropertySymbols: "es6.symbol",
        is: "es6.object.is",
        isExtensible: "es6.object.is-extensible",
        isFrozen: "es6.object.is-frozen",
        isSealed: "es6.object.is-sealed",
        keys: "es6.object.keys",
        preventExtensions: "es6.object.prevent-extensions",
        seal: "es6.object.seal",
        setPrototypeOf: "es6.object.set-prototype-of",
        values: "es7.object.values",
    },

    Math: Map {
        acosh: "es6.math.acosh",
        asinh: "es6.math.asinh",
        atanh: "es6.math.atanh",
        cbrt: "es6.math.cbrt",
        clz32: "es6.math.clz32",
        cosh: "es6.math.cosh",
        expm1: "es6.math.expm1",
        fround: "es6.math.fround",
        hypot: "es6.math.hypot",
        imul: "es6.math.imul",
        log1p: "es6.math.log1p",
        log10: "es6.math.log10",
        log2: "es6.math.log2",
        sign: "es6.math.sign",
        sinh: "es6.math.sinh",
        tanh: "es6.math.tanh",
        trunc: "es6.math.trunc",
    },

    String: Map {
        fromCodePoint: "es6.string.from-code-point",
        raw: "es6.string.raw",
    },

    Number: Map {
        EPSILON: "es6.number.epsilon",
        MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
        MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
        isFinite: "es6.number.is-finite",
        isInteger: "es6.number.is-integer",
        isSafeInteger: "es6.number.is-safe-integer",
        isNaN: "es6.number.is-nan",
        parseFloat: "es6.number.parse-float",
        parseInt: "es6.number.parse-int",
    },

    Promise: Map {
        all: COMMON_ITERATORS,
        race: COMMON_ITERATORS,
    },

    Reflect: Map {
        apply: "es6.reflect.apply",
        construct: "es6.reflect.construct",
        defineProperty: "es6.reflect.define-property",
        deleteProperty: "es6.reflect.delete-property",
        get: "es6.reflect.get",
        getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor",
        getPrototypeOf: "es6.reflect.get-prototype-of",
        has: "es6.reflect.has",
        isExtensible: "es6.reflect.is-extensible",
        ownKeys: "es6.reflect.own-keys",
        preventExtensions: "es6.reflect.prevent-extensions",
        set: "es6.reflect.set",
        setPrototypeOf: "es6.reflect.set-prototype-of",
    },
});