$ cnpm install @module-federation/sdk
@module-federation/sdk Documentation// The SDK can be used to parse entry strings, encode and decode module names, and generate filenames for exposed modules and shared packages.
// It also includes a logger for debugging and environment detection utilities.
// Additionally, it provides a function to generate a snapshot from a manifest and environment detection utilities.
import { parseEntry, encodeName, decodeName, generateExposeFilename, generateShareFilename, createLogger, isBrowserEnv, isBrowserEnvValue, isDebugMode, getProcessEnv, generateSnapshotFromManifest } from '@module-federation/sdk';
// Parse an entry string into a RemoteEntryInfo object
parseEntry('entryString');
// Encode a module name with a prefix and optional extension
encodeName('moduleName', 'prefix');
// Decode a module name with a prefix and optional extension
decodeName('encodedModuleName', 'prefix');
// Generate a filename for an exposed module
generateExposeFilename('exposeName', true);
// Generate a filename for a shared package
generateShareFilename('packageName', true);
// Create a logger
const logger = createLogger('identifier');
// Check if the current environment is a browser
const inBrowser = isBrowserEnv();
const inBrowserStatic = isBrowserEnvValue;
// Check if the current environment is in debug mode
isDebugMode();
// Get the process environment
getProcessEnv();
// Generate a snapshot from a manifest
generateSnapshotFromManifest(manifest, options);
parseEntry(str: string, devVerOrUrl?: string, separator?: string)encodeName(name: string, prefix?: string, withExt?: boolean)decodeName(name: string, prefix?: string, withExt?: boolean)generateExposeFilename(exposeName: string, withExt: boolean)generateShareFilename(pkgName: string, withExt: boolean)createLogger(prefix: string)isBrowserEnv(): booleanisBrowserEnvValue: booleanisDebugMode()getProcessEnv()generateSnapshotFromManifest(manifest: Manifest, options?: IOptions)The SDK uses Jest for testing. The configuration can be found in jest.config.js. The tests are located in the tests directory.
Copyright 2013 - present © cnpmjs.org | Home |