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

21
node_modules/@module-federation/error-codes/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson) Zhou Shaw (zhouxiao)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1 @@
# `@module-federation/error-codes`

View File

@@ -0,0 +1,84 @@
//#region src/MFContext.d.ts
type PackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
type MFRole = 'host' | 'remote' | 'host+remote' | 'unknown';
type BundlerName = 'webpack' | 'rspack' | 'rsbuild' | 'vite' | 'unknown';
/** A single remote entry, mirrors runtime-core's Remote type (simplified for diagnostics) */
interface MFRemoteEntry {
name: string;
alias?: string;
/** URL or version string */
entry?: string;
version?: string;
type?: string;
entryGlobalName?: string;
shareScope?: string | string[];
}
/** Shared package entry, mirrors runtime-core's SharedConfig (simplified) */
interface MFSharedEntry {
version?: string;
singleton?: boolean;
requiredVersion?: string | false;
eager?: boolean;
strictVersion?: boolean;
}
/** Module Federation plugin configuration, extracted from bundler config file */
interface MFConfigInfo {
name?: string;
filename?: string;
remotes?: MFRemoteEntry[];
exposes?: Record<string, string>;
shared?: Record<string, MFSharedEntry>;
}
/** Basic project metadata */
interface MFProjectInfo {
name?: string;
root?: string;
packageManager?: PackageManager;
mfRole?: MFRole;
}
/** Bundler in use */
interface MFBundlerInfo {
name?: BundlerName;
configFile?: string;
version?: string;
}
/** Runtime environment snapshot */
interface MFEnvironmentInfo {
nodeVersion?: string;
os?: string;
isCI?: boolean;
}
/** Most recent observability event (from .mf/observability/latest.json) */
interface MFLatestErrorEvent {
code: string;
message: string;
args?: Record<string, unknown>;
timestamp: number;
}
/** Build artifacts from dist/ */
interface MFBuildArtifacts {
manifest?: Record<string, unknown>;
stats?: Record<string, unknown>;
}
/**
* Module Federation context.
*
* Produced by the `mf-context` Claude skill for full project analysis,
* or contributed partially by the runtime when an error occurs (only fields
* known at the time of the error are set).
*
* All fields are optional so both full and partial contexts are valid.
*/
interface MFContext {
project?: MFProjectInfo;
bundler?: MFBundlerInfo;
mfConfig?: MFConfigInfo;
/** Installed dependency versions: packageName → version */
dependencies?: Record<string, string>;
environment?: MFEnvironmentInfo;
latestErrorEvent?: MFLatestErrorEvent;
buildArtifacts?: MFBuildArtifacts;
}
//#endregion
export { BundlerName, MFBuildArtifacts, MFBundlerInfo, MFConfigInfo, MFContext, MFEnvironmentInfo, MFLatestErrorEvent, MFProjectInfo, MFRemoteEntry, MFRole, MFSharedEntry, PackageManager };
//# sourceMappingURL=MFContext.d.mts.map

View File

@@ -0,0 +1,84 @@
//#region src/MFContext.d.ts
type PackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
type MFRole = 'host' | 'remote' | 'host+remote' | 'unknown';
type BundlerName = 'webpack' | 'rspack' | 'rsbuild' | 'vite' | 'unknown';
/** A single remote entry, mirrors runtime-core's Remote type (simplified for diagnostics) */
interface MFRemoteEntry {
name: string;
alias?: string;
/** URL or version string */
entry?: string;
version?: string;
type?: string;
entryGlobalName?: string;
shareScope?: string | string[];
}
/** Shared package entry, mirrors runtime-core's SharedConfig (simplified) */
interface MFSharedEntry {
version?: string;
singleton?: boolean;
requiredVersion?: string | false;
eager?: boolean;
strictVersion?: boolean;
}
/** Module Federation plugin configuration, extracted from bundler config file */
interface MFConfigInfo {
name?: string;
filename?: string;
remotes?: MFRemoteEntry[];
exposes?: Record<string, string>;
shared?: Record<string, MFSharedEntry>;
}
/** Basic project metadata */
interface MFProjectInfo {
name?: string;
root?: string;
packageManager?: PackageManager;
mfRole?: MFRole;
}
/** Bundler in use */
interface MFBundlerInfo {
name?: BundlerName;
configFile?: string;
version?: string;
}
/** Runtime environment snapshot */
interface MFEnvironmentInfo {
nodeVersion?: string;
os?: string;
isCI?: boolean;
}
/** Most recent observability event (from .mf/observability/latest.json) */
interface MFLatestErrorEvent {
code: string;
message: string;
args?: Record<string, unknown>;
timestamp: number;
}
/** Build artifacts from dist/ */
interface MFBuildArtifacts {
manifest?: Record<string, unknown>;
stats?: Record<string, unknown>;
}
/**
* Module Federation context.
*
* Produced by the `mf-context` Claude skill for full project analysis,
* or contributed partially by the runtime when an error occurs (only fields
* known at the time of the error are set).
*
* All fields are optional so both full and partial contexts are valid.
*/
interface MFContext {
project?: MFProjectInfo;
bundler?: MFBundlerInfo;
mfConfig?: MFConfigInfo;
/** Installed dependency versions: packageName → version */
dependencies?: Record<string, string>;
environment?: MFEnvironmentInfo;
latestErrorEvent?: MFLatestErrorEvent;
buildArtifacts?: MFBuildArtifacts;
}
//#endregion
export { BundlerName, MFBuildArtifacts, MFBundlerInfo, MFConfigInfo, MFContext, MFEnvironmentInfo, MFLatestErrorEvent, MFProjectInfo, MFRemoteEntry, MFRole, MFSharedEntry, PackageManager };
//# sourceMappingURL=MFContext.d.ts.map

View File

@@ -0,0 +1,29 @@
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) {
__defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
}
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
exports.__toESM = __toESM;

View File

@@ -0,0 +1,11 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_getShortErrorMsg = require('./getShortErrorMsg.cjs');
//#region src/browser.ts
function logAndReport(code, descMap, args, logger, originalErrorMsg, context) {
return logger(require_getShortErrorMsg.getShortErrorMsg(code, descMap, args, originalErrorMsg));
}
//#endregion
exports.logAndReport = logAndReport;
//# sourceMappingURL=browser.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.cjs","names":["getShortErrorMsg"],"sources":["../src/browser.ts"],"sourcesContent":["import { getShortErrorMsg } from './getShortErrorMsg';\nimport type { MFContext } from './MFContext';\n\nexport function logAndReport<T extends (msg: string) => unknown>(\n code: string,\n descMap: Record<string, string>,\n args: Record<string, unknown>,\n logger: T,\n originalErrorMsg?: string,\n context?: Partial<MFContext>,\n): ReturnType<T> {\n const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);\n return logger(msg) as ReturnType<T>;\n}\n"],"mappings":";;;;AAGA,SAAgB,aACd,MACA,SACA,MACA,QACA,kBACA,SACe;AAEf,QAAO,OADKA,0CAAiB,MAAM,SAAS,MAAM,iBAAiB,CACjD"}

View File

@@ -0,0 +1,7 @@
import { MFContext } from "./MFContext.mjs";
//#region src/browser.d.ts
declare function logAndReport<T extends (msg: string) => unknown>(code: string, descMap: Record<string, string>, args: Record<string, unknown>, logger: T, originalErrorMsg?: string, context?: Partial<MFContext>): ReturnType<T>;
//#endregion
export { logAndReport };
//# sourceMappingURL=browser.d.mts.map

View File

@@ -0,0 +1,7 @@
import { MFContext } from "./MFContext.js";
//#region src/browser.d.ts
declare function logAndReport<T extends (msg: string) => unknown>(code: string, descMap: Record<string, string>, args: Record<string, unknown>, logger: T, originalErrorMsg?: string, context?: Partial<MFContext>): ReturnType<T>;
//#endregion
export { logAndReport };
//# sourceMappingURL=browser.d.ts.map

View File

@@ -0,0 +1,10 @@
import { getShortErrorMsg } from "./getShortErrorMsg.mjs";
//#region src/browser.ts
function logAndReport(code, descMap, args, logger, originalErrorMsg, context) {
return logger(getShortErrorMsg(code, descMap, args, originalErrorMsg));
}
//#endregion
export { logAndReport };
//# sourceMappingURL=browser.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"browser.mjs","names":[],"sources":["../src/browser.ts"],"sourcesContent":["import { getShortErrorMsg } from './getShortErrorMsg';\nimport type { MFContext } from './MFContext';\n\nexport function logAndReport<T extends (msg: string) => unknown>(\n code: string,\n descMap: Record<string, string>,\n args: Record<string, unknown>,\n logger: T,\n originalErrorMsg?: string,\n context?: Partial<MFContext>,\n): ReturnType<T> {\n const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);\n return logger(msg) as ReturnType<T>;\n}\n"],"mappings":";;;AAGA,SAAgB,aACd,MACA,SACA,MACA,QACA,kBACA,SACe;AAEf,QAAO,OADK,iBAAiB,MAAM,SAAS,MAAM,iBAAiB,CACjD"}

View File

@@ -0,0 +1,37 @@
const require_error_codes = require('./error-codes.cjs');
//#region src/desc.ts
const runtimeDescMap = {
[require_error_codes.RUNTIME_001]: "Failed to get remoteEntry exports.",
[require_error_codes.RUNTIME_002]: "The remote entry interface does not contain \"init\"",
[require_error_codes.RUNTIME_003]: "Failed to get manifest.",
[require_error_codes.RUNTIME_004]: "Failed to locate remote.",
[require_error_codes.RUNTIME_005]: "Invalid loadShareSync function call from bundler runtime",
[require_error_codes.RUNTIME_006]: "Invalid loadShareSync function call from runtime",
[require_error_codes.RUNTIME_007]: "Failed to get remote snapshot.",
[require_error_codes.RUNTIME_008]: "Failed to load script resources.",
[require_error_codes.RUNTIME_009]: "Please call createInstance first.",
[require_error_codes.RUNTIME_010]: "The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.",
[require_error_codes.RUNTIME_011]: "The remoteEntry URL is missing from the remote snapshot.",
[require_error_codes.RUNTIME_012]: "The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib.",
[require_error_codes.RUNTIME_013]: "The manifest is not a valid Module Federation manifest.",
[require_error_codes.RUNTIME_014]: "The remote does not expose the requested module.",
[require_error_codes.RUNTIME_015]: "Remote container initialization failed."
};
const typeDescMap = { [require_error_codes.TYPE_001]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error." };
const buildDescMap = {
[require_error_codes.BUILD_001]: "Failed to find expose module.",
[require_error_codes.BUILD_002]: "PublicPath is required in prod mode."
};
const errorDescMap = {
...runtimeDescMap,
...typeDescMap,
...buildDescMap
};
//#endregion
exports.buildDescMap = buildDescMap;
exports.errorDescMap = errorDescMap;
exports.runtimeDescMap = runtimeDescMap;
exports.typeDescMap = typeDescMap;
//# sourceMappingURL=desc.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"desc.cjs","names":["RUNTIME_001","RUNTIME_002","RUNTIME_003","RUNTIME_004","RUNTIME_005","RUNTIME_006","RUNTIME_007","RUNTIME_008","RUNTIME_009","RUNTIME_010","RUNTIME_011","RUNTIME_012","RUNTIME_013","RUNTIME_014","RUNTIME_015","TYPE_001","BUILD_001","BUILD_002"],"sources":["../src/desc.ts"],"sourcesContent":["import {\n RUNTIME_001,\n RUNTIME_002,\n RUNTIME_003,\n RUNTIME_004,\n RUNTIME_005,\n RUNTIME_006,\n RUNTIME_007,\n RUNTIME_008,\n RUNTIME_009,\n RUNTIME_010,\n RUNTIME_011,\n RUNTIME_012,\n RUNTIME_013,\n RUNTIME_014,\n RUNTIME_015,\n TYPE_001,\n BUILD_001,\n BUILD_002,\n} from './error-codes';\n\nexport const runtimeDescMap = {\n [RUNTIME_001]: 'Failed to get remoteEntry exports.',\n [RUNTIME_002]: 'The remote entry interface does not contain \"init\"',\n [RUNTIME_003]: 'Failed to get manifest.',\n [RUNTIME_004]: 'Failed to locate remote.',\n [RUNTIME_005]: 'Invalid loadShareSync function call from bundler runtime',\n [RUNTIME_006]: 'Invalid loadShareSync function call from runtime',\n [RUNTIME_007]: 'Failed to get remote snapshot.',\n [RUNTIME_008]: 'Failed to load script resources.',\n [RUNTIME_009]: 'Please call createInstance first.',\n [RUNTIME_010]:\n 'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.',\n [RUNTIME_011]: 'The remoteEntry URL is missing from the remote snapshot.',\n [RUNTIME_012]:\n 'The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib.',\n [RUNTIME_013]: 'The manifest is not a valid Module Federation manifest.',\n [RUNTIME_014]: 'The remote does not expose the requested module.',\n [RUNTIME_015]: 'Remote container initialization failed.',\n};\n\nexport const typeDescMap = {\n [TYPE_001]:\n 'Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.',\n};\n\nexport const buildDescMap = {\n [BUILD_001]: 'Failed to find expose module.',\n [BUILD_002]: 'PublicPath is required in prod mode.',\n};\n\nexport const errorDescMap = {\n ...runtimeDescMap,\n ...typeDescMap,\n ...buildDescMap,\n};\n"],"mappings":";;;AAqBA,MAAa,iBAAiB;EAC3BA,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;EACdC,kCACC;EACDC,kCAAc;EACdC,kCACC;EACDC,kCAAc;EACdC,kCAAc;EACdC,kCAAc;CAChB;AAED,MAAa,cAAc,GACxBC,+BACC,8FACH;AAED,MAAa,eAAe;EACzBC,gCAAY;EACZC,gCAAY;CACd;AAED,MAAa,eAAe;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACJ"}

View File

@@ -0,0 +1,48 @@
//#region src/desc.d.ts
declare const runtimeDescMap: {
"RUNTIME-001": string;
"RUNTIME-002": string;
"RUNTIME-003": string;
"RUNTIME-004": string;
"RUNTIME-005": string;
"RUNTIME-006": string;
"RUNTIME-007": string;
"RUNTIME-008": string;
"RUNTIME-009": string;
"RUNTIME-010": string;
"RUNTIME-011": string;
"RUNTIME-012": string;
"RUNTIME-013": string;
"RUNTIME-014": string;
"RUNTIME-015": string;
};
declare const typeDescMap: {
"TYPE-001": string;
};
declare const buildDescMap: {
"BUILD-001": string;
"BUILD-002": string;
};
declare const errorDescMap: {
"BUILD-001": string;
"BUILD-002": string;
"TYPE-001": string;
"RUNTIME-001": string;
"RUNTIME-002": string;
"RUNTIME-003": string;
"RUNTIME-004": string;
"RUNTIME-005": string;
"RUNTIME-006": string;
"RUNTIME-007": string;
"RUNTIME-008": string;
"RUNTIME-009": string;
"RUNTIME-010": string;
"RUNTIME-011": string;
"RUNTIME-012": string;
"RUNTIME-013": string;
"RUNTIME-014": string;
"RUNTIME-015": string;
};
//#endregion
export { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap };
//# sourceMappingURL=desc.d.mts.map

View File

@@ -0,0 +1,48 @@
//#region src/desc.d.ts
declare const runtimeDescMap: {
"RUNTIME-001": string;
"RUNTIME-002": string;
"RUNTIME-003": string;
"RUNTIME-004": string;
"RUNTIME-005": string;
"RUNTIME-006": string;
"RUNTIME-007": string;
"RUNTIME-008": string;
"RUNTIME-009": string;
"RUNTIME-010": string;
"RUNTIME-011": string;
"RUNTIME-012": string;
"RUNTIME-013": string;
"RUNTIME-014": string;
"RUNTIME-015": string;
};
declare const typeDescMap: {
"TYPE-001": string;
};
declare const buildDescMap: {
"BUILD-001": string;
"BUILD-002": string;
};
declare const errorDescMap: {
"BUILD-001": string;
"BUILD-002": string;
"TYPE-001": string;
"RUNTIME-001": string;
"RUNTIME-002": string;
"RUNTIME-003": string;
"RUNTIME-004": string;
"RUNTIME-005": string;
"RUNTIME-006": string;
"RUNTIME-007": string;
"RUNTIME-008": string;
"RUNTIME-009": string;
"RUNTIME-010": string;
"RUNTIME-011": string;
"RUNTIME-012": string;
"RUNTIME-013": string;
"RUNTIME-014": string;
"RUNTIME-015": string;
};
//#endregion
export { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap };
//# sourceMappingURL=desc.d.ts.map

View File

@@ -0,0 +1,34 @@
import { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 } from "./error-codes.mjs";
//#region src/desc.ts
const runtimeDescMap = {
[RUNTIME_001]: "Failed to get remoteEntry exports.",
[RUNTIME_002]: "The remote entry interface does not contain \"init\"",
[RUNTIME_003]: "Failed to get manifest.",
[RUNTIME_004]: "Failed to locate remote.",
[RUNTIME_005]: "Invalid loadShareSync function call from bundler runtime",
[RUNTIME_006]: "Invalid loadShareSync function call from runtime",
[RUNTIME_007]: "Failed to get remote snapshot.",
[RUNTIME_008]: "Failed to load script resources.",
[RUNTIME_009]: "Please call createInstance first.",
[RUNTIME_010]: "The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.",
[RUNTIME_011]: "The remoteEntry URL is missing from the remote snapshot.",
[RUNTIME_012]: "The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib.",
[RUNTIME_013]: "The manifest is not a valid Module Federation manifest.",
[RUNTIME_014]: "The remote does not expose the requested module.",
[RUNTIME_015]: "Remote container initialization failed."
};
const typeDescMap = { [TYPE_001]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error." };
const buildDescMap = {
[BUILD_001]: "Failed to find expose module.",
[BUILD_002]: "PublicPath is required in prod mode."
};
const errorDescMap = {
...runtimeDescMap,
...typeDescMap,
...buildDescMap
};
//#endregion
export { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap };
//# sourceMappingURL=desc.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"desc.mjs","names":[],"sources":["../src/desc.ts"],"sourcesContent":["import {\n RUNTIME_001,\n RUNTIME_002,\n RUNTIME_003,\n RUNTIME_004,\n RUNTIME_005,\n RUNTIME_006,\n RUNTIME_007,\n RUNTIME_008,\n RUNTIME_009,\n RUNTIME_010,\n RUNTIME_011,\n RUNTIME_012,\n RUNTIME_013,\n RUNTIME_014,\n RUNTIME_015,\n TYPE_001,\n BUILD_001,\n BUILD_002,\n} from './error-codes';\n\nexport const runtimeDescMap = {\n [RUNTIME_001]: 'Failed to get remoteEntry exports.',\n [RUNTIME_002]: 'The remote entry interface does not contain \"init\"',\n [RUNTIME_003]: 'Failed to get manifest.',\n [RUNTIME_004]: 'Failed to locate remote.',\n [RUNTIME_005]: 'Invalid loadShareSync function call from bundler runtime',\n [RUNTIME_006]: 'Invalid loadShareSync function call from runtime',\n [RUNTIME_007]: 'Failed to get remote snapshot.',\n [RUNTIME_008]: 'Failed to load script resources.',\n [RUNTIME_009]: 'Please call createInstance first.',\n [RUNTIME_010]:\n 'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.',\n [RUNTIME_011]: 'The remoteEntry URL is missing from the remote snapshot.',\n [RUNTIME_012]:\n 'The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib.',\n [RUNTIME_013]: 'The manifest is not a valid Module Federation manifest.',\n [RUNTIME_014]: 'The remote does not expose the requested module.',\n [RUNTIME_015]: 'Remote container initialization failed.',\n};\n\nexport const typeDescMap = {\n [TYPE_001]:\n 'Failed to generate type declaration. Execute the below cmd to reproduce and fix the error.',\n};\n\nexport const buildDescMap = {\n [BUILD_001]: 'Failed to find expose module.',\n [BUILD_002]: 'PublicPath is required in prod mode.',\n};\n\nexport const errorDescMap = {\n ...runtimeDescMap,\n ...typeDescMap,\n ...buildDescMap,\n};\n"],"mappings":";;;AAqBA,MAAa,iBAAiB;EAC3B,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cACC;EACD,cAAc;EACd,cACC;EACD,cAAc;EACd,cAAc;EACd,cAAc;CAChB;AAED,MAAa,cAAc,GACxB,WACC,8FACH;AAED,MAAa,eAAe;EACzB,YAAY;EACZ,YAAY;CACd;AAED,MAAa,eAAe;CAC1B,GAAG;CACH,GAAG;CACH,GAAG;CACJ"}

View File

@@ -0,0 +1,41 @@
//#region src/error-codes.ts
const RUNTIME_001 = "RUNTIME-001";
const RUNTIME_002 = "RUNTIME-002";
const RUNTIME_003 = "RUNTIME-003";
const RUNTIME_004 = "RUNTIME-004";
const RUNTIME_005 = "RUNTIME-005";
const RUNTIME_006 = "RUNTIME-006";
const RUNTIME_007 = "RUNTIME-007";
const RUNTIME_008 = "RUNTIME-008";
const RUNTIME_009 = "RUNTIME-009";
const RUNTIME_010 = "RUNTIME-010";
const RUNTIME_011 = "RUNTIME-011";
const RUNTIME_012 = "RUNTIME-012";
const RUNTIME_013 = "RUNTIME-013";
const RUNTIME_014 = "RUNTIME-014";
const RUNTIME_015 = "RUNTIME-015";
const TYPE_001 = "TYPE-001";
const BUILD_001 = "BUILD-001";
const BUILD_002 = "BUILD-002";
//#endregion
exports.BUILD_001 = BUILD_001;
exports.BUILD_002 = BUILD_002;
exports.RUNTIME_001 = RUNTIME_001;
exports.RUNTIME_002 = RUNTIME_002;
exports.RUNTIME_003 = RUNTIME_003;
exports.RUNTIME_004 = RUNTIME_004;
exports.RUNTIME_005 = RUNTIME_005;
exports.RUNTIME_006 = RUNTIME_006;
exports.RUNTIME_007 = RUNTIME_007;
exports.RUNTIME_008 = RUNTIME_008;
exports.RUNTIME_009 = RUNTIME_009;
exports.RUNTIME_010 = RUNTIME_010;
exports.RUNTIME_011 = RUNTIME_011;
exports.RUNTIME_012 = RUNTIME_012;
exports.RUNTIME_013 = RUNTIME_013;
exports.RUNTIME_014 = RUNTIME_014;
exports.RUNTIME_015 = RUNTIME_015;
exports.TYPE_001 = TYPE_001;
//# sourceMappingURL=error-codes.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error-codes.cjs","names":[],"sources":["../src/error-codes.ts"],"sourcesContent":["export const RUNTIME_001 = 'RUNTIME-001';\nexport const RUNTIME_002 = 'RUNTIME-002';\nexport const RUNTIME_003 = 'RUNTIME-003';\nexport const RUNTIME_004 = 'RUNTIME-004';\nexport const RUNTIME_005 = 'RUNTIME-005';\nexport const RUNTIME_006 = 'RUNTIME-006';\nexport const RUNTIME_007 = 'RUNTIME-007';\nexport const RUNTIME_008 = 'RUNTIME-008';\nexport const RUNTIME_009 = 'RUNTIME-009';\nexport const RUNTIME_010 = 'RUNTIME-010';\nexport const RUNTIME_011 = 'RUNTIME-011';\nexport const RUNTIME_012 = 'RUNTIME-012';\nexport const RUNTIME_013 = 'RUNTIME-013';\nexport const RUNTIME_014 = 'RUNTIME-014';\nexport const RUNTIME_015 = 'RUNTIME-015';\n\nexport const TYPE_001 = 'TYPE-001';\nexport const BUILD_001 = 'BUILD-001';\nexport const BUILD_002 = 'BUILD-002';\n"],"mappings":";;AAAA,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAE3B,MAAa,WAAW;AACxB,MAAa,YAAY;AACzB,MAAa,YAAY"}

View File

@@ -0,0 +1,22 @@
//#region src/error-codes.d.ts
declare const RUNTIME_001 = "RUNTIME-001";
declare const RUNTIME_002 = "RUNTIME-002";
declare const RUNTIME_003 = "RUNTIME-003";
declare const RUNTIME_004 = "RUNTIME-004";
declare const RUNTIME_005 = "RUNTIME-005";
declare const RUNTIME_006 = "RUNTIME-006";
declare const RUNTIME_007 = "RUNTIME-007";
declare const RUNTIME_008 = "RUNTIME-008";
declare const RUNTIME_009 = "RUNTIME-009";
declare const RUNTIME_010 = "RUNTIME-010";
declare const RUNTIME_011 = "RUNTIME-011";
declare const RUNTIME_012 = "RUNTIME-012";
declare const RUNTIME_013 = "RUNTIME-013";
declare const RUNTIME_014 = "RUNTIME-014";
declare const RUNTIME_015 = "RUNTIME-015";
declare const TYPE_001 = "TYPE-001";
declare const BUILD_001 = "BUILD-001";
declare const BUILD_002 = "BUILD-002";
//#endregion
export { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 };
//# sourceMappingURL=error-codes.d.mts.map

View File

@@ -0,0 +1,22 @@
//#region src/error-codes.d.ts
declare const RUNTIME_001 = "RUNTIME-001";
declare const RUNTIME_002 = "RUNTIME-002";
declare const RUNTIME_003 = "RUNTIME-003";
declare const RUNTIME_004 = "RUNTIME-004";
declare const RUNTIME_005 = "RUNTIME-005";
declare const RUNTIME_006 = "RUNTIME-006";
declare const RUNTIME_007 = "RUNTIME-007";
declare const RUNTIME_008 = "RUNTIME-008";
declare const RUNTIME_009 = "RUNTIME-009";
declare const RUNTIME_010 = "RUNTIME-010";
declare const RUNTIME_011 = "RUNTIME-011";
declare const RUNTIME_012 = "RUNTIME-012";
declare const RUNTIME_013 = "RUNTIME-013";
declare const RUNTIME_014 = "RUNTIME-014";
declare const RUNTIME_015 = "RUNTIME-015";
declare const TYPE_001 = "TYPE-001";
declare const BUILD_001 = "BUILD-001";
declare const BUILD_002 = "BUILD-002";
//#endregion
export { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 };
//# sourceMappingURL=error-codes.d.ts.map

View File

@@ -0,0 +1,23 @@
//#region src/error-codes.ts
const RUNTIME_001 = "RUNTIME-001";
const RUNTIME_002 = "RUNTIME-002";
const RUNTIME_003 = "RUNTIME-003";
const RUNTIME_004 = "RUNTIME-004";
const RUNTIME_005 = "RUNTIME-005";
const RUNTIME_006 = "RUNTIME-006";
const RUNTIME_007 = "RUNTIME-007";
const RUNTIME_008 = "RUNTIME-008";
const RUNTIME_009 = "RUNTIME-009";
const RUNTIME_010 = "RUNTIME-010";
const RUNTIME_011 = "RUNTIME-011";
const RUNTIME_012 = "RUNTIME-012";
const RUNTIME_013 = "RUNTIME-013";
const RUNTIME_014 = "RUNTIME-014";
const RUNTIME_015 = "RUNTIME-015";
const TYPE_001 = "TYPE-001";
const BUILD_001 = "BUILD-001";
const BUILD_002 = "BUILD-002";
//#endregion
export { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 };
//# sourceMappingURL=error-codes.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error-codes.mjs","names":[],"sources":["../src/error-codes.ts"],"sourcesContent":["export const RUNTIME_001 = 'RUNTIME-001';\nexport const RUNTIME_002 = 'RUNTIME-002';\nexport const RUNTIME_003 = 'RUNTIME-003';\nexport const RUNTIME_004 = 'RUNTIME-004';\nexport const RUNTIME_005 = 'RUNTIME-005';\nexport const RUNTIME_006 = 'RUNTIME-006';\nexport const RUNTIME_007 = 'RUNTIME-007';\nexport const RUNTIME_008 = 'RUNTIME-008';\nexport const RUNTIME_009 = 'RUNTIME-009';\nexport const RUNTIME_010 = 'RUNTIME-010';\nexport const RUNTIME_011 = 'RUNTIME-011';\nexport const RUNTIME_012 = 'RUNTIME-012';\nexport const RUNTIME_013 = 'RUNTIME-013';\nexport const RUNTIME_014 = 'RUNTIME-014';\nexport const RUNTIME_015 = 'RUNTIME-015';\n\nexport const TYPE_001 = 'TYPE-001';\nexport const BUILD_001 = 'BUILD-001';\nexport const BUILD_002 = 'BUILD-002';\n"],"mappings":";AAAA,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAE3B,MAAa,WAAW;AACxB,MAAa,YAAY;AACzB,MAAa,YAAY"}

View File

@@ -0,0 +1,16 @@
//#region src/getShortErrorMsg.ts
const getDocsUrl = (errorCode) => {
return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${errorCode.split("-")[0].toLowerCase()}#${errorCode.toLowerCase()}`;
};
const getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg) => {
const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];
args && msg.push(`args: ${JSON.stringify(args)}`);
msg.push(getDocsUrl(errorCode));
originalErrorMsg && msg.push(`Original Error Message:\n ${originalErrorMsg}`);
return msg.join("\n");
};
//#endregion
exports.getShortErrorMsg = getShortErrorMsg;
//# sourceMappingURL=getShortErrorMsg.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getShortErrorMsg.cjs","names":[],"sources":["../src/getShortErrorMsg.ts"],"sourcesContent":["const getDocsUrl = (errorCode: string) => {\n const type = errorCode.split('-')[0].toLowerCase();\n return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${type}#${errorCode.toLowerCase()}`;\n};\n\nexport const getShortErrorMsg = (\n errorCode: string,\n errorDescMap: Record<string, string>,\n args?: Record<string, unknown>,\n originalErrorMsg?: string,\n) => {\n const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];\n args && msg.push(`args: ${JSON.stringify(args)}`);\n msg.push(getDocsUrl(errorCode));\n originalErrorMsg && msg.push(`Original Error Message:\\n ${originalErrorMsg}`);\n return msg.join('\\n');\n};\n"],"mappings":";;AAAA,MAAM,cAAc,cAAsB;AAExC,QAAO,yFADM,UAAU,MAAM,IAAI,CAAC,GAAG,aAAa,CACmD,GAAG,UAAU,aAAa;;AAGjI,MAAa,oBACX,WACA,cACA,MACA,qBACG;CACH,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,WAAW,CAAC,IAAI,YAAY;AAC1D,SAAQ,IAAI,KAAK,SAAS,KAAK,UAAU,KAAK,GAAG;AACjD,KAAI,KAAK,WAAW,UAAU,CAAC;AAC/B,qBAAoB,IAAI,KAAK,6BAA6B,mBAAmB;AAC7E,QAAO,IAAI,KAAK,KAAK"}

View File

@@ -0,0 +1,5 @@
//#region src/getShortErrorMsg.d.ts
declare const getShortErrorMsg: (errorCode: string, errorDescMap: Record<string, string>, args?: Record<string, unknown>, originalErrorMsg?: string) => string;
//#endregion
export { getShortErrorMsg };
//# sourceMappingURL=getShortErrorMsg.d.mts.map

View File

@@ -0,0 +1,5 @@
//#region src/getShortErrorMsg.d.ts
declare const getShortErrorMsg: (errorCode: string, errorDescMap: Record<string, string>, args?: Record<string, unknown>, originalErrorMsg?: string) => string;
//#endregion
export { getShortErrorMsg };
//# sourceMappingURL=getShortErrorMsg.d.ts.map

View File

@@ -0,0 +1,15 @@
//#region src/getShortErrorMsg.ts
const getDocsUrl = (errorCode) => {
return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${errorCode.split("-")[0].toLowerCase()}#${errorCode.toLowerCase()}`;
};
const getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg) => {
const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];
args && msg.push(`args: ${JSON.stringify(args)}`);
msg.push(getDocsUrl(errorCode));
originalErrorMsg && msg.push(`Original Error Message:\n ${originalErrorMsg}`);
return msg.join("\n");
};
//#endregion
export { getShortErrorMsg };
//# sourceMappingURL=getShortErrorMsg.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getShortErrorMsg.mjs","names":[],"sources":["../src/getShortErrorMsg.ts"],"sourcesContent":["const getDocsUrl = (errorCode: string) => {\n const type = errorCode.split('-')[0].toLowerCase();\n return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${type}#${errorCode.toLowerCase()}`;\n};\n\nexport const getShortErrorMsg = (\n errorCode: string,\n errorDescMap: Record<string, string>,\n args?: Record<string, unknown>,\n originalErrorMsg?: string,\n) => {\n const msg = [`${[errorDescMap[errorCode]]} #${errorCode}`];\n args && msg.push(`args: ${JSON.stringify(args)}`);\n msg.push(getDocsUrl(errorCode));\n originalErrorMsg && msg.push(`Original Error Message:\\n ${originalErrorMsg}`);\n return msg.join('\\n');\n};\n"],"mappings":";AAAA,MAAM,cAAc,cAAsB;AAExC,QAAO,yFADM,UAAU,MAAM,IAAI,CAAC,GAAG,aAAa,CACmD,GAAG,UAAU,aAAa;;AAGjI,MAAa,oBACX,WACA,cACA,MACA,qBACG;CACH,MAAM,MAAM,CAAC,GAAG,CAAC,aAAa,WAAW,CAAC,IAAI,YAAY;AAC1D,SAAQ,IAAI,KAAK,SAAS,KAAK,UAAU,KAAK,GAAG;AACjD,KAAI,KAAK,WAAW,UAAU,CAAC;AAC/B,qBAAoB,IAAI,KAAK,6BAA6B,mBAAmB;AAC7E,QAAO,IAAI,KAAK,KAAK"}

View File

@@ -0,0 +1,28 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_error_codes = require('./error-codes.cjs');
const require_getShortErrorMsg = require('./getShortErrorMsg.cjs');
const require_desc = require('./desc.cjs');
exports.BUILD_001 = require_error_codes.BUILD_001;
exports.BUILD_002 = require_error_codes.BUILD_002;
exports.RUNTIME_001 = require_error_codes.RUNTIME_001;
exports.RUNTIME_002 = require_error_codes.RUNTIME_002;
exports.RUNTIME_003 = require_error_codes.RUNTIME_003;
exports.RUNTIME_004 = require_error_codes.RUNTIME_004;
exports.RUNTIME_005 = require_error_codes.RUNTIME_005;
exports.RUNTIME_006 = require_error_codes.RUNTIME_006;
exports.RUNTIME_007 = require_error_codes.RUNTIME_007;
exports.RUNTIME_008 = require_error_codes.RUNTIME_008;
exports.RUNTIME_009 = require_error_codes.RUNTIME_009;
exports.RUNTIME_010 = require_error_codes.RUNTIME_010;
exports.RUNTIME_011 = require_error_codes.RUNTIME_011;
exports.RUNTIME_012 = require_error_codes.RUNTIME_012;
exports.RUNTIME_013 = require_error_codes.RUNTIME_013;
exports.RUNTIME_014 = require_error_codes.RUNTIME_014;
exports.RUNTIME_015 = require_error_codes.RUNTIME_015;
exports.TYPE_001 = require_error_codes.TYPE_001;
exports.buildDescMap = require_desc.buildDescMap;
exports.errorDescMap = require_desc.errorDescMap;
exports.getShortErrorMsg = require_getShortErrorMsg.getShortErrorMsg;
exports.runtimeDescMap = require_desc.runtimeDescMap;
exports.typeDescMap = require_desc.typeDescMap;

View File

@@ -0,0 +1,5 @@
import { BundlerName, MFBuildArtifacts, MFBundlerInfo, MFConfigInfo, MFContext, MFEnvironmentInfo, MFLatestErrorEvent, MFProjectInfo, MFRemoteEntry, MFRole, MFSharedEntry, PackageManager } from "./MFContext.mjs";
import { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 } from "./error-codes.mjs";
import { getShortErrorMsg } from "./getShortErrorMsg.mjs";
import { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap } from "./desc.mjs";
export { BUILD_001, BUILD_002, type BundlerName, type MFBuildArtifacts, type MFBundlerInfo, type MFConfigInfo, type MFContext, type MFEnvironmentInfo, type MFLatestErrorEvent, type MFProjectInfo, type MFRemoteEntry, type MFRole, type MFSharedEntry, type PackageManager, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001, buildDescMap, errorDescMap, getShortErrorMsg, runtimeDescMap, typeDescMap };

View File

@@ -0,0 +1,5 @@
import { BundlerName, MFBuildArtifacts, MFBundlerInfo, MFConfigInfo, MFContext, MFEnvironmentInfo, MFLatestErrorEvent, MFProjectInfo, MFRemoteEntry, MFRole, MFSharedEntry, PackageManager } from "./MFContext.js";
import { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 } from "./error-codes.js";
import { getShortErrorMsg } from "./getShortErrorMsg.js";
import { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap } from "./desc.js";
export { BUILD_001, BUILD_002, type BundlerName, type MFBuildArtifacts, type MFBundlerInfo, type MFConfigInfo, type MFContext, type MFEnvironmentInfo, type MFLatestErrorEvent, type MFProjectInfo, type MFRemoteEntry, type MFRole, type MFSharedEntry, type PackageManager, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001, buildDescMap, errorDescMap, getShortErrorMsg, runtimeDescMap, typeDescMap };

View File

@@ -0,0 +1,5 @@
import { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001 } from "./error-codes.mjs";
import { getShortErrorMsg } from "./getShortErrorMsg.mjs";
import { buildDescMap, errorDescMap, runtimeDescMap, typeDescMap } from "./desc.mjs";
export { BUILD_001, BUILD_002, RUNTIME_001, RUNTIME_002, RUNTIME_003, RUNTIME_004, RUNTIME_005, RUNTIME_006, RUNTIME_007, RUNTIME_008, RUNTIME_009, RUNTIME_010, RUNTIME_011, RUNTIME_012, RUNTIME_013, RUNTIME_014, RUNTIME_015, TYPE_001, buildDescMap, errorDescMap, getShortErrorMsg, runtimeDescMap, typeDescMap };

View File

@@ -0,0 +1,34 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
const require_getShortErrorMsg = require('./getShortErrorMsg.cjs');
let fs = require("fs");
fs = require_runtime.__toESM(fs);
let path = require("path");
path = require_runtime.__toESM(path);
//#region src/node.ts
function reportDiagnostic(code, message, args, context) {
try {
const dir = path.default.resolve(process.cwd(), ".mf", "diagnostics");
fs.default.mkdirSync(dir, { recursive: true });
const output = {
...context,
latestErrorEvent: {
code,
message,
args,
timestamp: Date.now()
}
};
fs.default.writeFileSync(path.default.join(dir, "latest.json"), JSON.stringify(output, null, 2));
} catch {}
}
function logAndReport(code, descMap, args, logger, originalErrorMsg, context) {
const msg = require_getShortErrorMsg.getShortErrorMsg(code, descMap, args, originalErrorMsg);
reportDiagnostic(code, msg, args, context);
return logger(msg);
}
//#endregion
exports.logAndReport = logAndReport;
//# sourceMappingURL=node.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node.cjs","names":["getShortErrorMsg"],"sources":["../src/node.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { getShortErrorMsg } from './getShortErrorMsg';\nimport type { MFContext } from './MFContext';\n\nfunction reportDiagnostic(\n code: string,\n message: string,\n args: Record<string, unknown>,\n context?: Partial<MFContext>,\n): void {\n try {\n const dir = path.resolve(process.cwd(), '.mf', 'diagnostics');\n fs.mkdirSync(dir, { recursive: true });\n const output: MFContext = {\n ...context,\n latestErrorEvent: { code, message, args, timestamp: Date.now() },\n };\n fs.writeFileSync(\n path.join(dir, 'latest.json'),\n JSON.stringify(output, null, 2),\n );\n } catch {\n // noop - don't let diagnostic writing fail the build\n }\n}\n\nexport function logAndReport<T extends (msg: string) => unknown>(\n code: string,\n descMap: Record<string, string>,\n args: Record<string, unknown>,\n logger: T,\n originalErrorMsg?: string,\n context?: Partial<MFContext>,\n): ReturnType<T> {\n const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);\n reportDiagnostic(code, msg, args, context);\n return logger(msg) as ReturnType<T>;\n}\n"],"mappings":";;;;;;;;;AAKA,SAAS,iBACP,MACA,SACA,MACA,SACM;AACN,KAAI;EACF,MAAM,MAAM,aAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,cAAc;AAC7D,aAAG,UAAU,KAAK,EAAE,WAAW,MAAM,CAAC;EACtC,MAAM,SAAoB;GACxB,GAAG;GACH,kBAAkB;IAAE;IAAM;IAAS;IAAM,WAAW,KAAK,KAAK;IAAE;GACjE;AACD,aAAG,cACD,aAAK,KAAK,KAAK,cAAc,EAC7B,KAAK,UAAU,QAAQ,MAAM,EAAE,CAChC;SACK;;AAKV,SAAgB,aACd,MACA,SACA,MACA,QACA,kBACA,SACe;CACf,MAAM,MAAMA,0CAAiB,MAAM,SAAS,MAAM,iBAAiB;AACnE,kBAAiB,MAAM,KAAK,MAAM,QAAQ;AAC1C,QAAO,OAAO,IAAI"}

View File

@@ -0,0 +1,7 @@
import { MFContext } from "./MFContext.mjs";
//#region src/node.d.ts
declare function logAndReport<T extends (msg: string) => unknown>(code: string, descMap: Record<string, string>, args: Record<string, unknown>, logger: T, originalErrorMsg?: string, context?: Partial<MFContext>): ReturnType<T>;
//#endregion
export { logAndReport };
//# sourceMappingURL=node.d.mts.map

View File

@@ -0,0 +1,7 @@
import { MFContext } from "./MFContext.js";
//#region src/node.d.ts
declare function logAndReport<T extends (msg: string) => unknown>(code: string, descMap: Record<string, string>, args: Record<string, unknown>, logger: T, originalErrorMsg?: string, context?: Partial<MFContext>): ReturnType<T>;
//#endregion
export { logAndReport };
//# sourceMappingURL=node.d.ts.map

View File

@@ -0,0 +1,30 @@
import { getShortErrorMsg } from "./getShortErrorMsg.mjs";
import fs from "fs";
import path from "path";
//#region src/node.ts
function reportDiagnostic(code, message, args, context) {
try {
const dir = path.resolve(process.cwd(), ".mf", "diagnostics");
fs.mkdirSync(dir, { recursive: true });
const output = {
...context,
latestErrorEvent: {
code,
message,
args,
timestamp: Date.now()
}
};
fs.writeFileSync(path.join(dir, "latest.json"), JSON.stringify(output, null, 2));
} catch {}
}
function logAndReport(code, descMap, args, logger, originalErrorMsg, context) {
const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);
reportDiagnostic(code, msg, args, context);
return logger(msg);
}
//#endregion
export { logAndReport };
//# sourceMappingURL=node.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node.mjs","names":[],"sources":["../src/node.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { getShortErrorMsg } from './getShortErrorMsg';\nimport type { MFContext } from './MFContext';\n\nfunction reportDiagnostic(\n code: string,\n message: string,\n args: Record<string, unknown>,\n context?: Partial<MFContext>,\n): void {\n try {\n const dir = path.resolve(process.cwd(), '.mf', 'diagnostics');\n fs.mkdirSync(dir, { recursive: true });\n const output: MFContext = {\n ...context,\n latestErrorEvent: { code, message, args, timestamp: Date.now() },\n };\n fs.writeFileSync(\n path.join(dir, 'latest.json'),\n JSON.stringify(output, null, 2),\n );\n } catch {\n // noop - don't let diagnostic writing fail the build\n }\n}\n\nexport function logAndReport<T extends (msg: string) => unknown>(\n code: string,\n descMap: Record<string, string>,\n args: Record<string, unknown>,\n logger: T,\n originalErrorMsg?: string,\n context?: Partial<MFContext>,\n): ReturnType<T> {\n const msg = getShortErrorMsg(code, descMap, args, originalErrorMsg);\n reportDiagnostic(code, msg, args, context);\n return logger(msg) as ReturnType<T>;\n}\n"],"mappings":";;;;;AAKA,SAAS,iBACP,MACA,SACA,MACA,SACM;AACN,KAAI;EACF,MAAM,MAAM,KAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,cAAc;AAC7D,KAAG,UAAU,KAAK,EAAE,WAAW,MAAM,CAAC;EACtC,MAAM,SAAoB;GACxB,GAAG;GACH,kBAAkB;IAAE;IAAM;IAAS;IAAM,WAAW,KAAK,KAAK;IAAE;GACjE;AACD,KAAG,cACD,KAAK,KAAK,KAAK,cAAc,EAC7B,KAAK,UAAU,QAAQ,MAAM,EAAE,CAChC;SACK;;AAKV,SAAgB,aACd,MACA,SACA,MACA,QACA,kBACA,SACe;CACf,MAAM,MAAM,iBAAiB,MAAM,SAAS,MAAM,iBAAiB;AACnE,kBAAiB,MAAM,KAAK,MAAM,QAAQ;AAC1C,QAAO,OAAO,IAAI"}

View File

@@ -0,0 +1,83 @@
{
"name": "@module-federation/error-codes",
"description": "Module Federation Error Codes",
"author": "zhanghang <hanric.zhang@gmail.com>",
"public": true,
"sideEffects": false,
"version": "2.5.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/module-federation/core.git",
"directory": "packages/error-codes"
},
"keywords": [
"Module Federation",
"error codes"
],
"files": [
"dist/",
"README.md"
],
"publishConfig": {
"access": "public"
},
"browser": {
"url": false
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
}
},
"./browser": {
"import": {
"types": "./dist/browser.d.mts",
"default": "./dist/browser.mjs"
},
"require": {
"types": "./dist/browser.d.ts",
"default": "./dist/browser.cjs"
}
},
"./node": {
"import": {
"types": "./dist/node.d.mts",
"default": "./dist/node.mjs"
},
"require": {
"types": "./dist/node.d.ts",
"default": "./dist/node.cjs"
}
}
},
"typesVersions": {
"*": {
".": [
"./dist/index.d.ts"
],
"browser": [
"./dist/browser.d.ts"
],
"node": [
"./dist/node.d.ts"
]
}
},
"scripts": {
"build": "tsdown --config tsdown.config.ts --filter error-codes-build",
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
"test": "pnpm exec jest --config jest.config.js --passWithNoTests",
"test:ci": "pnpm exec jest --config jest.config.js --passWithNoTests --ci --coverage",
"pre-release": "pnpm run test && pnpm run build"
}
}