@next/polyfill-module 13.4.20-canary.0 → 13.4.20-canary.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.
@@ -1,7 +1,7 @@
1
1
 
2
- > @next/polyfill-module@13.4.20-canary.0 build /home/runner/work/next.js/next.js/packages/next-polyfill-module
2
+ > @next/polyfill-module@13.4.20-canary.1 build /home/runner/work/next.js/next.js/packages/next-polyfill-module
3
3
  > microbundle -i src/index.js -o dist/polyfill-module.js -f iife --no-sourcemap --external none --no-pkg-main
4
4
 
5
5
  Build "@next/polyfill-module" to dist:
6
- 422 B: polyfill-module.js.gz
7
- 344 B: polyfill-module.js.br
6
+ 473 B: polyfill-module.js.gz
7
+ 414 B: polyfill-module.js.br
@@ -1 +1 @@
1
- "trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var t=/\((.*)\)/.exec(this.toString());return t?t[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(t,r){return r=this.concat.apply([],this),t>1&&r.some(Array.isArray)?r.flat(t-1):r},Array.prototype.flatMap=function(t,r){return this.map(t,r).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(t){if("function"!=typeof t)return this.then(t,t);var r=this.constructor||Promise;return this.then(function(o){return r.resolve(t()).then(function(){return o})},function(o){return r.resolve(t()).then(function(){throw o})})}),Object.fromEntries||(Object.fromEntries=function(t){return Array.from(t).reduce(function(t,r){return t[r[0]]=r[1],t},{})});
1
+ "trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var t=/\((.*)\)/.exec(this.toString());return t?t[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(t,r){return r=this.concat.apply([],this),t>1&&r.some(Array.isArray)?r.flat(t-1):r},Array.prototype.flatMap=function(t,r){return this.map(t,r).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(t){if("function"!=typeof t)return this.then(t,t);var r=this.constructor||Promise;return this.then(function(n){return r.resolve(t()).then(function(){return n})},function(n){return r.resolve(t()).then(function(){throw n})})}),Object.fromEntries||(Object.fromEntries=function(t){return Array.from(t).reduce(function(t,r){return t[r[0]]=r[1],t},{})}),Array.prototype.at||(Array.prototype.at=function(t){var r=Math.trunc(t)||0;if(r<0&&(r+=this.length),!(r<0||r>=this.length))return this[r]});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/polyfill-module",
3
- "version": "13.4.20-canary.0",
3
+ "version": "13.4.20-canary.1",
4
4
  "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
5
5
  "main": "dist/polyfill-module.js",
6
6
  "license": "MIT",
package/src/index.js CHANGED
@@ -118,3 +118,26 @@ if (!Object.fromEntries) {
118
118
  }, {})
119
119
  }
120
120
  }
121
+
122
+ /**
123
+ * Available in:
124
+ * Internet Explorer: never
125
+ * Edge: 92
126
+ * Firefox: 90
127
+ * Chrome: 92
128
+ * Safari: 15.4
129
+ *
130
+ * https://caniuse.com/mdn-javascript_builtins_array_at
131
+ */
132
+ // Modified from TC39 at proposal polyfill: https://github.com/tc39/proposal-relative-indexing-method#polyfill
133
+ if (!Array.prototype.at) {
134
+ Array.prototype.at = function at(n) {
135
+ let i = Math.trunc(n) || 0
136
+
137
+ if (i < 0) i += this.length
138
+
139
+ if (i < 0 || i >= this.length) return undefined
140
+
141
+ return this[i]
142
+ }
143
+ }