Skip to content

Commit 8a3e537

Browse files
committed
MDL-67536 libraries: replace babel-polyfill with core-js
1 parent 338b60f commit 8a3e537

8 files changed

+781
-7222
lines changed

lib/babel-polyfill/polyfill.js

-7,200
This file was deleted.

lib/babel-polyfill/polyfill.min.js

-1
This file was deleted.

lib/babel-polyfill/readme_moodle.txt

-6
This file was deleted.

lib/outputrequirementslib.php

-8
Original file line numberDiff line numberDiff line change
@@ -1614,14 +1614,6 @@ public function get_top_of_body_code(renderer_base $renderer) {
16141614
// First the skip links.
16151615
$output = $renderer->render_skip_links($this->skiplinks);
16161616

1617-
// The polyfill needs to load before the other JavaScript in order to make sure
1618-
// that we have access to the functions it provides.
1619-
if (empty($CFG->cachejs)) {
1620-
$output .= html_writer::script('', $this->js_fix_url('/lib/babel-polyfill/polyfill.js'));
1621-
} else {
1622-
$output .= html_writer::script('', $this->js_fix_url('/lib/babel-polyfill/polyfill.min.js'));
1623-
}
1624-
16251617
// Include the Polyfills.
16261618
$output .= html_writer::script('', $this->js_fix_url('/lib/polyfills/polyfill.js'));
16271619

lib/polyfills/polyfill.js

+760-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/polyfills/readme_moodle.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
The steps are essentially:
2-
1) Install mdn-polyfills and url-polyfill packages
2+
1) Install required packages
33

4-
npm install --no-save mdn-polyfills url-polyfill
4+
npm install --no-save mdn-polyfills url-polyfill regenerator-runtime core-js-bundle
55

66
2) Join them all together:
77

88
cd node_modules/mdn-polyfills
99
cat CustomEvent.* Element.* Function.* HTMLCanvasElement.* MouseEvent.* Node.prototype.* NodeList.* > ../../lib/polyfills/polyfill.js
10+
1011
cd ../url-polyfill/
1112
cat url-polyfill.min.js >> ../../lib/polyfills/polyfill.js
1213

14+
cd ../regenerator-runtime
15+
cat runtime.js >> ../../lib/polyfills/polyfill.js
16+
17+
cd ../core-js-bundle
18+
cat minified.js >> ../../lib/polyfills/polyfill.js
19+
sed -i '/\/\/\# sourceMappingURL=minified.js.map/d' ../../lib/polyfills/polyfill.js
20+
1321
3) Uninstall the packages again
1422

15-
npm uninstall --no-save mdn-polyfills url-polyfill
23+
npm uninstall --no-save mdn-polyfills url-polyfill regenerator-runtime core-js-bundle

lib/thirdpartylibs.xml

+9-3
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,16 @@
303303
<licenseversion>3-Clause</licenseversion>
304304
</library>
305305
<library>
306-
<location>babel-polyfill</location>
307-
<name>babel-polyfill</name>
306+
<location>polyfills</location>
307+
<name>regenerator-runtime</name>
308+
<license>MIT</license>
309+
<version>0.13.7</version>
310+
</library>
311+
<library>
312+
<location>polyfills</location>
313+
<name>core-js-bundle</name>
308314
<license>MIT</license>
309-
<version>7.7.0</version>
315+
<version>3.15.0</version>
310316
</library>
311317
<library>
312318
<location>polyfills</location>

lib/upgrade.txt

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ information provided here is intended especially for developers.
2222
* The core/event::getLegacyEvents() function has been deprecated and should no longer be used.
2323
* Typo3 has now been removed. Use native mbstring or iconv functions.
2424
* A new index has been added on mdl_user_preferences.name. This upgrade step might take some time on big sites.
25+
* @babel/polyfill has been removed in favour of corejs@3
2526

2627
=== 3.11 ===
2728
* PHPUnit has been upgraded to 9.5 (see MDL-71036 for details).

0 commit comments

Comments
 (0)