babel-plugin-polyfill-es-shims 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.mjs +28 -51
- package/esm/index.mjs.map +1 -1
- package/lib/index.js +5 -26
- package/lib/mappings.js +19 -34
- package/package.json +5 -5
package/esm/index.mjs
CHANGED
|
@@ -11,7 +11,6 @@ const has = Function.call.bind(Object.hasOwnProperty);
|
|
|
11
11
|
const Globals = {};
|
|
12
12
|
const StaticProperties = {};
|
|
13
13
|
const InstanceProperties = {};
|
|
14
|
-
|
|
15
14
|
const lessThanArgs = num => (meta, path) => {
|
|
16
15
|
const {
|
|
17
16
|
node,
|
|
@@ -23,41 +22,34 @@ const lessThanArgs = num => (meta, path) => {
|
|
|
23
22
|
if (parent.arguments.length >= num) return false;
|
|
24
23
|
return parent.arguments.every(arg => !t.isSpreadElement(arg));
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
for (const [name, causeArgNum] of [["Error", 2], ["AggregateError", 3], ["EvalError", 2], ["RangeError", 2], ["ReferenceError", 2], ["SyntaxError", 2], ["TypeError", 2], ["URIError", 2]]) {
|
|
28
26
|
defineGlobal(name, "1.0.1", "error-cause", {
|
|
29
27
|
exclude: lessThanArgs(causeArgNum),
|
|
30
28
|
subfolder: name,
|
|
31
29
|
polyfillName: "Error cause"
|
|
32
30
|
});
|
|
33
|
-
}
|
|
31
|
+
}
|
|
32
|
+
// This needs to come after the AggregateError cause polyfill, since this
|
|
34
33
|
// one polyfills less features.
|
|
35
|
-
|
|
36
|
-
|
|
37
34
|
defineGlobal("AggregateError", "1.0.2", "es-aggregate-error");
|
|
38
|
-
const DATE_VERSION = "2.0.0";
|
|
39
|
-
|
|
35
|
+
const DATE_VERSION = "2.0.0";
|
|
36
|
+
// MISSING DATA: defineGlobal("Date", DATE_VERSION, "date", { subfolder: "Date" });
|
|
40
37
|
defineGlobal("globalThis", "1.0.0");
|
|
41
38
|
defineGlobal("parseInt", "2.0.0");
|
|
42
39
|
defineGlobal("Map", "1.0.4", "es-map");
|
|
43
40
|
defineGlobal("Set", "1.1.0", "es-set");
|
|
44
|
-
|
|
45
41
|
const arrayCheck = thisObj => expr`Array.isArray(${thisObj})`;
|
|
46
|
-
|
|
47
42
|
const typeofCheck = type => thisObj => expr`typeof ${thisObj} === "${type}"`;
|
|
48
|
-
|
|
49
43
|
const instanceofCheck = Class => thisObj => expr`${thisObj} instanceof ${t.identifier(Class)}`;
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const stringCheck = typeofCheck("string");
|
|
45
|
+
// const setCheck = instanceofCheck("Set");
|
|
52
46
|
|
|
53
47
|
const getter = {
|
|
54
48
|
getter: true
|
|
55
49
|
};
|
|
56
|
-
|
|
57
50
|
const excludeStatic = obj => ({
|
|
58
51
|
exclude: meta => meta.kind === "property" && meta.placement === "static" && meta.object === obj
|
|
59
52
|
});
|
|
60
|
-
|
|
61
53
|
const excludeObject = excludeStatic("Object");
|
|
62
54
|
defineStatic("Array", "from", "1.1.0");
|
|
63
55
|
defineStatic("Array", "of", "1.0.0");
|
|
@@ -76,14 +68,14 @@ defineInstance("Array", "flatMap", "1.2.3", arrayCheck);
|
|
|
76
68
|
defineInstance("Array", "includes", "3.1.1", arrayCheck, {
|
|
77
69
|
pkg: "array-includes"
|
|
78
70
|
});
|
|
79
|
-
defineInstance("Array", "indexOf", "1.0.1", arrayCheck);
|
|
80
|
-
|
|
71
|
+
defineInstance("Array", "indexOf", "1.0.1", arrayCheck);
|
|
72
|
+
// MISSING DATA: defineInstance("Array", "join", "1.0.0", arrayCheck);
|
|
81
73
|
defineInstance("Array", "keys", "1.0.0", arrayCheck, excludeObject);
|
|
82
74
|
defineInstance("Array", "lastIndexOf", "1.0.0", arrayCheck);
|
|
83
75
|
defineInstance("Array", "map", "1.0.2", arrayCheck);
|
|
84
76
|
defineInstance("Array", "reduce", "1.0.1", arrayCheck);
|
|
85
|
-
defineInstance("Array", "reduceRight", "1.0.1", arrayCheck);
|
|
86
|
-
|
|
77
|
+
defineInstance("Array", "reduceRight", "1.0.1", arrayCheck);
|
|
78
|
+
// MISSING DATA: defineInstance("Array", "slice", "1.0.0", arrayCheck);
|
|
87
79
|
defineInstance("Array", "some", "1.1.1", arrayCheck);
|
|
88
80
|
defineInstance("Array", "splice", "1.0.1", arrayCheck);
|
|
89
81
|
defineInstance("Array", "toReversed", "1.0.1", arrayCheck);
|
|
@@ -92,16 +84,16 @@ defineInstance("Array", "toSpliced", "1.0.0", arrayCheck);
|
|
|
92
84
|
defineInstance("Array", "unshift", "1.0.0", arrayCheck);
|
|
93
85
|
defineInstance("Array", "values", "1.0.0", arrayCheck, excludeObject);
|
|
94
86
|
defineInstance("Array", "with", "1.0.1", arrayCheck);
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
for (const name of ["now"
|
|
88
|
+
// MISSING DATA: "parse"
|
|
97
89
|
]) {
|
|
98
90
|
defineStatic("Date", name, DATE_VERSION, {
|
|
99
91
|
pkg: "date",
|
|
100
92
|
subfolder: `Date.${name}`
|
|
101
93
|
});
|
|
102
94
|
}
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
for (const name of [
|
|
96
|
+
// MISSING DATA: "getFullYear",
|
|
105
97
|
// MISSING DATA: "getMonth",
|
|
106
98
|
// MISSING DATA: "getDate",
|
|
107
99
|
// MISSING DATA: "getUTCDate",
|
|
@@ -116,7 +108,6 @@ for (const name of [// MISSING DATA: "getFullYear",
|
|
|
116
108
|
subfolder: `Date.prototype.${name}`
|
|
117
109
|
});
|
|
118
110
|
}
|
|
119
|
-
|
|
120
111
|
defineInstance("Function", "name", "1.1.2", typeofCheck("function"), getter);
|
|
121
112
|
defineStatic("Math", "acosh", "1.0.0");
|
|
122
113
|
defineStatic("Math", "atanh", "1.0.0");
|
|
@@ -151,7 +142,9 @@ defineInstance("Promise", "finally", "1.2.1", instanceofCheck("Promise"));
|
|
|
151
142
|
defineStatic("Reflect", "apply", "1.0.0");
|
|
152
143
|
defineStatic("Reflect", "ownKeys", "1.0.1");
|
|
153
144
|
defineStatic("Reflect", "getPrototypeOf", "1.0.0");
|
|
154
|
-
defineInstance("RegExp", "flags", "1.3.0", instanceofCheck("RegExp"), getter);
|
|
145
|
+
defineInstance("RegExp", "flags", "1.3.0", instanceofCheck("RegExp"), getter);
|
|
146
|
+
|
|
147
|
+
// TODO: Uncomment when Stage 4
|
|
155
148
|
// defineInstance("Set", "difference", "1.0.2", setCheck);
|
|
156
149
|
// defineInstance("Set", "intersection", "1.0.2", setCheck);
|
|
157
150
|
// defineInstance("Set", "isDisjointFrom", "1.0.2", setCheck);
|
|
@@ -179,15 +172,15 @@ defineInstance("String", "trimEnd", "1.0.0", stringCheck);
|
|
|
179
172
|
defineInstance("String", "trimLeft", "2.1.1", stringCheck);
|
|
180
173
|
defineInstance("String", "trimRight", "2.1.1", stringCheck);
|
|
181
174
|
defineInstance("String", "trimStart", "1.0.0", stringCheck);
|
|
182
|
-
defineInstance("Symbol", "description", "1.0.2", instanceofCheck("Symbol"), getter);
|
|
175
|
+
defineInstance("Symbol", "description", "1.0.2", instanceofCheck("Symbol"), getter);
|
|
183
176
|
|
|
177
|
+
// Annex B
|
|
184
178
|
for (const name of ["anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"]) {
|
|
185
179
|
defineInstance("String", name, "1.0.0", stringCheck, {
|
|
186
180
|
pkg: `es-string-html-methods`,
|
|
187
181
|
subfolder: name
|
|
188
182
|
});
|
|
189
183
|
}
|
|
190
|
-
|
|
191
184
|
function createDescriptor(name, version, pkg = name.toLowerCase(), subfolder) {
|
|
192
185
|
return {
|
|
193
186
|
name,
|
|
@@ -196,19 +189,18 @@ function createDescriptor(name, version, pkg = name.toLowerCase(), subfolder) {
|
|
|
196
189
|
path: subfolder ? `${pkg}/${subfolder}` : pkg
|
|
197
190
|
};
|
|
198
191
|
}
|
|
199
|
-
|
|
200
192
|
function defineGlobal(name, version, pkg, {
|
|
201
193
|
exclude,
|
|
202
194
|
subfolder,
|
|
203
195
|
polyfillName = name
|
|
204
196
|
} = {}) {
|
|
205
197
|
if (!has(Globals, name)) Globals[name] = [];
|
|
206
|
-
Globals[name].push({
|
|
198
|
+
Globals[name].push({
|
|
199
|
+
...createDescriptor(polyfillName, version, pkg, subfolder),
|
|
207
200
|
exclude,
|
|
208
201
|
nameHint: name
|
|
209
202
|
});
|
|
210
203
|
}
|
|
211
|
-
|
|
212
204
|
function defineStatic(object, property, version, {
|
|
213
205
|
pkg,
|
|
214
206
|
subfolder
|
|
@@ -216,7 +208,6 @@ function defineStatic(object, property, version, {
|
|
|
216
208
|
if (!has(StaticProperties, object)) StaticProperties[object] = {};
|
|
217
209
|
StaticProperties[object][property] = [createDescriptor(`${object}.${property}`, version, pkg, subfolder)];
|
|
218
210
|
}
|
|
219
|
-
|
|
220
211
|
function defineInstance(object, property, version, thisCheck, {
|
|
221
212
|
getter = false,
|
|
222
213
|
exclude,
|
|
@@ -224,7 +215,8 @@ function defineInstance(object, property, version, thisCheck, {
|
|
|
224
215
|
subfolder
|
|
225
216
|
} = {}) {
|
|
226
217
|
if (!has(InstanceProperties, property)) InstanceProperties[property] = [];
|
|
227
|
-
InstanceProperties[property].push({
|
|
218
|
+
InstanceProperties[property].push({
|
|
219
|
+
...createDescriptor(`${object}.prototype.${property}`, version, pkg, subfolder),
|
|
228
220
|
thisCheck,
|
|
229
221
|
exclude,
|
|
230
222
|
getter
|
|
@@ -247,7 +239,6 @@ var index = defineProvider(function ({
|
|
|
247
239
|
static: StaticProperties,
|
|
248
240
|
instance: InstanceProperties
|
|
249
241
|
});
|
|
250
|
-
|
|
251
242
|
function createDescIterator(cb, instance) {
|
|
252
243
|
return (meta, utils, path) => {
|
|
253
244
|
if (path.parentPath.isUnaryExpression({
|
|
@@ -255,17 +246,16 @@ var index = defineProvider(function ({
|
|
|
255
246
|
})) return;
|
|
256
247
|
const resolved = resolvePolyfill(meta);
|
|
257
248
|
if (!resolved) return;
|
|
258
|
-
|
|
259
249
|
if (instance && resolved.kind === "instance") {
|
|
260
250
|
instance(meta, resolved, utils, path);
|
|
261
251
|
return;
|
|
262
252
|
}
|
|
263
|
-
|
|
264
253
|
for (const desc of resolved.desc) {
|
|
265
254
|
if (!(desc.exclude != null && desc.exclude(meta, path)) && shouldInjectPolyfill(desc.name)) {
|
|
266
|
-
cb(desc, utils, path);
|
|
267
|
-
// inject the first non-excluded one.
|
|
255
|
+
cb(desc, utils, path);
|
|
268
256
|
|
|
257
|
+
// Since global and static polyfills are unambiguous, we only need to
|
|
258
|
+
// inject the first non-excluded one.
|
|
269
259
|
if (resolved.kind !== "instance") {
|
|
270
260
|
break;
|
|
271
261
|
}
|
|
@@ -273,13 +263,11 @@ var index = defineProvider(function ({
|
|
|
273
263
|
}
|
|
274
264
|
};
|
|
275
265
|
}
|
|
276
|
-
|
|
277
266
|
function injectDefault(desc, utils) {
|
|
278
267
|
assertDependency(desc.package, desc.version);
|
|
279
268
|
debug(desc.name);
|
|
280
269
|
return utils.injectDefaultImport(desc.path, desc.nameHint || desc.name);
|
|
281
270
|
}
|
|
282
|
-
|
|
283
271
|
const seen = new WeakSet();
|
|
284
272
|
return {
|
|
285
273
|
name: "es-shims",
|
|
@@ -303,19 +291,16 @@ var index = defineProvider(function ({
|
|
|
303
291
|
callee: path.node
|
|
304
292
|
});
|
|
305
293
|
const isGetter = resolved.desc[0].getter;
|
|
306
|
-
|
|
307
294
|
const matchesPolyfill = ({
|
|
308
295
|
name
|
|
309
296
|
}) => name.startsWith(meta.object);
|
|
310
|
-
|
|
311
297
|
let index = -1;
|
|
312
|
-
|
|
313
|
-
|
|
298
|
+
if (
|
|
299
|
+
// This is the actual method for sure.
|
|
314
300
|
meta.kind === "property" && meta.placement === "prototype" && meta.object != null && (index = resolved.desc.findIndex(matchesPolyfill)) !== -1) {
|
|
315
301
|
const desc = resolved.desc[index];
|
|
316
302
|
if (!shouldInjectPolyfill(desc.name)) return;
|
|
317
303
|
const id = injectDefault(desc, utils);
|
|
318
|
-
|
|
319
304
|
if (isGetter) {
|
|
320
305
|
path.replaceWith(expr`${id}(${path.node.object})`);
|
|
321
306
|
} else if (isCall) {
|
|
@@ -338,18 +323,14 @@ var index = defineProvider(function ({
|
|
|
338
323
|
const {
|
|
339
324
|
object
|
|
340
325
|
} = path.node;
|
|
341
|
-
|
|
342
326
|
for (const desc of resolved.desc) {
|
|
343
327
|
var _parent;
|
|
344
|
-
|
|
345
328
|
const {
|
|
346
329
|
thisCheck
|
|
347
330
|
} = desc;
|
|
348
|
-
|
|
349
331
|
if (!thisCheck || desc.exclude != null && desc.exclude(meta) || !shouldInjectPolyfill(desc.name)) {
|
|
350
332
|
continue;
|
|
351
333
|
}
|
|
352
|
-
|
|
353
334
|
if (!tmp) {
|
|
354
335
|
tmp = path.scope.generateUidIdentifierBasedOnNode(object);
|
|
355
336
|
path.scope.push({
|
|
@@ -357,20 +338,16 @@ var index = defineProvider(function ({
|
|
|
357
338
|
});
|
|
358
339
|
path.get("object").replaceWith(tmp);
|
|
359
340
|
}
|
|
360
|
-
|
|
361
341
|
const id = injectDefault(desc, utils);
|
|
362
342
|
replacement = t.conditionalExpression(thisCheck(t.cloneNode(tmp)), isGetter ? expr`${id}(${t.cloneNode(tmp)})` : isCall ? id : expr`${id}.getPolyfill()`, replacement);
|
|
363
343
|
parent = (_parent = parent) != null ? _parent : replacement;
|
|
364
344
|
}
|
|
365
|
-
|
|
366
345
|
if (!parent) return;
|
|
367
346
|
replacement = expr`(${t.cloneNode(tmp)} = ${object}, ${replacement})`;
|
|
368
|
-
|
|
369
347
|
if (!isGetter && isCall) {
|
|
370
348
|
parent.alternate = expr`Function.call.bind(${parent.alternate})`;
|
|
371
349
|
path.parentPath.unshiftContainer("arguments", t.cloneNode(tmp));
|
|
372
350
|
}
|
|
373
|
-
|
|
374
351
|
path.replaceWith(replacement);
|
|
375
352
|
}
|
|
376
353
|
})
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/mappings.ts","../src/index.ts"],"sourcesContent":["import { types as t, template } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"@babel/helper-define-polyfill-provider\";\n\nconst expr = template.expression.ast;\n\nconst has = Function.call.bind(Object.hasOwnProperty);\n\nexport type Descriptor = {\n name: string;\n version: string;\n package: string;\n path: string; // This is different from .package for multi-entry-point packages,\n pure?: false;\n global?: false;\n thisCheck?: (thisObj: any) => any;\n exclude?: (meta: MetaDescriptor, path: NodePath) => boolean;\n getter?: true;\n};\n\nexport const Globals = {};\nexport const StaticProperties = {};\nexport const InstanceProperties = {};\n\nconst lessThanArgs = num => (meta, path: NodePath) => {\n const { node, parent } = path;\n if (!t.isNewExpression(parent, { callee: node })) return false;\n if (parent.arguments.length >= num) return false;\n return parent.arguments.every(arg => !t.isSpreadElement(arg));\n};\n\nfor (const [name, causeArgNum] of [\n [\"Error\", 2],\n [\"AggregateError\", 3],\n [\"EvalError\", 2],\n [\"RangeError\", 2],\n [\"ReferenceError\", 2],\n [\"SyntaxError\", 2],\n [\"TypeError\", 2],\n [\"URIError\", 2],\n] as [string, number][]) {\n defineGlobal(name, \"1.0.1\", \"error-cause\", {\n exclude: lessThanArgs(causeArgNum),\n subfolder: name,\n polyfillName: \"Error cause\",\n });\n}\n// This needs to come after the AggregateError cause polyfill, since this\n// one polyfills less features.\ndefineGlobal(\"AggregateError\", \"1.0.2\", \"es-aggregate-error\");\nconst DATE_VERSION = \"2.0.0\";\n// MISSING DATA: defineGlobal(\"Date\", DATE_VERSION, \"date\", { subfolder: \"Date\" });\ndefineGlobal(\"globalThis\", \"1.0.0\");\ndefineGlobal(\"parseInt\", \"2.0.0\");\n\ndefineGlobal(\"Map\", \"1.0.4\", \"es-map\");\ndefineGlobal(\"Set\", \"1.1.0\", \"es-set\");\n\nconst arrayCheck = thisObj => expr`Array.isArray(${thisObj})`;\nconst typeofCheck = type => thisObj => expr`typeof ${thisObj} === \"${type}\"`;\nconst instanceofCheck = Class => thisObj =>\n expr`${thisObj} instanceof ${t.identifier(Class)}`;\nconst stringCheck = typeofCheck(\"string\");\n// const setCheck = instanceofCheck(\"Set\");\n\nconst getter = { getter: true };\nconst excludeStatic = obj => ({\n exclude: meta =>\n meta.kind === \"property\" &&\n meta.placement === \"static\" &&\n meta.object === obj,\n});\nconst excludeObject = excludeStatic(\"Object\");\n\ndefineStatic(\"Array\", \"from\", \"1.1.0\");\ndefineStatic(\"Array\", \"of\", \"1.0.0\");\ndefineInstance(\"Array\", \"at\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"concat\", \"1.0.2\", arrayCheck);\ndefineInstance(\"Array\", \"copyWithin\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"entries\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"every\", \"1.1.0\", arrayCheck);\ndefineInstance(\"Array\", \"filter\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"find\", \"2.1.1\", arrayCheck);\ndefineInstance(\"Array\", \"findIndex\", \"2.1.0\", arrayCheck);\ndefineInstance(\"Array\", \"findLast\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"findLastIndex\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"flat\", \"1.2.3\", arrayCheck);\ndefineInstance(\"Array\", \"flatMap\", \"1.2.3\", arrayCheck);\ndefineInstance(\"Array\", \"includes\", \"3.1.1\", arrayCheck, {\n pkg: \"array-includes\",\n});\ndefineInstance(\"Array\", \"indexOf\", \"1.0.1\", arrayCheck);\n// MISSING DATA: defineInstance(\"Array\", \"join\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"keys\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"lastIndexOf\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"map\", \"1.0.2\", arrayCheck);\ndefineInstance(\"Array\", \"reduce\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"reduceRight\", \"1.0.1\", arrayCheck);\n// MISSING DATA: defineInstance(\"Array\", \"slice\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"some\", \"1.1.1\", arrayCheck);\ndefineInstance(\"Array\", \"splice\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"toReversed\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"toSorted\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"toSpliced\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"unshift\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"values\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"with\", \"1.0.1\", arrayCheck);\n\nfor (const name of [\n \"now\",\n // MISSING DATA: \"parse\"\n]) {\n defineStatic(\"Date\", name, DATE_VERSION, {\n pkg: \"date\",\n subfolder: `Date.${name}`,\n });\n}\nfor (const name of [\n // MISSING DATA: \"getFullYear\",\n // MISSING DATA: \"getMonth\",\n // MISSING DATA: \"getDate\",\n // MISSING DATA: \"getUTCDate\",\n // MISSING DATA: \"getUTCFullYear\",\n // MISSING DATA: \"getUTCMonth\",\n // MISSING DATA: \"toUTCString\",\n // MISSING DATA: \"toDateString\",\n // MISSING DATA: \"toString\",\n \"toISOString\",\n \"toJSON\",\n]) {\n defineInstance(\"Date\", name, DATE_VERSION, instanceofCheck(\"Date\"), {\n pkg: \"date\",\n subfolder: `Date.prototype.${name}`,\n });\n}\n\ndefineInstance(\"Function\", \"name\", \"1.1.2\", typeofCheck(\"function\"), getter);\n\ndefineStatic(\"Math\", \"acosh\", \"1.0.0\");\ndefineStatic(\"Math\", \"atanh\", \"1.0.0\");\ndefineStatic(\"Math\", \"clz32\", \"1.0.0\");\ndefineStatic(\"Math\", \"cbrt\", \"1.0.0\");\ndefineStatic(\"Math\", \"fround\", \"1.0.0\");\ndefineStatic(\"Math\", \"log1p\", \"1.0.1\");\ndefineStatic(\"Math\", \"sign\", \"2.0.0\");\n\ndefineStatic(\"Number\", \"isFinite\", \"1.0.0\");\ndefineStatic(\"Number\", \"isInteger\", \"1.0.0\");\ndefineStatic(\"Number\", \"isSafeInteger\", \"1.0.0\");\ndefineStatic(\"Number\", \"isNaN\", \"1.0.0\", { pkg: \"number.isnan\" });\ndefineStatic(\"Number\", \"parseFloat\", \"1.0.0\");\ndefineStatic(\"Number\", \"parseInt\", \"1.0.0\");\n\ndefineStatic(\"Object\", \"assign\", \"4.1.0\");\ndefineStatic(\"Object\", \"defineProperties\", \"1.0.0\");\ndefineStatic(\"Object\", \"entries\", \"1.1.1\");\ndefineStatic(\"Object\", \"fromEntries\", \"2.0.2\");\ndefineStatic(\"Object\", \"hasOwn\", \"1.0.0\");\ndefineStatic(\"Object\", \"is\", \"1.1.2\", { pkg: \"object-is\" });\ndefineStatic(\"Object\", \"getOwnPropertyDescriptors\", \"2.1.0\");\ndefineStatic(\"Object\", \"getPrototypeOf\", \"1.0.1\");\ndefineStatic(\"Object\", \"values\", \"1.1.1\");\n\ndefineStatic(\"Promise\", \"allSettled\", \"1.0.2\");\ndefineStatic(\"Promise\", \"any\", \"2.0.1\");\ndefineStatic(\"Promise\", \"try\", \"1.0.0\");\ndefineInstance(\"Promise\", \"finally\", \"1.2.1\", instanceofCheck(\"Promise\"));\n\ndefineStatic(\"Reflect\", \"apply\", \"1.0.0\");\ndefineStatic(\"Reflect\", \"ownKeys\", \"1.0.1\");\ndefineStatic(\"Reflect\", \"getPrototypeOf\", \"1.0.0\");\n\ndefineInstance(\"RegExp\", \"flags\", \"1.3.0\", instanceofCheck(\"RegExp\"), getter);\n\n// TODO: Uncomment when Stage 4\n// defineInstance(\"Set\", \"difference\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"intersection\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isDisjointFrom\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isSubsetOf\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isSupersetOf\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"symmetricDifference\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"union\", \"1.0.2\", setCheck);\n\ndefineStatic(\"String\", \"fromCodePoint\", \"1.0.0\");\ndefineStatic(\"String\", \"raw\", \"1.0.1\");\ndefineInstance(\"String\", \"codePoitAt\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"endsWith\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"includes\", \"2.0.0\", stringCheck);\ndefineInstance(\"String\", \"at\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"matchAll\", \"4.0.2\", stringCheck);\ndefineInstance(\"String\", \"padEnd\", \"1.1.1\", stringCheck);\ndefineInstance(\"String\", \"padStart\", \"3.1.0\", stringCheck);\ndefineInstance(\"String\", \"repeat\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"replaceAll\", \"1.0.3\", stringCheck);\ndefineInstance(\n \"String\",\n \"split\",\n \"1.0.1\",\n stringCheck,\n excludeStatic(\"Symbol\"),\n);\ndefineInstance(\"String\", \"startsWith\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"substr\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"trim\", \"1.2.1\", stringCheck);\ndefineInstance(\"String\", \"trimEnd\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"trimLeft\", \"2.1.1\", stringCheck);\ndefineInstance(\"String\", \"trimRight\", \"2.1.1\", stringCheck);\ndefineInstance(\"String\", \"trimStart\", \"1.0.0\", stringCheck);\n\ndefineInstance(\n \"Symbol\",\n \"description\",\n \"1.0.2\",\n instanceofCheck(\"Symbol\"),\n getter,\n);\n\n// Annex B\nfor (const name of [\n \"anchor\",\n \"big\",\n \"blink\",\n \"bold\",\n \"fixed\",\n \"fontcolor\",\n \"fontsize\",\n \"italics\",\n \"link\",\n \"small\",\n \"strike\",\n \"sub\",\n \"sup\",\n]) {\n defineInstance(\"String\", name, \"1.0.0\", stringCheck, {\n pkg: `es-string-html-methods`,\n subfolder: name,\n });\n}\n\nfunction createDescriptor(name, version, pkg = name.toLowerCase(), subfolder?) {\n return {\n name,\n version,\n package: pkg,\n path: subfolder ? `${pkg}/${subfolder}` : pkg,\n };\n}\n\ntype ExcludeFilter = (meta: MetaDescriptor, path: NodePath) => boolean;\n\nfunction defineGlobal(\n name,\n version,\n pkg?,\n {\n exclude,\n subfolder,\n polyfillName = name,\n }: {\n exclude?: ExcludeFilter;\n subfolder?: string;\n polyfillName?: string;\n } = {},\n) {\n if (!has(Globals, name)) Globals[name] = [];\n Globals[name].push({\n ...createDescriptor(polyfillName, version, pkg, subfolder),\n exclude,\n nameHint: name,\n });\n}\n\nfunction defineStatic(\n object,\n property,\n version,\n { pkg, subfolder }: { pkg?: string; subfolder?: string } = {},\n) {\n if (!has(StaticProperties, object)) StaticProperties[object] = {};\n\n StaticProperties[object][property] = [\n createDescriptor(`${object}.${property}`, version, pkg, subfolder),\n ];\n}\n\nfunction defineInstance(\n object,\n property,\n version,\n thisCheck,\n {\n getter = false,\n exclude,\n pkg,\n subfolder,\n }: {\n getter?: boolean;\n exclude?: ExcludeFilter;\n pkg?: string;\n subfolder?: string;\n } = {},\n) {\n if (!has(InstanceProperties, property)) InstanceProperties[property] = [];\n\n InstanceProperties[property].push({\n ...createDescriptor(\n `${object}.prototype.${property}`,\n version,\n pkg,\n subfolder,\n ),\n thisCheck,\n exclude,\n getter,\n });\n}\n","import defineProvider, {\n type Utils,\n type MetaDescriptor,\n} from \"@babel/helper-define-polyfill-provider\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport polyfills from \"../data/polyfills.js\";\n\nimport {\n type Descriptor,\n Globals,\n StaticProperties,\n InstanceProperties,\n} from \"./mappings\";\n\nexport default defineProvider<{}>(function ({\n shouldInjectPolyfill,\n assertDependency,\n createMetaResolver,\n debug,\n babel: { template, types: t },\n}) {\n const expr = template.expression.ast;\n\n const resolvePolyfill = createMetaResolver<Descriptor[]>({\n global: Globals,\n static: StaticProperties,\n instance: InstanceProperties,\n });\n\n function createDescIterator(\n cb: (desc: Descriptor, utils: Utils, path: NodePath) => void,\n instance?: (\n meta: MetaDescriptor,\n resolved: any,\n utils: Utils,\n path: any,\n ) => void,\n ) {\n return (meta: MetaDescriptor, utils: Utils, path: NodePath) => {\n if (path.parentPath.isUnaryExpression({ operator: \"delete\" })) return;\n\n const resolved = resolvePolyfill(meta);\n if (!resolved) return;\n\n if (instance && resolved.kind === \"instance\") {\n instance(meta, resolved, utils, path);\n return;\n }\n\n for (const desc of resolved.desc) {\n if (!desc.exclude?.(meta, path) && shouldInjectPolyfill(desc.name)) {\n cb(desc, utils, path);\n\n // Since global and static polyfills are unambiguous, we only need to\n // inject the first non-excluded one.\n if (resolved.kind !== \"instance\") {\n break;\n }\n }\n }\n };\n }\n\n function injectDefault(desc, utils) {\n assertDependency(desc.package, desc.version);\n debug(desc.name);\n\n return utils.injectDefaultImport(desc.path, desc.nameHint || desc.name);\n }\n\n const seen = new WeakSet();\n\n return {\n name: \"es-shims\",\n polyfills,\n\n usageGlobal: createDescIterator((desc, utils) => {\n if (desc.global === false) return;\n\n assertDependency(desc.package, desc.version);\n\n utils.injectGlobalImport(`${desc.path}/auto`);\n\n debug(desc.name);\n }),\n\n usagePure: createDescIterator(\n (desc, utils, path) => {\n path.replaceWith(injectDefault(desc, utils));\n },\n (meta, resolved, utils, path) => {\n if (meta.kind !== \"property\") return;\n if (path.parentPath.isAssignmentExpression({ left: path.node })) return;\n\n if (seen.has(path.node)) return;\n seen.add(path.node);\n\n const isCall = path.parentPath.isCallExpression({ callee: path.node });\n const isGetter = resolved.desc[0].getter;\n\n const matchesPolyfill = ({ name }) =>\n name.startsWith(meta.object as any as string);\n\n let index = -1;\n if (\n // This is the actual method for sure.\n meta.kind === \"property\" &&\n meta.placement === \"prototype\" &&\n meta.object != null &&\n (index = resolved.desc.findIndex(matchesPolyfill)) !== -1\n ) {\n const desc = resolved.desc[index];\n if (!shouldInjectPolyfill(desc.name)) return;\n\n const id = injectDefault(desc, utils);\n\n if (isGetter) {\n path.replaceWith(expr`${id}(${path.node.object})`);\n } else if (isCall) {\n path.parentPath.unshiftContainer(\"arguments\", path.node.object);\n path.replaceWith(id);\n } else if (\n path.parentPath.isMemberExpression({\n object: path.node,\n computed: false,\n }) &&\n path.parent.property.name === \"call\" &&\n path.parentPath.parentPath.isCallExpression({ callee: path.parent })\n ) {\n path.parentPath.replaceWith(id);\n } else {\n path.replaceWith(expr`${id}.getPolyfill()`);\n }\n } else {\n let tmp;\n let parent;\n let replacement = path.node;\n const { object } = path.node;\n\n for (const desc of resolved.desc) {\n const { thisCheck } = desc;\n if (\n !thisCheck ||\n desc.exclude?.(meta) ||\n !shouldInjectPolyfill(desc.name)\n ) {\n continue;\n }\n\n if (!tmp) {\n tmp = path.scope.generateUidIdentifierBasedOnNode(object);\n path.scope.push({ id: t.cloneNode(tmp) });\n path.get(\"object\").replaceWith(tmp);\n }\n\n const id = injectDefault(desc, utils);\n\n replacement = t.conditionalExpression(\n thisCheck(t.cloneNode(tmp)),\n isGetter\n ? expr`${id}(${t.cloneNode(tmp)})`\n : isCall\n ? id\n : expr`${id}.getPolyfill()`,\n replacement,\n );\n\n parent = parent ?? replacement;\n }\n\n if (!parent) return;\n\n replacement = expr`(${t.cloneNode(tmp)} = ${object}, ${replacement})`;\n\n if (!isGetter && isCall) {\n parent.alternate = expr`Function.call.bind(${parent.alternate})`;\n path.parentPath.unshiftContainer(\"arguments\", t.cloneNode(tmp));\n }\n\n path.replaceWith(replacement);\n }\n },\n ),\n };\n});\n"],"names":["types","t","template","expr","expression","ast","has","Function","call","bind","Object","hasOwnProperty","Globals","StaticProperties","InstanceProperties","lessThanArgs","num","meta","path","node","parent","isNewExpression","callee","arguments","length","every","arg","isSpreadElement","name","causeArgNum","defineGlobal","exclude","subfolder","polyfillName","DATE_VERSION","arrayCheck","thisObj","typeofCheck","type","instanceofCheck","Class","identifier","stringCheck","getter","excludeStatic","obj","kind","placement","object","excludeObject","defineStatic","defineInstance","pkg","createDescriptor","version","toLowerCase","package","push","nameHint","property","thisCheck","defineProvider","shouldInjectPolyfill","assertDependency","createMetaResolver","debug","babel","resolvePolyfill","global","static","instance","createDescIterator","cb","utils","parentPath","isUnaryExpression","operator","resolved","desc","injectDefault","injectDefaultImport","seen","WeakSet","polyfills","usageGlobal","injectGlobalImport","usagePure","replaceWith","isAssignmentExpression","left","add","isCall","isCallExpression","isGetter","matchesPolyfill","startsWith","index","findIndex","id","unshiftContainer","isMemberExpression","computed","tmp","replacement","scope","generateUidIdentifierBasedOnNode","cloneNode","get","conditionalExpression","alternate"],"mappings":";;;;;EAASA,OAASC;EAAGC,UAAAA;;AAIrB,MAAMC,IAAI,GAAGD,QAAQ,CAACE,UAAT,CAAoBC,GAAjC;AAEA,MAAMC,GAAG,GAAGC,QAAQ,CAACC,IAAT,CAAcC,IAAd,CAAmBC,MAAM,CAACC,cAA1B,CAAZ;AAcO,MAAMC,OAAO,GAAG,EAAhB;AACA,MAAMC,gBAAgB,GAAG,EAAzB;AACA,MAAMC,kBAAkB,GAAG,EAA3B;;AAEP,MAAMC,YAAY,GAAGC,GAAG,IAAI,CAACC,IAAD,EAAOC,IAAP,KAA0B;EACpD,MAAM;IAAEC,IAAF;IAAQC;MAAWF,IAAzB;EACA,IAAI,CAACjB,CAAC,CAACoB,eAAF,CAAkBD,MAAlB,EAA0B;IAAEE,MAAM,EAAEH;GAApC,CAAL,EAAkD,OAAO,KAAP;EAClD,IAAIC,MAAM,CAACG,SAAP,CAAiBC,MAAjB,IAA2BR,GAA/B,EAAoC,OAAO,KAAP;EACpC,OAAOI,MAAM,CAACG,SAAP,CAAiBE,KAAjB,CAAuBC,GAAG,IAAI,CAACzB,CAAC,CAAC0B,eAAF,CAAkBD,GAAlB,CAA/B,CAAP;AACD,CALD;;AAOA,KAAK,MAAM,CAACE,IAAD,E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AE+F,EAAG,gBANF,EAOZK,WAPY,CAAd;UAUAnF,MAAM,cAAGA,MAAH,sBAAamF,WAAnB;;;QAGF,IAAI,CAACnF,MAAL,EAAa;QAEbmF,WAAW,GAAGpG,IAAK,IAAGF,CAAC,CAACyG,SAAF,CAAYJ,GAAZ,CAAiB,MAAKtD,MAAO,KAAIuD,WAAY,GAAnE;;QAEA,IAAI,CAACV,QAAD,IAAaF,MAAjB,EAAyB;UACvBvE,MAAM,CAACyF,SAAP,GAAmB1G,IAAK,sBAAqBiB,MAAM,CAACyF,SAAU,GAA9D;UACA3F,IAAI,CAACwD,UAAL,CAAgByB,gBAAhB,CAAiC,WAAjC,EAA8ClG,CAAC,CAACyG,SAAF,CAAYJ,GAAZ,CAA9C;;;QAGFpF,IAAI,CAACqE,WAAL,CAAiBgB,WAAjB;;KA7FuB;GAd/B;AAgHD,CA1K4B,CAA7B;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/mappings.ts","../src/index.ts"],"sourcesContent":["import { types as t, template } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type { MetaDescriptor } from \"@babel/helper-define-polyfill-provider\";\n\nconst expr = template.expression.ast;\n\nconst has = Function.call.bind(Object.hasOwnProperty);\n\nexport type Descriptor = {\n name: string;\n version: string;\n package: string;\n path: string; // This is different from .package for multi-entry-point packages,\n pure?: false;\n global?: false;\n thisCheck?: (thisObj: any) => any;\n exclude?: (meta: MetaDescriptor, path: NodePath) => boolean;\n getter?: true;\n};\n\nexport const Globals = {};\nexport const StaticProperties = {};\nexport const InstanceProperties = {};\n\nconst lessThanArgs = num => (meta, path: NodePath) => {\n const { node, parent } = path;\n if (!t.isNewExpression(parent, { callee: node })) return false;\n if (parent.arguments.length >= num) return false;\n return parent.arguments.every(arg => !t.isSpreadElement(arg));\n};\n\nfor (const [name, causeArgNum] of [\n [\"Error\", 2],\n [\"AggregateError\", 3],\n [\"EvalError\", 2],\n [\"RangeError\", 2],\n [\"ReferenceError\", 2],\n [\"SyntaxError\", 2],\n [\"TypeError\", 2],\n [\"URIError\", 2],\n] as [string, number][]) {\n defineGlobal(name, \"1.0.1\", \"error-cause\", {\n exclude: lessThanArgs(causeArgNum),\n subfolder: name,\n polyfillName: \"Error cause\",\n });\n}\n// This needs to come after the AggregateError cause polyfill, since this\n// one polyfills less features.\ndefineGlobal(\"AggregateError\", \"1.0.2\", \"es-aggregate-error\");\nconst DATE_VERSION = \"2.0.0\";\n// MISSING DATA: defineGlobal(\"Date\", DATE_VERSION, \"date\", { subfolder: \"Date\" });\ndefineGlobal(\"globalThis\", \"1.0.0\");\ndefineGlobal(\"parseInt\", \"2.0.0\");\n\ndefineGlobal(\"Map\", \"1.0.4\", \"es-map\");\ndefineGlobal(\"Set\", \"1.1.0\", \"es-set\");\n\nconst arrayCheck = thisObj => expr`Array.isArray(${thisObj})`;\nconst typeofCheck = type => thisObj => expr`typeof ${thisObj} === \"${type}\"`;\nconst instanceofCheck = Class => thisObj =>\n expr`${thisObj} instanceof ${t.identifier(Class)}`;\nconst stringCheck = typeofCheck(\"string\");\n// const setCheck = instanceofCheck(\"Set\");\n\nconst getter = { getter: true };\nconst excludeStatic = obj => ({\n exclude: meta =>\n meta.kind === \"property\" &&\n meta.placement === \"static\" &&\n meta.object === obj,\n});\nconst excludeObject = excludeStatic(\"Object\");\n\ndefineStatic(\"Array\", \"from\", \"1.1.0\");\ndefineStatic(\"Array\", \"of\", \"1.0.0\");\ndefineInstance(\"Array\", \"at\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"concat\", \"1.0.2\", arrayCheck);\ndefineInstance(\"Array\", \"copyWithin\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"entries\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"every\", \"1.1.0\", arrayCheck);\ndefineInstance(\"Array\", \"filter\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"find\", \"2.1.1\", arrayCheck);\ndefineInstance(\"Array\", \"findIndex\", \"2.1.0\", arrayCheck);\ndefineInstance(\"Array\", \"findLast\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"findLastIndex\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"flat\", \"1.2.3\", arrayCheck);\ndefineInstance(\"Array\", \"flatMap\", \"1.2.3\", arrayCheck);\ndefineInstance(\"Array\", \"includes\", \"3.1.1\", arrayCheck, {\n pkg: \"array-includes\",\n});\ndefineInstance(\"Array\", \"indexOf\", \"1.0.1\", arrayCheck);\n// MISSING DATA: defineInstance(\"Array\", \"join\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"keys\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"lastIndexOf\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"map\", \"1.0.2\", arrayCheck);\ndefineInstance(\"Array\", \"reduce\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"reduceRight\", \"1.0.1\", arrayCheck);\n// MISSING DATA: defineInstance(\"Array\", \"slice\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"some\", \"1.1.1\", arrayCheck);\ndefineInstance(\"Array\", \"splice\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"toReversed\", \"1.0.1\", arrayCheck);\ndefineInstance(\"Array\", \"toSorted\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"toSpliced\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"unshift\", \"1.0.0\", arrayCheck);\ndefineInstance(\"Array\", \"values\", \"1.0.0\", arrayCheck, excludeObject);\ndefineInstance(\"Array\", \"with\", \"1.0.1\", arrayCheck);\n\nfor (const name of [\n \"now\",\n // MISSING DATA: \"parse\"\n]) {\n defineStatic(\"Date\", name, DATE_VERSION, {\n pkg: \"date\",\n subfolder: `Date.${name}`,\n });\n}\nfor (const name of [\n // MISSING DATA: \"getFullYear\",\n // MISSING DATA: \"getMonth\",\n // MISSING DATA: \"getDate\",\n // MISSING DATA: \"getUTCDate\",\n // MISSING DATA: \"getUTCFullYear\",\n // MISSING DATA: \"getUTCMonth\",\n // MISSING DATA: \"toUTCString\",\n // MISSING DATA: \"toDateString\",\n // MISSING DATA: \"toString\",\n \"toISOString\",\n \"toJSON\",\n]) {\n defineInstance(\"Date\", name, DATE_VERSION, instanceofCheck(\"Date\"), {\n pkg: \"date\",\n subfolder: `Date.prototype.${name}`,\n });\n}\n\ndefineInstance(\"Function\", \"name\", \"1.1.2\", typeofCheck(\"function\"), getter);\n\ndefineStatic(\"Math\", \"acosh\", \"1.0.0\");\ndefineStatic(\"Math\", \"atanh\", \"1.0.0\");\ndefineStatic(\"Math\", \"clz32\", \"1.0.0\");\ndefineStatic(\"Math\", \"cbrt\", \"1.0.0\");\ndefineStatic(\"Math\", \"fround\", \"1.0.0\");\ndefineStatic(\"Math\", \"log1p\", \"1.0.1\");\ndefineStatic(\"Math\", \"sign\", \"2.0.0\");\n\ndefineStatic(\"Number\", \"isFinite\", \"1.0.0\");\ndefineStatic(\"Number\", \"isInteger\", \"1.0.0\");\ndefineStatic(\"Number\", \"isSafeInteger\", \"1.0.0\");\ndefineStatic(\"Number\", \"isNaN\", \"1.0.0\", { pkg: \"number.isnan\" });\ndefineStatic(\"Number\", \"parseFloat\", \"1.0.0\");\ndefineStatic(\"Number\", \"parseInt\", \"1.0.0\");\n\ndefineStatic(\"Object\", \"assign\", \"4.1.0\");\ndefineStatic(\"Object\", \"defineProperties\", \"1.0.0\");\ndefineStatic(\"Object\", \"entries\", \"1.1.1\");\ndefineStatic(\"Object\", \"fromEntries\", \"2.0.2\");\ndefineStatic(\"Object\", \"hasOwn\", \"1.0.0\");\ndefineStatic(\"Object\", \"is\", \"1.1.2\", { pkg: \"object-is\" });\ndefineStatic(\"Object\", \"getOwnPropertyDescriptors\", \"2.1.0\");\ndefineStatic(\"Object\", \"getPrototypeOf\", \"1.0.1\");\ndefineStatic(\"Object\", \"values\", \"1.1.1\");\n\ndefineStatic(\"Promise\", \"allSettled\", \"1.0.2\");\ndefineStatic(\"Promise\", \"any\", \"2.0.1\");\ndefineStatic(\"Promise\", \"try\", \"1.0.0\");\ndefineInstance(\"Promise\", \"finally\", \"1.2.1\", instanceofCheck(\"Promise\"));\n\ndefineStatic(\"Reflect\", \"apply\", \"1.0.0\");\ndefineStatic(\"Reflect\", \"ownKeys\", \"1.0.1\");\ndefineStatic(\"Reflect\", \"getPrototypeOf\", \"1.0.0\");\n\ndefineInstance(\"RegExp\", \"flags\", \"1.3.0\", instanceofCheck(\"RegExp\"), getter);\n\n// TODO: Uncomment when Stage 4\n// defineInstance(\"Set\", \"difference\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"intersection\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isDisjointFrom\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isSubsetOf\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"isSupersetOf\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"symmetricDifference\", \"1.0.2\", setCheck);\n// defineInstance(\"Set\", \"union\", \"1.0.2\", setCheck);\n\ndefineStatic(\"String\", \"fromCodePoint\", \"1.0.0\");\ndefineStatic(\"String\", \"raw\", \"1.0.1\");\ndefineInstance(\"String\", \"codePoitAt\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"endsWith\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"includes\", \"2.0.0\", stringCheck);\ndefineInstance(\"String\", \"at\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"matchAll\", \"4.0.2\", stringCheck);\ndefineInstance(\"String\", \"padEnd\", \"1.1.1\", stringCheck);\ndefineInstance(\"String\", \"padStart\", \"3.1.0\", stringCheck);\ndefineInstance(\"String\", \"repeat\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"replaceAll\", \"1.0.3\", stringCheck);\ndefineInstance(\n \"String\",\n \"split\",\n \"1.0.1\",\n stringCheck,\n excludeStatic(\"Symbol\"),\n);\ndefineInstance(\"String\", \"startsWith\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"substr\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"trim\", \"1.2.1\", stringCheck);\ndefineInstance(\"String\", \"trimEnd\", \"1.0.0\", stringCheck);\ndefineInstance(\"String\", \"trimLeft\", \"2.1.1\", stringCheck);\ndefineInstance(\"String\", \"trimRight\", \"2.1.1\", stringCheck);\ndefineInstance(\"String\", \"trimStart\", \"1.0.0\", stringCheck);\n\ndefineInstance(\n \"Symbol\",\n \"description\",\n \"1.0.2\",\n instanceofCheck(\"Symbol\"),\n getter,\n);\n\n// Annex B\nfor (const name of [\n \"anchor\",\n \"big\",\n \"blink\",\n \"bold\",\n \"fixed\",\n \"fontcolor\",\n \"fontsize\",\n \"italics\",\n \"link\",\n \"small\",\n \"strike\",\n \"sub\",\n \"sup\",\n]) {\n defineInstance(\"String\", name, \"1.0.0\", stringCheck, {\n pkg: `es-string-html-methods`,\n subfolder: name,\n });\n}\n\nfunction createDescriptor(name, version, pkg = name.toLowerCase(), subfolder?) {\n return {\n name,\n version,\n package: pkg,\n path: subfolder ? `${pkg}/${subfolder}` : pkg,\n };\n}\n\ntype ExcludeFilter = (meta: MetaDescriptor, path: NodePath) => boolean;\n\nfunction defineGlobal(\n name,\n version,\n pkg?,\n {\n exclude,\n subfolder,\n polyfillName = name,\n }: {\n exclude?: ExcludeFilter;\n subfolder?: string;\n polyfillName?: string;\n } = {},\n) {\n if (!has(Globals, name)) Globals[name] = [];\n Globals[name].push({\n ...createDescriptor(polyfillName, version, pkg, subfolder),\n exclude,\n nameHint: name,\n });\n}\n\nfunction defineStatic(\n object,\n property,\n version,\n { pkg, subfolder }: { pkg?: string; subfolder?: string } = {},\n) {\n if (!has(StaticProperties, object)) StaticProperties[object] = {};\n\n StaticProperties[object][property] = [\n createDescriptor(`${object}.${property}`, version, pkg, subfolder),\n ];\n}\n\nfunction defineInstance(\n object,\n property,\n version,\n thisCheck,\n {\n getter = false,\n exclude,\n pkg,\n subfolder,\n }: {\n getter?: boolean;\n exclude?: ExcludeFilter;\n pkg?: string;\n subfolder?: string;\n } = {},\n) {\n if (!has(InstanceProperties, property)) InstanceProperties[property] = [];\n\n InstanceProperties[property].push({\n ...createDescriptor(\n `${object}.prototype.${property}`,\n version,\n pkg,\n subfolder,\n ),\n thisCheck,\n exclude,\n getter,\n });\n}\n","import defineProvider, {\n type Utils,\n type MetaDescriptor,\n} from \"@babel/helper-define-polyfill-provider\";\nimport type { NodePath } from \"@babel/traverse\";\n\nimport polyfills from \"../data/polyfills.js\";\n\nimport {\n type Descriptor,\n Globals,\n StaticProperties,\n InstanceProperties,\n} from \"./mappings\";\n\nexport default defineProvider<{}>(function ({\n shouldInjectPolyfill,\n assertDependency,\n createMetaResolver,\n debug,\n babel: { template, types: t },\n}) {\n const expr = template.expression.ast;\n\n const resolvePolyfill = createMetaResolver<Descriptor[]>({\n global: Globals,\n static: StaticProperties,\n instance: InstanceProperties,\n });\n\n function createDescIterator(\n cb: (desc: Descriptor, utils: Utils, path: NodePath) => void,\n instance?: (\n meta: MetaDescriptor,\n resolved: any,\n utils: Utils,\n path: any,\n ) => void,\n ) {\n return (meta: MetaDescriptor, utils: Utils, path: NodePath) => {\n if (path.parentPath.isUnaryExpression({ operator: \"delete\" })) return;\n\n const resolved = resolvePolyfill(meta);\n if (!resolved) return;\n\n if (instance && resolved.kind === \"instance\") {\n instance(meta, resolved, utils, path);\n return;\n }\n\n for (const desc of resolved.desc) {\n if (!desc.exclude?.(meta, path) && shouldInjectPolyfill(desc.name)) {\n cb(desc, utils, path);\n\n // Since global and static polyfills are unambiguous, we only need to\n // inject the first non-excluded one.\n if (resolved.kind !== \"instance\") {\n break;\n }\n }\n }\n };\n }\n\n function injectDefault(desc, utils) {\n assertDependency(desc.package, desc.version);\n debug(desc.name);\n\n return utils.injectDefaultImport(desc.path, desc.nameHint || desc.name);\n }\n\n const seen = new WeakSet();\n\n return {\n name: \"es-shims\",\n polyfills,\n\n usageGlobal: createDescIterator((desc, utils) => {\n if (desc.global === false) return;\n\n assertDependency(desc.package, desc.version);\n\n utils.injectGlobalImport(`${desc.path}/auto`);\n\n debug(desc.name);\n }),\n\n usagePure: createDescIterator(\n (desc, utils, path) => {\n path.replaceWith(injectDefault(desc, utils));\n },\n (meta, resolved, utils, path) => {\n if (meta.kind !== \"property\") return;\n if (path.parentPath.isAssignmentExpression({ left: path.node })) return;\n\n if (seen.has(path.node)) return;\n seen.add(path.node);\n\n const isCall = path.parentPath.isCallExpression({ callee: path.node });\n const isGetter = resolved.desc[0].getter;\n\n const matchesPolyfill = ({ name }) =>\n name.startsWith(meta.object as any as string);\n\n let index = -1;\n if (\n // This is the actual method for sure.\n meta.kind === \"property\" &&\n meta.placement === \"prototype\" &&\n meta.object != null &&\n (index = resolved.desc.findIndex(matchesPolyfill)) !== -1\n ) {\n const desc = resolved.desc[index];\n if (!shouldInjectPolyfill(desc.name)) return;\n\n const id = injectDefault(desc, utils);\n\n if (isGetter) {\n path.replaceWith(expr`${id}(${path.node.object})`);\n } else if (isCall) {\n path.parentPath.unshiftContainer(\"arguments\", path.node.object);\n path.replaceWith(id);\n } else if (\n path.parentPath.isMemberExpression({\n object: path.node,\n computed: false,\n }) &&\n path.parent.property.name === \"call\" &&\n path.parentPath.parentPath.isCallExpression({ callee: path.parent })\n ) {\n path.parentPath.replaceWith(id);\n } else {\n path.replaceWith(expr`${id}.getPolyfill()`);\n }\n } else {\n let tmp;\n let parent;\n let replacement = path.node;\n const { object } = path.node;\n\n for (const desc of resolved.desc) {\n const { thisCheck } = desc;\n if (\n !thisCheck ||\n desc.exclude?.(meta) ||\n !shouldInjectPolyfill(desc.name)\n ) {\n continue;\n }\n\n if (!tmp) {\n tmp = path.scope.generateUidIdentifierBasedOnNode(object);\n path.scope.push({ id: t.cloneNode(tmp) });\n path.get(\"object\").replaceWith(tmp);\n }\n\n const id = injectDefault(desc, utils);\n\n replacement = t.conditionalExpression(\n thisCheck(t.cloneNode(tmp)),\n isGetter\n ? expr`${id}(${t.cloneNode(tmp)})`\n : isCall\n ? id\n : expr`${id}.getPolyfill()`,\n replacement,\n );\n\n parent = parent ?? replacement;\n }\n\n if (!parent) return;\n\n replacement = expr`(${t.cloneNode(tmp)} = ${object}, ${replacement})`;\n\n if (!isGetter && isCall) {\n parent.alternate = expr`Function.call.bind(${parent.alternate})`;\n path.parentPath.unshiftContainer(\"arguments\", t.cloneNode(tmp));\n }\n\n path.replaceWith(replacement);\n }\n },\n ),\n };\n});\n"],"names":["types","t","template","_babel","default","expr","expression","ast","has","Function","call","bind","Object","hasOwnProperty","Globals","StaticProperties","InstanceProperties","lessThanArgs","num","meta","path","node","parent","isNewExpression","callee","arguments","length","every","arg","isSpreadElement","name","causeArgNum","defineGlobal","exclude","subfolder","polyfillName","DATE_VERSION","arrayCheck","thisObj","typeofCheck","type","instanceofCheck","Class","identifier","stringCheck","getter","excludeStatic","obj","kind","placement","object","excludeObject","defineStatic","defineInstance","pkg","createDescriptor","version","toLowerCase","package","push","nameHint","property","thisCheck","defineProvider","shouldInjectPolyfill","assertDependency","createMetaResolver","debug","babel","resolvePolyfill","global","static","instance","createDescIterator","cb","utils","parentPath","isUnaryExpression","operator","resolved","desc","injectDefault","injectDefaultImport","seen","WeakSet","polyfills","usageGlobal","injectGlobalImport","usagePure","replaceWith","isAssignmentExpression","left","add","isCall","isCallExpression","isGetter","matchesPolyfill","startsWith","index","findIndex","id","unshiftContainer","isMemberExpression","computed","tmp","replacement","_parent","scope","generateUidIdentifierBasedOnNode","cloneNode","get","conditionalExpression","alternate"],"mappings":";;;;;EAASA,KAAK,EAAIC,CAAC;EAAEC,QAAQ,EAARA;AAAQ,IAAAC,MAAA,CAAAC,OAAA,IAAAD,MAAA;AAI7B,MAAME,IAAI,GAAGH,QAAQ,CAACI,UAAU,CAACC,GAAG;AAEpC,MAAMC,GAAG,GAAGC,QAAQ,CAACC,IAAI,CAACC,IAA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CAAC;UAErC8B,WAAW,GAAGxG,CAAC,CAAC8G,qBAAqB,CACnCjD,SAAS,CAAC7D,CAAC,CAAC4G,SAAS,CAACL,GAAG,CAAC,CAAC,EAC3BT,QAAQ,GACJ1F,IAAK,GAAE+F,EAAG,IAAGnG,CAAC,CAAC4G,SAAS,CAACL,GAAG,CAAE,GAAE,GAChCX,MAAM,GACNO,EAAE,GACF/F,IAAK,GAAE+F,EAAG,gBAAe,EAC7BK,WACF,CAAC;UAEDnF,MAAM,IAAAoF,OAAA,GAAGpF,MAAM,YAAAoF,OAAA,GAAID,WAAW;;QAGhC,IAAI,CAACnF,MAAM,EAAE;QAEbmF,WAAW,GAAGpG,IAAK,IAAGJ,CAAC,CAAC4G,SAAS,CAACL,GAAG,CAAE,MAAKtD,MAAO,KAAIuD,WAAY,GAAE;QAErE,IAAI,CAACV,QAAQ,IAAIF,MAAM,EAAE;UACvBvE,MAAM,CAAC0F,SAAS,GAAG3G,IAAK,sBAAqBiB,MAAM,CAAC0F,SAAU,GAAE;UAChE5F,IAAI,CAACwD,UAAU,CAACyB,gBAAgB,CAAC,WAAW,EAAEpG,CAAC,CAAC4G,SAAS,CAACL,GAAG,CAAC,CAAC;;QAGjEpF,IAAI,CAACqE,WAAW,CAACgB,WAAW,CAAC;;KAGnC;GACD;AACH,CAAC,CAAC;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
|
|
6
5
|
var _helperDefinePolyfillProvider = _interopRequireDefault(require("@babel/helper-define-polyfill-provider"));
|
|
7
|
-
|
|
8
6
|
var _polyfills = _interopRequireDefault(require("../data/polyfills.js"));
|
|
9
|
-
|
|
10
7
|
var _mappings = require("./mappings");
|
|
11
|
-
|
|
12
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
9
|
var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
15
10
|
shouldInjectPolyfill,
|
|
16
11
|
assertDependency,
|
|
@@ -27,7 +22,6 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
27
22
|
static: _mappings.StaticProperties,
|
|
28
23
|
instance: _mappings.InstanceProperties
|
|
29
24
|
});
|
|
30
|
-
|
|
31
25
|
function createDescIterator(cb, instance) {
|
|
32
26
|
return (meta, utils, path) => {
|
|
33
27
|
if (path.parentPath.isUnaryExpression({
|
|
@@ -35,17 +29,16 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
35
29
|
})) return;
|
|
36
30
|
const resolved = resolvePolyfill(meta);
|
|
37
31
|
if (!resolved) return;
|
|
38
|
-
|
|
39
32
|
if (instance && resolved.kind === "instance") {
|
|
40
33
|
instance(meta, resolved, utils, path);
|
|
41
34
|
return;
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
for (const desc of resolved.desc) {
|
|
45
37
|
if (!(desc.exclude != null && desc.exclude(meta, path)) && shouldInjectPolyfill(desc.name)) {
|
|
46
|
-
cb(desc, utils, path);
|
|
47
|
-
// inject the first non-excluded one.
|
|
38
|
+
cb(desc, utils, path);
|
|
48
39
|
|
|
40
|
+
// Since global and static polyfills are unambiguous, we only need to
|
|
41
|
+
// inject the first non-excluded one.
|
|
49
42
|
if (resolved.kind !== "instance") {
|
|
50
43
|
break;
|
|
51
44
|
}
|
|
@@ -53,13 +46,11 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
53
46
|
}
|
|
54
47
|
};
|
|
55
48
|
}
|
|
56
|
-
|
|
57
49
|
function injectDefault(desc, utils) {
|
|
58
50
|
assertDependency(desc.package, desc.version);
|
|
59
51
|
debug(desc.name);
|
|
60
52
|
return utils.injectDefaultImport(desc.path, desc.nameHint || desc.name);
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
const seen = new WeakSet();
|
|
64
55
|
return {
|
|
65
56
|
name: "es-shims",
|
|
@@ -83,19 +74,16 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
83
74
|
callee: path.node
|
|
84
75
|
});
|
|
85
76
|
const isGetter = resolved.desc[0].getter;
|
|
86
|
-
|
|
87
77
|
const matchesPolyfill = ({
|
|
88
78
|
name
|
|
89
79
|
}) => name.startsWith(meta.object);
|
|
90
|
-
|
|
91
80
|
let index = -1;
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
if (
|
|
82
|
+
// This is the actual method for sure.
|
|
94
83
|
meta.kind === "property" && meta.placement === "prototype" && meta.object != null && (index = resolved.desc.findIndex(matchesPolyfill)) !== -1) {
|
|
95
84
|
const desc = resolved.desc[index];
|
|
96
85
|
if (!shouldInjectPolyfill(desc.name)) return;
|
|
97
86
|
const id = injectDefault(desc, utils);
|
|
98
|
-
|
|
99
87
|
if (isGetter) {
|
|
100
88
|
path.replaceWith(expr`${id}(${path.node.object})`);
|
|
101
89
|
} else if (isCall) {
|
|
@@ -118,18 +106,14 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
118
106
|
const {
|
|
119
107
|
object
|
|
120
108
|
} = path.node;
|
|
121
|
-
|
|
122
109
|
for (const desc of resolved.desc) {
|
|
123
110
|
var _parent;
|
|
124
|
-
|
|
125
111
|
const {
|
|
126
112
|
thisCheck
|
|
127
113
|
} = desc;
|
|
128
|
-
|
|
129
114
|
if (!thisCheck || desc.exclude != null && desc.exclude(meta) || !shouldInjectPolyfill(desc.name)) {
|
|
130
115
|
continue;
|
|
131
116
|
}
|
|
132
|
-
|
|
133
117
|
if (!tmp) {
|
|
134
118
|
tmp = path.scope.generateUidIdentifierBasedOnNode(object);
|
|
135
119
|
path.scope.push({
|
|
@@ -137,24 +121,19 @@ var _default = (0, _helperDefinePolyfillProvider.default)(function ({
|
|
|
137
121
|
});
|
|
138
122
|
path.get("object").replaceWith(tmp);
|
|
139
123
|
}
|
|
140
|
-
|
|
141
124
|
const id = injectDefault(desc, utils);
|
|
142
125
|
replacement = t.conditionalExpression(thisCheck(t.cloneNode(tmp)), isGetter ? expr`${id}(${t.cloneNode(tmp)})` : isCall ? id : expr`${id}.getPolyfill()`, replacement);
|
|
143
126
|
parent = (_parent = parent) != null ? _parent : replacement;
|
|
144
127
|
}
|
|
145
|
-
|
|
146
128
|
if (!parent) return;
|
|
147
129
|
replacement = expr`(${t.cloneNode(tmp)} = ${object}, ${replacement})`;
|
|
148
|
-
|
|
149
130
|
if (!isGetter && isCall) {
|
|
150
131
|
parent.alternate = expr`Function.call.bind(${parent.alternate})`;
|
|
151
132
|
path.parentPath.unshiftContainer("arguments", t.cloneNode(tmp));
|
|
152
133
|
}
|
|
153
|
-
|
|
154
134
|
path.replaceWith(replacement);
|
|
155
135
|
}
|
|
156
136
|
})
|
|
157
137
|
};
|
|
158
138
|
});
|
|
159
|
-
|
|
160
139
|
exports.default = _default;
|
package/lib/mappings.js
CHANGED
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.StaticProperties = exports.InstanceProperties = exports.Globals = void 0;
|
|
5
|
-
|
|
6
5
|
var _babel = _interopRequireWildcard(require("@babel/core"));
|
|
7
|
-
|
|
8
6
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
|
|
10
7
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
|
|
12
8
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
-
|
|
14
9
|
const {
|
|
15
10
|
types: t,
|
|
16
11
|
template: template
|
|
@@ -23,7 +18,6 @@ const StaticProperties = {};
|
|
|
23
18
|
exports.StaticProperties = StaticProperties;
|
|
24
19
|
const InstanceProperties = {};
|
|
25
20
|
exports.InstanceProperties = InstanceProperties;
|
|
26
|
-
|
|
27
21
|
const lessThanArgs = num => (meta, path) => {
|
|
28
22
|
const {
|
|
29
23
|
node,
|
|
@@ -35,41 +29,34 @@ const lessThanArgs = num => (meta, path) => {
|
|
|
35
29
|
if (parent.arguments.length >= num) return false;
|
|
36
30
|
return parent.arguments.every(arg => !t.isSpreadElement(arg));
|
|
37
31
|
};
|
|
38
|
-
|
|
39
32
|
for (const [name, causeArgNum] of [["Error", 2], ["AggregateError", 3], ["EvalError", 2], ["RangeError", 2], ["ReferenceError", 2], ["SyntaxError", 2], ["TypeError", 2], ["URIError", 2]]) {
|
|
40
33
|
defineGlobal(name, "1.0.1", "error-cause", {
|
|
41
34
|
exclude: lessThanArgs(causeArgNum),
|
|
42
35
|
subfolder: name,
|
|
43
36
|
polyfillName: "Error cause"
|
|
44
37
|
});
|
|
45
|
-
}
|
|
38
|
+
}
|
|
39
|
+
// This needs to come after the AggregateError cause polyfill, since this
|
|
46
40
|
// one polyfills less features.
|
|
47
|
-
|
|
48
|
-
|
|
49
41
|
defineGlobal("AggregateError", "1.0.2", "es-aggregate-error");
|
|
50
|
-
const DATE_VERSION = "2.0.0";
|
|
51
|
-
|
|
42
|
+
const DATE_VERSION = "2.0.0";
|
|
43
|
+
// MISSING DATA: defineGlobal("Date", DATE_VERSION, "date", { subfolder: "Date" });
|
|
52
44
|
defineGlobal("globalThis", "1.0.0");
|
|
53
45
|
defineGlobal("parseInt", "2.0.0");
|
|
54
46
|
defineGlobal("Map", "1.0.4", "es-map");
|
|
55
47
|
defineGlobal("Set", "1.1.0", "es-set");
|
|
56
|
-
|
|
57
48
|
const arrayCheck = thisObj => expr`Array.isArray(${thisObj})`;
|
|
58
|
-
|
|
59
49
|
const typeofCheck = type => thisObj => expr`typeof ${thisObj} === "${type}"`;
|
|
60
|
-
|
|
61
50
|
const instanceofCheck = Class => thisObj => expr`${thisObj} instanceof ${t.identifier(Class)}`;
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
const stringCheck = typeofCheck("string");
|
|
52
|
+
// const setCheck = instanceofCheck("Set");
|
|
64
53
|
|
|
65
54
|
const getter = {
|
|
66
55
|
getter: true
|
|
67
56
|
};
|
|
68
|
-
|
|
69
57
|
const excludeStatic = obj => ({
|
|
70
58
|
exclude: meta => meta.kind === "property" && meta.placement === "static" && meta.object === obj
|
|
71
59
|
});
|
|
72
|
-
|
|
73
60
|
const excludeObject = excludeStatic("Object");
|
|
74
61
|
defineStatic("Array", "from", "1.1.0");
|
|
75
62
|
defineStatic("Array", "of", "1.0.0");
|
|
@@ -88,14 +75,14 @@ defineInstance("Array", "flatMap", "1.2.3", arrayCheck);
|
|
|
88
75
|
defineInstance("Array", "includes", "3.1.1", arrayCheck, {
|
|
89
76
|
pkg: "array-includes"
|
|
90
77
|
});
|
|
91
|
-
defineInstance("Array", "indexOf", "1.0.1", arrayCheck);
|
|
92
|
-
|
|
78
|
+
defineInstance("Array", "indexOf", "1.0.1", arrayCheck);
|
|
79
|
+
// MISSING DATA: defineInstance("Array", "join", "1.0.0", arrayCheck);
|
|
93
80
|
defineInstance("Array", "keys", "1.0.0", arrayCheck, excludeObject);
|
|
94
81
|
defineInstance("Array", "lastIndexOf", "1.0.0", arrayCheck);
|
|
95
82
|
defineInstance("Array", "map", "1.0.2", arrayCheck);
|
|
96
83
|
defineInstance("Array", "reduce", "1.0.1", arrayCheck);
|
|
97
|
-
defineInstance("Array", "reduceRight", "1.0.1", arrayCheck);
|
|
98
|
-
|
|
84
|
+
defineInstance("Array", "reduceRight", "1.0.1", arrayCheck);
|
|
85
|
+
// MISSING DATA: defineInstance("Array", "slice", "1.0.0", arrayCheck);
|
|
99
86
|
defineInstance("Array", "some", "1.1.1", arrayCheck);
|
|
100
87
|
defineInstance("Array", "splice", "1.0.1", arrayCheck);
|
|
101
88
|
defineInstance("Array", "toReversed", "1.0.1", arrayCheck);
|
|
@@ -104,16 +91,16 @@ defineInstance("Array", "toSpliced", "1.0.0", arrayCheck);
|
|
|
104
91
|
defineInstance("Array", "unshift", "1.0.0", arrayCheck);
|
|
105
92
|
defineInstance("Array", "values", "1.0.0", arrayCheck, excludeObject);
|
|
106
93
|
defineInstance("Array", "with", "1.0.1", arrayCheck);
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
for (const name of ["now"
|
|
95
|
+
// MISSING DATA: "parse"
|
|
109
96
|
]) {
|
|
110
97
|
defineStatic("Date", name, DATE_VERSION, {
|
|
111
98
|
pkg: "date",
|
|
112
99
|
subfolder: `Date.${name}`
|
|
113
100
|
});
|
|
114
101
|
}
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
for (const name of [
|
|
103
|
+
// MISSING DATA: "getFullYear",
|
|
117
104
|
// MISSING DATA: "getMonth",
|
|
118
105
|
// MISSING DATA: "getDate",
|
|
119
106
|
// MISSING DATA: "getUTCDate",
|
|
@@ -128,7 +115,6 @@ for (const name of [// MISSING DATA: "getFullYear",
|
|
|
128
115
|
subfolder: `Date.prototype.${name}`
|
|
129
116
|
});
|
|
130
117
|
}
|
|
131
|
-
|
|
132
118
|
defineInstance("Function", "name", "1.1.2", typeofCheck("function"), getter);
|
|
133
119
|
defineStatic("Math", "acosh", "1.0.0");
|
|
134
120
|
defineStatic("Math", "atanh", "1.0.0");
|
|
@@ -163,7 +149,9 @@ defineInstance("Promise", "finally", "1.2.1", instanceofCheck("Promise"));
|
|
|
163
149
|
defineStatic("Reflect", "apply", "1.0.0");
|
|
164
150
|
defineStatic("Reflect", "ownKeys", "1.0.1");
|
|
165
151
|
defineStatic("Reflect", "getPrototypeOf", "1.0.0");
|
|
166
|
-
defineInstance("RegExp", "flags", "1.3.0", instanceofCheck("RegExp"), getter);
|
|
152
|
+
defineInstance("RegExp", "flags", "1.3.0", instanceofCheck("RegExp"), getter);
|
|
153
|
+
|
|
154
|
+
// TODO: Uncomment when Stage 4
|
|
167
155
|
// defineInstance("Set", "difference", "1.0.2", setCheck);
|
|
168
156
|
// defineInstance("Set", "intersection", "1.0.2", setCheck);
|
|
169
157
|
// defineInstance("Set", "isDisjointFrom", "1.0.2", setCheck);
|
|
@@ -191,15 +179,15 @@ defineInstance("String", "trimEnd", "1.0.0", stringCheck);
|
|
|
191
179
|
defineInstance("String", "trimLeft", "2.1.1", stringCheck);
|
|
192
180
|
defineInstance("String", "trimRight", "2.1.1", stringCheck);
|
|
193
181
|
defineInstance("String", "trimStart", "1.0.0", stringCheck);
|
|
194
|
-
defineInstance("Symbol", "description", "1.0.2", instanceofCheck("Symbol"), getter);
|
|
182
|
+
defineInstance("Symbol", "description", "1.0.2", instanceofCheck("Symbol"), getter);
|
|
195
183
|
|
|
184
|
+
// Annex B
|
|
196
185
|
for (const name of ["anchor", "big", "blink", "bold", "fixed", "fontcolor", "fontsize", "italics", "link", "small", "strike", "sub", "sup"]) {
|
|
197
186
|
defineInstance("String", name, "1.0.0", stringCheck, {
|
|
198
187
|
pkg: `es-string-html-methods`,
|
|
199
188
|
subfolder: name
|
|
200
189
|
});
|
|
201
190
|
}
|
|
202
|
-
|
|
203
191
|
function createDescriptor(name, version, pkg = name.toLowerCase(), subfolder) {
|
|
204
192
|
return {
|
|
205
193
|
name,
|
|
@@ -208,7 +196,6 @@ function createDescriptor(name, version, pkg = name.toLowerCase(), subfolder) {
|
|
|
208
196
|
path: subfolder ? `${pkg}/${subfolder}` : pkg
|
|
209
197
|
};
|
|
210
198
|
}
|
|
211
|
-
|
|
212
199
|
function defineGlobal(name, version, pkg, {
|
|
213
200
|
exclude,
|
|
214
201
|
subfolder,
|
|
@@ -220,7 +207,6 @@ function defineGlobal(name, version, pkg, {
|
|
|
220
207
|
nameHint: name
|
|
221
208
|
}));
|
|
222
209
|
}
|
|
223
|
-
|
|
224
210
|
function defineStatic(object, property, version, {
|
|
225
211
|
pkg,
|
|
226
212
|
subfolder
|
|
@@ -228,7 +214,6 @@ function defineStatic(object, property, version, {
|
|
|
228
214
|
if (!has(StaticProperties, object)) StaticProperties[object] = {};
|
|
229
215
|
StaticProperties[object][property] = [createDescriptor(`${object}.${property}`, version, pkg, subfolder)];
|
|
230
216
|
}
|
|
231
|
-
|
|
232
217
|
function defineInstance(object, property, version, thisCheck, {
|
|
233
218
|
getter = false,
|
|
234
219
|
exclude,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-polyfill-es-shims",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "A Babel plugin to inject imports to es-shims polyfills",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"babel-plugin"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/helper-define-polyfill-provider": "^0.4.
|
|
29
|
+
"@babel/helper-define-polyfill-provider": "^0.4.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/helper-plugin-test-runner": "^7.
|
|
32
|
+
"@babel/core": "^7.22.6",
|
|
33
|
+
"@babel/helper-plugin-test-runner": "^7.22.5",
|
|
34
34
|
"array.from": "^1.1.0",
|
|
35
35
|
"math.clz32": "^1.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@babel/core": "^7.0.0-0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "74956db5d547985ac8e60bf1af56f4c61af12e4e"
|
|
41
41
|
}
|