Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
import type { Command } from 'commander';
export declare const applyCommonOptions: (command: Command) => void;

View File

@@ -0,0 +1,68 @@
"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/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__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
applyCommonOptions: () => (applyCommonOptions)
});
const applyCommonOptions = (command)=>{
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path');
command.option('-m --mode <mode>', 'Specify the runtime environment. You can choose "dev" or "prod". The default value is "dev". After setting, the process.env.NODE_ENV environment variable will be automatically injected with "development" or "production" according to the value.', (value)=>{
const validChoices = {
dev: 'development',
prod: 'production'
};
if (!Object.keys(validChoices).includes(value)) {
throw new Error(`Invalid mode: ${value}. Valid choices are: ${Object.keys(validChoices).join(', ')}`);
}
const targetEnv = validChoices[value];
if (process.env.NODE_ENV !== targetEnv) {
console.log(`process.env.NODE_ENV is set to ${targetEnv}`);
}
process.env.NODE_ENV = targetEnv;
return value;
}, 'dev');
};
exports.applyCommonOptions = __webpack_exports__.applyCommonOptions;
for(var __webpack_i__ in __webpack_exports__) {
if(["applyCommonOptions"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,4 @@
import { type Logger } from '@module-federation/sdk';
export declare const PREFIX = "[ Module Federation CLI ]";
declare const logger: Logger;
export default logger;

View File

@@ -0,0 +1,69 @@
"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/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__, {
PREFIX: () => (/* binding */ PREFIX),
"default": () => (/* binding */ utils_logger)
});
;// CONCATENATED MODULE: external "node:util"
const external_node_util_namespaceObject = require("node:util");
;// CONCATENATED MODULE: external "@module-federation/sdk"
const sdk_namespaceObject = require("@module-federation/sdk");
;// CONCATENATED MODULE: ./src/utils/logger.ts
const PREFIX = '[ Module Federation CLI ]';
const logger = (0,sdk_namespaceObject.createLogger)((0,external_node_util_namespaceObject.styleText)([
'bold',
'cyan'
], PREFIX));
/* ESM default export */ const utils_logger = (logger);
exports.PREFIX = __webpack_exports__.PREFIX;
exports["default"] = __webpack_exports__["default"];
for(var __webpack_i__ in __webpack_exports__) {
if(["PREFIX","default"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,2 @@
import type { CliOptions } from '../types';
export declare function prepareCli({ welcomeMsg }: Required<CliOptions>): void;

View File

@@ -0,0 +1,83 @@
"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__, {
prepareCli: () => (/* binding */ prepareCli)
});
;// CONCATENATED MODULE: external "./logger.js"
const external_logger_js_namespaceObject = require("./logger.js");
var external_logger_js_default = /*#__PURE__*/__webpack_require__.n(external_logger_js_namespaceObject);
;// CONCATENATED MODULE: ./src/utils/prepare.ts
function prepareCli({ welcomeMsg }) {
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = 'development';
}
// Print a blank line to keep the greet log nice.
// Some package managers automatically output a blank line, some do not.
const { npm_execpath } = process.env;
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) {
console.log();
}
external_logger_js_default().info(welcomeMsg);
}
exports.prepareCli = __webpack_exports__.prepareCli;
for(var __webpack_i__ in __webpack_exports__) {
if(["prepareCli"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,3 @@
import type { moduleFederationPlugin } from '@module-federation/sdk';
export declare const getConfigPath: (userConfigPath?: string) => string;
export declare function readConfig(userConfigPath?: string): Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;

View File

@@ -0,0 +1,91 @@
"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__, {
getConfigPath: () => (/* binding */ getConfigPath),
readConfig: () => (/* binding */ readConfig)
});
;// CONCATENATED MODULE: external "path"
const external_path_namespaceObject = require("path");
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
;// CONCATENATED MODULE: external "jiti"
const external_jiti_namespaceObject = require("jiti");
;// CONCATENATED MODULE: ./src/utils/readConfig.ts
const DEFAULT_CONFIG_PATH = 'module-federation.config.ts';
const getConfigPath = (userConfigPath)=>{
const defaultPath = external_path_default().resolve(process.cwd(), DEFAULT_CONFIG_PATH);
const filepath = userConfigPath ?? defaultPath;
return external_path_default().isAbsolute(filepath) ? filepath : external_path_default().resolve(process.cwd(), filepath);
};
async function readConfig(userConfigPath) {
const configPath = getConfigPath(userConfigPath);
const jit = (0,external_jiti_namespaceObject.createJiti)(__filename, {
interopDefault: true
});
const configModule = await jit(configPath);
const resolvedConfig = configModule && typeof configModule === 'object' && 'default' in configModule ? configModule.default : configModule;
return resolvedConfig;
}
exports.getConfigPath = __webpack_exports__.getConfigPath;
exports.readConfig = __webpack_exports__.readConfig;
for(var __webpack_i__ in __webpack_exports__) {
if(["getConfigPath","readConfig"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });