MDL-67536 libraries: replace babel-polyfill with core-js

This commit is contained in:
Dongsheng Cai
2021-06-21 12:03:58 +10:00
parent 338b60f43b
commit 8a3e5377b1
8 changed files with 781 additions and 7222 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
-6
View File
@@ -1,6 +0,0 @@
Installation instructions can be found at https://babeljs.io/docs/en/babel-polyfill.html#usage-in-browser
The steps are essentially:
1.) npm install @babel/polyfill
2.) copy polyfill.js and polyfill.min.js from the "dist" folder from the npm release into lib/babel-polyfill/
3.) npm uninstall --save @babel/polyfill (don't want to include that with Moodle package.json)
-8
View File
@@ -1614,14 +1614,6 @@ EOF;
// First the skip links.
$output = $renderer->render_skip_links($this->skiplinks);
// The polyfill needs to load before the other JavaScript in order to make sure
// that we have access to the functions it provides.
if (empty($CFG->cachejs)) {
$output .= html_writer::script('', $this->js_fix_url('/lib/babel-polyfill/polyfill.js'));
} else {
$output .= html_writer::script('', $this->js_fix_url('/lib/babel-polyfill/polyfill.min.js'));
}
// Include the Polyfills.
$output .= html_writer::script('', $this->js_fix_url('/lib/polyfills/polyfill.js'));
File diff suppressed because one or more lines are too long
+11 -3
View File
@@ -1,15 +1,23 @@
The steps are essentially:
1) Install mdn-polyfills and url-polyfill packages
1) Install required packages
npm install --no-save mdn-polyfills url-polyfill
npm install --no-save mdn-polyfills url-polyfill regenerator-runtime core-js-bundle
2) Join them all together:
cd node_modules/mdn-polyfills
cat CustomEvent.* Element.* Function.* HTMLCanvasElement.* MouseEvent.* Node.prototype.* NodeList.* > ../../lib/polyfills/polyfill.js
cd ../url-polyfill/
cat url-polyfill.min.js >> ../../lib/polyfills/polyfill.js
cd ../regenerator-runtime
cat runtime.js >> ../../lib/polyfills/polyfill.js
cd ../core-js-bundle
cat minified.js >> ../../lib/polyfills/polyfill.js
sed -i '/\/\/\# sourceMappingURL=minified.js.map/d' ../../lib/polyfills/polyfill.js
3) Uninstall the packages again
npm uninstall --no-save mdn-polyfills url-polyfill
npm uninstall --no-save mdn-polyfills url-polyfill regenerator-runtime core-js-bundle
+9 -3
View File
@@ -303,10 +303,16 @@
<licenseversion>3-Clause</licenseversion>
</library>
<library>
<location>babel-polyfill</location>
<name>babel-polyfill</name>
<location>polyfills</location>
<name>regenerator-runtime</name>
<license>MIT</license>
<version>7.7.0</version>
<version>0.13.7</version>
</library>
<library>
<location>polyfills</location>
<name>core-js-bundle</name>
<license>MIT</license>
<version>3.15.0</version>
</library>
<library>
<location>polyfills</location>
+1
View File
@@ -22,6 +22,7 @@ information provided here is intended especially for developers.
* The core/event::getLegacyEvents() function has been deprecated and should no longer be used.
* Typo3 has now been removed. Use native mbstring or iconv functions.
* A new index has been added on mdl_user_preferences.name. This upgrade step might take some time on big sites.
* @babel/polyfill has been removed in favour of corejs@3
=== 3.11 ===
* PHPUnit has been upgraded to 9.5 (see MDL-71036 for details).