zephyr-xpack-internal
Version:
Xpack internals for Zephyr
115 lines (114 loc) • 3.61 kB
JavaScript
;
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, getters, values)=>{
var define = (defs, kind)=>{
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
[kind]: defs[key]
});
};
define(getters, "get");
define(values, "value");
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
isLegacyMFPlugin: ()=>isLegacyMFPlugin
});
const external_zephyr_agent_namespaceObject = require("zephyr-agent");
const external_extract_federation_config_js_namespaceObject = require("./extract-federation-config.js");
function isLegacyMFPlugin(plugin) {
const options = (0, external_extract_federation_config_js_namespaceObject.extractFederatedConfig)(plugin);
if (!options) {
external_zephyr_agent_namespaceObject.ze_log.mf('Not a Module Federation plugin');
return false;
}
if ('ModuleFederationPlugin' !== plugin.constructor.name) {
external_zephyr_agent_namespaceObject.ze_log.mf('Non-legacy Module Federation plugin identified. Current plugin name: ', plugin.constructor.name);
return false;
}
if ('name' in plugin) {
external_zephyr_agent_namespaceObject.ze_log.mf('Non-legacy Module Federation plugin identified. Plugin has "name" property: ', plugin.name);
return false;
}
const enhancedFeaturesChecks = [
[
plugin,
'getRemoteEntryUrls',
'function'
],
[
plugin,
'getContainerEntryModule',
'function'
],
[
plugin,
'invalidateRemote',
'function'
],
[
plugin,
'statsResourceInfo'
],
[
plugin,
'getStats',
'function'
],
[
options,
'experiments'
],
[
options,
'runtimePlugins'
],
[
options,
'enhanced'
],
[
plugin,
'_experiments'
],
[
plugin,
'_enhanced'
]
];
for (const check of enhancedFeaturesChecks)if (hasProperty(...check)) {
external_zephyr_agent_namespaceObject.ze_log.mf('Non-legacy Module Federation plugin identified. Plugin contains property: ', check[1]);
return false;
}
return true;
}
const hasProperty = (target, property, type)=>{
const hasProp = property in target;
if (!(property in target)) return false;
if (type) return typeof target[property] === type;
return hasProp;
};
exports.isLegacyMFPlugin = __webpack_exports__.isLegacyMFPlugin;
for(var __rspack_i in __webpack_exports__)if (-1 === [
"isLegacyMFPlugin"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
value: true
});
//# sourceMappingURL=is-legacy-mf-plugin.js.map