-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build: Prepare for more Script Modules
This is a companion to WordPress/gutenberg#65460 that requires syncing in WordPress Core. Namely, the block-library changes require registration with their updated script module IDs so that the blocks continue to work correctly. They key improvement is script modules registration is handled in one central place, and a combined asset file is used to improve the performance by avoiding multiple disk operations for every individual file. Props jonsurrell, gziolo, wildworks, noisysocks. See #60647, #59462. Built from https://develop.svn.wordpress.org/trunk@59083 git-svn-id: http://core.svn.wordpress.org/trunk@58479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Loading branch information
Showing
25 changed files
with
3,679 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('interactivity/index.min.js' => array('dependencies' => array(), 'version' => '2d6d1fdbcb3fda39c768', 'type' => 'module'), 'interactivity/debug.min.js' => array('dependencies' => array(), 'version' => '1ccc67b05c275e51a8f8', 'type' => 'module'), 'interactivity-router/index.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '64645ef3cd2d32860d7d', 'type' => 'module'), 'block-library/file/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'fdc2f6842e015af83140', 'type' => 'module'), 'block-library/image/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'acfec7b3c0be4a859b31', 'type' => 'module'), 'block-library/navigation/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '8ff192874fc8910a284c', 'type' => 'module'), 'block-library/query/view.min.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => 'f4c91c89fa5271f3dad9', 'type' => 'module'), 'block-library/search/view.min.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '2a73400a693958f604de', 'type' => 'module')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('interactivity/index.js' => array('dependencies' => array(), 'version' => 'ff86b5988014bd364de8', 'type' => 'module'), 'interactivity/debug.js' => array('dependencies' => array(), 'version' => 'd05372e68bd7a4cb0676', 'type' => 'module'), 'interactivity-router/index.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'd76e562ff4609c2ae7fc', 'type' => 'module'), 'block-library/file/view.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'b0cd471b6fde34702d88', 'type' => 'module'), 'block-library/image/view.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'e1ce544dd878f3a09f70', 'type' => 'module'), 'block-library/navigation/view.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => '9510985aedc1f8e088f3', 'type' => 'module'), 'block-library/query/view.js' => array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => '8e6f28f734f3c306b648', 'type' => 'module'), 'block-library/search/view.js' => array('dependencies' => array('@wordpress/interactivity'), 'version' => 'acdb7febda1392ad28de', 'type' => 'module')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
97 changes: 97 additions & 0 deletions
97
wp-includes/js/dist/script-modules/block-library/file/view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; | ||
/******/ // The require scope | ||
/******/ var __webpack_require__ = {}; | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
|
||
;// CONCATENATED MODULE: external "@wordpress/interactivity" | ||
var x = (y) => { | ||
var x = {}; __webpack_require__.d(x, y); return x | ||
} | ||
var y = (x) => (() => (x)) | ||
const interactivity_namespaceObject = x({ ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) }); | ||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js | ||
/** | ||
* Uses a combination of user agent matching and feature detection to determine whether | ||
* the current browser supports rendering PDFs inline. | ||
* | ||
* @return {boolean} Whether or not the browser supports inline PDFs. | ||
*/ | ||
const browserSupportsPdfs = () => { | ||
// Most mobile devices include "Mobi" in their UA. | ||
if (window.navigator.userAgent.indexOf('Mobi') > -1) { | ||
return false; | ||
} | ||
|
||
// Android tablets are the noteable exception. | ||
if (window.navigator.userAgent.indexOf('Android') > -1) { | ||
return false; | ||
} | ||
|
||
// iPad pretends to be a Mac. | ||
if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) { | ||
return false; | ||
} | ||
|
||
// IE only supports PDFs when there's an ActiveX object available for it. | ||
if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
/** | ||
* Helper function for creating ActiveX objects, catching any errors that are thrown | ||
* when it's generated. | ||
* | ||
* @param {string} type The name of the ActiveX object to create. | ||
* @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed. | ||
*/ | ||
const createActiveXObject = type => { | ||
let ax; | ||
try { | ||
ax = new window.ActiveXObject(type); | ||
} catch (e) { | ||
ax = undefined; | ||
} | ||
return ax; | ||
}; | ||
|
||
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/view.js | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
|
||
(0,interactivity_namespaceObject.store)('core/file', { | ||
state: { | ||
get hasPdfPreview() { | ||
return browserSupportsPdfs(); | ||
} | ||
} | ||
}, { | ||
lock: true | ||
}); | ||
|
1 change: 1 addition & 0 deletions
1
wp-includes/js/dist/script-modules/block-library/file/view.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.