Files
emaui/node_modules/@module-federation/cli/dist/cli.js
2026-05-29 15:23:46 +03:00

124 lines
4.7 KiB
JavaScript

"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/compat_get_default_export
(() => {
// getDefaultExport function for compatibility with non-ESM modules
__webpack_require__.n = (module) => {
var getter = module && module.__esModule ?
() => (module['default']) :
() => (module);
__webpack_require__.d(getter, { a: getter });
return getter;
};
})();
// webpack/runtime/define_property_getters
(() => {
__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/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
runCli: () => (/* binding */ runCli)
});
;// CONCATENATED MODULE: external "commander"
const external_commander_namespaceObject = require("commander");
;// CONCATENATED MODULE: external "./utils/apply-common-options.js"
const apply_common_options_js_namespaceObject = require("./utils/apply-common-options.js");
;// CONCATENATED MODULE: external "./commands/dts.js"
const dts_js_namespaceObject = require("./commands/dts.js");
;// CONCATENATED MODULE: external "./utils/prepare.js"
const prepare_js_namespaceObject = require("./utils/prepare.js");
;// CONCATENATED MODULE: external "./utils/logger.js"
const logger_js_namespaceObject = require("./utils/logger.js");
var logger_js_default = /*#__PURE__*/__webpack_require__.n(logger_js_namespaceObject);
;// CONCATENATED MODULE: external "./utils/readConfig.js"
const readConfig_js_namespaceObject = require("./utils/readConfig.js");
;// CONCATENATED MODULE: ./src/cli.ts
function cli(cliOptions) {
const { name, version, applyCommands } = cliOptions;
external_commander_namespaceObject.program.name(name).usage('<command> [options]').version(version);
const dtsCommand = external_commander_namespaceObject.program.command('dts');
dtsCommand.option('--root <root>', 'specify the project root directory').option('--output <output>', 'specify the generated dts output directory').option('--fetch <boolean>', 'fetch types from remote, default is true', (value)=>value === 'true', true).option('--generate <boolean>', 'generate types, default is true', (value)=>value === 'true', true);
(0,apply_common_options_js_namespaceObject.applyCommonOptions)(dtsCommand);
dtsCommand.description('generate or fetch the mf types').action(async (options)=>{
try {
await (0,dts_js_namespaceObject.dts)(options, cliOptions);
} catch (err) {
console.error(err);
process.exit(1);
}
});
if (typeof applyCommands === 'function') {
applyCommands(external_commander_namespaceObject.program, apply_common_options_js_namespaceObject.applyCommonOptions);
}
external_commander_namespaceObject.program.parse();
}
function runCli(options) {
const normalizedOptions = {
loggerPrefix: logger_js_namespaceObject.PREFIX,
welcomeMsg: `${`Module Federation v${"2.5.0"}`}\n`,
name: 'mf',
readConfig: readConfig_js_namespaceObject.readConfig,
version: "2.5.0",
applyCommands: ()=>{},
...options
};
logger_js_default().setPrefix(normalizedOptions.loggerPrefix);
(0,prepare_js_namespaceObject.prepareCli)(normalizedOptions);
try {
cli(normalizedOptions);
} catch (err) {
console.error(err);
}
}
exports.runCli = __webpack_exports__.runCli;
for(var __webpack_i__ in __webpack_exports__) {
if(["runCli"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });